aboutsummaryrefslogtreecommitdiff
path: root/bip39-standalone.html
diff options
context:
space:
mode:
authorIan Coleman <coleman.ian@gmail.com>2015-08-16 18:58:42 +1000
committerIan Coleman <coleman.ian@gmail.com>2015-08-16 19:03:05 +1000
commitab78acc683cf497b1b910e85fbbb77703401da6d (patch)
treed25b935649cc109f01066f7f7686202c86a7109b /bip39-standalone.html
parentc90c680e13cc1c51f53479ed9427ca60c5ec5a0c (diff)
downloadBIP39-ab78acc683cf497b1b910e85fbbb77703401da6d.tar.gz
BIP39-ab78acc683cf497b1b910e85fbbb77703401da6d.tar.zst
BIP39-ab78acc683cf497b1b910e85fbbb77703401da6d.zip
compile.py generates bip39-standalone.html
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r--bip39-standalone.html36677
1 files changed, 8691 insertions, 27986 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html
index 910230a..90d2246 100644
--- a/bip39-standalone.html
+++ b/bip39-standalone.html
@@ -3,6211 +3,11 @@
3 <head lang="en"> 3 <head lang="en">
4 <meta charset="utf-8" /> 4 <meta charset="utf-8" />
5 <title>BIP39 - Mnemonic Code</title> 5 <title>BIP39 - Mnemonic Code</title>
6 <style> 6 <style>/*!
7/*!
8 * Bootstrap v3.2.0 (http://getbootstrap.com) 7 * Bootstrap v3.2.0 (http://getbootstrap.com)
9 * Copyright 2011-2014 Twitter, Inc. 8 * Copyright 2011-2014 Twitter, Inc.
10 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 9 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
11 */ 10 *//*! normalize.css v3.0.1 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background:0 0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:before,:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.img-responsive,.thumbnail>img,.thumbnail a>img,.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;width:100% \9;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;width:100% \9;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:400;line-height:1;color:#777}h1,.h1,h2,.h2,h3,.h3{margin-top:20px;margin-bottom:10px}h1 small,.h1 small,h2 small,.h2 small,h3 small,.h3 small,h1 .small,.h1 .small,h2 .small,.h2 .small,h3 .small,.h3 .small{font-size:65%}h4,.h4,h5,.h5,h6,.h6{margin-top:10px;margin-bottom:10px}h4 small,.h4 small,h5 small,.h5 small,h6 small,.h6 small,h4 .small,.h4 .small,h5 .small,.h5 .small,h6 .small,.h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}mark,.mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#428bca}a.text-primary:hover{color:#3071a9}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#428bca}a.bg-primary:hover{background-color:#3071a9}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dt,dd{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote p:last-child,blockquote ul:last-child,blockquote ol:last-child{margin-bottom:0}blockquote footer,blockquote small,blockquote .small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote footer:before,blockquote small:before,blockquote .small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse footer:before,blockquote.pull-right footer:before,.blockquote-reverse small:before,blockquote.pull-right small:before,.blockquote-reverse .small:before,blockquote.pull-right .small:before{content:''}.blockquote-reverse footer:after,blockquote.pull-right footer:after,.blockquote-reverse small:after,blockquote.pull-right small:after,.blockquote-reverse .small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11,.col-xs-12{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11,.col-sm-12{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11,.col-md-12{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11,.col-lg-12{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover,.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr.active:hover>th{background-color:#e8e8e8}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.info,.table>tbody>tr>td.info,.table>tfoot>tr>td.info,.table>thead>tr>th.info,.table>tbody>tr>th.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>tbody>tr.info>td,.table>tfoot>tr.info>td,.table>thead>tr.info>th,.table>tbody>tr.info>th,.table>tfoot>tr.info>th{background-color:#d9edf7}.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover,.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr.info:hover>th{background-color:#c4e3f3}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=radio],input[type=checkbox]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=radio]:focus,input[type=checkbox]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#777;opacity:1}.form-control:-ms-input-placeholder{color:#777}.form-control::-webkit-input-placeholder{color:#777}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee;opacity:1}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px;line-height:1.42857143 \0}input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}.form-group{margin-bottom:15px}.radio,.checkbox{position:relative;display:block;min-height:20px;margin-top:10px;margin-bottom:10px}.radio label,.checkbox label{padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.radio input[type=radio],.radio-inline input[type=radio],.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox]{position:absolute;margin-top:4px \9;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type=radio][disabled],input[type=checkbox][disabled],input[type=radio].disabled,input[type=checkbox].disabled,fieldset[disabled] input[type=radio],fieldset[disabled] input[type=checkbox]{cursor:not-allowed}.radio-inline.disabled,.checkbox-inline.disabled,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.radio.disabled label,.checkbox.disabled label,fieldset[disabled] .radio label,fieldset[disabled] .checkbox label{cursor:not-allowed}.form-control-static{padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm,.form-horizontal .form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm,select[multiple].input-sm{height:auto}.input-lg,.form-horizontal .form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:46px;line-height:46px}textarea.input-lg,select[multiple].input-lg{height:auto}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:25px;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn,.form-inline .input-group .form-control{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .radio,.form-inline .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .radio label,.form-inline .checkbox label{padding-left:0}.form-inline .radio input[type=radio],.form-inline .checkbox input[type=checkbox]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .radio,.form-horizontal .checkbox{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{top:0;right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.3px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn:focus,.btn:active:focus,.btn.active:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default:active,.btn-default.active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#3071a9;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-primary .badge{color:#428bca;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success:active,.btn-success.active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info:active,.btn-info.active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#428bca;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#777;text-decoration:none}.btn-lg,.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs,.btn-group-xs>.btn{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=submit].btn-block,input[type=reset].btn-block,input[type=button].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#777}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn>input[type=radio],[data-toggle=buttons]>.btn>input[type=checkbox]{position:absolute;z-index:-1;filter:alpha(opacity=0);opacity:0}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn,select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn,select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=radio],.input-group-addon input[type=checkbox]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle),.input-group-btn:last-child>.btn-group:not(:last-child)>.btn{border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:first-child>.btn-group:not(:first-child)>.btn{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:hover,.input-group-btn>.btn:focus,.input-group-btn>.btn:active{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:340px}@media (max-width:480px) and (orientation:landscape){.navbar-fixed-top .navbar-collapse,.navbar-fixed-bottom .navbar-collapse{max-height:200px}}.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container>.navbar-header,.container-fluid>.navbar-header,.container>.navbar-collapse,.container-fluid>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@media (min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}.navbar-nav.navbar-right:last-child{margin-right:-15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn,.navbar-form .input-group .form-control{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .radio label,.navbar-form .checkbox label{padding-left:0}.navbar-form .radio input[type=radio],.navbar-form .checkbox input[type=checkbox]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-form.navbar-right:last-child{margin-right:-15px}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}.navbar-text.navbar-right:last-child{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:hover,.navbar-default .btn-link:focus{color:#333}.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:hover,.navbar-default .btn-link[disabled]:focus,fieldset[disabled] .navbar-default .btn-link:focus{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#777}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#777}.navbar-inverse .navbar-nav>li>a{color:#777}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#777}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#777}.navbar-inverse .btn-link:hover,.navbar-inverse .btn-link:focus{color:#fff}.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:hover,.navbar-inverse .btn-link[disabled]:focus,fieldset[disabled] .navbar-inverse .btn-link:focus{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#428bca;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{color:#2a6496;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:hover,a.label:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:hover,.label-default[href]:focus{background-color:#5e5e5e}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-xs .badge{top:0;padding:1px 5px}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron h1,.jumbotron .h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1,.jumbotron .h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img,.thumbnail a>img{margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar,.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress.active .progress-bar,.progress-bar.active{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar[aria-valuenow="1"],.progress-bar[aria-valuenow="2"]{min-width:30px}.progress-bar[aria-valuenow="0"]{min-width:30px;color:#777;background-color:transparent;background-image:none;-webkit-box-shadow:none;box-shadow:none}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:hover,.list-group-item.disabled:focus{color:#777;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}.list-group-item.active .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>.small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:hover .list-group-item-text,.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:hover,a.list-group-item-success:focus{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:hover,a.list-group-item-success.active:focus{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:hover,a.list-group-item-info:focus{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:hover,a.list-group-item-info.active:focus{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:hover,a.list-group-item-warning:focus{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:hover,a.list-group-item-warning.active:focus{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:hover,a.list-group-item-danger:focus{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:hover,a.list-group-item-danger.active:focus{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.table,.panel>.table-responsive>.table,.panel>.panel-collapse>.table{margin-bottom:0}.panel>.table:first-child,.panel>.table-responsive:first-child>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table:last-child,.panel>.table-responsive:last-child>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child th,.panel>.table>tbody:first-child>tr:first-child td{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#428bca}.panel-primary>.panel-heading .badge{color:#428bca;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive iframe,.embed-responsive embed,.embed-responsive object{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate3d(0,-25%,0);-o-transform:translate3d(0,-25%,0);transform:translate3d(0,-25%,0)}.modal.in .modal-dialog{-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-size:12px;line-height:1.4;visibility:visible;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:400;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%;margin-left:-10px}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%;margin-right:-10px}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after,.dl-horizontal dd:before,.dl-horizontal dd:after,.container:before,.container:after,.container-fluid:before,.container-fluid:after,.row:before,.row:after,.form-horizontal .form-group:before,.form-horizontal .form-group:after,.btn-toolbar:before,.btn-toolbar:after,.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after,.nav:before,.nav:after,.navbar:before,.navbar:after,.navbar-header:before,.navbar-header:after,.navbar-collapse:before,.navbar-collapse:after,.pager:before,.pager:after,.panel-body:before,.panel-body:after,.modal-footer:before,.modal-footer:after{display:table;content:" "}.clearfix:after,.dl-horizontal dd:after,.container:after,.container-fluid:after,.row:after,.form-horizontal .form-group:after,.btn-toolbar:after,.btn-group-vertical>.btn-group:after,.nav:after,.navbar:after,.navbar-header:after,.navbar-collapse:after,.pager:after,.panel-body:after,.modal-footer:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed;-webkit-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}@-ms-viewport{width:device-width}.visible-xs,.visible-sm,.visible-md,.visible-lg{display:none!important}.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}}</style>
12
13/*! normalize.css v3.0.1 | MIT License | git.io/normalize */
14html {
15 font-family: sans-serif;
16 -webkit-text-size-adjust: 100%;
17 -ms-text-size-adjust: 100%;
18}
19body {
20 margin: 0;
21}
22article,
23aside,
24details,
25figcaption,
26figure,
27footer,
28header,
29hgroup,
30main,
31nav,
32section,
33summary {
34 display: block;
35}
36audio,
37canvas,
38progress,
39video {
40 display: inline-block;
41 vertical-align: baseline;
42}
43audio:not([controls]) {
44 display: none;
45 height: 0;
46}
47[hidden],
48template {
49 display: none;
50}
51a {
52 background: transparent;
53}
54a:active,
55a:hover {
56 outline: 0;
57}
58abbr[title] {
59 border-bottom: 1px dotted;
60}
61b,
62strong {
63 font-weight: bold;
64}
65dfn {
66 font-style: italic;
67}
68h1 {
69 margin: .67em 0;
70 font-size: 2em;
71}
72mark {
73 color: #000;
74 background: #ff0;
75}
76small {
77 font-size: 80%;
78}
79sub,
80sup {
81 position: relative;
82 font-size: 75%;
83 line-height: 0;
84 vertical-align: baseline;
85}
86sup {
87 top: -.5em;
88}
89sub {
90 bottom: -.25em;
91}
92img {
93 border: 0;
94}
95svg:not(:root) {
96 overflow: hidden;
97}
98figure {
99 margin: 1em 40px;
100}
101hr {
102 height: 0;
103 -webkit-box-sizing: content-box;
104 -moz-box-sizing: content-box;
105 box-sizing: content-box;
106}
107pre {
108 overflow: auto;
109}
110code,
111kbd,
112pre,
113samp {
114 font-family: monospace, monospace;
115 font-size: 1em;
116}
117button,
118input,
119optgroup,
120select,
121textarea {
122 margin: 0;
123 font: inherit;
124 color: inherit;
125}
126button {
127 overflow: visible;
128}
129button,
130select {
131 text-transform: none;
132}
133button,
134html input[type="button"],
135input[type="reset"],
136input[type="submit"] {
137 -webkit-appearance: button;
138 cursor: pointer;
139}
140button[disabled],
141html input[disabled] {
142 cursor: default;
143}
144button::-moz-focus-inner,
145input::-moz-focus-inner {
146 padding: 0;
147 border: 0;
148}
149input {
150 line-height: normal;
151}
152input[type="checkbox"],
153input[type="radio"] {
154 -webkit-box-sizing: border-box;
155 -moz-box-sizing: border-box;
156 box-sizing: border-box;
157 padding: 0;
158}
159input[type="number"]::-webkit-inner-spin-button,
160input[type="number"]::-webkit-outer-spin-button {
161 height: auto;
162}
163input[type="search"] {
164 -webkit-box-sizing: content-box;
165 -moz-box-sizing: content-box;
166 box-sizing: content-box;
167 -webkit-appearance: textfield;
168}
169input[type="search"]::-webkit-search-cancel-button,
170input[type="search"]::-webkit-search-decoration {
171 -webkit-appearance: none;
172}
173fieldset {
174 padding: .35em .625em .75em;
175 margin: 0 2px;
176 border: 1px solid #c0c0c0;
177}
178legend {
179 padding: 0;
180 border: 0;
181}
182textarea {
183 overflow: auto;
184}
185optgroup {
186 font-weight: bold;
187}
188table {
189 border-spacing: 0;
190 border-collapse: collapse;
191}
192td,
193th {
194 padding: 0;
195}
196@media print {
197 * {
198 color: #000 !important;
199 text-shadow: none !important;
200 background: transparent !important;
201 -webkit-box-shadow: none !important;
202 box-shadow: none !important;
203 }
204 a,
205 a:visited {
206 text-decoration: underline;
207 }
208 a[href]:after {
209 content: " (" attr(href) ")";
210 }
211 abbr[title]:after {
212 content: " (" attr(title) ")";
213 }
214 a[href^="javascript:"]:after,
215 a[href^="#"]:after {
216 content: "";
217 }
218 pre,
219 blockquote {
220 border: 1px solid #999;
221
222 page-break-inside: avoid;
223 }
224 thead {
225 display: table-header-group;
226 }
227 tr,
228 img {
229 page-break-inside: avoid;
230 }
231 img {
232 max-width: 100% !important;
233 }
234 p,
235 h2,
236 h3 {
237 orphans: 3;
238 widows: 3;
239 }
240 h2,
241 h3 {
242 page-break-after: avoid;
243 }
244 select {
245 background: #fff !important;
246 }
247 .navbar {
248 display: none;
249 }
250 .table td,
251 .table th {
252 background-color: #fff !important;
253 }
254 .btn > .caret,
255 .dropup > .btn > .caret {
256 border-top-color: #000 !important;
257 }
258 .label {
259 border: 1px solid #000;
260 }
261 .table {
262 border-collapse: collapse !important;
263 }
264 .table-bordered th,
265 .table-bordered td {
266 border: 1px solid #ddd !important;
267 }
268}
269@font-face {
270 font-family: 'Glyphicons Halflings';
271
272 src: url('../fonts/glyphicons-halflings-regular.eot');
273 src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
274}
275.glyphicon {
276 position: relative;
277 top: 1px;
278 display: inline-block;
279 font-family: 'Glyphicons Halflings';
280 font-style: normal;
281 font-weight: normal;
282 line-height: 1;
283
284 -webkit-font-smoothing: antialiased;
285 -moz-osx-font-smoothing: grayscale;
286}
287.glyphicon-asterisk:before {
288 content: "\2a";
289}
290.glyphicon-plus:before {
291 content: "\2b";
292}
293.glyphicon-euro:before {
294 content: "\20ac";
295}
296.glyphicon-minus:before {
297 content: "\2212";
298}
299.glyphicon-cloud:before {
300 content: "\2601";
301}
302.glyphicon-envelope:before {
303 content: "\2709";
304}
305.glyphicon-pencil:before {
306 content: "\270f";
307}
308.glyphicon-glass:before {
309 content: "\e001";
310}
311.glyphicon-music:before {
312 content: "\e002";
313}
314.glyphicon-search:before {
315 content: "\e003";
316}
317.glyphicon-heart:before {
318 content: "\e005";
319}
320.glyphicon-star:before {
321 content: "\e006";
322}
323.glyphicon-star-empty:before {
324 content: "\e007";
325}
326.glyphicon-user:before {
327 content: "\e008";
328}
329.glyphicon-film:before {
330 content: "\e009";
331}
332.glyphicon-th-large:before {
333 content: "\e010";
334}
335.glyphicon-th:before {
336 content: "\e011";
337}
338.glyphicon-th-list:before {
339 content: "\e012";
340}
341.glyphicon-ok:before {
342 content: "\e013";
343}
344.glyphicon-remove:before {
345 content: "\e014";
346}
347.glyphicon-zoom-in:before {
348 content: "\e015";
349}
350.glyphicon-zoom-out:before {
351 content: "\e016";
352}
353.glyphicon-off:before {
354 content: "\e017";
355}
356.glyphicon-signal:before {
357 content: "\e018";
358}
359.glyphicon-cog:before {
360 content: "\e019";
361}
362.glyphicon-trash:before {
363 content: "\e020";
364}
365.glyphicon-home:before {
366 content: "\e021";
367}
368.glyphicon-file:before {
369 content: "\e022";
370}
371.glyphicon-time:before {
372 content: "\e023";
373}
374.glyphicon-road:before {
375 content: "\e024";
376}
377.glyphicon-download-alt:before {
378 content: "\e025";
379}
380.glyphicon-download:before {
381 content: "\e026";
382}
383.glyphicon-upload:before {
384 content: "\e027";
385}
386.glyphicon-inbox:before {
387 content: "\e028";
388}
389.glyphicon-play-circle:before {
390 content: "\e029";
391}
392.glyphicon-repeat:before {
393 content: "\e030";
394}
395.glyphicon-refresh:before {
396 content: "\e031";
397}
398.glyphicon-list-alt:before {
399 content: "\e032";
400}
401.glyphicon-lock:before {
402 content: "\e033";
403}
404.glyphicon-flag:before {
405 content: "\e034";
406}
407.glyphicon-headphones:before {
408 content: "\e035";
409}
410.glyphicon-volume-off:before {
411 content: "\e036";
412}
413.glyphicon-volume-down:before {
414 content: "\e037";
415}
416.glyphicon-volume-up:before {
417 content: "\e038";
418}
419.glyphicon-qrcode:before {
420 content: "\e039";
421}
422.glyphicon-barcode:before {
423 content: "\e040";
424}
425.glyphicon-tag:before {
426 content: "\e041";
427}
428.glyphicon-tags:before {
429 content: "\e042";
430}
431.glyphicon-book:before {
432 content: "\e043";
433}
434.glyphicon-bookmark:before {
435 content: "\e044";
436}
437.glyphicon-print:before {
438 content: "\e045";
439}
440.glyphicon-camera:before {
441 content: "\e046";
442}
443.glyphicon-font:before {
444 content: "\e047";
445}
446.glyphicon-bold:before {
447 content: "\e048";
448}
449.glyphicon-italic:before {
450 content: "\e049";
451}
452.glyphicon-text-height:before {
453 content: "\e050";
454}
455.glyphicon-text-width:before {
456 content: "\e051";
457}
458.glyphicon-align-left:before {
459 content: "\e052";
460}
461.glyphicon-align-center:before {
462 content: "\e053";
463}
464.glyphicon-align-right:before {
465 content: "\e054";
466}
467.glyphicon-align-justify:before {
468 content: "\e055";
469}
470.glyphicon-list:before {
471 content: "\e056";
472}
473.glyphicon-indent-left:before {
474 content: "\e057";
475}
476.glyphicon-indent-right:before {
477 content: "\e058";
478}
479.glyphicon-facetime-video:before {
480 content: "\e059";
481}
482.glyphicon-picture:before {
483 content: "\e060";
484}
485.glyphicon-map-marker:before {
486 content: "\e062";
487}
488.glyphicon-adjust:before {
489 content: "\e063";
490}
491.glyphicon-tint:before {
492 content: "\e064";
493}
494.glyphicon-edit:before {
495 content: "\e065";
496}
497.glyphicon-share:before {
498 content: "\e066";
499}
500.glyphicon-check:before {
501 content: "\e067";
502}
503.glyphicon-move:before {
504 content: "\e068";
505}
506.glyphicon-step-backward:before {
507 content: "\e069";
508}
509.glyphicon-fast-backward:before {
510 content: "\e070";
511}
512.glyphicon-backward:before {
513 content: "\e071";
514}
515.glyphicon-play:before {
516 content: "\e072";
517}
518.glyphicon-pause:before {
519 content: "\e073";
520}
521.glyphicon-stop:before {
522 content: "\e074";
523}
524.glyphicon-forward:before {
525 content: "\e075";
526}
527.glyphicon-fast-forward:before {
528 content: "\e076";
529}
530.glyphicon-step-forward:before {
531 content: "\e077";
532}
533.glyphicon-eject:before {
534 content: "\e078";
535}
536.glyphicon-chevron-left:before {
537 content: "\e079";
538}
539.glyphicon-chevron-right:before {
540 content: "\e080";
541}
542.glyphicon-plus-sign:before {
543 content: "\e081";
544}
545.glyphicon-minus-sign:before {
546 content: "\e082";
547}
548.glyphicon-remove-sign:before {
549 content: "\e083";
550}
551.glyphicon-ok-sign:before {
552 content: "\e084";
553}
554.glyphicon-question-sign:before {
555 content: "\e085";
556}
557.glyphicon-info-sign:before {
558 content: "\e086";
559}
560.glyphicon-screenshot:before {
561 content: "\e087";
562}
563.glyphicon-remove-circle:before {
564 content: "\e088";
565}
566.glyphicon-ok-circle:before {
567 content: "\e089";
568}
569.glyphicon-ban-circle:before {
570 content: "\e090";
571}
572.glyphicon-arrow-left:before {
573 content: "\e091";
574}
575.glyphicon-arrow-right:before {
576 content: "\e092";
577}
578.glyphicon-arrow-up:before {
579 content: "\e093";
580}
581.glyphicon-arrow-down:before {
582 content: "\e094";
583}
584.glyphicon-share-alt:before {
585 content: "\e095";
586}
587.glyphicon-resize-full:before {
588 content: "\e096";
589}
590.glyphicon-resize-small:before {
591 content: "\e097";
592}
593.glyphicon-exclamation-sign:before {
594 content: "\e101";
595}
596.glyphicon-gift:before {
597 content: "\e102";
598}
599.glyphicon-leaf:before {
600 content: "\e103";
601}
602.glyphicon-fire:before {
603 content: "\e104";
604}
605.glyphicon-eye-open:before {
606 content: "\e105";
607}
608.glyphicon-eye-close:before {
609 content: "\e106";
610}
611.glyphicon-warning-sign:before {
612 content: "\e107";
613}
614.glyphicon-plane:before {
615 content: "\e108";
616}
617.glyphicon-calendar:before {
618 content: "\e109";
619}
620.glyphicon-random:before {
621 content: "\e110";
622}
623.glyphicon-comment:before {
624 content: "\e111";
625}
626.glyphicon-magnet:before {
627 content: "\e112";
628}
629.glyphicon-chevron-up:before {
630 content: "\e113";
631}
632.glyphicon-chevron-down:before {
633 content: "\e114";
634}
635.glyphicon-retweet:before {
636 content: "\e115";
637}
638.glyphicon-shopping-cart:before {
639 content: "\e116";
640}
641.glyphicon-folder-close:before {
642 content: "\e117";
643}
644.glyphicon-folder-open:before {
645 content: "\e118";
646}
647.glyphicon-resize-vertical:before {
648 content: "\e119";
649}
650.glyphicon-resize-horizontal:before {
651 content: "\e120";
652}
653.glyphicon-hdd:before {
654 content: "\e121";
655}
656.glyphicon-bullhorn:before {
657 content: "\e122";
658}
659.glyphicon-bell:before {
660 content: "\e123";
661}
662.glyphicon-certificate:before {
663 content: "\e124";
664}
665.glyphicon-thumbs-up:before {
666 content: "\e125";
667}
668.glyphicon-thumbs-down:before {
669 content: "\e126";
670}
671.glyphicon-hand-right:before {
672 content: "\e127";
673}
674.glyphicon-hand-left:before {
675 content: "\e128";
676}
677.glyphicon-hand-up:before {
678 content: "\e129";
679}
680.glyphicon-hand-down:before {
681 content: "\e130";
682}
683.glyphicon-circle-arrow-right:before {
684 content: "\e131";
685}
686.glyphicon-circle-arrow-left:before {
687 content: "\e132";
688}
689.glyphicon-circle-arrow-up:before {
690 content: "\e133";
691}
692.glyphicon-circle-arrow-down:before {
693 content: "\e134";
694}
695.glyphicon-globe:before {
696 content: "\e135";
697}
698.glyphicon-wrench:before {
699 content: "\e136";
700}
701.glyphicon-tasks:before {
702 content: "\e137";
703}
704.glyphicon-filter:before {
705 content: "\e138";
706}
707.glyphicon-briefcase:before {
708 content: "\e139";
709}
710.glyphicon-fullscreen:before {
711 content: "\e140";
712}
713.glyphicon-dashboard:before {
714 content: "\e141";
715}
716.glyphicon-paperclip:before {
717 content: "\e142";
718}
719.glyphicon-heart-empty:before {
720 content: "\e143";
721}
722.glyphicon-link:before {
723 content: "\e144";
724}
725.glyphicon-phone:before {
726 content: "\e145";
727}
728.glyphicon-pushpin:before {
729 content: "\e146";
730}
731.glyphicon-usd:before {
732 content: "\e148";
733}
734.glyphicon-gbp:before {
735 content: "\e149";
736}
737.glyphicon-sort:before {
738 content: "\e150";
739}
740.glyphicon-sort-by-alphabet:before {
741 content: "\e151";
742}
743.glyphicon-sort-by-alphabet-alt:before {
744 content: "\e152";
745}
746.glyphicon-sort-by-order:before {
747 content: "\e153";
748}
749.glyphicon-sort-by-order-alt:before {
750 content: "\e154";
751}
752.glyphicon-sort-by-attributes:before {
753 content: "\e155";
754}
755.glyphicon-sort-by-attributes-alt:before {
756 content: "\e156";
757}
758.glyphicon-unchecked:before {
759 content: "\e157";
760}
761.glyphicon-expand:before {
762 content: "\e158";
763}
764.glyphicon-collapse-down:before {
765 content: "\e159";
766}
767.glyphicon-collapse-up:before {
768 content: "\e160";
769}
770.glyphicon-log-in:before {
771 content: "\e161";
772}
773.glyphicon-flash:before {
774 content: "\e162";
775}
776.glyphicon-log-out:before {
777 content: "\e163";
778}
779.glyphicon-new-window:before {
780 content: "\e164";
781}
782.glyphicon-record:before {
783 content: "\e165";
784}
785.glyphicon-save:before {
786 content: "\e166";
787}
788.glyphicon-open:before {
789 content: "\e167";
790}
791.glyphicon-saved:before {
792 content: "\e168";
793}
794.glyphicon-import:before {
795 content: "\e169";
796}
797.glyphicon-export:before {
798 content: "\e170";
799}
800.glyphicon-send:before {
801 content: "\e171";
802}
803.glyphicon-floppy-disk:before {
804 content: "\e172";
805}
806.glyphicon-floppy-saved:before {
807 content: "\e173";
808}
809.glyphicon-floppy-remove:before {
810 content: "\e174";
811}
812.glyphicon-floppy-save:before {
813 content: "\e175";
814}
815.glyphicon-floppy-open:before {
816 content: "\e176";
817}
818.glyphicon-credit-card:before {
819 content: "\e177";
820}
821.glyphicon-transfer:before {
822 content: "\e178";
823}
824.glyphicon-cutlery:before {
825 content: "\e179";
826}
827.glyphicon-header:before {
828 content: "\e180";
829}
830.glyphicon-compressed:before {
831 content: "\e181";
832}
833.glyphicon-earphone:before {
834 content: "\e182";
835}
836.glyphicon-phone-alt:before {
837 content: "\e183";
838}
839.glyphicon-tower:before {
840 content: "\e184";
841}
842.glyphicon-stats:before {
843 content: "\e185";
844}
845.glyphicon-sd-video:before {
846 content: "\e186";
847}
848.glyphicon-hd-video:before {
849 content: "\e187";
850}
851.glyphicon-subtitles:before {
852 content: "\e188";
853}
854.glyphicon-sound-stereo:before {
855 content: "\e189";
856}
857.glyphicon-sound-dolby:before {
858 content: "\e190";
859}
860.glyphicon-sound-5-1:before {
861 content: "\e191";
862}
863.glyphicon-sound-6-1:before {
864 content: "\e192";
865}
866.glyphicon-sound-7-1:before {
867 content: "\e193";
868}
869.glyphicon-copyright-mark:before {
870 content: "\e194";
871}
872.glyphicon-registration-mark:before {
873 content: "\e195";
874}
875.glyphicon-cloud-download:before {
876 content: "\e197";
877}
878.glyphicon-cloud-upload:before {
879 content: "\e198";
880}
881.glyphicon-tree-conifer:before {
882 content: "\e199";
883}
884.glyphicon-tree-deciduous:before {
885 content: "\e200";
886}
887* {
888 -webkit-box-sizing: border-box;
889 -moz-box-sizing: border-box;
890 box-sizing: border-box;
891}
892*:before,
893*:after {
894 -webkit-box-sizing: border-box;
895 -moz-box-sizing: border-box;
896 box-sizing: border-box;
897}
898html {
899 font-size: 10px;
900
901 -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
902}
903body {
904 font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
905 font-size: 14px;
906 line-height: 1.42857143;
907 color: #333;
908 background-color: #fff;
909}
910input,
911button,
912select,
913textarea {
914 font-family: inherit;
915 font-size: inherit;
916 line-height: inherit;
917}
918a {
919 color: #428bca;
920 text-decoration: none;
921}
922a:hover,
923a:focus {
924 color: #2a6496;
925 text-decoration: underline;
926}
927a:focus {
928 outline: thin dotted;
929 outline: 5px auto -webkit-focus-ring-color;
930 outline-offset: -2px;
931}
932figure {
933 margin: 0;
934}
935img {
936 vertical-align: middle;
937}
938.img-responsive,
939.thumbnail > img,
940.thumbnail a > img,
941.carousel-inner > .item > img,
942.carousel-inner > .item > a > img {
943 display: block;
944 width: 100% \9;
945 max-width: 100%;
946 height: auto;
947}
948.img-rounded {
949 border-radius: 6px;
950}
951.img-thumbnail {
952 display: inline-block;
953 width: 100% \9;
954 max-width: 100%;
955 height: auto;
956 padding: 4px;
957 line-height: 1.42857143;
958 background-color: #fff;
959 border: 1px solid #ddd;
960 border-radius: 4px;
961 -webkit-transition: all .2s ease-in-out;
962 -o-transition: all .2s ease-in-out;
963 transition: all .2s ease-in-out;
964}
965.img-circle {
966 border-radius: 50%;
967}
968hr {
969 margin-top: 20px;
970 margin-bottom: 20px;
971 border: 0;
972 border-top: 1px solid #eee;
973}
974.sr-only {
975 position: absolute;
976 width: 1px;
977 height: 1px;
978 padding: 0;
979 margin: -1px;
980 overflow: hidden;
981 clip: rect(0, 0, 0, 0);
982 border: 0;
983}
984.sr-only-focusable:active,
985.sr-only-focusable:focus {
986 position: static;
987 width: auto;
988 height: auto;
989 margin: 0;
990 overflow: visible;
991 clip: auto;
992}
993h1,
994h2,
995h3,
996h4,
997h5,
998h6,
999.h1,
1000.h2,
1001.h3,
1002.h4,
1003.h5,
1004.h6 {
1005 font-family: inherit;
1006 font-weight: 500;
1007 line-height: 1.1;
1008 color: inherit;
1009}
1010h1 small,
1011h2 small,
1012h3 small,
1013h4 small,
1014h5 small,
1015h6 small,
1016.h1 small,
1017.h2 small,
1018.h3 small,
1019.h4 small,
1020.h5 small,
1021.h6 small,
1022h1 .small,
1023h2 .small,
1024h3 .small,
1025h4 .small,
1026h5 .small,
1027h6 .small,
1028.h1 .small,
1029.h2 .small,
1030.h3 .small,
1031.h4 .small,
1032.h5 .small,
1033.h6 .small {
1034 font-weight: normal;
1035 line-height: 1;
1036 color: #777;
1037}
1038h1,
1039.h1,
1040h2,
1041.h2,
1042h3,
1043.h3 {
1044 margin-top: 20px;
1045 margin-bottom: 10px;
1046}
1047h1 small,
1048.h1 small,
1049h2 small,
1050.h2 small,
1051h3 small,
1052.h3 small,
1053h1 .small,
1054.h1 .small,
1055h2 .small,
1056.h2 .small,
1057h3 .small,
1058.h3 .small {
1059 font-size: 65%;
1060}
1061h4,
1062.h4,
1063h5,
1064.h5,
1065h6,
1066.h6 {
1067 margin-top: 10px;
1068 margin-bottom: 10px;
1069}
1070h4 small,
1071.h4 small,
1072h5 small,
1073.h5 small,
1074h6 small,
1075.h6 small,
1076h4 .small,
1077.h4 .small,
1078h5 .small,
1079.h5 .small,
1080h6 .small,
1081.h6 .small {
1082 font-size: 75%;
1083}
1084h1,
1085.h1 {
1086 font-size: 36px;
1087}
1088h2,
1089.h2 {
1090 font-size: 30px;
1091}
1092h3,
1093.h3 {
1094 font-size: 24px;
1095}
1096h4,
1097.h4 {
1098 font-size: 18px;
1099}
1100h5,
1101.h5 {
1102 font-size: 14px;
1103}
1104h6,
1105.h6 {
1106 font-size: 12px;
1107}
1108p {
1109 margin: 0 0 10px;
1110}
1111.lead {
1112 margin-bottom: 20px;
1113 font-size: 16px;
1114 font-weight: 300;
1115 line-height: 1.4;
1116}
1117@media (min-width: 768px) {
1118 .lead {
1119 font-size: 21px;
1120 }
1121}
1122small,
1123.small {
1124 font-size: 85%;
1125}
1126cite {
1127 font-style: normal;
1128}
1129mark,
1130.mark {
1131 padding: .2em;
1132 background-color: #fcf8e3;
1133}
1134.text-left {
1135 text-align: left;
1136}
1137.text-right {
1138 text-align: right;
1139}
1140.text-center {
1141 text-align: center;
1142}
1143.text-justify {
1144 text-align: justify;
1145}
1146.text-nowrap {
1147 white-space: nowrap;
1148}
1149.text-lowercase {
1150 text-transform: lowercase;
1151}
1152.text-uppercase {
1153 text-transform: uppercase;
1154}
1155.text-capitalize {
1156 text-transform: capitalize;
1157}
1158.text-muted {
1159 color: #777;
1160}
1161.text-primary {
1162 color: #428bca;
1163}
1164a.text-primary:hover {
1165 color: #3071a9;
1166}
1167.text-success {
1168 color: #3c763d;
1169}
1170a.text-success:hover {
1171 color: #2b542c;
1172}
1173.text-info {
1174 color: #31708f;
1175}
1176a.text-info:hover {
1177 color: #245269;
1178}
1179.text-warning {
1180 color: #8a6d3b;
1181}
1182a.text-warning:hover {
1183 color: #66512c;
1184}
1185.text-danger {
1186 color: #a94442;
1187}
1188a.text-danger:hover {
1189 color: #843534;
1190}
1191.bg-primary {
1192 color: #fff;
1193 background-color: #428bca;
1194}
1195a.bg-primary:hover {
1196 background-color: #3071a9;
1197}
1198.bg-success {
1199 background-color: #dff0d8;
1200}
1201a.bg-success:hover {
1202 background-color: #c1e2b3;
1203}
1204.bg-info {
1205 background-color: #d9edf7;
1206}
1207a.bg-info:hover {
1208 background-color: #afd9ee;
1209}
1210.bg-warning {
1211 background-color: #fcf8e3;
1212}
1213a.bg-warning:hover {
1214 background-color: #f7ecb5;
1215}
1216.bg-danger {
1217 background-color: #f2dede;
1218}
1219a.bg-danger:hover {
1220 background-color: #e4b9b9;
1221}
1222.page-header {
1223 padding-bottom: 9px;
1224 margin: 40px 0 20px;
1225 border-bottom: 1px solid #eee;
1226}
1227ul,
1228ol {
1229 margin-top: 0;
1230 margin-bottom: 10px;
1231}
1232ul ul,
1233ol ul,
1234ul ol,
1235ol ol {
1236 margin-bottom: 0;
1237}
1238.list-unstyled {
1239 padding-left: 0;
1240 list-style: none;
1241}
1242.list-inline {
1243 padding-left: 0;
1244 margin-left: -5px;
1245 list-style: none;
1246}
1247.list-inline > li {
1248 display: inline-block;
1249 padding-right: 5px;
1250 padding-left: 5px;
1251}
1252dl {
1253 margin-top: 0;
1254 margin-bottom: 20px;
1255}
1256dt,
1257dd {
1258 line-height: 1.42857143;
1259}
1260dt {
1261 font-weight: bold;
1262}
1263dd {
1264 margin-left: 0;
1265}
1266@media (min-width: 768px) {
1267 .dl-horizontal dt {
1268 float: left;
1269 width: 160px;
1270 overflow: hidden;
1271 clear: left;
1272 text-align: right;
1273 text-overflow: ellipsis;
1274 white-space: nowrap;
1275 }
1276 .dl-horizontal dd {
1277 margin-left: 180px;
1278 }
1279}
1280abbr[title],
1281abbr[data-original-title] {
1282 cursor: help;
1283 border-bottom: 1px dotted #777;
1284}
1285.initialism {
1286 font-size: 90%;
1287 text-transform: uppercase;
1288}
1289blockquote {
1290 padding: 10px 20px;
1291 margin: 0 0 20px;
1292 font-size: 17.5px;
1293 border-left: 5px solid #eee;
1294}
1295blockquote p:last-child,
1296blockquote ul:last-child,
1297blockquote ol:last-child {
1298 margin-bottom: 0;
1299}
1300blockquote footer,
1301blockquote small,
1302blockquote .small {
1303 display: block;
1304 font-size: 80%;
1305 line-height: 1.42857143;
1306 color: #777;
1307}
1308blockquote footer:before,
1309blockquote small:before,
1310blockquote .small:before {
1311 content: '\2014 \00A0';
1312}
1313.blockquote-reverse,
1314blockquote.pull-right {
1315 padding-right: 15px;
1316 padding-left: 0;
1317 text-align: right;
1318 border-right: 5px solid #eee;
1319 border-left: 0;
1320}
1321.blockquote-reverse footer:before,
1322blockquote.pull-right footer:before,
1323.blockquote-reverse small:before,
1324blockquote.pull-right small:before,
1325.blockquote-reverse .small:before,
1326blockquote.pull-right .small:before {
1327 content: '';
1328}
1329.blockquote-reverse footer:after,
1330blockquote.pull-right footer:after,
1331.blockquote-reverse small:after,
1332blockquote.pull-right small:after,
1333.blockquote-reverse .small:after,
1334blockquote.pull-right .small:after {
1335 content: '\00A0 \2014';
1336}
1337blockquote:before,
1338blockquote:after {
1339 content: "";
1340}
1341address {
1342 margin-bottom: 20px;
1343 font-style: normal;
1344 line-height: 1.42857143;
1345}
1346code,
1347kbd,
1348pre,
1349samp {
1350 font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
1351}
1352code {
1353 padding: 2px 4px;
1354 font-size: 90%;
1355 color: #c7254e;
1356 background-color: #f9f2f4;
1357 border-radius: 4px;
1358}
1359kbd {
1360 padding: 2px 4px;
1361 font-size: 90%;
1362 color: #fff;
1363 background-color: #333;
1364 border-radius: 3px;
1365 -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);
1366 box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);
1367}
1368kbd kbd {
1369 padding: 0;
1370 font-size: 100%;
1371 -webkit-box-shadow: none;
1372 box-shadow: none;
1373}
1374pre {
1375 display: block;
1376 padding: 9.5px;
1377 margin: 0 0 10px;
1378 font-size: 13px;
1379 line-height: 1.42857143;
1380 color: #333;
1381 word-break: break-all;
1382 word-wrap: break-word;
1383 background-color: #f5f5f5;
1384 border: 1px solid #ccc;
1385 border-radius: 4px;
1386}
1387pre code {
1388 padding: 0;
1389 font-size: inherit;
1390 color: inherit;
1391 white-space: pre-wrap;
1392 background-color: transparent;
1393 border-radius: 0;
1394}
1395.pre-scrollable {
1396 max-height: 340px;
1397 overflow-y: scroll;
1398}
1399.container {
1400 padding-right: 15px;
1401 padding-left: 15px;
1402 margin-right: auto;
1403 margin-left: auto;
1404}
1405@media (min-width: 768px) {
1406 .container {
1407 width: 750px;
1408 }
1409}
1410@media (min-width: 992px) {
1411 .container {
1412 width: 970px;
1413 }
1414}
1415@media (min-width: 1200px) {
1416 .container {
1417 width: 1170px;
1418 }
1419}
1420.container-fluid {
1421 padding-right: 15px;
1422 padding-left: 15px;
1423 margin-right: auto;
1424 margin-left: auto;
1425}
1426.row {
1427 margin-right: -15px;
1428 margin-left: -15px;
1429}
1430.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
1431 position: relative;
1432 min-height: 1px;
1433 padding-right: 15px;
1434 padding-left: 15px;
1435}
1436.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
1437 float: left;
1438}
1439.col-xs-12 {
1440 width: 100%;
1441}
1442.col-xs-11 {
1443 width: 91.66666667%;
1444}
1445.col-xs-10 {
1446 width: 83.33333333%;
1447}
1448.col-xs-9 {
1449 width: 75%;
1450}
1451.col-xs-8 {
1452 width: 66.66666667%;
1453}
1454.col-xs-7 {
1455 width: 58.33333333%;
1456}
1457.col-xs-6 {
1458 width: 50%;
1459}
1460.col-xs-5 {
1461 width: 41.66666667%;
1462}
1463.col-xs-4 {
1464 width: 33.33333333%;
1465}
1466.col-xs-3 {
1467 width: 25%;
1468}
1469.col-xs-2 {
1470 width: 16.66666667%;
1471}
1472.col-xs-1 {
1473 width: 8.33333333%;
1474}
1475.col-xs-pull-12 {
1476 right: 100%;
1477}
1478.col-xs-pull-11 {
1479 right: 91.66666667%;
1480}
1481.col-xs-pull-10 {
1482 right: 83.33333333%;
1483}
1484.col-xs-pull-9 {
1485 right: 75%;
1486}
1487.col-xs-pull-8 {
1488 right: 66.66666667%;
1489}
1490.col-xs-pull-7 {
1491 right: 58.33333333%;
1492}
1493.col-xs-pull-6 {
1494 right: 50%;
1495}
1496.col-xs-pull-5 {
1497 right: 41.66666667%;
1498}
1499.col-xs-pull-4 {
1500 right: 33.33333333%;
1501}
1502.col-xs-pull-3 {
1503 right: 25%;
1504}
1505.col-xs-pull-2 {
1506 right: 16.66666667%;
1507}
1508.col-xs-pull-1 {
1509 right: 8.33333333%;
1510}
1511.col-xs-pull-0 {
1512 right: auto;
1513}
1514.col-xs-push-12 {
1515 left: 100%;
1516}
1517.col-xs-push-11 {
1518 left: 91.66666667%;
1519}
1520.col-xs-push-10 {
1521 left: 83.33333333%;
1522}
1523.col-xs-push-9 {
1524 left: 75%;
1525}
1526.col-xs-push-8 {
1527 left: 66.66666667%;
1528}
1529.col-xs-push-7 {
1530 left: 58.33333333%;
1531}
1532.col-xs-push-6 {
1533 left: 50%;
1534}
1535.col-xs-push-5 {
1536 left: 41.66666667%;
1537}
1538.col-xs-push-4 {
1539 left: 33.33333333%;
1540}
1541.col-xs-push-3 {
1542 left: 25%;
1543}
1544.col-xs-push-2 {
1545 left: 16.66666667%;
1546}
1547.col-xs-push-1 {
1548 left: 8.33333333%;
1549}
1550.col-xs-push-0 {
1551 left: auto;
1552}
1553.col-xs-offset-12 {
1554 margin-left: 100%;
1555}
1556.col-xs-offset-11 {
1557 margin-left: 91.66666667%;
1558}
1559.col-xs-offset-10 {
1560 margin-left: 83.33333333%;
1561}
1562.col-xs-offset-9 {
1563 margin-left: 75%;
1564}
1565.col-xs-offset-8 {
1566 margin-left: 66.66666667%;
1567}
1568.col-xs-offset-7 {
1569 margin-left: 58.33333333%;
1570}
1571.col-xs-offset-6 {
1572 margin-left: 50%;
1573}
1574.col-xs-offset-5 {
1575 margin-left: 41.66666667%;
1576}
1577.col-xs-offset-4 {
1578 margin-left: 33.33333333%;
1579}
1580.col-xs-offset-3 {
1581 margin-left: 25%;
1582}
1583.col-xs-offset-2 {
1584 margin-left: 16.66666667%;
1585}
1586.col-xs-offset-1 {
1587 margin-left: 8.33333333%;
1588}
1589.col-xs-offset-0 {
1590 margin-left: 0;
1591}
1592@media (min-width: 768px) {
1593 .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
1594 float: left;
1595 }
1596 .col-sm-12 {
1597 width: 100%;
1598 }
1599 .col-sm-11 {
1600 width: 91.66666667%;
1601 }
1602 .col-sm-10 {
1603 width: 83.33333333%;
1604 }
1605 .col-sm-9 {
1606 width: 75%;
1607 }
1608 .col-sm-8 {
1609 width: 66.66666667%;
1610 }
1611 .col-sm-7 {
1612 width: 58.33333333%;
1613 }
1614 .col-sm-6 {
1615 width: 50%;
1616 }
1617 .col-sm-5 {
1618 width: 41.66666667%;
1619 }
1620 .col-sm-4 {
1621 width: 33.33333333%;
1622 }
1623 .col-sm-3 {
1624 width: 25%;
1625 }
1626 .col-sm-2 {
1627 width: 16.66666667%;
1628 }
1629 .col-sm-1 {
1630 width: 8.33333333%;
1631 }
1632 .col-sm-pull-12 {
1633 right: 100%;
1634 }
1635 .col-sm-pull-11 {
1636 right: 91.66666667%;
1637 }
1638 .col-sm-pull-10 {
1639 right: 83.33333333%;
1640 }
1641 .col-sm-pull-9 {
1642 right: 75%;
1643 }
1644 .col-sm-pull-8 {
1645 right: 66.66666667%;
1646 }
1647 .col-sm-pull-7 {
1648 right: 58.33333333%;
1649 }
1650 .col-sm-pull-6 {
1651 right: 50%;
1652 }
1653 .col-sm-pull-5 {
1654 right: 41.66666667%;
1655 }
1656 .col-sm-pull-4 {
1657 right: 33.33333333%;
1658 }
1659 .col-sm-pull-3 {
1660 right: 25%;
1661 }
1662 .col-sm-pull-2 {
1663 right: 16.66666667%;
1664 }
1665 .col-sm-pull-1 {
1666 right: 8.33333333%;
1667 }
1668 .col-sm-pull-0 {
1669 right: auto;
1670 }
1671 .col-sm-push-12 {
1672 left: 100%;
1673 }
1674 .col-sm-push-11 {
1675 left: 91.66666667%;
1676 }
1677 .col-sm-push-10 {
1678 left: 83.33333333%;
1679 }
1680 .col-sm-push-9 {
1681 left: 75%;
1682 }
1683 .col-sm-push-8 {
1684 left: 66.66666667%;
1685 }
1686 .col-sm-push-7 {
1687 left: 58.33333333%;
1688 }
1689 .col-sm-push-6 {
1690 left: 50%;
1691 }
1692 .col-sm-push-5 {
1693 left: 41.66666667%;
1694 }
1695 .col-sm-push-4 {
1696 left: 33.33333333%;
1697 }
1698 .col-sm-push-3 {
1699 left: 25%;
1700 }
1701 .col-sm-push-2 {
1702 left: 16.66666667%;
1703 }
1704 .col-sm-push-1 {
1705 left: 8.33333333%;
1706 }
1707 .col-sm-push-0 {
1708 left: auto;
1709 }
1710 .col-sm-offset-12 {
1711 margin-left: 100%;
1712 }
1713 .col-sm-offset-11 {
1714 margin-left: 91.66666667%;
1715 }
1716 .col-sm-offset-10 {
1717 margin-left: 83.33333333%;
1718 }
1719 .col-sm-offset-9 {
1720 margin-left: 75%;
1721 }
1722 .col-sm-offset-8 {
1723 margin-left: 66.66666667%;
1724 }
1725 .col-sm-offset-7 {
1726 margin-left: 58.33333333%;
1727 }
1728 .col-sm-offset-6 {
1729 margin-left: 50%;
1730 }
1731 .col-sm-offset-5 {
1732 margin-left: 41.66666667%;
1733 }
1734 .col-sm-offset-4 {
1735 margin-left: 33.33333333%;
1736 }
1737 .col-sm-offset-3 {
1738 margin-left: 25%;
1739 }
1740 .col-sm-offset-2 {
1741 margin-left: 16.66666667%;
1742 }
1743 .col-sm-offset-1 {
1744 margin-left: 8.33333333%;
1745 }
1746 .col-sm-offset-0 {
1747 margin-left: 0;
1748 }
1749}
1750@media (min-width: 992px) {
1751 .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
1752 float: left;
1753 }
1754 .col-md-12 {
1755 width: 100%;
1756 }
1757 .col-md-11 {
1758 width: 91.66666667%;
1759 }
1760 .col-md-10 {
1761 width: 83.33333333%;
1762 }
1763 .col-md-9 {
1764 width: 75%;
1765 }
1766 .col-md-8 {
1767 width: 66.66666667%;
1768 }
1769 .col-md-7 {
1770 width: 58.33333333%;
1771 }
1772 .col-md-6 {
1773 width: 50%;
1774 }
1775 .col-md-5 {
1776 width: 41.66666667%;
1777 }
1778 .col-md-4 {
1779 width: 33.33333333%;
1780 }
1781 .col-md-3 {
1782 width: 25%;
1783 }
1784 .col-md-2 {
1785 width: 16.66666667%;
1786 }
1787 .col-md-1 {
1788 width: 8.33333333%;
1789 }
1790 .col-md-pull-12 {
1791 right: 100%;
1792 }
1793 .col-md-pull-11 {
1794 right: 91.66666667%;
1795 }
1796 .col-md-pull-10 {
1797 right: 83.33333333%;
1798 }
1799 .col-md-pull-9 {
1800 right: 75%;
1801 }
1802 .col-md-pull-8 {
1803 right: 66.66666667%;
1804 }
1805 .col-md-pull-7 {
1806 right: 58.33333333%;
1807 }
1808 .col-md-pull-6 {
1809 right: 50%;
1810 }
1811 .col-md-pull-5 {
1812 right: 41.66666667%;
1813 }
1814 .col-md-pull-4 {
1815 right: 33.33333333%;
1816 }
1817 .col-md-pull-3 {
1818 right: 25%;
1819 }
1820 .col-md-pull-2 {
1821 right: 16.66666667%;
1822 }
1823 .col-md-pull-1 {
1824 right: 8.33333333%;
1825 }
1826 .col-md-pull-0 {
1827 right: auto;
1828 }
1829 .col-md-push-12 {
1830 left: 100%;
1831 }
1832 .col-md-push-11 {
1833 left: 91.66666667%;
1834 }
1835 .col-md-push-10 {
1836 left: 83.33333333%;
1837 }
1838 .col-md-push-9 {
1839 left: 75%;
1840 }
1841 .col-md-push-8 {
1842 left: 66.66666667%;
1843 }
1844 .col-md-push-7 {
1845 left: 58.33333333%;
1846 }
1847 .col-md-push-6 {
1848 left: 50%;
1849 }
1850 .col-md-push-5 {
1851 left: 41.66666667%;
1852 }
1853 .col-md-push-4 {
1854 left: 33.33333333%;
1855 }
1856 .col-md-push-3 {
1857 left: 25%;
1858 }
1859 .col-md-push-2 {
1860 left: 16.66666667%;
1861 }
1862 .col-md-push-1 {
1863 left: 8.33333333%;
1864 }
1865 .col-md-push-0 {
1866 left: auto;
1867 }
1868 .col-md-offset-12 {
1869 margin-left: 100%;
1870 }
1871 .col-md-offset-11 {
1872 margin-left: 91.66666667%;
1873 }
1874 .col-md-offset-10 {
1875 margin-left: 83.33333333%;
1876 }
1877 .col-md-offset-9 {
1878 margin-left: 75%;
1879 }
1880 .col-md-offset-8 {
1881 margin-left: 66.66666667%;
1882 }
1883 .col-md-offset-7 {
1884 margin-left: 58.33333333%;
1885 }
1886 .col-md-offset-6 {
1887 margin-left: 50%;
1888 }
1889 .col-md-offset-5 {
1890 margin-left: 41.66666667%;
1891 }
1892 .col-md-offset-4 {
1893 margin-left: 33.33333333%;
1894 }
1895 .col-md-offset-3 {
1896 margin-left: 25%;
1897 }
1898 .col-md-offset-2 {
1899 margin-left: 16.66666667%;
1900 }
1901 .col-md-offset-1 {
1902 margin-left: 8.33333333%;
1903 }
1904 .col-md-offset-0 {
1905 margin-left: 0;
1906 }
1907}
1908@media (min-width: 1200px) {
1909 .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {
1910 float: left;
1911 }
1912 .col-lg-12 {
1913 width: 100%;
1914 }
1915 .col-lg-11 {
1916 width: 91.66666667%;
1917 }
1918 .col-lg-10 {
1919 width: 83.33333333%;
1920 }
1921 .col-lg-9 {
1922 width: 75%;
1923 }
1924 .col-lg-8 {
1925 width: 66.66666667%;
1926 }
1927 .col-lg-7 {
1928 width: 58.33333333%;
1929 }
1930 .col-lg-6 {
1931 width: 50%;
1932 }
1933 .col-lg-5 {
1934 width: 41.66666667%;
1935 }
1936 .col-lg-4 {
1937 width: 33.33333333%;
1938 }
1939 .col-lg-3 {
1940 width: 25%;
1941 }
1942 .col-lg-2 {
1943 width: 16.66666667%;
1944 }
1945 .col-lg-1 {
1946 width: 8.33333333%;
1947 }
1948 .col-lg-pull-12 {
1949 right: 100%;
1950 }
1951 .col-lg-pull-11 {
1952 right: 91.66666667%;
1953 }
1954 .col-lg-pull-10 {
1955 right: 83.33333333%;
1956 }
1957 .col-lg-pull-9 {
1958 right: 75%;
1959 }
1960 .col-lg-pull-8 {
1961 right: 66.66666667%;
1962 }
1963 .col-lg-pull-7 {
1964 right: 58.33333333%;
1965 }
1966 .col-lg-pull-6 {
1967 right: 50%;
1968 }
1969 .col-lg-pull-5 {
1970 right: 41.66666667%;
1971 }
1972 .col-lg-pull-4 {
1973 right: 33.33333333%;
1974 }
1975 .col-lg-pull-3 {
1976 right: 25%;
1977 }
1978 .col-lg-pull-2 {
1979 right: 16.66666667%;
1980 }
1981 .col-lg-pull-1 {
1982 right: 8.33333333%;
1983 }
1984 .col-lg-pull-0 {
1985 right: auto;
1986 }
1987 .col-lg-push-12 {
1988 left: 100%;
1989 }
1990 .col-lg-push-11 {
1991 left: 91.66666667%;
1992 }
1993 .col-lg-push-10 {
1994 left: 83.33333333%;
1995 }
1996 .col-lg-push-9 {
1997 left: 75%;
1998 }
1999 .col-lg-push-8 {
2000 left: 66.66666667%;
2001 }
2002 .col-lg-push-7 {
2003 left: 58.33333333%;
2004 }
2005 .col-lg-push-6 {
2006 left: 50%;
2007 }
2008 .col-lg-push-5 {
2009 left: 41.66666667%;
2010 }
2011 .col-lg-push-4 {
2012 left: 33.33333333%;
2013 }
2014 .col-lg-push-3 {
2015 left: 25%;
2016 }
2017 .col-lg-push-2 {
2018 left: 16.66666667%;
2019 }
2020 .col-lg-push-1 {
2021 left: 8.33333333%;
2022 }
2023 .col-lg-push-0 {
2024 left: auto;
2025 }
2026 .col-lg-offset-12 {
2027 margin-left: 100%;
2028 }
2029 .col-lg-offset-11 {
2030 margin-left: 91.66666667%;
2031 }
2032 .col-lg-offset-10 {
2033 margin-left: 83.33333333%;
2034 }
2035 .col-lg-offset-9 {
2036 margin-left: 75%;
2037 }
2038 .col-lg-offset-8 {
2039 margin-left: 66.66666667%;
2040 }
2041 .col-lg-offset-7 {
2042 margin-left: 58.33333333%;
2043 }
2044 .col-lg-offset-6 {
2045 margin-left: 50%;
2046 }
2047 .col-lg-offset-5 {
2048 margin-left: 41.66666667%;
2049 }
2050 .col-lg-offset-4 {
2051 margin-left: 33.33333333%;
2052 }
2053 .col-lg-offset-3 {
2054 margin-left: 25%;
2055 }
2056 .col-lg-offset-2 {
2057 margin-left: 16.66666667%;
2058 }
2059 .col-lg-offset-1 {
2060 margin-left: 8.33333333%;
2061 }
2062 .col-lg-offset-0 {
2063 margin-left: 0;
2064 }
2065}
2066table {
2067 background-color: transparent;
2068}
2069th {
2070 text-align: left;
2071}
2072.table {
2073 width: 100%;
2074 max-width: 100%;
2075 margin-bottom: 20px;
2076}
2077.table > thead > tr > th,
2078.table > tbody > tr > th,
2079.table > tfoot > tr > th,
2080.table > thead > tr > td,
2081.table > tbody > tr > td,
2082.table > tfoot > tr > td {
2083 padding: 8px;
2084 line-height: 1.42857143;
2085 vertical-align: top;
2086 border-top: 1px solid #ddd;
2087}
2088.table > thead > tr > th {
2089 vertical-align: bottom;
2090 border-bottom: 2px solid #ddd;
2091}
2092.table > caption + thead > tr:first-child > th,
2093.table > colgroup + thead > tr:first-child > th,
2094.table > thead:first-child > tr:first-child > th,
2095.table > caption + thead > tr:first-child > td,
2096.table > colgroup + thead > tr:first-child > td,
2097.table > thead:first-child > tr:first-child > td {
2098 border-top: 0;
2099}
2100.table > tbody + tbody {
2101 border-top: 2px solid #ddd;
2102}
2103.table .table {
2104 background-color: #fff;
2105}
2106.table-condensed > thead > tr > th,
2107.table-condensed > tbody > tr > th,
2108.table-condensed > tfoot > tr > th,
2109.table-condensed > thead > tr > td,
2110.table-condensed > tbody > tr > td,
2111.table-condensed > tfoot > tr > td {
2112 padding: 5px;
2113}
2114.table-bordered {
2115 border: 1px solid #ddd;
2116}
2117.table-bordered > thead > tr > th,
2118.table-bordered > tbody > tr > th,
2119.table-bordered > tfoot > tr > th,
2120.table-bordered > thead > tr > td,
2121.table-bordered > tbody > tr > td,
2122.table-bordered > tfoot > tr > td {
2123 border: 1px solid #ddd;
2124}
2125.table-bordered > thead > tr > th,
2126.table-bordered > thead > tr > td {
2127 border-bottom-width: 2px;
2128}
2129.table-striped > tbody > tr:nth-child(odd) > td,
2130.table-striped > tbody > tr:nth-child(odd) > th {
2131 background-color: #f9f9f9;
2132}
2133.table-hover > tbody > tr:hover > td,
2134.table-hover > tbody > tr:hover > th {
2135 background-color: #f5f5f5;
2136}
2137table col[class*="col-"] {
2138 position: static;
2139 display: table-column;
2140 float: none;
2141}
2142table td[class*="col-"],
2143table th[class*="col-"] {
2144 position: static;
2145 display: table-cell;
2146 float: none;
2147}
2148.table > thead > tr > td.active,
2149.table > tbody > tr > td.active,
2150.table > tfoot > tr > td.active,
2151.table > thead > tr > th.active,
2152.table > tbody > tr > th.active,
2153.table > tfoot > tr > th.active,
2154.table > thead > tr.active > td,
2155.table > tbody > tr.active > td,
2156.table > tfoot > tr.active > td,
2157.table > thead > tr.active > th,
2158.table > tbody > tr.active > th,
2159.table > tfoot > tr.active > th {
2160 background-color: #f5f5f5;
2161}
2162.table-hover > tbody > tr > td.active:hover,
2163.table-hover > tbody > tr > th.active:hover,
2164.table-hover > tbody > tr.active:hover > td,
2165.table-hover > tbody > tr:hover > .active,
2166.table-hover > tbody > tr.active:hover > th {
2167 background-color: #e8e8e8;
2168}
2169.table > thead > tr > td.success,
2170.table > tbody > tr > td.success,
2171.table > tfoot > tr > td.success,
2172.table > thead > tr > th.success,
2173.table > tbody > tr > th.success,
2174.table > tfoot > tr > th.success,
2175.table > thead > tr.success > td,
2176.table > tbody > tr.success > td,
2177.table > tfoot > tr.success > td,
2178.table > thead > tr.success > th,
2179.table > tbody > tr.success > th,
2180.table > tfoot > tr.success > th {
2181 background-color: #dff0d8;
2182}
2183.table-hover > tbody > tr > td.success:hover,
2184.table-hover > tbody > tr > th.success:hover,
2185.table-hover > tbody > tr.success:hover > td,
2186.table-hover > tbody > tr:hover > .success,
2187.table-hover > tbody > tr.success:hover > th {
2188 background-color: #d0e9c6;
2189}
2190.table > thead > tr > td.info,
2191.table > tbody > tr > td.info,
2192.table > tfoot > tr > td.info,
2193.table > thead > tr > th.info,
2194.table > tbody > tr > th.info,
2195.table > tfoot > tr > th.info,
2196.table > thead > tr.info > td,
2197.table > tbody > tr.info > td,
2198.table > tfoot > tr.info > td,
2199.table > thead > tr.info > th,
2200.table > tbody > tr.info > th,
2201.table > tfoot > tr.info > th {
2202 background-color: #d9edf7;
2203}
2204.table-hover > tbody > tr > td.info:hover,
2205.table-hover > tbody > tr > th.info:hover,
2206.table-hover > tbody > tr.info:hover > td,
2207.table-hover > tbody > tr:hover > .info,
2208.table-hover > tbody > tr.info:hover > th {
2209 background-color: #c4e3f3;
2210}
2211.table > thead > tr > td.warning,
2212.table > tbody > tr > td.warning,
2213.table > tfoot > tr > td.warning,
2214.table > thead > tr > th.warning,
2215.table > tbody > tr > th.warning,
2216.table > tfoot > tr > th.warning,
2217.table > thead > tr.warning > td,
2218.table > tbody > tr.warning > td,
2219.table > tfoot > tr.warning > td,
2220.table > thead > tr.warning > th,
2221.table > tbody > tr.warning > th,
2222.table > tfoot > tr.warning > th {
2223 background-color: #fcf8e3;
2224}
2225.table-hover > tbody > tr > td.warning:hover,
2226.table-hover > tbody > tr > th.warning:hover,
2227.table-hover > tbody > tr.warning:hover > td,
2228.table-hover > tbody > tr:hover > .warning,
2229.table-hover > tbody > tr.warning:hover > th {
2230 background-color: #faf2cc;
2231}
2232.table > thead > tr > td.danger,
2233.table > tbody > tr > td.danger,
2234.table > tfoot > tr > td.danger,
2235.table > thead > tr > th.danger,
2236.table > tbody > tr > th.danger,
2237.table > tfoot > tr > th.danger,
2238.table > thead > tr.danger > td,
2239.table > tbody > tr.danger > td,
2240.table > tfoot > tr.danger > td,
2241.table > thead > tr.danger > th,
2242.table > tbody > tr.danger > th,
2243.table > tfoot > tr.danger > th {
2244 background-color: #f2dede;
2245}
2246.table-hover > tbody > tr > td.danger:hover,
2247.table-hover > tbody > tr > th.danger:hover,
2248.table-hover > tbody > tr.danger:hover > td,
2249.table-hover > tbody > tr:hover > .danger,
2250.table-hover > tbody > tr.danger:hover > th {
2251 background-color: #ebcccc;
2252}
2253@media screen and (max-width: 767px) {
2254 .table-responsive {
2255 width: 100%;
2256 margin-bottom: 15px;
2257 overflow-x: auto;
2258 overflow-y: hidden;
2259 -webkit-overflow-scrolling: touch;
2260 -ms-overflow-style: -ms-autohiding-scrollbar;
2261 border: 1px solid #ddd;
2262 }
2263 .table-responsive > .table {
2264 margin-bottom: 0;
2265 }
2266 .table-responsive > .table > thead > tr > th,
2267 .table-responsive > .table > tbody > tr > th,
2268 .table-responsive > .table > tfoot > tr > th,
2269 .table-responsive > .table > thead > tr > td,
2270 .table-responsive > .table > tbody > tr > td,
2271 .table-responsive > .table > tfoot > tr > td {
2272 white-space: nowrap;
2273 }
2274 .table-responsive > .table-bordered {
2275 border: 0;
2276 }
2277 .table-responsive > .table-bordered > thead > tr > th:first-child,
2278 .table-responsive > .table-bordered > tbody > tr > th:first-child,
2279 .table-responsive > .table-bordered > tfoot > tr > th:first-child,
2280 .table-responsive > .table-bordered > thead > tr > td:first-child,
2281 .table-responsive > .table-bordered > tbody > tr > td:first-child,
2282 .table-responsive > .table-bordered > tfoot > tr > td:first-child {
2283 border-left: 0;
2284 }
2285 .table-responsive > .table-bordered > thead > tr > th:last-child,
2286 .table-responsive > .table-bordered > tbody > tr > th:last-child,
2287 .table-responsive > .table-bordered > tfoot > tr > th:last-child,
2288 .table-responsive > .table-bordered > thead > tr > td:last-child,
2289 .table-responsive > .table-bordered > tbody > tr > td:last-child,
2290 .table-responsive > .table-bordered > tfoot > tr > td:last-child {
2291 border-right: 0;
2292 }
2293 .table-responsive > .table-bordered > tbody > tr:last-child > th,
2294 .table-responsive > .table-bordered > tfoot > tr:last-child > th,
2295 .table-responsive > .table-bordered > tbody > tr:last-child > td,
2296 .table-responsive > .table-bordered > tfoot > tr:last-child > td {
2297 border-bottom: 0;
2298 }
2299}
2300fieldset {
2301 min-width: 0;
2302 padding: 0;
2303 margin: 0;
2304 border: 0;
2305}
2306legend {
2307 display: block;
2308 width: 100%;
2309 padding: 0;
2310 margin-bottom: 20px;
2311 font-size: 21px;
2312 line-height: inherit;
2313 color: #333;
2314 border: 0;
2315 border-bottom: 1px solid #e5e5e5;
2316}
2317label {
2318 display: inline-block;
2319 max-width: 100%;
2320 margin-bottom: 5px;
2321 font-weight: bold;
2322}
2323input[type="search"] {
2324 -webkit-box-sizing: border-box;
2325 -moz-box-sizing: border-box;
2326 box-sizing: border-box;
2327}
2328input[type="radio"],
2329input[type="checkbox"] {
2330 margin: 4px 0 0;
2331 margin-top: 1px \9;
2332 line-height: normal;
2333}
2334input[type="file"] {
2335 display: block;
2336}
2337input[type="range"] {
2338 display: block;
2339 width: 100%;
2340}
2341select[multiple],
2342select[size] {
2343 height: auto;
2344}
2345input[type="file"]:focus,
2346input[type="radio"]:focus,
2347input[type="checkbox"]:focus {
2348 outline: thin dotted;
2349 outline: 5px auto -webkit-focus-ring-color;
2350 outline-offset: -2px;
2351}
2352output {
2353 display: block;
2354 padding-top: 7px;
2355 font-size: 14px;
2356 line-height: 1.42857143;
2357 color: #555;
2358}
2359.form-control {
2360 display: block;
2361 width: 100%;
2362 height: 34px;
2363 padding: 6px 12px;
2364 font-size: 14px;
2365 line-height: 1.42857143;
2366 color: #555;
2367 background-color: #fff;
2368 background-image: none;
2369 border: 1px solid #ccc;
2370 border-radius: 4px;
2371 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2372 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2373 -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
2374 -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
2375 transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
2376}
2377.form-control:focus {
2378 border-color: #66afe9;
2379 outline: 0;
2380 -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
2381 box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
2382}
2383.form-control::-moz-placeholder {
2384 color: #777;
2385 opacity: 1;
2386}
2387.form-control:-ms-input-placeholder {
2388 color: #777;
2389}
2390.form-control::-webkit-input-placeholder {
2391 color: #777;
2392}
2393.form-control[disabled],
2394.form-control[readonly],
2395fieldset[disabled] .form-control {
2396 cursor: not-allowed;
2397 background-color: #eee;
2398 opacity: 1;
2399}
2400textarea.form-control {
2401 height: auto;
2402}
2403input[type="search"] {
2404 -webkit-appearance: none;
2405}
2406input[type="date"],
2407input[type="time"],
2408input[type="datetime-local"],
2409input[type="month"] {
2410 line-height: 34px;
2411 line-height: 1.42857143 \0;
2412}
2413input[type="date"].input-sm,
2414input[type="time"].input-sm,
2415input[type="datetime-local"].input-sm,
2416input[type="month"].input-sm {
2417 line-height: 30px;
2418}
2419input[type="date"].input-lg,
2420input[type="time"].input-lg,
2421input[type="datetime-local"].input-lg,
2422input[type="month"].input-lg {
2423 line-height: 46px;
2424}
2425.form-group {
2426 margin-bottom: 15px;
2427}
2428.radio,
2429.checkbox {
2430 position: relative;
2431 display: block;
2432 min-height: 20px;
2433 margin-top: 10px;
2434 margin-bottom: 10px;
2435}
2436.radio label,
2437.checkbox label {
2438 padding-left: 20px;
2439 margin-bottom: 0;
2440 font-weight: normal;
2441 cursor: pointer;
2442}
2443.radio input[type="radio"],
2444.radio-inline input[type="radio"],
2445.checkbox input[type="checkbox"],
2446.checkbox-inline input[type="checkbox"] {
2447 position: absolute;
2448 margin-top: 4px \9;
2449 margin-left: -20px;
2450}
2451.radio + .radio,
2452.checkbox + .checkbox {
2453 margin-top: -5px;
2454}
2455.radio-inline,
2456.checkbox-inline {
2457 display: inline-block;
2458 padding-left: 20px;
2459 margin-bottom: 0;
2460 font-weight: normal;
2461 vertical-align: middle;
2462 cursor: pointer;
2463}
2464.radio-inline + .radio-inline,
2465.checkbox-inline + .checkbox-inline {
2466 margin-top: 0;
2467 margin-left: 10px;
2468}
2469input[type="radio"][disabled],
2470input[type="checkbox"][disabled],
2471input[type="radio"].disabled,
2472input[type="checkbox"].disabled,
2473fieldset[disabled] input[type="radio"],
2474fieldset[disabled] input[type="checkbox"] {
2475 cursor: not-allowed;
2476}
2477.radio-inline.disabled,
2478.checkbox-inline.disabled,
2479fieldset[disabled] .radio-inline,
2480fieldset[disabled] .checkbox-inline {
2481 cursor: not-allowed;
2482}
2483.radio.disabled label,
2484.checkbox.disabled label,
2485fieldset[disabled] .radio label,
2486fieldset[disabled] .checkbox label {
2487 cursor: not-allowed;
2488}
2489.form-control-static {
2490 padding-top: 7px;
2491 padding-bottom: 7px;
2492 margin-bottom: 0;
2493}
2494.form-control-static.input-lg,
2495.form-control-static.input-sm {
2496 padding-right: 0;
2497 padding-left: 0;
2498}
2499.input-sm,
2500.form-horizontal .form-group-sm .form-control {
2501 height: 30px;
2502 padding: 5px 10px;
2503 font-size: 12px;
2504 line-height: 1.5;
2505 border-radius: 3px;
2506}
2507select.input-sm {
2508 height: 30px;
2509 line-height: 30px;
2510}
2511textarea.input-sm,
2512select[multiple].input-sm {
2513 height: auto;
2514}
2515.input-lg,
2516.form-horizontal .form-group-lg .form-control {
2517 height: 46px;
2518 padding: 10px 16px;
2519 font-size: 18px;
2520 line-height: 1.33;
2521 border-radius: 6px;
2522}
2523select.input-lg {
2524 height: 46px;
2525 line-height: 46px;
2526}
2527textarea.input-lg,
2528select[multiple].input-lg {
2529 height: auto;
2530}
2531.has-feedback {
2532 position: relative;
2533}
2534.has-feedback .form-control {
2535 padding-right: 42.5px;
2536}
2537.form-control-feedback {
2538 position: absolute;
2539 top: 25px;
2540 right: 0;
2541 z-index: 2;
2542 display: block;
2543 width: 34px;
2544 height: 34px;
2545 line-height: 34px;
2546 text-align: center;
2547}
2548.input-lg + .form-control-feedback {
2549 width: 46px;
2550 height: 46px;
2551 line-height: 46px;
2552}
2553.input-sm + .form-control-feedback {
2554 width: 30px;
2555 height: 30px;
2556 line-height: 30px;
2557}
2558.has-success .help-block,
2559.has-success .control-label,
2560.has-success .radio,
2561.has-success .checkbox,
2562.has-success .radio-inline,
2563.has-success .checkbox-inline {
2564 color: #3c763d;
2565}
2566.has-success .form-control {
2567 border-color: #3c763d;
2568 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2569 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2570}
2571.has-success .form-control:focus {
2572 border-color: #2b542c;
2573 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;
2574 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;
2575}
2576.has-success .input-group-addon {
2577 color: #3c763d;
2578 background-color: #dff0d8;
2579 border-color: #3c763d;
2580}
2581.has-success .form-control-feedback {
2582 color: #3c763d;
2583}
2584.has-warning .help-block,
2585.has-warning .control-label,
2586.has-warning .radio,
2587.has-warning .checkbox,
2588.has-warning .radio-inline,
2589.has-warning .checkbox-inline {
2590 color: #8a6d3b;
2591}
2592.has-warning .form-control {
2593 border-color: #8a6d3b;
2594 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2595 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2596}
2597.has-warning .form-control:focus {
2598 border-color: #66512c;
2599 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;
2600 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;
2601}
2602.has-warning .input-group-addon {
2603 color: #8a6d3b;
2604 background-color: #fcf8e3;
2605 border-color: #8a6d3b;
2606}
2607.has-warning .form-control-feedback {
2608 color: #8a6d3b;
2609}
2610.has-error .help-block,
2611.has-error .control-label,
2612.has-error .radio,
2613.has-error .checkbox,
2614.has-error .radio-inline,
2615.has-error .checkbox-inline {
2616 color: #a94442;
2617}
2618.has-error .form-control {
2619 border-color: #a94442;
2620 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2621 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
2622}
2623.has-error .form-control:focus {
2624 border-color: #843534;
2625 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;
2626 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;
2627}
2628.has-error .input-group-addon {
2629 color: #a94442;
2630 background-color: #f2dede;
2631 border-color: #a94442;
2632}
2633.has-error .form-control-feedback {
2634 color: #a94442;
2635}
2636.has-feedback label.sr-only ~ .form-control-feedback {
2637 top: 0;
2638}
2639.help-block {
2640 display: block;
2641 margin-top: 5px;
2642 margin-bottom: 10px;
2643 color: #737373;
2644}
2645@media (min-width: 768px) {
2646 .form-inline .form-group {
2647 display: inline-block;
2648 margin-bottom: 0;
2649 vertical-align: middle;
2650 }
2651 .form-inline .form-control {
2652 display: inline-block;
2653 width: auto;
2654 vertical-align: middle;
2655 }
2656 .form-inline .input-group {
2657 display: inline-table;
2658 vertical-align: middle;
2659 }
2660 .form-inline .input-group .input-group-addon,
2661 .form-inline .input-group .input-group-btn,
2662 .form-inline .input-group .form-control {
2663 width: auto;
2664 }
2665 .form-inline .input-group > .form-control {
2666 width: 100%;
2667 }
2668 .form-inline .control-label {
2669 margin-bottom: 0;
2670 vertical-align: middle;
2671 }
2672 .form-inline .radio,
2673 .form-inline .checkbox {
2674 display: inline-block;
2675 margin-top: 0;
2676 margin-bottom: 0;
2677 vertical-align: middle;
2678 }
2679 .form-inline .radio label,
2680 .form-inline .checkbox label {
2681 padding-left: 0;
2682 }
2683 .form-inline .radio input[type="radio"],
2684 .form-inline .checkbox input[type="checkbox"] {
2685 position: relative;
2686 margin-left: 0;
2687 }
2688 .form-inline .has-feedback .form-control-feedback {
2689 top: 0;
2690 }
2691}
2692.form-horizontal .radio,
2693.form-horizontal .checkbox,
2694.form-horizontal .radio-inline,
2695.form-horizontal .checkbox-inline {
2696 padding-top: 7px;
2697 margin-top: 0;
2698 margin-bottom: 0;
2699}
2700.form-horizontal .radio,
2701.form-horizontal .checkbox {
2702 min-height: 27px;
2703}
2704.form-horizontal .form-group {
2705 margin-right: -15px;
2706 margin-left: -15px;
2707}
2708@media (min-width: 768px) {
2709 .form-horizontal .control-label {
2710 padding-top: 7px;
2711 margin-bottom: 0;
2712 text-align: right;
2713 }
2714}
2715.form-horizontal .has-feedback .form-control-feedback {
2716 top: 0;
2717 right: 15px;
2718}
2719@media (min-width: 768px) {
2720 .form-horizontal .form-group-lg .control-label {
2721 padding-top: 14.3px;
2722 }
2723}
2724@media (min-width: 768px) {
2725 .form-horizontal .form-group-sm .control-label {
2726 padding-top: 6px;
2727 }
2728}
2729.btn {
2730 display: inline-block;
2731 padding: 6px 12px;
2732 margin-bottom: 0;
2733 font-size: 14px;
2734 font-weight: normal;
2735 line-height: 1.42857143;
2736 text-align: center;
2737 white-space: nowrap;
2738 vertical-align: middle;
2739 cursor: pointer;
2740 -webkit-user-select: none;
2741 -moz-user-select: none;
2742 -ms-user-select: none;
2743 user-select: none;
2744 background-image: none;
2745 border: 1px solid transparent;
2746 border-radius: 4px;
2747}
2748.btn:focus,
2749.btn:active:focus,
2750.btn.active:focus {
2751 outline: thin dotted;
2752 outline: 5px auto -webkit-focus-ring-color;
2753 outline-offset: -2px;
2754}
2755.btn:hover,
2756.btn:focus {
2757 color: #333;
2758 text-decoration: none;
2759}
2760.btn:active,
2761.btn.active {
2762 background-image: none;
2763 outline: 0;
2764 -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
2765 box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
2766}
2767.btn.disabled,
2768.btn[disabled],
2769fieldset[disabled] .btn {
2770 pointer-events: none;
2771 cursor: not-allowed;
2772 filter: alpha(opacity=65);
2773 -webkit-box-shadow: none;
2774 box-shadow: none;
2775 opacity: .65;
2776}
2777.btn-default {
2778 color: #333;
2779 background-color: #fff;
2780 border-color: #ccc;
2781}
2782.btn-default:hover,
2783.btn-default:focus,
2784.btn-default:active,
2785.btn-default.active,
2786.open > .dropdown-toggle.btn-default {
2787 color: #333;
2788 background-color: #e6e6e6;
2789 border-color: #adadad;
2790}
2791.btn-default:active,
2792.btn-default.active,
2793.open > .dropdown-toggle.btn-default {
2794 background-image: none;
2795}
2796.btn-default.disabled,
2797.btn-default[disabled],
2798fieldset[disabled] .btn-default,
2799.btn-default.disabled:hover,
2800.btn-default[disabled]:hover,
2801fieldset[disabled] .btn-default:hover,
2802.btn-default.disabled:focus,
2803.btn-default[disabled]:focus,
2804fieldset[disabled] .btn-default:focus,
2805.btn-default.disabled:active,
2806.btn-default[disabled]:active,
2807fieldset[disabled] .btn-default:active,
2808.btn-default.disabled.active,
2809.btn-default[disabled].active,
2810fieldset[disabled] .btn-default.active {
2811 background-color: #fff;
2812 border-color: #ccc;
2813}
2814.btn-default .badge {
2815 color: #fff;
2816 background-color: #333;
2817}
2818.btn-primary {
2819 color: #fff;
2820 background-color: #428bca;
2821 border-color: #357ebd;
2822}
2823.btn-primary:hover,
2824.btn-primary:focus,
2825.btn-primary:active,
2826.btn-primary.active,
2827.open > .dropdown-toggle.btn-primary {
2828 color: #fff;
2829 background-color: #3071a9;
2830 border-color: #285e8e;
2831}
2832.btn-primary:active,
2833.btn-primary.active,
2834.open > .dropdown-toggle.btn-primary {
2835 background-image: none;
2836}
2837.btn-primary.disabled,
2838.btn-primary[disabled],
2839fieldset[disabled] .btn-primary,
2840.btn-primary.disabled:hover,
2841.btn-primary[disabled]:hover,
2842fieldset[disabled] .btn-primary:hover,
2843.btn-primary.disabled:focus,
2844.btn-primary[disabled]:focus,
2845fieldset[disabled] .btn-primary:focus,
2846.btn-primary.disabled:active,
2847.btn-primary[disabled]:active,
2848fieldset[disabled] .btn-primary:active,
2849.btn-primary.disabled.active,
2850.btn-primary[disabled].active,
2851fieldset[disabled] .btn-primary.active {
2852 background-color: #428bca;
2853 border-color: #357ebd;
2854}
2855.btn-primary .badge {
2856 color: #428bca;
2857 background-color: #fff;
2858}
2859.btn-success {
2860 color: #fff;
2861 background-color: #5cb85c;
2862 border-color: #4cae4c;
2863}
2864.btn-success:hover,
2865.btn-success:focus,
2866.btn-success:active,
2867.btn-success.active,
2868.open > .dropdown-toggle.btn-success {
2869 color: #fff;
2870 background-color: #449d44;
2871 border-color: #398439;
2872}
2873.btn-success:active,
2874.btn-success.active,
2875.open > .dropdown-toggle.btn-success {
2876 background-image: none;
2877}
2878.btn-success.disabled,
2879.btn-success[disabled],
2880fieldset[disabled] .btn-success,
2881.btn-success.disabled:hover,
2882.btn-success[disabled]:hover,
2883fieldset[disabled] .btn-success:hover,
2884.btn-success.disabled:focus,
2885.btn-success[disabled]:focus,
2886fieldset[disabled] .btn-success:focus,
2887.btn-success.disabled:active,
2888.btn-success[disabled]:active,
2889fieldset[disabled] .btn-success:active,
2890.btn-success.disabled.active,
2891.btn-success[disabled].active,
2892fieldset[disabled] .btn-success.active {
2893 background-color: #5cb85c;
2894 border-color: #4cae4c;
2895}
2896.btn-success .badge {
2897 color: #5cb85c;
2898 background-color: #fff;
2899}
2900.btn-info {
2901 color: #fff;
2902 background-color: #5bc0de;
2903 border-color: #46b8da;
2904}
2905.btn-info:hover,
2906.btn-info:focus,
2907.btn-info:active,
2908.btn-info.active,
2909.open > .dropdown-toggle.btn-info {
2910 color: #fff;
2911 background-color: #31b0d5;
2912 border-color: #269abc;
2913}
2914.btn-info:active,
2915.btn-info.active,
2916.open > .dropdown-toggle.btn-info {
2917 background-image: none;
2918}
2919.btn-info.disabled,
2920.btn-info[disabled],
2921fieldset[disabled] .btn-info,
2922.btn-info.disabled:hover,
2923.btn-info[disabled]:hover,
2924fieldset[disabled] .btn-info:hover,
2925.btn-info.disabled:focus,
2926.btn-info[disabled]:focus,
2927fieldset[disabled] .btn-info:focus,
2928.btn-info.disabled:active,
2929.btn-info[disabled]:active,
2930fieldset[disabled] .btn-info:active,
2931.btn-info.disabled.active,
2932.btn-info[disabled].active,
2933fieldset[disabled] .btn-info.active {
2934 background-color: #5bc0de;
2935 border-color: #46b8da;
2936}
2937.btn-info .badge {
2938 color: #5bc0de;
2939 background-color: #fff;
2940}
2941.btn-warning {
2942 color: #fff;
2943 background-color: #f0ad4e;
2944 border-color: #eea236;
2945}
2946.btn-warning:hover,
2947.btn-warning:focus,
2948.btn-warning:active,
2949.btn-warning.active,
2950.open > .dropdown-toggle.btn-warning {
2951 color: #fff;
2952 background-color: #ec971f;
2953 border-color: #d58512;
2954}
2955.btn-warning:active,
2956.btn-warning.active,
2957.open > .dropdown-toggle.btn-warning {
2958 background-image: none;
2959}
2960.btn-warning.disabled,
2961.btn-warning[disabled],
2962fieldset[disabled] .btn-warning,
2963.btn-warning.disabled:hover,
2964.btn-warning[disabled]:hover,
2965fieldset[disabled] .btn-warning:hover,
2966.btn-warning.disabled:focus,
2967.btn-warning[disabled]:focus,
2968fieldset[disabled] .btn-warning:focus,
2969.btn-warning.disabled:active,
2970.btn-warning[disabled]:active,
2971fieldset[disabled] .btn-warning:active,
2972.btn-warning.disabled.active,
2973.btn-warning[disabled].active,
2974fieldset[disabled] .btn-warning.active {
2975 background-color: #f0ad4e;
2976 border-color: #eea236;
2977}
2978.btn-warning .badge {
2979 color: #f0ad4e;
2980 background-color: #fff;
2981}
2982.btn-danger {
2983 color: #fff;
2984 background-color: #d9534f;
2985 border-color: #d43f3a;
2986}
2987.btn-danger:hover,
2988.btn-danger:focus,
2989.btn-danger:active,
2990.btn-danger.active,
2991.open > .dropdown-toggle.btn-danger {
2992 color: #fff;
2993 background-color: #c9302c;
2994 border-color: #ac2925;
2995}
2996.btn-danger:active,
2997.btn-danger.active,
2998.open > .dropdown-toggle.btn-danger {
2999 background-image: none;
3000}
3001.btn-danger.disabled,
3002.btn-danger[disabled],
3003fieldset[disabled] .btn-danger,
3004.btn-danger.disabled:hover,
3005.btn-danger[disabled]:hover,
3006fieldset[disabled] .btn-danger:hover,
3007.btn-danger.disabled:focus,
3008.btn-danger[disabled]:focus,
3009fieldset[disabled] .btn-danger:focus,
3010.btn-danger.disabled:active,
3011.btn-danger[disabled]:active,
3012fieldset[disabled] .btn-danger:active,
3013.btn-danger.disabled.active,
3014.btn-danger[disabled].active,
3015fieldset[disabled] .btn-danger.active {
3016 background-color: #d9534f;
3017 border-color: #d43f3a;
3018}
3019.btn-danger .badge {
3020 color: #d9534f;
3021 background-color: #fff;
3022}
3023.btn-link {
3024 font-weight: normal;
3025 color: #428bca;
3026 cursor: pointer;
3027 border-radius: 0;
3028}
3029.btn-link,
3030.btn-link:active,
3031.btn-link[disabled],
3032fieldset[disabled] .btn-link {
3033 background-color: transparent;
3034 -webkit-box-shadow: none;
3035 box-shadow: none;
3036}
3037.btn-link,
3038.btn-link:hover,
3039.btn-link:focus,
3040.btn-link:active {
3041 border-color: transparent;
3042}
3043.btn-link:hover,
3044.btn-link:focus {
3045 color: #2a6496;
3046 text-decoration: underline;
3047 background-color: transparent;
3048}
3049.btn-link[disabled]:hover,
3050fieldset[disabled] .btn-link:hover,
3051.btn-link[disabled]:focus,
3052fieldset[disabled] .btn-link:focus {
3053 color: #777;
3054 text-decoration: none;
3055}
3056.btn-lg,
3057.btn-group-lg > .btn {
3058 padding: 10px 16px;
3059 font-size: 18px;
3060 line-height: 1.33;
3061 border-radius: 6px;
3062}
3063.btn-sm,
3064.btn-group-sm > .btn {
3065 padding: 5px 10px;
3066 font-size: 12px;
3067 line-height: 1.5;
3068 border-radius: 3px;
3069}
3070.btn-xs,
3071.btn-group-xs > .btn {
3072 padding: 1px 5px;
3073 font-size: 12px;
3074 line-height: 1.5;
3075 border-radius: 3px;
3076}
3077.btn-block {
3078 display: block;
3079 width: 100%;
3080}
3081.btn-block + .btn-block {
3082 margin-top: 5px;
3083}
3084input[type="submit"].btn-block,
3085input[type="reset"].btn-block,
3086input[type="button"].btn-block {
3087 width: 100%;
3088}
3089.fade {
3090 opacity: 0;
3091 -webkit-transition: opacity .15s linear;
3092 -o-transition: opacity .15s linear;
3093 transition: opacity .15s linear;
3094}
3095.fade.in {
3096 opacity: 1;
3097}
3098.collapse {
3099 display: none;
3100}
3101.collapse.in {
3102 display: block;
3103}
3104tr.collapse.in {
3105 display: table-row;
3106}
3107tbody.collapse.in {
3108 display: table-row-group;
3109}
3110.collapsing {
3111 position: relative;
3112 height: 0;
3113 overflow: hidden;
3114 -webkit-transition: height .35s ease;
3115 -o-transition: height .35s ease;
3116 transition: height .35s ease;
3117}
3118.caret {
3119 display: inline-block;
3120 width: 0;
3121 height: 0;
3122 margin-left: 2px;
3123 vertical-align: middle;
3124 border-top: 4px solid;
3125 border-right: 4px solid transparent;
3126 border-left: 4px solid transparent;
3127}
3128.dropdown {
3129 position: relative;
3130}
3131.dropdown-toggle:focus {
3132 outline: 0;
3133}
3134.dropdown-menu {
3135 position: absolute;
3136 top: 100%;
3137 left: 0;
3138 z-index: 1000;
3139 display: none;
3140 float: left;
3141 min-width: 160px;
3142 padding: 5px 0;
3143 margin: 2px 0 0;
3144 font-size: 14px;
3145 text-align: left;
3146 list-style: none;
3147 background-color: #fff;
3148 -webkit-background-clip: padding-box;
3149 background-clip: padding-box;
3150 border: 1px solid #ccc;
3151 border: 1px solid rgba(0, 0, 0, .15);
3152 border-radius: 4px;
3153 -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
3154 box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
3155}
3156.dropdown-menu.pull-right {
3157 right: 0;
3158 left: auto;
3159}
3160.dropdown-menu .divider {
3161 height: 1px;
3162 margin: 9px 0;
3163 overflow: hidden;
3164 background-color: #e5e5e5;
3165}
3166.dropdown-menu > li > a {
3167 display: block;
3168 padding: 3px 20px;
3169 clear: both;
3170 font-weight: normal;
3171 line-height: 1.42857143;
3172 color: #333;
3173 white-space: nowrap;
3174}
3175.dropdown-menu > li > a:hover,
3176.dropdown-menu > li > a:focus {
3177 color: #262626;
3178 text-decoration: none;
3179 background-color: #f5f5f5;
3180}
3181.dropdown-menu > .active > a,
3182.dropdown-menu > .active > a:hover,
3183.dropdown-menu > .active > a:focus {
3184 color: #fff;
3185 text-decoration: none;
3186 background-color: #428bca;
3187 outline: 0;
3188}
3189.dropdown-menu > .disabled > a,
3190.dropdown-menu > .disabled > a:hover,
3191.dropdown-menu > .disabled > a:focus {
3192 color: #777;
3193}
3194.dropdown-menu > .disabled > a:hover,
3195.dropdown-menu > .disabled > a:focus {
3196 text-decoration: none;
3197 cursor: not-allowed;
3198 background-color: transparent;
3199 background-image: none;
3200 filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
3201}
3202.open > .dropdown-menu {
3203 display: block;
3204}
3205.open > a {
3206 outline: 0;
3207}
3208.dropdown-menu-right {
3209 right: 0;
3210 left: auto;
3211}
3212.dropdown-menu-left {
3213 right: auto;
3214 left: 0;
3215}
3216.dropdown-header {
3217 display: block;
3218 padding: 3px 20px;
3219 font-size: 12px;
3220 line-height: 1.42857143;
3221 color: #777;
3222 white-space: nowrap;
3223}
3224.dropdown-backdrop {
3225 position: fixed;
3226 top: 0;
3227 right: 0;
3228 bottom: 0;
3229 left: 0;
3230 z-index: 990;
3231}
3232.pull-right > .dropdown-menu {
3233 right: 0;
3234 left: auto;
3235}
3236.dropup .caret,
3237.navbar-fixed-bottom .dropdown .caret {
3238 content: "";
3239 border-top: 0;
3240 border-bottom: 4px solid;
3241}
3242.dropup .dropdown-menu,
3243.navbar-fixed-bottom .dropdown .dropdown-menu {
3244 top: auto;
3245 bottom: 100%;
3246 margin-bottom: 1px;
3247}
3248@media (min-width: 768px) {
3249 .navbar-right .dropdown-menu {
3250 right: 0;
3251 left: auto;
3252 }
3253 .navbar-right .dropdown-menu-left {
3254 right: auto;
3255 left: 0;
3256 }
3257}
3258.btn-group,
3259.btn-group-vertical {
3260 position: relative;
3261 display: inline-block;
3262 vertical-align: middle;
3263}
3264.btn-group > .btn,
3265.btn-group-vertical > .btn {
3266 position: relative;
3267 float: left;
3268}
3269.btn-group > .btn:hover,
3270.btn-group-vertical > .btn:hover,
3271.btn-group > .btn:focus,
3272.btn-group-vertical > .btn:focus,
3273.btn-group > .btn:active,
3274.btn-group-vertical > .btn:active,
3275.btn-group > .btn.active,
3276.btn-group-vertical > .btn.active {
3277 z-index: 2;
3278}
3279.btn-group > .btn:focus,
3280.btn-group-vertical > .btn:focus {
3281 outline: 0;
3282}
3283.btn-group .btn + .btn,
3284.btn-group .btn + .btn-group,
3285.btn-group .btn-group + .btn,
3286.btn-group .btn-group + .btn-group {
3287 margin-left: -1px;
3288}
3289.btn-toolbar {
3290 margin-left: -5px;
3291}
3292.btn-toolbar .btn-group,
3293.btn-toolbar .input-group {
3294 float: left;
3295}
3296.btn-toolbar > .btn,
3297.btn-toolbar > .btn-group,
3298.btn-toolbar > .input-group {
3299 margin-left: 5px;
3300}
3301.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
3302 border-radius: 0;
3303}
3304.btn-group > .btn:first-child {
3305 margin-left: 0;
3306}
3307.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
3308 border-top-right-radius: 0;
3309 border-bottom-right-radius: 0;
3310}
3311.btn-group > .btn:last-child:not(:first-child),
3312.btn-group > .dropdown-toggle:not(:first-child) {
3313 border-top-left-radius: 0;
3314 border-bottom-left-radius: 0;
3315}
3316.btn-group > .btn-group {
3317 float: left;
3318}
3319.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
3320 border-radius: 0;
3321}
3322.btn-group > .btn-group:first-child > .btn:last-child,
3323.btn-group > .btn-group:first-child > .dropdown-toggle {
3324 border-top-right-radius: 0;
3325 border-bottom-right-radius: 0;
3326}
3327.btn-group > .btn-group:last-child > .btn:first-child {
3328 border-top-left-radius: 0;
3329 border-bottom-left-radius: 0;
3330}
3331.btn-group .dropdown-toggle:active,
3332.btn-group.open .dropdown-toggle {
3333 outline: 0;
3334}
3335.btn-group > .btn + .dropdown-toggle {
3336 padding-right: 8px;
3337 padding-left: 8px;
3338}
3339.btn-group > .btn-lg + .dropdown-toggle {
3340 padding-right: 12px;
3341 padding-left: 12px;
3342}
3343.btn-group.open .dropdown-toggle {
3344 -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
3345 box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
3346}
3347.btn-group.open .dropdown-toggle.btn-link {
3348 -webkit-box-shadow: none;
3349 box-shadow: none;
3350}
3351.btn .caret {
3352 margin-left: 0;
3353}
3354.btn-lg .caret {
3355 border-width: 5px 5px 0;
3356 border-bottom-width: 0;
3357}
3358.dropup .btn-lg .caret {
3359 border-width: 0 5px 5px;
3360}
3361.btn-group-vertical > .btn,
3362.btn-group-vertical > .btn-group,
3363.btn-group-vertical > .btn-group > .btn {
3364 display: block;
3365 float: none;
3366 width: 100%;
3367 max-width: 100%;
3368}
3369.btn-group-vertical > .btn-group > .btn {
3370 float: none;
3371}
3372.btn-group-vertical > .btn + .btn,
3373.btn-group-vertical > .btn + .btn-group,
3374.btn-group-vertical > .btn-group + .btn,
3375.btn-group-vertical > .btn-group + .btn-group {
3376 margin-top: -1px;
3377 margin-left: 0;
3378}
3379.btn-group-vertical > .btn:not(:first-child):not(:last-child) {
3380 border-radius: 0;
3381}
3382.btn-group-vertical > .btn:first-child:not(:last-child) {
3383 border-top-right-radius: 4px;
3384 border-bottom-right-radius: 0;
3385 border-bottom-left-radius: 0;
3386}
3387.btn-group-vertical > .btn:last-child:not(:first-child) {
3388 border-top-left-radius: 0;
3389 border-top-right-radius: 0;
3390 border-bottom-left-radius: 4px;
3391}
3392.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
3393 border-radius: 0;
3394}
3395.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child,
3396.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
3397 border-bottom-right-radius: 0;
3398 border-bottom-left-radius: 0;
3399}
3400.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
3401 border-top-left-radius: 0;
3402 border-top-right-radius: 0;
3403}
3404.btn-group-justified {
3405 display: table;
3406 width: 100%;
3407 table-layout: fixed;
3408 border-collapse: separate;
3409}
3410.btn-group-justified > .btn,
3411.btn-group-justified > .btn-group {
3412 display: table-cell;
3413 float: none;
3414 width: 1%;
3415}
3416.btn-group-justified > .btn-group .btn {
3417 width: 100%;
3418}
3419.btn-group-justified > .btn-group .dropdown-menu {
3420 left: auto;
3421}
3422[data-toggle="buttons"] > .btn > input[type="radio"],
3423[data-toggle="buttons"] > .btn > input[type="checkbox"] {
3424 position: absolute;
3425 z-index: -1;
3426 filter: alpha(opacity=0);
3427 opacity: 0;
3428}
3429.input-group {
3430 position: relative;
3431 display: table;
3432 border-collapse: separate;
3433}
3434.input-group[class*="col-"] {
3435 float: none;
3436 padding-right: 0;
3437 padding-left: 0;
3438}
3439.input-group .form-control {
3440 position: relative;
3441 z-index: 2;
3442 float: left;
3443 width: 100%;
3444 margin-bottom: 0;
3445}
3446.input-group-lg > .form-control,
3447.input-group-lg > .input-group-addon,
3448.input-group-lg > .input-group-btn > .btn {
3449 height: 46px;
3450 padding: 10px 16px;
3451 font-size: 18px;
3452 line-height: 1.33;
3453 border-radius: 6px;
3454}
3455select.input-group-lg > .form-control,
3456select.input-group-lg > .input-group-addon,
3457select.input-group-lg > .input-group-btn > .btn {
3458 height: 46px;
3459 line-height: 46px;
3460}
3461textarea.input-group-lg > .form-control,
3462textarea.input-group-lg > .input-group-addon,
3463textarea.input-group-lg > .input-group-btn > .btn,
3464select[multiple].input-group-lg > .form-control,
3465select[multiple].input-group-lg > .input-group-addon,
3466select[multiple].input-group-lg > .input-group-btn > .btn {
3467 height: auto;
3468}
3469.input-group-sm > .form-control,
3470.input-group-sm > .input-group-addon,
3471.input-group-sm > .input-group-btn > .btn {
3472 height: 30px;
3473 padding: 5px 10px;
3474 font-size: 12px;
3475 line-height: 1.5;
3476 border-radius: 3px;
3477}
3478select.input-group-sm > .form-control,
3479select.input-group-sm > .input-group-addon,
3480select.input-group-sm > .input-group-btn > .btn {
3481 height: 30px;
3482 line-height: 30px;
3483}
3484textarea.input-group-sm > .form-control,
3485textarea.input-group-sm > .input-group-addon,
3486textarea.input-group-sm > .input-group-btn > .btn,
3487select[multiple].input-group-sm > .form-control,
3488select[multiple].input-group-sm > .input-group-addon,
3489select[multiple].input-group-sm > .input-group-btn > .btn {
3490 height: auto;
3491}
3492.input-group-addon,
3493.input-group-btn,
3494.input-group .form-control {
3495 display: table-cell;
3496}
3497.input-group-addon:not(:first-child):not(:last-child),
3498.input-group-btn:not(:first-child):not(:last-child),
3499.input-group .form-control:not(:first-child):not(:last-child) {
3500 border-radius: 0;
3501}
3502.input-group-addon,
3503.input-group-btn {
3504 width: 1%;
3505 white-space: nowrap;
3506 vertical-align: middle;
3507}
3508.input-group-addon {
3509 padding: 6px 12px;
3510 font-size: 14px;
3511 font-weight: normal;
3512 line-height: 1;
3513 color: #555;
3514 text-align: center;
3515 background-color: #eee;
3516 border: 1px solid #ccc;
3517 border-radius: 4px;
3518}
3519.input-group-addon.input-sm {
3520 padding: 5px 10px;
3521 font-size: 12px;
3522 border-radius: 3px;
3523}
3524.input-group-addon.input-lg {
3525 padding: 10px 16px;
3526 font-size: 18px;
3527 border-radius: 6px;
3528}
3529.input-group-addon input[type="radio"],
3530.input-group-addon input[type="checkbox"] {
3531 margin-top: 0;
3532}
3533.input-group .form-control:first-child,
3534.input-group-addon:first-child,
3535.input-group-btn:first-child > .btn,
3536.input-group-btn:first-child > .btn-group > .btn,
3537.input-group-btn:first-child > .dropdown-toggle,
3538.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
3539.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
3540 border-top-right-radius: 0;
3541 border-bottom-right-radius: 0;
3542}
3543.input-group-addon:first-child {
3544 border-right: 0;
3545}
3546.input-group .form-control:last-child,
3547.input-group-addon:last-child,
3548.input-group-btn:last-child > .btn,
3549.input-group-btn:last-child > .btn-group > .btn,
3550.input-group-btn:last-child > .dropdown-toggle,
3551.input-group-btn:first-child > .btn:not(:first-child),
3552.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
3553 border-top-left-radius: 0;
3554 border-bottom-left-radius: 0;
3555}
3556.input-group-addon:last-child {
3557 border-left: 0;
3558}
3559.input-group-btn {
3560 position: relative;
3561 font-size: 0;
3562 white-space: nowrap;
3563}
3564.input-group-btn > .btn {
3565 position: relative;
3566}
3567.input-group-btn > .btn + .btn {
3568 margin-left: -1px;
3569}
3570.input-group-btn > .btn:hover,
3571.input-group-btn > .btn:focus,
3572.input-group-btn > .btn:active {
3573 z-index: 2;
3574}
3575.input-group-btn:first-child > .btn,
3576.input-group-btn:first-child > .btn-group {
3577 margin-right: -1px;
3578}
3579.input-group-btn:last-child > .btn,
3580.input-group-btn:last-child > .btn-group {
3581 margin-left: -1px;
3582}
3583.nav {
3584 padding-left: 0;
3585 margin-bottom: 0;
3586 list-style: none;
3587}
3588.nav > li {
3589 position: relative;
3590 display: block;
3591}
3592.nav > li > a {
3593 position: relative;
3594 display: block;
3595 padding: 10px 15px;
3596}
3597.nav > li > a:hover,
3598.nav > li > a:focus {
3599 text-decoration: none;
3600 background-color: #eee;
3601}
3602.nav > li.disabled > a {
3603 color: #777;
3604}
3605.nav > li.disabled > a:hover,
3606.nav > li.disabled > a:focus {
3607 color: #777;
3608 text-decoration: none;
3609 cursor: not-allowed;
3610 background-color: transparent;
3611}
3612.nav .open > a,
3613.nav .open > a:hover,
3614.nav .open > a:focus {
3615 background-color: #eee;
3616 border-color: #428bca;
3617}
3618.nav .nav-divider {
3619 height: 1px;
3620 margin: 9px 0;
3621 overflow: hidden;
3622 background-color: #e5e5e5;
3623}
3624.nav > li > a > img {
3625 max-width: none;
3626}
3627.nav-tabs {
3628 border-bottom: 1px solid #ddd;
3629}
3630.nav-tabs > li {
3631 float: left;
3632 margin-bottom: -1px;
3633}
3634.nav-tabs > li > a {
3635 margin-right: 2px;
3636 line-height: 1.42857143;
3637 border: 1px solid transparent;
3638 border-radius: 4px 4px 0 0;
3639}
3640.nav-tabs > li > a:hover {
3641 border-color: #eee #eee #ddd;
3642}
3643.nav-tabs > li.active > a,
3644.nav-tabs > li.active > a:hover,
3645.nav-tabs > li.active > a:focus {
3646 color: #555;
3647 cursor: default;
3648 background-color: #fff;
3649 border: 1px solid #ddd;
3650 border-bottom-color: transparent;
3651}
3652.nav-tabs.nav-justified {
3653 width: 100%;
3654 border-bottom: 0;
3655}
3656.nav-tabs.nav-justified > li {
3657 float: none;
3658}
3659.nav-tabs.nav-justified > li > a {
3660 margin-bottom: 5px;
3661 text-align: center;
3662}
3663.nav-tabs.nav-justified > .dropdown .dropdown-menu {
3664 top: auto;
3665 left: auto;
3666}
3667@media (min-width: 768px) {
3668 .nav-tabs.nav-justified > li {
3669 display: table-cell;
3670 width: 1%;
3671 }
3672 .nav-tabs.nav-justified > li > a {
3673 margin-bottom: 0;
3674 }
3675}
3676.nav-tabs.nav-justified > li > a {
3677 margin-right: 0;
3678 border-radius: 4px;
3679}
3680.nav-tabs.nav-justified > .active > a,
3681.nav-tabs.nav-justified > .active > a:hover,
3682.nav-tabs.nav-justified > .active > a:focus {
3683 border: 1px solid #ddd;
3684}
3685@media (min-width: 768px) {
3686 .nav-tabs.nav-justified > li > a {
3687 border-bottom: 1px solid #ddd;
3688 border-radius: 4px 4px 0 0;
3689 }
3690 .nav-tabs.nav-justified > .active > a,
3691 .nav-tabs.nav-justified > .active > a:hover,
3692 .nav-tabs.nav-justified > .active > a:focus {
3693 border-bottom-color: #fff;
3694 }
3695}
3696.nav-pills > li {
3697 float: left;
3698}
3699.nav-pills > li > a {
3700 border-radius: 4px;
3701}
3702.nav-pills > li + li {
3703 margin-left: 2px;
3704}
3705.nav-pills > li.active > a,
3706.nav-pills > li.active > a:hover,
3707.nav-pills > li.active > a:focus {
3708 color: #fff;
3709 background-color: #428bca;
3710}
3711.nav-stacked > li {
3712 float: none;
3713}
3714.nav-stacked > li + li {
3715 margin-top: 2px;
3716 margin-left: 0;
3717}
3718.nav-justified {
3719 width: 100%;
3720}
3721.nav-justified > li {
3722 float: none;
3723}
3724.nav-justified > li > a {
3725 margin-bottom: 5px;
3726 text-align: center;
3727}
3728.nav-justified > .dropdown .dropdown-menu {
3729 top: auto;
3730 left: auto;
3731}
3732@media (min-width: 768px) {
3733 .nav-justified > li {
3734 display: table-cell;
3735 width: 1%;
3736 }
3737 .nav-justified > li > a {
3738 margin-bottom: 0;
3739 }
3740}
3741.nav-tabs-justified {
3742 border-bottom: 0;
3743}
3744.nav-tabs-justified > li > a {
3745 margin-right: 0;
3746 border-radius: 4px;
3747}
3748.nav-tabs-justified > .active > a,
3749.nav-tabs-justified > .active > a:hover,
3750.nav-tabs-justified > .active > a:focus {
3751 border: 1px solid #ddd;
3752}
3753@media (min-width: 768px) {
3754 .nav-tabs-justified > li > a {
3755 border-bottom: 1px solid #ddd;
3756 border-radius: 4px 4px 0 0;
3757 }
3758 .nav-tabs-justified > .active > a,
3759 .nav-tabs-justified > .active > a:hover,
3760 .nav-tabs-justified > .active > a:focus {
3761 border-bottom-color: #fff;
3762 }
3763}
3764.tab-content > .tab-pane {
3765 display: none;
3766}
3767.tab-content > .active {
3768 display: block;
3769}
3770.nav-tabs .dropdown-menu {
3771 margin-top: -1px;
3772 border-top-left-radius: 0;
3773 border-top-right-radius: 0;
3774}
3775.navbar {
3776 position: relative;
3777 min-height: 50px;
3778 margin-bottom: 20px;
3779 border: 1px solid transparent;
3780}
3781@media (min-width: 768px) {
3782 .navbar {
3783 border-radius: 4px;
3784 }
3785}
3786@media (min-width: 768px) {
3787 .navbar-header {
3788 float: left;
3789 }
3790}
3791.navbar-collapse {
3792 padding-right: 15px;
3793 padding-left: 15px;
3794 overflow-x: visible;
3795 -webkit-overflow-scrolling: touch;
3796 border-top: 1px solid transparent;
3797 -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
3798 box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
3799}
3800.navbar-collapse.in {
3801 overflow-y: auto;
3802}
3803@media (min-width: 768px) {
3804 .navbar-collapse {
3805 width: auto;
3806 border-top: 0;
3807 -webkit-box-shadow: none;
3808 box-shadow: none;
3809 }
3810 .navbar-collapse.collapse {
3811 display: block !important;
3812 height: auto !important;
3813 padding-bottom: 0;
3814 overflow: visible !important;
3815 }
3816 .navbar-collapse.in {
3817 overflow-y: visible;
3818 }
3819 .navbar-fixed-top .navbar-collapse,
3820 .navbar-static-top .navbar-collapse,
3821 .navbar-fixed-bottom .navbar-collapse {
3822 padding-right: 0;
3823 padding-left: 0;
3824 }
3825}
3826.navbar-fixed-top .navbar-collapse,
3827.navbar-fixed-bottom .navbar-collapse {
3828 max-height: 340px;
3829}
3830@media (max-width: 480px) and (orientation: landscape) {
3831 .navbar-fixed-top .navbar-collapse,
3832 .navbar-fixed-bottom .navbar-collapse {
3833 max-height: 200px;
3834 }
3835}
3836.container > .navbar-header,
3837.container-fluid > .navbar-header,
3838.container > .navbar-collapse,
3839.container-fluid > .navbar-collapse {
3840 margin-right: -15px;
3841 margin-left: -15px;
3842}
3843@media (min-width: 768px) {
3844 .container > .navbar-header,
3845 .container-fluid > .navbar-header,
3846 .container > .navbar-collapse,
3847 .container-fluid > .navbar-collapse {
3848 margin-right: 0;
3849 margin-left: 0;
3850 }
3851}
3852.navbar-static-top {
3853 z-index: 1000;
3854 border-width: 0 0 1px;
3855}
3856@media (min-width: 768px) {
3857 .navbar-static-top {
3858 border-radius: 0;
3859 }
3860}
3861.navbar-fixed-top,
3862.navbar-fixed-bottom {
3863 position: fixed;
3864 right: 0;
3865 left: 0;
3866 z-index: 1030;
3867 -webkit-transform: translate3d(0, 0, 0);
3868 -o-transform: translate3d(0, 0, 0);
3869 transform: translate3d(0, 0, 0);
3870}
3871@media (min-width: 768px) {
3872 .navbar-fixed-top,
3873 .navbar-fixed-bottom {
3874 border-radius: 0;
3875 }
3876}
3877.navbar-fixed-top {
3878 top: 0;
3879 border-width: 0 0 1px;
3880}
3881.navbar-fixed-bottom {
3882 bottom: 0;
3883 margin-bottom: 0;
3884 border-width: 1px 0 0;
3885}
3886.navbar-brand {
3887 float: left;
3888 height: 50px;
3889 padding: 15px 15px;
3890 font-size: 18px;
3891 line-height: 20px;
3892}
3893.navbar-brand:hover,
3894.navbar-brand:focus {
3895 text-decoration: none;
3896}
3897@media (min-width: 768px) {
3898 .navbar > .container .navbar-brand,
3899 .navbar > .container-fluid .navbar-brand {
3900 margin-left: -15px;
3901 }
3902}
3903.navbar-toggle {
3904 position: relative;
3905 float: right;
3906 padding: 9px 10px;
3907 margin-top: 8px;
3908 margin-right: 15px;
3909 margin-bottom: 8px;
3910 background-color: transparent;
3911 background-image: none;
3912 border: 1px solid transparent;
3913 border-radius: 4px;
3914}
3915.navbar-toggle:focus {
3916 outline: 0;
3917}
3918.navbar-toggle .icon-bar {
3919 display: block;
3920 width: 22px;
3921 height: 2px;
3922 border-radius: 1px;
3923}
3924.navbar-toggle .icon-bar + .icon-bar {
3925 margin-top: 4px;
3926}
3927@media (min-width: 768px) {
3928 .navbar-toggle {
3929 display: none;
3930 }
3931}
3932.navbar-nav {
3933 margin: 7.5px -15px;
3934}
3935.navbar-nav > li > a {
3936 padding-top: 10px;
3937 padding-bottom: 10px;
3938 line-height: 20px;
3939}
3940@media (max-width: 767px) {
3941 .navbar-nav .open .dropdown-menu {
3942 position: static;
3943 float: none;
3944 width: auto;
3945 margin-top: 0;
3946 background-color: transparent;
3947 border: 0;
3948 -webkit-box-shadow: none;
3949 box-shadow: none;
3950 }
3951 .navbar-nav .open .dropdown-menu > li > a,
3952 .navbar-nav .open .dropdown-menu .dropdown-header {
3953 padding: 5px 15px 5px 25px;
3954 }
3955 .navbar-nav .open .dropdown-menu > li > a {
3956 line-height: 20px;
3957 }
3958 .navbar-nav .open .dropdown-menu > li > a:hover,
3959 .navbar-nav .open .dropdown-menu > li > a:focus {
3960 background-image: none;
3961 }
3962}
3963@media (min-width: 768px) {
3964 .navbar-nav {
3965 float: left;
3966 margin: 0;
3967 }
3968 .navbar-nav > li {
3969 float: left;
3970 }
3971 .navbar-nav > li > a {
3972 padding-top: 15px;
3973 padding-bottom: 15px;
3974 }
3975 .navbar-nav.navbar-right:last-child {
3976 margin-right: -15px;
3977 }
3978}
3979@media (min-width: 768px) {
3980 .navbar-left {
3981 float: left !important;
3982 }
3983 .navbar-right {
3984 float: right !important;
3985 }
3986}
3987.navbar-form {
3988 padding: 10px 15px;
3989 margin-top: 8px;
3990 margin-right: -15px;
3991 margin-bottom: 8px;
3992 margin-left: -15px;
3993 border-top: 1px solid transparent;
3994 border-bottom: 1px solid transparent;
3995 -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
3996 box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);
3997}
3998@media (min-width: 768px) {
3999 .navbar-form .form-group {
4000 display: inline-block;
4001 margin-bottom: 0;
4002 vertical-align: middle;
4003 }
4004 .navbar-form .form-control {
4005 display: inline-block;
4006 width: auto;
4007 vertical-align: middle;
4008 }
4009 .navbar-form .input-group {
4010 display: inline-table;
4011 vertical-align: middle;
4012 }
4013 .navbar-form .input-group .input-group-addon,
4014 .navbar-form .input-group .input-group-btn,
4015 .navbar-form .input-group .form-control {
4016 width: auto;
4017 }
4018 .navbar-form .input-group > .form-control {
4019 width: 100%;
4020 }
4021 .navbar-form .control-label {
4022 margin-bottom: 0;
4023 vertical-align: middle;
4024 }
4025 .navbar-form .radio,
4026 .navbar-form .checkbox {
4027 display: inline-block;
4028 margin-top: 0;
4029 margin-bottom: 0;
4030 vertical-align: middle;
4031 }
4032 .navbar-form .radio label,
4033 .navbar-form .checkbox label {
4034 padding-left: 0;
4035 }
4036 .navbar-form .radio input[type="radio"],
4037 .navbar-form .checkbox input[type="checkbox"] {
4038 position: relative;
4039 margin-left: 0;
4040 }
4041 .navbar-form .has-feedback .form-control-feedback {
4042 top: 0;
4043 }
4044}
4045@media (max-width: 767px) {
4046 .navbar-form .form-group {
4047 margin-bottom: 5px;
4048 }
4049}
4050@media (min-width: 768px) {
4051 .navbar-form {
4052 width: auto;
4053 padding-top: 0;
4054 padding-bottom: 0;
4055 margin-right: 0;
4056 margin-left: 0;
4057 border: 0;
4058 -webkit-box-shadow: none;
4059 box-shadow: none;
4060 }
4061 .navbar-form.navbar-right:last-child {
4062 margin-right: -15px;
4063 }
4064}
4065.navbar-nav > li > .dropdown-menu {
4066 margin-top: 0;
4067 border-top-left-radius: 0;
4068 border-top-right-radius: 0;
4069}
4070.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
4071 border-bottom-right-radius: 0;
4072 border-bottom-left-radius: 0;
4073}
4074.navbar-btn {
4075 margin-top: 8px;
4076 margin-bottom: 8px;
4077}
4078.navbar-btn.btn-sm {
4079 margin-top: 10px;
4080 margin-bottom: 10px;
4081}
4082.navbar-btn.btn-xs {
4083 margin-top: 14px;
4084 margin-bottom: 14px;
4085}
4086.navbar-text {
4087 margin-top: 15px;
4088 margin-bottom: 15px;
4089}
4090@media (min-width: 768px) {
4091 .navbar-text {
4092 float: left;
4093 margin-right: 15px;
4094 margin-left: 15px;
4095 }
4096 .navbar-text.navbar-right:last-child {
4097 margin-right: 0;
4098 }
4099}
4100.navbar-default {
4101 background-color: #f8f8f8;
4102 border-color: #e7e7e7;
4103}
4104.navbar-default .navbar-brand {
4105 color: #777;
4106}
4107.navbar-default .navbar-brand:hover,
4108.navbar-default .navbar-brand:focus {
4109 color: #5e5e5e;
4110 background-color: transparent;
4111}
4112.navbar-default .navbar-text {
4113 color: #777;
4114}
4115.navbar-default .navbar-nav > li > a {
4116 color: #777;
4117}
4118.navbar-default .navbar-nav > li > a:hover,
4119.navbar-default .navbar-nav > li > a:focus {
4120 color: #333;
4121 background-color: transparent;
4122}
4123.navbar-default .navbar-nav > .active > a,
4124.navbar-default .navbar-nav > .active > a:hover,
4125.navbar-default .navbar-nav > .active > a:focus {
4126 color: #555;
4127 background-color: #e7e7e7;
4128}
4129.navbar-default .navbar-nav > .disabled > a,
4130.navbar-default .navbar-nav > .disabled > a:hover,
4131.navbar-default .navbar-nav > .disabled > a:focus {
4132 color: #ccc;
4133 background-color: transparent;
4134}
4135.navbar-default .navbar-toggle {
4136 border-color: #ddd;
4137}
4138.navbar-default .navbar-toggle:hover,
4139.navbar-default .navbar-toggle:focus {
4140 background-color: #ddd;
4141}
4142.navbar-default .navbar-toggle .icon-bar {
4143 background-color: #888;
4144}
4145.navbar-default .navbar-collapse,
4146.navbar-default .navbar-form {
4147 border-color: #e7e7e7;
4148}
4149.navbar-default .navbar-nav > .open > a,
4150.navbar-default .navbar-nav > .open > a:hover,
4151.navbar-default .navbar-nav > .open > a:focus {
4152 color: #555;
4153 background-color: #e7e7e7;
4154}
4155@media (max-width: 767px) {
4156 .navbar-default .navbar-nav .open .dropdown-menu > li > a {
4157 color: #777;
4158 }
4159 .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
4160 .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
4161 color: #333;
4162 background-color: transparent;
4163 }
4164 .navbar-default .navbar-nav .open .dropdown-menu > .active > a,
4165 .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
4166 .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
4167 color: #555;
4168 background-color: #e7e7e7;
4169 }
4170 .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,
4171 .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,
4172 .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {
4173 color: #ccc;
4174 background-color: transparent;
4175 }
4176}
4177.navbar-default .navbar-link {
4178 color: #777;
4179}
4180.navbar-default .navbar-link:hover {
4181 color: #333;
4182}
4183.navbar-default .btn-link {
4184 color: #777;
4185}
4186.navbar-default .btn-link:hover,
4187.navbar-default .btn-link:focus {
4188 color: #333;
4189}
4190.navbar-default .btn-link[disabled]:hover,
4191fieldset[disabled] .navbar-default .btn-link:hover,
4192.navbar-default .btn-link[disabled]:focus,
4193fieldset[disabled] .navbar-default .btn-link:focus {
4194 color: #ccc;
4195}
4196.navbar-inverse {
4197 background-color: #222;
4198 border-color: #080808;
4199}
4200.navbar-inverse .navbar-brand {
4201 color: #777;
4202}
4203.navbar-inverse .navbar-brand:hover,
4204.navbar-inverse .navbar-brand:focus {
4205 color: #fff;
4206 background-color: transparent;
4207}
4208.navbar-inverse .navbar-text {
4209 color: #777;
4210}
4211.navbar-inverse .navbar-nav > li > a {
4212 color: #777;
4213}
4214.navbar-inverse .navbar-nav > li > a:hover,
4215.navbar-inverse .navbar-nav > li > a:focus {
4216 color: #fff;
4217 background-color: transparent;
4218}
4219.navbar-inverse .navbar-nav > .active > a,
4220.navbar-inverse .navbar-nav > .active > a:hover,
4221.navbar-inverse .navbar-nav > .active > a:focus {
4222 color: #fff;
4223 background-color: #080808;
4224}
4225.navbar-inverse .navbar-nav > .disabled > a,
4226.navbar-inverse .navbar-nav > .disabled > a:hover,
4227.navbar-inverse .navbar-nav > .disabled > a:focus {
4228 color: #444;
4229 background-color: transparent;
4230}
4231.navbar-inverse .navbar-toggle {
4232 border-color: #333;
4233}
4234.navbar-inverse .navbar-toggle:hover,
4235.navbar-inverse .navbar-toggle:focus {
4236 background-color: #333;
4237}
4238.navbar-inverse .navbar-toggle .icon-bar {
4239 background-color: #fff;
4240}
4241.navbar-inverse .navbar-collapse,
4242.navbar-inverse .navbar-form {
4243 border-color: #101010;
4244}
4245.navbar-inverse .navbar-nav > .open > a,
4246.navbar-inverse .navbar-nav > .open > a:hover,
4247.navbar-inverse .navbar-nav > .open > a:focus {
4248 color: #fff;
4249 background-color: #080808;
4250}
4251@media (max-width: 767px) {
4252 .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {
4253 border-color: #080808;
4254 }
4255 .navbar-inverse .navbar-nav .open .dropdown-menu .divider {
4256 background-color: #080808;
4257 }
4258 .navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
4259 color: #777;
4260 }
4261 .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,
4262 .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {
4263 color: #fff;
4264 background-color: transparent;
4265 }
4266 .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,
4267 .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,
4268 .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {
4269 color: #fff;
4270 background-color: #080808;
4271 }
4272 .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,
4273 .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,
4274 .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {
4275 color: #444;
4276 background-color: transparent;
4277 }
4278}
4279.navbar-inverse .navbar-link {
4280 color: #777;
4281}
4282.navbar-inverse .navbar-link:hover {
4283 color: #fff;
4284}
4285.navbar-inverse .btn-link {
4286 color: #777;
4287}
4288.navbar-inverse .btn-link:hover,
4289.navbar-inverse .btn-link:focus {
4290 color: #fff;
4291}
4292.navbar-inverse .btn-link[disabled]:hover,
4293fieldset[disabled] .navbar-inverse .btn-link:hover,
4294.navbar-inverse .btn-link[disabled]:focus,
4295fieldset[disabled] .navbar-inverse .btn-link:focus {
4296 color: #444;
4297}
4298.breadcrumb {
4299 padding: 8px 15px;
4300 margin-bottom: 20px;
4301 list-style: none;
4302 background-color: #f5f5f5;
4303 border-radius: 4px;
4304}
4305.breadcrumb > li {
4306 display: inline-block;
4307}
4308.breadcrumb > li + li:before {
4309 padding: 0 5px;
4310 color: #ccc;
4311 content: "/\00a0";
4312}
4313.breadcrumb > .active {
4314 color: #777;
4315}
4316.pagination {
4317 display: inline-block;
4318 padding-left: 0;
4319 margin: 20px 0;
4320 border-radius: 4px;
4321}
4322.pagination > li {
4323 display: inline;
4324}
4325.pagination > li > a,
4326.pagination > li > span {
4327 position: relative;
4328 float: left;
4329 padding: 6px 12px;
4330 margin-left: -1px;
4331 line-height: 1.42857143;
4332 color: #428bca;
4333 text-decoration: none;
4334 background-color: #fff;
4335 border: 1px solid #ddd;
4336}
4337.pagination > li:first-child > a,
4338.pagination > li:first-child > span {
4339 margin-left: 0;
4340 border-top-left-radius: 4px;
4341 border-bottom-left-radius: 4px;
4342}
4343.pagination > li:last-child > a,
4344.pagination > li:last-child > span {
4345 border-top-right-radius: 4px;
4346 border-bottom-right-radius: 4px;
4347}
4348.pagination > li > a:hover,
4349.pagination > li > span:hover,
4350.pagination > li > a:focus,
4351.pagination > li > span:focus {
4352 color: #2a6496;
4353 background-color: #eee;
4354 border-color: #ddd;
4355}
4356.pagination > .active > a,
4357.pagination > .active > span,
4358.pagination > .active > a:hover,
4359.pagination > .active > span:hover,
4360.pagination > .active > a:focus,
4361.pagination > .active > span:focus {
4362 z-index: 2;
4363 color: #fff;
4364 cursor: default;
4365 background-color: #428bca;
4366 border-color: #428bca;
4367}
4368.pagination > .disabled > span,
4369.pagination > .disabled > span:hover,
4370.pagination > .disabled > span:focus,
4371.pagination > .disabled > a,
4372.pagination > .disabled > a:hover,
4373.pagination > .disabled > a:focus {
4374 color: #777;
4375 cursor: not-allowed;
4376 background-color: #fff;
4377 border-color: #ddd;
4378}
4379.pagination-lg > li > a,
4380.pagination-lg > li > span {
4381 padding: 10px 16px;
4382 font-size: 18px;
4383}
4384.pagination-lg > li:first-child > a,
4385.pagination-lg > li:first-child > span {
4386 border-top-left-radius: 6px;
4387 border-bottom-left-radius: 6px;
4388}
4389.pagination-lg > li:last-child > a,
4390.pagination-lg > li:last-child > span {
4391 border-top-right-radius: 6px;
4392 border-bottom-right-radius: 6px;
4393}
4394.pagination-sm > li > a,
4395.pagination-sm > li > span {
4396 padding: 5px 10px;
4397 font-size: 12px;
4398}
4399.pagination-sm > li:first-child > a,
4400.pagination-sm > li:first-child > span {
4401 border-top-left-radius: 3px;
4402 border-bottom-left-radius: 3px;
4403}
4404.pagination-sm > li:last-child > a,
4405.pagination-sm > li:last-child > span {
4406 border-top-right-radius: 3px;
4407 border-bottom-right-radius: 3px;
4408}
4409.pager {
4410 padding-left: 0;
4411 margin: 20px 0;
4412 text-align: center;
4413 list-style: none;
4414}
4415.pager li {
4416 display: inline;
4417}
4418.pager li > a,
4419.pager li > span {
4420 display: inline-block;
4421 padding: 5px 14px;
4422 background-color: #fff;
4423 border: 1px solid #ddd;
4424 border-radius: 15px;
4425}
4426.pager li > a:hover,
4427.pager li > a:focus {
4428 text-decoration: none;
4429 background-color: #eee;
4430}
4431.pager .next > a,
4432.pager .next > span {
4433 float: right;
4434}
4435.pager .previous > a,
4436.pager .previous > span {
4437 float: left;
4438}
4439.pager .disabled > a,
4440.pager .disabled > a:hover,
4441.pager .disabled > a:focus,
4442.pager .disabled > span {
4443 color: #777;
4444 cursor: not-allowed;
4445 background-color: #fff;
4446}
4447.label {
4448 display: inline;
4449 padding: .2em .6em .3em;
4450 font-size: 75%;
4451 font-weight: bold;
4452 line-height: 1;
4453 color: #fff;
4454 text-align: center;
4455 white-space: nowrap;
4456 vertical-align: baseline;
4457 border-radius: .25em;
4458}
4459a.label:hover,
4460a.label:focus {
4461 color: #fff;
4462 text-decoration: none;
4463 cursor: pointer;
4464}
4465.label:empty {
4466 display: none;
4467}
4468.btn .label {
4469 position: relative;
4470 top: -1px;
4471}
4472.label-default {
4473 background-color: #777;
4474}
4475.label-default[href]:hover,
4476.label-default[href]:focus {
4477 background-color: #5e5e5e;
4478}
4479.label-primary {
4480 background-color: #428bca;
4481}
4482.label-primary[href]:hover,
4483.label-primary[href]:focus {
4484 background-color: #3071a9;
4485}
4486.label-success {
4487 background-color: #5cb85c;
4488}
4489.label-success[href]:hover,
4490.label-success[href]:focus {
4491 background-color: #449d44;
4492}
4493.label-info {
4494 background-color: #5bc0de;
4495}
4496.label-info[href]:hover,
4497.label-info[href]:focus {
4498 background-color: #31b0d5;
4499}
4500.label-warning {
4501 background-color: #f0ad4e;
4502}
4503.label-warning[href]:hover,
4504.label-warning[href]:focus {
4505 background-color: #ec971f;
4506}
4507.label-danger {
4508 background-color: #d9534f;
4509}
4510.label-danger[href]:hover,
4511.label-danger[href]:focus {
4512 background-color: #c9302c;
4513}
4514.badge {
4515 display: inline-block;
4516 min-width: 10px;
4517 padding: 3px 7px;
4518 font-size: 12px;
4519 font-weight: bold;
4520 line-height: 1;
4521 color: #fff;
4522 text-align: center;
4523 white-space: nowrap;
4524 vertical-align: baseline;
4525 background-color: #777;
4526 border-radius: 10px;
4527}
4528.badge:empty {
4529 display: none;
4530}
4531.btn .badge {
4532 position: relative;
4533 top: -1px;
4534}
4535.btn-xs .badge {
4536 top: 0;
4537 padding: 1px 5px;
4538}
4539a.badge:hover,
4540a.badge:focus {
4541 color: #fff;
4542 text-decoration: none;
4543 cursor: pointer;
4544}
4545a.list-group-item.active > .badge,
4546.nav-pills > .active > a > .badge {
4547 color: #428bca;
4548 background-color: #fff;
4549}
4550.nav-pills > li > a > .badge {
4551 margin-left: 3px;
4552}
4553.jumbotron {
4554 padding: 30px;
4555 margin-bottom: 30px;
4556 color: inherit;
4557 background-color: #eee;
4558}
4559.jumbotron h1,
4560.jumbotron .h1 {
4561 color: inherit;
4562}
4563.jumbotron p {
4564 margin-bottom: 15px;
4565 font-size: 21px;
4566 font-weight: 200;
4567}
4568.jumbotron > hr {
4569 border-top-color: #d5d5d5;
4570}
4571.container .jumbotron {
4572 border-radius: 6px;
4573}
4574.jumbotron .container {
4575 max-width: 100%;
4576}
4577@media screen and (min-width: 768px) {
4578 .jumbotron {
4579 padding-top: 48px;
4580 padding-bottom: 48px;
4581 }
4582 .container .jumbotron {
4583 padding-right: 60px;
4584 padding-left: 60px;
4585 }
4586 .jumbotron h1,
4587 .jumbotron .h1 {
4588 font-size: 63px;
4589 }
4590}
4591.thumbnail {
4592 display: block;
4593 padding: 4px;
4594 margin-bottom: 20px;
4595 line-height: 1.42857143;
4596 background-color: #fff;
4597 border: 1px solid #ddd;
4598 border-radius: 4px;
4599 -webkit-transition: all .2s ease-in-out;
4600 -o-transition: all .2s ease-in-out;
4601 transition: all .2s ease-in-out;
4602}
4603.thumbnail > img,
4604.thumbnail a > img {
4605 margin-right: auto;
4606 margin-left: auto;
4607}
4608a.thumbnail:hover,
4609a.thumbnail:focus,
4610a.thumbnail.active {
4611 border-color: #428bca;
4612}
4613.thumbnail .caption {
4614 padding: 9px;
4615 color: #333;
4616}
4617.alert {
4618 padding: 15px;
4619 margin-bottom: 20px;
4620 border: 1px solid transparent;
4621 border-radius: 4px;
4622}
4623.alert h4 {
4624 margin-top: 0;
4625 color: inherit;
4626}
4627.alert .alert-link {
4628 font-weight: bold;
4629}
4630.alert > p,
4631.alert > ul {
4632 margin-bottom: 0;
4633}
4634.alert > p + p {
4635 margin-top: 5px;
4636}
4637.alert-dismissable,
4638.alert-dismissible {
4639 padding-right: 35px;
4640}
4641.alert-dismissable .close,
4642.alert-dismissible .close {
4643 position: relative;
4644 top: -2px;
4645 right: -21px;
4646 color: inherit;
4647}
4648.alert-success {
4649 color: #3c763d;
4650 background-color: #dff0d8;
4651 border-color: #d6e9c6;
4652}
4653.alert-success hr {
4654 border-top-color: #c9e2b3;
4655}
4656.alert-success .alert-link {
4657 color: #2b542c;
4658}
4659.alert-info {
4660 color: #31708f;
4661 background-color: #d9edf7;
4662 border-color: #bce8f1;
4663}
4664.alert-info hr {
4665 border-top-color: #a6e1ec;
4666}
4667.alert-info .alert-link {
4668 color: #245269;
4669}
4670.alert-warning {
4671 color: #8a6d3b;
4672 background-color: #fcf8e3;
4673 border-color: #faebcc;
4674}
4675.alert-warning hr {
4676 border-top-color: #f7e1b5;
4677}
4678.alert-warning .alert-link {
4679 color: #66512c;
4680}
4681.alert-danger {
4682 color: #a94442;
4683 background-color: #f2dede;
4684 border-color: #ebccd1;
4685}
4686.alert-danger hr {
4687 border-top-color: #e4b9c0;
4688}
4689.alert-danger .alert-link {
4690 color: #843534;
4691}
4692@-webkit-keyframes progress-bar-stripes {
4693 from {
4694 background-position: 40px 0;
4695 }
4696 to {
4697 background-position: 0 0;
4698 }
4699}
4700@-o-keyframes progress-bar-stripes {
4701 from {
4702 background-position: 40px 0;
4703 }
4704 to {
4705 background-position: 0 0;
4706 }
4707}
4708@keyframes progress-bar-stripes {
4709 from {
4710 background-position: 40px 0;
4711 }
4712 to {
4713 background-position: 0 0;
4714 }
4715}
4716.progress {
4717 height: 20px;
4718 margin-bottom: 20px;
4719 overflow: hidden;
4720 background-color: #f5f5f5;
4721 border-radius: 4px;
4722 -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
4723 box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);
4724}
4725.progress-bar {
4726 float: left;
4727 width: 0;
4728 height: 100%;
4729 font-size: 12px;
4730 line-height: 20px;
4731 color: #fff;
4732 text-align: center;
4733 background-color: #428bca;
4734 -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
4735 box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);
4736 -webkit-transition: width .6s ease;
4737 -o-transition: width .6s ease;
4738 transition: width .6s ease;
4739}
4740.progress-striped .progress-bar,
4741.progress-bar-striped {
4742 background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4743 background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4744 background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4745 -webkit-background-size: 40px 40px;
4746 background-size: 40px 40px;
4747}
4748.progress.active .progress-bar,
4749.progress-bar.active {
4750 -webkit-animation: progress-bar-stripes 2s linear infinite;
4751 -o-animation: progress-bar-stripes 2s linear infinite;
4752 animation: progress-bar-stripes 2s linear infinite;
4753}
4754.progress-bar[aria-valuenow="1"],
4755.progress-bar[aria-valuenow="2"] {
4756 min-width: 30px;
4757}
4758.progress-bar[aria-valuenow="0"] {
4759 min-width: 30px;
4760 color: #777;
4761 background-color: transparent;
4762 background-image: none;
4763 -webkit-box-shadow: none;
4764 box-shadow: none;
4765}
4766.progress-bar-success {
4767 background-color: #5cb85c;
4768}
4769.progress-striped .progress-bar-success {
4770 background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4771 background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4772 background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4773}
4774.progress-bar-info {
4775 background-color: #5bc0de;
4776}
4777.progress-striped .progress-bar-info {
4778 background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4779 background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4780 background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4781}
4782.progress-bar-warning {
4783 background-color: #f0ad4e;
4784}
4785.progress-striped .progress-bar-warning {
4786 background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4787 background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4788 background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4789}
4790.progress-bar-danger {
4791 background-color: #d9534f;
4792}
4793.progress-striped .progress-bar-danger {
4794 background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4795 background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4796 background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
4797}
4798.media,
4799.media-body {
4800 overflow: hidden;
4801 zoom: 1;
4802}
4803.media,
4804.media .media {
4805 margin-top: 15px;
4806}
4807.media:first-child {
4808 margin-top: 0;
4809}
4810.media-object {
4811 display: block;
4812}
4813.media-heading {
4814 margin: 0 0 5px;
4815}
4816.media > .pull-left {
4817 margin-right: 10px;
4818}
4819.media > .pull-right {
4820 margin-left: 10px;
4821}
4822.media-list {
4823 padding-left: 0;
4824 list-style: none;
4825}
4826.list-group {
4827 padding-left: 0;
4828 margin-bottom: 20px;
4829}
4830.list-group-item {
4831 position: relative;
4832 display: block;
4833 padding: 10px 15px;
4834 margin-bottom: -1px;
4835 background-color: #fff;
4836 border: 1px solid #ddd;
4837}
4838.list-group-item:first-child {
4839 border-top-left-radius: 4px;
4840 border-top-right-radius: 4px;
4841}
4842.list-group-item:last-child {
4843 margin-bottom: 0;
4844 border-bottom-right-radius: 4px;
4845 border-bottom-left-radius: 4px;
4846}
4847.list-group-item > .badge {
4848 float: right;
4849}
4850.list-group-item > .badge + .badge {
4851 margin-right: 5px;
4852}
4853a.list-group-item {
4854 color: #555;
4855}
4856a.list-group-item .list-group-item-heading {
4857 color: #333;
4858}
4859a.list-group-item:hover,
4860a.list-group-item:focus {
4861 color: #555;
4862 text-decoration: none;
4863 background-color: #f5f5f5;
4864}
4865.list-group-item.disabled,
4866.list-group-item.disabled:hover,
4867.list-group-item.disabled:focus {
4868 color: #777;
4869 background-color: #eee;
4870}
4871.list-group-item.disabled .list-group-item-heading,
4872.list-group-item.disabled:hover .list-group-item-heading,
4873.list-group-item.disabled:focus .list-group-item-heading {
4874 color: inherit;
4875}
4876.list-group-item.disabled .list-group-item-text,
4877.list-group-item.disabled:hover .list-group-item-text,
4878.list-group-item.disabled:focus .list-group-item-text {
4879 color: #777;
4880}
4881.list-group-item.active,
4882.list-group-item.active:hover,
4883.list-group-item.active:focus {
4884 z-index: 2;
4885 color: #fff;
4886 background-color: #428bca;
4887 border-color: #428bca;
4888}
4889.list-group-item.active .list-group-item-heading,
4890.list-group-item.active:hover .list-group-item-heading,
4891.list-group-item.active:focus .list-group-item-heading,
4892.list-group-item.active .list-group-item-heading > small,
4893.list-group-item.active:hover .list-group-item-heading > small,
4894.list-group-item.active:focus .list-group-item-heading > small,
4895.list-group-item.active .list-group-item-heading > .small,
4896.list-group-item.active:hover .list-group-item-heading > .small,
4897.list-group-item.active:focus .list-group-item-heading > .small {
4898 color: inherit;
4899}
4900.list-group-item.active .list-group-item-text,
4901.list-group-item.active:hover .list-group-item-text,
4902.list-group-item.active:focus .list-group-item-text {
4903 color: #e1edf7;
4904}
4905.list-group-item-success {
4906 color: #3c763d;
4907 background-color: #dff0d8;
4908}
4909a.list-group-item-success {
4910 color: #3c763d;
4911}
4912a.list-group-item-success .list-group-item-heading {
4913 color: inherit;
4914}
4915a.list-group-item-success:hover,
4916a.list-group-item-success:focus {
4917 color: #3c763d;
4918 background-color: #d0e9c6;
4919}
4920a.list-group-item-success.active,
4921a.list-group-item-success.active:hover,
4922a.list-group-item-success.active:focus {
4923 color: #fff;
4924 background-color: #3c763d;
4925 border-color: #3c763d;
4926}
4927.list-group-item-info {
4928 color: #31708f;
4929 background-color: #d9edf7;
4930}
4931a.list-group-item-info {
4932 color: #31708f;
4933}
4934a.list-group-item-info .list-group-item-heading {
4935 color: inherit;
4936}
4937a.list-group-item-info:hover,
4938a.list-group-item-info:focus {
4939 color: #31708f;
4940 background-color: #c4e3f3;
4941}
4942a.list-group-item-info.active,
4943a.list-group-item-info.active:hover,
4944a.list-group-item-info.active:focus {
4945 color: #fff;
4946 background-color: #31708f;
4947 border-color: #31708f;
4948}
4949.list-group-item-warning {
4950 color: #8a6d3b;
4951 background-color: #fcf8e3;
4952}
4953a.list-group-item-warning {
4954 color: #8a6d3b;
4955}
4956a.list-group-item-warning .list-group-item-heading {
4957 color: inherit;
4958}
4959a.list-group-item-warning:hover,
4960a.list-group-item-warning:focus {
4961 color: #8a6d3b;
4962 background-color: #faf2cc;
4963}
4964a.list-group-item-warning.active,
4965a.list-group-item-warning.active:hover,
4966a.list-group-item-warning.active:focus {
4967 color: #fff;
4968 background-color: #8a6d3b;
4969 border-color: #8a6d3b;
4970}
4971.list-group-item-danger {
4972 color: #a94442;
4973 background-color: #f2dede;
4974}
4975a.list-group-item-danger {
4976 color: #a94442;
4977}
4978a.list-group-item-danger .list-group-item-heading {
4979 color: inherit;
4980}
4981a.list-group-item-danger:hover,
4982a.list-group-item-danger:focus {
4983 color: #a94442;
4984 background-color: #ebcccc;
4985}
4986a.list-group-item-danger.active,
4987a.list-group-item-danger.active:hover,
4988a.list-group-item-danger.active:focus {
4989 color: #fff;
4990 background-color: #a94442;
4991 border-color: #a94442;
4992}
4993.list-group-item-heading {
4994 margin-top: 0;
4995 margin-bottom: 5px;
4996}
4997.list-group-item-text {
4998 margin-bottom: 0;
4999 line-height: 1.3;
5000}
5001.panel {
5002 margin-bottom: 20px;
5003 background-color: #fff;
5004 border: 1px solid transparent;
5005 border-radius: 4px;
5006 -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
5007 box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
5008}
5009.panel-body {
5010 padding: 15px;
5011}
5012.panel-heading {
5013 padding: 10px 15px;
5014 border-bottom: 1px solid transparent;
5015 border-top-left-radius: 3px;
5016 border-top-right-radius: 3px;
5017}
5018.panel-heading > .dropdown .dropdown-toggle {
5019 color: inherit;
5020}
5021.panel-title {
5022 margin-top: 0;
5023 margin-bottom: 0;
5024 font-size: 16px;
5025 color: inherit;
5026}
5027.panel-title > a {
5028 color: inherit;
5029}
5030.panel-footer {
5031 padding: 10px 15px;
5032 background-color: #f5f5f5;
5033 border-top: 1px solid #ddd;
5034 border-bottom-right-radius: 3px;
5035 border-bottom-left-radius: 3px;
5036}
5037.panel > .list-group {
5038 margin-bottom: 0;
5039}
5040.panel > .list-group .list-group-item {
5041 border-width: 1px 0;
5042 border-radius: 0;
5043}
5044.panel > .list-group:first-child .list-group-item:first-child {
5045 border-top: 0;
5046 border-top-left-radius: 3px;
5047 border-top-right-radius: 3px;
5048}
5049.panel > .list-group:last-child .list-group-item:last-child {
5050 border-bottom: 0;
5051 border-bottom-right-radius: 3px;
5052 border-bottom-left-radius: 3px;
5053}
5054.panel-heading + .list-group .list-group-item:first-child {
5055 border-top-width: 0;
5056}
5057.list-group + .panel-footer {
5058 border-top-width: 0;
5059}
5060.panel > .table,
5061.panel > .table-responsive > .table,
5062.panel > .panel-collapse > .table {
5063 margin-bottom: 0;
5064}
5065.panel > .table:first-child,
5066.panel > .table-responsive:first-child > .table:first-child {
5067 border-top-left-radius: 3px;
5068 border-top-right-radius: 3px;
5069}
5070.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,
5071.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,
5072.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,
5073.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,
5074.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,
5075.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,
5076.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,
5077.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {
5078 border-top-left-radius: 3px;
5079}
5080.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,
5081.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,
5082.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,
5083.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,
5084.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,
5085.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,
5086.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,
5087.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {
5088 border-top-right-radius: 3px;
5089}
5090.panel > .table:last-child,
5091.panel > .table-responsive:last-child > .table:last-child {
5092 border-bottom-right-radius: 3px;
5093 border-bottom-left-radius: 3px;
5094}
5095.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,
5096.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,
5097.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
5098.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
5099.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,
5100.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,
5101.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
5102.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {
5103 border-bottom-left-radius: 3px;
5104}
5105.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,
5106.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,
5107.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
5108.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
5109.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,
5110.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,
5111.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
5112.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {
5113 border-bottom-right-radius: 3px;
5114}
5115.panel > .panel-body + .table,
5116.panel > .panel-body + .table-responsive {
5117 border-top: 1px solid #ddd;
5118}
5119.panel > .table > tbody:first-child > tr:first-child th,
5120.panel > .table > tbody:first-child > tr:first-child td {
5121 border-top: 0;
5122}
5123.panel > .table-bordered,
5124.panel > .table-responsive > .table-bordered {
5125 border: 0;
5126}
5127.panel > .table-bordered > thead > tr > th:first-child,
5128.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,
5129.panel > .table-bordered > tbody > tr > th:first-child,
5130.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,
5131.panel > .table-bordered > tfoot > tr > th:first-child,
5132.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,
5133.panel > .table-bordered > thead > tr > td:first-child,
5134.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,
5135.panel > .table-bordered > tbody > tr > td:first-child,
5136.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,
5137.panel > .table-bordered > tfoot > tr > td:first-child,
5138.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {
5139 border-left: 0;
5140}
5141.panel > .table-bordered > thead > tr > th:last-child,
5142.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,
5143.panel > .table-bordered > tbody > tr > th:last-child,
5144.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,
5145.panel > .table-bordered > tfoot > tr > th:last-child,
5146.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,
5147.panel > .table-bordered > thead > tr > td:last-child,
5148.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,
5149.panel > .table-bordered > tbody > tr > td:last-child,
5150.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,
5151.panel > .table-bordered > tfoot > tr > td:last-child,
5152.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {
5153 border-right: 0;
5154}
5155.panel > .table-bordered > thead > tr:first-child > td,
5156.panel > .table-responsive > .table-bordered > thead > tr:first-child > td,
5157.panel > .table-bordered > tbody > tr:first-child > td,
5158.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,
5159.panel > .table-bordered > thead > tr:first-child > th,
5160.panel > .table-responsive > .table-bordered > thead > tr:first-child > th,
5161.panel > .table-bordered > tbody > tr:first-child > th,
5162.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th {
5163 border-bottom: 0;
5164}
5165.panel > .table-bordered > tbody > tr:last-child > td,
5166.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,
5167.panel > .table-bordered > tfoot > tr:last-child > td,
5168.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,
5169.panel > .table-bordered > tbody > tr:last-child > th,
5170.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,
5171.panel > .table-bordered > tfoot > tr:last-child > th,
5172.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th {
5173 border-bottom: 0;
5174}
5175.panel > .table-responsive {
5176 margin-bottom: 0;
5177 border: 0;
5178}
5179.panel-group {
5180 margin-bottom: 20px;
5181}
5182.panel-group .panel {
5183 margin-bottom: 0;
5184 border-radius: 4px;
5185}
5186.panel-group .panel + .panel {
5187 margin-top: 5px;
5188}
5189.panel-group .panel-heading {
5190 border-bottom: 0;
5191}
5192.panel-group .panel-heading + .panel-collapse > .panel-body {
5193 border-top: 1px solid #ddd;
5194}
5195.panel-group .panel-footer {
5196 border-top: 0;
5197}
5198.panel-group .panel-footer + .panel-collapse .panel-body {
5199 border-bottom: 1px solid #ddd;
5200}
5201.panel-default {
5202 border-color: #ddd;
5203}
5204.panel-default > .panel-heading {
5205 color: #333;
5206 background-color: #f5f5f5;
5207 border-color: #ddd;
5208}
5209.panel-default > .panel-heading + .panel-collapse > .panel-body {
5210 border-top-color: #ddd;
5211}
5212.panel-default > .panel-heading .badge {
5213 color: #f5f5f5;
5214 background-color: #333;
5215}
5216.panel-default > .panel-footer + .panel-collapse > .panel-body {
5217 border-bottom-color: #ddd;
5218}
5219.panel-primary {
5220 border-color: #428bca;
5221}
5222.panel-primary > .panel-heading {
5223 color: #fff;
5224 background-color: #428bca;
5225 border-color: #428bca;
5226}
5227.panel-primary > .panel-heading + .panel-collapse > .panel-body {
5228 border-top-color: #428bca;
5229}
5230.panel-primary > .panel-heading .badge {
5231 color: #428bca;
5232 background-color: #fff;
5233}
5234.panel-primary > .panel-footer + .panel-collapse > .panel-body {
5235 border-bottom-color: #428bca;
5236}
5237.panel-success {
5238 border-color: #d6e9c6;
5239}
5240.panel-success > .panel-heading {
5241 color: #3c763d;
5242 background-color: #dff0d8;
5243 border-color: #d6e9c6;
5244}
5245.panel-success > .panel-heading + .panel-collapse > .panel-body {
5246 border-top-color: #d6e9c6;
5247}
5248.panel-success > .panel-heading .badge {
5249 color: #dff0d8;
5250 background-color: #3c763d;
5251}
5252.panel-success > .panel-footer + .panel-collapse > .panel-body {
5253 border-bottom-color: #d6e9c6;
5254}
5255.panel-info {
5256 border-color: #bce8f1;
5257}
5258.panel-info > .panel-heading {
5259 color: #31708f;
5260 background-color: #d9edf7;
5261 border-color: #bce8f1;
5262}
5263.panel-info > .panel-heading + .panel-collapse > .panel-body {
5264 border-top-color: #bce8f1;
5265}
5266.panel-info > .panel-heading .badge {
5267 color: #d9edf7;
5268 background-color: #31708f;
5269}
5270.panel-info > .panel-footer + .panel-collapse > .panel-body {
5271 border-bottom-color: #bce8f1;
5272}
5273.panel-warning {
5274 border-color: #faebcc;
5275}
5276.panel-warning > .panel-heading {
5277 color: #8a6d3b;
5278 background-color: #fcf8e3;
5279 border-color: #faebcc;
5280}
5281.panel-warning > .panel-heading + .panel-collapse > .panel-body {
5282 border-top-color: #faebcc;
5283}
5284.panel-warning > .panel-heading .badge {
5285 color: #fcf8e3;
5286 background-color: #8a6d3b;
5287}
5288.panel-warning > .panel-footer + .panel-collapse > .panel-body {
5289 border-bottom-color: #faebcc;
5290}
5291.panel-danger {
5292 border-color: #ebccd1;
5293}
5294.panel-danger > .panel-heading {
5295 color: #a94442;
5296 background-color: #f2dede;
5297 border-color: #ebccd1;
5298}
5299.panel-danger > .panel-heading + .panel-collapse > .panel-body {
5300 border-top-color: #ebccd1;
5301}
5302.panel-danger > .panel-heading .badge {
5303 color: #f2dede;
5304 background-color: #a94442;
5305}
5306.panel-danger > .panel-footer + .panel-collapse > .panel-body {
5307 border-bottom-color: #ebccd1;
5308}
5309.embed-responsive {
5310 position: relative;
5311 display: block;
5312 height: 0;
5313 padding: 0;
5314 overflow: hidden;
5315}
5316.embed-responsive .embed-responsive-item,
5317.embed-responsive iframe,
5318.embed-responsive embed,
5319.embed-responsive object {
5320 position: absolute;
5321 top: 0;
5322 bottom: 0;
5323 left: 0;
5324 width: 100%;
5325 height: 100%;
5326 border: 0;
5327}
5328.embed-responsive.embed-responsive-16by9 {
5329 padding-bottom: 56.25%;
5330}
5331.embed-responsive.embed-responsive-4by3 {
5332 padding-bottom: 75%;
5333}
5334.well {
5335 min-height: 20px;
5336 padding: 19px;
5337 margin-bottom: 20px;
5338 background-color: #f5f5f5;
5339 border: 1px solid #e3e3e3;
5340 border-radius: 4px;
5341 -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
5342 box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
5343}
5344.well blockquote {
5345 border-color: #ddd;
5346 border-color: rgba(0, 0, 0, .15);
5347}
5348.well-lg {
5349 padding: 24px;
5350 border-radius: 6px;
5351}
5352.well-sm {
5353 padding: 9px;
5354 border-radius: 3px;
5355}
5356.close {
5357 float: right;
5358 font-size: 21px;
5359 font-weight: bold;
5360 line-height: 1;
5361 color: #000;
5362 text-shadow: 0 1px 0 #fff;
5363 filter: alpha(opacity=20);
5364 opacity: .2;
5365}
5366.close:hover,
5367.close:focus {
5368 color: #000;
5369 text-decoration: none;
5370 cursor: pointer;
5371 filter: alpha(opacity=50);
5372 opacity: .5;
5373}
5374button.close {
5375 -webkit-appearance: none;
5376 padding: 0;
5377 cursor: pointer;
5378 background: transparent;
5379 border: 0;
5380}
5381.modal-open {
5382 overflow: hidden;
5383}
5384.modal {
5385 position: fixed;
5386 top: 0;
5387 right: 0;
5388 bottom: 0;
5389 left: 0;
5390 z-index: 1050;
5391 display: none;
5392 overflow: hidden;
5393 -webkit-overflow-scrolling: touch;
5394 outline: 0;
5395}
5396.modal.fade .modal-dialog {
5397 -webkit-transition: -webkit-transform .3s ease-out;
5398 -o-transition: -o-transform .3s ease-out;
5399 transition: transform .3s ease-out;
5400 -webkit-transform: translate3d(0, -25%, 0);
5401 -o-transform: translate3d(0, -25%, 0);
5402 transform: translate3d(0, -25%, 0);
5403}
5404.modal.in .modal-dialog {
5405 -webkit-transform: translate3d(0, 0, 0);
5406 -o-transform: translate3d(0, 0, 0);
5407 transform: translate3d(0, 0, 0);
5408}
5409.modal-open .modal {
5410 overflow-x: hidden;
5411 overflow-y: auto;
5412}
5413.modal-dialog {
5414 position: relative;
5415 width: auto;
5416 margin: 10px;
5417}
5418.modal-content {
5419 position: relative;
5420 background-color: #fff;
5421 -webkit-background-clip: padding-box;
5422 background-clip: padding-box;
5423 border: 1px solid #999;
5424 border: 1px solid rgba(0, 0, 0, .2);
5425 border-radius: 6px;
5426 outline: 0;
5427 -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
5428 box-shadow: 0 3px 9px rgba(0, 0, 0, .5);
5429}
5430.modal-backdrop {
5431 position: fixed;
5432 top: 0;
5433 right: 0;
5434 bottom: 0;
5435 left: 0;
5436 z-index: 1040;
5437 background-color: #000;
5438}
5439.modal-backdrop.fade {
5440 filter: alpha(opacity=0);
5441 opacity: 0;
5442}
5443.modal-backdrop.in {
5444 filter: alpha(opacity=50);
5445 opacity: .5;
5446}
5447.modal-header {
5448 min-height: 16.42857143px;
5449 padding: 15px;
5450 border-bottom: 1px solid #e5e5e5;
5451}
5452.modal-header .close {
5453 margin-top: -2px;
5454}
5455.modal-title {
5456 margin: 0;
5457 line-height: 1.42857143;
5458}
5459.modal-body {
5460 position: relative;
5461 padding: 15px;
5462}
5463.modal-footer {
5464 padding: 15px;
5465 text-align: right;
5466 border-top: 1px solid #e5e5e5;
5467}
5468.modal-footer .btn + .btn {
5469 margin-bottom: 0;
5470 margin-left: 5px;
5471}
5472.modal-footer .btn-group .btn + .btn {
5473 margin-left: -1px;
5474}
5475.modal-footer .btn-block + .btn-block {
5476 margin-left: 0;
5477}
5478.modal-scrollbar-measure {
5479 position: absolute;
5480 top: -9999px;
5481 width: 50px;
5482 height: 50px;
5483 overflow: scroll;
5484}
5485@media (min-width: 768px) {
5486 .modal-dialog {
5487 width: 600px;
5488 margin: 30px auto;
5489 }
5490 .modal-content {
5491 -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
5492 box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
5493 }
5494 .modal-sm {
5495 width: 300px;
5496 }
5497}
5498@media (min-width: 992px) {
5499 .modal-lg {
5500 width: 900px;
5501 }
5502}
5503.tooltip {
5504 position: absolute;
5505 z-index: 1070;
5506 display: block;
5507 font-size: 12px;
5508 line-height: 1.4;
5509 visibility: visible;
5510 filter: alpha(opacity=0);
5511 opacity: 0;
5512}
5513.tooltip.in {
5514 filter: alpha(opacity=90);
5515 opacity: .9;
5516}
5517.tooltip.top {
5518 padding: 5px 0;
5519 margin-top: -3px;
5520}
5521.tooltip.right {
5522 padding: 0 5px;
5523 margin-left: 3px;
5524}
5525.tooltip.bottom {
5526 padding: 5px 0;
5527 margin-top: 3px;
5528}
5529.tooltip.left {
5530 padding: 0 5px;
5531 margin-left: -3px;
5532}
5533.tooltip-inner {
5534 max-width: 200px;
5535 padding: 3px 8px;
5536 color: #fff;
5537 text-align: center;
5538 text-decoration: none;
5539 background-color: #000;
5540 border-radius: 4px;
5541}
5542.tooltip-arrow {
5543 position: absolute;
5544 width: 0;
5545 height: 0;
5546 border-color: transparent;
5547 border-style: solid;
5548}
5549.tooltip.top .tooltip-arrow {
5550 bottom: 0;
5551 left: 50%;
5552 margin-left: -5px;
5553 border-width: 5px 5px 0;
5554 border-top-color: #000;
5555}
5556.tooltip.top-left .tooltip-arrow {
5557 bottom: 0;
5558 left: 5px;
5559 border-width: 5px 5px 0;
5560 border-top-color: #000;
5561}
5562.tooltip.top-right .tooltip-arrow {
5563 right: 5px;
5564 bottom: 0;
5565 border-width: 5px 5px 0;
5566 border-top-color: #000;
5567}
5568.tooltip.right .tooltip-arrow {
5569 top: 50%;
5570 left: 0;
5571 margin-top: -5px;
5572 border-width: 5px 5px 5px 0;
5573 border-right-color: #000;
5574}
5575.tooltip.left .tooltip-arrow {
5576 top: 50%;
5577 right: 0;
5578 margin-top: -5px;
5579 border-width: 5px 0 5px 5px;
5580 border-left-color: #000;
5581}
5582.tooltip.bottom .tooltip-arrow {
5583 top: 0;
5584 left: 50%;
5585 margin-left: -5px;
5586 border-width: 0 5px 5px;
5587 border-bottom-color: #000;
5588}
5589.tooltip.bottom-left .tooltip-arrow {
5590 top: 0;
5591 left: 5px;
5592 border-width: 0 5px 5px;
5593 border-bottom-color: #000;
5594}
5595.tooltip.bottom-right .tooltip-arrow {
5596 top: 0;
5597 right: 5px;
5598 border-width: 0 5px 5px;
5599 border-bottom-color: #000;
5600}
5601.popover {
5602 position: absolute;
5603 top: 0;
5604 left: 0;
5605 z-index: 1060;
5606 display: none;
5607 max-width: 276px;
5608 padding: 1px;
5609 text-align: left;
5610 white-space: normal;
5611 background-color: #fff;
5612 -webkit-background-clip: padding-box;
5613 background-clip: padding-box;
5614 border: 1px solid #ccc;
5615 border: 1px solid rgba(0, 0, 0, .2);
5616 border-radius: 6px;
5617 -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
5618 box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
5619}
5620.popover.top {
5621 margin-top: -10px;
5622}
5623.popover.right {
5624 margin-left: 10px;
5625}
5626.popover.bottom {
5627 margin-top: 10px;
5628}
5629.popover.left {
5630 margin-left: -10px;
5631}
5632.popover-title {
5633 padding: 8px 14px;
5634 margin: 0;
5635 font-size: 14px;
5636 font-weight: normal;
5637 line-height: 18px;
5638 background-color: #f7f7f7;
5639 border-bottom: 1px solid #ebebeb;
5640 border-radius: 5px 5px 0 0;
5641}
5642.popover-content {
5643 padding: 9px 14px;
5644}
5645.popover > .arrow,
5646.popover > .arrow:after {
5647 position: absolute;
5648 display: block;
5649 width: 0;
5650 height: 0;
5651 border-color: transparent;
5652 border-style: solid;
5653}
5654.popover > .arrow {
5655 border-width: 11px;
5656}
5657.popover > .arrow:after {
5658 content: "";
5659 border-width: 10px;
5660}
5661.popover.top > .arrow {
5662 bottom: -11px;
5663 left: 50%;
5664 margin-left: -11px;
5665 border-top-color: #999;
5666 border-top-color: rgba(0, 0, 0, .25);
5667 border-bottom-width: 0;
5668}
5669.popover.top > .arrow:after {
5670 bottom: 1px;
5671 margin-left: -10px;
5672 content: " ";
5673 border-top-color: #fff;
5674 border-bottom-width: 0;
5675}
5676.popover.right > .arrow {
5677 top: 50%;
5678 left: -11px;
5679 margin-top: -11px;
5680 border-right-color: #999;
5681 border-right-color: rgba(0, 0, 0, .25);
5682 border-left-width: 0;
5683}
5684.popover.right > .arrow:after {
5685 bottom: -10px;
5686 left: 1px;
5687 content: " ";
5688 border-right-color: #fff;
5689 border-left-width: 0;
5690}
5691.popover.bottom > .arrow {
5692 top: -11px;
5693 left: 50%;
5694 margin-left: -11px;
5695 border-top-width: 0;
5696 border-bottom-color: #999;
5697 border-bottom-color: rgba(0, 0, 0, .25);
5698}
5699.popover.bottom > .arrow:after {
5700 top: 1px;
5701 margin-left: -10px;
5702 content: " ";
5703 border-top-width: 0;
5704 border-bottom-color: #fff;
5705}
5706.popover.left > .arrow {
5707 top: 50%;
5708 right: -11px;
5709 margin-top: -11px;
5710 border-right-width: 0;
5711 border-left-color: #999;
5712 border-left-color: rgba(0, 0, 0, .25);
5713}
5714.popover.left > .arrow:after {
5715 right: 1px;
5716 bottom: -10px;
5717 content: " ";
5718 border-right-width: 0;
5719 border-left-color: #fff;
5720}
5721.carousel {
5722 position: relative;
5723}
5724.carousel-inner {
5725 position: relative;
5726 width: 100%;
5727 overflow: hidden;
5728}
5729.carousel-inner > .item {
5730 position: relative;
5731 display: none;
5732 -webkit-transition: .6s ease-in-out left;
5733 -o-transition: .6s ease-in-out left;
5734 transition: .6s ease-in-out left;
5735}
5736.carousel-inner > .item > img,
5737.carousel-inner > .item > a > img {
5738 line-height: 1;
5739}
5740.carousel-inner > .active,
5741.carousel-inner > .next,
5742.carousel-inner > .prev {
5743 display: block;
5744}
5745.carousel-inner > .active {
5746 left: 0;
5747}
5748.carousel-inner > .next,
5749.carousel-inner > .prev {
5750 position: absolute;
5751 top: 0;
5752 width: 100%;
5753}
5754.carousel-inner > .next {
5755 left: 100%;
5756}
5757.carousel-inner > .prev {
5758 left: -100%;
5759}
5760.carousel-inner > .next.left,
5761.carousel-inner > .prev.right {
5762 left: 0;
5763}
5764.carousel-inner > .active.left {
5765 left: -100%;
5766}
5767.carousel-inner > .active.right {
5768 left: 100%;
5769}
5770.carousel-control {
5771 position: absolute;
5772 top: 0;
5773 bottom: 0;
5774 left: 0;
5775 width: 15%;
5776 font-size: 20px;
5777 color: #fff;
5778 text-align: center;
5779 text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
5780 filter: alpha(opacity=50);
5781 opacity: .5;
5782}
5783.carousel-control.left {
5784 background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
5785 background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
5786 background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001)));
5787 background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);
5788 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
5789 background-repeat: repeat-x;
5790}
5791.carousel-control.right {
5792 right: 0;
5793 left: auto;
5794 background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
5795 background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
5796 background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5)));
5797 background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);
5798 filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
5799 background-repeat: repeat-x;
5800}
5801.carousel-control:hover,
5802.carousel-control:focus {
5803 color: #fff;
5804 text-decoration: none;
5805 filter: alpha(opacity=90);
5806 outline: 0;
5807 opacity: .9;
5808}
5809.carousel-control .icon-prev,
5810.carousel-control .icon-next,
5811.carousel-control .glyphicon-chevron-left,
5812.carousel-control .glyphicon-chevron-right {
5813 position: absolute;
5814 top: 50%;
5815 z-index: 5;
5816 display: inline-block;
5817}
5818.carousel-control .icon-prev,
5819.carousel-control .glyphicon-chevron-left {
5820 left: 50%;
5821 margin-left: -10px;
5822}
5823.carousel-control .icon-next,
5824.carousel-control .glyphicon-chevron-right {
5825 right: 50%;
5826 margin-right: -10px;
5827}
5828.carousel-control .icon-prev,
5829.carousel-control .icon-next {
5830 width: 20px;
5831 height: 20px;
5832 margin-top: -10px;
5833 font-family: serif;
5834}
5835.carousel-control .icon-prev:before {
5836 content: '\2039';
5837}
5838.carousel-control .icon-next:before {
5839 content: '\203a';
5840}
5841.carousel-indicators {
5842 position: absolute;
5843 bottom: 10px;
5844 left: 50%;
5845 z-index: 15;
5846 width: 60%;
5847 padding-left: 0;
5848 margin-left: -30%;
5849 text-align: center;
5850 list-style: none;
5851}
5852.carousel-indicators li {
5853 display: inline-block;
5854 width: 10px;
5855 height: 10px;
5856 margin: 1px;
5857 text-indent: -999px;
5858 cursor: pointer;
5859 background-color: #000 \9;
5860 background-color: rgba(0, 0, 0, 0);
5861 border: 1px solid #fff;
5862 border-radius: 10px;
5863}
5864.carousel-indicators .active {
5865 width: 12px;
5866 height: 12px;
5867 margin: 0;
5868 background-color: #fff;
5869}
5870.carousel-caption {
5871 position: absolute;
5872 right: 15%;
5873 bottom: 20px;
5874 left: 15%;
5875 z-index: 10;
5876 padding-top: 20px;
5877 padding-bottom: 20px;
5878 color: #fff;
5879 text-align: center;
5880 text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
5881}
5882.carousel-caption .btn {
5883 text-shadow: none;
5884}
5885@media screen and (min-width: 768px) {
5886 .carousel-control .glyphicon-chevron-left,
5887 .carousel-control .glyphicon-chevron-right,
5888 .carousel-control .icon-prev,
5889 .carousel-control .icon-next {
5890 width: 30px;
5891 height: 30px;
5892 margin-top: -15px;
5893 font-size: 30px;
5894 }
5895 .carousel-control .glyphicon-chevron-left,
5896 .carousel-control .icon-prev {
5897 margin-left: -15px;
5898 }
5899 .carousel-control .glyphicon-chevron-right,
5900 .carousel-control .icon-next {
5901 margin-right: -15px;
5902 }
5903 .carousel-caption {
5904 right: 20%;
5905 left: 20%;
5906 padding-bottom: 30px;
5907 }
5908 .carousel-indicators {
5909 bottom: 20px;
5910 }
5911}
5912.clearfix:before,
5913.clearfix:after,
5914.dl-horizontal dd:before,
5915.dl-horizontal dd:after,
5916.container:before,
5917.container:after,
5918.container-fluid:before,
5919.container-fluid:after,
5920.row:before,
5921.row:after,
5922.form-horizontal .form-group:before,
5923.form-horizontal .form-group:after,
5924.btn-toolbar:before,
5925.btn-toolbar:after,
5926.btn-group-vertical > .btn-group:before,
5927.btn-group-vertical > .btn-group:after,
5928.nav:before,
5929.nav:after,
5930.navbar:before,
5931.navbar:after,
5932.navbar-header:before,
5933.navbar-header:after,
5934.navbar-collapse:before,
5935.navbar-collapse:after,
5936.pager:before,
5937.pager:after,
5938.panel-body:before,
5939.panel-body:after,
5940.modal-footer:before,
5941.modal-footer:after {
5942 display: table;
5943 content: " ";
5944}
5945.clearfix:after,
5946.dl-horizontal dd:after,
5947.container:after,
5948.container-fluid:after,
5949.row:after,
5950.form-horizontal .form-group:after,
5951.btn-toolbar:after,
5952.btn-group-vertical > .btn-group:after,
5953.nav:after,
5954.navbar:after,
5955.navbar-header:after,
5956.navbar-collapse:after,
5957.pager:after,
5958.panel-body:after,
5959.modal-footer:after {
5960 clear: both;
5961}
5962.center-block {
5963 display: block;
5964 margin-right: auto;
5965 margin-left: auto;
5966}
5967.pull-right {
5968 float: right !important;
5969}
5970.pull-left {
5971 float: left !important;
5972}
5973.hide {
5974 display: none !important;
5975}
5976.show {
5977 display: block !important;
5978}
5979.invisible {
5980 visibility: hidden;
5981}
5982.text-hide {
5983 font: 0/0 a;
5984 color: transparent;
5985 text-shadow: none;
5986 background-color: transparent;
5987 border: 0;
5988}
5989.hidden {
5990 display: none !important;
5991 visibility: hidden !important;
5992}
5993.affix {
5994 position: fixed;
5995 -webkit-transform: translate3d(0, 0, 0);
5996 -o-transform: translate3d(0, 0, 0);
5997 transform: translate3d(0, 0, 0);
5998}
5999@-ms-viewport {
6000 width: device-width;
6001}
6002.visible-xs,
6003.visible-sm,
6004.visible-md,
6005.visible-lg {
6006 display: none !important;
6007}
6008.visible-xs-block,
6009.visible-xs-inline,
6010.visible-xs-inline-block,
6011.visible-sm-block,
6012.visible-sm-inline,
6013.visible-sm-inline-block,
6014.visible-md-block,
6015.visible-md-inline,
6016.visible-md-inline-block,
6017.visible-lg-block,
6018.visible-lg-inline,
6019.visible-lg-inline-block {
6020 display: none !important;
6021}
6022@media (max-width: 767px) {
6023 .visible-xs {
6024 display: block !important;
6025 }
6026 table.visible-xs {
6027 display: table;
6028 }
6029 tr.visible-xs {
6030 display: table-row !important;
6031 }
6032 th.visible-xs,
6033 td.visible-xs {
6034 display: table-cell !important;
6035 }
6036}
6037@media (max-width: 767px) {
6038 .visible-xs-block {
6039 display: block !important;
6040 }
6041}
6042@media (max-width: 767px) {
6043 .visible-xs-inline {
6044 display: inline !important;
6045 }
6046}
6047@media (max-width: 767px) {
6048 .visible-xs-inline-block {
6049 display: inline-block !important;
6050 }
6051}
6052@media (min-width: 768px) and (max-width: 991px) {
6053 .visible-sm {
6054 display: block !important;
6055 }
6056 table.visible-sm {
6057 display: table;
6058 }
6059 tr.visible-sm {
6060 display: table-row !important;
6061 }
6062 th.visible-sm,
6063 td.visible-sm {
6064 display: table-cell !important;
6065 }
6066}
6067@media (min-width: 768px) and (max-width: 991px) {
6068 .visible-sm-block {
6069 display: block !important;
6070 }
6071}
6072@media (min-width: 768px) and (max-width: 991px) {
6073 .visible-sm-inline {
6074 display: inline !important;
6075 }
6076}
6077@media (min-width: 768px) and (max-width: 991px) {
6078 .visible-sm-inline-block {
6079 display: inline-block !important;
6080 }
6081}
6082@media (min-width: 992px) and (max-width: 1199px) {
6083 .visible-md {
6084 display: block !important;
6085 }
6086 table.visible-md {
6087 display: table;
6088 }
6089 tr.visible-md {
6090 display: table-row !important;
6091 }
6092 th.visible-md,
6093 td.visible-md {
6094 display: table-cell !important;
6095 }
6096}
6097@media (min-width: 992px) and (max-width: 1199px) {
6098 .visible-md-block {
6099 display: block !important;
6100 }
6101}
6102@media (min-width: 992px) and (max-width: 1199px) {
6103 .visible-md-inline {
6104 display: inline !important;
6105 }
6106}
6107@media (min-width: 992px) and (max-width: 1199px) {
6108 .visible-md-inline-block {
6109 display: inline-block !important;
6110 }
6111}
6112@media (min-width: 1200px) {
6113 .visible-lg {
6114 display: block !important;
6115 }
6116 table.visible-lg {
6117 display: table;
6118 }
6119 tr.visible-lg {
6120 display: table-row !important;
6121 }
6122 th.visible-lg,
6123 td.visible-lg {
6124 display: table-cell !important;
6125 }
6126}
6127@media (min-width: 1200px) {
6128 .visible-lg-block {
6129 display: block !important;
6130 }
6131}
6132@media (min-width: 1200px) {
6133 .visible-lg-inline {
6134 display: inline !important;
6135 }
6136}
6137@media (min-width: 1200px) {
6138 .visible-lg-inline-block {
6139 display: inline-block !important;
6140 }
6141}
6142@media (max-width: 767px) {
6143 .hidden-xs {
6144 display: none !important;
6145 }
6146}
6147@media (min-width: 768px) and (max-width: 991px) {
6148 .hidden-sm {
6149 display: none !important;
6150 }
6151}
6152@media (min-width: 992px) and (max-width: 1199px) {
6153 .hidden-md {
6154 display: none !important;
6155 }
6156}
6157@media (min-width: 1200px) {
6158 .hidden-lg {
6159 display: none !important;
6160 }
6161}
6162.visible-print {
6163 display: none !important;
6164}
6165@media print {
6166 .visible-print {
6167 display: block !important;
6168 }
6169 table.visible-print {
6170 display: table;
6171 }
6172 tr.visible-print {
6173 display: table-row !important;
6174 }
6175 th.visible-print,
6176 td.visible-print {
6177 display: table-cell !important;
6178 }
6179}
6180.visible-print-block {
6181 display: none !important;
6182}
6183@media print {
6184 .visible-print-block {
6185 display: block !important;
6186 }
6187}
6188.visible-print-inline {
6189 display: none !important;
6190}
6191@media print {
6192 .visible-print-inline {
6193 display: inline !important;
6194 }
6195}
6196.visible-print-inline-block {
6197 display: none !important;
6198}
6199@media print {
6200 .visible-print-inline-block {
6201 display: inline-block !important;
6202 }
6203}
6204@media print {
6205 .hidden-print {
6206 display: none !important;
6207 }
6208}
6209/*# sourceMappingURL=bootstrap.css.map */
6210 </style>
6211 <meta content="Mnemonic code for generating deterministic keys" name="description"/> 11 <meta content="Mnemonic code for generating deterministic keys" name="description"/>
6212 <meta content="width=device-width, initial-scale=1.0" name="viewport" /> 12 <meta content="width=device-width, initial-scale=1.0" name="viewport" />
6213 <meta content="bitcoin mnemonic converter" name="description" /> 13 <meta content="bitcoin mnemonic converter" name="description" />
@@ -6282,13 +82,8 @@ button.close {
6282 <label for="network-phrase" class="col-sm-2 control-label">Coin</label> 82 <label for="network-phrase" class="col-sm-2 control-label">Coin</label>
6283 <div class="col-sm-10"> 83 <div class="col-sm-10">
6284 <select id="network-phrase" class="network form-control"> 84 <select id="network-phrase" class="network form-control">
6285 <option value="bitcoin">Bitcoin</option> 85 <!-- populated by javascript -->
6286 <option value="bitcoin-testnet">Bitcoin Testnet</option> 86 </select>
6287 <option value="litecoin">Litecoin</option>
6288 <option value="dogecoin">Dogecoin</option>
6289 <option value="shadow">ShadowCash</option>
6290 <option value="shadowtn">ShadowCash Testnet</option>
6291 </select>
6292 </div> 87 </div>
6293 </div> 88 </div>
6294 <div class="form-group"> 89 <div class="form-group">
@@ -6497,7 +292,7 @@ button.close {
6497 <h3>Private Keys</h3> 292 <h3>Private Keys</h3>
6498 <p> 293 <p>
6499 Use private keys at 294 Use private keys at
6500 <a href="https://brainwallet.github.io/" target="_blank">brainwallet.org</a>, 295 <a href="https://web.archive.org/web/20150707020924/https://brainwallet.org/" target="_blank">brainwallet.org</a>,
6501 but be careful - it can be easy to make mistakes if you 296 but be careful - it can be easy to make mistakes if you
6502 don't know what you're doing 297 don't know what you're doing
6503 </p> 298 </p>
@@ -6598,12978 +393,6558 @@ button.close {
6598 <td class="privkey"><span></span></td> 393 <td class="privkey"><span></span></td>
6599 </tr> 394 </tr>
6600 </script> 395 </script>
6601<script> 396 <script>/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
6602/*! 397!function(a,b){"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){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.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||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},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?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;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;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(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 ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(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){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.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===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||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 fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.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},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.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=fb.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=fb.selectors={cacheLength:50,createPseudo:hb,match:X,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(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===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]||fb.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]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.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(cb,db).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("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.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+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},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;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(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),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).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:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!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 Z.test(a.nodeName)},input:function(a){return Y.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:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?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]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.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=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[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?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(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 tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(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?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;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};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)
6603 * jQuery JavaScript Library v2.1.1 398},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.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=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.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 L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.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=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),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),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==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,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(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=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={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,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.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 this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(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&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.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 yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=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};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{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=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.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=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.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=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):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):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.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 Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.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;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.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)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.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=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.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)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.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;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
6604 * http://jquery.com/ 399},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.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){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},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)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.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 sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.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 tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(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}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(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}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(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 this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.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),n.isFunction(b)&&(b=b.call(a,c,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)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n});
6605 * 400</script>
6606 * Includes Sizzle.js 401 <script>/*!
6607 * http://sizzlejs.com/ 402 * Bootstrap v3.2.0 (http://getbootstrap.com)
6608 * 403 * Copyright 2011-2014 Twitter, Inc.
6609 * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors 404 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
6610 * Released under the MIT license
6611 * http://jquery.org/license
6612 *
6613 * Date: 2014-05-01T17:11Z
6614 */ 405 */
406if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.2.0",d.prototype.close=function(b){function c(){f.detach().trigger("closed.bs.alert").remove()}var d=a(this),e=d.attr("data-target");e||(e=d.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,""));var f=a(e);b&&b.preventDefault(),f.length||(f=d.hasClass("alert")?d:d.parent()),f.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",c).emulateTransitionEnd(150):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.2.0",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),d[e](null==f[b]?this.options[b]:f[b]),setTimeout(a.proxy(function(){"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b).on("keydown.bs.carousel",a.proxy(this.keydown,this)),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,"hover"==this.options.pause&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.2.0",c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},c.prototype.keydown=function(a){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.to=function(b){var c=this,d=this.getItemIndex(this.$active=this.$element.find(".item.active"));return b>this.$items.length-1||0>b?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g="next"==b?"left":"right",h="next"==b?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}if(e.hasClass("active"))return this.sliding=!1;var j=e[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:g});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,f&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(e)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:g});return a.support.transition&&this.$element.hasClass("slide")?(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one("bsTransitionEnd",function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(1e3*d.css("transition-duration").slice(0,-1))):(d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger(m)),f&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this},a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b);!e&&f.toggle&&"show"==b&&(b=!b),e||d.data("bs.collapse",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};c.VERSION="3.2.0",c.DEFAULTS={toggle:!0},c.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},c.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var c=a.Event("show.bs.collapse");if(this.$element.trigger(c),!c.isDefaultPrevented()){var d=this.$parent&&this.$parent.find("> .panel > .in");if(d&&d.length){var e=d.data("bs.collapse");if(e&&e.transitioning)return;b.call(d,"hide"),e||d.data("bs.collapse",null)}var f=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[f](0),this.transitioning=1;var g=function(){this.$element.removeClass("collapsing").addClass("collapse in")[f](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return g.call(this);var h=a.camelCase(["scroll",f].join("-"));this.$element.one("bsTransitionEnd",a.proxy(g,this)).emulateTransitionEnd(350)[f](this.$element[0][h])}}},c.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(d,this)).emulateTransitionEnd(350):d.call(this)}}},c.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var d=a.fn.collapse;a.fn.collapse=b,a.fn.collapse.Constructor=c,a.fn.collapse.noConflict=function(){return a.fn.collapse=d,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(c){var d,e=a(this),f=e.attr("data-target")||c.preventDefault()||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),g=a(f),h=g.data("bs.collapse"),i=h?"toggle":e.data(),j=e.attr("data-parent"),k=j&&a(j);h&&h.transitioning||(k&&k.find('[data-toggle="collapse"][data-parent="'+j+'"]').not(e).addClass("collapsed"),e[g.hasClass("in")?"addClass":"removeClass"]("collapsed")),b.call(g,i)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=c(a(this)),e={relatedTarget:this};d.hasClass("open")&&(d.trigger(b=a.Event("hide.bs.dropdown",e)),b.isDefaultPrevented()||d.removeClass("open").trigger("hidden.bs.dropdown",e))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.2.0",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27)/.test(b.keyCode)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g||g&&27==b.keyCode)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.divider):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(i.filter(":focus"));38==b.keyCode&&j>0&&j--,40==b.keyCode&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f+', [role="menu"], [role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$backdrop=this.isShown=null,this.scrollbarWidth=0,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.2.0",c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d),this.isShown||d.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.$body.addClass("modal-open"),this.setScrollbar(),this.escape(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(c.$body),c.$element.show().scrollTop(0),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one("bsTransitionEnd",function(){c.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(300):c.$element.trigger("focus").trigger(e)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.$body.removeClass("modal-open"),this.resetScrollbar(),this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;if(this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;e?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(150):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var f=function(){c.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",f).emulateTransitionEnd(150):f()}else b&&b()},c.prototype.checkScrollbar=function(){document.body.clientWidth>=window.innerWidth||(this.scrollbarWidth=this.scrollbarWidth||this.measureScrollbar())},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.scrollbarWidth&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right","")},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.2.0",c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport);for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show()},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var c=a.contains(document.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!c)return;var d=this,e=this.tip(),f=this.getUID(this.type);this.setContent(),e.attr("id",f),this.$element.attr("aria-describedby",f),this.options.animation&&e.addClass("fade");var g="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,h=/\s?auto?\s?/i,i=h.test(g);i&&(g=g.replace(h,"")||"top"),e.detach().css({top:0,left:0,display:"block"}).addClass(g).data("bs."+this.type,this),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element);var j=this.getPosition(),k=e[0].offsetWidth,l=e[0].offsetHeight;if(i){var m=g,n=this.$element.parent(),o=this.getPosition(n);g="bottom"==g&&j.top+j.height+l-o.scroll>o.height?"top":"top"==g&&j.top-o.scroll-l<0?"bottom":"right"==g&&j.right+k>o.width?"left":"left"==g&&j.left-k<o.left?"right":g,e.removeClass(m).addClass(g)}var p=this.getCalculatedOffset(g,j,k,l);this.applyPlacement(p,g);var q=function(){d.$element.trigger("shown.bs."+d.type),d.hoverState=null};a.support.transition&&this.$tip.hasClass("fade")?e.one("bsTransitionEnd",q).emulateTransitionEnd(150):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=k.left?2*k.left-e+i:2*k.top-f+j,m=k.left?"left":"top",n=k.left?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(l,d[0][n],m)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(){function b(){"in"!=c.hoverState&&d.detach(),c.$element.trigger("hidden.bs."+c.type)}var c=this,d=this.tip(),e=a.Event("hide.bs."+this.type);return this.$element.removeAttr("aria-describedby"),this.$element.trigger(e),e.isDefaultPrevented()?void 0:(d.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d.one("bsTransitionEnd",b).emulateTransitionEnd(150):b(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName;return a.extend({},"function"==typeof c.getBoundingClientRect?c.getBoundingClientRect():null,{scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop(),width:d?a(window).width():b.outerWidth(),height:d?a(window).height():b.outerHeight()},d?{top:0,left:0}:b.offset())},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){clearTimeout(this.timeout),this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||"destroy"!=b)&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.2.0",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").empty()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},c.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){var e=a.proxy(this.process,this);this.$body=a("body"),this.$scrollElement=a(a(c).is("body")?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.2.0",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b="offset",c=0;a.isWindow(this.$scrollElement[0])||(b="position",c=this.$scrollElement.scrollTop()),this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight();var d=this;this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[b]().top+c,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){d.offsets.push(this[0]),d.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<=e[0])return g!=(a=f[0])&&this.activate(a);for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(!e[a+1]||b<=e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parentsUntil(this.options.target,".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.2.0",c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});if(b.trigger(f),!f.isDefaultPrevented()){var g=a(d);this.activate(b.closest("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})}}},c.prototype.activate=function(b,c,d){function e(){f.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),g?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var f=c.find("> .active"),g=d&&a.support.transition&&f.hasClass("fade");g?f.one("bsTransitionEnd",e).emulateTransitionEnd(150):e(),f.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(c){c.preventDefault(),b.call(a(this),"show")})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=this.unpin=this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.2.0",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=a(document).height(),d=this.$target.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;"object"!=typeof f&&(h=g=f),"function"==typeof g&&(g=f.top(this.$element)),"function"==typeof h&&(h=f.bottom(this.$element));var i=null!=this.unpin&&d+this.unpin<=e.top?!1:null!=h&&e.top+this.$element.height()>=b-h?"bottom":null!=g&&g>=d?"top":!1;if(this.affixed!==i){null!=this.unpin&&this.$element.css("top","");var j="affix"+(i?"-"+i:""),k=a.Event(j+".bs.affix");this.$element.trigger(k),k.isDefaultPrevented()||(this.affixed=i,this.unpin="bottom"==i?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(j).trigger(a.Event(j.replace("affix","affixed"))),"bottom"==i&&this.$element.offset({top:b-this.$element.height()-h}))}}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},d.offsetBottom&&(d.offset.bottom=d.offsetBottom),d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);</script>
407 <script>(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bitcoin = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
408// (public) Constructor
409function BigInteger(a, b, c) {
410 if (!(this instanceof BigInteger))
411 return new BigInteger(a, b, c)
6615 412
6616(function( global, factory ) { 413 if (a != null) {
6617 414 if ("number" == typeof a) this.fromNumber(a, b, c)
6618 if ( typeof module === "object" && typeof module.exports === "object" ) { 415 else if (b == null && "string" != typeof a) this.fromString(a, 256)
6619 // For CommonJS and CommonJS-like environments where a proper window is present, 416 else this.fromString(a, b)
6620 // execute the factory and get jQuery 417 }
6621 // For environments that do not inherently posses a window with a document 418}
6622 // (such as Node.js), expose a jQuery-making factory as module.exports
6623 // This accentuates the need for the creation of a real window
6624 // e.g. var jQuery = require("jquery")(window);
6625 // See ticket #14549 for more info
6626 module.exports = global.document ?
6627 factory( global, true ) :
6628 function( w ) {
6629 if ( !w.document ) {
6630 throw new Error( "jQuery requires a window with a document" );
6631 }
6632 return factory( w );
6633 };
6634 } else {
6635 factory( global );
6636 }
6637
6638// Pass this if window is not defined yet
6639}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
6640
6641// Can't do this because several apps including ASP.NET trace
6642// the stack via arguments.caller.callee and Firefox dies if
6643// you try to trace through "use strict" call chains. (#13335)
6644// Support: Firefox 18+
6645//
6646
6647var arr = [];
6648
6649var slice = arr.slice;
6650
6651var concat = arr.concat;
6652
6653var push = arr.push;
6654
6655var indexOf = arr.indexOf;
6656
6657var class2type = {};
6658
6659var toString = class2type.toString;
6660
6661var hasOwn = class2type.hasOwnProperty;
6662
6663var support = {};
6664
6665
6666
6667var
6668 // Use the correct document accordingly with window argument (sandbox)
6669 document = window.document,
6670
6671 version = "2.1.1",
6672
6673 // Define a local copy of jQuery
6674 jQuery = function( selector, context ) {
6675 // The jQuery object is actually just the init constructor 'enhanced'
6676 // Need init if jQuery is called (just allow error to be thrown if not included)
6677 return new jQuery.fn.init( selector, context );
6678 },
6679
6680 // Support: Android<4.1
6681 // Make sure we trim BOM and NBSP
6682 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
6683
6684 // Matches dashed string for camelizing
6685 rmsPrefix = /^-ms-/,
6686 rdashAlpha = /-([\da-z])/gi,
6687
6688 // Used by jQuery.camelCase as callback to replace()
6689 fcamelCase = function( all, letter ) {
6690 return letter.toUpperCase();
6691 };
6692
6693jQuery.fn = jQuery.prototype = {
6694 // The current version of jQuery being used
6695 jquery: version,
6696
6697 constructor: jQuery,
6698
6699 // Start with an empty selector
6700 selector: "",
6701
6702 // The default length of a jQuery object is 0
6703 length: 0,
6704
6705 toArray: function() {
6706 return slice.call( this );
6707 },
6708
6709 // Get the Nth element in the matched element set OR
6710 // Get the whole matched element set as a clean array
6711 get: function( num ) {
6712 return num != null ?
6713
6714 // Return just the one element from the set
6715 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
6716
6717 // Return all the elements in a clean array
6718 slice.call( this );
6719 },
6720
6721 // Take an array of elements and push it onto the stack
6722 // (returning the new matched element set)
6723 pushStack: function( elems ) {
6724
6725 // Build a new jQuery matched element set
6726 var ret = jQuery.merge( this.constructor(), elems );
6727
6728 // Add the old object onto the stack (as a reference)
6729 ret.prevObject = this;
6730 ret.context = this.context;
6731
6732 // Return the newly-formed element set
6733 return ret;
6734 },
6735
6736 // Execute a callback for every element in the matched set.
6737 // (You can seed the arguments with an array of args, but this is
6738 // only used internally.)
6739 each: function( callback, args ) {
6740 return jQuery.each( this, callback, args );
6741 },
6742
6743 map: function( callback ) {
6744 return this.pushStack( jQuery.map(this, function( elem, i ) {
6745 return callback.call( elem, i, elem );
6746 }));
6747 },
6748
6749 slice: function() {
6750 return this.pushStack( slice.apply( this, arguments ) );
6751 },
6752
6753 first: function() {
6754 return this.eq( 0 );
6755 },
6756
6757 last: function() {
6758 return this.eq( -1 );
6759 },
6760
6761 eq: function( i ) {
6762 var len = this.length,
6763 j = +i + ( i < 0 ? len : 0 );
6764 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
6765 },
6766
6767 end: function() {
6768 return this.prevObject || this.constructor(null);
6769 },
6770
6771 // For internal use only.
6772 // Behaves like an Array's method, not like a jQuery method.
6773 push: push,
6774 sort: arr.sort,
6775 splice: arr.splice
6776};
6777
6778jQuery.extend = jQuery.fn.extend = function() {
6779 var options, name, src, copy, copyIsArray, clone,
6780 target = arguments[0] || {},
6781 i = 1,
6782 length = arguments.length,
6783 deep = false;
6784
6785 // Handle a deep copy situation
6786 if ( typeof target === "boolean" ) {
6787 deep = target;
6788
6789 // skip the boolean and the target
6790 target = arguments[ i ] || {};
6791 i++;
6792 }
6793
6794 // Handle case when target is a string or something (possible in deep copy)
6795 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
6796 target = {};
6797 }
6798
6799 // extend jQuery itself if only one argument is passed
6800 if ( i === length ) {
6801 target = this;
6802 i--;
6803 }
6804
6805 for ( ; i < length; i++ ) {
6806 // Only deal with non-null/undefined values
6807 if ( (options = arguments[ i ]) != null ) {
6808 // Extend the base object
6809 for ( name in options ) {
6810 src = target[ name ];
6811 copy = options[ name ];
6812
6813 // Prevent never-ending loop
6814 if ( target === copy ) {
6815 continue;
6816 }
6817
6818 // Recurse if we're merging plain objects or arrays
6819 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
6820 if ( copyIsArray ) {
6821 copyIsArray = false;
6822 clone = src && jQuery.isArray(src) ? src : [];
6823
6824 } else {
6825 clone = src && jQuery.isPlainObject(src) ? src : {};
6826 }
6827
6828 // Never move original objects, clone them
6829 target[ name ] = jQuery.extend( deep, clone, copy );
6830
6831 // Don't bring in undefined values
6832 } else if ( copy !== undefined ) {
6833 target[ name ] = copy;
6834 }
6835 }
6836 }
6837 }
6838
6839 // Return the modified object
6840 return target;
6841};
6842
6843jQuery.extend({
6844 // Unique for each copy of jQuery on the page
6845 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
6846
6847 // Assume jQuery is ready without the ready module
6848 isReady: true,
6849
6850 error: function( msg ) {
6851 throw new Error( msg );
6852 },
6853
6854 noop: function() {},
6855
6856 // See test/unit/core.js for details concerning isFunction.
6857 // Since version 1.3, DOM methods and functions like alert
6858 // aren't supported. They return false on IE (#2968).
6859 isFunction: function( obj ) {
6860 return jQuery.type(obj) === "function";
6861 },
6862
6863 isArray: Array.isArray,
6864
6865 isWindow: function( obj ) {
6866 return obj != null && obj === obj.window;
6867 },
6868
6869 isNumeric: function( obj ) {
6870 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
6871 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
6872 // subtraction forces infinities to NaN
6873 return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
6874 },
6875
6876 isPlainObject: function( obj ) {
6877 // Not plain objects:
6878 // - Any object or value whose internal [[Class]] property is not "[object Object]"
6879 // - DOM nodes
6880 // - window
6881 if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
6882 return false;
6883 }
6884
6885 if ( obj.constructor &&
6886 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
6887 return false;
6888 }
6889
6890 // If the function hasn't returned already, we're confident that
6891 // |obj| is a plain object, created by {} or constructed with new Object
6892 return true;
6893 },
6894
6895 isEmptyObject: function( obj ) {
6896 var name;
6897 for ( name in obj ) {
6898 return false;
6899 }
6900 return true;
6901 },
6902
6903 type: function( obj ) {
6904 if ( obj == null ) {
6905 return obj + "";
6906 }
6907 // Support: Android < 4.0, iOS < 6 (functionish RegExp)
6908 return typeof obj === "object" || typeof obj === "function" ?
6909 class2type[ toString.call(obj) ] || "object" :
6910 typeof obj;
6911 },
6912
6913 // Evaluates a script in a global context
6914 globalEval: function( code ) {
6915 var script,
6916 indirect = eval;
6917
6918 code = jQuery.trim( code );
6919
6920 if ( code ) {
6921 // If the code includes a valid, prologue position
6922 // strict mode pragma, execute code by injecting a
6923 // script tag into the document.
6924 if ( code.indexOf("use strict") === 1 ) {
6925 script = document.createElement("script");
6926 script.text = code;
6927 document.head.appendChild( script ).parentNode.removeChild( script );
6928 } else {
6929 // Otherwise, avoid the DOM node creation, insertion
6930 // and removal by using an indirect global eval
6931 indirect( code );
6932 }
6933 }
6934 },
6935
6936 // Convert dashed to camelCase; used by the css and data modules
6937 // Microsoft forgot to hump their vendor prefix (#9572)
6938 camelCase: function( string ) {
6939 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
6940 },
6941
6942 nodeName: function( elem, name ) {
6943 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
6944 },
6945
6946 // args is for internal usage only
6947 each: function( obj, callback, args ) {
6948 var value,
6949 i = 0,
6950 length = obj.length,
6951 isArray = isArraylike( obj );
6952
6953 if ( args ) {
6954 if ( isArray ) {
6955 for ( ; i < length; i++ ) {
6956 value = callback.apply( obj[ i ], args );
6957
6958 if ( value === false ) {
6959 break;
6960 }
6961 }
6962 } else {
6963 for ( i in obj ) {
6964 value = callback.apply( obj[ i ], args );
6965
6966 if ( value === false ) {
6967 break;
6968 }
6969 }
6970 }
6971
6972 // A special, fast, case for the most common use of each
6973 } else {
6974 if ( isArray ) {
6975 for ( ; i < length; i++ ) {
6976 value = callback.call( obj[ i ], i, obj[ i ] );
6977
6978 if ( value === false ) {
6979 break;
6980 }
6981 }
6982 } else {
6983 for ( i in obj ) {
6984 value = callback.call( obj[ i ], i, obj[ i ] );
6985
6986 if ( value === false ) {
6987 break;
6988 }
6989 }
6990 }
6991 }
6992
6993 return obj;
6994 },
6995 419
6996 // Support: Android<4.1 420var proto = BigInteger.prototype
6997 trim: function( text ) {
6998 return text == null ?
6999 "" :
7000 ( text + "" ).replace( rtrim, "" );
7001 },
7002 421
7003 // results is for internal usage only 422// duck-typed isBigInteger
7004 makeArray: function( arr, results ) { 423proto.__bigi = require('../package.json').version
7005 var ret = results || []; 424BigInteger.isBigInteger = function (obj, check_ver) {
7006 425 return obj && obj.__bigi && (!check_ver || obj.__bigi === proto.__bigi)
7007 if ( arr != null ) { 426}
7008 if ( isArraylike( Object(arr) ) ) {
7009 jQuery.merge( ret,
7010 typeof arr === "string" ?
7011 [ arr ] : arr
7012 );
7013 } else {
7014 push.call( ret, arr );
7015 }
7016 }
7017 427
7018 return ret; 428// Bits per digit
7019 }, 429var dbits
7020 430
7021 inArray: function( elem, arr, i ) { 431// am: Compute w_j += (x*this_i), propagate carries,
7022 return arr == null ? -1 : indexOf.call( arr, elem, i ); 432// c is initial carry, returns final carry.
7023 }, 433// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
434// We need to select the fastest one that works in this environment.
7024 435
7025 merge: function( first, second ) { 436// am1: use a single mult and divide to get the high bits,
7026 var len = +second.length, 437// max digit bits should be 26 because
7027 j = 0, 438// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
7028 i = first.length; 439function am1(i, x, w, j, c, n) {
440 while (--n >= 0) {
441 var v = x * this[i++] + w[j] + c
442 c = Math.floor(v / 0x4000000)
443 w[j++] = v & 0x3ffffff
444 }
445 return c
446}
447// am2 avoids a big mult-and-extract completely.
448// Max digit bits should be <= 30 because we do bitwise ops
449// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
450function am2(i, x, w, j, c, n) {
451 var xl = x & 0x7fff,
452 xh = x >> 15
453 while (--n >= 0) {
454 var l = this[i] & 0x7fff
455 var h = this[i++] >> 15
456 var m = xh * l + h * xl
457 l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff)
458 c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30)
459 w[j++] = l & 0x3fffffff
460 }
461 return c
462}
463// Alternately, set max digit bits to 28 since some
464// browsers slow down when dealing with 32-bit numbers.
465function am3(i, x, w, j, c, n) {
466 var xl = x & 0x3fff,
467 xh = x >> 14
468 while (--n >= 0) {
469 var l = this[i] & 0x3fff
470 var h = this[i++] >> 14
471 var m = xh * l + h * xl
472 l = xl * l + ((m & 0x3fff) << 14) + w[j] + c
473 c = (l >> 28) + (m >> 14) + xh * h
474 w[j++] = l & 0xfffffff
475 }
476 return c
477}
7029 478
7030 for ( ; j < len; j++ ) { 479// wtf?
7031 first[ i++ ] = second[ j ]; 480BigInteger.prototype.am = am1
7032 } 481dbits = 26
7033 482
7034 first.length = i; 483BigInteger.prototype.DB = dbits
484BigInteger.prototype.DM = ((1 << dbits) - 1)
485var DV = BigInteger.prototype.DV = (1 << dbits)
7035 486
7036 return first; 487var BI_FP = 52
7037 }, 488BigInteger.prototype.FV = Math.pow(2, BI_FP)
489BigInteger.prototype.F1 = BI_FP - dbits
490BigInteger.prototype.F2 = 2 * dbits - BI_FP
7038 491
7039 grep: function( elems, callback, invert ) { 492// Digit conversions
7040 var callbackInverse, 493var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"
7041 matches = [], 494var BI_RC = new Array()
7042 i = 0, 495var rr, vv
7043 length = elems.length, 496rr = "0".charCodeAt(0)
7044 callbackExpect = !invert; 497for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv
7045 498rr = "a".charCodeAt(0)
7046 // Go through the array, only saving the items 499for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
7047 // that pass the validator function 500rr = "A".charCodeAt(0)
7048 for ( ; i < length; i++ ) { 501for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv
7049 callbackInverse = !callback( elems[ i ], i );
7050 if ( callbackInverse !== callbackExpect ) {
7051 matches.push( elems[ i ] );
7052 }
7053 }
7054 502
7055 return matches; 503function int2char(n) {
7056 }, 504 return BI_RM.charAt(n)
505}
7057 506
7058 // arg is for internal usage only 507function intAt(s, i) {
7059 map: function( elems, callback, arg ) { 508 var c = BI_RC[s.charCodeAt(i)]
7060 var value, 509 return (c == null) ? -1 : c
7061 i = 0, 510}
7062 length = elems.length,
7063 isArray = isArraylike( elems ),
7064 ret = [];
7065
7066 // Go through the array, translating each of the items to their new values
7067 if ( isArray ) {
7068 for ( ; i < length; i++ ) {
7069 value = callback( elems[ i ], i, arg );
7070
7071 if ( value != null ) {
7072 ret.push( value );
7073 }
7074 }
7075 511
7076 // Go through every key on the object, 512// (protected) copy this to r
7077 } else { 513function bnpCopyTo(r) {
7078 for ( i in elems ) { 514 for (var i = this.t - 1; i >= 0; --i) r[i] = this[i]
7079 value = callback( elems[ i ], i, arg ); 515 r.t = this.t
516 r.s = this.s
517}
7080 518
7081 if ( value != null ) { 519// (protected) set from integer value x, -DV <= x < DV
7082 ret.push( value ); 520function bnpFromInt(x) {
7083 } 521 this.t = 1
7084 } 522 this.s = (x < 0) ? -1 : 0
7085 } 523 if (x > 0) this[0] = x
524 else if (x < -1) this[0] = x + DV
525 else this.t = 0
526}
7086 527
7087 // Flatten any nested arrays 528// return bigint initialized to value
7088 return concat.apply( [], ret ); 529function nbv(i) {
7089 }, 530 var r = new BigInteger()
531 r.fromInt(i)
532 return r
533}
7090 534
7091 // A global GUID counter for objects 535// (protected) set from string and radix
7092 guid: 1, 536function bnpFromString(s, b) {
537 var self = this
7093 538
7094 // Bind a function to a context, optionally partially applying any 539 var k
7095 // arguments. 540 if (b == 16) k = 4
7096 proxy: function( fn, context ) { 541 else if (b == 8) k = 3
7097 var tmp, args, proxy; 542 else if (b == 256) k = 8; // byte array
543 else if (b == 2) k = 1
544 else if (b == 32) k = 5
545 else if (b == 4) k = 2
546 else {
547 self.fromRadix(s, b)
548 return
549 }
550 self.t = 0
551 self.s = 0
552 var i = s.length,
553 mi = false,
554 sh = 0
555 while (--i >= 0) {
556 var x = (k == 8) ? s[i] & 0xff : intAt(s, i)
557 if (x < 0) {
558 if (s.charAt(i) == "-") mi = true
559 continue
560 }
561 mi = false
562 if (sh == 0)
563 self[self.t++] = x
564 else if (sh + k > self.DB) {
565 self[self.t - 1] |= (x & ((1 << (self.DB - sh)) - 1)) << sh
566 self[self.t++] = (x >> (self.DB - sh))
567 } else
568 self[self.t - 1] |= x << sh
569 sh += k
570 if (sh >= self.DB) sh -= self.DB
571 }
572 if (k == 8 && (s[0] & 0x80) != 0) {
573 self.s = -1
574 if (sh > 0) self[self.t - 1] |= ((1 << (self.DB - sh)) - 1) << sh
575 }
576 self.clamp()
577 if (mi) BigInteger.ZERO.subTo(self, self)
578}
7098 579
7099 if ( typeof context === "string" ) { 580// (protected) clamp off excess high words
7100 tmp = fn[ context ]; 581function bnpClamp() {
7101 context = fn; 582 var c = this.s & this.DM
7102 fn = tmp; 583 while (this.t > 0 && this[this.t - 1] == c)--this.t
7103 } 584}
7104 585
7105 // Quick check to determine if target is callable, in the spec 586// (public) return string representation in given radix
7106 // this throws a TypeError, but we will just return undefined. 587function bnToString(b) {
7107 if ( !jQuery.isFunction( fn ) ) { 588 var self = this
7108 return undefined; 589 if (self.s < 0) return "-" + self.negate()
590 .toString(b)
591 var k
592 if (b == 16) k = 4
593 else if (b == 8) k = 3
594 else if (b == 2) k = 1
595 else if (b == 32) k = 5
596 else if (b == 4) k = 2
597 else return self.toRadix(b)
598 var km = (1 << k) - 1,
599 d, m = false,
600 r = "",
601 i = self.t
602 var p = self.DB - (i * self.DB) % k
603 if (i-- > 0) {
604 if (p < self.DB && (d = self[i] >> p) > 0) {
605 m = true
606 r = int2char(d)
607 }
608 while (i >= 0) {
609 if (p < k) {
610 d = (self[i] & ((1 << p) - 1)) << (k - p)
611 d |= self[--i] >> (p += self.DB - k)
612 } else {
613 d = (self[i] >> (p -= k)) & km
614 if (p <= 0) {
615 p += self.DB
616 --i
7109 } 617 }
7110 618 }
7111 // Simulated bind 619 if (d > 0) m = true
7112 args = slice.call( arguments, 2 ); 620 if (m) r += int2char(d)
7113 proxy = function() {
7114 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
7115 };
7116
7117 // Set the guid of unique handler to the same of original handler, so it can be removed
7118 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
7119
7120 return proxy;
7121 },
7122
7123 now: Date.now,
7124
7125 // jQuery.support is not used in Core but other projects attach their
7126 // properties to it so it needs to exist.
7127 support: support
7128});
7129
7130// Populate the class2type map
7131jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
7132 class2type[ "[object " + name + "]" ] = name.toLowerCase();
7133});
7134
7135function isArraylike( obj ) {
7136 var length = obj.length,
7137 type = jQuery.type( obj );
7138
7139 if ( type === "function" || jQuery.isWindow( obj ) ) {
7140 return false;
7141 }
7142
7143 if ( obj.nodeType === 1 && length ) {
7144 return true;
7145 } 621 }
7146 622 }
7147 return type === "array" || length === 0 || 623 return m ? r : "0"
7148 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
7149} 624}
7150var Sizzle =
7151/*!
7152 * Sizzle CSS Selector Engine v1.10.19
7153 * http://sizzlejs.com/
7154 *
7155 * Copyright 2013 jQuery Foundation, Inc. and other contributors
7156 * Released under the MIT license
7157 * http://jquery.org/license
7158 *
7159 * Date: 2014-04-18
7160 */
7161(function( window ) {
7162
7163var i,
7164 support,
7165 Expr,
7166 getText,
7167 isXML,
7168 tokenize,
7169 compile,
7170 select,
7171 outermostContext,
7172 sortInput,
7173 hasDuplicate,
7174
7175 // Local document vars
7176 setDocument,
7177 document,
7178 docElem,
7179 documentIsHTML,
7180 rbuggyQSA,
7181 rbuggyMatches,
7182 matches,
7183 contains,
7184
7185 // Instance-specific data
7186 expando = "sizzle" + -(new Date()),
7187 preferredDoc = window.document,
7188 dirruns = 0,
7189 done = 0,
7190 classCache = createCache(),
7191 tokenCache = createCache(),
7192 compilerCache = createCache(),
7193 sortOrder = function( a, b ) {
7194 if ( a === b ) {
7195 hasDuplicate = true;
7196 }
7197 return 0;
7198 },
7199 625
7200 // General-purpose constants 626// (public) -this
7201 strundefined = typeof undefined, 627function bnNegate() {
7202 MAX_NEGATIVE = 1 << 31, 628 var r = new BigInteger()
7203 629 BigInteger.ZERO.subTo(this, r)
7204 // Instance methods 630 return r
7205 hasOwn = ({}).hasOwnProperty,
7206 arr = [],
7207 pop = arr.pop,
7208 push_native = arr.push,
7209 push = arr.push,
7210 slice = arr.slice,
7211 // Use a stripped-down indexOf if we can't use a native one
7212 indexOf = arr.indexOf || function( elem ) {
7213 var i = 0,
7214 len = this.length;
7215 for ( ; i < len; i++ ) {
7216 if ( this[i] === elem ) {
7217 return i;
7218 }
7219 }
7220 return -1;
7221 },
7222
7223 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
7224
7225 // Regular expressions
7226
7227 // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
7228 whitespace = "[\\x20\\t\\r\\n\\f]",
7229 // http://www.w3.org/TR/css3-syntax/#characters
7230 characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
7231
7232 // Loosely modeled on CSS identifier characters
7233 // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
7234 // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
7235 identifier = characterEncoding.replace( "w", "w#" ),
7236
7237 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
7238 attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
7239 // Operator (capture 2)
7240 "*([*^$|!~]?=)" + whitespace +
7241 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
7242 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
7243 "*\\]",
7244
7245 pseudos = ":(" + characterEncoding + ")(?:\\((" +
7246 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
7247 // 1. quoted (capture 3; capture 4 or capture 5)
7248 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
7249 // 2. simple (capture 6)
7250 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
7251 // 3. anything else (capture 2)
7252 ".*" +
7253 ")\\)|)",
7254
7255 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
7256 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
7257
7258 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
7259 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
7260
7261 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
7262
7263 rpseudo = new RegExp( pseudos ),
7264 ridentifier = new RegExp( "^" + identifier + "$" ),
7265
7266 matchExpr = {
7267 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
7268 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
7269 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
7270 "ATTR": new RegExp( "^" + attributes ),
7271 "PSEUDO": new RegExp( "^" + pseudos ),
7272 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
7273 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
7274 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
7275 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
7276 // For use in libraries implementing .is()
7277 // We use this for POS matching in `select`
7278 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
7279 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
7280 },
7281
7282 rinputs = /^(?:input|select|textarea|button)$/i,
7283 rheader = /^h\d$/i,
7284
7285 rnative = /^[^{]+\{\s*\[native \w/,
7286
7287 // Easily-parseable/retrievable ID or TAG or CLASS selectors
7288 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
7289
7290 rsibling = /[+~]/,
7291 rescape = /'|\\/g,
7292
7293 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
7294 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
7295 funescape = function( _, escaped, escapedWhitespace ) {
7296 var high = "0x" + escaped - 0x10000;
7297 // NaN means non-codepoint
7298 // Support: Firefox<24
7299 // Workaround erroneous numeric interpretation of +"0x"
7300 return high !== high || escapedWhitespace ?
7301 escaped :
7302 high < 0 ?
7303 // BMP codepoint
7304 String.fromCharCode( high + 0x10000 ) :
7305 // Supplemental Plane codepoint (surrogate pair)
7306 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
7307 };
7308
7309// Optimize for push.apply( _, NodeList )
7310try {
7311 push.apply(
7312 (arr = slice.call( preferredDoc.childNodes )),
7313 preferredDoc.childNodes
7314 );
7315 // Support: Android<4.0
7316 // Detect silently failing push.apply
7317 arr[ preferredDoc.childNodes.length ].nodeType;
7318} catch ( e ) {
7319 push = { apply: arr.length ?
7320
7321 // Leverage slice if possible
7322 function( target, els ) {
7323 push_native.apply( target, slice.call(els) );
7324 } :
7325
7326 // Support: IE<9
7327 // Otherwise append directly
7328 function( target, els ) {
7329 var j = target.length,
7330 i = 0;
7331 // Can't trust NodeList.length
7332 while ( (target[j++] = els[i++]) ) {}
7333 target.length = j - 1;
7334 }
7335 };
7336} 631}
7337 632
7338function Sizzle( selector, context, results, seed ) { 633// (public) |this|
7339 var match, elem, m, nodeType, 634function bnAbs() {
7340 // QSA vars 635 return (this.s < 0) ? this.negate() : this
7341 i, groups, old, nid, newContext, newSelector; 636}
7342
7343 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
7344 setDocument( context );
7345 }
7346
7347 context = context || document;
7348 results = results || [];
7349
7350 if ( !selector || typeof selector !== "string" ) {
7351 return results;
7352 }
7353
7354 if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
7355 return [];
7356 }
7357 637
7358 if ( documentIsHTML && !seed ) { 638// (public) return + if this > a, - if this < a, 0 if equal
639function bnCompareTo(a) {
640 var r = this.s - a.s
641 if (r != 0) return r
642 var i = this.t
643 r = i - a.t
644 if (r != 0) return (this.s < 0) ? -r : r
645 while (--i >= 0)
646 if ((r = this[i] - a[i]) != 0) return r
647 return 0
648}
7359 649
7360 // Shortcuts 650// returns bit length of the integer x
7361 if ( (match = rquickExpr.exec( selector )) ) { 651function nbits(x) {
7362 // Speed-up: Sizzle("#ID") 652 var r = 1,
7363 if ( (m = match[1]) ) { 653 t
7364 if ( nodeType === 9 ) { 654 if ((t = x >>> 16) != 0) {
7365 elem = context.getElementById( m ); 655 x = t
7366 // Check parentNode to catch when Blackberry 4.6 returns 656 r += 16
7367 // nodes that are no longer in the document (jQuery #6963) 657 }
7368 if ( elem && elem.parentNode ) { 658 if ((t = x >> 8) != 0) {
7369 // Handle the case where IE, Opera, and Webkit return items 659 x = t
7370 // by name instead of ID 660 r += 8
7371 if ( elem.id === m ) { 661 }
7372 results.push( elem ); 662 if ((t = x >> 4) != 0) {
7373 return results; 663 x = t
7374 } 664 r += 4
7375 } else { 665 }
7376 return results; 666 if ((t = x >> 2) != 0) {
7377 } 667 x = t
7378 } else { 668 r += 2
7379 // Context is not a document 669 }
7380 if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && 670 if ((t = x >> 1) != 0) {
7381 contains( context, elem ) && elem.id === m ) { 671 x = t
7382 results.push( elem ); 672 r += 1
7383 return results; 673 }
7384 } 674 return r
7385 } 675}
7386
7387 // Speed-up: Sizzle("TAG")
7388 } else if ( match[2] ) {
7389 push.apply( results, context.getElementsByTagName( selector ) );
7390 return results;
7391
7392 // Speed-up: Sizzle(".CLASS")
7393 } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
7394 push.apply( results, context.getElementsByClassName( m ) );
7395 return results;
7396 }
7397 }
7398 676
7399 // QSA path 677// (public) return the number of bits in "this"
7400 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 678function bnBitLength() {
7401 nid = old = expando; 679 if (this.t <= 0) return 0
7402 newContext = context; 680 return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM))
7403 newSelector = nodeType === 9 && selector; 681}
7404
7405 // qSA works strangely on Element-rooted queries
7406 // We can work around this by specifying an extra ID on the root
7407 // and working up from there (Thanks to Andrew Dupont for the technique)
7408 // IE 8 doesn't work on object elements
7409 if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
7410 groups = tokenize( selector );
7411
7412 if ( (old = context.getAttribute("id")) ) {
7413 nid = old.replace( rescape, "\\$&" );
7414 } else {
7415 context.setAttribute( "id", nid );
7416 }
7417 nid = "[id='" + nid + "'] ";
7418
7419 i = groups.length;
7420 while ( i-- ) {
7421 groups[i] = nid + toSelector( groups[i] );
7422 }
7423 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
7424 newSelector = groups.join(",");
7425 }
7426 682
7427 if ( newSelector ) { 683// (public) return the number of bytes in "this"
7428 try { 684function bnByteLength() {
7429 push.apply( results, 685 return this.bitLength() >> 3
7430 newContext.querySelectorAll( newSelector ) 686}
7431 );
7432 return results;
7433 } catch(qsaError) {
7434 } finally {
7435 if ( !old ) {
7436 context.removeAttribute("id");
7437 }
7438 }
7439 }
7440 }
7441 }
7442 687
7443 // All others 688// (protected) r = this << n*DB
7444 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 689function bnpDLShiftTo(n, r) {
690 var i
691 for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]
692 for (i = n - 1; i >= 0; --i) r[i] = 0
693 r.t = this.t + n
694 r.s = this.s
7445} 695}
7446 696
7447/** 697// (protected) r = this >> n*DB
7448 * Create key-value caches of limited size 698function bnpDRShiftTo(n, r) {
7449 * @returns {Function(string, Object)} Returns the Object data after storing it on itself with 699 for (var i = n; i < this.t; ++i) r[i - n] = this[i]
7450 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 700 r.t = Math.max(this.t - n, 0)
7451 * deleting the oldest entry 701 r.s = this.s
7452 */
7453function createCache() {
7454 var keys = [];
7455
7456 function cache( key, value ) {
7457 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
7458 if ( keys.push( key + " " ) > Expr.cacheLength ) {
7459 // Only keep the most recent entries
7460 delete cache[ keys.shift() ];
7461 }
7462 return (cache[ key + " " ] = value);
7463 }
7464 return cache;
7465} 702}
7466 703
7467/** 704// (protected) r = this << n
7468 * Mark a function for special use by Sizzle 705function bnpLShiftTo(n, r) {
7469 * @param {Function} fn The function to mark 706 var self = this
7470 */ 707 var bs = n % self.DB
7471function markFunction( fn ) { 708 var cbs = self.DB - bs
7472 fn[ expando ] = true; 709 var bm = (1 << cbs) - 1
7473 return fn; 710 var ds = Math.floor(n / self.DB),
711 c = (self.s << bs) & self.DM,
712 i
713 for (i = self.t - 1; i >= 0; --i) {
714 r[i + ds + 1] = (self[i] >> cbs) | c
715 c = (self[i] & bm) << bs
716 }
717 for (i = ds - 1; i >= 0; --i) r[i] = 0
718 r[ds] = c
719 r.t = self.t + ds + 1
720 r.s = self.s
721 r.clamp()
7474} 722}
7475 723
7476/** 724// (protected) r = this >> n
7477 * Support testing using an element 725function bnpRShiftTo(n, r) {
7478 * @param {Function} fn Passed the created div and expects a boolean result 726 var self = this
7479 */ 727 r.s = self.s
7480function assert( fn ) { 728 var ds = Math.floor(n / self.DB)
7481 var div = document.createElement("div"); 729 if (ds >= self.t) {
730 r.t = 0
731 return
732 }
733 var bs = n % self.DB
734 var cbs = self.DB - bs
735 var bm = (1 << bs) - 1
736 r[0] = self[ds] >> bs
737 for (var i = ds + 1; i < self.t; ++i) {
738 r[i - ds - 1] |= (self[i] & bm) << cbs
739 r[i - ds] = self[i] >> bs
740 }
741 if (bs > 0) r[self.t - ds - 1] |= (self.s & bm) << cbs
742 r.t = self.t - ds
743 r.clamp()
744}
7482 745
7483 try { 746// (protected) r = this - a
7484 return !!fn( div ); 747function bnpSubTo(a, r) {
7485 } catch (e) { 748 var self = this
7486 return false; 749 var i = 0,
7487 } finally { 750 c = 0,
7488 // Remove from its parent by default 751 m = Math.min(a.t, self.t)
7489 if ( div.parentNode ) { 752 while (i < m) {
7490 div.parentNode.removeChild( div ); 753 c += self[i] - a[i]
7491 } 754 r[i++] = c & self.DM
7492 // release memory in IE 755 c >>= self.DB
7493 div = null; 756 }
757 if (a.t < self.t) {
758 c -= a.s
759 while (i < self.t) {
760 c += self[i]
761 r[i++] = c & self.DM
762 c >>= self.DB
763 }
764 c += self.s
765 } else {
766 c += self.s
767 while (i < a.t) {
768 c -= a[i]
769 r[i++] = c & self.DM
770 c >>= self.DB
7494 } 771 }
772 c -= a.s
773 }
774 r.s = (c < 0) ? -1 : 0
775 if (c < -1) r[i++] = self.DV + c
776 else if (c > 0) r[i++] = c
777 r.t = i
778 r.clamp()
7495} 779}
7496 780
7497/** 781// (protected) r = this * a, r != this,a (HAC 14.12)
7498 * Adds the same handler for all of the specified attrs 782// "this" should be the larger one if appropriate.
7499 * @param {String} attrs Pipe-separated list of attributes 783function bnpMultiplyTo(a, r) {
7500 * @param {Function} handler The method that will be applied 784 var x = this.abs(),
7501 */ 785 y = a.abs()
7502function addHandle( attrs, handler ) { 786 var i = x.t
7503 var arr = attrs.split("|"), 787 r.t = i + y.t
7504 i = attrs.length; 788 while (--i >= 0) r[i] = 0
7505 789 for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t)
7506 while ( i-- ) { 790 r.s = 0
7507 Expr.attrHandle[ arr[i] ] = handler; 791 r.clamp()
7508 } 792 if (this.s != a.s) BigInteger.ZERO.subTo(r, r)
7509} 793}
7510 794
7511/** 795// (protected) r = this^2, r != this (HAC 14.16)
7512 * Checks document order of two siblings 796function bnpSquareTo(r) {
7513 * @param {Element} a 797 var x = this.abs()
7514 * @param {Element} b 798 var i = r.t = 2 * x.t
7515 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 799 while (--i >= 0) r[i] = 0
7516 */ 800 for (i = 0; i < x.t - 1; ++i) {
7517function siblingCheck( a, b ) { 801 var c = x.am(i, x[i], r, 2 * i, 0, 1)
7518 var cur = b && a, 802 if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
7519 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 803 r[i + x.t] -= x.DV
7520 ( ~b.sourceIndex || MAX_NEGATIVE ) - 804 r[i + x.t + 1] = 1
7521 ( ~a.sourceIndex || MAX_NEGATIVE );
7522
7523 // Use IE sourceIndex if available on both nodes
7524 if ( diff ) {
7525 return diff;
7526 } 805 }
806 }
807 if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1)
808 r.s = 0
809 r.clamp()
810}
7527 811
7528 // Check if b follows a 812// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
7529 if ( cur ) { 813// r != q, this != m. q or r may be null.
7530 while ( (cur = cur.nextSibling) ) { 814function bnpDivRemTo(m, q, r) {
7531 if ( cur === b ) { 815 var self = this
7532 return -1; 816 var pm = m.abs()
7533 } 817 if (pm.t <= 0) return
7534 } 818 var pt = self.abs()
819 if (pt.t < pm.t) {
820 if (q != null) q.fromInt(0)
821 if (r != null) self.copyTo(r)
822 return
823 }
824 if (r == null) r = new BigInteger()
825 var y = new BigInteger(),
826 ts = self.s,
827 ms = m.s
828 var nsh = self.DB - nbits(pm[pm.t - 1]); // normalize modulus
829 if (nsh > 0) {
830 pm.lShiftTo(nsh, y)
831 pt.lShiftTo(nsh, r)
832 } else {
833 pm.copyTo(y)
834 pt.copyTo(r)
835 }
836 var ys = y.t
837 var y0 = y[ys - 1]
838 if (y0 == 0) return
839 var yt = y0 * (1 << self.F1) + ((ys > 1) ? y[ys - 2] >> self.F2 : 0)
840 var d1 = self.FV / yt,
841 d2 = (1 << self.F1) / yt,
842 e = 1 << self.F2
843 var i = r.t,
844 j = i - ys,
845 t = (q == null) ? new BigInteger() : q
846 y.dlShiftTo(j, t)
847 if (r.compareTo(t) >= 0) {
848 r[r.t++] = 1
849 r.subTo(t, r)
850 }
851 BigInteger.ONE.dlShiftTo(ys, t)
852 t.subTo(y, y); // "negative" y so we can replace sub with am later
853 while (y.t < ys) y[y.t++] = 0
854 while (--j >= 0) {
855 // Estimate quotient digit
856 var qd = (r[--i] == y0) ? self.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2)
857 if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out
858 y.dlShiftTo(j, t)
859 r.subTo(t, r)
860 while (r[i] < --qd) r.subTo(t, r)
7535 } 861 }
7536 862 }
7537 return a ? 1 : -1; 863 if (q != null) {
864 r.drShiftTo(ys, q)
865 if (ts != ms) BigInteger.ZERO.subTo(q, q)
866 }
867 r.t = ys
868 r.clamp()
869 if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder
870 if (ts < 0) BigInteger.ZERO.subTo(r, r)
7538} 871}
7539 872
7540/** 873// (public) this mod a
7541 * Returns a function to use in pseudos for input types 874function bnMod(a) {
7542 * @param {String} type 875 var r = new BigInteger()
7543 */ 876 this.abs()
7544function createInputPseudo( type ) { 877 .divRemTo(a, null, r)
7545 return function( elem ) { 878 if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r)
7546 var name = elem.nodeName.toLowerCase(); 879 return r
7547 return name === "input" && elem.type === type;
7548 };
7549} 880}
7550 881
7551/** 882// Modular reduction using "classic" algorithm
7552 * Returns a function to use in pseudos for buttons 883function Classic(m) {
7553 * @param {String} type 884 this.m = m
7554 */
7555function createButtonPseudo( type ) {
7556 return function( elem ) {
7557 var name = elem.nodeName.toLowerCase();
7558 return (name === "input" || name === "button") && elem.type === type;
7559 };
7560} 885}
7561 886
7562/** 887function cConvert(x) {
7563 * Returns a function to use in pseudos for positionals 888 if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m)
7564 * @param {Function} fn 889 else return x
7565 */
7566function createPositionalPseudo( fn ) {
7567 return markFunction(function( argument ) {
7568 argument = +argument;
7569 return markFunction(function( seed, matches ) {
7570 var j,
7571 matchIndexes = fn( [], seed.length, argument ),
7572 i = matchIndexes.length;
7573
7574 // Match elements found at the specified indexes
7575 while ( i-- ) {
7576 if ( seed[ (j = matchIndexes[i]) ] ) {
7577 seed[j] = !(matches[j] = seed[j]);
7578 }
7579 }
7580 });
7581 });
7582} 890}
7583 891
7584/** 892function cRevert(x) {
7585 * Checks a node for validity as a Sizzle context 893 return x
7586 * @param {Element|Object=} context
7587 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
7588 */
7589function testContext( context ) {
7590 return context && typeof context.getElementsByTagName !== strundefined && context;
7591} 894}
7592 895
7593// Expose support vars for convenience 896function cReduce(x) {
7594support = Sizzle.support = {}; 897 x.divRemTo(this.m, null, x)
7595 898}
7596/**
7597 * Detects XML nodes
7598 * @param {Element|Object} elem An element or a document
7599 * @returns {Boolean} True iff elem is a non-HTML XML node
7600 */
7601isXML = Sizzle.isXML = function( elem ) {
7602 // documentElement is verified for cases where it doesn't yet exist
7603 // (such as loading iframes in IE - #4833)
7604 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
7605 return documentElement ? documentElement.nodeName !== "HTML" : false;
7606};
7607
7608/**
7609 * Sets document-related variables once based on the current document
7610 * @param {Element|Object} [doc] An element or document object to use to set the document
7611 * @returns {Object} Returns the current document
7612 */
7613setDocument = Sizzle.setDocument = function( node ) {
7614 var hasCompare,
7615 doc = node ? node.ownerDocument || node : preferredDoc,
7616 parent = doc.defaultView;
7617
7618 // If no document and documentElement is available, return
7619 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
7620 return document;
7621 }
7622
7623 // Set our document
7624 document = doc;
7625 docElem = doc.documentElement;
7626
7627 // Support tests
7628 documentIsHTML = !isXML( doc );
7629
7630 // Support: IE>8
7631 // If iframe document is assigned to "document" variable and if iframe has been reloaded,
7632 // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
7633 // IE6-8 do not support the defaultView property so parent will be undefined
7634 if ( parent && parent !== parent.top ) {
7635 // IE11 does not have attachEvent, so all must suffer
7636 if ( parent.addEventListener ) {
7637 parent.addEventListener( "unload", function() {
7638 setDocument();
7639 }, false );
7640 } else if ( parent.attachEvent ) {
7641 parent.attachEvent( "onunload", function() {
7642 setDocument();
7643 });
7644 }
7645 }
7646
7647 /* Attributes
7648 ---------------------------------------------------------------------- */
7649
7650 // Support: IE<8
7651 // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
7652 support.attributes = assert(function( div ) {
7653 div.className = "i";
7654 return !div.getAttribute("className");
7655 });
7656
7657 /* getElement(s)By*
7658 ---------------------------------------------------------------------- */
7659
7660 // Check if getElementsByTagName("*") returns only elements
7661 support.getElementsByTagName = assert(function( div ) {
7662 div.appendChild( doc.createComment("") );
7663 return !div.getElementsByTagName("*").length;
7664 });
7665
7666 // Check if getElementsByClassName can be trusted
7667 support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
7668 div.innerHTML = "<div class='a'></div><div class='a i'></div>";
7669
7670 // Support: Safari<4
7671 // Catch class over-caching
7672 div.firstChild.className = "i";
7673 // Support: Opera<10
7674 // Catch gEBCN failure to find non-leading classes
7675 return div.getElementsByClassName("i").length === 2;
7676 });
7677
7678 // Support: IE<10
7679 // Check if getElementById returns elements by name
7680 // The broken getElementById methods don't pick up programatically-set names,
7681 // so use a roundabout getElementsByName test
7682 support.getById = assert(function( div ) {
7683 docElem.appendChild( div ).id = expando;
7684 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
7685 });
7686
7687 // ID find and filter
7688 if ( support.getById ) {
7689 Expr.find["ID"] = function( id, context ) {
7690 if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
7691 var m = context.getElementById( id );
7692 // Check parentNode to catch when Blackberry 4.6 returns
7693 // nodes that are no longer in the document #6963
7694 return m && m.parentNode ? [ m ] : [];
7695 }
7696 };
7697 Expr.filter["ID"] = function( id ) {
7698 var attrId = id.replace( runescape, funescape );
7699 return function( elem ) {
7700 return elem.getAttribute("id") === attrId;
7701 };
7702 };
7703 } else {
7704 // Support: IE6/7
7705 // getElementById is not reliable as a find shortcut
7706 delete Expr.find["ID"];
7707
7708 Expr.filter["ID"] = function( id ) {
7709 var attrId = id.replace( runescape, funescape );
7710 return function( elem ) {
7711 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
7712 return node && node.value === attrId;
7713 };
7714 };
7715 }
7716
7717 // Tag
7718 Expr.find["TAG"] = support.getElementsByTagName ?
7719 function( tag, context ) {
7720 if ( typeof context.getElementsByTagName !== strundefined ) {
7721 return context.getElementsByTagName( tag );
7722 }
7723 } :
7724 function( tag, context ) {
7725 var elem,
7726 tmp = [],
7727 i = 0,
7728 results = context.getElementsByTagName( tag );
7729
7730 // Filter out possible comments
7731 if ( tag === "*" ) {
7732 while ( (elem = results[i++]) ) {
7733 if ( elem.nodeType === 1 ) {
7734 tmp.push( elem );
7735 }
7736 }
7737
7738 return tmp;
7739 }
7740 return results;
7741 };
7742 899
7743 // Class 900function cMulTo(x, y, r) {
7744 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 901 x.multiplyTo(y, r)
7745 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) { 902 this.reduce(r)
7746 return context.getElementsByClassName( className ); 903}
7747 }
7748 };
7749 904
7750 /* QSA/matchesSelector 905function cSqrTo(x, r) {
7751 ---------------------------------------------------------------------- */ 906 x.squareTo(r)
7752 907 this.reduce(r)
7753 // QSA and matchesSelector support 908}
7754
7755 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
7756 rbuggyMatches = [];
7757
7758 // qSa(:focus) reports false when true (Chrome 21)
7759 // We allow this because of a bug in IE8/9 that throws an error
7760 // whenever `document.activeElement` is accessed on an iframe
7761 // So, we allow :focus to pass through QSA all the time to avoid the IE error
7762 // See http://bugs.jquery.com/ticket/13378
7763 rbuggyQSA = [];
7764
7765 if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
7766 // Build QSA regex
7767 // Regex strategy adopted from Diego Perini
7768 assert(function( div ) {
7769 // Select is set to empty string on purpose
7770 // This is to test IE's treatment of not explicitly
7771 // setting a boolean content attribute,
7772 // since its presence should be enough
7773 // http://bugs.jquery.com/ticket/12359
7774 div.innerHTML = "<select msallowclip=''><option selected=''></option></select>";
7775
7776 // Support: IE8, Opera 11-12.16
7777 // Nothing should be selected when empty strings follow ^= or $= or *=
7778 // The test attribute must be unknown in Opera but "safe" for WinRT
7779 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
7780 if ( div.querySelectorAll("[msallowclip^='']").length ) {
7781 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
7782 }
7783 909
7784 // Support: IE8 910Classic.prototype.convert = cConvert
7785 // Boolean attributes and "value" are not treated correctly 911Classic.prototype.revert = cRevert
7786 if ( !div.querySelectorAll("[selected]").length ) { 912Classic.prototype.reduce = cReduce
7787 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 913Classic.prototype.mulTo = cMulTo
7788 } 914Classic.prototype.sqrTo = cSqrTo
7789 915
7790 // Webkit/Opera - :checked should return selected option elements 916// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
7791 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 917// justification:
7792 // IE8 throws error here and will not see later tests 918// xy == 1 (mod m)
7793 if ( !div.querySelectorAll(":checked").length ) { 919// xy = 1+km
7794 rbuggyQSA.push(":checked"); 920// xy(2-xy) = (1+km)(1-km)
7795 } 921// x[y(2-xy)] = 1-k^2m^2
7796 }); 922// x[y(2-xy)] == 1 (mod m^2)
923// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
924// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
925// JS multiply "overflows" differently from C/C++, so care is needed here.
926function bnpInvDigit() {
927 if (this.t < 1) return 0
928 var x = this[0]
929 if ((x & 1) == 0) return 0
930 var y = x & 3; // y == 1/x mod 2^2
931 y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4
932 y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8
933 y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16
934 // last step - calculate inverse mod DV directly
935 // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
936 y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits
937 // we really want the negative inverse, and -DV < y < DV
938 return (y > 0) ? this.DV - y : -y
939}
7797 940
7798 assert(function( div ) { 941// Montgomery reduction
7799 // Support: Windows 8 Native Apps 942function Montgomery(m) {
7800 // The type and name attributes are restricted during .innerHTML assignment 943 this.m = m
7801 var input = doc.createElement("input"); 944 this.mp = m.invDigit()
7802 input.setAttribute( "type", "hidden" ); 945 this.mpl = this.mp & 0x7fff
7803 div.appendChild( input ).setAttribute( "name", "D" ); 946 this.mph = this.mp >> 15
7804 947 this.um = (1 << (m.DB - 15)) - 1
7805 // Support: IE8 948 this.mt2 = 2 * m.t
7806 // Enforce case-sensitivity of name attribute 949}
7807 if ( div.querySelectorAll("[name=d]").length ) {
7808 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
7809 }
7810 950
7811 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 951// xR mod m
7812 // IE8 throws error here and will not see later tests 952function montConvert(x) {
7813 if ( !div.querySelectorAll(":enabled").length ) { 953 var r = new BigInteger()
7814 rbuggyQSA.push( ":enabled", ":disabled" ); 954 x.abs()
7815 } 955 .dlShiftTo(this.m.t, r)
956 r.divRemTo(this.m, null, r)
957 if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r)
958 return r
959}
7816 960
7817 // Opera 10-11 does not throw on post-comma invalid pseudos 961// x/R mod m
7818 div.querySelectorAll("*,:x"); 962function montRevert(x) {
7819 rbuggyQSA.push(",.*:"); 963 var r = new BigInteger()
7820 }); 964 x.copyTo(r)
7821 } 965 this.reduce(r)
966 return r
967}
7822 968
7823 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 969// x = x/R mod m (HAC 14.32)
7824 docElem.webkitMatchesSelector || 970function montReduce(x) {
7825 docElem.mozMatchesSelector || 971 while (x.t <= this.mt2) // pad x so am has enough room later
7826 docElem.oMatchesSelector || 972 x[x.t++] = 0
7827 docElem.msMatchesSelector) )) ) { 973 for (var i = 0; i < this.m.t; ++i) {
7828 974 // faster way of calculating u0 = x[i]*mp mod DV
7829 assert(function( div ) { 975 var j = x[i] & 0x7fff
7830 // Check to see if it's possible to do matchesSelector 976 var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM
7831 // on a disconnected node (IE 9) 977 // use am to combine the multiply-shift-add into one call
7832 support.disconnectedMatch = matches.call( div, "div" ); 978 j = i + this.m.t
7833 979 x[j] += this.m.am(0, u0, x, i, 0, this.m.t)
7834 // This should fail with an exception 980 // propagate carry
7835 // Gecko does not error, returns false instead 981 while (x[j] >= x.DV) {
7836 matches.call( div, "[s!='']:x" ); 982 x[j] -= x.DV
7837 rbuggyMatches.push( "!=", pseudos ); 983 x[++j]++
7838 });
7839 } 984 }
985 }
986 x.clamp()
987 x.drShiftTo(this.m.t, x)
988 if (x.compareTo(this.m) >= 0) x.subTo(this.m, x)
989}
7840 990
7841 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 991// r = "x^2/R mod m"; x != r
7842 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 992function montSqrTo(x, r) {
7843 993 x.squareTo(r)
7844 /* Contains 994 this.reduce(r)
7845 ---------------------------------------------------------------------- */ 995}
7846 hasCompare = rnative.test( docElem.compareDocumentPosition );
7847
7848 // Element contains another
7849 // Purposefully does not implement inclusive descendent
7850 // As in, an element does not contain itself
7851 contains = hasCompare || rnative.test( docElem.contains ) ?
7852 function( a, b ) {
7853 var adown = a.nodeType === 9 ? a.documentElement : a,
7854 bup = b && b.parentNode;
7855 return a === bup || !!( bup && bup.nodeType === 1 && (
7856 adown.contains ?
7857 adown.contains( bup ) :
7858 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
7859 ));
7860 } :
7861 function( a, b ) {
7862 if ( b ) {
7863 while ( (b = b.parentNode) ) {
7864 if ( b === a ) {
7865 return true;
7866 }
7867 }
7868 }
7869 return false;
7870 };
7871
7872 /* Sorting
7873 ---------------------------------------------------------------------- */
7874
7875 // Document order sorting
7876 sortOrder = hasCompare ?
7877 function( a, b ) {
7878
7879 // Flag for duplicate removal
7880 if ( a === b ) {
7881 hasDuplicate = true;
7882 return 0;
7883 }
7884
7885 // Sort on method existence if only one input has compareDocumentPosition
7886 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
7887 if ( compare ) {
7888 return compare;
7889 }
7890
7891 // Calculate position if both inputs belong to the same document
7892 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
7893 a.compareDocumentPosition( b ) :
7894
7895 // Otherwise we know they are disconnected
7896 1;
7897
7898 // Disconnected nodes
7899 if ( compare & 1 ||
7900 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
7901
7902 // Choose the first element that is related to our preferred document
7903 if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
7904 return -1;
7905 }
7906 if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
7907 return 1;
7908 }
7909
7910 // Maintain original order
7911 return sortInput ?
7912 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
7913 0;
7914 }
7915
7916 return compare & 4 ? -1 : 1;
7917 } :
7918 function( a, b ) {
7919 // Exit early if the nodes are identical
7920 if ( a === b ) {
7921 hasDuplicate = true;
7922 return 0;
7923 }
7924
7925 var cur,
7926 i = 0,
7927 aup = a.parentNode,
7928 bup = b.parentNode,
7929 ap = [ a ],
7930 bp = [ b ];
7931
7932 // Parentless nodes are either documents or disconnected
7933 if ( !aup || !bup ) {
7934 return a === doc ? -1 :
7935 b === doc ? 1 :
7936 aup ? -1 :
7937 bup ? 1 :
7938 sortInput ?
7939 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
7940 0;
7941
7942 // If the nodes are siblings, we can do a quick check
7943 } else if ( aup === bup ) {
7944 return siblingCheck( a, b );
7945 }
7946
7947 // Otherwise we need full lists of their ancestors for comparison
7948 cur = a;
7949 while ( (cur = cur.parentNode) ) {
7950 ap.unshift( cur );
7951 }
7952 cur = b;
7953 while ( (cur = cur.parentNode) ) {
7954 bp.unshift( cur );
7955 }
7956
7957 // Walk down the tree looking for a discrepancy
7958 while ( ap[i] === bp[i] ) {
7959 i++;
7960 }
7961
7962 return i ?
7963 // Do a sibling check if the nodes have a common ancestor
7964 siblingCheck( ap[i], bp[i] ) :
7965 996
7966 // Otherwise nodes in our document sort first 997// r = "xy/R mod m"; x,y != r
7967 ap[i] === preferredDoc ? -1 : 998function montMulTo(x, y, r) {
7968 bp[i] === preferredDoc ? 1 : 999 x.multiplyTo(y, r)
7969 0; 1000 this.reduce(r)
7970 }; 1001}
7971 1002
7972 return doc; 1003Montgomery.prototype.convert = montConvert
7973}; 1004Montgomery.prototype.revert = montRevert
1005Montgomery.prototype.reduce = montReduce
1006Montgomery.prototype.mulTo = montMulTo
1007Montgomery.prototype.sqrTo = montSqrTo
7974 1008
7975Sizzle.matches = function( expr, elements ) { 1009// (protected) true iff this is even
7976 return Sizzle( expr, null, null, elements ); 1010function bnpIsEven() {
7977}; 1011 return ((this.t > 0) ? (this[0] & 1) : this.s) == 0
1012}
7978 1013
7979Sizzle.matchesSelector = function( elem, expr ) { 1014// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
7980 // Set document vars if needed 1015function bnpExp(e, z) {
7981 if ( ( elem.ownerDocument || elem ) !== document ) { 1016 if (e > 0xffffffff || e < 1) return BigInteger.ONE
7982 setDocument( elem ); 1017 var r = new BigInteger(),
1018 r2 = new BigInteger(),
1019 g = z.convert(this),
1020 i = nbits(e) - 1
1021 g.copyTo(r)
1022 while (--i >= 0) {
1023 z.sqrTo(r, r2)
1024 if ((e & (1 << i)) > 0) z.mulTo(r2, g, r)
1025 else {
1026 var t = r
1027 r = r2
1028 r2 = t
7983 } 1029 }
1030 }
1031 return z.revert(r)
1032}
7984 1033
7985 // Make sure that attribute selectors are quoted 1034// (public) this^e % m, 0 <= e < 2^32
7986 expr = expr.replace( rattributeQuotes, "='$1']" ); 1035function bnModPowInt(e, m) {
1036 var z
1037 if (e < 256 || m.isEven()) z = new Classic(m)
1038 else z = new Montgomery(m)
1039 return this.exp(e, z)
1040}
7987 1041
7988 if ( support.matchesSelector && documentIsHTML && 1042// protected
7989 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1043proto.copyTo = bnpCopyTo
7990 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1044proto.fromInt = bnpFromInt
1045proto.fromString = bnpFromString
1046proto.clamp = bnpClamp
1047proto.dlShiftTo = bnpDLShiftTo
1048proto.drShiftTo = bnpDRShiftTo
1049proto.lShiftTo = bnpLShiftTo
1050proto.rShiftTo = bnpRShiftTo
1051proto.subTo = bnpSubTo
1052proto.multiplyTo = bnpMultiplyTo
1053proto.squareTo = bnpSquareTo
1054proto.divRemTo = bnpDivRemTo
1055proto.invDigit = bnpInvDigit
1056proto.isEven = bnpIsEven
1057proto.exp = bnpExp
7991 1058
7992 try { 1059// public
7993 var ret = matches.call( elem, expr ); 1060proto.toString = bnToString
7994 1061proto.negate = bnNegate
7995 // IE 9's matchesSelector returns false on disconnected nodes 1062proto.abs = bnAbs
7996 if ( ret || support.disconnectedMatch || 1063proto.compareTo = bnCompareTo
7997 // As well, disconnected nodes are said to be in a document 1064proto.bitLength = bnBitLength
7998 // fragment in IE 9 1065proto.byteLength = bnByteLength
7999 elem.document && elem.document.nodeType !== 11 ) { 1066proto.mod = bnMod
8000 return ret; 1067proto.modPowInt = bnModPowInt
8001 }
8002 } catch(e) {}
8003 }
8004 1068
8005 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1069// (public)
8006}; 1070function bnClone() {
1071 var r = new BigInteger()
1072 this.copyTo(r)
1073 return r
1074}
8007 1075
8008Sizzle.contains = function( context, elem ) { 1076// (public) return value as integer
8009 // Set document vars if needed 1077function bnIntValue() {
8010 if ( ( context.ownerDocument || context ) !== document ) { 1078 if (this.s < 0) {
8011 setDocument( context ); 1079 if (this.t == 1) return this[0] - this.DV
8012 } 1080 else if (this.t == 0) return -1
8013 return contains( context, elem ); 1081 } else if (this.t == 1) return this[0]
8014}; 1082 else if (this.t == 0) return 0
1083 // assumes 16 < DB < 32
1084 return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]
1085}
8015 1086
8016Sizzle.attr = function( elem, name ) { 1087// (public) return value as byte
8017 // Set document vars if needed 1088function bnByteValue() {
8018 if ( ( elem.ownerDocument || elem ) !== document ) { 1089 return (this.t == 0) ? this.s : (this[0] << 24) >> 24
8019 setDocument( elem ); 1090}
8020 }
8021 1091
8022 var fn = Expr.attrHandle[ name.toLowerCase() ], 1092// (public) return value as short (assumes DB>=16)
8023 // Don't get fooled by Object.prototype properties (jQuery #13807) 1093function bnShortValue() {
8024 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1094 return (this.t == 0) ? this.s : (this[0] << 16) >> 16
8025 fn( elem, name, !documentIsHTML ) : 1095}
8026 undefined;
8027
8028 return val !== undefined ?
8029 val :
8030 support.attributes || !documentIsHTML ?
8031 elem.getAttribute( name ) :
8032 (val = elem.getAttributeNode(name)) && val.specified ?
8033 val.value :
8034 null;
8035};
8036 1096
8037Sizzle.error = function( msg ) { 1097// (protected) return x s.t. r^x < DV
8038 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1098function bnpChunkSize(r) {
8039}; 1099 return Math.floor(Math.LN2 * this.DB / Math.log(r))
1100}
8040 1101
8041/** 1102// (public) 0 if this == 0, 1 if this > 0
8042 * Document sorting and removing duplicates 1103function bnSigNum() {
8043 * @param {ArrayLike} results 1104 if (this.s < 0) return -1
8044 */ 1105 else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0
8045Sizzle.uniqueSort = function( results ) { 1106 else return 1
8046 var elem, 1107}
8047 duplicates = [],
8048 j = 0,
8049 i = 0;
8050
8051 // Unless we *know* we can detect duplicates, assume their presence
8052 hasDuplicate = !support.detectDuplicates;
8053 sortInput = !support.sortStable && results.slice( 0 );
8054 results.sort( sortOrder );
8055
8056 if ( hasDuplicate ) {
8057 while ( (elem = results[i++]) ) {
8058 if ( elem === results[ i ] ) {
8059 j = duplicates.push( i );
8060 }
8061 }
8062 while ( j-- ) {
8063 results.splice( duplicates[ j ], 1 );
8064 }
8065 }
8066 1108
8067 // Clear input after sorting to release objects 1109// (protected) convert to radix string
8068 // See https://github.com/jquery/sizzle/pull/225 1110function bnpToRadix(b) {
8069 sortInput = null; 1111 if (b == null) b = 10
1112 if (this.signum() == 0 || b < 2 || b > 36) return "0"
1113 var cs = this.chunkSize(b)
1114 var a = Math.pow(b, cs)
1115 var d = nbv(a),
1116 y = new BigInteger(),
1117 z = new BigInteger(),
1118 r = ""
1119 this.divRemTo(d, y, z)
1120 while (y.signum() > 0) {
1121 r = (a + z.intValue())
1122 .toString(b)
1123 .substr(1) + r
1124 y.divRemTo(d, y, z)
1125 }
1126 return z.intValue()
1127 .toString(b) + r
1128}
8070 1129
8071 return results; 1130// (protected) convert from radix string
8072}; 1131function bnpFromRadix(s, b) {
1132 var self = this
1133 self.fromInt(0)
1134 if (b == null) b = 10
1135 var cs = self.chunkSize(b)
1136 var d = Math.pow(b, cs),
1137 mi = false,
1138 j = 0,
1139 w = 0
1140 for (var i = 0; i < s.length; ++i) {
1141 var x = intAt(s, i)
1142 if (x < 0) {
1143 if (s.charAt(i) == "-" && self.signum() == 0) mi = true
1144 continue
1145 }
1146 w = b * w + x
1147 if (++j >= cs) {
1148 self.dMultiply(d)
1149 self.dAddOffset(w, 0)
1150 j = 0
1151 w = 0
1152 }
1153 }
1154 if (j > 0) {
1155 self.dMultiply(Math.pow(b, j))
1156 self.dAddOffset(w, 0)
1157 }
1158 if (mi) BigInteger.ZERO.subTo(self, self)
1159}
8073 1160
8074/** 1161// (protected) alternate constructor
8075 * Utility function for retrieving the text value of an array of DOM nodes 1162function bnpFromNumber(a, b, c) {
8076 * @param {Array|Element} elem 1163 var self = this
8077 */ 1164 if ("number" == typeof b) {
8078getText = Sizzle.getText = function( elem ) { 1165 // new BigInteger(int,int,RNG)
8079 var node, 1166 if (a < 2) self.fromInt(1)
8080 ret = "", 1167 else {
8081 i = 0, 1168 self.fromNumber(a, c)
8082 nodeType = elem.nodeType; 1169 if (!self.testBit(a - 1)) // force MSB set
8083 1170 self.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, self)
8084 if ( !nodeType ) { 1171 if (self.isEven()) self.dAddOffset(1, 0); // force odd
8085 // If no nodeType, this is expected to be an array 1172 while (!self.isProbablePrime(b)) {
8086 while ( (node = elem[i++]) ) { 1173 self.dAddOffset(2, 0)
8087 // Do not traverse comment nodes 1174 if (self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a - 1), self)
8088 ret += getText( node ); 1175 }
8089 }
8090 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
8091 // Use textContent for elements
8092 // innerText usage removed for consistency of new lines (jQuery #11153)
8093 if ( typeof elem.textContent === "string" ) {
8094 return elem.textContent;
8095 } else {
8096 // Traverse its children
8097 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
8098 ret += getText( elem );
8099 }
8100 }
8101 } else if ( nodeType === 3 || nodeType === 4 ) {
8102 return elem.nodeValue;
8103 } 1176 }
8104 // Do not include comment or processing instruction nodes 1177 } else {
8105 1178 // new BigInteger(int,RNG)
8106 return ret; 1179 var x = new Array(),
8107}; 1180 t = a & 7
8108 1181 x.length = (a >> 3) + 1
8109Expr = Sizzle.selectors = { 1182 b.nextBytes(x)
8110 1183 if (t > 0) x[0] &= ((1 << t) - 1)
8111 // Can be adjusted by the user 1184 else x[0] = 0
8112 cacheLength: 50, 1185 self.fromString(x, 256)
8113 1186 }
8114 createPseudo: markFunction, 1187}
8115
8116 match: matchExpr,
8117
8118 attrHandle: {},
8119
8120 find: {},
8121
8122 relative: {
8123 ">": { dir: "parentNode", first: true },
8124 " ": { dir: "parentNode" },
8125 "+": { dir: "previousSibling", first: true },
8126 "~": { dir: "previousSibling" }
8127 },
8128
8129 preFilter: {
8130 "ATTR": function( match ) {
8131 match[1] = match[1].replace( runescape, funescape );
8132
8133 // Move the given value to match[3] whether quoted or unquoted
8134 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
8135
8136 if ( match[2] === "~=" ) {
8137 match[3] = " " + match[3] + " ";
8138 }
8139
8140 return match.slice( 0, 4 );
8141 },
8142
8143 "CHILD": function( match ) {
8144 /* matches from matchExpr["CHILD"]
8145 1 type (only|nth|...)
8146 2 what (child|of-type)
8147 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
8148 4 xn-component of xn+y argument ([+-]?\d*n|)
8149 5 sign of xn-component
8150 6 x of xn-component
8151 7 sign of y-component
8152 8 y of y-component
8153 */
8154 match[1] = match[1].toLowerCase();
8155
8156 if ( match[1].slice( 0, 3 ) === "nth" ) {
8157 // nth-* requires argument
8158 if ( !match[3] ) {
8159 Sizzle.error( match[0] );
8160 }
8161
8162 // numeric x and y parameters for Expr.filter.CHILD
8163 // remember that false/true cast respectively to 0/1
8164 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
8165 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
8166
8167 // other types prohibit arguments
8168 } else if ( match[3] ) {
8169 Sizzle.error( match[0] );
8170 }
8171
8172 return match;
8173 },
8174
8175 "PSEUDO": function( match ) {
8176 var excess,
8177 unquoted = !match[6] && match[2];
8178
8179 if ( matchExpr["CHILD"].test( match[0] ) ) {
8180 return null;
8181 }
8182
8183 // Accept quoted arguments as-is
8184 if ( match[3] ) {
8185 match[2] = match[4] || match[5] || "";
8186
8187 // Strip excess characters from unquoted arguments
8188 } else if ( unquoted && rpseudo.test( unquoted ) &&
8189 // Get excess from tokenize (recursively)
8190 (excess = tokenize( unquoted, true )) &&
8191 // advance to the next closing parenthesis
8192 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
8193
8194 // excess is a negative index
8195 match[0] = match[0].slice( 0, excess );
8196 match[2] = unquoted.slice( 0, excess );
8197 }
8198
8199 // Return only captures needed by the pseudo filter method (type and argument)
8200 return match.slice( 0, 3 );
8201 }
8202 },
8203
8204 filter: {
8205
8206 "TAG": function( nodeNameSelector ) {
8207 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
8208 return nodeNameSelector === "*" ?
8209 function() { return true; } :
8210 function( elem ) {
8211 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
8212 };
8213 },
8214
8215 "CLASS": function( className ) {
8216 var pattern = classCache[ className + " " ];
8217
8218 return pattern ||
8219 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
8220 classCache( className, function( elem ) {
8221 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
8222 });
8223 },
8224
8225 "ATTR": function( name, operator, check ) {
8226 return function( elem ) {
8227 var result = Sizzle.attr( elem, name );
8228
8229 if ( result == null ) {
8230 return operator === "!=";
8231 }
8232 if ( !operator ) {
8233 return true;
8234 }
8235
8236 result += "";
8237
8238 return operator === "=" ? result === check :
8239 operator === "!=" ? result !== check :
8240 operator === "^=" ? check && result.indexOf( check ) === 0 :
8241 operator === "*=" ? check && result.indexOf( check ) > -1 :
8242 operator === "$=" ? check && result.slice( -check.length ) === check :
8243 operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
8244 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
8245 false;
8246 };
8247 },
8248
8249 "CHILD": function( type, what, argument, first, last ) {
8250 var simple = type.slice( 0, 3 ) !== "nth",
8251 forward = type.slice( -4 ) !== "last",
8252 ofType = what === "of-type";
8253
8254 return first === 1 && last === 0 ?
8255
8256 // Shortcut for :nth-*(n)
8257 function( elem ) {
8258 return !!elem.parentNode;
8259 } :
8260
8261 function( elem, context, xml ) {
8262 var cache, outerCache, node, diff, nodeIndex, start,
8263 dir = simple !== forward ? "nextSibling" : "previousSibling",
8264 parent = elem.parentNode,
8265 name = ofType && elem.nodeName.toLowerCase(),
8266 useCache = !xml && !ofType;
8267
8268 if ( parent ) {
8269
8270 // :(first|last|only)-(child|of-type)
8271 if ( simple ) {
8272 while ( dir ) {
8273 node = elem;
8274 while ( (node = node[ dir ]) ) {
8275 if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
8276 return false;
8277 }
8278 }
8279 // Reverse direction for :only-* (if we haven't yet done so)
8280 start = dir = type === "only" && !start && "nextSibling";
8281 }
8282 return true;
8283 }
8284
8285 start = [ forward ? parent.firstChild : parent.lastChild ];
8286
8287 // non-xml :nth-child(...) stores cache data on `parent`
8288 if ( forward && useCache ) {
8289 // Seek `elem` from a previously-cached index
8290 outerCache = parent[ expando ] || (parent[ expando ] = {});
8291 cache = outerCache[ type ] || [];
8292 nodeIndex = cache[0] === dirruns && cache[1];
8293 diff = cache[0] === dirruns && cache[2];
8294 node = nodeIndex && parent.childNodes[ nodeIndex ];
8295
8296 while ( (node = ++nodeIndex && node && node[ dir ] ||
8297
8298 // Fallback to seeking `elem` from the start
8299 (diff = nodeIndex = 0) || start.pop()) ) {
8300
8301 // When found, cache indexes on `parent` and break
8302 if ( node.nodeType === 1 && ++diff && node === elem ) {
8303 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
8304 break;
8305 }
8306 }
8307
8308 // Use previously-cached element index if available
8309 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
8310 diff = cache[1];
8311
8312 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
8313 } else {
8314 // Use the same loop as above to seek `elem` from the start
8315 while ( (node = ++nodeIndex && node && node[ dir ] ||
8316 (diff = nodeIndex = 0) || start.pop()) ) {
8317
8318 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
8319 // Cache the index of each encountered element
8320 if ( useCache ) {
8321 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
8322 }
8323
8324 if ( node === elem ) {
8325 break;
8326 }
8327 }
8328 }
8329 }
8330
8331 // Incorporate the offset, then check against cycle size
8332 diff -= last;
8333 return diff === first || ( diff % first === 0 && diff / first >= 0 );
8334 }
8335 };
8336 },
8337
8338 "PSEUDO": function( pseudo, argument ) {
8339 // pseudo-class names are case-insensitive
8340 // http://www.w3.org/TR/selectors/#pseudo-classes
8341 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
8342 // Remember that setFilters inherits from pseudos
8343 var args,
8344 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
8345 Sizzle.error( "unsupported pseudo: " + pseudo );
8346
8347 // The user may use createPseudo to indicate that
8348 // arguments are needed to create the filter function
8349 // just as Sizzle does
8350 if ( fn[ expando ] ) {
8351 return fn( argument );
8352 }
8353
8354 // But maintain support for old signatures
8355 if ( fn.length > 1 ) {
8356 args = [ pseudo, pseudo, "", argument ];
8357 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
8358 markFunction(function( seed, matches ) {
8359 var idx,
8360 matched = fn( seed, argument ),
8361 i = matched.length;
8362 while ( i-- ) {
8363 idx = indexOf.call( seed, matched[i] );
8364 seed[ idx ] = !( matches[ idx ] = matched[i] );
8365 }
8366 }) :
8367 function( elem ) {
8368 return fn( elem, 0, args );
8369 };
8370 }
8371 1188
8372 return fn; 1189// (public) convert to bigendian byte array
1190function bnToByteArray() {
1191 var self = this
1192 var i = self.t,
1193 r = new Array()
1194 r[0] = self.s
1195 var p = self.DB - (i * self.DB) % 8,
1196 d, k = 0
1197 if (i-- > 0) {
1198 if (p < self.DB && (d = self[i] >> p) != (self.s & self.DM) >> p)
1199 r[k++] = d | (self.s << (self.DB - p))
1200 while (i >= 0) {
1201 if (p < 8) {
1202 d = (self[i] & ((1 << p) - 1)) << (8 - p)
1203 d |= self[--i] >> (p += self.DB - 8)
1204 } else {
1205 d = (self[i] >> (p -= 8)) & 0xff
1206 if (p <= 0) {
1207 p += self.DB
1208 --i
8373 } 1209 }
8374 }, 1210 }
8375 1211 if ((d & 0x80) != 0) d |= -256
8376 pseudos: { 1212 if (k === 0 && (self.s & 0x80) != (d & 0x80))++k
8377 // Potentially complex pseudos 1213 if (k > 0 || d != self.s) r[k++] = d
8378 "not": markFunction(function( selector ) {
8379 // Trim the selector passed to compile
8380 // to avoid treating leading and trailing
8381 // spaces as combinators
8382 var input = [],
8383 results = [],
8384 matcher = compile( selector.replace( rtrim, "$1" ) );
8385
8386 return matcher[ expando ] ?
8387 markFunction(function( seed, matches, context, xml ) {
8388 var elem,
8389 unmatched = matcher( seed, null, xml, [] ),
8390 i = seed.length;
8391
8392 // Match elements unmatched by `matcher`
8393 while ( i-- ) {
8394 if ( (elem = unmatched[i]) ) {
8395 seed[i] = !(matches[i] = elem);
8396 }
8397 }
8398 }) :
8399 function( elem, context, xml ) {
8400 input[0] = elem;
8401 matcher( input, null, xml, results );
8402 return !results.pop();
8403 };
8404 }),
8405
8406 "has": markFunction(function( selector ) {
8407 return function( elem ) {
8408 return Sizzle( selector, elem ).length > 0;
8409 };
8410 }),
8411
8412 "contains": markFunction(function( text ) {
8413 return function( elem ) {
8414 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
8415 };
8416 }),
8417
8418 // "Whether an element is represented by a :lang() selector
8419 // is based solely on the element's language value
8420 // being equal to the identifier C,
8421 // or beginning with the identifier C immediately followed by "-".
8422 // The matching of C against the element's language value is performed case-insensitively.
8423 // The identifier C does not have to be a valid language name."
8424 // http://www.w3.org/TR/selectors/#lang-pseudo
8425 "lang": markFunction( function( lang ) {
8426 // lang value must be a valid identifier
8427 if ( !ridentifier.test(lang || "") ) {
8428 Sizzle.error( "unsupported lang: " + lang );
8429 }
8430 lang = lang.replace( runescape, funescape ).toLowerCase();
8431 return function( elem ) {
8432 var elemLang;
8433 do {
8434 if ( (elemLang = documentIsHTML ?
8435 elem.lang :
8436 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
8437
8438 elemLang = elemLang.toLowerCase();
8439 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
8440 }
8441 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
8442 return false;
8443 };
8444 }),
8445
8446 // Miscellaneous
8447 "target": function( elem ) {
8448 var hash = window.location && window.location.hash;
8449 return hash && hash.slice( 1 ) === elem.id;
8450 },
8451
8452 "root": function( elem ) {
8453 return elem === docElem;
8454 },
8455
8456 "focus": function( elem ) {
8457 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
8458 },
8459
8460 // Boolean properties
8461 "enabled": function( elem ) {
8462 return elem.disabled === false;
8463 },
8464
8465 "disabled": function( elem ) {
8466 return elem.disabled === true;
8467 },
8468
8469 "checked": function( elem ) {
8470 // In CSS3, :checked should return both checked and selected elements
8471 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
8472 var nodeName = elem.nodeName.toLowerCase();
8473 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
8474 },
8475
8476 "selected": function( elem ) {
8477 // Accessing this property makes selected-by-default
8478 // options in Safari work properly
8479 if ( elem.parentNode ) {
8480 elem.parentNode.selectedIndex;
8481 }
8482
8483 return elem.selected === true;
8484 },
8485
8486 // Contents
8487 "empty": function( elem ) {
8488 // http://www.w3.org/TR/selectors/#empty-pseudo
8489 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
8490 // but not by others (comment: 8; processing instruction: 7; etc.)
8491 // nodeType < 6 works because attributes (2) do not appear as children
8492 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
8493 if ( elem.nodeType < 6 ) {
8494 return false;
8495 }
8496 }
8497 return true;
8498 },
8499
8500 "parent": function( elem ) {
8501 return !Expr.pseudos["empty"]( elem );
8502 },
8503
8504 // Element/input types
8505 "header": function( elem ) {
8506 return rheader.test( elem.nodeName );
8507 },
8508
8509 "input": function( elem ) {
8510 return rinputs.test( elem.nodeName );
8511 },
8512
8513 "button": function( elem ) {
8514 var name = elem.nodeName.toLowerCase();
8515 return name === "input" && elem.type === "button" || name === "button";
8516 },
8517
8518 "text": function( elem ) {
8519 var attr;
8520 return elem.nodeName.toLowerCase() === "input" &&
8521 elem.type === "text" &&
8522
8523 // Support: IE<8
8524 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
8525 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
8526 },
8527
8528 // Position-in-collection
8529 "first": createPositionalPseudo(function() {
8530 return [ 0 ];
8531 }),
8532
8533 "last": createPositionalPseudo(function( matchIndexes, length ) {
8534 return [ length - 1 ];
8535 }),
8536
8537 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
8538 return [ argument < 0 ? argument + length : argument ];
8539 }),
8540
8541 "even": createPositionalPseudo(function( matchIndexes, length ) {
8542 var i = 0;
8543 for ( ; i < length; i += 2 ) {
8544 matchIndexes.push( i );
8545 }
8546 return matchIndexes;
8547 }),
8548
8549 "odd": createPositionalPseudo(function( matchIndexes, length ) {
8550 var i = 1;
8551 for ( ; i < length; i += 2 ) {
8552 matchIndexes.push( i );
8553 }
8554 return matchIndexes;
8555 }),
8556
8557 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
8558 var i = argument < 0 ? argument + length : argument;
8559 for ( ; --i >= 0; ) {
8560 matchIndexes.push( i );
8561 }
8562 return matchIndexes;
8563 }),
8564
8565 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
8566 var i = argument < 0 ? argument + length : argument;
8567 for ( ; ++i < length; ) {
8568 matchIndexes.push( i );
8569 }
8570 return matchIndexes;
8571 })
8572 } 1214 }
8573}; 1215 }
8574 1216 return r
8575Expr.pseudos["nth"] = Expr.pseudos["eq"];
8576
8577// Add button/input type pseudos
8578for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
8579 Expr.pseudos[ i ] = createInputPseudo( i );
8580}
8581for ( i in { submit: true, reset: true } ) {
8582 Expr.pseudos[ i ] = createButtonPseudo( i );
8583} 1217}
8584 1218
8585// Easy API for creating new setFilters 1219function bnEquals(a) {
8586function setFilters() {} 1220 return (this.compareTo(a) == 0)
8587setFilters.prototype = Expr.filters = Expr.pseudos; 1221}
8588Expr.setFilters = new setFilters();
8589
8590tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
8591 var matched, match, tokens, type,
8592 soFar, groups, preFilters,
8593 cached = tokenCache[ selector + " " ];
8594
8595 if ( cached ) {
8596 return parseOnly ? 0 : cached.slice( 0 );
8597 }
8598
8599 soFar = selector;
8600 groups = [];
8601 preFilters = Expr.preFilter;
8602
8603 while ( soFar ) {
8604
8605 // Comma and first run
8606 if ( !matched || (match = rcomma.exec( soFar )) ) {
8607 if ( match ) {
8608 // Don't consume trailing commas as valid
8609 soFar = soFar.slice( match[0].length ) || soFar;
8610 }
8611 groups.push( (tokens = []) );
8612 }
8613 1222
8614 matched = false; 1223function bnMin(a) {
8615 1224 return (this.compareTo(a) < 0) ? this : a
8616 // Combinators 1225}
8617 if ( (match = rcombinators.exec( soFar )) ) {
8618 matched = match.shift();
8619 tokens.push({
8620 value: matched,
8621 // Cast descendant combinators to space
8622 type: match[0].replace( rtrim, " " )
8623 });
8624 soFar = soFar.slice( matched.length );
8625 }
8626 1226
8627 // Filters 1227function bnMax(a) {
8628 for ( type in Expr.filter ) { 1228 return (this.compareTo(a) > 0) ? this : a
8629 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 1229}
8630 (match = preFilters[ type ]( match ))) ) {
8631 matched = match.shift();
8632 tokens.push({
8633 value: matched,
8634 type: type,
8635 matches: match
8636 });
8637 soFar = soFar.slice( matched.length );
8638 }
8639 }
8640 1230
8641 if ( !matched ) { 1231// (protected) r = this op a (bitwise)
8642 break; 1232function bnpBitwiseTo(a, op, r) {
8643 } 1233 var self = this
8644 } 1234 var i, f, m = Math.min(a.t, self.t)
1235 for (i = 0; i < m; ++i) r[i] = op(self[i], a[i])
1236 if (a.t < self.t) {
1237 f = a.s & self.DM
1238 for (i = m; i < self.t; ++i) r[i] = op(self[i], f)
1239 r.t = self.t
1240 } else {
1241 f = self.s & self.DM
1242 for (i = m; i < a.t; ++i) r[i] = op(f, a[i])
1243 r.t = a.t
1244 }
1245 r.s = op(self.s, a.s)
1246 r.clamp()
1247}
8645 1248
8646 // Return the length of the invalid excess 1249// (public) this & a
8647 // if we're just parsing 1250function op_and(x, y) {
8648 // Otherwise, throw an error or return tokens 1251 return x & y
8649 return parseOnly ? 1252}
8650 soFar.length :
8651 soFar ?
8652 Sizzle.error( selector ) :
8653 // Cache the tokens
8654 tokenCache( selector, groups ).slice( 0 );
8655};
8656 1253
8657function toSelector( tokens ) { 1254function bnAnd(a) {
8658 var i = 0, 1255 var r = new BigInteger()
8659 len = tokens.length, 1256 this.bitwiseTo(a, op_and, r)
8660 selector = ""; 1257 return r
8661 for ( ; i < len; i++ ) {
8662 selector += tokens[i].value;
8663 }
8664 return selector;
8665} 1258}
8666 1259
8667function addCombinator( matcher, combinator, base ) { 1260// (public) this | a
8668 var dir = combinator.dir, 1261function op_or(x, y) {
8669 checkNonElements = base && dir === "parentNode", 1262 return x | y
8670 doneName = done++; 1263}
8671 1264
8672 return combinator.first ? 1265function bnOr(a) {
8673 // Check against closest ancestor/preceding element 1266 var r = new BigInteger()
8674 function( elem, context, xml ) { 1267 this.bitwiseTo(a, op_or, r)
8675 while ( (elem = elem[ dir ]) ) { 1268 return r
8676 if ( elem.nodeType === 1 || checkNonElements ) {
8677 return matcher( elem, context, xml );
8678 }
8679 }
8680 } :
8681
8682 // Check against all ancestor/preceding elements
8683 function( elem, context, xml ) {
8684 var oldCache, outerCache,
8685 newCache = [ dirruns, doneName ];
8686
8687 // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
8688 if ( xml ) {
8689 while ( (elem = elem[ dir ]) ) {
8690 if ( elem.nodeType === 1 || checkNonElements ) {
8691 if ( matcher( elem, context, xml ) ) {
8692 return true;
8693 }
8694 }
8695 }
8696 } else {
8697 while ( (elem = elem[ dir ]) ) {
8698 if ( elem.nodeType === 1 || checkNonElements ) {
8699 outerCache = elem[ expando ] || (elem[ expando ] = {});
8700 if ( (oldCache = outerCache[ dir ]) &&
8701 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
8702
8703 // Assign to newCache so results back-propagate to previous elements
8704 return (newCache[ 2 ] = oldCache[ 2 ]);
8705 } else {
8706 // Reuse newcache so results back-propagate to previous elements
8707 outerCache[ dir ] = newCache;
8708
8709 // A match means we're done; a fail means we have to keep checking
8710 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
8711 return true;
8712 }
8713 }
8714 }
8715 }
8716 }
8717 };
8718} 1269}
8719 1270
8720function elementMatcher( matchers ) { 1271// (public) this ^ a
8721 return matchers.length > 1 ? 1272function op_xor(x, y) {
8722 function( elem, context, xml ) { 1273 return x ^ y
8723 var i = matchers.length;
8724 while ( i-- ) {
8725 if ( !matchers[i]( elem, context, xml ) ) {
8726 return false;
8727 }
8728 }
8729 return true;
8730 } :
8731 matchers[0];
8732} 1274}
8733 1275
8734function multipleContexts( selector, contexts, results ) { 1276function bnXor(a) {
8735 var i = 0, 1277 var r = new BigInteger()
8736 len = contexts.length; 1278 this.bitwiseTo(a, op_xor, r)
8737 for ( ; i < len; i++ ) { 1279 return r
8738 Sizzle( selector, contexts[i], results ); 1280}
8739 }
8740 return results;
8741}
8742
8743function condense( unmatched, map, filter, context, xml ) {
8744 var elem,
8745 newUnmatched = [],
8746 i = 0,
8747 len = unmatched.length,
8748 mapped = map != null;
8749
8750 for ( ; i < len; i++ ) {
8751 if ( (elem = unmatched[i]) ) {
8752 if ( !filter || filter( elem, context, xml ) ) {
8753 newUnmatched.push( elem );
8754 if ( mapped ) {
8755 map.push( i );
8756 }
8757 }
8758 }
8759 }
8760 1281
8761 return newUnmatched; 1282// (public) this & ~a
1283function op_andnot(x, y) {
1284 return x & ~y
8762} 1285}
8763 1286
8764function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 1287function bnAndNot(a) {
8765 if ( postFilter && !postFilter[ expando ] ) { 1288 var r = new BigInteger()
8766 postFilter = setMatcher( postFilter ); 1289 this.bitwiseTo(a, op_andnot, r)
8767 } 1290 return r
8768 if ( postFinder && !postFinder[ expando ] ) { 1291}
8769 postFinder = setMatcher( postFinder, postSelector );
8770 }
8771 return markFunction(function( seed, results, context, xml ) {
8772 var temp, i, elem,
8773 preMap = [],
8774 postMap = [],
8775 preexisting = results.length,
8776
8777 // Get initial elements from seed or context
8778 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
8779
8780 // Prefilter to get matcher input, preserving a map for seed-results synchronization
8781 matcherIn = preFilter && ( seed || !selector ) ?
8782 condense( elems, preMap, preFilter, context, xml ) :
8783 elems,
8784
8785 matcherOut = matcher ?
8786 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
8787 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
8788
8789 // ...intermediate processing is necessary
8790 [] :
8791
8792 // ...otherwise use results directly
8793 results :
8794 matcherIn;
8795
8796 // Find primary matches
8797 if ( matcher ) {
8798 matcher( matcherIn, matcherOut, context, xml );
8799 }
8800 1292
8801 // Apply postFilter 1293// (public) ~this
8802 if ( postFilter ) { 1294function bnNot() {
8803 temp = condense( matcherOut, postMap ); 1295 var r = new BigInteger()
8804 postFilter( temp, [], context, xml ); 1296 for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i]
8805 1297 r.t = this.t
8806 // Un-match failing elements by moving them back to matcherIn 1298 r.s = ~this.s
8807 i = temp.length; 1299 return r
8808 while ( i-- ) { 1300}
8809 if ( (elem = temp[i]) ) {
8810 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
8811 }
8812 }
8813 }
8814 1301
8815 if ( seed ) { 1302// (public) this << n
8816 if ( postFinder || preFilter ) { 1303function bnShiftLeft(n) {
8817 if ( postFinder ) { 1304 var r = new BigInteger()
8818 // Get the final matcherOut by condensing this intermediate into postFinder contexts 1305 if (n < 0) this.rShiftTo(-n, r)
8819 temp = []; 1306 else this.lShiftTo(n, r)
8820 i = matcherOut.length; 1307 return r
8821 while ( i-- ) { 1308}
8822 if ( (elem = matcherOut[i]) ) {
8823 // Restore matcherIn since elem is not yet a final match
8824 temp.push( (matcherIn[i] = elem) );
8825 }
8826 }
8827 postFinder( null, (matcherOut = []), temp, xml );
8828 }
8829
8830 // Move matched elements from seed to results to keep them synchronized
8831 i = matcherOut.length;
8832 while ( i-- ) {
8833 if ( (elem = matcherOut[i]) &&
8834 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
8835
8836 seed[temp] = !(results[temp] = elem);
8837 }
8838 }
8839 }
8840 1309
8841 // Add elements to results, through postFinder if defined 1310// (public) this >> n
8842 } else { 1311function bnShiftRight(n) {
8843 matcherOut = condense( 1312 var r = new BigInteger()
8844 matcherOut === results ? 1313 if (n < 0) this.lShiftTo(-n, r)
8845 matcherOut.splice( preexisting, matcherOut.length ) : 1314 else this.rShiftTo(n, r)
8846 matcherOut 1315 return r
8847 );
8848 if ( postFinder ) {
8849 postFinder( null, results, matcherOut, xml );
8850 } else {
8851 push.apply( results, matcherOut );
8852 }
8853 }
8854 });
8855} 1316}
8856 1317
8857function matcherFromTokens( tokens ) { 1318// return index of lowest 1-bit in x, x < 2^31
8858 var checkContext, matcher, j, 1319function lbit(x) {
8859 len = tokens.length, 1320 if (x == 0) return -1
8860 leadingRelative = Expr.relative[ tokens[0].type ], 1321 var r = 0
8861 implicitRelative = leadingRelative || Expr.relative[" "], 1322 if ((x & 0xffff) == 0) {
8862 i = leadingRelative ? 1 : 0, 1323 x >>= 16
8863 1324 r += 16
8864 // The foundational matcher ensures that elements are reachable from top-level context(s) 1325 }
8865 matchContext = addCombinator( function( elem ) { 1326 if ((x & 0xff) == 0) {
8866 return elem === checkContext; 1327 x >>= 8
8867 }, implicitRelative, true ), 1328 r += 8
8868 matchAnyContext = addCombinator( function( elem ) { 1329 }
8869 return indexOf.call( checkContext, elem ) > -1; 1330 if ((x & 0xf) == 0) {
8870 }, implicitRelative, true ), 1331 x >>= 4
8871 matchers = [ function( elem, context, xml ) { 1332 r += 4
8872 return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 1333 }
8873 (checkContext = context).nodeType ? 1334 if ((x & 3) == 0) {
8874 matchContext( elem, context, xml ) : 1335 x >>= 2
8875 matchAnyContext( elem, context, xml ) ); 1336 r += 2
8876 } ]; 1337 }
8877 1338 if ((x & 1) == 0)++r
8878 for ( ; i < len; i++ ) { 1339 return r
8879 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 1340}
8880 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
8881 } else {
8882 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
8883
8884 // Return special upon seeing a positional matcher
8885 if ( matcher[ expando ] ) {
8886 // Find the next relative operator (if any) for proper handling
8887 j = ++i;
8888 for ( ; j < len; j++ ) {
8889 if ( Expr.relative[ tokens[j].type ] ) {
8890 break;
8891 }
8892 }
8893 return setMatcher(
8894 i > 1 && elementMatcher( matchers ),
8895 i > 1 && toSelector(
8896 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
8897 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
8898 ).replace( rtrim, "$1" ),
8899 matcher,
8900 i < j && matcherFromTokens( tokens.slice( i, j ) ),
8901 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
8902 j < len && toSelector( tokens )
8903 );
8904 }
8905 matchers.push( matcher );
8906 }
8907 }
8908 1341
8909 return elementMatcher( matchers ); 1342// (public) returns index of lowest 1-bit (or -1 if none)
8910} 1343function bnGetLowestSetBit() {
8911 1344 for (var i = 0; i < this.t; ++i)
8912function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 1345 if (this[i] != 0) return i * this.DB + lbit(this[i])
8913 var bySet = setMatchers.length > 0, 1346 if (this.s < 0) return this.t * this.DB
8914 byElement = elementMatchers.length > 0, 1347 return -1
8915 superMatcher = function( seed, context, xml, results, outermost ) { 1348}
8916 var elem, j, matcher,
8917 matchedCount = 0,
8918 i = "0",
8919 unmatched = seed && [],
8920 setMatched = [],
8921 contextBackup = outermostContext,
8922 // We must always have either seed elements or outermost context
8923 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
8924 // Use integer dirruns iff this is the outermost matcher
8925 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
8926 len = elems.length;
8927
8928 if ( outermost ) {
8929 outermostContext = context !== document && context;
8930 }
8931 1349
8932 // Add elements passing elementMatchers directly to results 1350// return number of 1 bits in x
8933 // Keep `i` a string if there are no elements so `matchedCount` will be "00" below 1351function cbit(x) {
8934 // Support: IE<9, Safari 1352 var r = 0
8935 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 1353 while (x != 0) {
8936 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 1354 x &= x - 1
8937 if ( byElement && elem ) { 1355 ++r
8938 j = 0; 1356 }
8939 while ( (matcher = elementMatchers[j++]) ) { 1357 return r
8940 if ( matcher( elem, context, xml ) ) { 1358}
8941 results.push( elem );
8942 break;
8943 }
8944 }
8945 if ( outermost ) {
8946 dirruns = dirrunsUnique;
8947 }
8948 }
8949
8950 // Track unmatched elements for set filters
8951 if ( bySet ) {
8952 // They will have gone through all possible matchers
8953 if ( (elem = !matcher && elem) ) {
8954 matchedCount--;
8955 }
8956
8957 // Lengthen the array for every element, matched or not
8958 if ( seed ) {
8959 unmatched.push( elem );
8960 }
8961 }
8962 }
8963 1359
8964 // Apply set filters to unmatched elements 1360// (public) return number of set bits
8965 matchedCount += i; 1361function bnBitCount() {
8966 if ( bySet && i !== matchedCount ) { 1362 var r = 0,
8967 j = 0; 1363 x = this.s & this.DM
8968 while ( (matcher = setMatchers[j++]) ) { 1364 for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x)
8969 matcher( unmatched, setMatched, context, xml ); 1365 return r
8970 } 1366}
8971
8972 if ( seed ) {
8973 // Reintegrate element matches to eliminate the need for sorting
8974 if ( matchedCount > 0 ) {
8975 while ( i-- ) {
8976 if ( !(unmatched[i] || setMatched[i]) ) {
8977 setMatched[i] = pop.call( results );
8978 }
8979 }
8980 }
8981
8982 // Discard index placeholder values to get only actual matches
8983 setMatched = condense( setMatched );
8984 }
8985
8986 // Add matches to results
8987 push.apply( results, setMatched );
8988
8989 // Seedless set matches succeeding multiple successful matchers stipulate sorting
8990 if ( outermost && !seed && setMatched.length > 0 &&
8991 ( matchedCount + setMatchers.length ) > 1 ) {
8992
8993 Sizzle.uniqueSort( results );
8994 }
8995 }
8996 1367
8997 // Override manipulation of globals by nested matchers 1368// (public) true iff nth bit is set
8998 if ( outermost ) { 1369function bnTestBit(n) {
8999 dirruns = dirrunsUnique; 1370 var j = Math.floor(n / this.DB)
9000 outermostContext = contextBackup; 1371 if (j >= this.t) return (this.s != 0)
9001 } 1372 return ((this[j] & (1 << (n % this.DB))) != 0)
1373}
9002 1374
9003 return unmatched; 1375// (protected) this op (1<<n)
9004 }; 1376function bnpChangeBit(n, op) {
1377 var r = BigInteger.ONE.shiftLeft(n)
1378 this.bitwiseTo(r, op, r)
1379 return r
1380}
9005 1381
9006 return bySet ? 1382// (public) this | (1<<n)
9007 markFunction( superMatcher ) : 1383function bnSetBit(n) {
9008 superMatcher; 1384 return this.changeBit(n, op_or)
9009} 1385}
9010 1386
9011compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 1387// (public) this & ~(1<<n)
9012 var i, 1388function bnClearBit(n) {
9013 setMatchers = [], 1389 return this.changeBit(n, op_andnot)
9014 elementMatchers = [], 1390}
9015 cached = compilerCache[ selector + " " ];
9016 1391
9017 if ( !cached ) { 1392// (public) this ^ (1<<n)
9018 // Generate a function of recursive functions that can be used to check each element 1393function bnFlipBit(n) {
9019 if ( !match ) { 1394 return this.changeBit(n, op_xor)
9020 match = tokenize( selector ); 1395}
9021 }
9022 i = match.length;
9023 while ( i-- ) {
9024 cached = matcherFromTokens( match[i] );
9025 if ( cached[ expando ] ) {
9026 setMatchers.push( cached );
9027 } else {
9028 elementMatchers.push( cached );
9029 }
9030 }
9031 1396
9032 // Cache the compiled function 1397// (protected) r = this + a
9033 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 1398function bnpAddTo(a, r) {
1399 var self = this
9034 1400
9035 // Save selector and tokenization 1401 var i = 0,
9036 cached.selector = selector; 1402 c = 0,
1403 m = Math.min(a.t, self.t)
1404 while (i < m) {
1405 c += self[i] + a[i]
1406 r[i++] = c & self.DM
1407 c >>= self.DB
1408 }
1409 if (a.t < self.t) {
1410 c += a.s
1411 while (i < self.t) {
1412 c += self[i]
1413 r[i++] = c & self.DM
1414 c >>= self.DB
1415 }
1416 c += self.s
1417 } else {
1418 c += self.s
1419 while (i < a.t) {
1420 c += a[i]
1421 r[i++] = c & self.DM
1422 c >>= self.DB
9037 } 1423 }
9038 return cached; 1424 c += a.s
9039}; 1425 }
9040 1426 r.s = (c < 0) ? -1 : 0
9041/** 1427 if (c > 0) r[i++] = c
9042 * A low-level selection function that works with Sizzle's compiled 1428 else if (c < -1) r[i++] = self.DV + c
9043 * selector functions 1429 r.t = i
9044 * @param {String|Function} selector A selector or a pre-compiled 1430 r.clamp()
9045 * selector function built with Sizzle.compile 1431}
9046 * @param {Element} context
9047 * @param {Array} [results]
9048 * @param {Array} [seed] A set of elements to match against
9049 */
9050select = Sizzle.select = function( selector, context, results, seed ) {
9051 var i, tokens, token, type, find,
9052 compiled = typeof selector === "function" && selector,
9053 match = !seed && tokenize( (selector = compiled.selector || selector) );
9054
9055 results = results || [];
9056
9057 // Try to minimize operations if there is no seed and only one group
9058 if ( match.length === 1 ) {
9059
9060 // Take a shortcut and set the context if the root selector is an ID
9061 tokens = match[0] = match[0].slice( 0 );
9062 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
9063 support.getById && context.nodeType === 9 && documentIsHTML &&
9064 Expr.relative[ tokens[1].type ] ) {
9065
9066 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
9067 if ( !context ) {
9068 return results;
9069 1432
9070 // Precompiled matchers will still verify ancestry, so step up a level 1433// (public) this + a
9071 } else if ( compiled ) { 1434function bnAdd(a) {
9072 context = context.parentNode; 1435 var r = new BigInteger()
9073 } 1436 this.addTo(a, r)
1437 return r
1438}
9074 1439
9075 selector = selector.slice( tokens.shift().value.length ); 1440// (public) this - a
9076 } 1441function bnSubtract(a) {
1442 var r = new BigInteger()
1443 this.subTo(a, r)
1444 return r
1445}
9077 1446
9078 // Fetch a seed set for right-to-left matching 1447// (public) this * a
9079 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 1448function bnMultiply(a) {
9080 while ( i-- ) { 1449 var r = new BigInteger()
9081 token = tokens[i]; 1450 this.multiplyTo(a, r)
1451 return r
1452}
9082 1453
9083 // Abort if we hit a combinator 1454// (public) this^2
9084 if ( Expr.relative[ (type = token.type) ] ) { 1455function bnSquare() {
9085 break; 1456 var r = new BigInteger()
9086 } 1457 this.squareTo(r)
9087 if ( (find = Expr.find[ type ]) ) { 1458 return r
9088 // Search, expanding context for leading sibling combinators 1459}
9089 if ( (seed = find(
9090 token.matches[0].replace( runescape, funescape ),
9091 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
9092 )) ) {
9093
9094 // If seed is empty or no tokens remain, we can return early
9095 tokens.splice( i, 1 );
9096 selector = seed.length && toSelector( tokens );
9097 if ( !selector ) {
9098 push.apply( results, seed );
9099 return results;
9100 }
9101
9102 break;
9103 }
9104 }
9105 }
9106 }
9107 1460
9108 // Compile and execute a filtering function if one is not provided 1461// (public) this / a
9109 // Provide `match` to avoid retokenization if we modified the selector above 1462function bnDivide(a) {
9110 ( compiled || compile( selector, match ) )( 1463 var r = new BigInteger()
9111 seed, 1464 this.divRemTo(a, r, null)
9112 context, 1465 return r
9113 !documentIsHTML, 1466}
9114 results,
9115 rsibling.test( selector ) && testContext( context.parentNode ) || context
9116 );
9117 return results;
9118};
9119 1467
9120// One-time assignments 1468// (public) this % a
1469function bnRemainder(a) {
1470 var r = new BigInteger()
1471 this.divRemTo(a, null, r)
1472 return r
1473}
9121 1474
9122// Sort stability 1475// (public) [this/a,this%a]
9123support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 1476function bnDivideAndRemainder(a) {
1477 var q = new BigInteger(),
1478 r = new BigInteger()
1479 this.divRemTo(a, q, r)
1480 return new Array(q, r)
1481}
9124 1482
9125// Support: Chrome<14 1483// (protected) this *= n, this >= 0, 1 < n < DV
9126// Always assume duplicates if they aren't passed to the comparison function 1484function bnpDMultiply(n) {
9127support.detectDuplicates = !!hasDuplicate; 1485 this[this.t] = this.am(0, n - 1, this, 0, 0, this.t)
1486 ++this.t
1487 this.clamp()
1488}
9128 1489
9129// Initialize against the default document 1490// (protected) this += n << w words, this >= 0
9130setDocument(); 1491function bnpDAddOffset(n, w) {
1492 if (n == 0) return
1493 while (this.t <= w) this[this.t++] = 0
1494 this[w] += n
1495 while (this[w] >= this.DV) {
1496 this[w] -= this.DV
1497 if (++w >= this.t) this[this.t++] = 0
1498 ++this[w]
1499 }
1500}
9131 1501
9132// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 1502// A "null" reducer
9133// Detached nodes confoundingly follow *each other* 1503function NullExp() {}
9134support.sortDetached = assert(function( div1 ) {
9135 // Should return 1, but returns 4 (following)
9136 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
9137});
9138 1504
9139// Support: IE<8 1505function nNop(x) {
9140// Prevent attribute/property "interpolation" 1506 return x
9141// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
9142if ( !assert(function( div ) {
9143 div.innerHTML = "<a href='#'></a>";
9144 return div.firstChild.getAttribute("href") === "#" ;
9145}) ) {
9146 addHandle( "type|href|height|width", function( elem, name, isXML ) {
9147 if ( !isXML ) {
9148 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
9149 }
9150 });
9151} 1507}
9152 1508
9153// Support: IE<9 1509function nMulTo(x, y, r) {
9154// Use defaultValue in place of getAttribute("value") 1510 x.multiplyTo(y, r)
9155if ( !support.attributes || !assert(function( div ) {
9156 div.innerHTML = "<input/>";
9157 div.firstChild.setAttribute( "value", "" );
9158 return div.firstChild.getAttribute( "value" ) === "";
9159}) ) {
9160 addHandle( "value", function( elem, name, isXML ) {
9161 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
9162 return elem.defaultValue;
9163 }
9164 });
9165} 1511}
9166 1512
9167// Support: IE<9 1513function nSqrTo(x, r) {
9168// Use getAttributeNode to fetch booleans when getAttribute lies 1514 x.squareTo(r)
9169if ( !assert(function( div ) {
9170 return div.getAttribute("disabled") == null;
9171}) ) {
9172 addHandle( booleans, function( elem, name, isXML ) {
9173 var val;
9174 if ( !isXML ) {
9175 return elem[ name ] === true ? name.toLowerCase() :
9176 (val = elem.getAttributeNode( name )) && val.specified ?
9177 val.value :
9178 null;
9179 }
9180 });
9181} 1515}
9182 1516
9183return Sizzle; 1517NullExp.prototype.convert = nNop
9184 1518NullExp.prototype.revert = nNop
9185})( window ); 1519NullExp.prototype.mulTo = nMulTo
1520NullExp.prototype.sqrTo = nSqrTo
9186 1521
1522// (public) this^e
1523function bnPow(e) {
1524 return this.exp(e, new NullExp())
1525}
9187 1526
1527// (protected) r = lower n words of "this * a", a.t <= n
1528// "this" should be the larger one if appropriate.
1529function bnpMultiplyLowerTo(a, n, r) {
1530 var i = Math.min(this.t + a.t, n)
1531 r.s = 0; // assumes a,this >= 0
1532 r.t = i
1533 while (i > 0) r[--i] = 0
1534 var j
1535 for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t)
1536 for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i)
1537 r.clamp()
1538}
9188 1539
9189jQuery.find = Sizzle; 1540// (protected) r = "this * a" without lower n words, n > 0
9190jQuery.expr = Sizzle.selectors; 1541// "this" should be the larger one if appropriate.
9191jQuery.expr[":"] = jQuery.expr.pseudos; 1542function bnpMultiplyUpperTo(a, n, r) {
9192jQuery.unique = Sizzle.uniqueSort; 1543 --n
9193jQuery.text = Sizzle.getText; 1544 var i = r.t = this.t + a.t - n
9194jQuery.isXMLDoc = Sizzle.isXML; 1545 r.s = 0; // assumes a,this >= 0
9195jQuery.contains = Sizzle.contains; 1546 while (--i >= 0) r[i] = 0
1547 for (i = Math.max(n - this.t, 0); i < a.t; ++i)
1548 r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n)
1549 r.clamp()
1550 r.drShiftTo(1, r)
1551}
9196 1552
1553// Barrett modular reduction
1554function Barrett(m) {
1555 // setup Barrett
1556 this.r2 = new BigInteger()
1557 this.q3 = new BigInteger()
1558 BigInteger.ONE.dlShiftTo(2 * m.t, this.r2)
1559 this.mu = this.r2.divide(m)
1560 this.m = m
1561}
9197 1562
1563function barrettConvert(x) {
1564 if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m)
1565 else if (x.compareTo(this.m) < 0) return x
1566 else {
1567 var r = new BigInteger()
1568 x.copyTo(r)
1569 this.reduce(r)
1570 return r
1571 }
1572}
9198 1573
9199var rneedsContext = jQuery.expr.match.needsContext; 1574function barrettRevert(x) {
1575 return x
1576}
9200 1577
9201var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); 1578// x = x mod m (HAC 14.42)
1579function barrettReduce(x) {
1580 var self = this
1581 x.drShiftTo(self.m.t - 1, self.r2)
1582 if (x.t > self.m.t + 1) {
1583 x.t = self.m.t + 1
1584 x.clamp()
1585 }
1586 self.mu.multiplyUpperTo(self.r2, self.m.t + 1, self.q3)
1587 self.m.multiplyLowerTo(self.q3, self.m.t + 1, self.r2)
1588 while (x.compareTo(self.r2) < 0) x.dAddOffset(1, self.m.t + 1)
1589 x.subTo(self.r2, x)
1590 while (x.compareTo(self.m) >= 0) x.subTo(self.m, x)
1591}
9202 1592
1593// r = x^2 mod m; x != r
1594function barrettSqrTo(x, r) {
1595 x.squareTo(r)
1596 this.reduce(r)
1597}
9203 1598
1599// r = x*y mod m; x,y != r
1600function barrettMulTo(x, y, r) {
1601 x.multiplyTo(y, r)
1602 this.reduce(r)
1603}
9204 1604
9205var risSimple = /^.[^:#\[\.,]*$/; 1605Barrett.prototype.convert = barrettConvert
1606Barrett.prototype.revert = barrettRevert
1607Barrett.prototype.reduce = barrettReduce
1608Barrett.prototype.mulTo = barrettMulTo
1609Barrett.prototype.sqrTo = barrettSqrTo
9206 1610
9207// Implement the identical functionality for filter and not 1611// (public) this^e % m (HAC 14.85)
9208function winnow( elements, qualifier, not ) { 1612function bnModPow(e, m) {
9209 if ( jQuery.isFunction( qualifier ) ) { 1613 var i = e.bitLength(),
9210 return jQuery.grep( elements, function( elem, i ) { 1614 k, r = nbv(1),
9211 /* jshint -W018 */ 1615 z
9212 return !!qualifier.call( elem, i, elem ) !== not; 1616 if (i <= 0) return r
9213 }); 1617 else if (i < 18) k = 1
1618 else if (i < 48) k = 3
1619 else if (i < 144) k = 4
1620 else if (i < 768) k = 5
1621 else k = 6
1622 if (i < 8)
1623 z = new Classic(m)
1624 else if (m.isEven())
1625 z = new Barrett(m)
1626 else
1627 z = new Montgomery(m)
9214 1628
1629 // precomputation
1630 var g = new Array(),
1631 n = 3,
1632 k1 = k - 1,
1633 km = (1 << k) - 1
1634 g[1] = z.convert(this)
1635 if (k > 1) {
1636 var g2 = new BigInteger()
1637 z.sqrTo(g[1], g2)
1638 while (n <= km) {
1639 g[n] = new BigInteger()
1640 z.mulTo(g2, g[n - 2], g[n])
1641 n += 2
1642 }
1643 }
1644
1645 var j = e.t - 1,
1646 w, is1 = true,
1647 r2 = new BigInteger(),
1648 t
1649 i = nbits(e[j]) - 1
1650 while (j >= 0) {
1651 if (i >= k1) w = (e[j] >> (i - k1)) & km
1652 else {
1653 w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i)
1654 if (j > 0) w |= e[j - 1] >> (this.DB + i - k1)
9215 } 1655 }
9216 1656
9217 if ( qualifier.nodeType ) { 1657 n = k
9218 return jQuery.grep( elements, function( elem ) { 1658 while ((w & 1) == 0) {
9219 return ( elem === qualifier ) !== not; 1659 w >>= 1
9220 }); 1660 --n
9221
9222 } 1661 }
9223 1662 if ((i -= n) < 0) {
9224 if ( typeof qualifier === "string" ) { 1663 i += this.DB
9225 if ( risSimple.test( qualifier ) ) { 1664 --j
9226 return jQuery.filter( qualifier, elements, not );
9227 }
9228
9229 qualifier = jQuery.filter( qualifier, elements );
9230 } 1665 }
9231 1666 if (is1) { // ret == 1, don't bother squaring or multiplying it
9232 return jQuery.grep( elements, function( elem ) { 1667 g[w].copyTo(r)
9233 return ( indexOf.call( qualifier, elem ) >= 0 ) !== not; 1668 is1 = false
9234 }); 1669 } else {
9235} 1670 while (n > 1) {
9236 1671 z.sqrTo(r, r2)
9237jQuery.filter = function( expr, elems, not ) { 1672 z.sqrTo(r2, r)
9238 var elem = elems[ 0 ]; 1673 n -= 2
9239 1674 }
9240 if ( not ) { 1675 if (n > 0) z.sqrTo(r, r2)
9241 expr = ":not(" + expr + ")"; 1676 else {
1677 t = r
1678 r = r2
1679 r2 = t
1680 }
1681 z.mulTo(r2, g[w], r)
9242 } 1682 }
9243 1683
9244 return elems.length === 1 && elem.nodeType === 1 ? 1684 while (j >= 0 && (e[j] & (1 << i)) == 0) {
9245 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : 1685 z.sqrTo(r, r2)
9246 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 1686 t = r
9247 return elem.nodeType === 1; 1687 r = r2
9248 })); 1688 r2 = t
9249}; 1689 if (--i < 0) {
9250 1690 i = this.DB - 1
9251jQuery.fn.extend({ 1691 --j
9252 find: function( selector ) { 1692 }
9253 var i,
9254 len = this.length,
9255 ret = [],
9256 self = this;
9257
9258 if ( typeof selector !== "string" ) {
9259 return this.pushStack( jQuery( selector ).filter(function() {
9260 for ( i = 0; i < len; i++ ) {
9261 if ( jQuery.contains( self[ i ], this ) ) {
9262 return true;
9263 }
9264 }
9265 }) );
9266 }
9267
9268 for ( i = 0; i < len; i++ ) {
9269 jQuery.find( selector, self[ i ], ret );
9270 }
9271
9272 // Needed because $( selector, context ) becomes $( context ).find( selector )
9273 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
9274 ret.selector = this.selector ? this.selector + " " + selector : selector;
9275 return ret;
9276 },
9277 filter: function( selector ) {
9278 return this.pushStack( winnow(this, selector || [], false) );
9279 },
9280 not: function( selector ) {
9281 return this.pushStack( winnow(this, selector || [], true) );
9282 },
9283 is: function( selector ) {
9284 return !!winnow(
9285 this,
9286
9287 // If this is a positional/relative selector, check membership in the returned set
9288 // so $("p:first").is("p:last") won't return true for a doc with two "p".
9289 typeof selector === "string" && rneedsContext.test( selector ) ?
9290 jQuery( selector ) :
9291 selector || [],
9292 false
9293 ).length;
9294 } 1693 }
9295}); 1694 }
9296 1695 return z.revert(r)
9297 1696}
9298// Initialize a jQuery object
9299
9300
9301// A central reference to the root jQuery(document)
9302var rootjQuery,
9303
9304 // A simple way to check for HTML strings
9305 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
9306 // Strict HTML recognition (#11290: must start with <)
9307 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
9308
9309 init = jQuery.fn.init = function( selector, context ) {
9310 var match, elem;
9311
9312 // HANDLE: $(""), $(null), $(undefined), $(false)
9313 if ( !selector ) {
9314 return this;
9315 }
9316
9317 // Handle HTML strings
9318 if ( typeof selector === "string" ) {
9319 if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) {
9320 // Assume that strings that start and end with <> are HTML and skip the regex check
9321 match = [ null, selector, null ];
9322
9323 } else {
9324 match = rquickExpr.exec( selector );
9325 }
9326
9327 // Match html or make sure no context is specified for #id
9328 if ( match && (match[1] || !context) ) {
9329
9330 // HANDLE: $(html) -> $(array)
9331 if ( match[1] ) {
9332 context = context instanceof jQuery ? context[0] : context;
9333
9334 // scripts is true for back-compat
9335 // Intentionally let the error be thrown if parseHTML is not present
9336 jQuery.merge( this, jQuery.parseHTML(
9337 match[1],
9338 context && context.nodeType ? context.ownerDocument || context : document,
9339 true
9340 ) );
9341
9342 // HANDLE: $(html, props)
9343 if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
9344 for ( match in context ) {
9345 // Properties of context are called as methods if possible
9346 if ( jQuery.isFunction( this[ match ] ) ) {
9347 this[ match ]( context[ match ] );
9348
9349 // ...and otherwise set as attributes
9350 } else {
9351 this.attr( match, context[ match ] );
9352 }
9353 }
9354 }
9355
9356 return this;
9357
9358 // HANDLE: $(#id)
9359 } else {
9360 elem = document.getElementById( match[2] );
9361
9362 // Check parentNode to catch when Blackberry 4.6 returns
9363 // nodes that are no longer in the document #6963
9364 if ( elem && elem.parentNode ) {
9365 // Inject the element directly into the jQuery object
9366 this.length = 1;
9367 this[0] = elem;
9368 }
9369
9370 this.context = document;
9371 this.selector = selector;
9372 return this;
9373 }
9374
9375 // HANDLE: $(expr, $(...))
9376 } else if ( !context || context.jquery ) {
9377 return ( context || rootjQuery ).find( selector );
9378
9379 // HANDLE: $(expr, context)
9380 // (which is just equivalent to: $(context).find(expr)
9381 } else {
9382 return this.constructor( context ).find( selector );
9383 }
9384
9385 // HANDLE: $(DOMElement)
9386 } else if ( selector.nodeType ) {
9387 this.context = this[0] = selector;
9388 this.length = 1;
9389 return this;
9390
9391 // HANDLE: $(function)
9392 // Shortcut for document ready
9393 } else if ( jQuery.isFunction( selector ) ) {
9394 return typeof rootjQuery.ready !== "undefined" ?
9395 rootjQuery.ready( selector ) :
9396 // Execute immediately if ready is not present
9397 selector( jQuery );
9398 }
9399
9400 if ( selector.selector !== undefined ) {
9401 this.selector = selector.selector;
9402 this.context = selector.context;
9403 }
9404
9405 return jQuery.makeArray( selector, this );
9406 };
9407
9408// Give the init function the jQuery prototype for later instantiation
9409init.prototype = jQuery.fn;
9410
9411// Initialize central reference
9412rootjQuery = jQuery( document );
9413
9414
9415var rparentsprev = /^(?:parents|prev(?:Until|All))/,
9416 // methods guaranteed to produce a unique set when starting from a unique set
9417 guaranteedUnique = {
9418 children: true,
9419 contents: true,
9420 next: true,
9421 prev: true
9422 };
9423
9424jQuery.extend({
9425 dir: function( elem, dir, until ) {
9426 var matched = [],
9427 truncate = until !== undefined;
9428
9429 while ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {
9430 if ( elem.nodeType === 1 ) {
9431 if ( truncate && jQuery( elem ).is( until ) ) {
9432 break;
9433 }
9434 matched.push( elem );
9435 }
9436 }
9437 return matched;
9438 },
9439
9440 sibling: function( n, elem ) {
9441 var matched = [];
9442
9443 for ( ; n; n = n.nextSibling ) {
9444 if ( n.nodeType === 1 && n !== elem ) {
9445 matched.push( n );
9446 }
9447 }
9448 1697
9449 return matched; 1698// (public) gcd(this,a) (HAC 14.54)
1699function bnGCD(a) {
1700 var x = (this.s < 0) ? this.negate() : this.clone()
1701 var y = (a.s < 0) ? a.negate() : a.clone()
1702 if (x.compareTo(y) < 0) {
1703 var t = x
1704 x = y
1705 y = t
1706 }
1707 var i = x.getLowestSetBit(),
1708 g = y.getLowestSetBit()
1709 if (g < 0) return x
1710 if (i < g) g = i
1711 if (g > 0) {
1712 x.rShiftTo(g, x)
1713 y.rShiftTo(g, y)
1714 }
1715 while (x.signum() > 0) {
1716 if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x)
1717 if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y)
1718 if (x.compareTo(y) >= 0) {
1719 x.subTo(y, x)
1720 x.rShiftTo(1, x)
1721 } else {
1722 y.subTo(x, y)
1723 y.rShiftTo(1, y)
9450 } 1724 }
9451}); 1725 }
9452 1726 if (g > 0) y.lShiftTo(g, y)
9453jQuery.fn.extend({ 1727 return y
9454 has: function( target ) { 1728}
9455 var targets = jQuery( target, this ),
9456 l = targets.length;
9457
9458 return this.filter(function() {
9459 var i = 0;
9460 for ( ; i < l; i++ ) {
9461 if ( jQuery.contains( this, targets[i] ) ) {
9462 return true;
9463 }
9464 }
9465 });
9466 },
9467
9468 closest: function( selectors, context ) {
9469 var cur,
9470 i = 0,
9471 l = this.length,
9472 matched = [],
9473 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
9474 jQuery( selectors, context || this.context ) :
9475 0;
9476
9477 for ( ; i < l; i++ ) {
9478 for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
9479 // Always skip document fragments
9480 if ( cur.nodeType < 11 && (pos ?
9481 pos.index(cur) > -1 :
9482
9483 // Don't pass non-elements to Sizzle
9484 cur.nodeType === 1 &&
9485 jQuery.find.matchesSelector(cur, selectors)) ) {
9486
9487 matched.push( cur );
9488 break;
9489 }
9490 }
9491 }
9492
9493 return this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );
9494 },
9495
9496 // Determine the position of an element within
9497 // the matched set of elements
9498 index: function( elem ) {
9499
9500 // No argument, return index in parent
9501 if ( !elem ) {
9502 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
9503 }
9504
9505 // index in selector
9506 if ( typeof elem === "string" ) {
9507 return indexOf.call( jQuery( elem ), this[ 0 ] );
9508 }
9509
9510 // Locate the position of the desired element
9511 return indexOf.call( this,
9512
9513 // If it receives a jQuery object, the first element is used
9514 elem.jquery ? elem[ 0 ] : elem
9515 );
9516 },
9517 1729
9518 add: function( selector, context ) { 1730// (protected) this % n, n < 2^26
9519 return this.pushStack( 1731function bnpModInt(n) {
9520 jQuery.unique( 1732 if (n <= 0) return 0
9521 jQuery.merge( this.get(), jQuery( selector, context ) ) 1733 var d = this.DV % n,
9522 ) 1734 r = (this.s < 0) ? n - 1 : 0
9523 ); 1735 if (this.t > 0)
9524 }, 1736 if (d == 0) r = this[0] % n
1737 else
1738 for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n
1739 return r
1740}
9525 1741
9526 addBack: function( selector ) { 1742// (public) 1/this % m (HAC 14.61)
9527 return this.add( selector == null ? 1743function bnModInverse(m) {
9528 this.prevObject : this.prevObject.filter(selector) 1744 var ac = m.isEven()
9529 ); 1745 if ((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO
1746 var u = m.clone(),
1747 v = this.clone()
1748 var a = nbv(1),
1749 b = nbv(0),
1750 c = nbv(0),
1751 d = nbv(1)
1752 while (u.signum() != 0) {
1753 while (u.isEven()) {
1754 u.rShiftTo(1, u)
1755 if (ac) {
1756 if (!a.isEven() || !b.isEven()) {
1757 a.addTo(this, a)
1758 b.subTo(m, b)
1759 }
1760 a.rShiftTo(1, a)
1761 } else if (!b.isEven()) b.subTo(m, b)
1762 b.rShiftTo(1, b)
1763 }
1764 while (v.isEven()) {
1765 v.rShiftTo(1, v)
1766 if (ac) {
1767 if (!c.isEven() || !d.isEven()) {
1768 c.addTo(this, c)
1769 d.subTo(m, d)
1770 }
1771 c.rShiftTo(1, c)
1772 } else if (!d.isEven()) d.subTo(m, d)
1773 d.rShiftTo(1, d)
1774 }
1775 if (u.compareTo(v) >= 0) {
1776 u.subTo(v, u)
1777 if (ac) a.subTo(c, a)
1778 b.subTo(d, b)
1779 } else {
1780 v.subTo(u, v)
1781 if (ac) c.subTo(a, c)
1782 d.subTo(b, d)
1783 }
1784 }
1785 if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO
1786 if (d.compareTo(m) >= 0) return d.subtract(m)
1787 if (d.signum() < 0) d.addTo(m, d)
1788 else return d
1789 if (d.signum() < 0) return d.add(m)
1790 else return d
1791}
1792
1793var lowprimes = [
1794 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
1795 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
1796 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
1797 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
1798 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,
1799 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
1800 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,
1801 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
1802 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,
1803 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
1804 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997
1805]
1806
1807var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]
1808
1809// (public) test primality with certainty >= 1-.5^t
1810function bnIsProbablePrime(t) {
1811 var i, x = this.abs()
1812 if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) {
1813 for (i = 0; i < lowprimes.length; ++i)
1814 if (x[0] == lowprimes[i]) return true
1815 return false
1816 }
1817 if (x.isEven()) return false
1818 i = 1
1819 while (i < lowprimes.length) {
1820 var m = lowprimes[i],
1821 j = i + 1
1822 while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]
1823 m = x.modInt(m)
1824 while (i < j) if (m % lowprimes[i++] == 0) return false
1825 }
1826 return x.millerRabin(t)
1827}
1828
1829// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
1830function bnpMillerRabin(t) {
1831 var n1 = this.subtract(BigInteger.ONE)
1832 var k = n1.getLowestSetBit()
1833 if (k <= 0) return false
1834 var r = n1.shiftRight(k)
1835 t = (t + 1) >> 1
1836 if (t > lowprimes.length) t = lowprimes.length
1837 var a = new BigInteger(null)
1838 var j, bases = []
1839 for (var i = 0; i < t; ++i) {
1840 for (;;) {
1841 j = lowprimes[Math.floor(Math.random() * lowprimes.length)]
1842 if (bases.indexOf(j) == -1) break
1843 }
1844 bases.push(j)
1845 a.fromInt(j)
1846 var y = a.modPow(r, this)
1847 if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
1848 var j = 1
1849 while (j++ < k && y.compareTo(n1) != 0) {
1850 y = y.modPowInt(2, this)
1851 if (y.compareTo(BigInteger.ONE) == 0) return false
1852 }
1853 if (y.compareTo(n1) != 0) return false
9530 } 1854 }
9531}); 1855 }
9532 1856 return true
9533function sibling( cur, dir ) {
9534 while ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}
9535 return cur;
9536} 1857}
9537 1858
9538jQuery.each({ 1859// protected
9539 parent: function( elem ) { 1860proto.chunkSize = bnpChunkSize
9540 var parent = elem.parentNode; 1861proto.toRadix = bnpToRadix
9541 return parent && parent.nodeType !== 11 ? parent : null; 1862proto.fromRadix = bnpFromRadix
9542 }, 1863proto.fromNumber = bnpFromNumber
9543 parents: function( elem ) { 1864proto.bitwiseTo = bnpBitwiseTo
9544 return jQuery.dir( elem, "parentNode" ); 1865proto.changeBit = bnpChangeBit
9545 }, 1866proto.addTo = bnpAddTo
9546 parentsUntil: function( elem, i, until ) { 1867proto.dMultiply = bnpDMultiply
9547 return jQuery.dir( elem, "parentNode", until ); 1868proto.dAddOffset = bnpDAddOffset
9548 }, 1869proto.multiplyLowerTo = bnpMultiplyLowerTo
9549 next: function( elem ) { 1870proto.multiplyUpperTo = bnpMultiplyUpperTo
9550 return sibling( elem, "nextSibling" ); 1871proto.modInt = bnpModInt
9551 }, 1872proto.millerRabin = bnpMillerRabin
9552 prev: function( elem ) {
9553 return sibling( elem, "previousSibling" );
9554 },
9555 nextAll: function( elem ) {
9556 return jQuery.dir( elem, "nextSibling" );
9557 },
9558 prevAll: function( elem ) {
9559 return jQuery.dir( elem, "previousSibling" );
9560 },
9561 nextUntil: function( elem, i, until ) {
9562 return jQuery.dir( elem, "nextSibling", until );
9563 },
9564 prevUntil: function( elem, i, until ) {
9565 return jQuery.dir( elem, "previousSibling", until );
9566 },
9567 siblings: function( elem ) {
9568 return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
9569 },
9570 children: function( elem ) {
9571 return jQuery.sibling( elem.firstChild );
9572 },
9573 contents: function( elem ) {
9574 return elem.contentDocument || jQuery.merge( [], elem.childNodes );
9575 }
9576}, function( name, fn ) {
9577 jQuery.fn[ name ] = function( until, selector ) {
9578 var matched = jQuery.map( this, fn, until );
9579 1873
9580 if ( name.slice( -5 ) !== "Until" ) { 1874// public
9581 selector = until; 1875proto.clone = bnClone
9582 } 1876proto.intValue = bnIntValue
1877proto.byteValue = bnByteValue
1878proto.shortValue = bnShortValue
1879proto.signum = bnSigNum
1880proto.toByteArray = bnToByteArray
1881proto.equals = bnEquals
1882proto.min = bnMin
1883proto.max = bnMax
1884proto.and = bnAnd
1885proto.or = bnOr
1886proto.xor = bnXor
1887proto.andNot = bnAndNot
1888proto.not = bnNot
1889proto.shiftLeft = bnShiftLeft
1890proto.shiftRight = bnShiftRight
1891proto.getLowestSetBit = bnGetLowestSetBit
1892proto.bitCount = bnBitCount
1893proto.testBit = bnTestBit
1894proto.setBit = bnSetBit
1895proto.clearBit = bnClearBit
1896proto.flipBit = bnFlipBit
1897proto.add = bnAdd
1898proto.subtract = bnSubtract
1899proto.multiply = bnMultiply
1900proto.divide = bnDivide
1901proto.remainder = bnRemainder
1902proto.divideAndRemainder = bnDivideAndRemainder
1903proto.modPow = bnModPow
1904proto.modInverse = bnModInverse
1905proto.pow = bnPow
1906proto.gcd = bnGCD
1907proto.isProbablePrime = bnIsProbablePrime
9583 1908
9584 if ( selector && typeof selector === "string" ) { 1909// JSBN-specific extension
9585 matched = jQuery.filter( selector, matched ); 1910proto.square = bnSquare
9586 }
9587 1911
9588 if ( this.length > 1 ) { 1912// constants
9589 // Remove duplicates 1913BigInteger.ZERO = nbv(0)
9590 if ( !guaranteedUnique[ name ] ) { 1914BigInteger.ONE = nbv(1)
9591 jQuery.unique( matched ); 1915BigInteger.valueOf = nbv
9592 }
9593 1916
9594 // Reverse order for parents* and prev-derivatives 1917module.exports = BigInteger
9595 if ( rparentsprev.test( name ) ) {
9596 matched.reverse();
9597 }
9598 }
9599 1918
9600 return this.pushStack( matched ); 1919},{"../package.json":4}],2:[function(require,module,exports){
9601 }; 1920(function (Buffer){
9602}); 1921// FIXME: Kind of a weird way to throw exceptions, consider removing
9603var rnotwhite = (/\S+/g); 1922var assert = require('assert')
1923var BigInteger = require('./bigi')
9604 1924
1925/**
1926 * Turns a byte array into a big integer.
1927 *
1928 * This function will interpret a byte array as a big integer in big
1929 * endian notation.
1930 */
1931BigInteger.fromByteArrayUnsigned = function(byteArray) {
1932 // BigInteger expects a DER integer conformant byte array
1933 if (byteArray[0] & 0x80) {
1934 return new BigInteger([0].concat(byteArray))
1935 }
9605 1936
1937 return new BigInteger(byteArray)
1938}
9606 1939
9607// String to Object options format cache 1940/**
9608var optionsCache = {}; 1941 * Returns a byte array representation of the big integer.
1942 *
1943 * This returns the absolute of the contained value in big endian
1944 * form. A value of zero results in an empty array.
1945 */
1946BigInteger.prototype.toByteArrayUnsigned = function() {
1947 var byteArray = this.toByteArray()
1948 return byteArray[0] === 0 ? byteArray.slice(1) : byteArray
1949}
9609 1950
9610// Convert String-formatted options into Object-formatted ones and store in cache 1951BigInteger.fromDERInteger = function(byteArray) {
9611function createOptions( options ) { 1952 return new BigInteger(byteArray)
9612 var object = optionsCache[ options ] = {};
9613 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {
9614 object[ flag ] = true;
9615 });
9616 return object;
9617} 1953}
9618 1954
9619/* 1955/*
9620 * Create a callback list using the following parameters: 1956 * Converts BigInteger to a DER integer representation.
9621 *
9622 * options: an optional list of space-separated options that will change how
9623 * the callback list behaves or a more traditional option object
9624 *
9625 * By default a callback list will act like an event callback list and can be
9626 * "fired" multiple times.
9627 *
9628 * Possible options:
9629 *
9630 * once: will ensure the callback list can only be fired once (like a Deferred)
9631 *
9632 * memory: will keep track of previous values and will call any callback added
9633 * after the list has been fired right away with the latest "memorized"
9634 * values (like a Deferred)
9635 * 1957 *
9636 * unique: will ensure a callback can only be added once (no duplicate in the list) 1958 * The format for this value uses the most significant bit as a sign
1959 * bit. If the most significant bit is already set and the integer is
1960 * positive, a 0x00 is prepended.
9637 * 1961 *
9638 * stopOnFalse: interrupt callings when a callback returns false 1962 * Examples:
9639 * 1963 *
9640 */ 1964 * 0 => 0x00
9641jQuery.Callbacks = function( options ) { 1965 * 1 => 0x01
9642 1966 * -1 => 0xff
9643 // Convert options from String-formatted to Object-formatted if needed 1967 * 127 => 0x7f
9644 // (we check in cache first) 1968 * -127 => 0x81
9645 options = typeof options === "string" ? 1969 * 128 => 0x0080
9646 ( optionsCache[ options ] || createOptions( options ) ) : 1970 * -128 => 0x80
9647 jQuery.extend( {}, options ); 1971 * 255 => 0x00ff
9648 1972 * -255 => 0xff01
9649 var // Last fire value (for non-forgettable lists) 1973 * 16300 => 0x3fac
9650 memory, 1974 * -16300 => 0xc054
9651 // Flag to know if list was already fired 1975 * 62300 => 0x00f35c
9652 fired, 1976 * -62300 => 0xff0ca4
9653 // Flag to know if list is currently firing 1977*/
9654 firing, 1978BigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray
9655 // First callback to fire (used internally by add and fireWith)
9656 firingStart,
9657 // End of the loop when firing
9658 firingLength,
9659 // Index of currently firing callback (modified by remove if needed)
9660 firingIndex,
9661 // Actual callback list
9662 list = [],
9663 // Stack of fire calls for repeatable lists
9664 stack = !options.once && [],
9665 // Fire callbacks
9666 fire = function( data ) {
9667 memory = options.memory && data;
9668 fired = true;
9669 firingIndex = firingStart || 0;
9670 firingStart = 0;
9671 firingLength = list.length;
9672 firing = true;
9673 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
9674 if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
9675 memory = false; // To prevent further calls using add
9676 break;
9677 }
9678 }
9679 firing = false;
9680 if ( list ) {
9681 if ( stack ) {
9682 if ( stack.length ) {
9683 fire( stack.shift() );
9684 }
9685 } else if ( memory ) {
9686 list = [];
9687 } else {
9688 self.disable();
9689 }
9690 }
9691 },
9692 // Actual Callbacks object
9693 self = {
9694 // Add a callback or a collection of callbacks to the list
9695 add: function() {
9696 if ( list ) {
9697 // First, we save the current length
9698 var start = list.length;
9699 (function add( args ) {
9700 jQuery.each( args, function( _, arg ) {
9701 var type = jQuery.type( arg );
9702 if ( type === "function" ) {
9703 if ( !options.unique || !self.has( arg ) ) {
9704 list.push( arg );
9705 }
9706 } else if ( arg && arg.length && type !== "string" ) {
9707 // Inspect recursively
9708 add( arg );
9709 }
9710 });
9711 })( arguments );
9712 // Do we need to add the callbacks to the
9713 // current firing batch?
9714 if ( firing ) {
9715 firingLength = list.length;
9716 // With memory, if we're not firing then
9717 // we should call right away
9718 } else if ( memory ) {
9719 firingStart = start;
9720 fire( memory );
9721 }
9722 }
9723 return this;
9724 },
9725 // Remove a callback from the list
9726 remove: function() {
9727 if ( list ) {
9728 jQuery.each( arguments, function( _, arg ) {
9729 var index;
9730 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
9731 list.splice( index, 1 );
9732 // Handle firing indexes
9733 if ( firing ) {
9734 if ( index <= firingLength ) {
9735 firingLength--;
9736 }
9737 if ( index <= firingIndex ) {
9738 firingIndex--;
9739 }
9740 }
9741 }
9742 });
9743 }
9744 return this;
9745 },
9746 // Check if a given callback is in the list.
9747 // If no argument is given, return whether or not list has callbacks attached.
9748 has: function( fn ) {
9749 return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
9750 },
9751 // Remove all callbacks from the list
9752 empty: function() {
9753 list = [];
9754 firingLength = 0;
9755 return this;
9756 },
9757 // Have the list do nothing anymore
9758 disable: function() {
9759 list = stack = memory = undefined;
9760 return this;
9761 },
9762 // Is it disabled?
9763 disabled: function() {
9764 return !list;
9765 },
9766 // Lock the list in its current state
9767 lock: function() {
9768 stack = undefined;
9769 if ( !memory ) {
9770 self.disable();
9771 }
9772 return this;
9773 },
9774 // Is it locked?
9775 locked: function() {
9776 return !stack;
9777 },
9778 // Call all callbacks with the given context and arguments
9779 fireWith: function( context, args ) {
9780 if ( list && ( !fired || stack ) ) {
9781 args = args || [];
9782 args = [ context, args.slice ? args.slice() : args ];
9783 if ( firing ) {
9784 stack.push( args );
9785 } else {
9786 fire( args );
9787 }
9788 }
9789 return this;
9790 },
9791 // Call all the callbacks with the given arguments
9792 fire: function() {
9793 self.fireWith( this, arguments );
9794 return this;
9795 },
9796 // To know if the callbacks have already been called at least once
9797 fired: function() {
9798 return !!fired;
9799 }
9800 };
9801
9802 return self;
9803};
9804
9805
9806jQuery.extend({
9807
9808 Deferred: function( func ) {
9809 var tuples = [
9810 // action, add listener, listener list, final state
9811 [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
9812 [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
9813 [ "notify", "progress", jQuery.Callbacks("memory") ]
9814 ],
9815 state = "pending",
9816 promise = {
9817 state: function() {
9818 return state;
9819 },
9820 always: function() {
9821 deferred.done( arguments ).fail( arguments );
9822 return this;
9823 },
9824 then: function( /* fnDone, fnFail, fnProgress */ ) {
9825 var fns = arguments;
9826 return jQuery.Deferred(function( newDefer ) {
9827 jQuery.each( tuples, function( i, tuple ) {
9828 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
9829 // deferred[ done | fail | progress ] for forwarding actions to newDefer
9830 deferred[ tuple[1] ](function() {
9831 var returned = fn && fn.apply( this, arguments );
9832 if ( returned && jQuery.isFunction( returned.promise ) ) {
9833 returned.promise()
9834 .done( newDefer.resolve )
9835 .fail( newDefer.reject )
9836 .progress( newDefer.notify );
9837 } else {
9838 newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
9839 }
9840 });
9841 });
9842 fns = null;
9843 }).promise();
9844 },
9845 // Get a promise for this deferred
9846 // If obj is provided, the promise aspect is added to the object
9847 promise: function( obj ) {
9848 return obj != null ? jQuery.extend( obj, promise ) : promise;
9849 }
9850 },
9851 deferred = {};
9852
9853 // Keep pipe for back-compat
9854 promise.pipe = promise.then;
9855
9856 // Add list-specific methods
9857 jQuery.each( tuples, function( i, tuple ) {
9858 var list = tuple[ 2 ],
9859 stateString = tuple[ 3 ];
9860
9861 // promise[ done | fail | progress ] = list.add
9862 promise[ tuple[1] ] = list.add;
9863
9864 // Handle state
9865 if ( stateString ) {
9866 list.add(function() {
9867 // state = [ resolved | rejected ]
9868 state = stateString;
9869
9870 // [ reject_list | resolve_list ].disable; progress_list.lock
9871 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
9872 }
9873
9874 // deferred[ resolve | reject | notify ]
9875 deferred[ tuple[0] ] = function() {
9876 deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
9877 return this;
9878 };
9879 deferred[ tuple[0] + "With" ] = list.fireWith;
9880 });
9881
9882 // Make the deferred a promise
9883 promise.promise( deferred );
9884
9885 // Call given func if any
9886 if ( func ) {
9887 func.call( deferred, deferred );
9888 }
9889
9890 // All done!
9891 return deferred;
9892 },
9893
9894 // Deferred helper
9895 when: function( subordinate /* , ..., subordinateN */ ) {
9896 var i = 0,
9897 resolveValues = slice.call( arguments ),
9898 length = resolveValues.length,
9899
9900 // the count of uncompleted subordinates
9901 remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
9902
9903 // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
9904 deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
9905
9906 // Update function for both resolve and progress values
9907 updateFunc = function( i, contexts, values ) {
9908 return function( value ) {
9909 contexts[ i ] = this;
9910 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
9911 if ( values === progressValues ) {
9912 deferred.notifyWith( contexts, values );
9913 } else if ( !( --remaining ) ) {
9914 deferred.resolveWith( contexts, values );
9915 }
9916 };
9917 },
9918
9919 progressValues, progressContexts, resolveContexts;
9920
9921 // add listeners to Deferred subordinates; treat others as resolved
9922 if ( length > 1 ) {
9923 progressValues = new Array( length );
9924 progressContexts = new Array( length );
9925 resolveContexts = new Array( length );
9926 for ( ; i < length; i++ ) {
9927 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
9928 resolveValues[ i ].promise()
9929 .done( updateFunc( i, resolveContexts, resolveValues ) )
9930 .fail( deferred.reject )
9931 .progress( updateFunc( i, progressContexts, progressValues ) );
9932 } else {
9933 --remaining;
9934 }
9935 }
9936 }
9937
9938 // if we're not waiting on anything, resolve the master
9939 if ( !remaining ) {
9940 deferred.resolveWith( resolveContexts, resolveValues );
9941 }
9942
9943 return deferred.promise();
9944 }
9945});
9946
9947
9948// The deferred used on DOM ready
9949var readyList;
9950
9951jQuery.fn.ready = function( fn ) {
9952 // Add the callback
9953 jQuery.ready.promise().done( fn );
9954
9955 return this;
9956};
9957
9958jQuery.extend({
9959 // Is the DOM ready to be used? Set to true once it occurs.
9960 isReady: false,
9961
9962 // A counter to track how many items to wait for before
9963 // the ready event fires. See #6781
9964 readyWait: 1,
9965
9966 // Hold (or release) the ready event
9967 holdReady: function( hold ) {
9968 if ( hold ) {
9969 jQuery.readyWait++;
9970 } else {
9971 jQuery.ready( true );
9972 }
9973 },
9974
9975 // Handle when the DOM is ready
9976 ready: function( wait ) {
9977
9978 // Abort if there are pending holds or we're already ready
9979 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
9980 return;
9981 }
9982
9983 // Remember that the DOM is ready
9984 jQuery.isReady = true;
9985
9986 // If a normal DOM Ready event fired, decrement, and wait if need be
9987 if ( wait !== true && --jQuery.readyWait > 0 ) {
9988 return;
9989 }
9990 1979
9991 // If there are functions bound, to execute 1980BigInteger.fromBuffer = function(buffer) {
9992 readyList.resolveWith( document, [ jQuery ] ); 1981 // BigInteger expects a DER integer conformant byte array
1982 if (buffer[0] & 0x80) {
1983 var byteArray = Array.prototype.slice.call(buffer)
9993 1984
9994 // Trigger any bound ready events 1985 return new BigInteger([0].concat(byteArray))
9995 if ( jQuery.fn.triggerHandler ) { 1986 }
9996 jQuery( document ).triggerHandler( "ready" );
9997 jQuery( document ).off( "ready" );
9998 }
9999 }
10000});
10001 1987
10002/** 1988 return new BigInteger(buffer)
10003 * The ready event handler and self cleanup method
10004 */
10005function completed() {
10006 document.removeEventListener( "DOMContentLoaded", completed, false );
10007 window.removeEventListener( "load", completed, false );
10008 jQuery.ready();
10009} 1989}
10010 1990
10011jQuery.ready.promise = function( obj ) { 1991BigInteger.fromHex = function(hex) {
10012 if ( !readyList ) { 1992 if (hex === '') return BigInteger.ZERO
10013
10014 readyList = jQuery.Deferred();
10015
10016 // Catch cases where $(document).ready() is called after the browser event has already occurred.
10017 // we once tried to use readyState "interactive" here, but it caused issues like the one
10018 // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
10019 if ( document.readyState === "complete" ) {
10020 // Handle it asynchronously to allow scripts the opportunity to delay ready
10021 setTimeout( jQuery.ready );
10022
10023 } else {
10024
10025 // Use the handy event callback
10026 document.addEventListener( "DOMContentLoaded", completed, false );
10027
10028 // A fallback to window.onload, that will always work
10029 window.addEventListener( "load", completed, false );
10030 }
10031 }
10032 return readyList.promise( obj );
10033};
10034
10035// Kick off the DOM ready check even if the user does not
10036jQuery.ready.promise();
10037
10038
10039
10040
10041// Multifunctional method to get and set values of a collection
10042// The value/s can optionally be executed if it's a function
10043var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
10044 var i = 0,
10045 len = elems.length,
10046 bulk = key == null;
10047
10048 // Sets many values
10049 if ( jQuery.type( key ) === "object" ) {
10050 chainable = true;
10051 for ( i in key ) {
10052 jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
10053 }
10054
10055 // Sets one value
10056 } else if ( value !== undefined ) {
10057 chainable = true;
10058
10059 if ( !jQuery.isFunction( value ) ) {
10060 raw = true;
10061 }
10062
10063 if ( bulk ) {
10064 // Bulk operations run against the entire set
10065 if ( raw ) {
10066 fn.call( elems, value );
10067 fn = null;
10068
10069 // ...except when executing function values
10070 } else {
10071 bulk = fn;
10072 fn = function( elem, key, value ) {
10073 return bulk.call( jQuery( elem ), value );
10074 };
10075 }
10076 }
10077
10078 if ( fn ) {
10079 for ( ; i < len; i++ ) {
10080 fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
10081 }
10082 }
10083 }
10084
10085 return chainable ?
10086 elems :
10087
10088 // Gets
10089 bulk ?
10090 fn.call( elems ) :
10091 len ? fn( elems[0], key ) : emptyGet;
10092};
10093
10094
10095/**
10096 * Determines whether an object can have data
10097 */
10098jQuery.acceptData = function( owner ) {
10099 // Accepts only:
10100 // - Node
10101 // - Node.ELEMENT_NODE
10102 // - Node.DOCUMENT_NODE
10103 // - Object
10104 // - Any
10105 /* jshint -W018 */
10106 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
10107};
10108
10109
10110function Data() {
10111 // Support: Android < 4,
10112 // Old WebKit does not have Object.preventExtensions/freeze method,
10113 // return new empty object instead with no [[set]] accessor
10114 Object.defineProperty( this.cache = {}, 0, {
10115 get: function() {
10116 return {};
10117 }
10118 });
10119 1993
10120 this.expando = jQuery.expando + Math.random(); 1994 assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string')
1995 assert.equal(hex.length % 2, 0, 'Incomplete hex')
1996 return new BigInteger(hex, 16)
10121} 1997}
10122 1998
10123Data.uid = 1; 1999BigInteger.prototype.toBuffer = function(size) {
10124Data.accepts = jQuery.acceptData; 2000 var byteArray = this.toByteArrayUnsigned()
10125 2001 var zeros = []
10126Data.prototype = {
10127 key: function( owner ) {
10128 // We can accept data for non-element nodes in modern browsers,
10129 // but we should not, see #8335.
10130 // Always return the key for a frozen object.
10131 if ( !Data.accepts( owner ) ) {
10132 return 0;
10133 }
10134
10135 var descriptor = {},
10136 // Check if the owner object already has a cache key
10137 unlock = owner[ this.expando ];
10138
10139 // If not, create one
10140 if ( !unlock ) {
10141 unlock = Data.uid++;
10142
10143 // Secure it in a non-enumerable, non-writable property
10144 try {
10145 descriptor[ this.expando ] = { value: unlock };
10146 Object.defineProperties( owner, descriptor );
10147
10148 // Support: Android < 4
10149 // Fallback to a less secure definition
10150 } catch ( e ) {
10151 descriptor[ this.expando ] = unlock;
10152 jQuery.extend( owner, descriptor );
10153 }
10154 }
10155
10156 // Ensure the cache object
10157 if ( !this.cache[ unlock ] ) {
10158 this.cache[ unlock ] = {};
10159 }
10160
10161 return unlock;
10162 },
10163 set: function( owner, data, value ) {
10164 var prop,
10165 // There may be an unlock assigned to this node,
10166 // if there is no entry for this "owner", create one inline
10167 // and set the unlock as though an owner entry had always existed
10168 unlock = this.key( owner ),
10169 cache = this.cache[ unlock ];
10170
10171 // Handle: [ owner, key, value ] args
10172 if ( typeof data === "string" ) {
10173 cache[ data ] = value;
10174
10175 // Handle: [ owner, { properties } ] args
10176 } else {
10177 // Fresh assignments by object are shallow copied
10178 if ( jQuery.isEmptyObject( cache ) ) {
10179 jQuery.extend( this.cache[ unlock ], data );
10180 // Otherwise, copy the properties one-by-one to the cache object
10181 } else {
10182 for ( prop in data ) {
10183 cache[ prop ] = data[ prop ];
10184 }
10185 }
10186 }
10187 return cache;
10188 },
10189 get: function( owner, key ) {
10190 // Either a valid cache is found, or will be created.
10191 // New caches will be created and the unlock returned,
10192 // allowing direct access to the newly created
10193 // empty data object. A valid owner object must be provided.
10194 var cache = this.cache[ this.key( owner ) ];
10195
10196 return key === undefined ?
10197 cache : cache[ key ];
10198 },
10199 access: function( owner, key, value ) {
10200 var stored;
10201 // In cases where either:
10202 //
10203 // 1. No key was specified
10204 // 2. A string key was specified, but no value provided
10205 //
10206 // Take the "read" path and allow the get method to determine
10207 // which value to return, respectively either:
10208 //
10209 // 1. The entire cache object
10210 // 2. The data stored at the key
10211 //
10212 if ( key === undefined ||
10213 ((key && typeof key === "string") && value === undefined) ) {
10214
10215 stored = this.get( owner, key );
10216
10217 return stored !== undefined ?
10218 stored : this.get( owner, jQuery.camelCase(key) );
10219 }
10220
10221 // [*]When the key is not a string, or both a key and value
10222 // are specified, set or extend (existing objects) with either:
10223 //
10224 // 1. An object of properties
10225 // 2. A key and value
10226 //
10227 this.set( owner, key, value );
10228
10229 // Since the "set" path can have two possible entry points
10230 // return the expected data based on which path was taken[*]
10231 return value !== undefined ? value : key;
10232 },
10233 remove: function( owner, key ) {
10234 var i, name, camel,
10235 unlock = this.key( owner ),
10236 cache = this.cache[ unlock ];
10237
10238 if ( key === undefined ) {
10239 this.cache[ unlock ] = {};
10240
10241 } else {
10242 // Support array or space separated string of keys
10243 if ( jQuery.isArray( key ) ) {
10244 // If "name" is an array of keys...
10245 // When data is initially created, via ("key", "val") signature,
10246 // keys will be converted to camelCase.
10247 // Since there is no way to tell _how_ a key was added, remove
10248 // both plain key and camelCase key. #12786
10249 // This will only penalize the array argument path.
10250 name = key.concat( key.map( jQuery.camelCase ) );
10251 } else {
10252 camel = jQuery.camelCase( key );
10253 // Try the string as a key before any manipulation
10254 if ( key in cache ) {
10255 name = [ key, camel ];
10256 } else {
10257 // If a key with the spaces exists, use it.
10258 // Otherwise, create an array by matching non-whitespace
10259 name = camel;
10260 name = name in cache ?
10261 [ name ] : ( name.match( rnotwhite ) || [] );
10262 }
10263 }
10264
10265 i = name.length;
10266 while ( i-- ) {
10267 delete cache[ name[ i ] ];
10268 }
10269 }
10270 },
10271 hasData: function( owner ) {
10272 return !jQuery.isEmptyObject(
10273 this.cache[ owner[ this.expando ] ] || {}
10274 );
10275 },
10276 discard: function( owner ) {
10277 if ( owner[ this.expando ] ) {
10278 delete this.cache[ owner[ this.expando ] ];
10279 }
10280 }
10281};
10282var data_priv = new Data();
10283
10284var data_user = new Data();
10285 2002
2003 var padding = size - byteArray.length
2004 while (zeros.length < padding) zeros.push(0)
10286 2005
2006 return new Buffer(zeros.concat(byteArray))
2007}
10287 2008
10288/* 2009BigInteger.prototype.toHex = function(size) {
10289 Implementation Summary 2010 return this.toBuffer(size).toString('hex')
10290
10291 1. Enforce API surface and semantic compatibility with 1.9.x branch
10292 2. Improve the module's maintainability by reducing the storage
10293 paths to a single mechanism.
10294 3. Use the same single mechanism to support "private" and "user" data.
10295 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
10296 5. Avoid exposing implementation details on user objects (eg. expando properties)
10297 6. Provide a clear path for implementation upgrade to WeakMap in 2014
10298*/
10299var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
10300 rmultiDash = /([A-Z])/g;
10301
10302function dataAttr( elem, key, data ) {
10303 var name;
10304
10305 // If nothing was found internally, try to fetch any
10306 // data from the HTML5 data-* attribute
10307 if ( data === undefined && elem.nodeType === 1 ) {
10308 name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
10309 data = elem.getAttribute( name );
10310
10311 if ( typeof data === "string" ) {
10312 try {
10313 data = data === "true" ? true :
10314 data === "false" ? false :
10315 data === "null" ? null :
10316 // Only convert to a number if it doesn't change the string
10317 +data + "" === data ? +data :
10318 rbrace.test( data ) ? jQuery.parseJSON( data ) :
10319 data;
10320 } catch( e ) {}
10321
10322 // Make sure we set the data so it isn't changed later
10323 data_user.set( elem, key, data );
10324 } else {
10325 data = undefined;
10326 }
10327 }
10328 return data;
10329} 2011}
10330 2012
10331jQuery.extend({ 2013}).call(this,require("buffer").Buffer)
10332 hasData: function( elem ) { 2014},{"./bigi":1,"assert":5,"buffer":7}],3:[function(require,module,exports){
10333 return data_user.hasData( elem ) || data_priv.hasData( elem ); 2015var BigInteger = require('./bigi')
10334 },
10335 2016
10336 data: function( elem, name, data ) { 2017//addons
10337 return data_user.access( elem, name, data ); 2018require('./convert')
10338 },
10339 2019
10340 removeData: function( elem, name ) { 2020module.exports = BigInteger
10341 data_user.remove( elem, name ); 2021},{"./bigi":1,"./convert":2}],4:[function(require,module,exports){
2022module.exports={
2023 "name": "bigi",
2024 "version": "1.4.0",
2025 "description": "Big integers.",
2026 "keywords": [
2027 "cryptography",
2028 "math",
2029 "bitcoin",
2030 "arbitrary",
2031 "precision",
2032 "arithmetic",
2033 "big",
2034 "integer",
2035 "int",
2036 "number",
2037 "biginteger",
2038 "bigint",
2039 "bignumber",
2040 "decimal",
2041 "float"
2042 ],
2043 "devDependencies": {
2044 "mocha": "^1.20.1",
2045 "jshint": "^2.5.1",
2046 "coveralls": "^2.10.0",
2047 "istanbul": "^0.2.11"
2048 },
2049 "repository": {
2050 "url": "https://github.com/cryptocoinjs/bigi",
2051 "type": "git"
2052 },
2053 "main": "./lib/index.js",
2054 "scripts": {
2055 "test": "_mocha -- test/*.js",
2056 "jshint": "jshint --config jshint.json lib/*.js ; true",
2057 "unit": "mocha",
2058 "coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter list test/*.js",
2059 "coveralls": "npm run-script coverage && node ./node_modules/.bin/coveralls < coverage/lcov.info"
2060 },
2061 "dependencies": {},
2062 "testling": {
2063 "files": "test/*.js",
2064 "harness": "mocha",
2065 "browsers": [
2066 "ie/9..latest",
2067 "firefox/latest",
2068 "chrome/latest",
2069 "safari/6.0..latest",
2070 "iphone/6.0..latest",
2071 "android-browser/4.2..latest"
2072 ]
2073 },
2074 "bugs": {
2075 "url": "https://github.com/cryptocoinjs/bigi/issues"
2076 },
2077 "homepage": "https://github.com/cryptocoinjs/bigi",
2078 "_id": "bigi@1.4.0",
2079 "dist": {
2080 "shasum": "90ac1aeac0a531216463bdb58f42c1e05c8407ac",
2081 "tarball": "http://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz"
2082 },
2083 "_from": "bigi@^1.4.0",
2084 "_npmVersion": "1.4.3",
2085 "_npmUser": {
2086 "name": "jp",
2087 "email": "jprichardson@gmail.com"
2088 },
2089 "maintainers": [
2090 {
2091 "name": "jp",
2092 "email": "jprichardson@gmail.com"
10342 }, 2093 },
10343 2094 {
10344 // TODO: Now that all calls to _data and _removeData have been replaced 2095 "name": "midnightlightning",
10345 // with direct calls to data_priv methods, these can be deprecated. 2096 "email": "boydb@midnightdesign.ws"
10346 _data: function( elem, name, data ) {
10347 return data_priv.access( elem, name, data );
10348 }, 2097 },
10349 2098 {
10350 _removeData: function( elem, name ) { 2099 "name": "sidazhang",
10351 data_priv.remove( elem, name ); 2100 "email": "sidazhang89@gmail.com"
10352 }
10353});
10354
10355jQuery.fn.extend({
10356 data: function( key, value ) {
10357 var i, name, data,
10358 elem = this[ 0 ],
10359 attrs = elem && elem.attributes;
10360
10361 // Gets all values
10362 if ( key === undefined ) {
10363 if ( this.length ) {
10364 data = data_user.get( elem );
10365
10366 if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
10367 i = attrs.length;
10368 while ( i-- ) {
10369
10370 // Support: IE11+
10371 // The attrs elements can be null (#14894)
10372 if ( attrs[ i ] ) {
10373 name = attrs[ i ].name;
10374 if ( name.indexOf( "data-" ) === 0 ) {
10375 name = jQuery.camelCase( name.slice(5) );
10376 dataAttr( elem, name, data[ name ] );
10377 }
10378 }
10379 }
10380 data_priv.set( elem, "hasDataAttrs", true );
10381 }
10382 }
10383
10384 return data;
10385 }
10386
10387 // Sets multiple values
10388 if ( typeof key === "object" ) {
10389 return this.each(function() {
10390 data_user.set( this, key );
10391 });
10392 }
10393
10394 return access( this, function( value ) {
10395 var data,
10396 camelKey = jQuery.camelCase( key );
10397
10398 // The calling jQuery object (element matches) is not empty
10399 // (and therefore has an element appears at this[ 0 ]) and the
10400 // `value` parameter was not undefined. An empty jQuery object
10401 // will result in `undefined` for elem = this[ 0 ] which will
10402 // throw an exception if an attempt to read a data cache is made.
10403 if ( elem && value === undefined ) {
10404 // Attempt to get data from the cache
10405 // with the key as-is
10406 data = data_user.get( elem, key );
10407 if ( data !== undefined ) {
10408 return data;
10409 }
10410
10411 // Attempt to get data from the cache
10412 // with the key camelized
10413 data = data_user.get( elem, camelKey );
10414 if ( data !== undefined ) {
10415 return data;
10416 }
10417
10418 // Attempt to "discover" the data in
10419 // HTML5 custom data-* attrs
10420 data = dataAttr( elem, camelKey, undefined );
10421 if ( data !== undefined ) {
10422 return data;
10423 }
10424
10425 // We tried really hard, but the data doesn't exist.
10426 return;
10427 }
10428
10429 // Set the data...
10430 this.each(function() {
10431 // First, attempt to store a copy or reference of any
10432 // data that might've been store with a camelCased key.
10433 var data = data_user.get( this, camelKey );
10434
10435 // For HTML5 data-* attribute interop, we have to
10436 // store property names with dashes in a camelCase form.
10437 // This might not apply to all properties...*
10438 data_user.set( this, camelKey, value );
10439
10440 // *... In the case of properties that might _actually_
10441 // have dashes, we need to also store a copy of that
10442 // unchanged property.
10443 if ( key.indexOf("-") !== -1 && data !== undefined ) {
10444 data_user.set( this, key, value );
10445 }
10446 });
10447 }, null, value, arguments.length > 1, null, true );
10448 }, 2101 },
10449 2102 {
10450 removeData: function( key ) { 2103 "name": "nadav",
10451 return this.each(function() { 2104 "email": "npm@shesek.info"
10452 data_user.remove( this, key );
10453 });
10454 } 2105 }
10455}); 2106 ],
10456 2107 "directories": {},
10457 2108 "_shasum": "90ac1aeac0a531216463bdb58f42c1e05c8407ac",
10458jQuery.extend({ 2109 "_resolved": "https://registry.npmjs.org/bigi/-/bigi-1.4.0.tgz"
10459 queue: function( elem, type, data ) { 2110}
10460 var queue;
10461
10462 if ( elem ) {
10463 type = ( type || "fx" ) + "queue";
10464 queue = data_priv.get( elem, type );
10465
10466 // Speed up dequeue by getting out quickly if this is just a lookup
10467 if ( data ) {
10468 if ( !queue || jQuery.isArray( data ) ) {
10469 queue = data_priv.access( elem, type, jQuery.makeArray(data) );
10470 } else {
10471 queue.push( data );
10472 }
10473 }
10474 return queue || [];
10475 }
10476 },
10477
10478 dequeue: function( elem, type ) {
10479 type = type || "fx";
10480
10481 var queue = jQuery.queue( elem, type ),
10482 startLength = queue.length,
10483 fn = queue.shift(),
10484 hooks = jQuery._queueHooks( elem, type ),
10485 next = function() {
10486 jQuery.dequeue( elem, type );
10487 };
10488
10489 // If the fx queue is dequeued, always remove the progress sentinel
10490 if ( fn === "inprogress" ) {
10491 fn = queue.shift();
10492 startLength--;
10493 }
10494
10495 if ( fn ) {
10496
10497 // Add a progress sentinel to prevent the fx queue from being
10498 // automatically dequeued
10499 if ( type === "fx" ) {
10500 queue.unshift( "inprogress" );
10501 }
10502 2111
10503 // clear up the last queue stop function 2112},{}],5:[function(require,module,exports){
10504 delete hooks.stop; 2113// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
10505 fn.call( elem, next, hooks ); 2114//
10506 } 2115// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
2116//
2117// Originally from narwhal.js (http://narwhaljs.org)
2118// Copyright (c) 2009 Thomas Robinson <280north.com>
2119//
2120// Permission is hereby granted, free of charge, to any person obtaining a copy
2121// of this software and associated documentation files (the 'Software'), to
2122// deal in the Software without restriction, including without limitation the
2123// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
2124// sell copies of the Software, and to permit persons to whom the Software is
2125// furnished to do so, subject to the following conditions:
2126//
2127// The above copyright notice and this permission notice shall be included in
2128// all copies or substantial portions of the Software.
2129//
2130// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2131// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2132// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2133// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2134// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2135// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10507 2136
10508 if ( !startLength && hooks ) { 2137// when used in node, this will actually load the util module we depend on
10509 hooks.empty.fire(); 2138// versus loading the builtin util module as happens otherwise
10510 } 2139// this is a bug in node module loading as far as I am concerned
10511 }, 2140var util = require('util/');
10512 2141
10513 // not intended for public consumption - generates a queueHooks object, or returns the current one 2142var pSlice = Array.prototype.slice;
10514 _queueHooks: function( elem, type ) { 2143var hasOwn = Object.prototype.hasOwnProperty;
10515 var key = type + "queueHooks";
10516 return data_priv.get( elem, key ) || data_priv.access( elem, key, {
10517 empty: jQuery.Callbacks("once memory").add(function() {
10518 data_priv.remove( elem, [ type + "queue", key ] );
10519 })
10520 });
10521 }
10522});
10523 2144
10524jQuery.fn.extend({ 2145// 1. The assert module provides functions that throw
10525 queue: function( type, data ) { 2146// AssertionError's when particular conditions are not met. The
10526 var setter = 2; 2147// assert module must conform to the following interface.
10527 2148
10528 if ( typeof type !== "string" ) { 2149var assert = module.exports = ok;
10529 data = type;
10530 type = "fx";
10531 setter--;
10532 }
10533 2150
10534 if ( arguments.length < setter ) { 2151// 2. The AssertionError is defined in assert.
10535 return jQuery.queue( this[0], type ); 2152// new assert.AssertionError({ message: message,
10536 } 2153// actual: actual,
2154// expected: expected })
10537 2155
10538 return data === undefined ? 2156assert.AssertionError = function AssertionError(options) {
10539 this : 2157 this.name = 'AssertionError';
10540 this.each(function() { 2158 this.actual = options.actual;
10541 var queue = jQuery.queue( this, type, data ); 2159 this.expected = options.expected;
2160 this.operator = options.operator;
2161 if (options.message) {
2162 this.message = options.message;
2163 this.generatedMessage = false;
2164 } else {
2165 this.message = getMessage(this);
2166 this.generatedMessage = true;
2167 }
2168 var stackStartFunction = options.stackStartFunction || fail;
10542 2169
10543 // ensure a hooks for this queue 2170 if (Error.captureStackTrace) {
10544 jQuery._queueHooks( this, type ); 2171 Error.captureStackTrace(this, stackStartFunction);
2172 }
2173 else {
2174 // non v8 browsers so we can have a stacktrace
2175 var err = new Error();
2176 if (err.stack) {
2177 var out = err.stack;
10545 2178
10546 if ( type === "fx" && queue[0] !== "inprogress" ) { 2179 // try to strip useless frames
10547 jQuery.dequeue( this, type ); 2180 var fn_name = stackStartFunction.name;
10548 } 2181 var idx = out.indexOf('\n' + fn_name);
10549 }); 2182 if (idx >= 0) {
10550 }, 2183 // once we have located the function frame
10551 dequeue: function( type ) { 2184 // we need to strip out everything before it (and its line)
10552 return this.each(function() { 2185 var next_line = out.indexOf('\n', idx + 1);
10553 jQuery.dequeue( this, type ); 2186 out = out.substring(next_line + 1);
10554 }); 2187 }
10555 },
10556 clearQueue: function( type ) {
10557 return this.queue( type || "fx", [] );
10558 },
10559 // Get a promise resolved when queues of a certain type
10560 // are emptied (fx is the type by default)
10561 promise: function( type, obj ) {
10562 var tmp,
10563 count = 1,
10564 defer = jQuery.Deferred(),
10565 elements = this,
10566 i = this.length,
10567 resolve = function() {
10568 if ( !( --count ) ) {
10569 defer.resolveWith( elements, [ elements ] );
10570 }
10571 };
10572
10573 if ( typeof type !== "string" ) {
10574 obj = type;
10575 type = undefined;
10576 }
10577 type = type || "fx";
10578 2188
10579 while ( i-- ) { 2189 this.stack = out;
10580 tmp = data_priv.get( elements[ i ], type + "queueHooks" );
10581 if ( tmp && tmp.empty ) {
10582 count++;
10583 tmp.empty.add( resolve );
10584 }
10585 }
10586 resolve();
10587 return defer.promise( obj );
10588 } 2190 }
10589}); 2191 }
10590var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 2192};
10591
10592var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
10593
10594var isHidden = function( elem, el ) {
10595 // isHidden might be called from jQuery#filter function;
10596 // in that case, element will be second argument
10597 elem = el || elem;
10598 return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
10599 };
10600
10601var rcheckableType = (/^(?:checkbox|radio)$/i);
10602
10603
10604
10605(function() {
10606 var fragment = document.createDocumentFragment(),
10607 div = fragment.appendChild( document.createElement( "div" ) ),
10608 input = document.createElement( "input" );
10609
10610 // #11217 - WebKit loses check when the name is after the checked attribute
10611 // Support: Windows Web Apps (WWA)
10612 // `name` and `type` need .setAttribute for WWA
10613 input.setAttribute( "type", "radio" );
10614 input.setAttribute( "checked", "checked" );
10615 input.setAttribute( "name", "t" );
10616
10617 div.appendChild( input );
10618
10619 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
10620 // old WebKit doesn't clone checked state correctly in fragments
10621 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
10622
10623 // Make sure textarea (and checkbox) defaultValue is properly cloned
10624 // Support: IE9-IE11+
10625 div.innerHTML = "<textarea>x</textarea>";
10626 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
10627})();
10628var strundefined = typeof undefined;
10629
10630
10631
10632support.focusinBubbles = "onfocusin" in window;
10633
10634 2193
10635var 2194// assert.AssertionError instanceof Error
10636 rkeyEvent = /^key/, 2195util.inherits(assert.AssertionError, Error);
10637 rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
10638 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
10639 rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
10640 2196
10641function returnTrue() { 2197function replacer(key, value) {
10642 return true; 2198 if (util.isUndefined(value)) {
2199 return '' + value;
2200 }
2201 if (util.isNumber(value) && !isFinite(value)) {
2202 return value.toString();
2203 }
2204 if (util.isFunction(value) || util.isRegExp(value)) {
2205 return value.toString();
2206 }
2207 return value;
10643} 2208}
10644 2209
10645function returnFalse() { 2210function truncate(s, n) {
10646 return false; 2211 if (util.isString(s)) {
2212 return s.length < n ? s : s.slice(0, n);
2213 } else {
2214 return s;
2215 }
10647} 2216}
10648 2217
10649function safeActiveElement() { 2218function getMessage(self) {
10650 try { 2219 return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' +
10651 return document.activeElement; 2220 self.operator + ' ' +
10652 } catch ( err ) { } 2221 truncate(JSON.stringify(self.expected, replacer), 128);
10653} 2222}
10654 2223
10655/* 2224// At present only the three keys mentioned above are used and
10656 * Helper functions for managing events -- not part of the public interface. 2225// understood by the spec. Implementations or sub modules can pass
10657 * Props to Dean Edwards' addEvent library for many of the ideas. 2226// other keys to the AssertionError's constructor - they will be
10658 */ 2227// ignored.
10659jQuery.event = {
10660
10661 global: {},
10662
10663 add: function( elem, types, handler, data, selector ) {
10664
10665 var handleObjIn, eventHandle, tmp,
10666 events, t, handleObj,
10667 special, handlers, type, namespaces, origType,
10668 elemData = data_priv.get( elem );
10669
10670 // Don't attach events to noData or text/comment nodes (but allow plain objects)
10671 if ( !elemData ) {
10672 return;
10673 }
10674
10675 // Caller can pass in an object of custom data in lieu of the handler
10676 if ( handler.handler ) {
10677 handleObjIn = handler;
10678 handler = handleObjIn.handler;
10679 selector = handleObjIn.selector;
10680 }
10681
10682 // Make sure that the handler has a unique ID, used to find/remove it later
10683 if ( !handler.guid ) {
10684 handler.guid = jQuery.guid++;
10685 }
10686
10687 // Init the element's event structure and main handler, if this is the first
10688 if ( !(events = elemData.events) ) {
10689 events = elemData.events = {};
10690 }
10691 if ( !(eventHandle = elemData.handle) ) {
10692 eventHandle = elemData.handle = function( e ) {
10693 // Discard the second event of a jQuery.event.trigger() and
10694 // when an event is called after a page has unloaded
10695 return typeof jQuery !== strundefined && jQuery.event.triggered !== e.type ?
10696 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
10697 };
10698 }
10699
10700 // Handle multiple events separated by a space
10701 types = ( types || "" ).match( rnotwhite ) || [ "" ];
10702 t = types.length;
10703 while ( t-- ) {
10704 tmp = rtypenamespace.exec( types[t] ) || [];
10705 type = origType = tmp[1];
10706 namespaces = ( tmp[2] || "" ).split( "." ).sort();
10707
10708 // There *must* be a type, no attaching namespace-only handlers
10709 if ( !type ) {
10710 continue;
10711 }
10712
10713 // If event changes its type, use the special event handlers for the changed type
10714 special = jQuery.event.special[ type ] || {};
10715
10716 // If selector defined, determine special event api type, otherwise given type
10717 type = ( selector ? special.delegateType : special.bindType ) || type;
10718
10719 // Update special based on newly reset type
10720 special = jQuery.event.special[ type ] || {};
10721
10722 // handleObj is passed to all event handlers
10723 handleObj = jQuery.extend({
10724 type: type,
10725 origType: origType,
10726 data: data,
10727 handler: handler,
10728 guid: handler.guid,
10729 selector: selector,
10730 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
10731 namespace: namespaces.join(".")
10732 }, handleObjIn );
10733
10734 // Init the event handler queue if we're the first
10735 if ( !(handlers = events[ type ]) ) {
10736 handlers = events[ type ] = [];
10737 handlers.delegateCount = 0;
10738
10739 // Only use addEventListener if the special events handler returns false
10740 if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
10741 if ( elem.addEventListener ) {
10742 elem.addEventListener( type, eventHandle, false );
10743 }
10744 }
10745 }
10746
10747 if ( special.add ) {
10748 special.add.call( elem, handleObj );
10749
10750 if ( !handleObj.handler.guid ) {
10751 handleObj.handler.guid = handler.guid;
10752 }
10753 }
10754
10755 // Add to the element's handler list, delegates in front
10756 if ( selector ) {
10757 handlers.splice( handlers.delegateCount++, 0, handleObj );
10758 } else {
10759 handlers.push( handleObj );
10760 }
10761
10762 // Keep track of which events have ever been used, for event optimization
10763 jQuery.event.global[ type ] = true;
10764 }
10765
10766 },
10767
10768 // Detach an event or set of events from an element
10769 remove: function( elem, types, handler, selector, mappedTypes ) {
10770
10771 var j, origCount, tmp,
10772 events, t, handleObj,
10773 special, handlers, type, namespaces, origType,
10774 elemData = data_priv.hasData( elem ) && data_priv.get( elem );
10775
10776 if ( !elemData || !(events = elemData.events) ) {
10777 return;
10778 }
10779
10780 // Once for each type.namespace in types; type may be omitted
10781 types = ( types || "" ).match( rnotwhite ) || [ "" ];
10782 t = types.length;
10783 while ( t-- ) {
10784 tmp = rtypenamespace.exec( types[t] ) || [];
10785 type = origType = tmp[1];
10786 namespaces = ( tmp[2] || "" ).split( "." ).sort();
10787
10788 // Unbind all events (on this namespace, if provided) for the element
10789 if ( !type ) {
10790 for ( type in events ) {
10791 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
10792 }
10793 continue;
10794 }
10795
10796 special = jQuery.event.special[ type ] || {};
10797 type = ( selector ? special.delegateType : special.bindType ) || type;
10798 handlers = events[ type ] || [];
10799 tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" );
10800
10801 // Remove matching events
10802 origCount = j = handlers.length;
10803 while ( j-- ) {
10804 handleObj = handlers[ j ];
10805
10806 if ( ( mappedTypes || origType === handleObj.origType ) &&
10807 ( !handler || handler.guid === handleObj.guid ) &&
10808 ( !tmp || tmp.test( handleObj.namespace ) ) &&
10809 ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
10810 handlers.splice( j, 1 );
10811
10812 if ( handleObj.selector ) {
10813 handlers.delegateCount--;
10814 }
10815 if ( special.remove ) {
10816 special.remove.call( elem, handleObj );
10817 }
10818 }
10819 }
10820
10821 // Remove generic event handler if we removed something and no more handlers exist
10822 // (avoids potential for endless recursion during removal of special event handlers)
10823 if ( origCount && !handlers.length ) {
10824 if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
10825 jQuery.removeEvent( elem, type, elemData.handle );
10826 }
10827
10828 delete events[ type ];
10829 }
10830 }
10831
10832 // Remove the expando if it's no longer used
10833 if ( jQuery.isEmptyObject( events ) ) {
10834 delete elemData.handle;
10835 data_priv.remove( elem, "events" );
10836 }
10837 },
10838
10839 trigger: function( event, data, elem, onlyHandlers ) {
10840
10841 var i, cur, tmp, bubbleType, ontype, handle, special,
10842 eventPath = [ elem || document ],
10843 type = hasOwn.call( event, "type" ) ? event.type : event,
10844 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
10845
10846 cur = tmp = elem = elem || document;
10847
10848 // Don't do events on text and comment nodes
10849 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
10850 return;
10851 }
10852
10853 // focus/blur morphs to focusin/out; ensure we're not firing them right now
10854 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
10855 return;
10856 }
10857
10858 if ( type.indexOf(".") >= 0 ) {
10859 // Namespaced trigger; create a regexp to match event type in handle()
10860 namespaces = type.split(".");
10861 type = namespaces.shift();
10862 namespaces.sort();
10863 }
10864 ontype = type.indexOf(":") < 0 && "on" + type;
10865
10866 // Caller can pass in a jQuery.Event object, Object, or just an event type string
10867 event = event[ jQuery.expando ] ?
10868 event :
10869 new jQuery.Event( type, typeof event === "object" && event );
10870
10871 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
10872 event.isTrigger = onlyHandlers ? 2 : 3;
10873 event.namespace = namespaces.join(".");
10874 event.namespace_re = event.namespace ?
10875 new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
10876 null;
10877
10878 // Clean up the event in case it is being reused
10879 event.result = undefined;
10880 if ( !event.target ) {
10881 event.target = elem;
10882 }
10883
10884 // Clone any incoming data and prepend the event, creating the handler arg list
10885 data = data == null ?
10886 [ event ] :
10887 jQuery.makeArray( data, [ event ] );
10888
10889 // Allow special events to draw outside the lines
10890 special = jQuery.event.special[ type ] || {};
10891 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
10892 return;
10893 }
10894
10895 // Determine event propagation path in advance, per W3C events spec (#9951)
10896 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
10897 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
10898
10899 bubbleType = special.delegateType || type;
10900 if ( !rfocusMorph.test( bubbleType + type ) ) {
10901 cur = cur.parentNode;
10902 }
10903 for ( ; cur; cur = cur.parentNode ) {
10904 eventPath.push( cur );
10905 tmp = cur;
10906 }
10907
10908 // Only add window if we got to document (e.g., not plain obj or detached DOM)
10909 if ( tmp === (elem.ownerDocument || document) ) {
10910 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
10911 }
10912 }
10913
10914 // Fire handlers on the event path
10915 i = 0;
10916 while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {
10917
10918 event.type = i > 1 ?
10919 bubbleType :
10920 special.bindType || type;
10921
10922 // jQuery handler
10923 handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
10924 if ( handle ) {
10925 handle.apply( cur, data );
10926 }
10927
10928 // Native handler
10929 handle = ontype && cur[ ontype ];
10930 if ( handle && handle.apply && jQuery.acceptData( cur ) ) {
10931 event.result = handle.apply( cur, data );
10932 if ( event.result === false ) {
10933 event.preventDefault();
10934 }
10935 }
10936 }
10937 event.type = type;
10938
10939 // If nobody prevented the default action, do it now
10940 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
10941
10942 if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&
10943 jQuery.acceptData( elem ) ) {
10944
10945 // Call a native DOM method on the target with the same name name as the event.
10946 // Don't do default actions on window, that's where global variables be (#6170)
10947 if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
10948
10949 // Don't re-trigger an onFOO event when we call its FOO() method
10950 tmp = elem[ ontype ];
10951
10952 if ( tmp ) {
10953 elem[ ontype ] = null;
10954 }
10955
10956 // Prevent re-triggering of the same event, since we already bubbled it above
10957 jQuery.event.triggered = type;
10958 elem[ type ]();
10959 jQuery.event.triggered = undefined;
10960
10961 if ( tmp ) {
10962 elem[ ontype ] = tmp;
10963 }
10964 }
10965 }
10966 }
10967
10968 return event.result;
10969 },
10970
10971 dispatch: function( event ) {
10972
10973 // Make a writable jQuery.Event from the native event object
10974 event = jQuery.event.fix( event );
10975
10976 var i, j, ret, matched, handleObj,
10977 handlerQueue = [],
10978 args = slice.call( arguments ),
10979 handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
10980 special = jQuery.event.special[ event.type ] || {};
10981
10982 // Use the fix-ed jQuery.Event rather than the (read-only) native event
10983 args[0] = event;
10984 event.delegateTarget = this;
10985
10986 // Call the preDispatch hook for the mapped type, and let it bail if desired
10987 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
10988 return;
10989 }
10990
10991 // Determine handlers
10992 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
10993
10994 // Run delegates first; they may want to stop propagation beneath us
10995 i = 0;
10996 while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {
10997 event.currentTarget = matched.elem;
10998
10999 j = 0;
11000 while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {
11001
11002 // Triggered event must either 1) have no namespace, or
11003 // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
11004 if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {
11005
11006 event.handleObj = handleObj;
11007 event.data = handleObj.data;
11008
11009 ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
11010 .apply( matched.elem, args );
11011
11012 if ( ret !== undefined ) {
11013 if ( (event.result = ret) === false ) {
11014 event.preventDefault();
11015 event.stopPropagation();
11016 }
11017 }
11018 }
11019 }
11020 }
11021
11022 // Call the postDispatch hook for the mapped type
11023 if ( special.postDispatch ) {
11024 special.postDispatch.call( this, event );
11025 }
11026
11027 return event.result;
11028 },
11029
11030 handlers: function( event, handlers ) {
11031 var i, matches, sel, handleObj,
11032 handlerQueue = [],
11033 delegateCount = handlers.delegateCount,
11034 cur = event.target;
11035
11036 // Find delegate handlers
11037 // Black-hole SVG <use> instance trees (#13180)
11038 // Avoid non-left-click bubbling in Firefox (#3861)
11039 if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
11040
11041 for ( ; cur !== this; cur = cur.parentNode || this ) {
11042
11043 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
11044 if ( cur.disabled !== true || event.type !== "click" ) {
11045 matches = [];
11046 for ( i = 0; i < delegateCount; i++ ) {
11047 handleObj = handlers[ i ];
11048
11049 // Don't conflict with Object.prototype properties (#13203)
11050 sel = handleObj.selector + " ";
11051
11052 if ( matches[ sel ] === undefined ) {
11053 matches[ sel ] = handleObj.needsContext ?
11054 jQuery( sel, this ).index( cur ) >= 0 :
11055 jQuery.find( sel, this, null, [ cur ] ).length;
11056 }
11057 if ( matches[ sel ] ) {
11058 matches.push( handleObj );
11059 }
11060 }
11061 if ( matches.length ) {
11062 handlerQueue.push({ elem: cur, handlers: matches });
11063 }
11064 }
11065 }
11066 }
11067
11068 // Add the remaining (directly-bound) handlers
11069 if ( delegateCount < handlers.length ) {
11070 handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
11071 }
11072
11073 return handlerQueue;
11074 },
11075
11076 // Includes some event props shared by KeyEvent and MouseEvent
11077 props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
11078
11079 fixHooks: {},
11080
11081 keyHooks: {
11082 props: "char charCode key keyCode".split(" "),
11083 filter: function( event, original ) {
11084
11085 // Add which for key events
11086 if ( event.which == null ) {
11087 event.which = original.charCode != null ? original.charCode : original.keyCode;
11088 }
11089
11090 return event;
11091 }
11092 },
11093
11094 mouseHooks: {
11095 props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
11096 filter: function( event, original ) {
11097 var eventDoc, doc, body,
11098 button = original.button;
11099
11100 // Calculate pageX/Y if missing and clientX/Y available
11101 if ( event.pageX == null && original.clientX != null ) {
11102 eventDoc = event.target.ownerDocument || document;
11103 doc = eventDoc.documentElement;
11104 body = eventDoc.body;
11105
11106 event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
11107 event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
11108 }
11109
11110 // Add which for click: 1 === left; 2 === middle; 3 === right
11111 // Note: button is not normalized, so don't use it
11112 if ( !event.which && button !== undefined ) {
11113 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
11114 }
11115
11116 return event;
11117 }
11118 },
11119
11120 fix: function( event ) {
11121 if ( event[ jQuery.expando ] ) {
11122 return event;
11123 }
11124
11125 // Create a writable copy of the event object and normalize some properties
11126 var i, prop, copy,
11127 type = event.type,
11128 originalEvent = event,
11129 fixHook = this.fixHooks[ type ];
11130
11131 if ( !fixHook ) {
11132 this.fixHooks[ type ] = fixHook =
11133 rmouseEvent.test( type ) ? this.mouseHooks :
11134 rkeyEvent.test( type ) ? this.keyHooks :
11135 {};
11136 }
11137 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
11138
11139 event = new jQuery.Event( originalEvent );
11140
11141 i = copy.length;
11142 while ( i-- ) {
11143 prop = copy[ i ];
11144 event[ prop ] = originalEvent[ prop ];
11145 }
11146
11147 // Support: Cordova 2.5 (WebKit) (#13255)
11148 // All events should have a target; Cordova deviceready doesn't
11149 if ( !event.target ) {
11150 event.target = document;
11151 }
11152
11153 // Support: Safari 6.0+, Chrome < 28
11154 // Target should not be a text node (#504, #13143)
11155 if ( event.target.nodeType === 3 ) {
11156 event.target = event.target.parentNode;
11157 }
11158 2228
11159 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 2229// 3. All of the following functions must throw an AssertionError
11160 }, 2230// when a corresponding condition is not met, with a message that
2231// may be undefined if not provided. All assertion methods provide
2232// both the actual and expected values to the assertion error for
2233// display purposes.
11161 2234
11162 special: { 2235function fail(actual, expected, message, operator, stackStartFunction) {
11163 load: { 2236 throw new assert.AssertionError({
11164 // Prevent triggered image.load events from bubbling to window.load 2237 message: message,
11165 noBubble: true 2238 actual: actual,
11166 }, 2239 expected: expected,
11167 focus: { 2240 operator: operator,
11168 // Fire native event if possible so blur/focus sequence is correct 2241 stackStartFunction: stackStartFunction
11169 trigger: function() { 2242 });
11170 if ( this !== safeActiveElement() && this.focus ) { 2243}
11171 this.focus();
11172 return false;
11173 }
11174 },
11175 delegateType: "focusin"
11176 },
11177 blur: {
11178 trigger: function() {
11179 if ( this === safeActiveElement() && this.blur ) {
11180 this.blur();
11181 return false;
11182 }
11183 },
11184 delegateType: "focusout"
11185 },
11186 click: {
11187 // For checkbox, fire native event so checked state will be right
11188 trigger: function() {
11189 if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
11190 this.click();
11191 return false;
11192 }
11193 },
11194 2244
11195 // For cross-browser consistency, don't fire native .click() on links 2245// EXTENSION! allows for well behaved errors defined elsewhere.
11196 _default: function( event ) { 2246assert.fail = fail;
11197 return jQuery.nodeName( event.target, "a" );
11198 }
11199 },
11200 2247
11201 beforeunload: { 2248// 4. Pure assertion tests whether a value is truthy, as determined
11202 postDispatch: function( event ) { 2249// by !!guard.
2250// assert.ok(guard, message_opt);
2251// This statement is equivalent to assert.equal(true, !!guard,
2252// message_opt);. To test strictly for the value true, use
2253// assert.strictEqual(true, guard, message_opt);.
11203 2254
11204 // Support: Firefox 20+ 2255function ok(value, message) {
11205 // Firefox doesn't alert if the returnValue field is not set. 2256 if (!value) fail(value, true, message, '==', assert.ok);
11206 if ( event.result !== undefined && event.originalEvent ) { 2257}
11207 event.originalEvent.returnValue = event.result; 2258assert.ok = ok;
11208 }
11209 }
11210 }
11211 },
11212 2259
11213 simulate: function( type, elem, event, bubble ) { 2260// 5. The equality assertion tests shallow, coercive equality with
11214 // Piggyback on a donor event to simulate a different one. 2261// ==.
11215 // Fake originalEvent to avoid donor's stopPropagation, but if the 2262// assert.equal(actual, expected, message_opt);
11216 // simulated event prevents default then we do the same on the donor.
11217 var e = jQuery.extend(
11218 new jQuery.Event(),
11219 event,
11220 {
11221 type: type,
11222 isSimulated: true,
11223 originalEvent: {}
11224 }
11225 );
11226 if ( bubble ) {
11227 jQuery.event.trigger( e, null, elem );
11228 } else {
11229 jQuery.event.dispatch.call( elem, e );
11230 }
11231 if ( e.isDefaultPrevented() ) {
11232 event.preventDefault();
11233 }
11234 }
11235};
11236 2263
11237jQuery.removeEvent = function( elem, type, handle ) { 2264assert.equal = function equal(actual, expected, message) {
11238 if ( elem.removeEventListener ) { 2265 if (actual != expected) fail(actual, expected, message, '==', assert.equal);
11239 elem.removeEventListener( type, handle, false );
11240 }
11241}; 2266};
11242 2267
11243jQuery.Event = function( src, props ) { 2268// 6. The non-equality assertion tests for whether two objects are not equal
11244 // Allow instantiation without the 'new' keyword 2269// with != assert.notEqual(actual, expected, message_opt);
11245 if ( !(this instanceof jQuery.Event) ) {
11246 return new jQuery.Event( src, props );
11247 }
11248
11249 // Event object
11250 if ( src && src.type ) {
11251 this.originalEvent = src;
11252 this.type = src.type;
11253
11254 // Events bubbling up the document may have been marked as prevented
11255 // by a handler lower down the tree; reflect the correct value.
11256 this.isDefaultPrevented = src.defaultPrevented ||
11257 src.defaultPrevented === undefined &&
11258 // Support: Android < 4.0
11259 src.returnValue === false ?
11260 returnTrue :
11261 returnFalse;
11262
11263 // Event type
11264 } else {
11265 this.type = src;
11266 }
11267
11268 // Put explicitly provided properties onto the event object
11269 if ( props ) {
11270 jQuery.extend( this, props );
11271 }
11272
11273 // Create a timestamp if incoming event doesn't have one
11274 this.timeStamp = src && src.timeStamp || jQuery.now();
11275 2270
11276 // Mark it as fixed 2271assert.notEqual = function notEqual(actual, expected, message) {
11277 this[ jQuery.expando ] = true; 2272 if (actual == expected) {
2273 fail(actual, expected, message, '!=', assert.notEqual);
2274 }
11278}; 2275};
11279 2276
11280// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 2277// 7. The equivalence assertion tests a deep equality relation.
11281// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 2278// assert.deepEqual(actual, expected, message_opt);
11282jQuery.Event.prototype = {
11283 isDefaultPrevented: returnFalse,
11284 isPropagationStopped: returnFalse,
11285 isImmediatePropagationStopped: returnFalse,
11286
11287 preventDefault: function() {
11288 var e = this.originalEvent;
11289
11290 this.isDefaultPrevented = returnTrue;
11291
11292 if ( e && e.preventDefault ) {
11293 e.preventDefault();
11294 }
11295 },
11296 stopPropagation: function() {
11297 var e = this.originalEvent;
11298
11299 this.isPropagationStopped = returnTrue;
11300
11301 if ( e && e.stopPropagation ) {
11302 e.stopPropagation();
11303 }
11304 },
11305 stopImmediatePropagation: function() {
11306 var e = this.originalEvent;
11307
11308 this.isImmediatePropagationStopped = returnTrue;
11309
11310 if ( e && e.stopImmediatePropagation ) {
11311 e.stopImmediatePropagation();
11312 }
11313 2279
11314 this.stopPropagation(); 2280assert.deepEqual = function deepEqual(actual, expected, message) {
11315 } 2281 if (!_deepEqual(actual, expected)) {
2282 fail(actual, expected, message, 'deepEqual', assert.deepEqual);
2283 }
11316}; 2284};
11317 2285
11318// Create mouseenter/leave events using mouseover/out and event-time checks 2286function _deepEqual(actual, expected) {
11319// Support: Chrome 15+ 2287 // 7.1. All identical values are equivalent, as determined by ===.
11320jQuery.each({ 2288 if (actual === expected) {
11321 mouseenter: "mouseover", 2289 return true;
11322 mouseleave: "mouseout",
11323 pointerenter: "pointerover",
11324 pointerleave: "pointerout"
11325}, function( orig, fix ) {
11326 jQuery.event.special[ orig ] = {
11327 delegateType: fix,
11328 bindType: fix,
11329
11330 handle: function( event ) {
11331 var ret,
11332 target = this,
11333 related = event.relatedTarget,
11334 handleObj = event.handleObj;
11335
11336 // For mousenter/leave call the handler if related is outside the target.
11337 // NB: No relatedTarget if the mouse left/entered the browser window
11338 if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
11339 event.type = handleObj.origType;
11340 ret = handleObj.handler.apply( this, arguments );
11341 event.type = fix;
11342 }
11343 return ret;
11344 }
11345 };
11346});
11347
11348// Create "bubbling" focus and blur events
11349// Support: Firefox, Chrome, Safari
11350if ( !support.focusinBubbles ) {
11351 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
11352
11353 // Attach a single capturing handler on the document while someone wants focusin/focusout
11354 var handler = function( event ) {
11355 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
11356 };
11357
11358 jQuery.event.special[ fix ] = {
11359 setup: function() {
11360 var doc = this.ownerDocument || this,
11361 attaches = data_priv.access( doc, fix );
11362
11363 if ( !attaches ) {
11364 doc.addEventListener( orig, handler, true );
11365 }
11366 data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
11367 },
11368 teardown: function() {
11369 var doc = this.ownerDocument || this,
11370 attaches = data_priv.access( doc, fix ) - 1;
11371
11372 if ( !attaches ) {
11373 doc.removeEventListener( orig, handler, true );
11374 data_priv.remove( doc, fix );
11375
11376 } else {
11377 data_priv.access( doc, fix, attaches );
11378 }
11379 }
11380 };
11381 });
11382}
11383
11384jQuery.fn.extend({
11385
11386 on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
11387 var origFn, type;
11388
11389 // Types can be a map of types/handlers
11390 if ( typeof types === "object" ) {
11391 // ( types-Object, selector, data )
11392 if ( typeof selector !== "string" ) {
11393 // ( types-Object, data )
11394 data = data || selector;
11395 selector = undefined;
11396 }
11397 for ( type in types ) {
11398 this.on( type, selector, data, types[ type ], one );
11399 }
11400 return this;
11401 }
11402
11403 if ( data == null && fn == null ) {
11404 // ( types, fn )
11405 fn = selector;
11406 data = selector = undefined;
11407 } else if ( fn == null ) {
11408 if ( typeof selector === "string" ) {
11409 // ( types, selector, fn )
11410 fn = data;
11411 data = undefined;
11412 } else {
11413 // ( types, data, fn )
11414 fn = data;
11415 data = selector;
11416 selector = undefined;
11417 }
11418 }
11419 if ( fn === false ) {
11420 fn = returnFalse;
11421 } else if ( !fn ) {
11422 return this;
11423 }
11424 2290
11425 if ( one === 1 ) { 2291 } else if (util.isBuffer(actual) && util.isBuffer(expected)) {
11426 origFn = fn; 2292 if (actual.length != expected.length) return false;
11427 fn = function( event ) {
11428 // Can use an empty set, since event contains the info
11429 jQuery().off( event );
11430 return origFn.apply( this, arguments );
11431 };
11432 // Use same guid so caller can remove using origFn
11433 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
11434 }
11435 return this.each( function() {
11436 jQuery.event.add( this, types, fn, data, selector );
11437 });
11438 },
11439 one: function( types, selector, data, fn ) {
11440 return this.on( types, selector, data, fn, 1 );
11441 },
11442 off: function( types, selector, fn ) {
11443 var handleObj, type;
11444 if ( types && types.preventDefault && types.handleObj ) {
11445 // ( event ) dispatched jQuery.Event
11446 handleObj = types.handleObj;
11447 jQuery( types.delegateTarget ).off(
11448 handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
11449 handleObj.selector,
11450 handleObj.handler
11451 );
11452 return this;
11453 }
11454 if ( typeof types === "object" ) {
11455 // ( types-object [, selector] )
11456 for ( type in types ) {
11457 this.off( type, selector, types[ type ] );
11458 }
11459 return this;
11460 }
11461 if ( selector === false || typeof selector === "function" ) {
11462 // ( types [, fn] )
11463 fn = selector;
11464 selector = undefined;
11465 }
11466 if ( fn === false ) {
11467 fn = returnFalse;
11468 }
11469 return this.each(function() {
11470 jQuery.event.remove( this, types, fn, selector );
11471 });
11472 },
11473 2293
11474 trigger: function( type, data ) { 2294 for (var i = 0; i < actual.length; i++) {
11475 return this.each(function() { 2295 if (actual[i] !== expected[i]) return false;
11476 jQuery.event.trigger( type, data, this );
11477 });
11478 },
11479 triggerHandler: function( type, data ) {
11480 var elem = this[0];
11481 if ( elem ) {
11482 return jQuery.event.trigger( type, data, elem, true );
11483 }
11484 } 2296 }
11485});
11486
11487
11488var
11489 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
11490 rtagName = /<([\w:]+)/,
11491 rhtml = /<|&#?\w+;/,
11492 rnoInnerhtml = /<(?:script|style|link)/i,
11493 // checked="checked" or checked
11494 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
11495 rscriptType = /^$|\/(?:java|ecma)script/i,
11496 rscriptTypeMasked = /^true\/(.*)/,
11497 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
11498 2297
11499 // We have to close these tags to support XHTML (#13200) 2298 return true;
11500 wrapMap = {
11501
11502 // Support: IE 9
11503 option: [ 1, "<select multiple='multiple'>", "</select>" ],
11504
11505 thead: [ 1, "<table>", "</table>" ],
11506 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
11507 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
11508 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
11509
11510 _default: [ 0, "", "" ]
11511 };
11512
11513// Support: IE 9
11514wrapMap.optgroup = wrapMap.option;
11515 2299
11516wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 2300 // 7.2. If the expected value is a Date object, the actual value is
11517wrapMap.th = wrapMap.td; 2301 // equivalent if it is also a Date object that refers to the same time.
2302 } else if (util.isDate(actual) && util.isDate(expected)) {
2303 return actual.getTime() === expected.getTime();
11518 2304
11519// Support: 1.x compatibility 2305 // 7.3 If the expected value is a RegExp object, the actual value is
11520// Manipulating tables requires a tbody 2306 // equivalent if it is also a RegExp object with the same source and
11521function manipulationTarget( elem, content ) { 2307 // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
11522 return jQuery.nodeName( elem, "table" ) && 2308 } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
11523 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? 2309 return actual.source === expected.source &&
2310 actual.global === expected.global &&
2311 actual.multiline === expected.multiline &&
2312 actual.lastIndex === expected.lastIndex &&
2313 actual.ignoreCase === expected.ignoreCase;
11524 2314
11525 elem.getElementsByTagName("tbody")[0] || 2315 // 7.4. Other pairs that do not both pass typeof value == 'object',
11526 elem.appendChild( elem.ownerDocument.createElement("tbody") ) : 2316 // equivalence is determined by ==.
11527 elem; 2317 } else if (!util.isObject(actual) && !util.isObject(expected)) {
11528} 2318 return actual == expected;
11529 2319
11530// Replace/restore the type attribute of script elements for safe DOM manipulation 2320 // 7.5 For all other Object pairs, including Array objects, equivalence is
11531function disableScript( elem ) { 2321 // determined by having the same number of owned properties (as verified
11532 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 2322 // with Object.prototype.hasOwnProperty.call), the same set of keys
11533 return elem; 2323 // (although not necessarily the same order), equivalent values for every
2324 // corresponding key, and an identical 'prototype' property. Note: this
2325 // accounts for both named and indexed properties on Arrays.
2326 } else {
2327 return objEquiv(actual, expected);
2328 }
11534} 2329}
11535function restoreScript( elem ) {
11536 var match = rscriptTypeMasked.exec( elem.type );
11537 2330
11538 if ( match ) { 2331function isArguments(object) {
11539 elem.type = match[ 1 ]; 2332 return Object.prototype.toString.call(object) == '[object Arguments]';
11540 } else {
11541 elem.removeAttribute("type");
11542 }
11543
11544 return elem;
11545} 2333}
11546 2334
11547// Mark scripts as having already been evaluated 2335function objEquiv(a, b) {
11548function setGlobalEval( elems, refElements ) { 2336 if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
11549 var i = 0, 2337 return false;
11550 l = elems.length; 2338 // an identical 'prototype' property.
11551 2339 if (a.prototype !== b.prototype) return false;
11552 for ( ; i < l; i++ ) { 2340 // if one is a primitive, the other must be same
11553 data_priv.set( 2341 if (util.isPrimitive(a) || util.isPrimitive(b)) {
11554 elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" ) 2342 return a === b;
11555 ); 2343 }
11556 } 2344 var aIsArgs = isArguments(a),
2345 bIsArgs = isArguments(b);
2346 if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
2347 return false;
2348 if (aIsArgs) {
2349 a = pSlice.call(a);
2350 b = pSlice.call(b);
2351 return _deepEqual(a, b);
2352 }
2353 var ka = objectKeys(a),
2354 kb = objectKeys(b),
2355 key, i;
2356 // having the same number of owned properties (keys incorporates
2357 // hasOwnProperty)
2358 if (ka.length != kb.length)
2359 return false;
2360 //the same set of keys (although not necessarily the same order),
2361 ka.sort();
2362 kb.sort();
2363 //~~~cheap key test
2364 for (i = ka.length - 1; i >= 0; i--) {
2365 if (ka[i] != kb[i])
2366 return false;
2367 }
2368 //equivalent values for every corresponding key, and
2369 //~~~possibly expensive deep test
2370 for (i = ka.length - 1; i >= 0; i--) {
2371 key = ka[i];
2372 if (!_deepEqual(a[key], b[key])) return false;
2373 }
2374 return true;
11557} 2375}
11558 2376
11559function cloneCopyEvent( src, dest ) { 2377// 8. The non-equivalence assertion tests for any deep inequality.
11560 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 2378// assert.notDeepEqual(actual, expected, message_opt);
11561
11562 if ( dest.nodeType !== 1 ) {
11563 return;
11564 }
11565
11566 // 1. Copy private data: events, handlers, etc.
11567 if ( data_priv.hasData( src ) ) {
11568 pdataOld = data_priv.access( src );
11569 pdataCur = data_priv.set( dest, pdataOld );
11570 events = pdataOld.events;
11571
11572 if ( events ) {
11573 delete pdataCur.handle;
11574 pdataCur.events = {};
11575 2379
11576 for ( type in events ) { 2380assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
11577 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 2381 if (_deepEqual(actual, expected)) {
11578 jQuery.event.add( dest, type, events[ type ][ i ] ); 2382 fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
11579 } 2383 }
11580 } 2384};
11581 }
11582 }
11583 2385
11584 // 2. Copy user data 2386// 9. The strict equality assertion tests strict equality, as determined by ===.
11585 if ( data_user.hasData( src ) ) { 2387// assert.strictEqual(actual, expected, message_opt);
11586 udataOld = data_user.access( src );
11587 udataCur = jQuery.extend( {}, udataOld );
11588 2388
11589 data_user.set( dest, udataCur ); 2389assert.strictEqual = function strictEqual(actual, expected, message) {
11590 } 2390 if (actual !== expected) {
11591} 2391 fail(actual, expected, message, '===', assert.strictEqual);
2392 }
2393};
11592 2394
11593function getAll( context, tag ) { 2395// 10. The strict non-equality assertion tests for strict inequality, as
11594 var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) : 2396// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
11595 context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
11596 [];
11597 2397
11598 return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 2398assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
11599 jQuery.merge( [ context ], ret ) : 2399 if (actual === expected) {
11600 ret; 2400 fail(actual, expected, message, '!==', assert.notStrictEqual);
11601} 2401 }
2402};
11602 2403
11603// Support: IE >= 9 2404function expectedException(actual, expected) {
11604function fixInput( src, dest ) { 2405 if (!actual || !expected) {
11605 var nodeName = dest.nodeName.toLowerCase(); 2406 return false;
2407 }
11606 2408
11607 // Fails to persist the checked state of a cloned checkbox or radio button. 2409 if (Object.prototype.toString.call(expected) == '[object RegExp]') {
11608 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 2410 return expected.test(actual);
11609 dest.checked = src.checked; 2411 } else if (actual instanceof expected) {
2412 return true;
2413 } else if (expected.call({}, actual) === true) {
2414 return true;
2415 }
11610 2416
11611 // Fails to return the selected option to the default selected state when cloning options 2417 return false;
11612 } else if ( nodeName === "input" || nodeName === "textarea" ) {
11613 dest.defaultValue = src.defaultValue;
11614 }
11615} 2418}
11616 2419
11617jQuery.extend({ 2420function _throws(shouldThrow, block, expected, message) {
11618 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 2421 var actual;
11619 var i, l, srcElements, destElements,
11620 clone = elem.cloneNode( true ),
11621 inPage = jQuery.contains( elem.ownerDocument, elem );
11622
11623 // Support: IE >= 9
11624 // Fix Cloning issues
11625 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
11626 !jQuery.isXMLDoc( elem ) ) {
11627
11628 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2
11629 destElements = getAll( clone );
11630 srcElements = getAll( elem );
11631
11632 for ( i = 0, l = srcElements.length; i < l; i++ ) {
11633 fixInput( srcElements[ i ], destElements[ i ] );
11634 }
11635 }
11636
11637 // Copy the events from the original to the clone
11638 if ( dataAndEvents ) {
11639 if ( deepDataAndEvents ) {
11640 srcElements = srcElements || getAll( elem );
11641 destElements = destElements || getAll( clone );
11642
11643 for ( i = 0, l = srcElements.length; i < l; i++ ) {
11644 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
11645 }
11646 } else {
11647 cloneCopyEvent( elem, clone );
11648 }
11649 }
11650
11651 // Preserve script evaluation history
11652 destElements = getAll( clone, "script" );
11653 if ( destElements.length > 0 ) {
11654 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
11655 }
11656
11657 // Return the cloned set
11658 return clone;
11659 },
11660
11661 buildFragment: function( elems, context, scripts, selection ) {
11662 var elem, tmp, tag, wrap, contains, j,
11663 fragment = context.createDocumentFragment(),
11664 nodes = [],
11665 i = 0,
11666 l = elems.length;
11667
11668 for ( ; i < l; i++ ) {
11669 elem = elems[ i ];
11670
11671 if ( elem || elem === 0 ) {
11672
11673 // Add nodes directly
11674 if ( jQuery.type( elem ) === "object" ) {
11675 // Support: QtWebKit
11676 // jQuery.merge because push.apply(_, arraylike) throws
11677 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
11678
11679 // Convert non-html into a text node
11680 } else if ( !rhtml.test( elem ) ) {
11681 nodes.push( context.createTextNode( elem ) );
11682
11683 // Convert html into DOM nodes
11684 } else {
11685 tmp = tmp || fragment.appendChild( context.createElement("div") );
11686
11687 // Deserialize a standard representation
11688 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
11689 wrap = wrapMap[ tag ] || wrapMap._default;
11690 tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
11691
11692 // Descend through wrappers to the right content
11693 j = wrap[ 0 ];
11694 while ( j-- ) {
11695 tmp = tmp.lastChild;
11696 }
11697
11698 // Support: QtWebKit
11699 // jQuery.merge because push.apply(_, arraylike) throws
11700 jQuery.merge( nodes, tmp.childNodes );
11701
11702 // Remember the top-level container
11703 tmp = fragment.firstChild;
11704
11705 // Fixes #12346
11706 // Support: Webkit, IE
11707 tmp.textContent = "";
11708 }
11709 }
11710 }
11711
11712 // Remove wrapper from fragment
11713 fragment.textContent = "";
11714
11715 i = 0;
11716 while ( (elem = nodes[ i++ ]) ) {
11717
11718 // #4087 - If origin and destination elements are the same, and this is
11719 // that element, do not do anything
11720 if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
11721 continue;
11722 }
11723
11724 contains = jQuery.contains( elem.ownerDocument, elem );
11725
11726 // Append to fragment
11727 tmp = getAll( fragment.appendChild( elem ), "script" );
11728
11729 // Preserve script evaluation history
11730 if ( contains ) {
11731 setGlobalEval( tmp );
11732 }
11733
11734 // Capture executables
11735 if ( scripts ) {
11736 j = 0;
11737 while ( (elem = tmp[ j++ ]) ) {
11738 if ( rscriptType.test( elem.type || "" ) ) {
11739 scripts.push( elem );
11740 }
11741 }
11742 }
11743 }
11744
11745 return fragment;
11746 },
11747
11748 cleanData: function( elems ) {
11749 var data, elem, type, key,
11750 special = jQuery.event.special,
11751 i = 0;
11752
11753 for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
11754 if ( jQuery.acceptData( elem ) ) {
11755 key = elem[ data_priv.expando ];
11756
11757 if ( key && (data = data_priv.cache[ key ]) ) {
11758 if ( data.events ) {
11759 for ( type in data.events ) {
11760 if ( special[ type ] ) {
11761 jQuery.event.remove( elem, type );
11762
11763 // This is a shortcut to avoid jQuery.event.remove's overhead
11764 } else {
11765 jQuery.removeEvent( elem, type, data.handle );
11766 }
11767 }
11768 }
11769 if ( data_priv.cache[ key ] ) {
11770 // Discard any remaining `private` data
11771 delete data_priv.cache[ key ];
11772 }
11773 }
11774 }
11775 // Discard any remaining `user` data
11776 delete data_user.cache[ elem[ data_user.expando ] ];
11777 }
11778 }
11779});
11780
11781jQuery.fn.extend({
11782 text: function( value ) {
11783 return access( this, function( value ) {
11784 return value === undefined ?
11785 jQuery.text( this ) :
11786 this.empty().each(function() {
11787 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11788 this.textContent = value;
11789 }
11790 });
11791 }, null, value, arguments.length );
11792 },
11793
11794 append: function() {
11795 return this.domManip( arguments, function( elem ) {
11796 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11797 var target = manipulationTarget( this, elem );
11798 target.appendChild( elem );
11799 }
11800 });
11801 },
11802
11803 prepend: function() {
11804 return this.domManip( arguments, function( elem ) {
11805 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
11806 var target = manipulationTarget( this, elem );
11807 target.insertBefore( elem, target.firstChild );
11808 }
11809 });
11810 },
11811
11812 before: function() {
11813 return this.domManip( arguments, function( elem ) {
11814 if ( this.parentNode ) {
11815 this.parentNode.insertBefore( elem, this );
11816 }
11817 });
11818 },
11819
11820 after: function() {
11821 return this.domManip( arguments, function( elem ) {
11822 if ( this.parentNode ) {
11823 this.parentNode.insertBefore( elem, this.nextSibling );
11824 }
11825 });
11826 },
11827
11828 remove: function( selector, keepData /* Internal Use Only */ ) {
11829 var elem,
11830 elems = selector ? jQuery.filter( selector, this ) : this,
11831 i = 0;
11832
11833 for ( ; (elem = elems[i]) != null; i++ ) {
11834 if ( !keepData && elem.nodeType === 1 ) {
11835 jQuery.cleanData( getAll( elem ) );
11836 }
11837
11838 if ( elem.parentNode ) {
11839 if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
11840 setGlobalEval( getAll( elem, "script" ) );
11841 }
11842 elem.parentNode.removeChild( elem );
11843 }
11844 }
11845
11846 return this;
11847 },
11848
11849 empty: function() {
11850 var elem,
11851 i = 0;
11852
11853 for ( ; (elem = this[i]) != null; i++ ) {
11854 if ( elem.nodeType === 1 ) {
11855
11856 // Prevent memory leaks
11857 jQuery.cleanData( getAll( elem, false ) );
11858
11859 // Remove any remaining nodes
11860 elem.textContent = "";
11861 }
11862 }
11863
11864 return this;
11865 },
11866
11867 clone: function( dataAndEvents, deepDataAndEvents ) {
11868 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
11869 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
11870
11871 return this.map(function() {
11872 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
11873 });
11874 },
11875
11876 html: function( value ) {
11877 return access( this, function( value ) {
11878 var elem = this[ 0 ] || {},
11879 i = 0,
11880 l = this.length;
11881
11882 if ( value === undefined && elem.nodeType === 1 ) {
11883 return elem.innerHTML;
11884 }
11885
11886 // See if we can take a shortcut and just use innerHTML
11887 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
11888 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
11889
11890 value = value.replace( rxhtmlTag, "<$1></$2>" );
11891
11892 try {
11893 for ( ; i < l; i++ ) {
11894 elem = this[ i ] || {};
11895
11896 // Remove element nodes and prevent memory leaks
11897 if ( elem.nodeType === 1 ) {
11898 jQuery.cleanData( getAll( elem, false ) );
11899 elem.innerHTML = value;
11900 }
11901 }
11902
11903 elem = 0;
11904
11905 // If using innerHTML throws an exception, use the fallback method
11906 } catch( e ) {}
11907 }
11908 2422
11909 if ( elem ) { 2423 if (util.isString(expected)) {
11910 this.empty().append( value ); 2424 message = expected;
11911 } 2425 expected = null;
11912 }, null, value, arguments.length ); 2426 }
11913 },
11914 2427
11915 replaceWith: function() { 2428 try {
11916 var arg = arguments[ 0 ]; 2429 block();
2430 } catch (e) {
2431 actual = e;
2432 }
11917 2433
11918 // Make the changes, replacing each context element with the new content 2434 message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
11919 this.domManip( arguments, function( elem ) { 2435 (message ? ' ' + message : '.');
11920 arg = this.parentNode;
11921 2436
11922 jQuery.cleanData( getAll( this ) ); 2437 if (shouldThrow && !actual) {
2438 fail(actual, expected, 'Missing expected exception' + message);
2439 }
11923 2440
11924 if ( arg ) { 2441 if (!shouldThrow && expectedException(actual, expected)) {
11925 arg.replaceChild( elem, this ); 2442 fail(actual, expected, 'Got unwanted exception' + message);
11926 } 2443 }
11927 });
11928 2444
11929 // Force removal if there was no new content (e.g., from empty arguments) 2445 if ((shouldThrow && actual && expected &&
11930 return arg && (arg.length || arg.nodeType) ? this : this.remove(); 2446 !expectedException(actual, expected)) || (!shouldThrow && actual)) {
11931 }, 2447 throw actual;
2448 }
2449}
11932 2450
11933 detach: function( selector ) { 2451// 11. Expected to throw an error:
11934 return this.remove( selector, true ); 2452// assert.throws(block, Error_opt, message_opt);
11935 },
11936 2453
11937 domManip: function( args, callback ) { 2454assert.throws = function(block, /*optional*/error, /*optional*/message) {
11938 2455 _throws.apply(this, [true].concat(pSlice.call(arguments)));
11939 // Flatten any nested arrays 2456};
11940 args = concat.apply( [], args );
11941
11942 var fragment, first, scripts, hasScripts, node, doc,
11943 i = 0,
11944 l = this.length,
11945 set = this,
11946 iNoClone = l - 1,
11947 value = args[ 0 ],
11948 isFunction = jQuery.isFunction( value );
11949
11950 // We can't cloneNode fragments that contain checked, in WebKit
11951 if ( isFunction ||
11952 ( l > 1 && typeof value === "string" &&
11953 !support.checkClone && rchecked.test( value ) ) ) {
11954 return this.each(function( index ) {
11955 var self = set.eq( index );
11956 if ( isFunction ) {
11957 args[ 0 ] = value.call( this, index, self.html() );
11958 }
11959 self.domManip( args, callback );
11960 });
11961 }
11962 2457
11963 if ( l ) { 2458// EXTENSION! This is annoying to write outside this module.
11964 fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); 2459assert.doesNotThrow = function(block, /*optional*/message) {
11965 first = fragment.firstChild; 2460 _throws.apply(this, [false].concat(pSlice.call(arguments)));
2461};
11966 2462
11967 if ( fragment.childNodes.length === 1 ) { 2463assert.ifError = function(err) { if (err) {throw err;}};
11968 fragment = first;
11969 }
11970 2464
11971 if ( first ) { 2465var objectKeys = Object.keys || function (obj) {
11972 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 2466 var keys = [];
11973 hasScripts = scripts.length; 2467 for (var key in obj) {
11974 2468 if (hasOwn.call(obj, key)) keys.push(key);
11975 // Use the original fragment for the last item instead of the first because it can end up 2469 }
11976 // being emptied incorrectly in certain situations (#8070). 2470 return keys;
11977 for ( ; i < l; i++ ) { 2471};
11978 node = fragment;
11979
11980 if ( i !== iNoClone ) {
11981 node = jQuery.clone( node, true, true );
11982
11983 // Keep references to cloned scripts for later restoration
11984 if ( hasScripts ) {
11985 // Support: QtWebKit
11986 // jQuery.merge because push.apply(_, arraylike) throws
11987 jQuery.merge( scripts, getAll( node, "script" ) );
11988 }
11989 }
11990
11991 callback.call( this[ i ], node, i );
11992 }
11993
11994 if ( hasScripts ) {
11995 doc = scripts[ scripts.length - 1 ].ownerDocument;
11996
11997 // Reenable scripts
11998 jQuery.map( scripts, restoreScript );
11999
12000 // Evaluate executable scripts on first document insertion
12001 for ( i = 0; i < hasScripts; i++ ) {
12002 node = scripts[ i ];
12003 if ( rscriptType.test( node.type || "" ) &&
12004 !data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
12005
12006 if ( node.src ) {
12007 // Optional AJAX dependency, but won't run scripts if not present
12008 if ( jQuery._evalUrl ) {
12009 jQuery._evalUrl( node.src );
12010 }
12011 } else {
12012 jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
12013 }
12014 }
12015 }
12016 }
12017 }
12018 }
12019 2472
12020 return this; 2473},{"util/":29}],6:[function(require,module,exports){
12021 }
12022});
12023 2474
12024jQuery.each({ 2475},{}],7:[function(require,module,exports){
12025 appendTo: "append", 2476/*!
12026 prependTo: "prepend", 2477 * The buffer module from node.js, for the browser.
12027 insertBefore: "before", 2478 *
12028 insertAfter: "after", 2479 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
12029 replaceAll: "replaceWith" 2480 * @license MIT
12030}, function( name, original ) { 2481 */
12031 jQuery.fn[ name ] = function( selector ) {
12032 var elems,
12033 ret = [],
12034 insert = jQuery( selector ),
12035 last = insert.length - 1,
12036 i = 0;
12037
12038 for ( ; i <= last; i++ ) {
12039 elems = i === last ? this : this.clone( true );
12040 jQuery( insert[ i ] )[ original ]( elems );
12041
12042 // Support: QtWebKit
12043 // .get() because push.apply(_, arraylike) throws
12044 push.apply( ret, elems.get() );
12045 }
12046 2482
12047 return this.pushStack( ret ); 2483var base64 = require('base64-js')
12048 }; 2484var ieee754 = require('ieee754')
12049}); 2485var isArray = require('is-array')
12050 2486
2487exports.Buffer = Buffer
2488exports.SlowBuffer = SlowBuffer
2489exports.INSPECT_MAX_BYTES = 50
2490Buffer.poolSize = 8192 // not used by this implementation
12051 2491
12052var iframe, 2492var rootParent = {}
12053 elemdisplay = {};
12054 2493
12055/** 2494/**
12056 * Retrieve the actual display of a element 2495 * If `Buffer.TYPED_ARRAY_SUPPORT`:
12057 * @param {String} name nodeName of the element 2496 * === true Use Uint8Array implementation (fastest)
12058 * @param {Object} doc Document object 2497 * === false Use Object implementation (most compatible, even IE6)
12059 */ 2498 *
12060// Called only from within defaultDisplay 2499 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
12061function actualDisplay( name, doc ) { 2500 * Opera 11.6+, iOS 4.2+.
12062 var style, 2501 *
12063 elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), 2502 * Due to various browser bugs, sometimes the Object implementation will be used even
12064 2503 * when the browser supports typed arrays.
12065 // getDefaultComputedStyle might be reliably used only on attached element 2504 *
12066 display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? 2505 * Note:
12067 2506 *
12068 // Use of this method is a temporary fix (more like optmization) until something better comes along, 2507 * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
12069 // since it was removed from specification and supported only in FF 2508 * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
12070 style.display : jQuery.css( elem[ 0 ], "display" ); 2509 *
2510 * - Safari 5-7 lacks support for changing the `Object.prototype.constructor` property
2511 * on objects.
2512 *
2513 * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
2514 *
2515 * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
2516 * incorrect length in some situations.
12071 2517
12072 // We don't have any data stored on the element, 2518 * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
12073 // so use "detach" method as fast way to get rid of the element 2519 * get the Object implementation, which is slower but behaves correctly.
12074 elem.detach(); 2520 */
2521Buffer.TYPED_ARRAY_SUPPORT = (function () {
2522 function Bar () {}
2523 try {
2524 var arr = new Uint8Array(1)
2525 arr.foo = function () { return 42 }
2526 arr.constructor = Bar
2527 return arr.foo() === 42 && // typed array instances can be augmented
2528 arr.constructor === Bar && // constructor can be set
2529 typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
2530 arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
2531 } catch (e) {
2532 return false
2533 }
2534})()
12075 2535
12076 return display; 2536function kMaxLength () {
2537 return Buffer.TYPED_ARRAY_SUPPORT
2538 ? 0x7fffffff
2539 : 0x3fffffff
12077} 2540}
12078 2541
12079/** 2542/**
12080 * Try to determine the default display value of an element 2543 * Class: Buffer
12081 * @param {String} nodeName 2544 * =============
2545 *
2546 * The Buffer constructor returns instances of `Uint8Array` that are augmented
2547 * with function properties for all the node `Buffer` API functions. We use
2548 * `Uint8Array` so that square bracket notation works as expected -- it returns
2549 * a single octet.
2550 *
2551 * By augmenting the instances, we can avoid modifying the `Uint8Array`
2552 * prototype.
12082 */ 2553 */
12083function defaultDisplay( nodeName ) { 2554function Buffer (arg) {
12084 var doc = document, 2555 if (!(this instanceof Buffer)) {
12085 display = elemdisplay[ nodeName ]; 2556 // Avoid going through an ArgumentsAdaptorTrampoline in the common case.
12086 2557 if (arguments.length > 1) return new Buffer(arg, arguments[1])
12087 if ( !display ) { 2558 return new Buffer(arg)
12088 display = actualDisplay( nodeName, doc ); 2559 }
12089
12090 // If the simple way fails, read from inside an iframe
12091 if ( display === "none" || !display ) {
12092
12093 // Use the already-created iframe if possible
12094 iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
12095
12096 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
12097 doc = iframe[ 0 ].contentDocument;
12098 2560
12099 // Support: IE 2561 this.length = 0
12100 doc.write(); 2562 this.parent = undefined
12101 doc.close();
12102 2563
12103 display = actualDisplay( nodeName, doc ); 2564 // Common case.
12104 iframe.detach(); 2565 if (typeof arg === 'number') {
12105 } 2566 return fromNumber(this, arg)
2567 }
12106 2568
12107 // Store the correct default display 2569 // Slightly less common case.
12108 elemdisplay[ nodeName ] = display; 2570 if (typeof arg === 'string') {
12109 } 2571 return fromString(this, arg, arguments.length > 1 ? arguments[1] : 'utf8')
2572 }
12110 2573
12111 return display; 2574 // Unusual.
2575 return fromObject(this, arg)
12112} 2576}
12113var rmargin = (/^margin/);
12114
12115var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
12116 2577
12117var getStyles = function( elem ) { 2578function fromNumber (that, length) {
12118 return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); 2579 that = allocate(that, length < 0 ? 0 : checked(length) | 0)
12119 }; 2580 if (!Buffer.TYPED_ARRAY_SUPPORT) {
12120 2581 for (var i = 0; i < length; i++) {
12121 2582 that[i] = 0
12122
12123function curCSS( elem, name, computed ) {
12124 var width, minWidth, maxWidth, ret,
12125 style = elem.style;
12126
12127 computed = computed || getStyles( elem );
12128
12129 // Support: IE9
12130 // getPropertyValue is only needed for .css('filter') in IE9, see #12537
12131 if ( computed ) {
12132 ret = computed.getPropertyValue( name ) || computed[ name ];
12133 } 2583 }
12134 2584 }
12135 if ( computed ) { 2585 return that
12136
12137 if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
12138 ret = jQuery.style( elem, name );
12139 }
12140
12141 // Support: iOS < 6
12142 // A tribute to the "awesome hack by Dean Edwards"
12143 // iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
12144 // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
12145 if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
12146
12147 // Remember the original values
12148 width = style.width;
12149 minWidth = style.minWidth;
12150 maxWidth = style.maxWidth;
12151
12152 // Put in the new values to get a computed value out
12153 style.minWidth = style.maxWidth = style.width = ret;
12154 ret = computed.width;
12155
12156 // Revert the changed values
12157 style.width = width;
12158 style.minWidth = minWidth;
12159 style.maxWidth = maxWidth;
12160 }
12161 }
12162
12163 return ret !== undefined ?
12164 // Support: IE
12165 // IE returns zIndex value as an integer.
12166 ret + "" :
12167 ret;
12168} 2586}
12169 2587
2588function fromString (that, string, encoding) {
2589 if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
12170 2590
12171function addGetHookIf( conditionFn, hookFn ) { 2591 // Assumption: byteLength() return value is always < kMaxLength.
12172 // Define the hook, we'll check on the first run if it's really needed. 2592 var length = byteLength(string, encoding) | 0
12173 return { 2593 that = allocate(that, length)
12174 get: function() {
12175 if ( conditionFn() ) {
12176 // Hook not needed (or it's not possible to use it due to missing dependency),
12177 // remove it.
12178 // Since there are no other hooks for marginRight, remove the whole object.
12179 delete this.get;
12180 return;
12181 }
12182
12183 // Hook needed; redefine it so that the support test is not executed again.
12184 2594
12185 return (this.get = hookFn).apply( this, arguments ); 2595 that.write(string, encoding)
12186 } 2596 return that
12187 };
12188} 2597}
12189 2598
2599function fromObject (that, object) {
2600 if (Buffer.isBuffer(object)) return fromBuffer(that, object)
12190 2601
12191(function() { 2602 if (isArray(object)) return fromArray(that, object)
12192 var pixelPositionVal, boxSizingReliableVal,
12193 docElem = document.documentElement,
12194 container = document.createElement( "div" ),
12195 div = document.createElement( "div" );
12196 2603
12197 if ( !div.style ) { 2604 if (object == null) {
12198 return; 2605 throw new TypeError('must start with number, buffer, array or string')
12199 } 2606 }
12200 2607
12201 div.style.backgroundClip = "content-box"; 2608 if (typeof ArrayBuffer !== 'undefined') {
12202 div.cloneNode( true ).style.backgroundClip = ""; 2609 if (object.buffer instanceof ArrayBuffer) {
12203 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 2610 return fromTypedArray(that, object)
12204
12205 container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
12206 "position:absolute";
12207 container.appendChild( div );
12208
12209 // Executing both pixelPosition & boxSizingReliable tests require only one layout
12210 // so they're executed at the same time to save the second computation.
12211 function computePixelPositionAndBoxSizingReliable() {
12212 div.style.cssText =
12213 // Support: Firefox<29, Android 2.3
12214 // Vendor-prefix box-sizing
12215 "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
12216 "box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
12217 "border:1px;padding:1px;width:4px;position:absolute";
12218 div.innerHTML = "";
12219 docElem.appendChild( container );
12220
12221 var divStyle = window.getComputedStyle( div, null );
12222 pixelPositionVal = divStyle.top !== "1%";
12223 boxSizingReliableVal = divStyle.width === "4px";
12224
12225 docElem.removeChild( container );
12226 } 2611 }
12227 2612 if (object instanceof ArrayBuffer) {
12228 // Support: node.js jsdom 2613 return fromArrayBuffer(that, object)
12229 // Don't assume that getComputedStyle is a property of the global object
12230 if ( window.getComputedStyle ) {
12231 jQuery.extend( support, {
12232 pixelPosition: function() {
12233 // This test is executed only once but we still do memoizing
12234 // since we can use the boxSizingReliable pre-computing.
12235 // No need to check if the test was already performed, though.
12236 computePixelPositionAndBoxSizingReliable();
12237 return pixelPositionVal;
12238 },
12239 boxSizingReliable: function() {
12240 if ( boxSizingReliableVal == null ) {
12241 computePixelPositionAndBoxSizingReliable();
12242 }
12243 return boxSizingReliableVal;
12244 },
12245 reliableMarginRight: function() {
12246 // Support: Android 2.3
12247 // Check if div with explicit width and no margin-right incorrectly
12248 // gets computed margin-right based on width of container. (#3333)
12249 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
12250 // This support function is only executed once so no memoizing is needed.
12251 var ret,
12252 marginDiv = div.appendChild( document.createElement( "div" ) );
12253
12254 // Reset CSS: box-sizing; display; margin; border; padding
12255 marginDiv.style.cssText = div.style.cssText =
12256 // Support: Firefox<29, Android 2.3
12257 // Vendor-prefix box-sizing
12258 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
12259 "box-sizing:content-box;display:block;margin:0;border:0;padding:0";
12260 marginDiv.style.marginRight = marginDiv.style.width = "0";
12261 div.style.width = "1px";
12262 docElem.appendChild( container );
12263
12264 ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
12265
12266 docElem.removeChild( container );
12267
12268 return ret;
12269 }
12270 });
12271 } 2614 }
12272})(); 2615 }
12273
12274
12275// A method for quickly swapping in/out CSS properties to get correct calculations.
12276jQuery.swap = function( elem, options, callback, args ) {
12277 var ret, name,
12278 old = {};
12279 2616
12280 // Remember the old values, and insert the new ones 2617 if (object.length) return fromArrayLike(that, object)
12281 for ( name in options ) {
12282 old[ name ] = elem.style[ name ];
12283 elem.style[ name ] = options[ name ];
12284 }
12285 2618
12286 ret = callback.apply( elem, args || [] ); 2619 return fromJsonObject(that, object)
2620}
12287 2621
12288 // Revert the old values 2622function fromBuffer (that, buffer) {
12289 for ( name in options ) { 2623 var length = checked(buffer.length) | 0
12290 elem.style[ name ] = old[ name ]; 2624 that = allocate(that, length)
12291 } 2625 buffer.copy(that, 0, 0, length)
2626 return that
2627}
12292 2628
12293 return ret; 2629function fromArray (that, array) {
12294}; 2630 var length = checked(array.length) | 0
2631 that = allocate(that, length)
2632 for (var i = 0; i < length; i += 1) {
2633 that[i] = array[i] & 255
2634 }
2635 return that
2636}
12295 2637
2638// Duplicate of fromArray() to keep fromArray() monomorphic.
2639function fromTypedArray (that, array) {
2640 var length = checked(array.length) | 0
2641 that = allocate(that, length)
2642 // Truncating the elements is probably not what people expect from typed
2643 // arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
2644 // of the old Buffer constructor.
2645 for (var i = 0; i < length; i += 1) {
2646 that[i] = array[i] & 255
2647 }
2648 return that
2649}
12296 2650
12297var 2651function fromArrayBuffer (that, array) {
12298 // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" 2652 if (Buffer.TYPED_ARRAY_SUPPORT) {
12299 // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 2653 // Return an augmented `Uint8Array` instance, for best performance
12300 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 2654 array.byteLength
12301 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), 2655 that = Buffer._augment(new Uint8Array(array))
12302 rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), 2656 } else {
2657 // Fallback: Return an object instance of the Buffer class
2658 that = fromTypedArray(that, new Uint8Array(array))
2659 }
2660 return that
2661}
12303 2662
12304 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 2663function fromArrayLike (that, array) {
12305 cssNormalTransform = { 2664 var length = checked(array.length) | 0
12306 letterSpacing: "0", 2665 that = allocate(that, length)
12307 fontWeight: "400" 2666 for (var i = 0; i < length; i += 1) {
12308 }, 2667 that[i] = array[i] & 255
2668 }
2669 return that
2670}
12309 2671
12310 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; 2672// Deserialize { type: 'Buffer', data: [1,2,3,...] } into a Buffer object.
2673// Returns a zero-length buffer for inputs that don't conform to the spec.
2674function fromJsonObject (that, object) {
2675 var array
2676 var length = 0
12311 2677
12312// return a css property mapped to a potentially vendor prefixed property 2678 if (object.type === 'Buffer' && isArray(object.data)) {
12313function vendorPropName( style, name ) { 2679 array = object.data
2680 length = checked(array.length) | 0
2681 }
2682 that = allocate(that, length)
12314 2683
12315 // shortcut for names that are not vendor prefixed 2684 for (var i = 0; i < length; i += 1) {
12316 if ( name in style ) { 2685 that[i] = array[i] & 255
12317 return name; 2686 }
12318 } 2687 return that
2688}
12319 2689
12320 // check for vendor prefixed names 2690function allocate (that, length) {
12321 var capName = name[0].toUpperCase() + name.slice(1), 2691 if (Buffer.TYPED_ARRAY_SUPPORT) {
12322 origName = name, 2692 // Return an augmented `Uint8Array` instance, for best performance
12323 i = cssPrefixes.length; 2693 that = Buffer._augment(new Uint8Array(length))
2694 } else {
2695 // Fallback: Return an object instance of the Buffer class
2696 that.length = length
2697 that._isBuffer = true
2698 }
12324 2699
12325 while ( i-- ) { 2700 var fromPool = length !== 0 && length <= Buffer.poolSize >>> 1
12326 name = cssPrefixes[ i ] + capName; 2701 if (fromPool) that.parent = rootParent
12327 if ( name in style ) {
12328 return name;
12329 }
12330 }
12331 2702
12332 return origName; 2703 return that
12333} 2704}
12334 2705
12335function setPositiveNumber( elem, value, subtract ) { 2706function checked (length) {
12336 var matches = rnumsplit.exec( value ); 2707 // Note: cannot use `length < kMaxLength` here because that fails when
12337 return matches ? 2708 // length is NaN (which is otherwise coerced to zero.)
12338 // Guard against undefined "subtract", e.g., when used as in cssHooks 2709 if (length >= kMaxLength()) {
12339 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : 2710 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
12340 value; 2711 'size: 0x' + kMaxLength().toString(16) + ' bytes')
2712 }
2713 return length | 0
12341} 2714}
12342 2715
12343function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 2716function SlowBuffer (subject, encoding) {
12344 var i = extra === ( isBorderBox ? "border" : "content" ) ? 2717 if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
12345 // If we already have the right measurement, avoid augmentation
12346 4 :
12347 // Otherwise initialize for horizontal or vertical properties
12348 name === "width" ? 1 : 0,
12349 2718
12350 val = 0; 2719 var buf = new Buffer(subject, encoding)
12351 2720 delete buf.parent
12352 for ( ; i < 4; i += 2 ) { 2721 return buf
12353 // both box models exclude margin, so add it if we want it 2722}
12354 if ( extra === "margin" ) {
12355 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
12356 }
12357
12358 if ( isBorderBox ) {
12359 // border-box includes padding, so remove it if we want content
12360 if ( extra === "content" ) {
12361 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
12362 }
12363
12364 // at this point, extra isn't border nor margin, so remove border
12365 if ( extra !== "margin" ) {
12366 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
12367 }
12368 } else {
12369 // at this point, extra isn't content, so add padding
12370 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
12371
12372 // at this point, extra isn't content nor padding, so add border
12373 if ( extra !== "padding" ) {
12374 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
12375 }
12376 }
12377 }
12378 2723
12379 return val; 2724Buffer.isBuffer = function isBuffer (b) {
2725 return !!(b != null && b._isBuffer)
12380} 2726}
12381 2727
12382function getWidthOrHeight( elem, name, extra ) { 2728Buffer.compare = function compare (a, b) {
2729 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
2730 throw new TypeError('Arguments must be Buffers')
2731 }
12383 2732
12384 // Start with offset property, which is equivalent to the border-box value 2733 if (a === b) return 0
12385 var valueIsBorderBox = true,
12386 val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
12387 styles = getStyles( elem ),
12388 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
12389 2734
12390 // some non-html elements return undefined for offsetWidth, so check for null/undefined 2735 var x = a.length
12391 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 2736 var y = b.length
12392 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
12393 if ( val <= 0 || val == null ) {
12394 // Fall back to computed then uncomputed css if necessary
12395 val = curCSS( elem, name, styles );
12396 if ( val < 0 || val == null ) {
12397 val = elem.style[ name ];
12398 }
12399 2737
12400 // Computed unit is not pixels. Stop here and return. 2738 var i = 0
12401 if ( rnumnonpx.test(val) ) { 2739 var len = Math.min(x, y)
12402 return val; 2740 while (i < len) {
12403 } 2741 if (a[i] !== b[i]) break
12404 2742
12405 // we need the check for style in case a browser which returns unreliable values 2743 ++i
12406 // for getComputedStyle silently falls back to the reliable elem.style 2744 }
12407 valueIsBorderBox = isBorderBox &&
12408 ( support.boxSizingReliable() || val === elem.style[ name ] );
12409 2745
12410 // Normalize "", auto, and prepare for extra 2746 if (i !== len) {
12411 val = parseFloat( val ) || 0; 2747 x = a[i]
12412 } 2748 y = b[i]
2749 }
12413 2750
12414 // use the active box-sizing model to add/subtract irrelevant styles 2751 if (x < y) return -1
12415 return ( val + 2752 if (y < x) return 1
12416 augmentWidthOrHeight( 2753 return 0
12417 elem, 2754}
12418 name,
12419 extra || ( isBorderBox ? "border" : "content" ),
12420 valueIsBorderBox,
12421 styles
12422 )
12423 ) + "px";
12424}
12425
12426function showHide( elements, show ) {
12427 var display, elem, hidden,
12428 values = [],
12429 index = 0,
12430 length = elements.length;
12431
12432 for ( ; index < length; index++ ) {
12433 elem = elements[ index ];
12434 if ( !elem.style ) {
12435 continue;
12436 }
12437 2755
12438 values[ index ] = data_priv.get( elem, "olddisplay" ); 2756Buffer.isEncoding = function isEncoding (encoding) {
12439 display = elem.style.display; 2757 switch (String(encoding).toLowerCase()) {
12440 if ( show ) { 2758 case 'hex':
12441 // Reset the inline display of this element to learn if it is 2759 case 'utf8':
12442 // being hidden by cascaded rules or not 2760 case 'utf-8':
12443 if ( !values[ index ] && display === "none" ) { 2761 case 'ascii':
12444 elem.style.display = ""; 2762 case 'binary':
12445 } 2763 case 'base64':
2764 case 'raw':
2765 case 'ucs2':
2766 case 'ucs-2':
2767 case 'utf16le':
2768 case 'utf-16le':
2769 return true
2770 default:
2771 return false
2772 }
2773}
12446 2774
12447 // Set elements which have been overridden with display: none 2775Buffer.concat = function concat (list, length) {
12448 // in a stylesheet to whatever the default browser style is 2776 if (!isArray(list)) throw new TypeError('list argument must be an Array of Buffers.')
12449 // for such an element
12450 if ( elem.style.display === "" && isHidden( elem ) ) {
12451 values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
12452 }
12453 } else {
12454 hidden = isHidden( elem );
12455 2777
12456 if ( display !== "none" || !hidden ) { 2778 if (list.length === 0) {
12457 data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); 2779 return new Buffer(0)
12458 } 2780 }
12459 }
12460 }
12461 2781
12462 // Set the display of most of the elements in a second loop 2782 var i
12463 // to avoid the constant reflow 2783 if (length === undefined) {
12464 for ( index = 0; index < length; index++ ) { 2784 length = 0
12465 elem = elements[ index ]; 2785 for (i = 0; i < list.length; i++) {
12466 if ( !elem.style ) { 2786 length += list[i].length
12467 continue;
12468 }
12469 if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
12470 elem.style.display = show ? values[ index ] || "" : "none";
12471 }
12472 } 2787 }
2788 }
12473 2789
12474 return elements; 2790 var buf = new Buffer(length)
2791 var pos = 0
2792 for (i = 0; i < list.length; i++) {
2793 var item = list[i]
2794 item.copy(buf, pos)
2795 pos += item.length
2796 }
2797 return buf
12475} 2798}
12476 2799
12477jQuery.extend({ 2800function byteLength (string, encoding) {
12478 // Add in style property hooks for overriding the default 2801 if (typeof string !== 'string') string = '' + string
12479 // behavior of getting and setting a style property 2802
12480 cssHooks: { 2803 var len = string.length
12481 opacity: { 2804 if (len === 0) return 0
12482 get: function( elem, computed ) { 2805
12483 if ( computed ) { 2806 // Use a for loop to avoid recursion
12484 // We should always get a number back from opacity 2807 var loweredCase = false
12485 var ret = curCSS( elem, "opacity" ); 2808 for (;;) {
12486 return ret === "" ? "1" : ret; 2809 switch (encoding) {
12487 } 2810 case 'ascii':
12488 } 2811 case 'binary':
12489 } 2812 // Deprecated
12490 }, 2813 case 'raw':
12491 2814 case 'raws':
12492 // Don't automatically add "px" to these possibly-unitless properties 2815 return len
12493 cssNumber: { 2816 case 'utf8':
12494 "columnCount": true, 2817 case 'utf-8':
12495 "fillOpacity": true, 2818 return utf8ToBytes(string).length
12496 "flexGrow": true, 2819 case 'ucs2':
12497 "flexShrink": true, 2820 case 'ucs-2':
12498 "fontWeight": true, 2821 case 'utf16le':
12499 "lineHeight": true, 2822 case 'utf-16le':
12500 "opacity": true, 2823 return len * 2
12501 "order": true, 2824 case 'hex':
12502 "orphans": true, 2825 return len >>> 1
12503 "widows": true, 2826 case 'base64':
12504 "zIndex": true, 2827 return base64ToBytes(string).length
12505 "zoom": true 2828 default:
12506 }, 2829 if (loweredCase) return utf8ToBytes(string).length // assume utf8
12507 2830 encoding = ('' + encoding).toLowerCase()
12508 // Add in properties whose names you wish to fix before 2831 loweredCase = true
12509 // setting or getting the value
12510 cssProps: {
12511 // normalize float css property
12512 "float": "cssFloat"
12513 },
12514
12515 // Get and set the style property on a DOM Node
12516 style: function( elem, name, value, extra ) {
12517 // Don't set styles on text and comment nodes
12518 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
12519 return;
12520 }
12521
12522 // Make sure that we're working with the right name
12523 var ret, type, hooks,
12524 origName = jQuery.camelCase( name ),
12525 style = elem.style;
12526
12527 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
12528
12529 // gets hook for the prefixed version
12530 // followed by the unprefixed version
12531 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
12532
12533 // Check if we're setting a value
12534 if ( value !== undefined ) {
12535 type = typeof value;
12536
12537 // convert relative number strings (+= or -=) to relative numbers. #7345
12538 if ( type === "string" && (ret = rrelNum.exec( value )) ) {
12539 value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
12540 // Fixes bug #9237
12541 type = "number";
12542 }
12543
12544 // Make sure that null and NaN values aren't set. See: #7116
12545 if ( value == null || value !== value ) {
12546 return;
12547 }
12548
12549 // If a number was passed in, add 'px' to the (except for certain CSS properties)
12550 if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
12551 value += "px";
12552 }
12553
12554 // Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
12555 // but it would mean to define eight (for every problematic property) identical functions
12556 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
12557 style[ name ] = "inherit";
12558 }
12559
12560 // If a hook was provided, use that value, otherwise just set the specified value
12561 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
12562 style[ name ] = value;
12563 }
12564
12565 } else {
12566 // If a hook was provided get the non-computed value from there
12567 if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
12568 return ret;
12569 }
12570
12571 // Otherwise just get the value from the style object
12572 return style[ name ];
12573 }
12574 },
12575
12576 css: function( elem, name, extra, styles ) {
12577 var val, num, hooks,
12578 origName = jQuery.camelCase( name );
12579
12580 // Make sure that we're working with the right name
12581 name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
12582
12583 // gets hook for the prefixed version
12584 // followed by the unprefixed version
12585 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
12586
12587 // If a hook was provided get the computed value from there
12588 if ( hooks && "get" in hooks ) {
12589 val = hooks.get( elem, true, extra );
12590 }
12591
12592 // Otherwise, if a way to get the computed value exists, use that
12593 if ( val === undefined ) {
12594 val = curCSS( elem, name, styles );
12595 }
12596
12597 //convert "normal" to computed value
12598 if ( val === "normal" && name in cssNormalTransform ) {
12599 val = cssNormalTransform[ name ];
12600 }
12601
12602 // Return, converting to number if forced or a qualifier was provided and val looks numeric
12603 if ( extra === "" || extra ) {
12604 num = parseFloat( val );
12605 return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
12606 }
12607 return val;
12608 } 2832 }
12609}); 2833 }
2834}
2835Buffer.byteLength = byteLength
12610 2836
12611jQuery.each([ "height", "width" ], function( i, name ) { 2837// pre-set for values that may exist in the future
12612 jQuery.cssHooks[ name ] = { 2838Buffer.prototype.length = undefined
12613 get: function( elem, computed, extra ) { 2839Buffer.prototype.parent = undefined
12614 if ( computed ) {
12615 // certain elements can have dimension info if we invisibly show them
12616 // however, it must have a current display style that would benefit from this
12617 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
12618 jQuery.swap( elem, cssShow, function() {
12619 return getWidthOrHeight( elem, name, extra );
12620 }) :
12621 getWidthOrHeight( elem, name, extra );
12622 }
12623 },
12624 2840
12625 set: function( elem, value, extra ) { 2841function slowToString (encoding, start, end) {
12626 var styles = extra && getStyles( elem ); 2842 var loweredCase = false
12627 return setPositiveNumber( elem, value, extra ?
12628 augmentWidthOrHeight(
12629 elem,
12630 name,
12631 extra,
12632 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
12633 styles
12634 ) : 0
12635 );
12636 }
12637 };
12638});
12639 2843
12640// Support: Android 2.3 2844 start = start | 0
12641jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 2845 end = end === undefined || end === Infinity ? this.length : end | 0
12642 function( elem, computed ) {
12643 if ( computed ) {
12644 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
12645 // Work around by temporarily setting element display to inline-block
12646 return jQuery.swap( elem, { "display": "inline-block" },
12647 curCSS, [ elem, "marginRight" ] );
12648 }
12649 }
12650);
12651
12652// These hooks are used by animate to expand properties
12653jQuery.each({
12654 margin: "",
12655 padding: "",
12656 border: "Width"
12657}, function( prefix, suffix ) {
12658 jQuery.cssHooks[ prefix + suffix ] = {
12659 expand: function( value ) {
12660 var i = 0,
12661 expanded = {},
12662
12663 // assumes a single number if not a string
12664 parts = typeof value === "string" ? value.split(" ") : [ value ];
12665
12666 for ( ; i < 4; i++ ) {
12667 expanded[ prefix + cssExpand[ i ] + suffix ] =
12668 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
12669 }
12670 2846
12671 return expanded; 2847 if (!encoding) encoding = 'utf8'
12672 } 2848 if (start < 0) start = 0
12673 }; 2849 if (end > this.length) end = this.length
2850 if (end <= start) return ''
12674 2851
12675 if ( !rmargin.test( prefix ) ) { 2852 while (true) {
12676 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 2853 switch (encoding) {
12677 } 2854 case 'hex':
12678}); 2855 return hexSlice(this, start, end)
12679 2856
12680jQuery.fn.extend({ 2857 case 'utf8':
12681 css: function( name, value ) { 2858 case 'utf-8':
12682 return access( this, function( elem, name, value ) { 2859 return utf8Slice(this, start, end)
12683 var styles, len,
12684 map = {},
12685 i = 0;
12686 2860
12687 if ( jQuery.isArray( name ) ) { 2861 case 'ascii':
12688 styles = getStyles( elem ); 2862 return asciiSlice(this, start, end)
12689 len = name.length;
12690 2863
12691 for ( ; i < len; i++ ) { 2864 case 'binary':
12692 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 2865 return binarySlice(this, start, end)
12693 }
12694 2866
12695 return map; 2867 case 'base64':
12696 } 2868 return base64Slice(this, start, end)
12697 2869
12698 return value !== undefined ? 2870 case 'ucs2':
12699 jQuery.style( elem, name, value ) : 2871 case 'ucs-2':
12700 jQuery.css( elem, name ); 2872 case 'utf16le':
12701 }, name, value, arguments.length > 1 ); 2873 case 'utf-16le':
12702 }, 2874 return utf16leSlice(this, start, end)
12703 show: function() {
12704 return showHide( this, true );
12705 },
12706 hide: function() {
12707 return showHide( this );
12708 },
12709 toggle: function( state ) {
12710 if ( typeof state === "boolean" ) {
12711 return state ? this.show() : this.hide();
12712 }
12713 2875
12714 return this.each(function() { 2876 default:
12715 if ( isHidden( this ) ) { 2877 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
12716 jQuery( this ).show(); 2878 encoding = (encoding + '').toLowerCase()
12717 } else { 2879 loweredCase = true
12718 jQuery( this ).hide();
12719 }
12720 });
12721 } 2880 }
12722}); 2881 }
12723
12724
12725function Tween( elem, options, prop, end, easing ) {
12726 return new Tween.prototype.init( elem, options, prop, end, easing );
12727} 2882}
12728jQuery.Tween = Tween;
12729
12730Tween.prototype = {
12731 constructor: Tween,
12732 init: function( elem, options, prop, end, easing, unit ) {
12733 this.elem = elem;
12734 this.prop = prop;
12735 this.easing = easing || "swing";
12736 this.options = options;
12737 this.start = this.now = this.cur();
12738 this.end = end;
12739 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
12740 },
12741 cur: function() {
12742 var hooks = Tween.propHooks[ this.prop ];
12743
12744 return hooks && hooks.get ?
12745 hooks.get( this ) :
12746 Tween.propHooks._default.get( this );
12747 },
12748 run: function( percent ) {
12749 var eased,
12750 hooks = Tween.propHooks[ this.prop ];
12751
12752 if ( this.options.duration ) {
12753 this.pos = eased = jQuery.easing[ this.easing ](
12754 percent, this.options.duration * percent, 0, 1, this.options.duration
12755 );
12756 } else {
12757 this.pos = eased = percent;
12758 }
12759 this.now = ( this.end - this.start ) * eased + this.start;
12760 2883
12761 if ( this.options.step ) { 2884Buffer.prototype.toString = function toString () {
12762 this.options.step.call( this.elem, this.now, this ); 2885 var length = this.length | 0
12763 } 2886 if (length === 0) return ''
2887 if (arguments.length === 0) return utf8Slice(this, 0, length)
2888 return slowToString.apply(this, arguments)
2889}
12764 2890
12765 if ( hooks && hooks.set ) { 2891Buffer.prototype.equals = function equals (b) {
12766 hooks.set( this ); 2892 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
12767 } else { 2893 if (this === b) return true
12768 Tween.propHooks._default.set( this ); 2894 return Buffer.compare(this, b) === 0
12769 } 2895}
12770 return this;
12771 }
12772};
12773 2896
12774Tween.prototype.init.prototype = Tween.prototype; 2897Buffer.prototype.inspect = function inspect () {
2898 var str = ''
2899 var max = exports.INSPECT_MAX_BYTES
2900 if (this.length > 0) {
2901 str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
2902 if (this.length > max) str += ' ... '
2903 }
2904 return '<Buffer ' + str + '>'
2905}
12775 2906
12776Tween.propHooks = { 2907Buffer.prototype.compare = function compare (b) {
12777 _default: { 2908 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
12778 get: function( tween ) { 2909 if (this === b) return 0
12779 var result; 2910 return Buffer.compare(this, b)
2911}
12780 2912
12781 if ( tween.elem[ tween.prop ] != null && 2913Buffer.prototype.indexOf = function indexOf (val, byteOffset) {
12782 (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { 2914 if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff
12783 return tween.elem[ tween.prop ]; 2915 else if (byteOffset < -0x80000000) byteOffset = -0x80000000
12784 } 2916 byteOffset >>= 0
12785 2917
12786 // passing an empty string as a 3rd parameter to .css will automatically 2918 if (this.length === 0) return -1
12787 // attempt a parseFloat and fallback to a string if the parse fails 2919 if (byteOffset >= this.length) return -1
12788 // so, simple values such as "10px" are parsed to Float.
12789 // complex values such as "rotate(1rad)" are returned as is.
12790 result = jQuery.css( tween.elem, tween.prop, "" );
12791 // Empty strings, null, undefined and "auto" are converted to 0.
12792 return !result || result === "auto" ? 0 : result;
12793 },
12794 set: function( tween ) {
12795 // use step hook for back compat - use cssHook if its there - use .style if its
12796 // available and use plain properties where available
12797 if ( jQuery.fx.step[ tween.prop ] ) {
12798 jQuery.fx.step[ tween.prop ]( tween );
12799 } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
12800 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
12801 } else {
12802 tween.elem[ tween.prop ] = tween.now;
12803 }
12804 }
12805 }
12806};
12807 2920
12808// Support: IE9 2921 // Negative offsets start from the end of the buffer
12809// Panic based approach to setting things on disconnected nodes 2922 if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
12810 2923
12811Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 2924 if (typeof val === 'string') {
12812 set: function( tween ) { 2925 if (val.length === 0) return -1 // special case: looking for empty string always fails
12813 if ( tween.elem.nodeType && tween.elem.parentNode ) { 2926 return String.prototype.indexOf.call(this, val, byteOffset)
12814 tween.elem[ tween.prop ] = tween.now; 2927 }
12815 } 2928 if (Buffer.isBuffer(val)) {
2929 return arrayIndexOf(this, val, byteOffset)
2930 }
2931 if (typeof val === 'number') {
2932 if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
2933 return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
12816 } 2934 }
12817}; 2935 return arrayIndexOf(this, [ val ], byteOffset)
2936 }
12818 2937
12819jQuery.easing = { 2938 function arrayIndexOf (arr, val, byteOffset) {
12820 linear: function( p ) { 2939 var foundIndex = -1
12821 return p; 2940 for (var i = 0; byteOffset + i < arr.length; i++) {
12822 }, 2941 if (arr[byteOffset + i] === val[foundIndex === -1 ? 0 : i - foundIndex]) {
12823 swing: function( p ) { 2942 if (foundIndex === -1) foundIndex = i
12824 return 0.5 - Math.cos( p * Math.PI ) / 2; 2943 if (i - foundIndex + 1 === val.length) return byteOffset + foundIndex
2944 } else {
2945 foundIndex = -1
2946 }
12825 } 2947 }
12826}; 2948 return -1
12827 2949 }
12828jQuery.fx = Tween.prototype.init;
12829
12830// Back Compat <1.8 extension point
12831jQuery.fx.step = {};
12832
12833
12834
12835
12836var
12837 fxNow, timerId,
12838 rfxtypes = /^(?:toggle|show|hide)$/,
12839 rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
12840 rrun = /queueHooks$/,
12841 animationPrefilters = [ defaultPrefilter ],
12842 tweeners = {
12843 "*": [ function( prop, value ) {
12844 var tween = this.createTween( prop, value ),
12845 target = tween.cur(),
12846 parts = rfxnum.exec( value ),
12847 unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
12848
12849 // Starting value computation is required for potential unit mismatches
12850 start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
12851 rfxnum.exec( jQuery.css( tween.elem, prop ) ),
12852 scale = 1,
12853 maxIterations = 20;
12854
12855 if ( start && start[ 3 ] !== unit ) {
12856 // Trust units reported by jQuery.css
12857 unit = unit || start[ 3 ];
12858
12859 // Make sure we update the tween properties later on
12860 parts = parts || [];
12861
12862 // Iteratively approximate from a nonzero starting point
12863 start = +target || 1;
12864
12865 do {
12866 // If previous iteration zeroed out, double until we get *something*
12867 // Use a string for doubling factor so we don't accidentally see scale as unchanged below
12868 scale = scale || ".5";
12869
12870 // Adjust and apply
12871 start = start / scale;
12872 jQuery.style( tween.elem, prop, start + unit );
12873
12874 // Update scale, tolerating zero or NaN from tween.cur()
12875 // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
12876 } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
12877 }
12878
12879 // Update tween properties
12880 if ( parts ) {
12881 start = tween.start = +start || +target || 0;
12882 tween.unit = unit;
12883 // If a +=/-= token was provided, we're doing a relative animation
12884 tween.end = parts[ 1 ] ?
12885 start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
12886 +parts[ 2 ];
12887 }
12888 2950
12889 return tween; 2951 throw new TypeError('val must be string, number or Buffer')
12890 } ] 2952}
12891 };
12892 2953
12893// Animations created synchronously will run synchronously 2954// `get` is deprecated
12894function createFxNow() { 2955Buffer.prototype.get = function get (offset) {
12895 setTimeout(function() { 2956 console.log('.get() is deprecated. Access using array indexes instead.')
12896 fxNow = undefined; 2957 return this.readUInt8(offset)
12897 });
12898 return ( fxNow = jQuery.now() );
12899} 2958}
12900 2959
12901// Generate parameters to create a standard animation 2960// `set` is deprecated
12902function genFx( type, includeWidth ) { 2961Buffer.prototype.set = function set (v, offset) {
12903 var which, 2962 console.log('.set() is deprecated. Access using array indexes instead.')
12904 i = 0, 2963 return this.writeUInt8(v, offset)
12905 attrs = { height: type }; 2964}
12906 2965
12907 // if we include width, step value is 1 to do all cssExpand values, 2966function hexWrite (buf, string, offset, length) {
12908 // if we don't include width, step value is 2 to skip over Left and Right 2967 offset = Number(offset) || 0
12909 includeWidth = includeWidth ? 1 : 0; 2968 var remaining = buf.length - offset
12910 for ( ; i < 4 ; i += 2 - includeWidth ) { 2969 if (!length) {
12911 which = cssExpand[ i ]; 2970 length = remaining
12912 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 2971 } else {
2972 length = Number(length)
2973 if (length > remaining) {
2974 length = remaining
12913 } 2975 }
2976 }
12914 2977
12915 if ( includeWidth ) { 2978 // must be an even number of digits
12916 attrs.opacity = attrs.width = type; 2979 var strLen = string.length
12917 } 2980 if (strLen % 2 !== 0) throw new Error('Invalid hex string')
12918 2981
12919 return attrs; 2982 if (length > strLen / 2) {
2983 length = strLen / 2
2984 }
2985 for (var i = 0; i < length; i++) {
2986 var parsed = parseInt(string.substr(i * 2, 2), 16)
2987 if (isNaN(parsed)) throw new Error('Invalid hex string')
2988 buf[offset + i] = parsed
2989 }
2990 return i
12920} 2991}
12921 2992
12922function createTween( value, prop, animation ) { 2993function utf8Write (buf, string, offset, length) {
12923 var tween, 2994 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
12924 collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
12925 index = 0,
12926 length = collection.length;
12927 for ( ; index < length; index++ ) {
12928 if ( (tween = collection[ index ].call( animation, prop, value )) ) {
12929
12930 // we're done with this property
12931 return tween;
12932 }
12933 }
12934} 2995}
12935 2996
12936function defaultPrefilter( elem, props, opts ) { 2997function asciiWrite (buf, string, offset, length) {
12937 /* jshint validthis: true */ 2998 return blitBuffer(asciiToBytes(string), buf, offset, length)
12938 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, 2999}
12939 anim = this,
12940 orig = {},
12941 style = elem.style,
12942 hidden = elem.nodeType && isHidden( elem ),
12943 dataShow = data_priv.get( elem, "fxshow" );
12944
12945 // handle queue: false promises
12946 if ( !opts.queue ) {
12947 hooks = jQuery._queueHooks( elem, "fx" );
12948 if ( hooks.unqueued == null ) {
12949 hooks.unqueued = 0;
12950 oldfire = hooks.empty.fire;
12951 hooks.empty.fire = function() {
12952 if ( !hooks.unqueued ) {
12953 oldfire();
12954 }
12955 };
12956 }
12957 hooks.unqueued++;
12958
12959 anim.always(function() {
12960 // doing this makes sure that the complete handler will be called
12961 // before this completes
12962 anim.always(function() {
12963 hooks.unqueued--;
12964 if ( !jQuery.queue( elem, "fx" ).length ) {
12965 hooks.empty.fire();
12966 }
12967 });
12968 });
12969 }
12970
12971 // height/width overflow pass
12972 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
12973 // Make sure that nothing sneaks out
12974 // Record all 3 overflow attributes because IE9-10 do not
12975 // change the overflow attribute when overflowX and
12976 // overflowY are set to the same value
12977 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
12978 3000
12979 // Set display property to inline-block for height/width 3001function binaryWrite (buf, string, offset, length) {
12980 // animations on inline elements that are having width/height animated 3002 return asciiWrite(buf, string, offset, length)
12981 display = jQuery.css( elem, "display" ); 3003}
12982 3004
12983 // Test default display if display is currently "none" 3005function base64Write (buf, string, offset, length) {
12984 checkDisplay = display === "none" ? 3006 return blitBuffer(base64ToBytes(string), buf, offset, length)
12985 data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; 3007}
12986 3008
12987 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { 3009function ucs2Write (buf, string, offset, length) {
12988 style.display = "inline-block"; 3010 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
12989 } 3011}
12990 }
12991 3012
12992 if ( opts.overflow ) { 3013Buffer.prototype.write = function write (string, offset, length, encoding) {
12993 style.overflow = "hidden"; 3014 // Buffer#write(string)
12994 anim.always(function() { 3015 if (offset === undefined) {
12995 style.overflow = opts.overflow[ 0 ]; 3016 encoding = 'utf8'
12996 style.overflowX = opts.overflow[ 1 ]; 3017 length = this.length
12997 style.overflowY = opts.overflow[ 2 ]; 3018 offset = 0
12998 }); 3019 // Buffer#write(string, encoding)
3020 } else if (length === undefined && typeof offset === 'string') {
3021 encoding = offset
3022 length = this.length
3023 offset = 0
3024 // Buffer#write(string, offset[, length][, encoding])
3025 } else if (isFinite(offset)) {
3026 offset = offset | 0
3027 if (isFinite(length)) {
3028 length = length | 0
3029 if (encoding === undefined) encoding = 'utf8'
3030 } else {
3031 encoding = length
3032 length = undefined
12999 } 3033 }
3034 // legacy write(string, encoding, offset, length) - remove in v0.13
3035 } else {
3036 var swap = encoding
3037 encoding = offset
3038 offset = length | 0
3039 length = swap
3040 }
13000 3041
13001 // show/hide pass 3042 var remaining = this.length - offset
13002 for ( prop in props ) { 3043 if (length === undefined || length > remaining) length = remaining
13003 value = props[ prop ];
13004 if ( rfxtypes.exec( value ) ) {
13005 delete props[ prop ];
13006 toggle = toggle || value === "toggle";
13007 if ( value === ( hidden ? "hide" : "show" ) ) {
13008
13009 // If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
13010 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
13011 hidden = true;
13012 } else {
13013 continue;
13014 }
13015 }
13016 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
13017 3044
13018 // Any non-fx value stops us from restoring the original display value 3045 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
13019 } else { 3046 throw new RangeError('attempt to write outside buffer bounds')
13020 display = undefined; 3047 }
13021 }
13022 }
13023 3048
13024 if ( !jQuery.isEmptyObject( orig ) ) { 3049 if (!encoding) encoding = 'utf8'
13025 if ( dataShow ) {
13026 if ( "hidden" in dataShow ) {
13027 hidden = dataShow.hidden;
13028 }
13029 } else {
13030 dataShow = data_priv.access( elem, "fxshow", {} );
13031 }
13032 3050
13033 // store state if its toggle - enables .stop().toggle() to "reverse" 3051 var loweredCase = false
13034 if ( toggle ) { 3052 for (;;) {
13035 dataShow.hidden = !hidden; 3053 switch (encoding) {
13036 } 3054 case 'hex':
13037 if ( hidden ) { 3055 return hexWrite(this, string, offset, length)
13038 jQuery( elem ).show();
13039 } else {
13040 anim.done(function() {
13041 jQuery( elem ).hide();
13042 });
13043 }
13044 anim.done(function() {
13045 var prop;
13046 3056
13047 data_priv.remove( elem, "fxshow" ); 3057 case 'utf8':
13048 for ( prop in orig ) { 3058 case 'utf-8':
13049 jQuery.style( elem, prop, orig[ prop ] ); 3059 return utf8Write(this, string, offset, length)
13050 }
13051 });
13052 for ( prop in orig ) {
13053 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
13054
13055 if ( !( prop in dataShow ) ) {
13056 dataShow[ prop ] = tween.start;
13057 if ( hidden ) {
13058 tween.end = tween.start;
13059 tween.start = prop === "width" || prop === "height" ? 1 : 0;
13060 }
13061 }
13062 }
13063 3060
13064 // If this is a noop like .hide().hide(), restore an overwritten display value 3061 case 'ascii':
13065 } else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) { 3062 return asciiWrite(this, string, offset, length)
13066 style.display = display;
13067 }
13068}
13069 3063
13070function propFilter( props, specialEasing ) { 3064 case 'binary':
13071 var index, name, easing, value, hooks; 3065 return binaryWrite(this, string, offset, length)
13072 3066
13073 // camelCase, specialEasing and expand cssHook pass 3067 case 'base64':
13074 for ( index in props ) { 3068 // Warning: maxLength not taken into account in base64Write
13075 name = jQuery.camelCase( index ); 3069 return base64Write(this, string, offset, length)
13076 easing = specialEasing[ name ];
13077 value = props[ index ];
13078 if ( jQuery.isArray( value ) ) {
13079 easing = value[ 1 ];
13080 value = props[ index ] = value[ 0 ];
13081 }
13082 3070
13083 if ( index !== name ) { 3071 case 'ucs2':
13084 props[ name ] = value; 3072 case 'ucs-2':
13085 delete props[ index ]; 3073 case 'utf16le':
13086 } 3074 case 'utf-16le':
3075 return ucs2Write(this, string, offset, length)
13087 3076
13088 hooks = jQuery.cssHooks[ name ]; 3077 default:
13089 if ( hooks && "expand" in hooks ) { 3078 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
13090 value = hooks.expand( value ); 3079 encoding = ('' + encoding).toLowerCase()
13091 delete props[ name ]; 3080 loweredCase = true
13092
13093 // not quite $.extend, this wont overwrite keys already present.
13094 // also - reusing 'index' from above because we have the correct "name"
13095 for ( index in value ) {
13096 if ( !( index in props ) ) {
13097 props[ index ] = value[ index ];
13098 specialEasing[ index ] = easing;
13099 }
13100 }
13101 } else {
13102 specialEasing[ name ] = easing;
13103 }
13104 } 3081 }
3082 }
13105} 3083}
13106 3084
13107function Animation( elem, properties, options ) { 3085Buffer.prototype.toJSON = function toJSON () {
13108 var result, 3086 return {
13109 stopped, 3087 type: 'Buffer',
13110 index = 0, 3088 data: Array.prototype.slice.call(this._arr || this, 0)
13111 length = animationPrefilters.length, 3089 }
13112 deferred = jQuery.Deferred().always( function() {
13113 // don't match elem in the :animated selector
13114 delete tick.elem;
13115 }),
13116 tick = function() {
13117 if ( stopped ) {
13118 return false;
13119 }
13120 var currentTime = fxNow || createFxNow(),
13121 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
13122 // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
13123 temp = remaining / animation.duration || 0,
13124 percent = 1 - temp,
13125 index = 0,
13126 length = animation.tweens.length;
13127
13128 for ( ; index < length ; index++ ) {
13129 animation.tweens[ index ].run( percent );
13130 }
13131
13132 deferred.notifyWith( elem, [ animation, percent, remaining ]);
13133
13134 if ( percent < 1 && length ) {
13135 return remaining;
13136 } else {
13137 deferred.resolveWith( elem, [ animation ] );
13138 return false;
13139 }
13140 },
13141 animation = deferred.promise({
13142 elem: elem,
13143 props: jQuery.extend( {}, properties ),
13144 opts: jQuery.extend( true, { specialEasing: {} }, options ),
13145 originalProperties: properties,
13146 originalOptions: options,
13147 startTime: fxNow || createFxNow(),
13148 duration: options.duration,
13149 tweens: [],
13150 createTween: function( prop, end ) {
13151 var tween = jQuery.Tween( elem, animation.opts, prop, end,
13152 animation.opts.specialEasing[ prop ] || animation.opts.easing );
13153 animation.tweens.push( tween );
13154 return tween;
13155 },
13156 stop: function( gotoEnd ) {
13157 var index = 0,
13158 // if we are going to the end, we want to run all the tweens
13159 // otherwise we skip this part
13160 length = gotoEnd ? animation.tweens.length : 0;
13161 if ( stopped ) {
13162 return this;
13163 }
13164 stopped = true;
13165 for ( ; index < length ; index++ ) {
13166 animation.tweens[ index ].run( 1 );
13167 }
13168
13169 // resolve when we played the last frame
13170 // otherwise, reject
13171 if ( gotoEnd ) {
13172 deferred.resolveWith( elem, [ animation, gotoEnd ] );
13173 } else {
13174 deferred.rejectWith( elem, [ animation, gotoEnd ] );
13175 }
13176 return this;
13177 }
13178 }),
13179 props = animation.props;
13180
13181 propFilter( props, animation.opts.specialEasing );
13182
13183 for ( ; index < length ; index++ ) {
13184 result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
13185 if ( result ) {
13186 return result;
13187 }
13188 }
13189
13190 jQuery.map( props, createTween, animation );
13191
13192 if ( jQuery.isFunction( animation.opts.start ) ) {
13193 animation.opts.start.call( elem, animation );
13194 }
13195
13196 jQuery.fx.timer(
13197 jQuery.extend( tick, {
13198 elem: elem,
13199 anim: animation,
13200 queue: animation.opts.queue
13201 })
13202 );
13203
13204 // attach callbacks from options
13205 return animation.progress( animation.opts.progress )
13206 .done( animation.opts.done, animation.opts.complete )
13207 .fail( animation.opts.fail )
13208 .always( animation.opts.always );
13209} 3090}
13210 3091
13211jQuery.Animation = jQuery.extend( Animation, { 3092function base64Slice (buf, start, end) {
13212 3093 if (start === 0 && end === buf.length) {
13213 tweener: function( props, callback ) { 3094 return base64.fromByteArray(buf)
13214 if ( jQuery.isFunction( props ) ) { 3095 } else {
13215 callback = props; 3096 return base64.fromByteArray(buf.slice(start, end))
13216 props = [ "*" ]; 3097 }
13217 } else { 3098}
13218 props = props.split(" ");
13219 }
13220
13221 var prop,
13222 index = 0,
13223 length = props.length;
13224
13225 for ( ; index < length ; index++ ) {
13226 prop = props[ index ];
13227 tweeners[ prop ] = tweeners[ prop ] || [];
13228 tweeners[ prop ].unshift( callback );
13229 }
13230 },
13231
13232 prefilter: function( callback, prepend ) {
13233 if ( prepend ) {
13234 animationPrefilters.unshift( callback );
13235 } else {
13236 animationPrefilters.push( callback );
13237 }
13238 }
13239});
13240
13241jQuery.speed = function( speed, easing, fn ) {
13242 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
13243 complete: fn || !fn && easing ||
13244 jQuery.isFunction( speed ) && speed,
13245 duration: speed,
13246 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
13247 };
13248
13249 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
13250 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
13251 3099
13252 // normalize opt.queue - true/undefined/null -> "fx" 3100function utf8Slice (buf, start, end) {
13253 if ( opt.queue == null || opt.queue === true ) { 3101 end = Math.min(buf.length, end)
13254 opt.queue = "fx"; 3102 var firstByte
3103 var secondByte
3104 var thirdByte
3105 var fourthByte
3106 var bytesPerSequence
3107 var tempCodePoint
3108 var codePoint
3109 var res = []
3110 var i = start
3111
3112 for (; i < end; i += bytesPerSequence) {
3113 firstByte = buf[i]
3114 codePoint = 0xFFFD
3115
3116 if (firstByte > 0xEF) {
3117 bytesPerSequence = 4
3118 } else if (firstByte > 0xDF) {
3119 bytesPerSequence = 3
3120 } else if (firstByte > 0xBF) {
3121 bytesPerSequence = 2
3122 } else {
3123 bytesPerSequence = 1
13255 } 3124 }
13256 3125
13257 // Queueing 3126 if (i + bytesPerSequence <= end) {
13258 opt.old = opt.complete; 3127 switch (bytesPerSequence) {
13259 3128 case 1:
13260 opt.complete = function() { 3129 if (firstByte < 0x80) {
13261 if ( jQuery.isFunction( opt.old ) ) { 3130 codePoint = firstByte
13262 opt.old.call( this ); 3131 }
13263 } 3132 break
13264 3133 case 2:
13265 if ( opt.queue ) { 3134 secondByte = buf[i + 1]
13266 jQuery.dequeue( this, opt.queue ); 3135 if ((secondByte & 0xC0) === 0x80) {
13267 } 3136 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
13268 }; 3137 if (tempCodePoint > 0x7F) {
13269 3138 codePoint = tempCodePoint
13270 return opt;
13271};
13272
13273jQuery.fn.extend({
13274 fadeTo: function( speed, to, easing, callback ) {
13275
13276 // show any hidden elements after setting opacity to 0
13277 return this.filter( isHidden ).css( "opacity", 0 ).show()
13278
13279 // animate to the value specified
13280 .end().animate({ opacity: to }, speed, easing, callback );
13281 },
13282 animate: function( prop, speed, easing, callback ) {
13283 var empty = jQuery.isEmptyObject( prop ),
13284 optall = jQuery.speed( speed, easing, callback ),
13285 doAnimation = function() {
13286 // Operate on a copy of prop so per-property easing won't be lost
13287 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
13288
13289 // Empty animations, or finishing resolves immediately
13290 if ( empty || data_priv.get( this, "finish" ) ) {
13291 anim.stop( true );
13292 }
13293 };
13294 doAnimation.finish = doAnimation;
13295
13296 return empty || optall.queue === false ?
13297 this.each( doAnimation ) :
13298 this.queue( optall.queue, doAnimation );
13299 },
13300 stop: function( type, clearQueue, gotoEnd ) {
13301 var stopQueue = function( hooks ) {
13302 var stop = hooks.stop;
13303 delete hooks.stop;
13304 stop( gotoEnd );
13305 };
13306
13307 if ( typeof type !== "string" ) {
13308 gotoEnd = clearQueue;
13309 clearQueue = type;
13310 type = undefined;
13311 }
13312 if ( clearQueue && type !== false ) {
13313 this.queue( type || "fx", [] );
13314 }
13315
13316 return this.each(function() {
13317 var dequeue = true,
13318 index = type != null && type + "queueHooks",
13319 timers = jQuery.timers,
13320 data = data_priv.get( this );
13321
13322 if ( index ) {
13323 if ( data[ index ] && data[ index ].stop ) {
13324 stopQueue( data[ index ] );
13325 }
13326 } else {
13327 for ( index in data ) {
13328 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
13329 stopQueue( data[ index ] );
13330 }
13331 }
13332 }
13333
13334 for ( index = timers.length; index--; ) {
13335 if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
13336 timers[ index ].anim.stop( gotoEnd );
13337 dequeue = false;
13338 timers.splice( index, 1 );
13339 }
13340 }
13341
13342 // start the next in the queue if the last step wasn't forced
13343 // timers currently will call their complete callbacks, which will dequeue
13344 // but only if they were gotoEnd
13345 if ( dequeue || !gotoEnd ) {
13346 jQuery.dequeue( this, type );
13347 }
13348 });
13349 },
13350 finish: function( type ) {
13351 if ( type !== false ) {
13352 type = type || "fx";
13353 }
13354 return this.each(function() {
13355 var index,
13356 data = data_priv.get( this ),
13357 queue = data[ type + "queue" ],
13358 hooks = data[ type + "queueHooks" ],
13359 timers = jQuery.timers,
13360 length = queue ? queue.length : 0;
13361
13362 // enable finishing flag on private data
13363 data.finish = true;
13364
13365 // empty the queue first
13366 jQuery.queue( this, type, [] );
13367
13368 if ( hooks && hooks.stop ) {
13369 hooks.stop.call( this, true );
13370 } 3139 }
13371 3140 }
13372 // look for any active animations, and finish them 3141 break
13373 for ( index = timers.length; index--; ) { 3142 case 3:
13374 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 3143 secondByte = buf[i + 1]
13375 timers[ index ].anim.stop( true ); 3144 thirdByte = buf[i + 2]
13376 timers.splice( index, 1 ); 3145 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
13377 } 3146 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
3147 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
3148 codePoint = tempCodePoint
13378 } 3149 }
13379 3150 }
13380 // look for any animations in the old queue and finish them 3151 break
13381 for ( index = 0; index < length; index++ ) { 3152 case 4:
13382 if ( queue[ index ] && queue[ index ].finish ) { 3153 secondByte = buf[i + 1]
13383 queue[ index ].finish.call( this ); 3154 thirdByte = buf[i + 2]
13384 } 3155 fourthByte = buf[i + 3]
3156 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
3157 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
3158 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
3159 codePoint = tempCodePoint
13385 } 3160 }
13386 3161 }
13387 // turn off finishing flag 3162 }
13388 delete data.finish;
13389 });
13390 }
13391});
13392
13393jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
13394 var cssFn = jQuery.fn[ name ];
13395 jQuery.fn[ name ] = function( speed, easing, callback ) {
13396 return speed == null || typeof speed === "boolean" ?
13397 cssFn.apply( this, arguments ) :
13398 this.animate( genFx( name, true ), speed, easing, callback );
13399 };
13400});
13401
13402// Generate shortcuts for custom animations
13403jQuery.each({
13404 slideDown: genFx("show"),
13405 slideUp: genFx("hide"),
13406 slideToggle: genFx("toggle"),
13407 fadeIn: { opacity: "show" },
13408 fadeOut: { opacity: "hide" },
13409 fadeToggle: { opacity: "toggle" }
13410}, function( name, props ) {
13411 jQuery.fn[ name ] = function( speed, easing, callback ) {
13412 return this.animate( props, speed, easing, callback );
13413 };
13414});
13415
13416jQuery.timers = [];
13417jQuery.fx.tick = function() {
13418 var timer,
13419 i = 0,
13420 timers = jQuery.timers;
13421
13422 fxNow = jQuery.now();
13423
13424 for ( ; i < timers.length; i++ ) {
13425 timer = timers[ i ];
13426 // Checks the timer has not already been removed
13427 if ( !timer() && timers[ i ] === timer ) {
13428 timers.splice( i--, 1 );
13429 }
13430 }
13431
13432 if ( !timers.length ) {
13433 jQuery.fx.stop();
13434 }
13435 fxNow = undefined;
13436};
13437
13438jQuery.fx.timer = function( timer ) {
13439 jQuery.timers.push( timer );
13440 if ( timer() ) {
13441 jQuery.fx.start();
13442 } else {
13443 jQuery.timers.pop();
13444 } 3163 }
13445};
13446
13447jQuery.fx.interval = 13;
13448 3164
13449jQuery.fx.start = function() { 3165 if (codePoint === 0xFFFD) {
13450 if ( !timerId ) { 3166 // we generated an invalid codePoint so make sure to only advance by 1 byte
13451 timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); 3167 bytesPerSequence = 1
3168 } else if (codePoint > 0xFFFF) {
3169 // encode to utf16 (surrogate pair dance)
3170 codePoint -= 0x10000
3171 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
3172 codePoint = 0xDC00 | codePoint & 0x3FF
13452 } 3173 }
13453};
13454 3174
13455jQuery.fx.stop = function() { 3175 res.push(codePoint)
13456 clearInterval( timerId ); 3176 }
13457 timerId = null;
13458};
13459
13460jQuery.fx.speeds = {
13461 slow: 600,
13462 fast: 200,
13463 // Default speed
13464 _default: 400
13465};
13466
13467
13468// Based off of the plugin by Clint Helfers, with permission.
13469// http://blindsignals.com/index.php/2009/07/jquery-delay/
13470jQuery.fn.delay = function( time, type ) {
13471 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
13472 type = type || "fx";
13473
13474 return this.queue( type, function( next, hooks ) {
13475 var timeout = setTimeout( next, time );
13476 hooks.stop = function() {
13477 clearTimeout( timeout );
13478 };
13479 });
13480};
13481
13482
13483(function() {
13484 var input = document.createElement( "input" ),
13485 select = document.createElement( "select" ),
13486 opt = select.appendChild( document.createElement( "option" ) );
13487
13488 input.type = "checkbox";
13489
13490 // Support: iOS 5.1, Android 4.x, Android 2.3
13491 // Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
13492 support.checkOn = input.value !== "";
13493
13494 // Must access the parent to make an option select properly
13495 // Support: IE9, IE10
13496 support.optSelected = opt.selected;
13497
13498 // Make sure that the options inside disabled selects aren't marked as disabled
13499 // (WebKit marks them as disabled)
13500 select.disabled = true;
13501 support.optDisabled = !opt.disabled;
13502
13503 // Check if an input maintains its value after becoming a radio
13504 // Support: IE9, IE10
13505 input = document.createElement( "input" );
13506 input.value = "t";
13507 input.type = "radio";
13508 support.radioValue = input.value === "t";
13509})();
13510
13511
13512var nodeHook, boolHook,
13513 attrHandle = jQuery.expr.attrHandle;
13514
13515jQuery.fn.extend({
13516 attr: function( name, value ) {
13517 return access( this, jQuery.attr, name, value, arguments.length > 1 );
13518 },
13519
13520 removeAttr: function( name ) {
13521 return this.each(function() {
13522 jQuery.removeAttr( this, name );
13523 });
13524 }
13525});
13526
13527jQuery.extend({
13528 attr: function( elem, name, value ) {
13529 var hooks, ret,
13530 nType = elem.nodeType;
13531
13532 // don't get/set attributes on text, comment and attribute nodes
13533 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
13534 return;
13535 }
13536 3177
13537 // Fallback to prop when attributes are not supported 3178 return String.fromCharCode.apply(String, res)
13538 if ( typeof elem.getAttribute === strundefined ) { 3179}
13539 return jQuery.prop( elem, name, value );
13540 }
13541 3180
13542 // All attributes are lowercase 3181function asciiSlice (buf, start, end) {
13543 // Grab necessary hook if one is defined 3182 var ret = ''
13544 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 3183 end = Math.min(buf.length, end)
13545 name = name.toLowerCase();
13546 hooks = jQuery.attrHooks[ name ] ||
13547 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
13548 }
13549 3184
13550 if ( value !== undefined ) { 3185 for (var i = start; i < end; i++) {
3186 ret += String.fromCharCode(buf[i] & 0x7F)
3187 }
3188 return ret
3189}
13551 3190
13552 if ( value === null ) { 3191function binarySlice (buf, start, end) {
13553 jQuery.removeAttr( elem, name ); 3192 var ret = ''
3193 end = Math.min(buf.length, end)
13554 3194
13555 } else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { 3195 for (var i = start; i < end; i++) {
13556 return ret; 3196 ret += String.fromCharCode(buf[i])
3197 }
3198 return ret
3199}
13557 3200
13558 } else { 3201function hexSlice (buf, start, end) {
13559 elem.setAttribute( name, value + "" ); 3202 var len = buf.length
13560 return value;
13561 }
13562 3203
13563 } else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { 3204 if (!start || start < 0) start = 0
13564 return ret; 3205 if (!end || end < 0 || end > len) end = len
13565 3206
13566 } else { 3207 var out = ''
13567 ret = jQuery.find.attr( elem, name ); 3208 for (var i = start; i < end; i++) {
3209 out += toHex(buf[i])
3210 }
3211 return out
3212}
13568 3213
13569 // Non-existent attributes return null, we normalize to undefined 3214function utf16leSlice (buf, start, end) {
13570 return ret == null ? 3215 var bytes = buf.slice(start, end)
13571 undefined : 3216 var res = ''
13572 ret; 3217 for (var i = 0; i < bytes.length; i += 2) {
13573 } 3218 res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
13574 }, 3219 }
3220 return res
3221}
13575 3222
13576 removeAttr: function( elem, value ) { 3223Buffer.prototype.slice = function slice (start, end) {
13577 var name, propName, 3224 var len = this.length
13578 i = 0, 3225 start = ~~start
13579 attrNames = value && value.match( rnotwhite ); 3226 end = end === undefined ? len : ~~end
13580 3227
13581 if ( attrNames && elem.nodeType === 1 ) { 3228 if (start < 0) {
13582 while ( (name = attrNames[i++]) ) { 3229 start += len
13583 propName = jQuery.propFix[ name ] || name; 3230 if (start < 0) start = 0
3231 } else if (start > len) {
3232 start = len
3233 }
13584 3234
13585 // Boolean attributes get special treatment (#10870) 3235 if (end < 0) {
13586 if ( jQuery.expr.match.bool.test( name ) ) { 3236 end += len
13587 // Set corresponding property to false 3237 if (end < 0) end = 0
13588 elem[ propName ] = false; 3238 } else if (end > len) {
13589 } 3239 end = len
3240 }
13590 3241
13591 elem.removeAttribute( name ); 3242 if (end < start) end = start
13592 }
13593 }
13594 },
13595 3243
13596 attrHooks: { 3244 var newBuf
13597 type: { 3245 if (Buffer.TYPED_ARRAY_SUPPORT) {
13598 set: function( elem, value ) { 3246 newBuf = Buffer._augment(this.subarray(start, end))
13599 if ( !support.radioValue && value === "radio" && 3247 } else {
13600 jQuery.nodeName( elem, "input" ) ) { 3248 var sliceLen = end - start
13601 // Setting the type on a radio button after the value resets the value in IE6-9 3249 newBuf = new Buffer(sliceLen, undefined)
13602 // Reset value to default in case type is set after value during creation 3250 for (var i = 0; i < sliceLen; i++) {
13603 var val = elem.value; 3251 newBuf[i] = this[i + start]
13604 elem.setAttribute( "type", value );
13605 if ( val ) {
13606 elem.value = val;
13607 }
13608 return value;
13609 }
13610 }
13611 }
13612 } 3252 }
13613}); 3253 }
13614 3254
13615// Hooks for boolean attributes 3255 if (newBuf.length) newBuf.parent = this.parent || this
13616boolHook = {
13617 set: function( elem, value, name ) {
13618 if ( value === false ) {
13619 // Remove boolean attributes when set to false
13620 jQuery.removeAttr( elem, name );
13621 } else {
13622 elem.setAttribute( name, name );
13623 }
13624 return name;
13625 }
13626};
13627jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
13628 var getter = attrHandle[ name ] || jQuery.find.attr;
13629
13630 attrHandle[ name ] = function( elem, name, isXML ) {
13631 var ret, handle;
13632 if ( !isXML ) {
13633 // Avoid an infinite loop by temporarily removing this function from the getter
13634 handle = attrHandle[ name ];
13635 attrHandle[ name ] = ret;
13636 ret = getter( elem, name, isXML ) != null ?
13637 name.toLowerCase() :
13638 null;
13639 attrHandle[ name ] = handle;
13640 }
13641 return ret;
13642 };
13643});
13644 3256
3257 return newBuf
3258}
13645 3259
3260/*
3261 * Need to make sure that buffer isn't trying to write out of bounds.
3262 */
3263function checkOffset (offset, ext, length) {
3264 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
3265 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
3266}
13646 3267
3268Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
3269 offset = offset | 0
3270 byteLength = byteLength | 0
3271 if (!noAssert) checkOffset(offset, byteLength, this.length)
13647 3272
13648var rfocusable = /^(?:input|select|textarea|button)$/i; 3273 var val = this[offset]
3274 var mul = 1
3275 var i = 0
3276 while (++i < byteLength && (mul *= 0x100)) {
3277 val += this[offset + i] * mul
3278 }
13649 3279
13650jQuery.fn.extend({ 3280 return val
13651 prop: function( name, value ) { 3281}
13652 return access( this, jQuery.prop, name, value, arguments.length > 1 );
13653 },
13654 3282
13655 removeProp: function( name ) { 3283Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
13656 return this.each(function() { 3284 offset = offset | 0
13657 delete this[ jQuery.propFix[ name ] || name ]; 3285 byteLength = byteLength | 0
13658 }); 3286 if (!noAssert) {
13659 } 3287 checkOffset(offset, byteLength, this.length)
13660}); 3288 }
13661 3289
13662jQuery.extend({ 3290 var val = this[offset + --byteLength]
13663 propFix: { 3291 var mul = 1
13664 "for": "htmlFor", 3292 while (byteLength > 0 && (mul *= 0x100)) {
13665 "class": "className" 3293 val += this[offset + --byteLength] * mul
13666 }, 3294 }
13667 3295
13668 prop: function( elem, name, value ) { 3296 return val
13669 var ret, hooks, notxml, 3297}
13670 nType = elem.nodeType;
13671 3298
13672 // don't get/set properties on text, comment and attribute nodes 3299Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
13673 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { 3300 if (!noAssert) checkOffset(offset, 1, this.length)
13674 return; 3301 return this[offset]
13675 } 3302}
13676 3303
13677 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); 3304Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
3305 if (!noAssert) checkOffset(offset, 2, this.length)
3306 return this[offset] | (this[offset + 1] << 8)
3307}
13678 3308
13679 if ( notxml ) { 3309Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
13680 // Fix name and attach hooks 3310 if (!noAssert) checkOffset(offset, 2, this.length)
13681 name = jQuery.propFix[ name ] || name; 3311 return (this[offset] << 8) | this[offset + 1]
13682 hooks = jQuery.propHooks[ name ]; 3312}
13683 }
13684 3313
13685 if ( value !== undefined ) { 3314Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
13686 return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? 3315 if (!noAssert) checkOffset(offset, 4, this.length)
13687 ret :
13688 ( elem[ name ] = value );
13689 3316
13690 } else { 3317 return ((this[offset]) |
13691 return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? 3318 (this[offset + 1] << 8) |
13692 ret : 3319 (this[offset + 2] << 16)) +
13693 elem[ name ]; 3320 (this[offset + 3] * 0x1000000)
13694 } 3321}
13695 },
13696 3322
13697 propHooks: { 3323Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
13698 tabIndex: { 3324 if (!noAssert) checkOffset(offset, 4, this.length)
13699 get: function( elem ) {
13700 return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
13701 elem.tabIndex :
13702 -1;
13703 }
13704 }
13705 }
13706});
13707 3325
13708// Support: IE9+ 3326 return (this[offset] * 0x1000000) +
13709// Selectedness for an option in an optgroup can be inaccurate 3327 ((this[offset + 1] << 16) |
13710if ( !support.optSelected ) { 3328 (this[offset + 2] << 8) |
13711 jQuery.propHooks.selected = { 3329 this[offset + 3])
13712 get: function( elem ) {
13713 var parent = elem.parentNode;
13714 if ( parent && parent.parentNode ) {
13715 parent.parentNode.selectedIndex;
13716 }
13717 return null;
13718 }
13719 };
13720} 3330}
13721 3331
13722jQuery.each([ 3332Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
13723 "tabIndex", 3333 offset = offset | 0
13724 "readOnly", 3334 byteLength = byteLength | 0
13725 "maxLength", 3335 if (!noAssert) checkOffset(offset, byteLength, this.length)
13726 "cellSpacing",
13727 "cellPadding",
13728 "rowSpan",
13729 "colSpan",
13730 "useMap",
13731 "frameBorder",
13732 "contentEditable"
13733], function() {
13734 jQuery.propFix[ this.toLowerCase() ] = this;
13735});
13736 3336
3337 var val = this[offset]
3338 var mul = 1
3339 var i = 0
3340 while (++i < byteLength && (mul *= 0x100)) {
3341 val += this[offset + i] * mul
3342 }
3343 mul *= 0x80
13737 3344
3345 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
13738 3346
3347 return val
3348}
13739 3349
13740var rclass = /[\t\r\n\f]/g; 3350Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
3351 offset = offset | 0
3352 byteLength = byteLength | 0
3353 if (!noAssert) checkOffset(offset, byteLength, this.length)
13741 3354
13742jQuery.fn.extend({ 3355 var i = byteLength
13743 addClass: function( value ) { 3356 var mul = 1
13744 var classes, elem, cur, clazz, j, finalValue, 3357 var val = this[offset + --i]
13745 proceed = typeof value === "string" && value, 3358 while (i > 0 && (mul *= 0x100)) {
13746 i = 0, 3359 val += this[offset + --i] * mul
13747 len = this.length; 3360 }
3361 mul *= 0x80
13748 3362
13749 if ( jQuery.isFunction( value ) ) { 3363 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
13750 return this.each(function( j ) {
13751 jQuery( this ).addClass( value.call( this, j, this.className ) );
13752 });
13753 }
13754 3364
13755 if ( proceed ) { 3365 return val
13756 // The disjunction here is for better compressibility (see removeClass) 3366}
13757 classes = ( value || "" ).match( rnotwhite ) || [];
13758
13759 for ( ; i < len; i++ ) {
13760 elem = this[ i ];
13761 cur = elem.nodeType === 1 && ( elem.className ?
13762 ( " " + elem.className + " " ).replace( rclass, " " ) :
13763 " "
13764 );
13765
13766 if ( cur ) {
13767 j = 0;
13768 while ( (clazz = classes[j++]) ) {
13769 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
13770 cur += clazz + " ";
13771 }
13772 }
13773
13774 // only assign if different to avoid unneeded rendering.
13775 finalValue = jQuery.trim( cur );
13776 if ( elem.className !== finalValue ) {
13777 elem.className = finalValue;
13778 }
13779 }
13780 }
13781 }
13782 3367
13783 return this; 3368Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
13784 }, 3369 if (!noAssert) checkOffset(offset, 1, this.length)
3370 if (!(this[offset] & 0x80)) return (this[offset])
3371 return ((0xff - this[offset] + 1) * -1)
3372}
13785 3373
13786 removeClass: function( value ) { 3374Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
13787 var classes, elem, cur, clazz, j, finalValue, 3375 if (!noAssert) checkOffset(offset, 2, this.length)
13788 proceed = arguments.length === 0 || typeof value === "string" && value, 3376 var val = this[offset] | (this[offset + 1] << 8)
13789 i = 0, 3377 return (val & 0x8000) ? val | 0xFFFF0000 : val
13790 len = this.length; 3378}
13791 3379
13792 if ( jQuery.isFunction( value ) ) { 3380Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
13793 return this.each(function( j ) { 3381 if (!noAssert) checkOffset(offset, 2, this.length)
13794 jQuery( this ).removeClass( value.call( this, j, this.className ) ); 3382 var val = this[offset + 1] | (this[offset] << 8)
13795 }); 3383 return (val & 0x8000) ? val | 0xFFFF0000 : val
13796 } 3384}
13797 if ( proceed ) {
13798 classes = ( value || "" ).match( rnotwhite ) || [];
13799
13800 for ( ; i < len; i++ ) {
13801 elem = this[ i ];
13802 // This expression is here for better compressibility (see addClass)
13803 cur = elem.nodeType === 1 && ( elem.className ?
13804 ( " " + elem.className + " " ).replace( rclass, " " ) :
13805 ""
13806 );
13807
13808 if ( cur ) {
13809 j = 0;
13810 while ( (clazz = classes[j++]) ) {
13811 // Remove *all* instances
13812 while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
13813 cur = cur.replace( " " + clazz + " ", " " );
13814 }
13815 }
13816
13817 // only assign if different to avoid unneeded rendering.
13818 finalValue = value ? jQuery.trim( cur ) : "";
13819 if ( elem.className !== finalValue ) {
13820 elem.className = finalValue;
13821 }
13822 }
13823 }
13824 }
13825 3385
13826 return this; 3386Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
13827 }, 3387 if (!noAssert) checkOffset(offset, 4, this.length)
13828 3388
13829 toggleClass: function( value, stateVal ) { 3389 return (this[offset]) |
13830 var type = typeof value; 3390 (this[offset + 1] << 8) |
3391 (this[offset + 2] << 16) |
3392 (this[offset + 3] << 24)
3393}
13831 3394
13832 if ( typeof stateVal === "boolean" && type === "string" ) { 3395Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
13833 return stateVal ? this.addClass( value ) : this.removeClass( value ); 3396 if (!noAssert) checkOffset(offset, 4, this.length)
13834 }
13835 3397
13836 if ( jQuery.isFunction( value ) ) { 3398 return (this[offset] << 24) |
13837 return this.each(function( i ) { 3399 (this[offset + 1] << 16) |
13838 jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); 3400 (this[offset + 2] << 8) |
13839 }); 3401 (this[offset + 3])
13840 } 3402}
13841 3403
13842 return this.each(function() { 3404Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
13843 if ( type === "string" ) { 3405 if (!noAssert) checkOffset(offset, 4, this.length)
13844 // toggle individual class names 3406 return ieee754.read(this, offset, true, 23, 4)
13845 var className, 3407}
13846 i = 0,
13847 self = jQuery( this ),
13848 classNames = value.match( rnotwhite ) || [];
13849
13850 while ( (className = classNames[ i++ ]) ) {
13851 // check each className given, space separated list
13852 if ( self.hasClass( className ) ) {
13853 self.removeClass( className );
13854 } else {
13855 self.addClass( className );
13856 }
13857 }
13858
13859 // Toggle whole class name
13860 } else if ( type === strundefined || type === "boolean" ) {
13861 if ( this.className ) {
13862 // store className if set
13863 data_priv.set( this, "__className__", this.className );
13864 }
13865
13866 // If the element has a class name or if we're passed "false",
13867 // then remove the whole classname (if there was one, the above saved it).
13868 // Otherwise bring back whatever was previously saved (if anything),
13869 // falling back to the empty string if nothing was stored.
13870 this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
13871 }
13872 });
13873 },
13874 3408
13875 hasClass: function( selector ) { 3409Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
13876 var className = " " + selector + " ", 3410 if (!noAssert) checkOffset(offset, 4, this.length)
13877 i = 0, 3411 return ieee754.read(this, offset, false, 23, 4)
13878 l = this.length; 3412}
13879 for ( ; i < l; i++ ) {
13880 if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
13881 return true;
13882 }
13883 }
13884 3413
13885 return false; 3414Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
13886 } 3415 if (!noAssert) checkOffset(offset, 8, this.length)
13887}); 3416 return ieee754.read(this, offset, true, 52, 8)
3417}
13888 3418
3419Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
3420 if (!noAssert) checkOffset(offset, 8, this.length)
3421 return ieee754.read(this, offset, false, 52, 8)
3422}
13889 3423
3424function checkInt (buf, value, offset, ext, max, min) {
3425 if (!Buffer.isBuffer(buf)) throw new TypeError('buffer must be a Buffer instance')
3426 if (value > max || value < min) throw new RangeError('value is out of bounds')
3427 if (offset + ext > buf.length) throw new RangeError('index out of range')
3428}
13890 3429
3430Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
3431 value = +value
3432 offset = offset | 0
3433 byteLength = byteLength | 0
3434 if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
13891 3435
13892var rreturn = /\r/g; 3436 var mul = 1
3437 var i = 0
3438 this[offset] = value & 0xFF
3439 while (++i < byteLength && (mul *= 0x100)) {
3440 this[offset + i] = (value / mul) & 0xFF
3441 }
13893 3442
13894jQuery.fn.extend({ 3443 return offset + byteLength
13895 val: function( value ) { 3444}
13896 var hooks, ret, isFunction,
13897 elem = this[0];
13898 3445
13899 if ( !arguments.length ) { 3446Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
13900 if ( elem ) { 3447 value = +value
13901 hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 3448 offset = offset | 0
3449 byteLength = byteLength | 0
3450 if (!noAssert) checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0)
13902 3451
13903 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { 3452 var i = byteLength - 1
13904 return ret; 3453 var mul = 1
13905 } 3454 this[offset + i] = value & 0xFF
3455 while (--i >= 0 && (mul *= 0x100)) {
3456 this[offset + i] = (value / mul) & 0xFF
3457 }
13906 3458
13907 ret = elem.value; 3459 return offset + byteLength
3460}
13908 3461
13909 return typeof ret === "string" ? 3462Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
13910 // handle most common string cases 3463 value = +value
13911 ret.replace(rreturn, "") : 3464 offset = offset | 0
13912 // handle cases where value is null/undef or number 3465 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
13913 ret == null ? "" : ret; 3466 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
13914 } 3467 this[offset] = value
3468 return offset + 1
3469}
13915 3470
13916 return; 3471function objectWriteUInt16 (buf, value, offset, littleEndian) {
13917 } 3472 if (value < 0) value = 0xffff + value + 1
3473 for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
3474 buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
3475 (littleEndian ? i : 1 - i) * 8
3476 }
3477}
13918 3478
13919 isFunction = jQuery.isFunction( value ); 3479Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
3480 value = +value
3481 offset = offset | 0
3482 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
3483 if (Buffer.TYPED_ARRAY_SUPPORT) {
3484 this[offset] = value
3485 this[offset + 1] = (value >>> 8)
3486 } else {
3487 objectWriteUInt16(this, value, offset, true)
3488 }
3489 return offset + 2
3490}
13920 3491
13921 return this.each(function( i ) { 3492Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
13922 var val; 3493 value = +value
3494 offset = offset | 0
3495 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
3496 if (Buffer.TYPED_ARRAY_SUPPORT) {
3497 this[offset] = (value >>> 8)
3498 this[offset + 1] = value
3499 } else {
3500 objectWriteUInt16(this, value, offset, false)
3501 }
3502 return offset + 2
3503}
13923 3504
13924 if ( this.nodeType !== 1 ) { 3505function objectWriteUInt32 (buf, value, offset, littleEndian) {
13925 return; 3506 if (value < 0) value = 0xffffffff + value + 1
13926 } 3507 for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
3508 buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
3509 }
3510}
13927 3511
13928 if ( isFunction ) { 3512Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
13929 val = value.call( this, i, jQuery( this ).val() ); 3513 value = +value
13930 } else { 3514 offset = offset | 0
13931 val = value; 3515 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
13932 } 3516 if (Buffer.TYPED_ARRAY_SUPPORT) {
3517 this[offset + 3] = (value >>> 24)
3518 this[offset + 2] = (value >>> 16)
3519 this[offset + 1] = (value >>> 8)
3520 this[offset] = value
3521 } else {
3522 objectWriteUInt32(this, value, offset, true)
3523 }
3524 return offset + 4
3525}
13933 3526
13934 // Treat null/undefined as ""; convert numbers to string 3527Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
13935 if ( val == null ) { 3528 value = +value
13936 val = ""; 3529 offset = offset | 0
3530 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
3531 if (Buffer.TYPED_ARRAY_SUPPORT) {
3532 this[offset] = (value >>> 24)
3533 this[offset + 1] = (value >>> 16)
3534 this[offset + 2] = (value >>> 8)
3535 this[offset + 3] = value
3536 } else {
3537 objectWriteUInt32(this, value, offset, false)
3538 }
3539 return offset + 4
3540}
13937 3541
13938 } else if ( typeof val === "number" ) { 3542Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
13939 val += ""; 3543 value = +value
3544 offset = offset | 0
3545 if (!noAssert) {
3546 var limit = Math.pow(2, 8 * byteLength - 1)
13940 3547
13941 } else if ( jQuery.isArray( val ) ) { 3548 checkInt(this, value, offset, byteLength, limit - 1, -limit)
13942 val = jQuery.map( val, function( value ) { 3549 }
13943 return value == null ? "" : value + "";
13944 });
13945 }
13946 3550
13947 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 3551 var i = 0
3552 var mul = 1
3553 var sub = value < 0 ? 1 : 0
3554 this[offset] = value & 0xFF
3555 while (++i < byteLength && (mul *= 0x100)) {
3556 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
3557 }
13948 3558
13949 // If set returns undefined, fall back to normal setting 3559 return offset + byteLength
13950 if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { 3560}
13951 this.value = val;
13952 }
13953 });
13954 }
13955});
13956 3561
13957jQuery.extend({ 3562Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
13958 valHooks: { 3563 value = +value
13959 option: { 3564 offset = offset | 0
13960 get: function( elem ) { 3565 if (!noAssert) {
13961 var val = jQuery.find.attr( elem, "value" ); 3566 var limit = Math.pow(2, 8 * byteLength - 1)
13962 return val != null ?
13963 val :
13964 // Support: IE10-11+
13965 // option.text throws exceptions (#14686, #14858)
13966 jQuery.trim( jQuery.text( elem ) );
13967 }
13968 },
13969 select: {
13970 get: function( elem ) {
13971 var value, option,
13972 options = elem.options,
13973 index = elem.selectedIndex,
13974 one = elem.type === "select-one" || index < 0,
13975 values = one ? null : [],
13976 max = one ? index + 1 : options.length,
13977 i = index < 0 ?
13978 max :
13979 one ? index : 0;
13980
13981 // Loop through all the selected options
13982 for ( ; i < max; i++ ) {
13983 option = options[ i ];
13984
13985 // IE6-9 doesn't update selected after form reset (#2551)
13986 if ( ( option.selected || i === index ) &&
13987 // Don't return options that are disabled or in a disabled optgroup
13988 ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
13989 ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
13990
13991 // Get the specific value for the option
13992 value = jQuery( option ).val();
13993
13994 // We don't need an array for one selects
13995 if ( one ) {
13996 return value;
13997 }
13998
13999 // Multi-Selects return an array
14000 values.push( value );
14001 }
14002 }
14003
14004 return values;
14005 },
14006 3567
14007 set: function( elem, value ) { 3568 checkInt(this, value, offset, byteLength, limit - 1, -limit)
14008 var optionSet, option, 3569 }
14009 options = elem.options,
14010 values = jQuery.makeArray( value ),
14011 i = options.length;
14012
14013 while ( i-- ) {
14014 option = options[ i ];
14015 if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
14016 optionSet = true;
14017 }
14018 }
14019
14020 // force browsers to behave consistently when non-matching value is set
14021 if ( !optionSet ) {
14022 elem.selectedIndex = -1;
14023 }
14024 return values;
14025 }
14026 }
14027 }
14028});
14029 3570
14030// Radios and checkboxes getter/setter 3571 var i = byteLength - 1
14031jQuery.each([ "radio", "checkbox" ], function() { 3572 var mul = 1
14032 jQuery.valHooks[ this ] = { 3573 var sub = value < 0 ? 1 : 0
14033 set: function( elem, value ) { 3574 this[offset + i] = value & 0xFF
14034 if ( jQuery.isArray( value ) ) { 3575 while (--i >= 0 && (mul *= 0x100)) {
14035 return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); 3576 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
14036 } 3577 }
14037 }
14038 };
14039 if ( !support.checkOn ) {
14040 jQuery.valHooks[ this ].get = function( elem ) {
14041 // Support: Webkit
14042 // "" is returned instead of "on" if a value isn't specified
14043 return elem.getAttribute("value") === null ? "on" : elem.value;
14044 };
14045 }
14046});
14047 3578
3579 return offset + byteLength
3580}
14048 3581
3582Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
3583 value = +value
3584 offset = offset | 0
3585 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
3586 if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
3587 if (value < 0) value = 0xff + value + 1
3588 this[offset] = value
3589 return offset + 1
3590}
14049 3591
3592Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
3593 value = +value
3594 offset = offset | 0
3595 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
3596 if (Buffer.TYPED_ARRAY_SUPPORT) {
3597 this[offset] = value
3598 this[offset + 1] = (value >>> 8)
3599 } else {
3600 objectWriteUInt16(this, value, offset, true)
3601 }
3602 return offset + 2
3603}
14050 3604
14051// Return jQuery for attributes-only inclusion 3605Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
3606 value = +value
3607 offset = offset | 0
3608 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
3609 if (Buffer.TYPED_ARRAY_SUPPORT) {
3610 this[offset] = (value >>> 8)
3611 this[offset + 1] = value
3612 } else {
3613 objectWriteUInt16(this, value, offset, false)
3614 }
3615 return offset + 2
3616}
14052 3617
3618Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
3619 value = +value
3620 offset = offset | 0
3621 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
3622 if (Buffer.TYPED_ARRAY_SUPPORT) {
3623 this[offset] = value
3624 this[offset + 1] = (value >>> 8)
3625 this[offset + 2] = (value >>> 16)
3626 this[offset + 3] = (value >>> 24)
3627 } else {
3628 objectWriteUInt32(this, value, offset, true)
3629 }
3630 return offset + 4
3631}
14053 3632
14054jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + 3633Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
14055 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 3634 value = +value
14056 "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { 3635 offset = offset | 0
3636 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
3637 if (value < 0) value = 0xffffffff + value + 1
3638 if (Buffer.TYPED_ARRAY_SUPPORT) {
3639 this[offset] = (value >>> 24)
3640 this[offset + 1] = (value >>> 16)
3641 this[offset + 2] = (value >>> 8)
3642 this[offset + 3] = value
3643 } else {
3644 objectWriteUInt32(this, value, offset, false)
3645 }
3646 return offset + 4
3647}
14057 3648
14058 // Handle event binding 3649function checkIEEE754 (buf, value, offset, ext, max, min) {
14059 jQuery.fn[ name ] = function( data, fn ) { 3650 if (value > max || value < min) throw new RangeError('value is out of bounds')
14060 return arguments.length > 0 ? 3651 if (offset + ext > buf.length) throw new RangeError('index out of range')
14061 this.on( name, null, data, fn ) : 3652 if (offset < 0) throw new RangeError('index out of range')
14062 this.trigger( name ); 3653}
14063 };
14064});
14065 3654
14066jQuery.fn.extend({ 3655function writeFloat (buf, value, offset, littleEndian, noAssert) {
14067 hover: function( fnOver, fnOut ) { 3656 if (!noAssert) {
14068 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 3657 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
14069 }, 3658 }
3659 ieee754.write(buf, value, offset, littleEndian, 23, 4)
3660 return offset + 4
3661}
14070 3662
14071 bind: function( types, data, fn ) { 3663Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
14072 return this.on( types, null, data, fn ); 3664 return writeFloat(this, value, offset, true, noAssert)
14073 }, 3665}
14074 unbind: function( types, fn ) {
14075 return this.off( types, null, fn );
14076 },
14077 3666
14078 delegate: function( selector, types, data, fn ) { 3667Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
14079 return this.on( types, selector, data, fn ); 3668 return writeFloat(this, value, offset, false, noAssert)
14080 }, 3669}
14081 undelegate: function( selector, types, fn ) {
14082 // ( namespace ) or ( selector, types [, fn] )
14083 return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
14084 }
14085});
14086 3670
3671function writeDouble (buf, value, offset, littleEndian, noAssert) {
3672 if (!noAssert) {
3673 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
3674 }
3675 ieee754.write(buf, value, offset, littleEndian, 52, 8)
3676 return offset + 8
3677}
14087 3678
14088var nonce = jQuery.now(); 3679Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
3680 return writeDouble(this, value, offset, true, noAssert)
3681}
14089 3682
14090var rquery = (/\?/); 3683Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
3684 return writeDouble(this, value, offset, false, noAssert)
3685}
14091 3686
3687// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
3688Buffer.prototype.copy = function copy (target, targetStart, start, end) {
3689 if (!start) start = 0
3690 if (!end && end !== 0) end = this.length
3691 if (targetStart >= target.length) targetStart = target.length
3692 if (!targetStart) targetStart = 0
3693 if (end > 0 && end < start) end = start
14092 3694
3695 // Copy 0 bytes; we're done
3696 if (end === start) return 0
3697 if (target.length === 0 || this.length === 0) return 0
14093 3698
14094// Support: Android 2.3 3699 // Fatal error conditions
14095// Workaround failure to string-cast null input 3700 if (targetStart < 0) {
14096jQuery.parseJSON = function( data ) { 3701 throw new RangeError('targetStart out of bounds')
14097 return JSON.parse( data + "" ); 3702 }
14098}; 3703 if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
3704 if (end < 0) throw new RangeError('sourceEnd out of bounds')
14099 3705
3706 // Are we oob?
3707 if (end > this.length) end = this.length
3708 if (target.length - targetStart < end - start) {
3709 end = target.length - targetStart + start
3710 }
14100 3711
14101// Cross-browser xml parsing 3712 var len = end - start
14102jQuery.parseXML = function( data ) { 3713 var i
14103 var xml, tmp;
14104 if ( !data || typeof data !== "string" ) {
14105 return null;
14106 }
14107 3714
14108 // Support: IE9 3715 if (this === target && start < targetStart && targetStart < end) {
14109 try { 3716 // descending copy from end
14110 tmp = new DOMParser(); 3717 for (i = len - 1; i >= 0; i--) {
14111 xml = tmp.parseFromString( data, "text/xml" ); 3718 target[i + targetStart] = this[i + start]
14112 } catch ( e ) {
14113 xml = undefined;
14114 } 3719 }
14115 3720 } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
14116 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 3721 // ascending copy from start
14117 jQuery.error( "Invalid XML: " + data ); 3722 for (i = 0; i < len; i++) {
3723 target[i + targetStart] = this[i + start]
14118 } 3724 }
14119 return xml; 3725 } else {
14120}; 3726 target._set(this.subarray(start, start + len), targetStart)
14121 3727 }
14122
14123var
14124 // Document location
14125 ajaxLocParts,
14126 ajaxLocation,
14127
14128 rhash = /#.*$/,
14129 rts = /([?&])_=[^&]*/,
14130 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
14131 // #7653, #8125, #8152: local protocol detection
14132 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
14133 rnoContent = /^(?:GET|HEAD)$/,
14134 rprotocol = /^\/\//,
14135 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
14136
14137 /* Prefilters
14138 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
14139 * 2) These are called:
14140 * - BEFORE asking for a transport
14141 * - AFTER param serialization (s.data is a string if s.processData is true)
14142 * 3) key is the dataType
14143 * 4) the catchall symbol "*" can be used
14144 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
14145 */
14146 prefilters = {},
14147
14148 /* Transports bindings
14149 * 1) key is the dataType
14150 * 2) the catchall symbol "*" can be used
14151 * 3) selection will start with transport dataType and THEN go to "*" if needed
14152 */
14153 transports = {},
14154
14155 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
14156 allTypes = "*/".concat("*");
14157
14158// #8138, IE may throw an exception when accessing
14159// a field from window.location if document.domain has been set
14160try {
14161 ajaxLocation = location.href;
14162} catch( e ) {
14163 // Use the href attribute of an A element
14164 // since IE will modify it given document.location
14165 ajaxLocation = document.createElement( "a" );
14166 ajaxLocation.href = "";
14167 ajaxLocation = ajaxLocation.href;
14168}
14169
14170// Segment location into parts
14171ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
14172
14173// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
14174function addToPrefiltersOrTransports( structure ) {
14175
14176 // dataTypeExpression is optional and defaults to "*"
14177 return function( dataTypeExpression, func ) {
14178
14179 if ( typeof dataTypeExpression !== "string" ) {
14180 func = dataTypeExpression;
14181 dataTypeExpression = "*";
14182 }
14183 3728
14184 var dataType, 3729 return len
14185 i = 0,
14186 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];
14187
14188 if ( jQuery.isFunction( func ) ) {
14189 // For each dataType in the dataTypeExpression
14190 while ( (dataType = dataTypes[i++]) ) {
14191 // Prepend if requested
14192 if ( dataType[0] === "+" ) {
14193 dataType = dataType.slice( 1 ) || "*";
14194 (structure[ dataType ] = structure[ dataType ] || []).unshift( func );
14195
14196 // Otherwise append
14197 } else {
14198 (structure[ dataType ] = structure[ dataType ] || []).push( func );
14199 }
14200 }
14201 }
14202 };
14203} 3730}
14204 3731
14205// Base inspection function for prefilters and transports 3732// fill(value, start=0, end=buffer.length)
14206function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 3733Buffer.prototype.fill = function fill (value, start, end) {
3734 if (!value) value = 0
3735 if (!start) start = 0
3736 if (!end) end = this.length
14207 3737
14208 var inspected = {}, 3738 if (end < start) throw new RangeError('end < start')
14209 seekingTransport = ( structure === transports );
14210 3739
14211 function inspect( dataType ) { 3740 // Fill 0 bytes; we're done
14212 var selected; 3741 if (end === start) return
14213 inspected[ dataType ] = true; 3742 if (this.length === 0) return
14214 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
14215 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
14216 if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
14217 options.dataTypes.unshift( dataTypeOrTransport );
14218 inspect( dataTypeOrTransport );
14219 return false;
14220 } else if ( seekingTransport ) {
14221 return !( selected = dataTypeOrTransport );
14222 }
14223 });
14224 return selected;
14225 }
14226
14227 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
14228}
14229 3743
14230// A special extend for ajax options 3744 if (start < 0 || start >= this.length) throw new RangeError('start out of bounds')
14231// that takes "flat" options (not to be deep extended) 3745 if (end < 0 || end > this.length) throw new RangeError('end out of bounds')
14232// Fixes #9887
14233function ajaxExtend( target, src ) {
14234 var key, deep,
14235 flatOptions = jQuery.ajaxSettings.flatOptions || {};
14236 3746
14237 for ( key in src ) { 3747 var i
14238 if ( src[ key ] !== undefined ) { 3748 if (typeof value === 'number') {
14239 ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; 3749 for (i = start; i < end; i++) {
14240 } 3750 this[i] = value
14241 } 3751 }
14242 if ( deep ) { 3752 } else {
14243 jQuery.extend( true, target, deep ); 3753 var bytes = utf8ToBytes(value.toString())
3754 var len = bytes.length
3755 for (i = start; i < end; i++) {
3756 this[i] = bytes[i % len]
14244 } 3757 }
3758 }
14245 3759
14246 return target; 3760 return this
14247} 3761}
14248 3762
14249/* Handles responses to an ajax request: 3763/**
14250 * - finds the right dataType (mediates between content-type and expected dataType) 3764 * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
14251 * - returns the corresponding response 3765 * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
14252 */ 3766 */
14253function ajaxHandleResponses( s, jqXHR, responses ) { 3767Buffer.prototype.toArrayBuffer = function toArrayBuffer () {
14254 3768 if (typeof Uint8Array !== 'undefined') {
14255 var ct, type, finalDataType, firstDataType, 3769 if (Buffer.TYPED_ARRAY_SUPPORT) {
14256 contents = s.contents, 3770 return (new Buffer(this)).buffer
14257 dataTypes = s.dataTypes;
14258
14259 // Remove auto dataType and get content-type in the process
14260 while ( dataTypes[ 0 ] === "*" ) {
14261 dataTypes.shift();
14262 if ( ct === undefined ) {
14263 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
14264 }
14265 }
14266
14267 // Check if we're dealing with a known content-type
14268 if ( ct ) {
14269 for ( type in contents ) {
14270 if ( contents[ type ] && contents[ type ].test( ct ) ) {
14271 dataTypes.unshift( type );
14272 break;
14273 }
14274 }
14275 }
14276
14277 // Check to see if we have a response for the expected dataType
14278 if ( dataTypes[ 0 ] in responses ) {
14279 finalDataType = dataTypes[ 0 ];
14280 } else { 3771 } else {
14281 // Try convertible dataTypes 3772 var buf = new Uint8Array(this.length)
14282 for ( type in responses ) { 3773 for (var i = 0, len = buf.length; i < len; i += 1) {
14283 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { 3774 buf[i] = this[i]
14284 finalDataType = type; 3775 }
14285 break; 3776 return buf.buffer
14286 }
14287 if ( !firstDataType ) {
14288 firstDataType = type;
14289 }
14290 }
14291 // Or just use first one
14292 finalDataType = finalDataType || firstDataType;
14293 }
14294
14295 // If we found a dataType
14296 // We add the dataType to the list if needed
14297 // and return the corresponding response
14298 if ( finalDataType ) {
14299 if ( finalDataType !== dataTypes[ 0 ] ) {
14300 dataTypes.unshift( finalDataType );
14301 }
14302 return responses[ finalDataType ];
14303 } 3777 }
3778 } else {
3779 throw new TypeError('Buffer.toArrayBuffer not supported in this browser')
3780 }
14304} 3781}
14305 3782
14306/* Chain conversions given the request and the original response 3783// HELPER FUNCTIONS
14307 * Also sets the responseXXX fields on the jqXHR instance 3784// ================
14308 */
14309function ajaxConvert( s, response, jqXHR, isSuccess ) {
14310 var conv2, current, conv, tmp, prev,
14311 converters = {},
14312 // Work with a copy of dataTypes in case we need to modify it for conversion
14313 dataTypes = s.dataTypes.slice();
14314
14315 // Create converters map with lowercased keys
14316 if ( dataTypes[ 1 ] ) {
14317 for ( conv in s.converters ) {
14318 converters[ conv.toLowerCase() ] = s.converters[ conv ];
14319 }
14320 }
14321
14322 current = dataTypes.shift();
14323
14324 // Convert to each sequential dataType
14325 while ( current ) {
14326
14327 if ( s.responseFields[ current ] ) {
14328 jqXHR[ s.responseFields[ current ] ] = response;
14329 }
14330
14331 // Apply the dataFilter if provided
14332 if ( !prev && isSuccess && s.dataFilter ) {
14333 response = s.dataFilter( response, s.dataType );
14334 }
14335
14336 prev = current;
14337 current = dataTypes.shift();
14338
14339 if ( current ) {
14340
14341 // There's only work to do if current dataType is non-auto
14342 if ( current === "*" ) {
14343
14344 current = prev;
14345
14346 // Convert response if prev dataType is non-auto and differs from current
14347 } else if ( prev !== "*" && prev !== current ) {
14348
14349 // Seek a direct converter
14350 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
14351
14352 // If none found, seek a pair
14353 if ( !conv ) {
14354 for ( conv2 in converters ) {
14355
14356 // If conv2 outputs current
14357 tmp = conv2.split( " " );
14358 if ( tmp[ 1 ] === current ) {
14359
14360 // If prev can be converted to accepted input
14361 conv = converters[ prev + " " + tmp[ 0 ] ] ||
14362 converters[ "* " + tmp[ 0 ] ];
14363 if ( conv ) {
14364 // Condense equivalence converters
14365 if ( conv === true ) {
14366 conv = converters[ conv2 ];
14367
14368 // Otherwise, insert the intermediate dataType
14369 } else if ( converters[ conv2 ] !== true ) {
14370 current = tmp[ 0 ];
14371 dataTypes.unshift( tmp[ 1 ] );
14372 }
14373 break;
14374 }
14375 }
14376 }
14377 }
14378
14379 // Apply converter (if not an equivalence)
14380 if ( conv !== true ) {
14381
14382 // Unless errors are allowed to bubble, catch and return them
14383 if ( conv && s[ "throws" ] ) {
14384 response = conv( response );
14385 } else {
14386 try {
14387 response = conv( response );
14388 } catch ( e ) {
14389 return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
14390 }
14391 }
14392 }
14393 }
14394 }
14395 }
14396
14397 return { state: "success", data: response };
14398}
14399
14400jQuery.extend({
14401
14402 // Counter for holding the number of active queries
14403 active: 0,
14404
14405 // Last-Modified header cache for next request
14406 lastModified: {},
14407 etag: {},
14408
14409 ajaxSettings: {
14410 url: ajaxLocation,
14411 type: "GET",
14412 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
14413 global: true,
14414 processData: true,
14415 async: true,
14416 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
14417 /*
14418 timeout: 0,
14419 data: null,
14420 dataType: null,
14421 username: null,
14422 password: null,
14423 cache: null,
14424 throws: false,
14425 traditional: false,
14426 headers: {},
14427 */
14428
14429 accepts: {
14430 "*": allTypes,
14431 text: "text/plain",
14432 html: "text/html",
14433 xml: "application/xml, text/xml",
14434 json: "application/json, text/javascript"
14435 },
14436
14437 contents: {
14438 xml: /xml/,
14439 html: /html/,
14440 json: /json/
14441 },
14442
14443 responseFields: {
14444 xml: "responseXML",
14445 text: "responseText",
14446 json: "responseJSON"
14447 },
14448
14449 // Data converters
14450 // Keys separate source (or catchall "*") and destination types with a single space
14451 converters: {
14452
14453 // Convert anything to text
14454 "* text": String,
14455
14456 // Text to html (true = no transformation)
14457 "text html": true,
14458
14459 // Evaluate text as a json expression
14460 "text json": jQuery.parseJSON,
14461
14462 // Parse text as xml
14463 "text xml": jQuery.parseXML
14464 },
14465
14466 // For options that shouldn't be deep extended:
14467 // you can add your own custom options here if
14468 // and when you create one that shouldn't be
14469 // deep extended (see ajaxExtend)
14470 flatOptions: {
14471 url: true,
14472 context: true
14473 }
14474 },
14475
14476 // Creates a full fledged settings object into target
14477 // with both ajaxSettings and settings fields.
14478 // If target is omitted, writes into ajaxSettings.
14479 ajaxSetup: function( target, settings ) {
14480 return settings ?
14481
14482 // Building a settings object
14483 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
14484
14485 // Extending ajaxSettings
14486 ajaxExtend( jQuery.ajaxSettings, target );
14487 },
14488
14489 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
14490 ajaxTransport: addToPrefiltersOrTransports( transports ),
14491
14492 // Main method
14493 ajax: function( url, options ) {
14494
14495 // If url is an object, simulate pre-1.5 signature
14496 if ( typeof url === "object" ) {
14497 options = url;
14498 url = undefined;
14499 }
14500
14501 // Force options to be an object
14502 options = options || {};
14503
14504 var transport,
14505 // URL without anti-cache param
14506 cacheURL,
14507 // Response headers
14508 responseHeadersString,
14509 responseHeaders,
14510 // timeout handle
14511 timeoutTimer,
14512 // Cross-domain detection vars
14513 parts,
14514 // To know if global events are to be dispatched
14515 fireGlobals,
14516 // Loop variable
14517 i,
14518 // Create the final options object
14519 s = jQuery.ajaxSetup( {}, options ),
14520 // Callbacks context
14521 callbackContext = s.context || s,
14522 // Context for global events is callbackContext if it is a DOM node or jQuery collection
14523 globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
14524 jQuery( callbackContext ) :
14525 jQuery.event,
14526 // Deferreds
14527 deferred = jQuery.Deferred(),
14528 completeDeferred = jQuery.Callbacks("once memory"),
14529 // Status-dependent callbacks
14530 statusCode = s.statusCode || {},
14531 // Headers (they are sent all at once)
14532 requestHeaders = {},
14533 requestHeadersNames = {},
14534 // The jqXHR state
14535 state = 0,
14536 // Default abort message
14537 strAbort = "canceled",
14538 // Fake xhr
14539 jqXHR = {
14540 readyState: 0,
14541
14542 // Builds headers hashtable if needed
14543 getResponseHeader: function( key ) {
14544 var match;
14545 if ( state === 2 ) {
14546 if ( !responseHeaders ) {
14547 responseHeaders = {};
14548 while ( (match = rheaders.exec( responseHeadersString )) ) {
14549 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
14550 }
14551 }
14552 match = responseHeaders[ key.toLowerCase() ];
14553 }
14554 return match == null ? null : match;
14555 },
14556
14557 // Raw string
14558 getAllResponseHeaders: function() {
14559 return state === 2 ? responseHeadersString : null;
14560 },
14561
14562 // Caches the header
14563 setRequestHeader: function( name, value ) {
14564 var lname = name.toLowerCase();
14565 if ( !state ) {
14566 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
14567 requestHeaders[ name ] = value;
14568 }
14569 return this;
14570 },
14571
14572 // Overrides response content-type header
14573 overrideMimeType: function( type ) {
14574 if ( !state ) {
14575 s.mimeType = type;
14576 }
14577 return this;
14578 },
14579
14580 // Status-dependent callbacks
14581 statusCode: function( map ) {
14582 var code;
14583 if ( map ) {
14584 if ( state < 2 ) {
14585 for ( code in map ) {
14586 // Lazy-add the new callback in a way that preserves old ones
14587 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
14588 }
14589 } else {
14590 // Execute the appropriate callbacks
14591 jqXHR.always( map[ jqXHR.status ] );
14592 }
14593 }
14594 return this;
14595 },
14596
14597 // Cancel the request
14598 abort: function( statusText ) {
14599 var finalText = statusText || strAbort;
14600 if ( transport ) {
14601 transport.abort( finalText );
14602 }
14603 done( 0, finalText );
14604 return this;
14605 }
14606 };
14607
14608 // Attach deferreds
14609 deferred.promise( jqXHR ).complete = completeDeferred.add;
14610 jqXHR.success = jqXHR.done;
14611 jqXHR.error = jqXHR.fail;
14612
14613 // Remove hash character (#7531: and string promotion)
14614 // Add protocol if not provided (prefilters might expect it)
14615 // Handle falsy url in the settings object (#10093: consistency with old signature)
14616 // We also use the url parameter if available
14617 s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" )
14618 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
14619
14620 // Alias method option to type as per ticket #12004
14621 s.type = options.method || options.type || s.method || s.type;
14622
14623 // Extract dataTypes list
14624 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
14625
14626 // A cross-domain request is in order when we have a protocol:host:port mismatch
14627 if ( s.crossDomain == null ) {
14628 parts = rurl.exec( s.url.toLowerCase() );
14629 s.crossDomain = !!( parts &&
14630 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
14631 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
14632 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
14633 );
14634 }
14635
14636 // Convert data if not already a string
14637 if ( s.data && s.processData && typeof s.data !== "string" ) {
14638 s.data = jQuery.param( s.data, s.traditional );
14639 }
14640
14641 // Apply prefilters
14642 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
14643
14644 // If request was aborted inside a prefilter, stop there
14645 if ( state === 2 ) {
14646 return jqXHR;
14647 }
14648
14649 // We can fire global events as of now if asked to
14650 fireGlobals = s.global;
14651
14652 // Watch for a new set of requests
14653 if ( fireGlobals && jQuery.active++ === 0 ) {
14654 jQuery.event.trigger("ajaxStart");
14655 }
14656
14657 // Uppercase the type
14658 s.type = s.type.toUpperCase();
14659
14660 // Determine if request has content
14661 s.hasContent = !rnoContent.test( s.type );
14662
14663 // Save the URL in case we're toying with the If-Modified-Since
14664 // and/or If-None-Match header later on
14665 cacheURL = s.url;
14666
14667 // More options handling for requests with no content
14668 if ( !s.hasContent ) {
14669
14670 // If data is available, append data to url
14671 if ( s.data ) {
14672 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
14673 // #9682: remove data so that it's not used in an eventual retry
14674 delete s.data;
14675 }
14676
14677 // Add anti-cache in url if needed
14678 if ( s.cache === false ) {
14679 s.url = rts.test( cacheURL ) ?
14680
14681 // If there is already a '_' parameter, set its value
14682 cacheURL.replace( rts, "$1_=" + nonce++ ) :
14683
14684 // Otherwise add one to the end
14685 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
14686 }
14687 }
14688
14689 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
14690 if ( s.ifModified ) {
14691 if ( jQuery.lastModified[ cacheURL ] ) {
14692 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
14693 }
14694 if ( jQuery.etag[ cacheURL ] ) {
14695 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
14696 }
14697 }
14698
14699 // Set the correct header, if data is being sent
14700 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
14701 jqXHR.setRequestHeader( "Content-Type", s.contentType );
14702 }
14703
14704 // Set the Accepts header for the server, depending on the dataType
14705 jqXHR.setRequestHeader(
14706 "Accept",
14707 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
14708 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
14709 s.accepts[ "*" ]
14710 );
14711
14712 // Check for headers option
14713 for ( i in s.headers ) {
14714 jqXHR.setRequestHeader( i, s.headers[ i ] );
14715 }
14716
14717 // Allow custom headers/mimetypes and early abort
14718 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
14719 // Abort if not done already and return
14720 return jqXHR.abort();
14721 }
14722
14723 // aborting is no longer a cancellation
14724 strAbort = "abort";
14725
14726 // Install callbacks on deferreds
14727 for ( i in { success: 1, error: 1, complete: 1 } ) {
14728 jqXHR[ i ]( s[ i ] );
14729 }
14730
14731 // Get transport
14732 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
14733
14734 // If no transport, we auto-abort
14735 if ( !transport ) {
14736 done( -1, "No Transport" );
14737 } else {
14738 jqXHR.readyState = 1;
14739
14740 // Send global event
14741 if ( fireGlobals ) {
14742 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
14743 }
14744 // Timeout
14745 if ( s.async && s.timeout > 0 ) {
14746 timeoutTimer = setTimeout(function() {
14747 jqXHR.abort("timeout");
14748 }, s.timeout );
14749 }
14750
14751 try {
14752 state = 1;
14753 transport.send( requestHeaders, done );
14754 } catch ( e ) {
14755 // Propagate exception as error if not done
14756 if ( state < 2 ) {
14757 done( -1, e );
14758 // Simply rethrow otherwise
14759 } else {
14760 throw e;
14761 }
14762 }
14763 }
14764
14765 // Callback for when everything is done
14766 function done( status, nativeStatusText, responses, headers ) {
14767 var isSuccess, success, error, response, modified,
14768 statusText = nativeStatusText;
14769
14770 // Called once
14771 if ( state === 2 ) {
14772 return;
14773 }
14774
14775 // State is "done" now
14776 state = 2;
14777
14778 // Clear timeout if it exists
14779 if ( timeoutTimer ) {
14780 clearTimeout( timeoutTimer );
14781 }
14782
14783 // Dereference transport for early garbage collection
14784 // (no matter how long the jqXHR object will be used)
14785 transport = undefined;
14786
14787 // Cache response headers
14788 responseHeadersString = headers || "";
14789
14790 // Set readyState
14791 jqXHR.readyState = status > 0 ? 4 : 0;
14792
14793 // Determine if successful
14794 isSuccess = status >= 200 && status < 300 || status === 304;
14795
14796 // Get response data
14797 if ( responses ) {
14798 response = ajaxHandleResponses( s, jqXHR, responses );
14799 }
14800
14801 // Convert no matter what (that way responseXXX fields are always set)
14802 response = ajaxConvert( s, response, jqXHR, isSuccess );
14803
14804 // If successful, handle type chaining
14805 if ( isSuccess ) {
14806
14807 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
14808 if ( s.ifModified ) {
14809 modified = jqXHR.getResponseHeader("Last-Modified");
14810 if ( modified ) {
14811 jQuery.lastModified[ cacheURL ] = modified;
14812 }
14813 modified = jqXHR.getResponseHeader("etag");
14814 if ( modified ) {
14815 jQuery.etag[ cacheURL ] = modified;
14816 }
14817 }
14818
14819 // if no content
14820 if ( status === 204 || s.type === "HEAD" ) {
14821 statusText = "nocontent";
14822
14823 // if not modified
14824 } else if ( status === 304 ) {
14825 statusText = "notmodified";
14826
14827 // If we have data, let's convert it
14828 } else {
14829 statusText = response.state;
14830 success = response.data;
14831 error = response.error;
14832 isSuccess = !error;
14833 }
14834 } else {
14835 // We extract error from statusText
14836 // then normalize statusText and status for non-aborts
14837 error = statusText;
14838 if ( status || !statusText ) {
14839 statusText = "error";
14840 if ( status < 0 ) {
14841 status = 0;
14842 }
14843 }
14844 }
14845
14846 // Set data for the fake xhr object
14847 jqXHR.status = status;
14848 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
14849
14850 // Success/Error
14851 if ( isSuccess ) {
14852 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
14853 } else {
14854 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
14855 }
14856
14857 // Status-dependent callbacks
14858 jqXHR.statusCode( statusCode );
14859 statusCode = undefined;
14860
14861 if ( fireGlobals ) {
14862 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
14863 [ jqXHR, s, isSuccess ? success : error ] );
14864 }
14865
14866 // Complete
14867 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
14868
14869 if ( fireGlobals ) {
14870 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
14871 // Handle the global AJAX counter
14872 if ( !( --jQuery.active ) ) {
14873 jQuery.event.trigger("ajaxStop");
14874 }
14875 }
14876 }
14877
14878 return jqXHR;
14879 },
14880
14881 getJSON: function( url, data, callback ) {
14882 return jQuery.get( url, data, callback, "json" );
14883 },
14884
14885 getScript: function( url, callback ) {
14886 return jQuery.get( url, undefined, callback, "script" );
14887 }
14888});
14889
14890jQuery.each( [ "get", "post" ], function( i, method ) {
14891 jQuery[ method ] = function( url, data, callback, type ) {
14892 // shift arguments if data argument was omitted
14893 if ( jQuery.isFunction( data ) ) {
14894 type = type || callback;
14895 callback = data;
14896 data = undefined;
14897 }
14898
14899 return jQuery.ajax({
14900 url: url,
14901 type: method,
14902 dataType: type,
14903 data: data,
14904 success: callback
14905 });
14906 };
14907});
14908 3785
14909// Attach a bunch of functions for handling common AJAX events 3786var BP = Buffer.prototype
14910jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
14911 jQuery.fn[ type ] = function( fn ) {
14912 return this.on( type, fn );
14913 };
14914});
14915 3787
3788/**
3789 * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
3790 */
3791Buffer._augment = function _augment (arr) {
3792 arr.constructor = Buffer
3793 arr._isBuffer = true
14916 3794
14917jQuery._evalUrl = function( url ) { 3795 // save reference to original Uint8Array set method before overwriting
14918 return jQuery.ajax({ 3796 arr._set = arr.set
14919 url: url,
14920 type: "GET",
14921 dataType: "script",
14922 async: false,
14923 global: false,
14924 "throws": true
14925 });
14926};
14927 3797
3798 // deprecated
3799 arr.get = BP.get
3800 arr.set = BP.set
14928 3801
14929jQuery.fn.extend({ 3802 arr.write = BP.write
14930 wrapAll: function( html ) { 3803 arr.toString = BP.toString
14931 var wrap; 3804 arr.toLocaleString = BP.toString
3805 arr.toJSON = BP.toJSON
3806 arr.equals = BP.equals
3807 arr.compare = BP.compare
3808 arr.indexOf = BP.indexOf
3809 arr.copy = BP.copy
3810 arr.slice = BP.slice
3811 arr.readUIntLE = BP.readUIntLE
3812 arr.readUIntBE = BP.readUIntBE
3813 arr.readUInt8 = BP.readUInt8
3814 arr.readUInt16LE = BP.readUInt16LE
3815 arr.readUInt16BE = BP.readUInt16BE
3816 arr.readUInt32LE = BP.readUInt32LE
3817 arr.readUInt32BE = BP.readUInt32BE
3818 arr.readIntLE = BP.readIntLE
3819 arr.readIntBE = BP.readIntBE
3820 arr.readInt8 = BP.readInt8
3821 arr.readInt16LE = BP.readInt16LE
3822 arr.readInt16BE = BP.readInt16BE
3823 arr.readInt32LE = BP.readInt32LE
3824 arr.readInt32BE = BP.readInt32BE
3825 arr.readFloatLE = BP.readFloatLE
3826 arr.readFloatBE = BP.readFloatBE
3827 arr.readDoubleLE = BP.readDoubleLE
3828 arr.readDoubleBE = BP.readDoubleBE
3829 arr.writeUInt8 = BP.writeUInt8
3830 arr.writeUIntLE = BP.writeUIntLE
3831 arr.writeUIntBE = BP.writeUIntBE
3832 arr.writeUInt16LE = BP.writeUInt16LE
3833 arr.writeUInt16BE = BP.writeUInt16BE
3834 arr.writeUInt32LE = BP.writeUInt32LE
3835 arr.writeUInt32BE = BP.writeUInt32BE
3836 arr.writeIntLE = BP.writeIntLE
3837 arr.writeIntBE = BP.writeIntBE
3838 arr.writeInt8 = BP.writeInt8
3839 arr.writeInt16LE = BP.writeInt16LE
3840 arr.writeInt16BE = BP.writeInt16BE
3841 arr.writeInt32LE = BP.writeInt32LE
3842 arr.writeInt32BE = BP.writeInt32BE
3843 arr.writeFloatLE = BP.writeFloatLE
3844 arr.writeFloatBE = BP.writeFloatBE
3845 arr.writeDoubleLE = BP.writeDoubleLE
3846 arr.writeDoubleBE = BP.writeDoubleBE
3847 arr.fill = BP.fill
3848 arr.inspect = BP.inspect
3849 arr.toArrayBuffer = BP.toArrayBuffer
14932 3850
14933 if ( jQuery.isFunction( html ) ) { 3851 return arr
14934 return this.each(function( i ) { 3852}
14935 jQuery( this ).wrapAll( html.call(this, i) );
14936 });
14937 }
14938 3853
14939 if ( this[ 0 ] ) { 3854var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
14940 3855
14941 // The elements to wrap the target around 3856function base64clean (str) {
14942 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 3857 // Node strips out invalid characters like \n and \t from the string, base64-js does not
3858 str = stringtrim(str).replace(INVALID_BASE64_RE, '')
3859 // Node converts strings with length < 2 to ''
3860 if (str.length < 2) return ''
3861 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
3862 while (str.length % 4 !== 0) {
3863 str = str + '='
3864 }
3865 return str
3866}
14943 3867
14944 if ( this[ 0 ].parentNode ) { 3868function stringtrim (str) {
14945 wrap.insertBefore( this[ 0 ] ); 3869 if (str.trim) return str.trim()
14946 } 3870 return str.replace(/^\s+|\s+$/g, '')
3871}
14947 3872
14948 wrap.map(function() { 3873function toHex (n) {
14949 var elem = this; 3874 if (n < 16) return '0' + n.toString(16)
3875 return n.toString(16)
3876}
14950 3877
14951 while ( elem.firstElementChild ) { 3878function utf8ToBytes (string, units) {
14952 elem = elem.firstElementChild; 3879 units = units || Infinity
14953 } 3880 var codePoint
3881 var length = string.length
3882 var leadSurrogate = null
3883 var bytes = []
14954 3884
14955 return elem; 3885 for (var i = 0; i < length; i++) {
14956 }).append( this ); 3886 codePoint = string.charCodeAt(i)
14957 }
14958 3887
14959 return this; 3888 // is surrogate component
14960 }, 3889 if (codePoint > 0xD7FF && codePoint < 0xE000) {
3890 // last char was a lead
3891 if (!leadSurrogate) {
3892 // no lead yet
3893 if (codePoint > 0xDBFF) {
3894 // unexpected trail
3895 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
3896 continue
14961 3897
14962 wrapInner: function( html ) { 3898 } else if (i + 1 === length) {
14963 if ( jQuery.isFunction( html ) ) { 3899 // unpaired lead
14964 return this.each(function( i ) { 3900 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
14965 jQuery( this ).wrapInner( html.call(this, i) ); 3901 continue
14966 });
14967 } 3902 }
14968 3903
14969 return this.each(function() { 3904 // valid lead
14970 var self = jQuery( this ), 3905 leadSurrogate = codePoint
14971 contents = self.contents();
14972
14973 if ( contents.length ) {
14974 contents.wrapAll( html );
14975
14976 } else {
14977 self.append( html );
14978 }
14979 });
14980 },
14981
14982 wrap: function( html ) {
14983 var isFunction = jQuery.isFunction( html );
14984
14985 return this.each(function( i ) {
14986 jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
14987 });
14988 },
14989
14990 unwrap: function() {
14991 return this.parent().each(function() {
14992 if ( !jQuery.nodeName( this, "body" ) ) {
14993 jQuery( this ).replaceWith( this.childNodes );
14994 }
14995 }).end();
14996 }
14997});
14998
14999
15000jQuery.expr.filters.hidden = function( elem ) {
15001 // Support: Opera <= 12.12
15002 // Opera reports offsetWidths and offsetHeights less than zero on some elements
15003 return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
15004};
15005jQuery.expr.filters.visible = function( elem ) {
15006 return !jQuery.expr.filters.hidden( elem );
15007};
15008
15009
15010 3906
3907 continue
3908 }
15011 3909
15012var r20 = /%20/g, 3910 // 2 leads in a row
15013 rbracket = /\[\]$/, 3911 if (codePoint < 0xDC00) {
15014 rCRLF = /\r?\n/g, 3912 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
15015 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 3913 leadSurrogate = codePoint
15016 rsubmittable = /^(?:input|select|textarea|keygen)/i; 3914 continue
15017 3915 }
15018function buildParams( prefix, obj, traditional, add ) {
15019 var name;
15020
15021 if ( jQuery.isArray( obj ) ) {
15022 // Serialize array item.
15023 jQuery.each( obj, function( i, v ) {
15024 if ( traditional || rbracket.test( prefix ) ) {
15025 // Treat each array item as a scalar.
15026 add( prefix, v );
15027
15028 } else {
15029 // Item is non-scalar (array or object), encode its numeric index.
15030 buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
15031 }
15032 });
15033
15034 } else if ( !traditional && jQuery.type( obj ) === "object" ) {
15035 // Serialize object item.
15036 for ( name in obj ) {
15037 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
15038 }
15039 3916
3917 // valid surrogate pair
3918 codePoint = leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00 | 0x10000
3919
3920 } else if (leadSurrogate) {
3921 // valid bmp char, but last char was a lead
3922 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
3923 }
3924
3925 leadSurrogate = null
3926
3927 // encode utf8
3928 if (codePoint < 0x80) {
3929 if ((units -= 1) < 0) break
3930 bytes.push(codePoint)
3931 } else if (codePoint < 0x800) {
3932 if ((units -= 2) < 0) break
3933 bytes.push(
3934 codePoint >> 0x6 | 0xC0,
3935 codePoint & 0x3F | 0x80
3936 )
3937 } else if (codePoint < 0x10000) {
3938 if ((units -= 3) < 0) break
3939 bytes.push(
3940 codePoint >> 0xC | 0xE0,
3941 codePoint >> 0x6 & 0x3F | 0x80,
3942 codePoint & 0x3F | 0x80
3943 )
3944 } else if (codePoint < 0x110000) {
3945 if ((units -= 4) < 0) break
3946 bytes.push(
3947 codePoint >> 0x12 | 0xF0,
3948 codePoint >> 0xC & 0x3F | 0x80,
3949 codePoint >> 0x6 & 0x3F | 0x80,
3950 codePoint & 0x3F | 0x80
3951 )
15040 } else { 3952 } else {
15041 // Serialize scalar item. 3953 throw new Error('Invalid code point')
15042 add( prefix, obj );
15043 }
15044}
15045
15046// Serialize an array of form elements or a set of
15047// key/values into a query string
15048jQuery.param = function( a, traditional ) {
15049 var prefix,
15050 s = [],
15051 add = function( key, value ) {
15052 // If value is a function, invoke it and return its value
15053 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
15054 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
15055 };
15056
15057 // Set traditional to true for jQuery <= 1.3.2 behavior.
15058 if ( traditional === undefined ) {
15059 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
15060 } 3954 }
3955 }
15061 3956
15062 // If an array was passed in, assume that it is an array of form elements. 3957 return bytes
15063 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 3958}
15064 // Serialize the form elements
15065 jQuery.each( a, function() {
15066 add( this.name, this.value );
15067 });
15068 3959
15069 } else { 3960function asciiToBytes (str) {
15070 // If traditional, encode the "old" way (the way 1.3.2 or older 3961 var byteArray = []
15071 // did it), otherwise encode params recursively. 3962 for (var i = 0; i < str.length; i++) {
15072 for ( prefix in a ) { 3963 // Node's code seems to be doing this and not & 0x7F..
15073 buildParams( prefix, a[ prefix ], traditional, add ); 3964 byteArray.push(str.charCodeAt(i) & 0xFF)
15074 } 3965 }
15075 } 3966 return byteArray
3967}
15076 3968
15077 // Return the resulting serialization 3969function utf16leToBytes (str, units) {
15078 return s.join( "&" ).replace( r20, "+" ); 3970 var c, hi, lo
15079}; 3971 var byteArray = []
3972 for (var i = 0; i < str.length; i++) {
3973 if ((units -= 2) < 0) break
15080 3974
15081jQuery.fn.extend({ 3975 c = str.charCodeAt(i)
15082 serialize: function() { 3976 hi = c >> 8
15083 return jQuery.param( this.serializeArray() ); 3977 lo = c % 256
15084 }, 3978 byteArray.push(lo)
15085 serializeArray: function() { 3979 byteArray.push(hi)
15086 return this.map(function() { 3980 }
15087 // Can add propHook for "elements" to filter or add form elements
15088 var elements = jQuery.prop( this, "elements" );
15089 return elements ? jQuery.makeArray( elements ) : this;
15090 })
15091 .filter(function() {
15092 var type = this.type;
15093
15094 // Use .is( ":disabled" ) so that fieldset[disabled] works
15095 return this.name && !jQuery( this ).is( ":disabled" ) &&
15096 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
15097 ( this.checked || !rcheckableType.test( type ) );
15098 })
15099 .map(function( i, elem ) {
15100 var val = jQuery( this ).val();
15101
15102 return val == null ?
15103 null :
15104 jQuery.isArray( val ) ?
15105 jQuery.map( val, function( val ) {
15106 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
15107 }) :
15108 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
15109 }).get();
15110 }
15111});
15112 3981
3982 return byteArray
3983}
15113 3984
15114jQuery.ajaxSettings.xhr = function() { 3985function base64ToBytes (str) {
15115 try { 3986 return base64.toByteArray(base64clean(str))
15116 return new XMLHttpRequest(); 3987}
15117 } catch( e ) {}
15118};
15119 3988
15120var xhrId = 0, 3989function blitBuffer (src, dst, offset, length) {
15121 xhrCallbacks = {}, 3990 for (var i = 0; i < length; i++) {
15122 xhrSuccessStatus = { 3991 if ((i + offset >= dst.length) || (i >= src.length)) break
15123 // file protocol always yields status code 0, assume 200 3992 dst[i + offset] = src[i]
15124 0: 200, 3993 }
15125 // Support: IE9 3994 return i
15126 // #1450: sometimes IE returns 1223 when it should be 204
15127 1223: 204
15128 },
15129 xhrSupported = jQuery.ajaxSettings.xhr();
15130
15131// Support: IE9
15132// Open requests must be manually aborted on unload (#5280)
15133if ( window.ActiveXObject ) {
15134 jQuery( window ).on( "unload", function() {
15135 for ( var key in xhrCallbacks ) {
15136 xhrCallbacks[ key ]();
15137 }
15138 });
15139} 3995}
15140 3996
15141support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 3997},{"base64-js":8,"ieee754":9,"is-array":10}],8:[function(require,module,exports){
15142support.ajax = xhrSupported = !!xhrSupported; 3998var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
15143
15144jQuery.ajaxTransport(function( options ) {
15145 var callback;
15146
15147 // Cross domain only allowed if supported through XMLHttpRequest
15148 if ( support.cors || xhrSupported && !options.crossDomain ) {
15149 return {
15150 send: function( headers, complete ) {
15151 var i,
15152 xhr = options.xhr(),
15153 id = ++xhrId;
15154
15155 xhr.open( options.type, options.url, options.async, options.username, options.password );
15156
15157 // Apply custom fields if provided
15158 if ( options.xhrFields ) {
15159 for ( i in options.xhrFields ) {
15160 xhr[ i ] = options.xhrFields[ i ];
15161 }
15162 }
15163
15164 // Override mime type if needed
15165 if ( options.mimeType && xhr.overrideMimeType ) {
15166 xhr.overrideMimeType( options.mimeType );
15167 }
15168
15169 // X-Requested-With header
15170 // For cross-domain requests, seeing as conditions for a preflight are
15171 // akin to a jigsaw puzzle, we simply never set it to be sure.
15172 // (it can always be set on a per-request basis or even using ajaxSetup)
15173 // For same-domain requests, won't change header if already provided.
15174 if ( !options.crossDomain && !headers["X-Requested-With"] ) {
15175 headers["X-Requested-With"] = "XMLHttpRequest";
15176 }
15177
15178 // Set headers
15179 for ( i in headers ) {
15180 xhr.setRequestHeader( i, headers[ i ] );
15181 }
15182
15183 // Callback
15184 callback = function( type ) {
15185 return function() {
15186 if ( callback ) {
15187 delete xhrCallbacks[ id ];
15188 callback = xhr.onload = xhr.onerror = null;
15189
15190 if ( type === "abort" ) {
15191 xhr.abort();
15192 } else if ( type === "error" ) {
15193 complete(
15194 // file: protocol always yields status 0; see #8605, #14207
15195 xhr.status,
15196 xhr.statusText
15197 );
15198 } else {
15199 complete(
15200 xhrSuccessStatus[ xhr.status ] || xhr.status,
15201 xhr.statusText,
15202 // Support: IE9
15203 // Accessing binary-data responseText throws an exception
15204 // (#11426)
15205 typeof xhr.responseText === "string" ? {
15206 text: xhr.responseText
15207 } : undefined,
15208 xhr.getAllResponseHeaders()
15209 );
15210 }
15211 }
15212 };
15213 };
15214
15215 // Listen to events
15216 xhr.onload = callback();
15217 xhr.onerror = callback("error");
15218
15219 // Create the abort callback
15220 callback = xhrCallbacks[ id ] = callback("abort");
15221
15222 try {
15223 // Do send the request (this may raise an exception)
15224 xhr.send( options.hasContent && options.data || null );
15225 } catch ( e ) {
15226 // #14683: Only rethrow if this hasn't been notified as an error yet
15227 if ( callback ) {
15228 throw e;
15229 }
15230 }
15231 },
15232 3999
15233 abort: function() { 4000;(function (exports) {
15234 if ( callback ) { 4001 'use strict';
15235 callback();
15236 }
15237 }
15238 };
15239 }
15240});
15241 4002
4003 var Arr = (typeof Uint8Array !== 'undefined')
4004 ? Uint8Array
4005 : Array
15242 4006
4007 var PLUS = '+'.charCodeAt(0)
4008 var SLASH = '/'.charCodeAt(0)
4009 var NUMBER = '0'.charCodeAt(0)
4010 var LOWER = 'a'.charCodeAt(0)
4011 var UPPER = 'A'.charCodeAt(0)
4012 var PLUS_URL_SAFE = '-'.charCodeAt(0)
4013 var SLASH_URL_SAFE = '_'.charCodeAt(0)
15243 4014
4015 function decode (elt) {
4016 var code = elt.charCodeAt(0)
4017 if (code === PLUS ||
4018 code === PLUS_URL_SAFE)
4019 return 62 // '+'
4020 if (code === SLASH ||
4021 code === SLASH_URL_SAFE)
4022 return 63 // '/'
4023 if (code < NUMBER)
4024 return -1 //no match
4025 if (code < NUMBER + 10)
4026 return code - NUMBER + 26 + 26
4027 if (code < UPPER + 26)
4028 return code - UPPER
4029 if (code < LOWER + 26)
4030 return code - LOWER + 26
4031 }
15244 4032
15245// Install script dataType 4033 function b64ToByteArray (b64) {
15246jQuery.ajaxSetup({ 4034 var i, j, l, tmp, placeHolders, arr
15247 accepts: {
15248 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
15249 },
15250 contents: {
15251 script: /(?:java|ecma)script/
15252 },
15253 converters: {
15254 "text script": function( text ) {
15255 jQuery.globalEval( text );
15256 return text;
15257 }
15258 }
15259});
15260 4035
15261// Handle cache's special case and crossDomain 4036 if (b64.length % 4 > 0) {
15262jQuery.ajaxPrefilter( "script", function( s ) { 4037 throw new Error('Invalid string. Length must be a multiple of 4')
15263 if ( s.cache === undefined ) { 4038 }
15264 s.cache = false;
15265 }
15266 if ( s.crossDomain ) {
15267 s.type = "GET";
15268 }
15269});
15270 4039
15271// Bind script tag hack transport 4040 // the number of equal signs (place holders)
15272jQuery.ajaxTransport( "script", function( s ) { 4041 // if there are two placeholders, than the two characters before it
15273 // This transport only deals with cross domain requests 4042 // represent one byte
15274 if ( s.crossDomain ) { 4043 // if there is only one, then the three characters before it represent 2 bytes
15275 var script, callback; 4044 // this is just a cheap hack to not do indexOf twice
15276 return { 4045 var len = b64.length
15277 send: function( _, complete ) { 4046 placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
15278 script = jQuery("<script>").prop({
15279 async: true,
15280 charset: s.scriptCharset,
15281 src: s.url
15282 }).on(
15283 "load error",
15284 callback = function( evt ) {
15285 script.remove();
15286 callback = null;
15287 if ( evt ) {
15288 complete( evt.type === "error" ? 404 : 200, evt.type );
15289 }
15290 }
15291 );
15292 document.head.appendChild( script[ 0 ] );
15293 },
15294 abort: function() {
15295 if ( callback ) {
15296 callback();
15297 }
15298 }
15299 };
15300 }
15301});
15302 4047
4048 // base64 is 4/3 + up to two characters of the original data
4049 arr = new Arr(b64.length * 3 / 4 - placeHolders)
15303 4050
4051 // if there are placeholders, only get up to the last complete 4 chars
4052 l = placeHolders > 0 ? b64.length - 4 : b64.length
15304 4053
4054 var L = 0
15305 4055
15306var oldCallbacks = [], 4056 function push (v) {
15307 rjsonp = /(=)\?(?=&|$)|\?\?/; 4057 arr[L++] = v
4058 }
15308 4059
15309// Default jsonp settings 4060 for (i = 0, j = 0; i < l; i += 4, j += 3) {
15310jQuery.ajaxSetup({ 4061 tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
15311 jsonp: "callback", 4062 push((tmp & 0xFF0000) >> 16)
15312 jsonpCallback: function() { 4063 push((tmp & 0xFF00) >> 8)
15313 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 4064 push(tmp & 0xFF)
15314 this[ callback ] = true; 4065 }
15315 return callback;
15316 }
15317});
15318 4066
15319// Detect, normalize options and install callbacks for jsonp requests 4067 if (placeHolders === 2) {
15320jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 4068 tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
4069 push(tmp & 0xFF)
4070 } else if (placeHolders === 1) {
4071 tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
4072 push((tmp >> 8) & 0xFF)
4073 push(tmp & 0xFF)
4074 }
15321 4075
15322 var callbackName, overwritten, responseContainer, 4076 return arr
15323 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 4077 }
15324 "url" :
15325 typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
15326 );
15327 4078
15328 // Handle iff the expected data type is "jsonp" or we have a parameter to set 4079 function uint8ToBase64 (uint8) {
15329 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 4080 var i,
4081 extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
4082 output = "",
4083 temp, length
15330 4084
15331 // Get callback name, remembering preexisting value associated with it 4085 function encode (num) {
15332 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 4086 return lookup.charAt(num)
15333 s.jsonpCallback() : 4087 }
15334 s.jsonpCallback;
15335 4088
15336 // Insert callback into url or form data 4089 function tripletToBase64 (num) {
15337 if ( jsonProp ) { 4090 return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
15338 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 4091 }
15339 } else if ( s.jsonp !== false ) {
15340 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
15341 }
15342 4092
15343 // Use data converter to retrieve json after script execution 4093 // go through the array every three bytes, we'll deal with trailing stuff later
15344 s.converters["script json"] = function() { 4094 for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
15345 if ( !responseContainer ) { 4095 temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
15346 jQuery.error( callbackName + " was not called" ); 4096 output += tripletToBase64(temp)
15347 } 4097 }
15348 return responseContainer[ 0 ];
15349 };
15350 4098
15351 // force json dataType 4099 // pad the end with zeros, but make sure to not forget the extra bytes
15352 s.dataTypes[ 0 ] = "json"; 4100 switch (extraBytes) {
4101 case 1:
4102 temp = uint8[uint8.length - 1]
4103 output += encode(temp >> 2)
4104 output += encode((temp << 4) & 0x3F)
4105 output += '=='
4106 break
4107 case 2:
4108 temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
4109 output += encode(temp >> 10)
4110 output += encode((temp >> 4) & 0x3F)
4111 output += encode((temp << 2) & 0x3F)
4112 output += '='
4113 break
4114 }
15353 4115
15354 // Install callback 4116 return output
15355 overwritten = window[ callbackName ]; 4117 }
15356 window[ callbackName ] = function() {
15357 responseContainer = arguments;
15358 };
15359 4118
15360 // Clean-up function (fires after converters) 4119 exports.toByteArray = b64ToByteArray
15361 jqXHR.always(function() { 4120 exports.fromByteArray = uint8ToBase64
15362 // Restore preexisting value 4121}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
15363 window[ callbackName ] = overwritten;
15364 4122
15365 // Save back as free 4123},{}],9:[function(require,module,exports){
15366 if ( s[ callbackName ] ) { 4124exports.read = function (buffer, offset, isLE, mLen, nBytes) {
15367 // make sure that re-using the options doesn't screw things around 4125 var e, m
15368 s.jsonpCallback = originalSettings.jsonpCallback; 4126 var eLen = nBytes * 8 - mLen - 1
4127 var eMax = (1 << eLen) - 1
4128 var eBias = eMax >> 1
4129 var nBits = -7
4130 var i = isLE ? (nBytes - 1) : 0
4131 var d = isLE ? -1 : 1
4132 var s = buffer[offset + i]
4133
4134 i += d
4135
4136 e = s & ((1 << (-nBits)) - 1)
4137 s >>= (-nBits)
4138 nBits += eLen
4139 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
4140
4141 m = e & ((1 << (-nBits)) - 1)
4142 e >>= (-nBits)
4143 nBits += mLen
4144 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
15369 4145
15370 // save the callback name for future use 4146 if (e === 0) {
15371 oldCallbacks.push( callbackName ); 4147 e = 1 - eBias
15372 } 4148 } else if (e === eMax) {
4149 return m ? NaN : ((s ? -1 : 1) * Infinity)
4150 } else {
4151 m = m + Math.pow(2, mLen)
4152 e = e - eBias
4153 }
4154 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
4155}
15373 4156
15374 // Call if it was a function and we have a response 4157exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
15375 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 4158 var e, m, c
15376 overwritten( responseContainer[ 0 ] ); 4159 var eLen = nBytes * 8 - mLen - 1
15377 } 4160 var eMax = (1 << eLen) - 1
4161 var eBias = eMax >> 1
4162 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
4163 var i = isLE ? 0 : (nBytes - 1)
4164 var d = isLE ? 1 : -1
4165 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
15378 4166
15379 responseContainer = overwritten = undefined; 4167 value = Math.abs(value)
15380 });
15381 4168
15382 // Delegate to script 4169 if (isNaN(value) || value === Infinity) {
15383 return "script"; 4170 m = isNaN(value) ? 1 : 0
4171 e = eMax
4172 } else {
4173 e = Math.floor(Math.log(value) / Math.LN2)
4174 if (value * (c = Math.pow(2, -e)) < 1) {
4175 e--
4176 c *= 2
15384 } 4177 }
15385}); 4178 if (e + eBias >= 1) {
15386 4179 value += rt / c
15387 4180 } else {
15388 4181 value += rt * Math.pow(2, 1 - eBias)
15389
15390// data: string of html
15391// context (optional): If specified, the fragment will be created in this context, defaults to document
15392// keepScripts (optional): If true, will include scripts passed in the html string
15393jQuery.parseHTML = function( data, context, keepScripts ) {
15394 if ( !data || typeof data !== "string" ) {
15395 return null;
15396 } 4182 }
15397 if ( typeof context === "boolean" ) { 4183 if (value * c >= 2) {
15398 keepScripts = context; 4184 e++
15399 context = false; 4185 c /= 2
15400 } 4186 }
15401 context = context || document;
15402
15403 var parsed = rsingleTag.exec( data ),
15404 scripts = !keepScripts && [];
15405 4187
15406 // Single tag 4188 if (e + eBias >= eMax) {
15407 if ( parsed ) { 4189 m = 0
15408 return [ context.createElement( parsed[1] ) ]; 4190 e = eMax
4191 } else if (e + eBias >= 1) {
4192 m = (value * c - 1) * Math.pow(2, mLen)
4193 e = e + eBias
4194 } else {
4195 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
4196 e = 0
15409 } 4197 }
4198 }
15410 4199
15411 parsed = jQuery.buildFragment( [ data ], context, scripts ); 4200 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
15412
15413 if ( scripts && scripts.length ) {
15414 jQuery( scripts ).remove();
15415 }
15416 4201
15417 return jQuery.merge( [], parsed.childNodes ); 4202 e = (e << mLen) | m
15418}; 4203 eLen += mLen
4204 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
15419 4205
4206 buffer[offset + i - d] |= s * 128
4207}
15420 4208
15421// Keep a copy of the old load method 4209},{}],10:[function(require,module,exports){
15422var _load = jQuery.fn.load;
15423 4210
15424/** 4211/**
15425 * Load a url into a page 4212 * isArray
15426 */ 4213 */
15427jQuery.fn.load = function( url, params, callback ) {
15428 if ( typeof url !== "string" && _load ) {
15429 return _load.apply( this, arguments );
15430 }
15431
15432 var selector, type, response,
15433 self = this,
15434 off = url.indexOf(" ");
15435
15436 if ( off >= 0 ) {
15437 selector = jQuery.trim( url.slice( off ) );
15438 url = url.slice( 0, off );
15439 }
15440
15441 // If it's a function
15442 if ( jQuery.isFunction( params ) ) {
15443
15444 // We assume that it's the callback
15445 callback = params;
15446 params = undefined;
15447
15448 // Otherwise, build a param string
15449 } else if ( params && typeof params === "object" ) {
15450 type = "POST";
15451 }
15452
15453 // If we have elements to modify, make the request
15454 if ( self.length > 0 ) {
15455 jQuery.ajax({
15456 url: url,
15457
15458 // if "type" variable is undefined, then "GET" method will be used
15459 type: type,
15460 dataType: "html",
15461 data: params
15462 }).done(function( responseText ) {
15463
15464 // Save response for use in complete callback
15465 response = arguments;
15466
15467 self.html( selector ?
15468
15469 // If a selector was specified, locate the right elements in a dummy div
15470 // Exclude scripts to avoid IE 'Permission Denied' errors
15471 jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) :
15472
15473 // Otherwise use the full result
15474 responseText );
15475
15476 }).complete( callback && function( jqXHR, status ) {
15477 self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
15478 });
15479 }
15480
15481 return this;
15482};
15483
15484
15485
15486
15487jQuery.expr.filters.animated = function( elem ) {
15488 return jQuery.grep(jQuery.timers, function( fn ) {
15489 return elem === fn.elem;
15490 }).length;
15491};
15492 4214
15493 4215var isArray = Array.isArray;
15494
15495
15496var docElem = window.document.documentElement;
15497 4216
15498/** 4217/**
15499 * Gets a window from an element 4218 * toString
15500 */ 4219 */
15501function getWindow( elem ) {
15502 return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
15503}
15504
15505jQuery.offset = {
15506 setOffset: function( elem, options, i ) {
15507 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
15508 position = jQuery.css( elem, "position" ),
15509 curElem = jQuery( elem ),
15510 props = {};
15511
15512 // Set position first, in-case top/left are set even on static elem
15513 if ( position === "static" ) {
15514 elem.style.position = "relative";
15515 }
15516
15517 curOffset = curElem.offset();
15518 curCSSTop = jQuery.css( elem, "top" );
15519 curCSSLeft = jQuery.css( elem, "left" );
15520 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
15521 ( curCSSTop + curCSSLeft ).indexOf("auto") > -1;
15522
15523 // Need to be able to calculate position if either top or left is auto and position is either absolute or fixed
15524 if ( calculatePosition ) {
15525 curPosition = curElem.position();
15526 curTop = curPosition.top;
15527 curLeft = curPosition.left;
15528
15529 } else {
15530 curTop = parseFloat( curCSSTop ) || 0;
15531 curLeft = parseFloat( curCSSLeft ) || 0;
15532 }
15533
15534 if ( jQuery.isFunction( options ) ) {
15535 options = options.call( elem, i, curOffset );
15536 }
15537
15538 if ( options.top != null ) {
15539 props.top = ( options.top - curOffset.top ) + curTop;
15540 }
15541 if ( options.left != null ) {
15542 props.left = ( options.left - curOffset.left ) + curLeft;
15543 }
15544
15545 if ( "using" in options ) {
15546 options.using.call( elem, props );
15547
15548 } else {
15549 curElem.css( props );
15550 }
15551 }
15552};
15553
15554jQuery.fn.extend({
15555 offset: function( options ) {
15556 if ( arguments.length ) {
15557 return options === undefined ?
15558 this :
15559 this.each(function( i ) {
15560 jQuery.offset.setOffset( this, options, i );
15561 });
15562 }
15563
15564 var docElem, win,
15565 elem = this[ 0 ],
15566 box = { top: 0, left: 0 },
15567 doc = elem && elem.ownerDocument;
15568
15569 if ( !doc ) {
15570 return;
15571 }
15572
15573 docElem = doc.documentElement;
15574
15575 // Make sure it's not a disconnected DOM node
15576 if ( !jQuery.contains( docElem, elem ) ) {
15577 return box;
15578 }
15579
15580 // If we don't have gBCR, just use 0,0 rather than error
15581 // BlackBerry 5, iOS 3 (original iPhone)
15582 if ( typeof elem.getBoundingClientRect !== strundefined ) {
15583 box = elem.getBoundingClientRect();
15584 }
15585 win = getWindow( doc );
15586 return {
15587 top: box.top + win.pageYOffset - docElem.clientTop,
15588 left: box.left + win.pageXOffset - docElem.clientLeft
15589 };
15590 },
15591 4220
15592 position: function() { 4221var str = Object.prototype.toString;
15593 if ( !this[ 0 ] ) {
15594 return;
15595 }
15596
15597 var offsetParent, offset,
15598 elem = this[ 0 ],
15599 parentOffset = { top: 0, left: 0 };
15600
15601 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
15602 if ( jQuery.css( elem, "position" ) === "fixed" ) {
15603 // We assume that getBoundingClientRect is available when computed position is fixed
15604 offset = elem.getBoundingClientRect();
15605
15606 } else {
15607 // Get *real* offsetParent
15608 offsetParent = this.offsetParent();
15609
15610 // Get correct offsets
15611 offset = this.offset();
15612 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
15613 parentOffset = offsetParent.offset();
15614 }
15615
15616 // Add offsetParent borders
15617 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
15618 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
15619 }
15620
15621 // Subtract parent offsets and element margins
15622 return {
15623 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
15624 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
15625 };
15626 },
15627
15628 offsetParent: function() {
15629 return this.map(function() {
15630 var offsetParent = this.offsetParent || docElem;
15631
15632 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
15633 offsetParent = offsetParent.offsetParent;
15634 }
15635
15636 return offsetParent || docElem;
15637 });
15638 }
15639});
15640
15641// Create scrollLeft and scrollTop methods
15642jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
15643 var top = "pageYOffset" === prop;
15644
15645 jQuery.fn[ method ] = function( val ) {
15646 return access( this, function( elem, method, val ) {
15647 var win = getWindow( elem );
15648
15649 if ( val === undefined ) {
15650 return win ? win[ prop ] : elem[ method ];
15651 }
15652
15653 if ( win ) {
15654 win.scrollTo(
15655 !top ? val : window.pageXOffset,
15656 top ? val : window.pageYOffset
15657 );
15658
15659 } else {
15660 elem[ method ] = val;
15661 }
15662 }, method, val, arguments.length, null );
15663 };
15664});
15665
15666// Add the top/left cssHooks using jQuery.fn.position
15667// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
15668// getComputedStyle returns percent when specified for top/left/bottom/right
15669// rather than make the css module depend on the offset module, we just check for it here
15670jQuery.each( [ "top", "left" ], function( i, prop ) {
15671 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
15672 function( elem, computed ) {
15673 if ( computed ) {
15674 computed = curCSS( elem, prop );
15675 // if curCSS returns percentage, fallback to offset
15676 return rnumnonpx.test( computed ) ?
15677 jQuery( elem ).position()[ prop ] + "px" :
15678 computed;
15679 }
15680 }
15681 );
15682});
15683
15684
15685// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
15686jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
15687 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
15688 // margin is only for outerHeight, outerWidth
15689 jQuery.fn[ funcName ] = function( margin, value ) {
15690 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
15691 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
15692
15693 return access( this, function( elem, type, value ) {
15694 var doc;
15695
15696 if ( jQuery.isWindow( elem ) ) {
15697 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
15698 // isn't a whole lot we can do. See pull request at this URL for discussion:
15699 // https://github.com/jquery/jquery/pull/764
15700 return elem.document.documentElement[ "client" + name ];
15701 }
15702
15703 // Get document width or height
15704 if ( elem.nodeType === 9 ) {
15705 doc = elem.documentElement;
15706
15707 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
15708 // whichever is greatest
15709 return Math.max(
15710 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
15711 elem.body[ "offset" + name ], doc[ "offset" + name ],
15712 doc[ "client" + name ]
15713 );
15714 }
15715
15716 return value === undefined ?
15717 // Get width or height on the element, requesting but not forcing parseFloat
15718 jQuery.css( elem, type, extra ) :
15719
15720 // Set width or height on the element
15721 jQuery.style( elem, type, value, extra );
15722 }, type, chainable ? margin : undefined, chainable, null );
15723 };
15724 });
15725});
15726 4222
4223/**
4224 * Whether or not the given `val`
4225 * is an array.
4226 *
4227 * example:
4228 *
4229 * isArray([]);
4230 * // > true
4231 * isArray(arguments);
4232 * // > false
4233 * isArray('');
4234 * // > false
4235 *
4236 * @param {mixed} val
4237 * @return {bool}
4238 */
15727 4239
15728// The number of elements contained in the matched element set 4240module.exports = isArray || function (val) {
15729jQuery.fn.size = function() { 4241 return !! val && '[object Array]' == str.call(val);
15730 return this.length;
15731}; 4242};
15732 4243
15733jQuery.fn.andSelf = jQuery.fn.addBack; 4244},{}],11:[function(require,module,exports){
15734 4245// Copyright Joyent, Inc. and other Node contributors.
15735 4246//
15736 4247// Permission is hereby granted, free of charge, to any person obtaining a
15737 4248// copy of this software and associated documentation files (the
15738// Register as a named AMD module, since jQuery can be concatenated with other 4249// "Software"), to deal in the Software without restriction, including
15739// files that may use define, but not via a proper concatenation script that 4250// without limitation the rights to use, copy, modify, merge, publish,
15740// understands anonymous AMD modules. A named AMD is safest and most robust 4251// distribute, sublicense, and/or sell copies of the Software, and to permit
15741// way to register. Lowercase jquery is used because AMD module names are 4252// persons to whom the Software is furnished to do so, subject to the
15742// derived from file names, and jQuery is normally delivered in a lowercase 4253// following conditions:
15743// file name. Do this after creating the global so that if an AMD module wants 4254//
15744// to call noConflict to hide this version of jQuery, it will work. 4255// The above copyright notice and this permission notice shall be included
15745 4256// in all copies or substantial portions of the Software.
15746// Note that for maximum portability, libraries that are not jQuery should 4257//
15747// declare themselves as anonymous modules, and avoid setting a global if an 4258// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15748// AMD loader is present. jQuery is a special case. For more information, see 4259// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15749// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 4260// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4261// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4262// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4263// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4264// USE OR OTHER DEALINGS IN THE SOFTWARE.
15750 4265
15751if ( typeof define === "function" && define.amd ) { 4266function EventEmitter() {
15752 define( "jquery", [], function() { 4267 this._events = this._events || {};
15753 return jQuery; 4268 this._maxListeners = this._maxListeners || undefined;
15754 });
15755} 4269}
4270module.exports = EventEmitter;
15756 4271
4272// Backwards-compat with node 0.10.x
4273EventEmitter.EventEmitter = EventEmitter;
15757 4274
4275EventEmitter.prototype._events = undefined;
4276EventEmitter.prototype._maxListeners = undefined;
15758 4277
4278// By default EventEmitters will print a warning if more than 10 listeners are
4279// added to it. This is a useful default which helps finding memory leaks.
4280EventEmitter.defaultMaxListeners = 10;
15759 4281
15760var 4282// Obviously not all Emitters should be limited to 10. This function allows
15761 // Map over jQuery in case of overwrite 4283// that to be increased. Set to zero for unlimited.
15762 _jQuery = window.jQuery, 4284EventEmitter.prototype.setMaxListeners = function(n) {
15763 4285 if (!isNumber(n) || n < 0 || isNaN(n))
15764 // Map over the $ in case of overwrite 4286 throw TypeError('n must be a positive number');
15765 _$ = window.$; 4287 this._maxListeners = n;
15766 4288 return this;
15767jQuery.noConflict = function( deep ) {
15768 if ( window.$ === jQuery ) {
15769 window.$ = _$;
15770 }
15771
15772 if ( deep && window.jQuery === jQuery ) {
15773 window.jQuery = _jQuery;
15774 }
15775
15776 return jQuery;
15777}; 4289};
15778 4290
15779// Expose jQuery and $ identifiers, even in 4291EventEmitter.prototype.emit = function(type) {
15780// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 4292 var er, handler, len, args, i, listeners;
15781// and CommonJS for browser emulators (#13566)
15782if ( typeof noGlobal === strundefined ) {
15783 window.jQuery = window.$ = jQuery;
15784}
15785
15786
15787
15788
15789return jQuery;
15790
15791}));
15792</script>
15793<script>
15794/*!
15795 * Bootstrap v3.2.0 (http://getbootstrap.com)
15796 * Copyright 2011-2014 Twitter, Inc.
15797 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15798 */
15799
15800if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript requires jQuery') }
15801
15802/* ========================================================================
15803 * Bootstrap: transition.js v3.2.0
15804 * http://getbootstrap.com/javascript/#transitions
15805 * ========================================================================
15806 * Copyright 2011-2014 Twitter, Inc.
15807 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15808 * ======================================================================== */
15809
15810
15811+function ($) {
15812 'use strict';
15813 4293
15814 // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) 4294 if (!this._events)
15815 // ============================================================ 4295 this._events = {};
15816 4296
15817 function transitionEnd() { 4297 // If there is no 'error' event listener then throw.
15818 var el = document.createElement('bootstrap') 4298 if (type === 'error') {
15819 4299 if (!this._events.error ||
15820 var transEndEventNames = { 4300 (isObject(this._events.error) && !this._events.error.length)) {
15821 WebkitTransition : 'webkitTransitionEnd', 4301 er = arguments[1];
15822 MozTransition : 'transitionend', 4302 if (er instanceof Error) {
15823 OTransition : 'oTransitionEnd otransitionend', 4303 throw er; // Unhandled 'error' event
15824 transition : 'transitionend'
15825 }
15826
15827 for (var name in transEndEventNames) {
15828 if (el.style[name] !== undefined) {
15829 return { end: transEndEventNames[name] }
15830 } 4304 }
4305 throw TypeError('Uncaught, unspecified "error" event.');
15831 } 4306 }
15832
15833 return false // explicit for ie8 ( ._.)
15834 } 4307 }
15835 4308
15836 // http://blog.alexmaccaw.com/css-transitions 4309 handler = this._events[type];
15837 $.fn.emulateTransitionEnd = function (duration) {
15838 var called = false
15839 var $el = this
15840 $(this).one('bsTransitionEnd', function () { called = true })
15841 var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
15842 setTimeout(callback, duration)
15843 return this
15844 }
15845
15846 $(function () {
15847 $.support.transition = transitionEnd()
15848 4310
15849 if (!$.support.transition) return 4311 if (isUndefined(handler))
4312 return false;
15850 4313
15851 $.event.special.bsTransitionEnd = { 4314 if (isFunction(handler)) {
15852 bindType: $.support.transition.end, 4315 switch (arguments.length) {
15853 delegateType: $.support.transition.end, 4316 // fast cases
15854 handle: function (e) { 4317 case 1:
15855 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 4318 handler.call(this);
15856 } 4319 break;
4320 case 2:
4321 handler.call(this, arguments[1]);
4322 break;
4323 case 3:
4324 handler.call(this, arguments[1], arguments[2]);
4325 break;
4326 // slower
4327 default:
4328 len = arguments.length;
4329 args = new Array(len - 1);
4330 for (i = 1; i < len; i++)
4331 args[i - 1] = arguments[i];
4332 handler.apply(this, args);
15857 } 4333 }
15858 }) 4334 } else if (isObject(handler)) {
15859 4335 len = arguments.length;
15860}(jQuery); 4336 args = new Array(len - 1);
4337 for (i = 1; i < len; i++)
4338 args[i - 1] = arguments[i];
15861 4339
15862/* ======================================================================== 4340 listeners = handler.slice();
15863 * Bootstrap: alert.js v3.2.0 4341 len = listeners.length;
15864 * http://getbootstrap.com/javascript/#alerts 4342 for (i = 0; i < len; i++)
15865 * ======================================================================== 4343 listeners[i].apply(this, args);
15866 * Copyright 2011-2014 Twitter, Inc.
15867 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15868 * ======================================================================== */
15869
15870
15871+function ($) {
15872 'use strict';
15873
15874 // ALERT CLASS DEFINITION
15875 // ======================
15876
15877 var dismiss = '[data-dismiss="alert"]'
15878 var Alert = function (el) {
15879 $(el).on('click', dismiss, this.close)
15880 } 4344 }
15881 4345
15882 Alert.VERSION = '3.2.0' 4346 return true;
15883 4347};
15884 Alert.prototype.close = function (e) {
15885 var $this = $(this)
15886 var selector = $this.attr('data-target')
15887
15888 if (!selector) {
15889 selector = $this.attr('href')
15890 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
15891 }
15892
15893 var $parent = $(selector)
15894
15895 if (e) e.preventDefault()
15896 4348
15897 if (!$parent.length) { 4349EventEmitter.prototype.addListener = function(type, listener) {
15898 $parent = $this.hasClass('alert') ? $this : $this.parent() 4350 var m;
15899 }
15900 4351
15901 $parent.trigger(e = $.Event('close.bs.alert')) 4352 if (!isFunction(listener))
4353 throw TypeError('listener must be a function');
15902 4354
15903 if (e.isDefaultPrevented()) return 4355 if (!this._events)
4356 this._events = {};
15904 4357
15905 $parent.removeClass('in') 4358 // To avoid recursion in the case that type === "newListener"! Before
4359 // adding it to the listeners, first emit "newListener".
4360 if (this._events.newListener)
4361 this.emit('newListener', type,
4362 isFunction(listener.listener) ?
4363 listener.listener : listener);
15906 4364
15907 function removeElement() { 4365 if (!this._events[type])
15908 // detach from parent, fire event then clean up data 4366 // Optimize the case of one listener. Don't need the extra array object.
15909 $parent.detach().trigger('closed.bs.alert').remove() 4367 this._events[type] = listener;
4368 else if (isObject(this._events[type]))
4369 // If we've already got an array, just append.
4370 this._events[type].push(listener);
4371 else
4372 // Adding the second element, need to change to array.
4373 this._events[type] = [this._events[type], listener];
4374
4375 // Check for listener leak
4376 if (isObject(this._events[type]) && !this._events[type].warned) {
4377 var m;
4378 if (!isUndefined(this._maxListeners)) {
4379 m = this._maxListeners;
4380 } else {
4381 m = EventEmitter.defaultMaxListeners;
4382 }
4383
4384 if (m && m > 0 && this._events[type].length > m) {
4385 this._events[type].warned = true;
4386 console.error('(node) warning: possible EventEmitter memory ' +
4387 'leak detected. %d listeners added. ' +
4388 'Use emitter.setMaxListeners() to increase limit.',
4389 this._events[type].length);
4390 if (typeof console.trace === 'function') {
4391 // not supported in IE 10
4392 console.trace();
4393 }
15910 } 4394 }
15911
15912 $.support.transition && $parent.hasClass('fade') ?
15913 $parent
15914 .one('bsTransitionEnd', removeElement)
15915 .emulateTransitionEnd(150) :
15916 removeElement()
15917 }
15918
15919
15920 // ALERT PLUGIN DEFINITION
15921 // =======================
15922
15923 function Plugin(option) {
15924 return this.each(function () {
15925 var $this = $(this)
15926 var data = $this.data('bs.alert')
15927
15928 if (!data) $this.data('bs.alert', (data = new Alert(this)))
15929 if (typeof option == 'string') data[option].call($this)
15930 })
15931 }
15932
15933 var old = $.fn.alert
15934
15935 $.fn.alert = Plugin
15936 $.fn.alert.Constructor = Alert
15937
15938
15939 // ALERT NO CONFLICT
15940 // =================
15941
15942 $.fn.alert.noConflict = function () {
15943 $.fn.alert = old
15944 return this
15945 } 4395 }
15946 4396
4397 return this;
4398};
15947 4399
15948 // ALERT DATA-API 4400EventEmitter.prototype.on = EventEmitter.prototype.addListener;
15949 // ==============
15950
15951 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
15952
15953}(jQuery);
15954
15955/* ========================================================================
15956 * Bootstrap: button.js v3.2.0
15957 * http://getbootstrap.com/javascript/#buttons
15958 * ========================================================================
15959 * Copyright 2011-2014 Twitter, Inc.
15960 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
15961 * ======================================================================== */
15962
15963 4401
15964+function ($) { 4402EventEmitter.prototype.once = function(type, listener) {
15965 'use strict'; 4403 if (!isFunction(listener))
4404 throw TypeError('listener must be a function');
15966 4405
15967 // BUTTON PUBLIC CLASS DEFINITION 4406 var fired = false;
15968 // ==============================
15969 4407
15970 var Button = function (element, options) { 4408 function g() {
15971 this.$element = $(element) 4409 this.removeListener(type, g);
15972 this.options = $.extend({}, Button.DEFAULTS, options)
15973 this.isLoading = false
15974 }
15975 4410
15976 Button.VERSION = '3.2.0' 4411 if (!fired) {
15977 4412 fired = true;
15978 Button.DEFAULTS = { 4413 listener.apply(this, arguments);
15979 loadingText: 'loading...' 4414 }
15980 } 4415 }
15981 4416
15982 Button.prototype.setState = function (state) { 4417 g.listener = listener;
15983 var d = 'disabled' 4418 this.on(type, g);
15984 var $el = this.$element
15985 var val = $el.is('input') ? 'val' : 'html'
15986 var data = $el.data()
15987 4419
15988 state = state + 'Text' 4420 return this;
4421};
15989 4422
15990 if (data.resetText == null) $el.data('resetText', $el[val]()) 4423// emits a 'removeListener' event iff the listener was removed
4424EventEmitter.prototype.removeListener = function(type, listener) {
4425 var list, position, length, i;
15991 4426
15992 $el[val](data[state] == null ? this.options[state] : data[state]) 4427 if (!isFunction(listener))
4428 throw TypeError('listener must be a function');
15993 4429
15994 // push to event loop to allow forms to submit 4430 if (!this._events || !this._events[type])
15995 setTimeout($.proxy(function () { 4431 return this;
15996 if (state == 'loadingText') {
15997 this.isLoading = true
15998 $el.addClass(d).attr(d, d)
15999 } else if (this.isLoading) {
16000 this.isLoading = false
16001 $el.removeClass(d).removeAttr(d)
16002 }
16003 }, this), 0)
16004 }
16005
16006 Button.prototype.toggle = function () {
16007 var changed = true
16008 var $parent = this.$element.closest('[data-toggle="buttons"]')
16009 4432
16010 if ($parent.length) { 4433 list = this._events[type];
16011 var $input = this.$element.find('input') 4434 length = list.length;
16012 if ($input.prop('type') == 'radio') { 4435 position = -1;
16013 if ($input.prop('checked') && this.$element.hasClass('active')) changed = false 4436
16014 else $parent.find('.active').removeClass('active') 4437 if (list === listener ||
4438 (isFunction(list.listener) && list.listener === listener)) {
4439 delete this._events[type];
4440 if (this._events.removeListener)
4441 this.emit('removeListener', type, listener);
4442
4443 } else if (isObject(list)) {
4444 for (i = length; i-- > 0;) {
4445 if (list[i] === listener ||
4446 (list[i].listener && list[i].listener === listener)) {
4447 position = i;
4448 break;
16015 } 4449 }
16016 if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
16017 } 4450 }
16018 4451
16019 if (changed) this.$element.toggleClass('active') 4452 if (position < 0)
16020 } 4453 return this;
16021
16022
16023 // BUTTON PLUGIN DEFINITION
16024 // ========================
16025
16026 function Plugin(option) {
16027 return this.each(function () {
16028 var $this = $(this)
16029 var data = $this.data('bs.button')
16030 var options = typeof option == 'object' && option
16031
16032 if (!data) $this.data('bs.button', (data = new Button(this, options)))
16033
16034 if (option == 'toggle') data.toggle()
16035 else if (option) data.setState(option)
16036 })
16037 }
16038 4454
16039 var old = $.fn.button 4455 if (list.length === 1) {
16040 4456 list.length = 0;
16041 $.fn.button = Plugin 4457 delete this._events[type];
16042 $.fn.button.Constructor = Button 4458 } else {
16043 4459 list.splice(position, 1);
16044 4460 }
16045 // BUTTON NO CONFLICT
16046 // ==================
16047 4461
16048 $.fn.button.noConflict = function () { 4462 if (this._events.removeListener)
16049 $.fn.button = old 4463 this.emit('removeListener', type, listener);
16050 return this
16051 } 4464 }
16052 4465
4466 return this;
4467};
16053 4468
16054 // BUTTON DATA-API 4469EventEmitter.prototype.removeAllListeners = function(type) {
16055 // =============== 4470 var key, listeners;
16056
16057 $(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
16058 var $btn = $(e.target)
16059 if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
16060 Plugin.call($btn, 'toggle')
16061 e.preventDefault()
16062 })
16063
16064}(jQuery);
16065
16066/* ========================================================================
16067 * Bootstrap: carousel.js v3.2.0
16068 * http://getbootstrap.com/javascript/#carousel
16069 * ========================================================================
16070 * Copyright 2011-2014 Twitter, Inc.
16071 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
16072 * ======================================================================== */
16073
16074
16075+function ($) {
16076 'use strict';
16077
16078 // CAROUSEL CLASS DEFINITION
16079 // =========================
16080
16081 var Carousel = function (element, options) {
16082 this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
16083 this.$indicators = this.$element.find('.carousel-indicators')
16084 this.options = options
16085 this.paused =
16086 this.sliding =
16087 this.interval =
16088 this.$active =
16089 this.$items = null
16090
16091 this.options.pause == 'hover' && this.$element
16092 .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
16093 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
16094 }
16095 4471
16096 Carousel.VERSION = '3.2.0' 4472 if (!this._events)
4473 return this;
16097 4474
16098 Carousel.DEFAULTS = { 4475 // not listening for removeListener, no need to emit
16099 interval: 5000, 4476 if (!this._events.removeListener) {
16100 pause: 'hover', 4477 if (arguments.length === 0)
16101 wrap: true 4478 this._events = {};
4479 else if (this._events[type])
4480 delete this._events[type];
4481 return this;
16102 } 4482 }
16103 4483
16104 Carousel.prototype.keydown = function (e) { 4484 // emit removeListener for all listeners on all events
16105 switch (e.which) { 4485 if (arguments.length === 0) {
16106 case 37: this.prev(); break 4486 for (key in this._events) {
16107 case 39: this.next(); break 4487 if (key === 'removeListener') continue;
16108 default: return 4488 this.removeAllListeners(key);
16109 } 4489 }
16110 4490 this.removeAllListeners('removeListener');
16111 e.preventDefault() 4491 this._events = {};
4492 return this;
16112 } 4493 }
16113 4494
16114 Carousel.prototype.cycle = function (e) { 4495 listeners = this._events[type];
16115 e || (this.paused = false)
16116
16117 this.interval && clearInterval(this.interval)
16118
16119 this.options.interval
16120 && !this.paused
16121 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
16122
16123 return this
16124 }
16125 4496
16126 Carousel.prototype.getItemIndex = function (item) { 4497 if (isFunction(listeners)) {
16127 this.$items = item.parent().children('.item') 4498 this.removeListener(type, listeners);
16128 return this.$items.index(item || this.$active) 4499 } else {
4500 // LIFO order
4501 while (listeners.length)
4502 this.removeListener(type, listeners[listeners.length - 1]);
16129 } 4503 }
4504 delete this._events[type];
16130 4505
16131 Carousel.prototype.to = function (pos) { 4506 return this;
16132 var that = this 4507};
16133 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
16134
16135 if (pos > (this.$items.length - 1) || pos < 0) return
16136 4508
16137 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" 4509EventEmitter.prototype.listeners = function(type) {
16138 if (activeIndex == pos) return this.pause().cycle() 4510 var ret;
4511 if (!this._events || !this._events[type])
4512 ret = [];
4513 else if (isFunction(this._events[type]))
4514 ret = [this._events[type]];
4515 else
4516 ret = this._events[type].slice();
4517 return ret;
4518};
16139 4519
16140 return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) 4520EventEmitter.listenerCount = function(emitter, type) {
16141 } 4521 var ret;
4522 if (!emitter._events || !emitter._events[type])
4523 ret = 0;
4524 else if (isFunction(emitter._events[type]))
4525 ret = 1;
4526 else
4527 ret = emitter._events[type].length;
4528 return ret;
4529};
16142 4530
16143 Carousel.prototype.pause = function (e) { 4531function isFunction(arg) {
16144 e || (this.paused = true) 4532 return typeof arg === 'function';
4533}
16145 4534
16146 if (this.$element.find('.next, .prev').length && $.support.transition) { 4535function isNumber(arg) {
16147 this.$element.trigger($.support.transition.end) 4536 return typeof arg === 'number';
16148 this.cycle(true) 4537}
16149 }
16150 4538
16151 this.interval = clearInterval(this.interval) 4539function isObject(arg) {
4540 return typeof arg === 'object' && arg !== null;
4541}
16152 4542
16153 return this 4543function isUndefined(arg) {
16154 } 4544 return arg === void 0;
4545}
16155 4546
16156 Carousel.prototype.next = function () { 4547},{}],12:[function(require,module,exports){
16157 if (this.sliding) return 4548if (typeof Object.create === 'function') {
16158 return this.slide('next') 4549 // implementation from standard node.js 'util' module
4550 module.exports = function inherits(ctor, superCtor) {
4551 ctor.super_ = superCtor
4552 ctor.prototype = Object.create(superCtor.prototype, {
4553 constructor: {
4554 value: ctor,
4555 enumerable: false,
4556 writable: true,
4557 configurable: true
4558 }
4559 });
4560 };
4561} else {
4562 // old school shim for old browsers
4563 module.exports = function inherits(ctor, superCtor) {
4564 ctor.super_ = superCtor
4565 var TempCtor = function () {}
4566 TempCtor.prototype = superCtor.prototype
4567 ctor.prototype = new TempCtor()
4568 ctor.prototype.constructor = ctor
16159 } 4569 }
4570}
16160 4571
16161 Carousel.prototype.prev = function () { 4572},{}],13:[function(require,module,exports){
16162 if (this.sliding) return 4573module.exports = Array.isArray || function (arr) {
16163 return this.slide('prev') 4574 return Object.prototype.toString.call(arr) == '[object Array]';
16164 } 4575};
16165 4576
16166 Carousel.prototype.slide = function (type, next) { 4577},{}],14:[function(require,module,exports){
16167 var $active = this.$element.find('.item.active') 4578// shim for using process in browser
16168 var $next = next || $active[type]()
16169 var isCycling = this.interval
16170 var direction = type == 'next' ? 'left' : 'right'
16171 var fallback = type == 'next' ? 'first' : 'last'
16172 var that = this
16173 4579
16174 if (!$next.length) { 4580var process = module.exports = {};
16175 if (!this.options.wrap) return 4581var queue = [];
16176 $next = this.$element.find('.item')[fallback]() 4582var draining = false;
4583var currentQueue;
4584var queueIndex = -1;
4585
4586function cleanUpNextTick() {
4587 draining = false;
4588 if (currentQueue.length) {
4589 queue = currentQueue.concat(queue);
4590 } else {
4591 queueIndex = -1;
16177 } 4592 }
16178 4593 if (queue.length) {
16179 if ($next.hasClass('active')) return (this.sliding = false) 4594 drainQueue();
16180
16181 var relatedTarget = $next[0]
16182 var slideEvent = $.Event('slide.bs.carousel', {
16183 relatedTarget: relatedTarget,
16184 direction: direction
16185 })
16186 this.$element.trigger(slideEvent)
16187 if (slideEvent.isDefaultPrevented()) return
16188
16189 this.sliding = true
16190
16191 isCycling && this.pause()
16192
16193 if (this.$indicators.length) {
16194 this.$indicators.find('.active').removeClass('active')
16195 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
16196 $nextIndicator && $nextIndicator.addClass('active')
16197 } 4595 }
4596}
16198 4597
16199 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" 4598function drainQueue() {
16200 if ($.support.transition && this.$element.hasClass('slide')) { 4599 if (draining) {
16201 $next.addClass(type) 4600 return;
16202 $next[0].offsetWidth // force reflow
16203 $active.addClass(direction)
16204 $next.addClass(direction)
16205 $active
16206 .one('bsTransitionEnd', function () {
16207 $next.removeClass([type, direction].join(' ')).addClass('active')
16208 $active.removeClass(['active', direction].join(' '))
16209 that.sliding = false
16210 setTimeout(function () {
16211 that.$element.trigger(slidEvent)
16212 }, 0)
16213 })
16214 .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
16215 } else {
16216 $active.removeClass('active')
16217 $next.addClass('active')
16218 this.sliding = false
16219 this.$element.trigger(slidEvent)
16220 } 4601 }
4602 var timeout = setTimeout(cleanUpNextTick);
4603 draining = true;
16221 4604
16222 isCycling && this.cycle() 4605 var len = queue.length;
16223 4606 while(len) {
16224 return this 4607 currentQueue = queue;
16225 } 4608 queue = [];
16226 4609 while (++queueIndex < len) {
16227 4610 currentQueue[queueIndex].run();
16228 // CAROUSEL PLUGIN DEFINITION 4611 }
16229 // ========================== 4612 queueIndex = -1;
16230 4613 len = queue.length;
16231 function Plugin(option) {
16232 return this.each(function () {
16233 var $this = $(this)
16234 var data = $this.data('bs.carousel')
16235 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
16236 var action = typeof option == 'string' ? option : options.slide
16237
16238 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
16239 if (typeof option == 'number') data.to(option)
16240 else if (action) data[action]()
16241 else if (options.interval) data.pause().cycle()
16242 })
16243 }
16244
16245 var old = $.fn.carousel
16246
16247 $.fn.carousel = Plugin
16248 $.fn.carousel.Constructor = Carousel
16249
16250
16251 // CAROUSEL NO CONFLICT
16252 // ====================
16253
16254 $.fn.carousel.noConflict = function () {
16255 $.fn.carousel = old
16256 return this
16257 }
16258
16259
16260 // CAROUSEL DATA-API
16261 // =================
16262
16263 $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
16264 var href
16265 var $this = $(this)
16266 var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
16267 if (!$target.hasClass('carousel')) return
16268 var options = $.extend({}, $target.data(), $this.data())
16269 var slideIndex = $this.attr('data-slide-to')
16270 if (slideIndex) options.interval = false
16271
16272 Plugin.call($target, options)
16273
16274 if (slideIndex) {
16275 $target.data('bs.carousel').to(slideIndex)
16276 } 4614 }
4615 currentQueue = null;
4616 draining = false;
4617 clearTimeout(timeout);
4618}
16277 4619
16278 e.preventDefault() 4620process.nextTick = function (fun) {
16279 }) 4621 var args = new Array(arguments.length - 1);
16280 4622 if (arguments.length > 1) {
16281 $(window).on('load', function () { 4623 for (var i = 1; i < arguments.length; i++) {
16282 $('[data-ride="carousel"]').each(function () { 4624 args[i - 1] = arguments[i];
16283 var $carousel = $(this) 4625 }
16284 Plugin.call($carousel, $carousel.data())
16285 })
16286 })
16287
16288}(jQuery);
16289
16290/* ========================================================================
16291 * Bootstrap: collapse.js v3.2.0
16292 * http://getbootstrap.com/javascript/#collapse
16293 * ========================================================================
16294 * Copyright 2011-2014 Twitter, Inc.
16295 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
16296 * ======================================================================== */
16297
16298
16299+function ($) {
16300 'use strict';
16301
16302 // COLLAPSE PUBLIC CLASS DEFINITION
16303 // ================================
16304
16305 var Collapse = function (element, options) {
16306 this.$element = $(element)
16307 this.options = $.extend({}, Collapse.DEFAULTS, options)
16308 this.transitioning = null
16309
16310 if (this.options.parent) this.$parent = $(this.options.parent)
16311 if (this.options.toggle) this.toggle()
16312 }
16313
16314 Collapse.VERSION = '3.2.0'
16315
16316 Collapse.DEFAULTS = {
16317 toggle: true
16318 }
16319
16320 Collapse.prototype.dimension = function () {
16321 var hasWidth = this.$element.hasClass('width')
16322 return hasWidth ? 'width' : 'height'
16323 }
16324
16325 Collapse.prototype.show = function () {
16326 if (this.transitioning || this.$element.hasClass('in')) return
16327
16328 var startEvent = $.Event('show.bs.collapse')
16329 this.$element.trigger(startEvent)
16330 if (startEvent.isDefaultPrevented()) return
16331
16332 var actives = this.$parent && this.$parent.find('> .panel > .in')
16333
16334 if (actives && actives.length) {
16335 var hasData = actives.data('bs.collapse')
16336 if (hasData && hasData.transitioning) return
16337 Plugin.call(actives, 'hide')
16338 hasData || actives.data('bs.collapse', null)
16339 } 4626 }
16340 4627 queue.push(new Item(fun, args));
16341 var dimension = this.dimension() 4628 if (queue.length === 1 && !draining) {
16342 4629 setTimeout(drainQueue, 0);
16343 this.$element
16344 .removeClass('collapse')
16345 .addClass('collapsing')[dimension](0)
16346
16347 this.transitioning = 1
16348
16349 var complete = function () {
16350 this.$element
16351 .removeClass('collapsing')
16352 .addClass('collapse in')[dimension]('')
16353 this.transitioning = 0
16354 this.$element
16355 .trigger('shown.bs.collapse')
16356 } 4630 }
4631};
16357 4632
16358 if (!$.support.transition) return complete.call(this) 4633// v8 likes predictible objects
16359 4634function Item(fun, array) {
16360 var scrollSize = $.camelCase(['scroll', dimension].join('-')) 4635 this.fun = fun;
16361 4636 this.array = array;
16362 this.$element 4637}
16363 .one('bsTransitionEnd', $.proxy(complete, this)) 4638Item.prototype.run = function () {
16364 .emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize]) 4639 this.fun.apply(null, this.array);
16365 } 4640};
16366 4641process.title = 'browser';
16367 Collapse.prototype.hide = function () { 4642process.browser = true;
16368 if (this.transitioning || !this.$element.hasClass('in')) return 4643process.env = {};
16369 4644process.argv = [];
16370 var startEvent = $.Event('hide.bs.collapse') 4645process.version = ''; // empty string to avoid regexp issues
16371 this.$element.trigger(startEvent) 4646process.versions = {};
16372 if (startEvent.isDefaultPrevented()) return
16373
16374 var dimension = this.dimension()
16375
16376 this.$element[dimension](this.$element[dimension]())[0].offsetHeight
16377
16378 this.$element
16379 .addClass('collapsing')
16380 .removeClass('collapse')
16381 .removeClass('in')
16382
16383 this.transitioning = 1
16384 4647
16385 var complete = function () { 4648function noop() {}
16386 this.transitioning = 0
16387 this.$element
16388 .trigger('hidden.bs.collapse')
16389 .removeClass('collapsing')
16390 .addClass('collapse')
16391 }
16392 4649
16393 if (!$.support.transition) return complete.call(this) 4650process.on = noop;
4651process.addListener = noop;
4652process.once = noop;
4653process.off = noop;
4654process.removeListener = noop;
4655process.removeAllListeners = noop;
4656process.emit = noop;
16394 4657
16395 this.$element 4658process.binding = function (name) {
16396 [dimension](0) 4659 throw new Error('process.binding is not supported');
16397 .one('bsTransitionEnd', $.proxy(complete, this)) 4660};
16398 .emulateTransitionEnd(350)
16399 }
16400 4661
16401 Collapse.prototype.toggle = function () { 4662// TODO(shtylman)
16402 this[this.$element.hasClass('in') ? 'hide' : 'show']() 4663process.cwd = function () { return '/' };
16403 } 4664process.chdir = function (dir) {
4665 throw new Error('process.chdir is not supported');
4666};
4667process.umask = function() { return 0; };
16404 4668
4669},{}],15:[function(require,module,exports){
4670module.exports = require("./lib/_stream_duplex.js")
16405 4671
16406 // COLLAPSE PLUGIN DEFINITION 4672},{"./lib/_stream_duplex.js":16}],16:[function(require,module,exports){
16407 // ========================== 4673(function (process){
4674// Copyright Joyent, Inc. and other Node contributors.
4675//
4676// Permission is hereby granted, free of charge, to any person obtaining a
4677// copy of this software and associated documentation files (the
4678// "Software"), to deal in the Software without restriction, including
4679// without limitation the rights to use, copy, modify, merge, publish,
4680// distribute, sublicense, and/or sell copies of the Software, and to permit
4681// persons to whom the Software is furnished to do so, subject to the
4682// following conditions:
4683//
4684// The above copyright notice and this permission notice shall be included
4685// in all copies or substantial portions of the Software.
4686//
4687// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4688// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4689// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4690// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4691// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4692// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4693// USE OR OTHER DEALINGS IN THE SOFTWARE.
16408 4694
16409 function Plugin(option) { 4695// a duplex stream is just a stream that is both readable and writable.
16410 return this.each(function () { 4696// Since JS doesn't have multiple prototypal inheritance, this class
16411 var $this = $(this) 4697// prototypally inherits from Readable, and then parasitically from
16412 var data = $this.data('bs.collapse') 4698// Writable.
16413 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
16414 4699
16415 if (!data && options.toggle && option == 'show') option = !option 4700module.exports = Duplex;
16416 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
16417 if (typeof option == 'string') data[option]()
16418 })
16419 }
16420 4701
16421 var old = $.fn.collapse 4702/*<replacement>*/
4703var objectKeys = Object.keys || function (obj) {
4704 var keys = [];
4705 for (var key in obj) keys.push(key);
4706 return keys;
4707}
4708/*</replacement>*/
16422 4709
16423 $.fn.collapse = Plugin
16424 $.fn.collapse.Constructor = Collapse
16425 4710
4711/*<replacement>*/
4712var util = require('core-util-is');
4713util.inherits = require('inherits');
4714/*</replacement>*/
16426 4715
16427 // COLLAPSE NO CONFLICT 4716var Readable = require('./_stream_readable');
16428 // ==================== 4717var Writable = require('./_stream_writable');
16429 4718
16430 $.fn.collapse.noConflict = function () { 4719util.inherits(Duplex, Readable);
16431 $.fn.collapse = old
16432 return this
16433 }
16434 4720
4721forEach(objectKeys(Writable.prototype), function(method) {
4722 if (!Duplex.prototype[method])
4723 Duplex.prototype[method] = Writable.prototype[method];
4724});
16435 4725
16436 // COLLAPSE DATA-API 4726function Duplex(options) {
16437 // ================= 4727 if (!(this instanceof Duplex))
4728 return new Duplex(options);
16438 4729
16439 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { 4730 Readable.call(this, options);
16440 var href 4731 Writable.call(this, options);
16441 var $this = $(this)
16442 var target = $this.attr('data-target')
16443 || e.preventDefault()
16444 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
16445 var $target = $(target)
16446 var data = $target.data('bs.collapse')
16447 var option = data ? 'toggle' : $this.data()
16448 var parent = $this.attr('data-parent')
16449 var $parent = parent && $(parent)
16450 4732
16451 if (!data || !data.transitioning) { 4733 if (options && options.readable === false)
16452 if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 4734 this.readable = false;
16453 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
16454 }
16455 4735
16456 Plugin.call($target, option) 4736 if (options && options.writable === false)
16457 }) 4737 this.writable = false;
16458 4738
16459}(jQuery); 4739 this.allowHalfOpen = true;
16460 4740 if (options && options.allowHalfOpen === false)
16461/* ======================================================================== 4741 this.allowHalfOpen = false;
16462 * Bootstrap: dropdown.js v3.2.0
16463 * http://getbootstrap.com/javascript/#dropdowns
16464 * ========================================================================
16465 * Copyright 2011-2014 Twitter, Inc.
16466 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
16467 * ======================================================================== */
16468 4742
4743 this.once('end', onend);
4744}
16469 4745
16470+function ($) { 4746// the no-half-open enforcer
16471 'use strict'; 4747function onend() {
4748 // if we allow half-open state, or if the writable side ended,
4749 // then we're ok.
4750 if (this.allowHalfOpen || this._writableState.ended)
4751 return;
16472 4752
16473 // DROPDOWN CLASS DEFINITION 4753 // no more data can be written.
16474 // ========================= 4754 // But allow more writes to happen in this tick.
4755 process.nextTick(this.end.bind(this));
4756}
16475 4757
16476 var backdrop = '.dropdown-backdrop' 4758function forEach (xs, f) {
16477 var toggle = '[data-toggle="dropdown"]' 4759 for (var i = 0, l = xs.length; i < l; i++) {
16478 var Dropdown = function (element) { 4760 f(xs[i], i);
16479 $(element).on('click.bs.dropdown', this.toggle)
16480 } 4761 }
4762}
16481 4763
16482 Dropdown.VERSION = '3.2.0' 4764}).call(this,require('_process'))
4765},{"./_stream_readable":18,"./_stream_writable":20,"_process":14,"core-util-is":21,"inherits":12}],17:[function(require,module,exports){
4766// Copyright Joyent, Inc. and other Node contributors.
4767//
4768// Permission is hereby granted, free of charge, to any person obtaining a
4769// copy of this software and associated documentation files (the
4770// "Software"), to deal in the Software without restriction, including
4771// without limitation the rights to use, copy, modify, merge, publish,
4772// distribute, sublicense, and/or sell copies of the Software, and to permit
4773// persons to whom the Software is furnished to do so, subject to the
4774// following conditions:
4775//
4776// The above copyright notice and this permission notice shall be included
4777// in all copies or substantial portions of the Software.
4778//
4779// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4780// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4781// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4782// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4783// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4784// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4785// USE OR OTHER DEALINGS IN THE SOFTWARE.
16483 4786
16484 Dropdown.prototype.toggle = function (e) { 4787// a passthrough stream.
16485 var $this = $(this) 4788// basically just the most minimal sort of Transform stream.
4789// Every written chunk gets output as-is.
16486 4790
16487 if ($this.is('.disabled, :disabled')) return 4791module.exports = PassThrough;
16488 4792
16489 var $parent = getParent($this) 4793var Transform = require('./_stream_transform');
16490 var isActive = $parent.hasClass('open')
16491 4794
16492 clearMenus() 4795/*<replacement>*/
4796var util = require('core-util-is');
4797util.inherits = require('inherits');
4798/*</replacement>*/
16493 4799
16494 if (!isActive) { 4800util.inherits(PassThrough, Transform);
16495 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
16496 // if mobile we use a backdrop because click events don't delegate
16497 $('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
16498 }
16499 4801
16500 var relatedTarget = { relatedTarget: this } 4802function PassThrough(options) {
16501 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) 4803 if (!(this instanceof PassThrough))
4804 return new PassThrough(options);
16502 4805
16503 if (e.isDefaultPrevented()) return 4806 Transform.call(this, options);
4807}
16504 4808
16505 $this.trigger('focus') 4809PassThrough.prototype._transform = function(chunk, encoding, cb) {
4810 cb(null, chunk);
4811};
16506 4812
16507 $parent 4813},{"./_stream_transform":19,"core-util-is":21,"inherits":12}],18:[function(require,module,exports){
16508 .toggleClass('open') 4814(function (process){
16509 .trigger('shown.bs.dropdown', relatedTarget) 4815// Copyright Joyent, Inc. and other Node contributors.
16510 } 4816//
4817// Permission is hereby granted, free of charge, to any person obtaining a
4818// copy of this software and associated documentation files (the
4819// "Software"), to deal in the Software without restriction, including
4820// without limitation the rights to use, copy, modify, merge, publish,
4821// distribute, sublicense, and/or sell copies of the Software, and to permit
4822// persons to whom the Software is furnished to do so, subject to the
4823// following conditions:
4824//
4825// The above copyright notice and this permission notice shall be included
4826// in all copies or substantial portions of the Software.
4827//
4828// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
4829// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
4830// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
4831// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
4832// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
4833// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
4834// USE OR OTHER DEALINGS IN THE SOFTWARE.
16511 4835
16512 return false 4836module.exports = Readable;
16513 }
16514 4837
16515 Dropdown.prototype.keydown = function (e) { 4838/*<replacement>*/
16516 if (!/(38|40|27)/.test(e.keyCode)) return 4839var isArray = require('isarray');
4840/*</replacement>*/
16517 4841
16518 var $this = $(this)
16519 4842
16520 e.preventDefault() 4843/*<replacement>*/
16521 e.stopPropagation() 4844var Buffer = require('buffer').Buffer;
4845/*</replacement>*/
16522 4846
16523 if ($this.is('.disabled, :disabled')) return 4847Readable.ReadableState = ReadableState;
16524 4848
16525 var $parent = getParent($this) 4849var EE = require('events').EventEmitter;
16526 var isActive = $parent.hasClass('open')
16527 4850
16528 if (!isActive || (isActive && e.keyCode == 27)) { 4851/*<replacement>*/
16529 if (e.which == 27) $parent.find(toggle).trigger('focus') 4852if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
16530 return $this.trigger('click') 4853 return emitter.listeners(type).length;
16531 } 4854};
4855/*</replacement>*/
16532 4856
16533 var desc = ' li:not(.divider):visible a' 4857var Stream = require('stream');
16534 var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
16535 4858
16536 if (!$items.length) return 4859/*<replacement>*/
4860var util = require('core-util-is');
4861util.inherits = require('inherits');
4862/*</replacement>*/
16537 4863
16538 var index = $items.index($items.filter(':focus')) 4864var StringDecoder;
16539 4865
16540 if (e.keyCode == 38 && index > 0) index-- // up
16541 if (e.keyCode == 40 && index < $items.length - 1) index++ // down
16542 if (!~index) index = 0
16543 4866
16544 $items.eq(index).trigger('focus') 4867/*<replacement>*/
16545 } 4868var debug = require('util');
4869if (debug && debug.debuglog) {
4870 debug = debug.debuglog('stream');
4871} else {
4872 debug = function () {};
4873}
4874/*</replacement>*/
16546 4875
16547 function clearMenus(e) {
16548 if (e && e.which === 3) return
16549 $(backdrop).remove()
16550 $(toggle).each(function () {
16551 var $parent = getParent($(this))
16552 var relatedTarget = { relatedTarget: this }
16553 if (!$parent.hasClass('open')) return
16554 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
16555 if (e.isDefaultPrevented()) return
16556 $parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
16557 })
16558 }
16559 4876
16560 function getParent($this) { 4877util.inherits(Readable, Stream);
16561 var selector = $this.attr('data-target')
16562 4878
16563 if (!selector) { 4879function ReadableState(options, stream) {
16564 selector = $this.attr('href') 4880 var Duplex = require('./_stream_duplex');
16565 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
16566 }
16567 4881
16568 var $parent = selector && $(selector) 4882 options = options || {};
16569 4883
16570 return $parent && $parent.length ? $parent : $this.parent() 4884 // the point at which it stops calling _read() to fill the buffer
16571 } 4885 // Note: 0 is a valid value, means "don't call _read preemptively ever"
4886 var hwm = options.highWaterMark;
4887 var defaultHwm = options.objectMode ? 16 : 16 * 1024;
4888 this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
16572 4889
4890 // cast to ints.
4891 this.highWaterMark = ~~this.highWaterMark;
16573 4892
16574 // DROPDOWN PLUGIN DEFINITION 4893 this.buffer = [];
16575 // ========================== 4894 this.length = 0;
4895 this.pipes = null;
4896 this.pipesCount = 0;
4897 this.flowing = null;
4898 this.ended = false;
4899 this.endEmitted = false;
4900 this.reading = false;
16576 4901
16577 function Plugin(option) { 4902 // a flag to be able to tell if the onwrite cb is called immediately,
16578 return this.each(function () { 4903 // or on a later tick. We set this to true at first, because any
16579 var $this = $(this) 4904 // actions that shouldn't happen until "later" should generally also
16580 var data = $this.data('bs.dropdown') 4905 // not happen before the first write call.
4906 this.sync = true;
16581 4907
16582 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) 4908 // whenever we return null, then we set a flag to say
16583 if (typeof option == 'string') data[option].call($this) 4909 // that we're awaiting a 'readable' event emission.
16584 }) 4910 this.needReadable = false;
16585 } 4911 this.emittedReadable = false;
4912 this.readableListening = false;
16586 4913
16587 var old = $.fn.dropdown
16588 4914
16589 $.fn.dropdown = Plugin 4915 // object stream flag. Used to make read(n) ignore n and to
16590 $.fn.dropdown.Constructor = Dropdown 4916 // make all the buffer merging and length checks go away
4917 this.objectMode = !!options.objectMode;
16591 4918
4919 if (stream instanceof Duplex)
4920 this.objectMode = this.objectMode || !!options.readableObjectMode;
16592 4921
16593 // DROPDOWN NO CONFLICT 4922 // Crypto is kind of old and crusty. Historically, its default string
16594 // ==================== 4923 // encoding is 'binary' so we have to make this configurable.
4924 // Everything else in the universe uses 'utf8', though.
4925 this.defaultEncoding = options.defaultEncoding || 'utf8';
16595 4926
16596 $.fn.dropdown.noConflict = function () { 4927 // when piping, we only care about 'readable' events that happen
16597 $.fn.dropdown = old 4928 // after read()ing all the bytes and not getting any pushback.
16598 return this 4929 this.ranOut = false;
16599 }
16600 4930
4931 // the number of writers that are awaiting a drain event in .pipe()s
4932 this.awaitDrain = 0;
16601 4933
16602 // APPLY TO STANDARD DROPDOWN ELEMENTS 4934 // if true, a maybeReadMore has been scheduled
16603 // =================================== 4935 this.readingMore = false;
16604 4936
16605 $(document) 4937 this.decoder = null;
16606 .on('click.bs.dropdown.data-api', clearMenus) 4938 this.encoding = null;
16607 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) 4939 if (options.encoding) {
16608 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) 4940 if (!StringDecoder)
16609 .on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown) 4941 StringDecoder = require('string_decoder/').StringDecoder;
4942 this.decoder = new StringDecoder(options.encoding);
4943 this.encoding = options.encoding;
4944 }
4945}
16610 4946
16611}(jQuery); 4947function Readable(options) {
4948 var Duplex = require('./_stream_duplex');
16612 4949
16613/* ======================================================================== 4950 if (!(this instanceof Readable))
16614 * Bootstrap: modal.js v3.2.0 4951 return new Readable(options);
16615 * http://getbootstrap.com/javascript/#modals
16616 * ========================================================================
16617 * Copyright 2011-2014 Twitter, Inc.
16618 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
16619 * ======================================================================== */
16620 4952
4953 this._readableState = new ReadableState(options, this);
16621 4954
16622+function ($) { 4955 // legacy
16623 'use strict'; 4956 this.readable = true;
16624 4957
16625 // MODAL CLASS DEFINITION 4958 Stream.call(this);
16626 // ====================== 4959}
16627 4960
16628 var Modal = function (element, options) { 4961// Manually shove something into the read() buffer.
16629 this.options = options 4962// This returns true if the highWaterMark has not been hit yet,
16630 this.$body = $(document.body) 4963// similar to how Writable.write() returns true if you should
16631 this.$element = $(element) 4964// write() some more.
16632 this.$backdrop = 4965Readable.prototype.push = function(chunk, encoding) {
16633 this.isShown = null 4966 var state = this._readableState;
16634 this.scrollbarWidth = 0
16635 4967
16636 if (this.options.remote) { 4968 if (util.isString(chunk) && !state.objectMode) {
16637 this.$element 4969 encoding = encoding || state.defaultEncoding;
16638 .find('.modal-content') 4970 if (encoding !== state.encoding) {
16639 .load(this.options.remote, $.proxy(function () { 4971 chunk = new Buffer(chunk, encoding);
16640 this.$element.trigger('loaded.bs.modal') 4972 encoding = '';
16641 }, this))
16642 } 4973 }
16643 } 4974 }
16644 4975
16645 Modal.VERSION = '3.2.0' 4976 return readableAddChunk(this, state, chunk, encoding, false);
16646 4977};
16647 Modal.DEFAULTS = {
16648 backdrop: true,
16649 keyboard: true,
16650 show: true
16651 }
16652
16653 Modal.prototype.toggle = function (_relatedTarget) {
16654 return this.isShown ? this.hide() : this.show(_relatedTarget)
16655 }
16656
16657 Modal.prototype.show = function (_relatedTarget) {
16658 var that = this
16659 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
16660
16661 this.$element.trigger(e)
16662
16663 if (this.isShown || e.isDefaultPrevented()) return
16664
16665 this.isShown = true
16666
16667 this.checkScrollbar()
16668 this.$body.addClass('modal-open')
16669
16670 this.setScrollbar()
16671 this.escape()
16672
16673 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
16674 4978
16675 this.backdrop(function () { 4979// Unshift should *always* be something directly out of read()
16676 var transition = $.support.transition && that.$element.hasClass('fade') 4980Readable.prototype.unshift = function(chunk) {
4981 var state = this._readableState;
4982 return readableAddChunk(this, state, chunk, '', true);
4983};
16677 4984
16678 if (!that.$element.parent().length) { 4985function readableAddChunk(stream, state, chunk, encoding, addToFront) {
16679 that.$element.appendTo(that.$body) // don't move modals dom position 4986 var er = chunkInvalid(state, chunk);
16680 } 4987 if (er) {
4988 stream.emit('error', er);
4989 } else if (util.isNullOrUndefined(chunk)) {
4990 state.reading = false;
4991 if (!state.ended)
4992 onEofChunk(stream, state);
4993 } else if (state.objectMode || chunk && chunk.length > 0) {
4994 if (state.ended && !addToFront) {
4995 var e = new Error('stream.push() after EOF');
4996 stream.emit('error', e);
4997 } else if (state.endEmitted && addToFront) {
4998 var e = new Error('stream.unshift() after end event');
4999 stream.emit('error', e);
5000 } else {
5001 if (state.decoder && !addToFront && !encoding)
5002 chunk = state.decoder.write(chunk);
16681 5003
16682 that.$element 5004 if (!addToFront)
16683 .show() 5005 state.reading = false;
16684 .scrollTop(0)
16685 5006
16686 if (transition) { 5007 // if we want the data now, just emit it.
16687 that.$element[0].offsetWidth // force reflow 5008 if (state.flowing && state.length === 0 && !state.sync) {
5009 stream.emit('data', chunk);
5010 stream.read(0);
5011 } else {
5012 // update the buffer info.
5013 state.length += state.objectMode ? 1 : chunk.length;
5014 if (addToFront)
5015 state.buffer.unshift(chunk);
5016 else
5017 state.buffer.push(chunk);
5018
5019 if (state.needReadable)
5020 emitReadable(stream);
16688 } 5021 }
16689 5022
16690 that.$element 5023 maybeReadMore(stream, state);
16691 .addClass('in')
16692 .attr('aria-hidden', false)
16693
16694 that.enforceFocus()
16695
16696 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
16697
16698 transition ?
16699 that.$element.find('.modal-dialog') // wait for modal to slide in
16700 .one('bsTransitionEnd', function () {
16701 that.$element.trigger('focus').trigger(e)
16702 })
16703 .emulateTransitionEnd(300) :
16704 that.$element.trigger('focus').trigger(e)
16705 })
16706 }
16707
16708 Modal.prototype.hide = function (e) {
16709 if (e) e.preventDefault()
16710
16711 e = $.Event('hide.bs.modal')
16712
16713 this.$element.trigger(e)
16714
16715 if (!this.isShown || e.isDefaultPrevented()) return
16716
16717 this.isShown = false
16718
16719 this.$body.removeClass('modal-open')
16720
16721 this.resetScrollbar()
16722 this.escape()
16723
16724 $(document).off('focusin.bs.modal')
16725
16726 this.$element
16727 .removeClass('in')
16728 .attr('aria-hidden', true)
16729 .off('click.dismiss.bs.modal')
16730
16731 $.support.transition && this.$element.hasClass('fade') ?
16732 this.$element
16733 .one('bsTransitionEnd', $.proxy(this.hideModal, this))
16734 .emulateTransitionEnd(300) :
16735 this.hideModal()
16736 }
16737
16738 Modal.prototype.enforceFocus = function () {
16739 $(document)
16740 .off('focusin.bs.modal') // guard against infinite focus loop
16741 .on('focusin.bs.modal', $.proxy(function (e) {
16742 if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
16743 this.$element.trigger('focus')
16744 }
16745 }, this))
16746 }
16747
16748 Modal.prototype.escape = function () {
16749 if (this.isShown && this.options.keyboard) {
16750 this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
16751 e.which == 27 && this.hide()
16752 }, this))
16753 } else if (!this.isShown) {
16754 this.$element.off('keyup.dismiss.bs.modal')
16755 } 5024 }
5025 } else if (!addToFront) {
5026 state.reading = false;
16756 } 5027 }
16757 5028
16758 Modal.prototype.hideModal = function () { 5029 return needMoreData(state);
16759 var that = this 5030}
16760 this.$element.hide()
16761 this.backdrop(function () {
16762 that.$element.trigger('hidden.bs.modal')
16763 })
16764 }
16765
16766 Modal.prototype.removeBackdrop = function () {
16767 this.$backdrop && this.$backdrop.remove()
16768 this.$backdrop = null
16769 }
16770
16771 Modal.prototype.backdrop = function (callback) {
16772 var that = this
16773 var animate = this.$element.hasClass('fade') ? 'fade' : ''
16774
16775 if (this.isShown && this.options.backdrop) {
16776 var doAnimate = $.support.transition && animate
16777
16778 this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
16779 .appendTo(this.$body)
16780
16781 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
16782 if (e.target !== e.currentTarget) return
16783 this.options.backdrop == 'static'
16784 ? this.$element[0].focus.call(this.$element[0])
16785 : this.hide.call(this)
16786 }, this))
16787
16788 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
16789
16790 this.$backdrop.addClass('in')
16791 5031
16792 if (!callback) return
16793 5032
16794 doAnimate ?
16795 this.$backdrop
16796 .one('bsTransitionEnd', callback)
16797 .emulateTransitionEnd(150) :
16798 callback()
16799 5033
16800 } else if (!this.isShown && this.$backdrop) { 5034// if it's past the high water mark, we can push in some more.
16801 this.$backdrop.removeClass('in') 5035// Also, if we have no data yet, we can stand some
5036// more bytes. This is to work around cases where hwm=0,
5037// such as the repl. Also, if the push() triggered a
5038// readable event, and the user called read(largeNumber) such that
5039// needReadable was set, then we ought to push more, so that another
5040// 'readable' event will be triggered.
5041function needMoreData(state) {
5042 return !state.ended &&
5043 (state.needReadable ||
5044 state.length < state.highWaterMark ||
5045 state.length === 0);
5046}
16802 5047
16803 var callbackRemove = function () { 5048// backwards compatibility.
16804 that.removeBackdrop() 5049Readable.prototype.setEncoding = function(enc) {
16805 callback && callback() 5050 if (!StringDecoder)
16806 } 5051 StringDecoder = require('string_decoder/').StringDecoder;
16807 $.support.transition && this.$element.hasClass('fade') ? 5052 this._readableState.decoder = new StringDecoder(enc);
16808 this.$backdrop 5053 this._readableState.encoding = enc;
16809 .one('bsTransitionEnd', callbackRemove) 5054 return this;
16810 .emulateTransitionEnd(150) : 5055};
16811 callbackRemove()
16812
16813 } else if (callback) {
16814 callback()
16815 }
16816 }
16817 5056
16818 Modal.prototype.checkScrollbar = function () { 5057// Don't raise the hwm > 128MB
16819 if (document.body.clientWidth >= window.innerWidth) return 5058var MAX_HWM = 0x800000;
16820 this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar() 5059function roundUpToNextPowerOf2(n) {
5060 if (n >= MAX_HWM) {
5061 n = MAX_HWM;
5062 } else {
5063 // Get the next highest power of 2
5064 n--;
5065 for (var p = 1; p < 32; p <<= 1) n |= n >> p;
5066 n++;
16821 } 5067 }
5068 return n;
5069}
16822 5070
16823 Modal.prototype.setScrollbar = function () { 5071function howMuchToRead(n, state) {
16824 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) 5072 if (state.length === 0 && state.ended)
16825 if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth) 5073 return 0;
16826 }
16827 5074
16828 Modal.prototype.resetScrollbar = function () { 5075 if (state.objectMode)
16829 this.$body.css('padding-right', '') 5076 return n === 0 ? 0 : 1;
16830 }
16831 5077
16832 Modal.prototype.measureScrollbar = function () { // thx walsh 5078 if (isNaN(n) || util.isNull(n)) {
16833 var scrollDiv = document.createElement('div') 5079 // only flow one buffer at a time
16834 scrollDiv.className = 'modal-scrollbar-measure' 5080 if (state.flowing && state.buffer.length)
16835 this.$body.append(scrollDiv) 5081 return state.buffer[0].length;
16836 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth 5082 else
16837 this.$body[0].removeChild(scrollDiv) 5083 return state.length;
16838 return scrollbarWidth
16839 } 5084 }
16840 5085
5086 if (n <= 0)
5087 return 0;
16841 5088
16842 // MODAL PLUGIN DEFINITION 5089 // If we're asking for more than the target buffer level,
16843 // ======================= 5090 // then raise the water mark. Bump up to the next highest
16844 5091 // power of 2, to prevent increasing it excessively in tiny
16845 function Plugin(option, _relatedTarget) { 5092 // amounts.
16846 return this.each(function () { 5093 if (n > state.highWaterMark)
16847 var $this = $(this) 5094 state.highWaterMark = roundUpToNextPowerOf2(n);
16848 var data = $this.data('bs.modal')
16849 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
16850 5095
16851 if (!data) $this.data('bs.modal', (data = new Modal(this, options))) 5096 // don't have that much. return null, unless we've ended.
16852 if (typeof option == 'string') data[option](_relatedTarget) 5097 if (n > state.length) {
16853 else if (options.show) data.show(_relatedTarget) 5098 if (!state.ended) {
16854 }) 5099 state.needReadable = true;
5100 return 0;
5101 } else
5102 return state.length;
16855 } 5103 }
16856 5104
16857 var old = $.fn.modal 5105 return n;
5106}
16858 5107
16859 $.fn.modal = Plugin 5108// you can override either this method, or the async _read(n) below.
16860 $.fn.modal.Constructor = Modal 5109Readable.prototype.read = function(n) {
5110 debug('read', n);
5111 var state = this._readableState;
5112 var nOrig = n;
16861 5113
5114 if (!util.isNumber(n) || n > 0)
5115 state.emittedReadable = false;
16862 5116
16863 // MODAL NO CONFLICT 5117 // if we're doing read(0) to trigger a readable event, but we
16864 // ================= 5118 // already have a bunch of data in the buffer, then just trigger
5119 // the 'readable' event and move on.
5120 if (n === 0 &&
5121 state.needReadable &&
5122 (state.length >= state.highWaterMark || state.ended)) {
5123 debug('read: emitReadable', state.length, state.ended);
5124 if (state.length === 0 && state.ended)
5125 endReadable(this);
5126 else
5127 emitReadable(this);
5128 return null;
5129 }
5130
5131 n = howMuchToRead(n, state);
5132
5133 // if we've ended, and we're now clear, then finish it up.
5134 if (n === 0 && state.ended) {
5135 if (state.length === 0)
5136 endReadable(this);
5137 return null;
5138 }
5139
5140 // All the actual chunk generation logic needs to be
5141 // *below* the call to _read. The reason is that in certain
5142 // synthetic stream cases, such as passthrough streams, _read
5143 // may be a completely synchronous operation which may change
5144 // the state of the read buffer, providing enough data when
5145 // before there was *not* enough.
5146 //
5147 // So, the steps are:
5148 // 1. Figure out what the state of things will be after we do
5149 // a read from the buffer.
5150 //
5151 // 2. If that resulting state will trigger a _read, then call _read.
5152 // Note that this may be asynchronous, or synchronous. Yes, it is
5153 // deeply ugly to write APIs this way, but that still doesn't mean
5154 // that the Readable class should behave improperly, as streams are
5155 // designed to be sync/async agnostic.
5156 // Take note if the _read call is sync or async (ie, if the read call
5157 // has returned yet), so that we know whether or not it's safe to emit
5158 // 'readable' etc.
5159 //
5160 // 3. Actually pull the requested chunks out of the buffer and return.
5161
5162 // if we need a readable event, then we need to do some reading.
5163 var doRead = state.needReadable;
5164 debug('need readable', doRead);
5165
5166 // if we currently have less than the highWaterMark, then also read some
5167 if (state.length === 0 || state.length - n < state.highWaterMark) {
5168 doRead = true;
5169 debug('length less than watermark', doRead);
5170 }
5171
5172 // however, if we've ended, then there's no point, and if we're already
5173 // reading, then it's unnecessary.
5174 if (state.ended || state.reading) {
5175 doRead = false;
5176 debug('reading or ended', doRead);
5177 }
5178
5179 if (doRead) {
5180 debug('do read');
5181 state.reading = true;
5182 state.sync = true;
5183 // if the length is currently zero, then we *need* a readable event.
5184 if (state.length === 0)
5185 state.needReadable = true;
5186 // call internal read method
5187 this._read(state.highWaterMark);
5188 state.sync = false;
5189 }
5190
5191 // If _read pushed data synchronously, then `reading` will be false,
5192 // and we need to re-evaluate how much data we can return to the user.
5193 if (doRead && !state.reading)
5194 n = howMuchToRead(nOrig, state);
5195
5196 var ret;
5197 if (n > 0)
5198 ret = fromList(n, state);
5199 else
5200 ret = null;
16865 5201
16866 $.fn.modal.noConflict = function () { 5202 if (util.isNull(ret)) {
16867 $.fn.modal = old 5203 state.needReadable = true;
16868 return this 5204 n = 0;
16869 } 5205 }
16870 5206
5207 state.length -= n;
16871 5208
16872 // MODAL DATA-API 5209 // If we have nothing in the buffer, then we want to know
16873 // ============== 5210 // as soon as we *do* get something into the buffer.
5211 if (state.length === 0 && !state.ended)
5212 state.needReadable = true;
16874 5213
16875 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { 5214 // If we tried to read() past the EOF, then emit end on the next tick.
16876 var $this = $(this) 5215 if (nOrig !== n && state.ended && state.length === 0)
16877 var href = $this.attr('href') 5216 endReadable(this);
16878 var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
16879 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
16880 5217
16881 if ($this.is('a')) e.preventDefault() 5218 if (!util.isNull(ret))
5219 this.emit('data', ret);
16882 5220
16883 $target.one('show.bs.modal', function (showEvent) { 5221 return ret;
16884 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown 5222};
16885 $target.one('hidden.bs.modal', function () {
16886 $this.is(':visible') && $this.trigger('focus')
16887 })
16888 })
16889 Plugin.call($target, option, this)
16890 })
16891
16892}(jQuery);
16893
16894/* ========================================================================
16895 * Bootstrap: tooltip.js v3.2.0
16896 * http://getbootstrap.com/javascript/#tooltip
16897 * Inspired by the original jQuery.tipsy by Jason Frame
16898 * ========================================================================
16899 * Copyright 2011-2014 Twitter, Inc.
16900 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
16901 * ======================================================================== */
16902
16903
16904+function ($) {
16905 'use strict';
16906
16907 // TOOLTIP PUBLIC CLASS DEFINITION
16908 // ===============================
16909
16910 var Tooltip = function (element, options) {
16911 this.type =
16912 this.options =
16913 this.enabled =
16914 this.timeout =
16915 this.hoverState =
16916 this.$element = null
16917 5223
16918 this.init('tooltip', element, options) 5224function chunkInvalid(state, chunk) {
5225 var er = null;
5226 if (!util.isBuffer(chunk) &&
5227 !util.isString(chunk) &&
5228 !util.isNullOrUndefined(chunk) &&
5229 !state.objectMode) {
5230 er = new TypeError('Invalid non-string/buffer chunk');
16919 } 5231 }
5232 return er;
5233}
16920 5234
16921 Tooltip.VERSION = '3.2.0'
16922
16923 Tooltip.DEFAULTS = {
16924 animation: true,
16925 placement: 'top',
16926 selector: false,
16927 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
16928 trigger: 'hover focus',
16929 title: '',
16930 delay: 0,
16931 html: false,
16932 container: false,
16933 viewport: {
16934 selector: 'body',
16935 padding: 0
16936 }
16937 }
16938
16939 Tooltip.prototype.init = function (type, element, options) {
16940 this.enabled = true
16941 this.type = type
16942 this.$element = $(element)
16943 this.options = this.getOptions(options)
16944 this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
16945
16946 var triggers = this.options.trigger.split(' ')
16947
16948 for (var i = triggers.length; i--;) {
16949 var trigger = triggers[i]
16950
16951 if (trigger == 'click') {
16952 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
16953 } else if (trigger != 'manual') {
16954 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
16955 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
16956 5235
16957 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 5236function onEofChunk(stream, state) {
16958 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 5237 if (state.decoder && !state.ended) {
16959 } 5238 var chunk = state.decoder.end();
5239 if (chunk && chunk.length) {
5240 state.buffer.push(chunk);
5241 state.length += state.objectMode ? 1 : chunk.length;
16960 } 5242 }
16961
16962 this.options.selector ?
16963 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
16964 this.fixTitle()
16965 } 5243 }
5244 state.ended = true;
16966 5245
16967 Tooltip.prototype.getDefaults = function () { 5246 // emit 'readable' now to make sure it gets picked up.
16968 return Tooltip.DEFAULTS 5247 emitReadable(stream);
16969 } 5248}
16970
16971 Tooltip.prototype.getOptions = function (options) {
16972 options = $.extend({}, this.getDefaults(), this.$element.data(), options)
16973
16974 if (options.delay && typeof options.delay == 'number') {
16975 options.delay = {
16976 show: options.delay,
16977 hide: options.delay
16978 }
16979 }
16980 5249
16981 return options 5250// Don't emit readable right away in sync mode, because this can trigger
5251// another read() call => stack overflow. This way, it might trigger
5252// a nextTick recursion warning, but that's not so bad.
5253function emitReadable(stream) {
5254 var state = stream._readableState;
5255 state.needReadable = false;
5256 if (!state.emittedReadable) {
5257 debug('emitReadable', state.flowing);
5258 state.emittedReadable = true;
5259 if (state.sync)
5260 process.nextTick(function() {
5261 emitReadable_(stream);
5262 });
5263 else
5264 emitReadable_(stream);
16982 } 5265 }
5266}
16983 5267
16984 Tooltip.prototype.getDelegateOptions = function () { 5268function emitReadable_(stream) {
16985 var options = {} 5269 debug('emit readable');
16986 var defaults = this.getDefaults() 5270 stream.emit('readable');
5271 flow(stream);
5272}
16987 5273
16988 this._options && $.each(this._options, function (key, value) {
16989 if (defaults[key] != value) options[key] = value
16990 })
16991 5274
16992 return options 5275// at this point, the user has presumably seen the 'readable' event,
5276// and called read() to consume some data. that may have triggered
5277// in turn another _read(n) call, in which case reading = true if
5278// it's in progress.
5279// However, if we're not ended, or reading, and the length < hwm,
5280// then go ahead and try to read some more preemptively.
5281function maybeReadMore(stream, state) {
5282 if (!state.readingMore) {
5283 state.readingMore = true;
5284 process.nextTick(function() {
5285 maybeReadMore_(stream, state);
5286 });
16993 } 5287 }
5288}
16994 5289
16995 Tooltip.prototype.enter = function (obj) { 5290function maybeReadMore_(stream, state) {
16996 var self = obj instanceof this.constructor ? 5291 var len = state.length;
16997 obj : $(obj.currentTarget).data('bs.' + this.type) 5292 while (!state.reading && !state.flowing && !state.ended &&
16998 5293 state.length < state.highWaterMark) {
16999 if (!self) { 5294 debug('maybeReadMore read 0');
17000 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 5295 stream.read(0);
17001 $(obj.currentTarget).data('bs.' + this.type, self) 5296 if (len === state.length)
17002 } 5297 // didn't get any data, stop spinning.
17003 5298 break;
17004 clearTimeout(self.timeout) 5299 else
17005 5300 len = state.length;
17006 self.hoverState = 'in'
17007
17008 if (!self.options.delay || !self.options.delay.show) return self.show()
17009
17010 self.timeout = setTimeout(function () {
17011 if (self.hoverState == 'in') self.show()
17012 }, self.options.delay.show)
17013 } 5301 }
5302 state.readingMore = false;
5303}
17014 5304
17015 Tooltip.prototype.leave = function (obj) { 5305// abstract method. to be overridden in specific implementation classes.
17016 var self = obj instanceof this.constructor ? 5306// call cb(er, data) where data is <= n in length.
17017 obj : $(obj.currentTarget).data('bs.' + this.type) 5307// for virtual (non-string, non-buffer) streams, "length" is somewhat
17018 5308// arbitrary, and perhaps not very meaningful.
17019 if (!self) { 5309Readable.prototype._read = function(n) {
17020 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 5310 this.emit('error', new Error('not implemented'));
17021 $(obj.currentTarget).data('bs.' + this.type, self) 5311};
17022 }
17023
17024 clearTimeout(self.timeout)
17025
17026 self.hoverState = 'out'
17027
17028 if (!self.options.delay || !self.options.delay.hide) return self.hide()
17029 5312
17030 self.timeout = setTimeout(function () { 5313Readable.prototype.pipe = function(dest, pipeOpts) {
17031 if (self.hoverState == 'out') self.hide() 5314 var src = this;
17032 }, self.options.delay.hide) 5315 var state = this._readableState;
5316
5317 switch (state.pipesCount) {
5318 case 0:
5319 state.pipes = dest;
5320 break;
5321 case 1:
5322 state.pipes = [state.pipes, dest];
5323 break;
5324 default:
5325 state.pipes.push(dest);
5326 break;
17033 } 5327 }
5328 state.pipesCount += 1;
5329 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
17034 5330
17035 Tooltip.prototype.show = function () { 5331 var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
17036 var e = $.Event('show.bs.' + this.type) 5332 dest !== process.stdout &&
17037 5333 dest !== process.stderr;
17038 if (this.hasContent() && this.enabled) {
17039 this.$element.trigger(e)
17040
17041 var inDom = $.contains(document.documentElement, this.$element[0])
17042 if (e.isDefaultPrevented() || !inDom) return
17043 var that = this
17044
17045 var $tip = this.tip()
17046
17047 var tipId = this.getUID(this.type)
17048
17049 this.setContent()
17050 $tip.attr('id', tipId)
17051 this.$element.attr('aria-describedby', tipId)
17052
17053 if (this.options.animation) $tip.addClass('fade')
17054
17055 var placement = typeof this.options.placement == 'function' ?
17056 this.options.placement.call(this, $tip[0], this.$element[0]) :
17057 this.options.placement
17058
17059 var autoToken = /\s?auto?\s?/i
17060 var autoPlace = autoToken.test(placement)
17061 if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
17062
17063 $tip
17064 .detach()
17065 .css({ top: 0, left: 0, display: 'block' })
17066 .addClass(placement)
17067 .data('bs.' + this.type, this)
17068
17069 this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
17070 5334
17071 var pos = this.getPosition() 5335 var endFn = doEnd ? onend : cleanup;
17072 var actualWidth = $tip[0].offsetWidth 5336 if (state.endEmitted)
17073 var actualHeight = $tip[0].offsetHeight 5337 process.nextTick(endFn);
17074 5338 else
17075 if (autoPlace) { 5339 src.once('end', endFn);
17076 var orgPlacement = placement 5340
17077 var $parent = this.$element.parent() 5341 dest.on('unpipe', onunpipe);
17078 var parentDim = this.getPosition($parent) 5342 function onunpipe(readable) {
17079 5343 debug('onunpipe');
17080 placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' : 5344 if (readable === src) {
17081 placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' : 5345 cleanup();
17082 placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' : 5346 }
17083 placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' : 5347 }
17084 placement 5348
17085 5349 function onend() {
17086 $tip 5350 debug('onend');
17087 .removeClass(orgPlacement) 5351 dest.end();
17088 .addClass(placement) 5352 }
17089 } 5353
17090 5354 // when the dest drains, it reduces the awaitDrain counter
17091 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 5355 // on the source. This would be more elegant with a .once()
5356 // handler in flow(), but adding and removing repeatedly is
5357 // too slow.
5358 var ondrain = pipeOnDrain(src);
5359 dest.on('drain', ondrain);
5360
5361 function cleanup() {
5362 debug('cleanup');
5363 // cleanup event handlers once the pipe is broken
5364 dest.removeListener('close', onclose);
5365 dest.removeListener('finish', onfinish);
5366 dest.removeListener('drain', ondrain);
5367 dest.removeListener('error', onerror);
5368 dest.removeListener('unpipe', onunpipe);
5369 src.removeListener('end', onend);
5370 src.removeListener('end', cleanup);
5371 src.removeListener('data', ondata);
5372
5373 // if the reader is waiting for a drain event from this
5374 // specific writer, then it would cause it to never start
5375 // flowing again.
5376 // So, if this is awaiting a drain, then we just call it now.
5377 // If we don't know, then assume that we are waiting for one.
5378 if (state.awaitDrain &&
5379 (!dest._writableState || dest._writableState.needDrain))
5380 ondrain();
5381 }
5382
5383 src.on('data', ondata);
5384 function ondata(chunk) {
5385 debug('ondata');
5386 var ret = dest.write(chunk);
5387 if (false === ret) {
5388 debug('false write response, pause',
5389 src._readableState.awaitDrain);
5390 src._readableState.awaitDrain++;
5391 src.pause();
5392 }
5393 }
5394
5395 // if the dest has an error, then stop piping into it.
5396 // however, don't suppress the throwing behavior for this.
5397 function onerror(er) {
5398 debug('onerror', er);
5399 unpipe();
5400 dest.removeListener('error', onerror);
5401 if (EE.listenerCount(dest, 'error') === 0)
5402 dest.emit('error', er);
5403 }
5404 // This is a brutally ugly hack to make sure that our error handler
5405 // is attached before any userland ones. NEVER DO THIS.
5406 if (!dest._events || !dest._events.error)
5407 dest.on('error', onerror);
5408 else if (isArray(dest._events.error))
5409 dest._events.error.unshift(onerror);
5410 else
5411 dest._events.error = [onerror, dest._events.error];
17092 5412
17093 this.applyPlacement(calculatedOffset, placement)
17094 5413
17095 var complete = function () {
17096 that.$element.trigger('shown.bs.' + that.type)
17097 that.hoverState = null
17098 }
17099 5414
17100 $.support.transition && this.$tip.hasClass('fade') ? 5415 // Both close and finish should trigger unpipe, but only once.
17101 $tip 5416 function onclose() {
17102 .one('bsTransitionEnd', complete) 5417 dest.removeListener('finish', onfinish);
17103 .emulateTransitionEnd(150) : 5418 unpipe();
17104 complete()
17105 }
17106 } 5419 }
17107 5420 dest.once('close', onclose);
17108 Tooltip.prototype.applyPlacement = function (offset, placement) { 5421 function onfinish() {
17109 var $tip = this.tip() 5422 debug('onfinish');
17110 var width = $tip[0].offsetWidth 5423 dest.removeListener('close', onclose);
17111 var height = $tip[0].offsetHeight 5424 unpipe();
17112
17113 // manually read margins because getBoundingClientRect includes difference
17114 var marginTop = parseInt($tip.css('margin-top'), 10)
17115 var marginLeft = parseInt($tip.css('margin-left'), 10)
17116
17117 // we must check for NaN for ie 8/9
17118 if (isNaN(marginTop)) marginTop = 0
17119 if (isNaN(marginLeft)) marginLeft = 0
17120
17121 offset.top = offset.top + marginTop
17122 offset.left = offset.left + marginLeft
17123
17124 // $.fn.offset doesn't round pixel values
17125 // so we use setOffset directly with our own function B-0
17126 $.offset.setOffset($tip[0], $.extend({
17127 using: function (props) {
17128 $tip.css({
17129 top: Math.round(props.top),
17130 left: Math.round(props.left)
17131 })
17132 }
17133 }, offset), 0)
17134
17135 $tip.addClass('in')
17136
17137 // check to see if placing tip in new offset caused the tip to resize itself
17138 var actualWidth = $tip[0].offsetWidth
17139 var actualHeight = $tip[0].offsetHeight
17140
17141 if (placement == 'top' && actualHeight != height) {
17142 offset.top = offset.top + height - actualHeight
17143 }
17144
17145 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
17146
17147 if (delta.left) offset.left += delta.left
17148 else offset.top += delta.top
17149
17150 var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
17151 var arrowPosition = delta.left ? 'left' : 'top'
17152 var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
17153
17154 $tip.offset(offset)
17155 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
17156 } 5425 }
5426 dest.once('finish', onfinish);
17157 5427
17158 Tooltip.prototype.replaceArrow = function (delta, dimension, position) { 5428 function unpipe() {
17159 this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '') 5429 debug('unpipe');
5430 src.unpipe(dest);
17160 } 5431 }
17161 5432
17162 Tooltip.prototype.setContent = function () { 5433 // tell the dest that it's being piped to
17163 var $tip = this.tip() 5434 dest.emit('pipe', src);
17164 var title = this.getTitle()
17165 5435
17166 $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) 5436 // start the flow if it hasn't been started already.
17167 $tip.removeClass('fade in top bottom left right') 5437 if (!state.flowing) {
5438 debug('pipe resume');
5439 src.resume();
17168 } 5440 }
17169 5441
17170 Tooltip.prototype.hide = function () { 5442 return dest;
17171 var that = this 5443};
17172 var $tip = this.tip()
17173 var e = $.Event('hide.bs.' + this.type)
17174
17175 this.$element.removeAttr('aria-describedby')
17176 5444
17177 function complete() { 5445function pipeOnDrain(src) {
17178 if (that.hoverState != 'in') $tip.detach() 5446 return function() {
17179 that.$element.trigger('hidden.bs.' + that.type) 5447 var state = src._readableState;
5448 debug('pipeOnDrain', state.awaitDrain);
5449 if (state.awaitDrain)
5450 state.awaitDrain--;
5451 if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
5452 state.flowing = true;
5453 flow(src);
17180 } 5454 }
5455 };
5456}
17181 5457
17182 this.$element.trigger(e)
17183
17184 if (e.isDefaultPrevented()) return
17185
17186 $tip.removeClass('in')
17187 5458
17188 $.support.transition && this.$tip.hasClass('fade') ? 5459Readable.prototype.unpipe = function(dest) {
17189 $tip 5460 var state = this._readableState;
17190 .one('bsTransitionEnd', complete)
17191 .emulateTransitionEnd(150) :
17192 complete()
17193 5461
17194 this.hoverState = null 5462 // if we're not piping anywhere, then do nothing.
5463 if (state.pipesCount === 0)
5464 return this;
17195 5465
17196 return this 5466 // just one destination. most common case.
5467 if (state.pipesCount === 1) {
5468 // passed in one, but it's not the right one.
5469 if (dest && dest !== state.pipes)
5470 return this;
5471
5472 if (!dest)
5473 dest = state.pipes;
5474
5475 // got a match.
5476 state.pipes = null;
5477 state.pipesCount = 0;
5478 state.flowing = false;
5479 if (dest)
5480 dest.emit('unpipe', this);
5481 return this;
17197 } 5482 }
17198 5483
17199 Tooltip.prototype.fixTitle = function () { 5484 // slow case. multiple pipe destinations.
17200 var $e = this.$element
17201 if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
17202 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
17203 }
17204 }
17205 5485
17206 Tooltip.prototype.hasContent = function () { 5486 if (!dest) {
17207 return this.getTitle() 5487 // remove all.
17208 } 5488 var dests = state.pipes;
5489 var len = state.pipesCount;
5490 state.pipes = null;
5491 state.pipesCount = 0;
5492 state.flowing = false;
17209 5493
17210 Tooltip.prototype.getPosition = function ($element) { 5494 for (var i = 0; i < len; i++)
17211 $element = $element || this.$element 5495 dests[i].emit('unpipe', this);
17212 var el = $element[0] 5496 return this;
17213 var isBody = el.tagName == 'BODY'
17214 return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
17215 scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
17216 width: isBody ? $(window).width() : $element.outerWidth(),
17217 height: isBody ? $(window).height() : $element.outerHeight()
17218 }, isBody ? { top: 0, left: 0 } : $element.offset())
17219 } 5497 }
17220 5498
17221 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 5499 // try to find the right one.
17222 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 5500 var i = indexOf(state.pipes, dest);
17223 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : 5501 if (i === -1)
17224 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : 5502 return this;
17225 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
17226 5503
17227 } 5504 state.pipes.splice(i, 1);
5505 state.pipesCount -= 1;
5506 if (state.pipesCount === 1)
5507 state.pipes = state.pipes[0];
17228 5508
17229 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { 5509 dest.emit('unpipe', this);
17230 var delta = { top: 0, left: 0 }
17231 if (!this.$viewport) return delta
17232 5510
17233 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 5511 return this;
17234 var viewportDimensions = this.getPosition(this.$viewport) 5512};
17235 5513
17236 if (/right|left/.test(placement)) { 5514// set up data events if they are asked for
17237 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll 5515// Ensure readable listeners eventually get something
17238 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight 5516Readable.prototype.on = function(ev, fn) {
17239 if (topEdgeOffset < viewportDimensions.top) { // top overflow 5517 var res = Stream.prototype.on.call(this, ev, fn);
17240 delta.top = viewportDimensions.top - topEdgeOffset 5518
17241 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow 5519 // If listening to data, and it has not explicitly been paused,
17242 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset 5520 // then call resume to start the flow of data on the next tick.
17243 } 5521 if (ev === 'data' && false !== this._readableState.flowing) {
17244 } else { 5522 this.resume();
17245 var leftEdgeOffset = pos.left - viewportPadding 5523 }
17246 var rightEdgeOffset = pos.left + viewportPadding + actualWidth 5524
17247 if (leftEdgeOffset < viewportDimensions.left) { // left overflow 5525 if (ev === 'readable' && this.readable) {
17248 delta.left = viewportDimensions.left - leftEdgeOffset 5526 var state = this._readableState;
17249 } else if (rightEdgeOffset > viewportDimensions.width) { // right overflow 5527 if (!state.readableListening) {
17250 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset 5528 state.readableListening = true;
5529 state.emittedReadable = false;
5530 state.needReadable = true;
5531 if (!state.reading) {
5532 var self = this;
5533 process.nextTick(function() {
5534 debug('readable nexttick read 0');
5535 self.read(0);
5536 });
5537 } else if (state.length) {
5538 emitReadable(this, state);
17251 } 5539 }
17252 } 5540 }
17253
17254 return delta
17255 } 5541 }
17256 5542
17257 Tooltip.prototype.getTitle = function () { 5543 return res;
17258 var title 5544};
17259 var $e = this.$element 5545Readable.prototype.addListener = Readable.prototype.on;
17260 var o = this.options 5546
17261 5547// pause() and resume() are remnants of the legacy readable stream API
17262 title = $e.attr('data-original-title') 5548// If the user uses them, then switch into old mode.
17263 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 5549Readable.prototype.resume = function() {
17264 5550 var state = this._readableState;
17265 return title 5551 if (!state.flowing) {
17266 } 5552 debug('resume');
17267 5553 state.flowing = true;
17268 Tooltip.prototype.getUID = function (prefix) { 5554 if (!state.reading) {
17269 do prefix += ~~(Math.random() * 1000000) 5555 debug('resume read 0');
17270 while (document.getElementById(prefix)) 5556 this.read(0);
17271 return prefix 5557 }
17272 } 5558 resume(this, state);
17273 5559 }
17274 Tooltip.prototype.tip = function () { 5560 return this;
17275 return (this.$tip = this.$tip || $(this.options.template)) 5561};
17276 }
17277 5562
17278 Tooltip.prototype.arrow = function () { 5563function resume(stream, state) {
17279 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) 5564 if (!state.resumeScheduled) {
5565 state.resumeScheduled = true;
5566 process.nextTick(function() {
5567 resume_(stream, state);
5568 });
17280 } 5569 }
5570}
17281 5571
17282 Tooltip.prototype.validate = function () { 5572function resume_(stream, state) {
17283 if (!this.$element[0].parentNode) { 5573 state.resumeScheduled = false;
17284 this.hide() 5574 stream.emit('resume');
17285 this.$element = null 5575 flow(stream);
17286 this.options = null 5576 if (state.flowing && !state.reading)
17287 } 5577 stream.read(0);
17288 } 5578}
17289 5579
17290 Tooltip.prototype.enable = function () { 5580Readable.prototype.pause = function() {
17291 this.enabled = true 5581 debug('call pause flowing=%j', this._readableState.flowing);
5582 if (false !== this._readableState.flowing) {
5583 debug('pause');
5584 this._readableState.flowing = false;
5585 this.emit('pause');
17292 } 5586 }
5587 return this;
5588};
17293 5589
17294 Tooltip.prototype.disable = function () { 5590function flow(stream) {
17295 this.enabled = false 5591 var state = stream._readableState;
5592 debug('flow', state.flowing);
5593 if (state.flowing) {
5594 do {
5595 var chunk = stream.read();
5596 } while (null !== chunk && state.flowing);
17296 } 5597 }
5598}
17297 5599
17298 Tooltip.prototype.toggleEnabled = function () { 5600// wrap an old-style stream as the async data source.
17299 this.enabled = !this.enabled 5601// This is *not* part of the readable stream interface.
17300 } 5602// It is an ugly unfortunate mess of history.
5603Readable.prototype.wrap = function(stream) {
5604 var state = this._readableState;
5605 var paused = false;
17301 5606
17302 Tooltip.prototype.toggle = function (e) { 5607 var self = this;
17303 var self = this 5608 stream.on('end', function() {
17304 if (e) { 5609 debug('wrapped end');
17305 self = $(e.currentTarget).data('bs.' + this.type) 5610 if (state.decoder && !state.ended) {
17306 if (!self) { 5611 var chunk = state.decoder.end();
17307 self = new this.constructor(e.currentTarget, this.getDelegateOptions()) 5612 if (chunk && chunk.length)
17308 $(e.currentTarget).data('bs.' + this.type, self) 5613 self.push(chunk);
17309 }
17310 } 5614 }
17311 5615
17312 self.tip().hasClass('in') ? self.leave(self) : self.enter(self) 5616 self.push(null);
17313 } 5617 });
17314
17315 Tooltip.prototype.destroy = function () {
17316 clearTimeout(this.timeout)
17317 this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
17318 }
17319
17320
17321 // TOOLTIP PLUGIN DEFINITION
17322 // =========================
17323
17324 function Plugin(option) {
17325 return this.each(function () {
17326 var $this = $(this)
17327 var data = $this.data('bs.tooltip')
17328 var options = typeof option == 'object' && option
17329
17330 if (!data && option == 'destroy') return
17331 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
17332 if (typeof option == 'string') data[option]()
17333 })
17334 }
17335
17336 var old = $.fn.tooltip
17337
17338 $.fn.tooltip = Plugin
17339 $.fn.tooltip.Constructor = Tooltip
17340
17341
17342 // TOOLTIP NO CONFLICT
17343 // ===================
17344
17345 $.fn.tooltip.noConflict = function () {
17346 $.fn.tooltip = old
17347 return this
17348 }
17349
17350}(jQuery);
17351
17352/* ========================================================================
17353 * Bootstrap: popover.js v3.2.0
17354 * http://getbootstrap.com/javascript/#popovers
17355 * ========================================================================
17356 * Copyright 2011-2014 Twitter, Inc.
17357 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
17358 * ======================================================================== */
17359
17360 5618
17361+function ($) { 5619 stream.on('data', function(chunk) {
17362 'use strict'; 5620 debug('wrapped data');
5621 if (state.decoder)
5622 chunk = state.decoder.write(chunk);
5623 if (!chunk || !state.objectMode && !chunk.length)
5624 return;
17363 5625
17364 // POPOVER PUBLIC CLASS DEFINITION 5626 var ret = self.push(chunk);
17365 // =============================== 5627 if (!ret) {
5628 paused = true;
5629 stream.pause();
5630 }
5631 });
17366 5632
17367 var Popover = function (element, options) { 5633 // proxy all the other methods.
17368 this.init('popover', element, options) 5634 // important when wrapping filters and duplexes.
5635 for (var i in stream) {
5636 if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
5637 this[i] = function(method) { return function() {
5638 return stream[method].apply(stream, arguments);
5639 }}(i);
5640 }
17369 } 5641 }
17370 5642
17371 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') 5643 // proxy certain important events.
5644 var events = ['error', 'close', 'destroy', 'pause', 'resume'];
5645 forEach(events, function(ev) {
5646 stream.on(ev, self.emit.bind(self, ev));
5647 });
17372 5648
17373 Popover.VERSION = '3.2.0' 5649 // when we try to consume some more bytes, simply unpause the
5650 // underlying stream.
5651 self._read = function(n) {
5652 debug('wrapped _read', n);
5653 if (paused) {
5654 paused = false;
5655 stream.resume();
5656 }
5657 };
17374 5658
17375 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { 5659 return self;
17376 placement: 'right', 5660};
17377 trigger: 'click',
17378 content: '',
17379 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
17380 })
17381 5661
17382 5662
17383 // NOTE: POPOVER EXTENDS tooltip.js
17384 // ================================
17385 5663
17386 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) 5664// exposed for testing purposes only.
5665Readable._fromList = fromList;
17387 5666
17388 Popover.prototype.constructor = Popover 5667// Pluck off n bytes from an array of buffers.
5668// Length is the combined lengths of all the buffers in the list.
5669function fromList(n, state) {
5670 var list = state.buffer;
5671 var length = state.length;
5672 var stringMode = !!state.decoder;
5673 var objectMode = !!state.objectMode;
5674 var ret;
17389 5675
17390 Popover.prototype.getDefaults = function () { 5676 // nothing in the list, definitely empty.
17391 return Popover.DEFAULTS 5677 if (list.length === 0)
17392 } 5678 return null;
17393 5679
17394 Popover.prototype.setContent = function () { 5680 if (length === 0)
17395 var $tip = this.tip() 5681 ret = null;
17396 var title = this.getTitle() 5682 else if (objectMode)
17397 var content = this.getContent() 5683 ret = list.shift();
5684 else if (!n || n >= length) {
5685 // read it all, truncate the array.
5686 if (stringMode)
5687 ret = list.join('');
5688 else
5689 ret = Buffer.concat(list, length);
5690 list.length = 0;
5691 } else {
5692 // read just some of it.
5693 if (n < list[0].length) {
5694 // just take a part of the first list item.
5695 // slice is the same for buffers and strings.
5696 var buf = list[0];
5697 ret = buf.slice(0, n);
5698 list[0] = buf.slice(n);
5699 } else if (n === list[0].length) {
5700 // first list is a perfect match
5701 ret = list.shift();
5702 } else {
5703 // complex case.
5704 // we have enough to cover it, but it spans past the first buffer.
5705 if (stringMode)
5706 ret = '';
5707 else
5708 ret = new Buffer(n);
17398 5709
17399 $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) 5710 var c = 0;
17400 $tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events 5711 for (var i = 0, l = list.length; i < l && c < n; i++) {
17401 this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text' 5712 var buf = list[0];
17402 ](content) 5713 var cpy = Math.min(n - c, buf.length);
17403 5714
17404 $tip.removeClass('fade top bottom left right in') 5715 if (stringMode)
5716 ret += buf.slice(0, cpy);
5717 else
5718 buf.copy(ret, c, 0, cpy);
17405 5719
17406 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 5720 if (cpy < buf.length)
17407 // this manually by checking the contents. 5721 list[0] = buf.slice(cpy);
17408 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() 5722 else
17409 } 5723 list.shift();
17410 5724
17411 Popover.prototype.hasContent = function () { 5725 c += cpy;
17412 return this.getTitle() || this.getContent() 5726 }
5727 }
17413 } 5728 }
17414 5729
17415 Popover.prototype.getContent = function () { 5730 return ret;
17416 var $e = this.$element 5731}
17417 var o = this.options
17418 5732
17419 return $e.attr('data-content') 5733function endReadable(stream) {
17420 || (typeof o.content == 'function' ? 5734 var state = stream._readableState;
17421 o.content.call($e[0]) :
17422 o.content)
17423 }
17424 5735
17425 Popover.prototype.arrow = function () { 5736 // If we get here before consuming all the bytes, then that is a
17426 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 5737 // bug in node. Should never happen.
17427 } 5738 if (state.length > 0)
5739 throw new Error('endReadable called on non-empty stream');
17428 5740
17429 Popover.prototype.tip = function () { 5741 if (!state.endEmitted) {
17430 if (!this.$tip) this.$tip = $(this.options.template) 5742 state.ended = true;
17431 return this.$tip 5743 process.nextTick(function() {
5744 // Check that we didn't get one last unshift.
5745 if (!state.endEmitted && state.length === 0) {
5746 state.endEmitted = true;
5747 stream.readable = false;
5748 stream.emit('end');
5749 }
5750 });
17432 } 5751 }
5752}
17433 5753
17434 5754function forEach (xs, f) {
17435 // POPOVER PLUGIN DEFINITION 5755 for (var i = 0, l = xs.length; i < l; i++) {
17436 // ========================= 5756 f(xs[i], i);
17437
17438 function Plugin(option) {
17439 return this.each(function () {
17440 var $this = $(this)
17441 var data = $this.data('bs.popover')
17442 var options = typeof option == 'object' && option
17443
17444 if (!data && option == 'destroy') return
17445 if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
17446 if (typeof option == 'string') data[option]()
17447 })
17448 } 5757 }
5758}
17449 5759
17450 var old = $.fn.popover 5760function indexOf (xs, x) {
17451 5761 for (var i = 0, l = xs.length; i < l; i++) {
17452 $.fn.popover = Plugin 5762 if (xs[i] === x) return i;
17453 $.fn.popover.Constructor = Popover
17454
17455
17456 // POPOVER NO CONFLICT
17457 // ===================
17458
17459 $.fn.popover.noConflict = function () {
17460 $.fn.popover = old
17461 return this
17462 } 5763 }
5764 return -1;
5765}
17463 5766
17464}(jQuery); 5767}).call(this,require('_process'))
17465 5768},{"./_stream_duplex":16,"_process":14,"buffer":7,"core-util-is":21,"events":11,"inherits":12,"isarray":13,"stream":26,"string_decoder/":27,"util":6}],19:[function(require,module,exports){
17466/* ======================================================================== 5769// Copyright Joyent, Inc. and other Node contributors.
17467 * Bootstrap: scrollspy.js v3.2.0 5770//
17468 * http://getbootstrap.com/javascript/#scrollspy 5771// Permission is hereby granted, free of charge, to any person obtaining a
17469 * ======================================================================== 5772// copy of this software and associated documentation files (the
17470 * Copyright 2011-2014 Twitter, Inc. 5773// "Software"), to deal in the Software without restriction, including
17471 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5774// without limitation the rights to use, copy, modify, merge, publish,
17472 * ======================================================================== */ 5775// distribute, sublicense, and/or sell copies of the Software, and to permit
17473 5776// persons to whom the Software is furnished to do so, subject to the
17474 5777// following conditions:
17475+function ($) { 5778//
17476 'use strict'; 5779// The above copyright notice and this permission notice shall be included
17477 5780// in all copies or substantial portions of the Software.
17478 // SCROLLSPY CLASS DEFINITION 5781//
17479 // ========================== 5782// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17480 5783// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17481 function ScrollSpy(element, options) { 5784// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17482 var process = $.proxy(this.process, this) 5785// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
5786// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
5787// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
5788// USE OR OTHER DEALINGS IN THE SOFTWARE.
17483 5789
17484 this.$body = $('body')
17485 this.$scrollElement = $(element).is('body') ? $(window) : $(element)
17486 this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
17487 this.selector = (this.options.target || '') + ' .nav li > a'
17488 this.offsets = []
17489 this.targets = []
17490 this.activeTarget = null
17491 this.scrollHeight = 0
17492 5790
17493 this.$scrollElement.on('scroll.bs.scrollspy', process) 5791// a transform stream is a readable/writable stream where you do
17494 this.refresh() 5792// something with the data. Sometimes it's called a "filter",
17495 this.process() 5793// but that's not a great name for it, since that implies a thing where
17496 } 5794// some bits pass through, and others are simply ignored. (That would
5795// be a valid example of a transform, of course.)
5796//
5797// While the output is causally related to the input, it's not a
5798// necessarily symmetric or synchronous transformation. For example,
5799// a zlib stream might take multiple plain-text writes(), and then
5800// emit a single compressed chunk some time in the future.
5801//
5802// Here's how this works:
5803//
5804// The Transform stream has all the aspects of the readable and writable
5805// stream classes. When you write(chunk), that calls _write(chunk,cb)
5806// internally, and returns false if there's a lot of pending writes
5807// buffered up. When you call read(), that calls _read(n) until
5808// there's enough pending readable data buffered up.
5809//
5810// In a transform stream, the written data is placed in a buffer. When
5811// _read(n) is called, it transforms the queued up data, calling the
5812// buffered _write cb's as it consumes chunks. If consuming a single
5813// written chunk would result in multiple output chunks, then the first
5814// outputted bit calls the readcb, and subsequent chunks just go into
5815// the read buffer, and will cause it to emit 'readable' if necessary.
5816//
5817// This way, back-pressure is actually determined by the reading side,
5818// since _read has to be called to start processing a new chunk. However,
5819// a pathological inflate type of transform can cause excessive buffering
5820// here. For example, imagine a stream where every byte of input is
5821// interpreted as an integer from 0-255, and then results in that many
5822// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
5823// 1kb of data being output. In this case, you could write a very small
5824// amount of input, and end up with a very large amount of output. In
5825// such a pathological inflating mechanism, there'd be no way to tell
5826// the system to stop doing the transform. A single 4MB write could
5827// cause the system to run out of memory.
5828//
5829// However, even in such a pathological case, only a single written chunk
5830// would be consumed, and then the rest would wait (un-transformed) until
5831// the results of the previous transformed chunk were consumed.
17497 5832
17498 ScrollSpy.VERSION = '3.2.0' 5833module.exports = Transform;
17499 5834
17500 ScrollSpy.DEFAULTS = { 5835var Duplex = require('./_stream_duplex');
17501 offset: 10
17502 }
17503 5836
17504 ScrollSpy.prototype.getScrollHeight = function () { 5837/*<replacement>*/
17505 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 5838var util = require('core-util-is');
17506 } 5839util.inherits = require('inherits');
5840/*</replacement>*/
17507 5841
17508 ScrollSpy.prototype.refresh = function () { 5842util.inherits(Transform, Duplex);
17509 var offsetMethod = 'offset'
17510 var offsetBase = 0
17511 5843
17512 if (!$.isWindow(this.$scrollElement[0])) {
17513 offsetMethod = 'position'
17514 offsetBase = this.$scrollElement.scrollTop()
17515 }
17516 5844
17517 this.offsets = [] 5845function TransformState(options, stream) {
17518 this.targets = [] 5846 this.afterTransform = function(er, data) {
17519 this.scrollHeight = this.getScrollHeight() 5847 return afterTransform(stream, er, data);
5848 };
17520 5849
17521 var self = this 5850 this.needTransform = false;
5851 this.transforming = false;
5852 this.writecb = null;
5853 this.writechunk = null;
5854}
17522 5855
17523 this.$body 5856function afterTransform(stream, er, data) {
17524 .find(this.selector) 5857 var ts = stream._transformState;
17525 .map(function () { 5858 ts.transforming = false;
17526 var $el = $(this)
17527 var href = $el.data('target') || $el.attr('href')
17528 var $href = /^#./.test(href) && $(href)
17529 5859
17530 return ($href 5860 var cb = ts.writecb;
17531 && $href.length
17532 && $href.is(':visible')
17533 && [[$href[offsetMethod]().top + offsetBase, href]]) || null
17534 })
17535 .sort(function (a, b) { return a[0] - b[0] })
17536 .each(function () {
17537 self.offsets.push(this[0])
17538 self.targets.push(this[1])
17539 })
17540 }
17541 5861
17542 ScrollSpy.prototype.process = function () { 5862 if (!cb)
17543 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 5863 return stream.emit('error', new Error('no writecb in Transform class'));
17544 var scrollHeight = this.getScrollHeight()
17545 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
17546 var offsets = this.offsets
17547 var targets = this.targets
17548 var activeTarget = this.activeTarget
17549 var i
17550 5864
17551 if (this.scrollHeight != scrollHeight) { 5865 ts.writechunk = null;
17552 this.refresh() 5866 ts.writecb = null;
17553 }
17554 5867
17555 if (scrollTop >= maxScroll) { 5868 if (!util.isNullOrUndefined(data))
17556 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) 5869 stream.push(data);
17557 }
17558 5870
17559 if (activeTarget && scrollTop <= offsets[0]) { 5871 if (cb)
17560 return activeTarget != (i = targets[0]) && this.activate(i) 5872 cb(er);
17561 }
17562 5873
17563 for (i = offsets.length; i--;) { 5874 var rs = stream._readableState;
17564 activeTarget != targets[i] 5875 rs.reading = false;
17565 && scrollTop >= offsets[i] 5876 if (rs.needReadable || rs.length < rs.highWaterMark) {
17566 && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) 5877 stream._read(rs.highWaterMark);
17567 && this.activate(targets[i])
17568 }
17569 } 5878 }
5879}
17570 5880
17571 ScrollSpy.prototype.activate = function (target) {
17572 this.activeTarget = target
17573
17574 $(this.selector)
17575 .parentsUntil(this.options.target, '.active')
17576 .removeClass('active')
17577
17578 var selector = this.selector +
17579 '[data-target="' + target + '"],' +
17580 this.selector + '[href="' + target + '"]'
17581
17582 var active = $(selector)
17583 .parents('li')
17584 .addClass('active')
17585
17586 if (active.parent('.dropdown-menu').length) {
17587 active = active
17588 .closest('li.dropdown')
17589 .addClass('active')
17590 }
17591 5881
17592 active.trigger('activate.bs.scrollspy') 5882function Transform(options) {
17593 } 5883 if (!(this instanceof Transform))
5884 return new Transform(options);
17594 5885
5886 Duplex.call(this, options);
17595 5887
17596 // SCROLLSPY PLUGIN DEFINITION 5888 this._transformState = new TransformState(options, this);
17597 // ===========================
17598 5889
17599 function Plugin(option) { 5890 // when the writable side finishes, then flush out anything remaining.
17600 return this.each(function () { 5891 var stream = this;
17601 var $this = $(this)
17602 var data = $this.data('bs.scrollspy')
17603 var options = typeof option == 'object' && option
17604 5892
17605 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) 5893 // start out asking for a readable event once data is transformed.
17606 if (typeof option == 'string') data[option]() 5894 this._readableState.needReadable = true;
17607 })
17608 }
17609 5895
17610 var old = $.fn.scrollspy 5896 // we have implemented the _read method, and done the other things
5897 // that Readable wants before the first _read call, so unset the
5898 // sync guard flag.
5899 this._readableState.sync = false;
17611 5900
17612 $.fn.scrollspy = Plugin 5901 this.once('prefinish', function() {
17613 $.fn.scrollspy.Constructor = ScrollSpy 5902 if (util.isFunction(this._flush))
5903 this._flush(function(er) {
5904 done(stream, er);
5905 });
5906 else
5907 done(stream);
5908 });
5909}
17614 5910
5911Transform.prototype.push = function(chunk, encoding) {
5912 this._transformState.needTransform = false;
5913 return Duplex.prototype.push.call(this, chunk, encoding);
5914};
17615 5915
17616 // SCROLLSPY NO CONFLICT 5916// This is the part where you do stuff!
17617 // ===================== 5917// override this function in implementation classes.
5918// 'chunk' is an input chunk.
5919//
5920// Call `push(newChunk)` to pass along transformed output
5921// to the readable side. You may call 'push' zero or more times.
5922//
5923// Call `cb(err)` when you are done with this chunk. If you pass
5924// an error, then that'll put the hurt on the whole operation. If you
5925// never call cb(), then you'll never get another chunk.
5926Transform.prototype._transform = function(chunk, encoding, cb) {
5927 throw new Error('not implemented');
5928};
17618 5929
17619 $.fn.scrollspy.noConflict = function () { 5930Transform.prototype._write = function(chunk, encoding, cb) {
17620 $.fn.scrollspy = old 5931 var ts = this._transformState;
17621 return this 5932 ts.writecb = cb;
5933 ts.writechunk = chunk;
5934 ts.writeencoding = encoding;
5935 if (!ts.transforming) {
5936 var rs = this._readableState;
5937 if (ts.needTransform ||
5938 rs.needReadable ||
5939 rs.length < rs.highWaterMark)
5940 this._read(rs.highWaterMark);
17622 } 5941 }
5942};
17623 5943
5944// Doesn't matter what the args are here.
5945// _transform does all the work.
5946// That we got here means that the readable side wants more data.
5947Transform.prototype._read = function(n) {
5948 var ts = this._transformState;
17624 5949
17625 // SCROLLSPY DATA-API 5950 if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
17626 // ================== 5951 ts.transforming = true;
17627 5952 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
17628 $(window).on('load.bs.scrollspy.data-api', function () { 5953 } else {
17629 $('[data-spy="scroll"]').each(function () { 5954 // mark that we need a transform, so that any data that comes in
17630 var $spy = $(this) 5955 // will get processed, now that we've asked for it.
17631 Plugin.call($spy, $spy.data()) 5956 ts.needTransform = true;
17632 })
17633 })
17634
17635}(jQuery);
17636
17637/* ========================================================================
17638 * Bootstrap: tab.js v3.2.0
17639 * http://getbootstrap.com/javascript/#tabs
17640 * ========================================================================
17641 * Copyright 2011-2014 Twitter, Inc.
17642 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
17643 * ======================================================================== */
17644
17645
17646+function ($) {
17647 'use strict';
17648
17649 // TAB CLASS DEFINITION
17650 // ====================
17651
17652 var Tab = function (element) {
17653 this.element = $(element)
17654 } 5957 }
5958};
17655 5959
17656 Tab.VERSION = '3.2.0'
17657
17658 Tab.prototype.show = function () {
17659 var $this = this.element
17660 var $ul = $this.closest('ul:not(.dropdown-menu)')
17661 var selector = $this.data('target')
17662
17663 if (!selector) {
17664 selector = $this.attr('href')
17665 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
17666 }
17667
17668 if ($this.parent('li').hasClass('active')) return
17669
17670 var previous = $ul.find('.active:last a')[0]
17671 var e = $.Event('show.bs.tab', {
17672 relatedTarget: previous
17673 })
17674
17675 $this.trigger(e)
17676 5960
17677 if (e.isDefaultPrevented()) return 5961function done(stream, er) {
5962 if (er)
5963 return stream.emit('error', er);
17678 5964
17679 var $target = $(selector) 5965 // if there's nothing in the write buffer, then that means
5966 // that nothing more will ever be provided
5967 var ws = stream._writableState;
5968 var ts = stream._transformState;
17680 5969
17681 this.activate($this.closest('li'), $ul) 5970 if (ws.length)
17682 this.activate($target, $target.parent(), function () { 5971 throw new Error('calling transform done when ws.length != 0');
17683 $this.trigger({
17684 type: 'shown.bs.tab',
17685 relatedTarget: previous
17686 })
17687 })
17688 }
17689 5972
17690 Tab.prototype.activate = function (element, container, callback) { 5973 if (ts.transforming)
17691 var $active = container.find('> .active') 5974 throw new Error('calling transform done when still transforming');
17692 var transition = callback
17693 && $.support.transition
17694 && $active.hasClass('fade')
17695 5975
17696 function next() { 5976 return stream.push(null);
17697 $active 5977}
17698 .removeClass('active')
17699 .find('> .dropdown-menu > .active')
17700 .removeClass('active')
17701
17702 element.addClass('active')
17703
17704 if (transition) {
17705 element[0].offsetWidth // reflow for transition
17706 element.addClass('in')
17707 } else {
17708 element.removeClass('fade')
17709 }
17710
17711 if (element.parent('.dropdown-menu')) {
17712 element.closest('li.dropdown').addClass('active')
17713 }
17714 5978
17715 callback && callback() 5979},{"./_stream_duplex":16,"core-util-is":21,"inherits":12}],20:[function(require,module,exports){
17716 } 5980(function (process){
5981// Copyright Joyent, Inc. and other Node contributors.
5982//
5983// Permission is hereby granted, free of charge, to any person obtaining a
5984// copy of this software and associated documentation files (the
5985// "Software"), to deal in the Software without restriction, including
5986// without limitation the rights to use, copy, modify, merge, publish,
5987// distribute, sublicense, and/or sell copies of the Software, and to permit
5988// persons to whom the Software is furnished to do so, subject to the
5989// following conditions:
5990//
5991// The above copyright notice and this permission notice shall be included
5992// in all copies or substantial portions of the Software.
5993//
5994// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
5995// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
5996// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
5997// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
5998// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
5999// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6000// USE OR OTHER DEALINGS IN THE SOFTWARE.
17717 6001
17718 transition ? 6002// A bit simpler than readable streams.
17719 $active 6003// Implement an async ._write(chunk, cb), and it'll handle all
17720 .one('bsTransitionEnd', next) 6004// the drain event emission and buffering.
17721 .emulateTransitionEnd(150) :
17722 next()
17723 6005
17724 $active.removeClass('in') 6006module.exports = Writable;
17725 }
17726 6007
6008/*<replacement>*/
6009var Buffer = require('buffer').Buffer;
6010/*</replacement>*/
17727 6011
17728 // TAB PLUGIN DEFINITION 6012Writable.WritableState = WritableState;
17729 // =====================
17730 6013
17731 function Plugin(option) {
17732 return this.each(function () {
17733 var $this = $(this)
17734 var data = $this.data('bs.tab')
17735 6014
17736 if (!data) $this.data('bs.tab', (data = new Tab(this))) 6015/*<replacement>*/
17737 if (typeof option == 'string') data[option]() 6016var util = require('core-util-is');
17738 }) 6017util.inherits = require('inherits');
17739 } 6018/*</replacement>*/
17740 6019
17741 var old = $.fn.tab 6020var Stream = require('stream');
17742 6021
17743 $.fn.tab = Plugin 6022util.inherits(Writable, Stream);
17744 $.fn.tab.Constructor = Tab
17745 6023
6024function WriteReq(chunk, encoding, cb) {
6025 this.chunk = chunk;
6026 this.encoding = encoding;
6027 this.callback = cb;
6028}
17746 6029
17747 // TAB NO CONFLICT 6030function WritableState(options, stream) {
17748 // =============== 6031 var Duplex = require('./_stream_duplex');
17749 6032
17750 $.fn.tab.noConflict = function () { 6033 options = options || {};
17751 $.fn.tab = old
17752 return this
17753 }
17754 6034
6035 // the point at which write() starts returning false
6036 // Note: 0 is a valid value, means that we always return false if
6037 // the entire buffer is not flushed immediately on write()
6038 var hwm = options.highWaterMark;
6039 var defaultHwm = options.objectMode ? 16 : 16 * 1024;
6040 this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
17755 6041
17756 // TAB DATA-API 6042 // object stream flag to indicate whether or not this stream
17757 // ============ 6043 // contains buffers or objects.
6044 this.objectMode = !!options.objectMode;
17758 6045
17759 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { 6046 if (stream instanceof Duplex)
17760 e.preventDefault() 6047 this.objectMode = this.objectMode || !!options.writableObjectMode;
17761 Plugin.call($(this), 'show')
17762 })
17763 6048
17764}(jQuery); 6049 // cast to ints.
6050 this.highWaterMark = ~~this.highWaterMark;
17765 6051
17766/* ======================================================================== 6052 this.needDrain = false;
17767 * Bootstrap: affix.js v3.2.0 6053 // at the start of calling end()
17768 * http://getbootstrap.com/javascript/#affix 6054 this.ending = false;
17769 * ======================================================================== 6055 // when end() has been called, and returned
17770 * Copyright 2011-2014 Twitter, Inc. 6056 this.ended = false;
17771 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6057 // when 'finish' is emitted
17772 * ======================================================================== */ 6058 this.finished = false;
17773 6059
6060 // should we decode strings into buffers before passing to _write?
6061 // this is here so that some node-core streams can optimize string
6062 // handling at a lower level.
6063 var noDecode = options.decodeStrings === false;
6064 this.decodeStrings = !noDecode;
17774 6065
17775+function ($) { 6066 // Crypto is kind of old and crusty. Historically, its default string
17776 'use strict'; 6067 // encoding is 'binary' so we have to make this configurable.
6068 // Everything else in the universe uses 'utf8', though.
6069 this.defaultEncoding = options.defaultEncoding || 'utf8';
17777 6070
17778 // AFFIX CLASS DEFINITION 6071 // not an actual buffer we keep track of, but a measurement
17779 // ====================== 6072 // of how much we're waiting to get pushed to some underlying
6073 // socket or file.
6074 this.length = 0;
17780 6075
17781 var Affix = function (element, options) { 6076 // a flag to see when we're in the middle of a write.
17782 this.options = $.extend({}, Affix.DEFAULTS, options) 6077 this.writing = false;
17783 6078
17784 this.$target = $(this.options.target) 6079 // when true all writes will be buffered until .uncork() call
17785 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 6080 this.corked = 0;
17786 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
17787 6081
17788 this.$element = $(element) 6082 // a flag to be able to tell if the onwrite cb is called immediately,
17789 this.affixed = 6083 // or on a later tick. We set this to true at first, because any
17790 this.unpin = 6084 // actions that shouldn't happen until "later" should generally also
17791 this.pinnedOffset = null 6085 // not happen before the first write call.
6086 this.sync = true;
17792 6087
17793 this.checkPosition() 6088 // a flag to know if we're processing previously buffered items, which
17794 } 6089 // may call the _write() callback in the same tick, so that we don't
6090 // end up in an overlapped onwrite situation.
6091 this.bufferProcessing = false;
17795 6092
17796 Affix.VERSION = '3.2.0' 6093 // the callback that's passed to _write(chunk,cb)
6094 this.onwrite = function(er) {
6095 onwrite(stream, er);
6096 };
17797 6097
17798 Affix.RESET = 'affix affix-top affix-bottom' 6098 // the callback that the user supplies to write(chunk,encoding,cb)
6099 this.writecb = null;
17799 6100
17800 Affix.DEFAULTS = { 6101 // the amount that is being written when _write is called.
17801 offset: 0, 6102 this.writelen = 0;
17802 target: window
17803 }
17804 6103
17805 Affix.prototype.getPinnedOffset = function () { 6104 this.buffer = [];
17806 if (this.pinnedOffset) return this.pinnedOffset
17807 this.$element.removeClass(Affix.RESET).addClass('affix')
17808 var scrollTop = this.$target.scrollTop()
17809 var position = this.$element.offset()
17810 return (this.pinnedOffset = position.top - scrollTop)
17811 }
17812 6105
17813 Affix.prototype.checkPositionWithEventLoop = function () { 6106 // number of pending user-supplied write callbacks
17814 setTimeout($.proxy(this.checkPosition, this), 1) 6107 // this must be 0 before 'finish' can be emitted
17815 } 6108 this.pendingcb = 0;
17816 6109
17817 Affix.prototype.checkPosition = function () { 6110 // emit prefinish if the only thing we're waiting for is _write cbs
17818 if (!this.$element.is(':visible')) return 6111 // This is relevant for synchronous Transform streams
6112 this.prefinished = false;
17819 6113
17820 var scrollHeight = $(document).height() 6114 // True if the error was already emitted and should not be thrown again
17821 var scrollTop = this.$target.scrollTop() 6115 this.errorEmitted = false;
17822 var position = this.$element.offset() 6116}
17823 var offset = this.options.offset
17824 var offsetTop = offset.top
17825 var offsetBottom = offset.bottom
17826 6117
17827 if (typeof offset != 'object') offsetBottom = offsetTop = offset 6118function Writable(options) {
17828 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) 6119 var Duplex = require('./_stream_duplex');
17829 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
17830 6120
17831 var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : 6121 // Writable ctor is applied to Duplexes, though they're not
17832 offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : 6122 // instanceof Writable, they're instanceof Readable.
17833 offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false 6123 if (!(this instanceof Writable) && !(this instanceof Duplex))
6124 return new Writable(options);
17834 6125
17835 if (this.affixed === affix) return 6126 this._writableState = new WritableState(options, this);
17836 if (this.unpin != null) this.$element.css('top', '')
17837 6127
17838 var affixType = 'affix' + (affix ? '-' + affix : '') 6128 // legacy.
17839 var e = $.Event(affixType + '.bs.affix') 6129 this.writable = true;
17840 6130
17841 this.$element.trigger(e) 6131 Stream.call(this);
6132}
17842 6133
17843 if (e.isDefaultPrevented()) return 6134// Otherwise people can pipe Writable streams, which is just wrong.
6135Writable.prototype.pipe = function() {
6136 this.emit('error', new Error('Cannot pipe. Not readable.'));
6137};
17844 6138
17845 this.affixed = affix
17846 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
17847 6139
17848 this.$element 6140function writeAfterEnd(stream, state, cb) {
17849 .removeClass(Affix.RESET) 6141 var er = new Error('write after end');
17850 .addClass(affixType) 6142 // TODO: defer error events consistently everywhere, not just the cb
17851 .trigger($.Event(affixType.replace('affix', 'affixed'))) 6143 stream.emit('error', er);
6144 process.nextTick(function() {
6145 cb(er);
6146 });
6147}
17852 6148
17853 if (affix == 'bottom') { 6149// If we get something that is not a buffer, string, null, or undefined,
17854 this.$element.offset({ 6150// and we're not in objectMode, then that's an error.
17855 top: scrollHeight - this.$element.height() - offsetBottom 6151// Otherwise stream chunks are all considered to be of length=1, and the
17856 }) 6152// watermarks determine how many objects to keep in the buffer, rather than
17857 } 6153// how many bytes or characters.
6154function validChunk(stream, state, chunk, cb) {
6155 var valid = true;
6156 if (!util.isBuffer(chunk) &&
6157 !util.isString(chunk) &&
6158 !util.isNullOrUndefined(chunk) &&
6159 !state.objectMode) {
6160 var er = new TypeError('Invalid non-string/buffer chunk');
6161 stream.emit('error', er);
6162 process.nextTick(function() {
6163 cb(er);
6164 });
6165 valid = false;
17858 } 6166 }
6167 return valid;
6168}
17859 6169
6170Writable.prototype.write = function(chunk, encoding, cb) {
6171 var state = this._writableState;
6172 var ret = false;
17860 6173
17861 // AFFIX PLUGIN DEFINITION 6174 if (util.isFunction(encoding)) {
17862 // ======================= 6175 cb = encoding;
17863 6176 encoding = null;
17864 function Plugin(option) {
17865 return this.each(function () {
17866 var $this = $(this)
17867 var data = $this.data('bs.affix')
17868 var options = typeof option == 'object' && option
17869
17870 if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
17871 if (typeof option == 'string') data[option]()
17872 })
17873 } 6177 }
17874 6178
17875 var old = $.fn.affix 6179 if (util.isBuffer(chunk))
17876 6180 encoding = 'buffer';
17877 $.fn.affix = Plugin 6181 else if (!encoding)
17878 $.fn.affix.Constructor = Affix 6182 encoding = state.defaultEncoding;
17879
17880 6183
17881 // AFFIX NO CONFLICT 6184 if (!util.isFunction(cb))
17882 // ================= 6185 cb = function() {};
17883 6186
17884 $.fn.affix.noConflict = function () { 6187 if (state.ended)
17885 $.fn.affix = old 6188 writeAfterEnd(this, state, cb);
17886 return this 6189 else if (validChunk(this, state, chunk, cb)) {
6190 state.pendingcb++;
6191 ret = writeOrBuffer(this, state, chunk, encoding, cb);
17887 } 6192 }
17888 6193
6194 return ret;
6195};
17889 6196
17890 // AFFIX DATA-API 6197Writable.prototype.cork = function() {
17891 // ============== 6198 var state = this._writableState;
17892
17893 $(window).on('load', function () {
17894 $('[data-spy="affix"]').each(function () {
17895 var $spy = $(this)
17896 var data = $spy.data()
17897
17898 data.offset = data.offset || {}
17899
17900 if (data.offsetBottom) data.offset.bottom = data.offsetBottom
17901 if (data.offsetTop) data.offset.top = data.offsetTop
17902
17903 Plugin.call($spy, data)
17904 })
17905 })
17906 6199
17907}(jQuery); 6200 state.corked++;
17908</script> 6201};
17909<script>
17910(function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Bitcoin=e()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
17911var assert = _dereq_('assert')
17912 6202
17913module.exports = BigInteger 6203Writable.prototype.uncork = function() {
6204 var state = this._writableState;
17914 6205
17915// JavaScript engine analysis 6206 if (state.corked) {
17916var canary = 0xdeadbeefcafe; 6207 state.corked--;
17917var j_lm = ((canary&0xffffff)==0xefcafe);
17918 6208
17919// (public) Constructor 6209 if (!state.writing &&
17920function BigInteger(a,b,c) { 6210 !state.corked &&
17921 if (!(this instanceof BigInteger)) { 6211 !state.finished &&
17922 return new BigInteger(a, b, c); 6212 !state.bufferProcessing &&
6213 state.buffer.length)
6214 clearBuffer(this, state);
17923 } 6215 }
6216};
17924 6217
17925 if(a != null) { 6218function decodeChunk(state, chunk, encoding) {
17926 if("number" == typeof a) this.fromNumber(a,b,c); 6219 if (!state.objectMode &&
17927 else if(b == null && "string" != typeof a) this.fromString(a,256); 6220 state.decodeStrings !== false &&
17928 else this.fromString(a,b); 6221 util.isString(chunk)) {
17929 } 6222 chunk = new Buffer(chunk, encoding);
17930}
17931
17932var proto = BigInteger.prototype;
17933
17934// return new, unset BigInteger
17935function nbi() { return new BigInteger(null); }
17936
17937// Bits per digit
17938var dbits;
17939
17940// am: Compute w_j += (x*this_i), propagate carries,
17941// c is initial carry, returns final carry.
17942// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
17943// We need to select the fastest one that works in this environment.
17944
17945// am1: use a single mult and divide to get the high bits,
17946// max digit bits should be 26 because
17947// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
17948function am1(i,x,w,j,c,n) {
17949 while(--n >= 0) {
17950 var v = x*this[i++]+w[j]+c;
17951 c = Math.floor(v/0x4000000);
17952 w[j++] = v&0x3ffffff;
17953 } 6223 }
17954 return c; 6224 return chunk;
17955}
17956// am2 avoids a big mult-and-extract completely.
17957// Max digit bits should be <= 30 because we do bitwise ops
17958// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
17959function am2(i,x,w,j,c,n) {
17960 var xl = x&0x7fff, xh = x>>15;
17961 while(--n >= 0) {
17962 var l = this[i]&0x7fff;
17963 var h = this[i++]>>15;
17964 var m = xh*l+h*xl;
17965 l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff);
17966 c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
17967 w[j++] = l&0x3fffffff;
17968 }
17969 return c;
17970}
17971// Alternately, set max digit bits to 28 since some
17972// browsers slow down when dealing with 32-bit numbers.
17973function am3(i,x,w,j,c,n) {
17974 var xl = x&0x3fff, xh = x>>14;
17975 while(--n >= 0) {
17976 var l = this[i]&0x3fff;
17977 var h = this[i++]>>14;
17978 var m = xh*l+h*xl;
17979 l = xl*l+((m&0x3fff)<<14)+w[j]+c;
17980 c = (l>>28)+(m>>14)+xh*h;
17981 w[j++] = l&0xfffffff;
17982 }
17983 return c;
17984}
17985
17986// wtf?
17987BigInteger.prototype.am = am1;
17988dbits = 26;
17989
17990/*
17991if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
17992 BigInteger.prototype.am = am2;
17993 dbits = 30;
17994} 6225}
17995else if(j_lm && (navigator.appName != "Netscape")) {
17996 BigInteger.prototype.am = am1;
17997 dbits = 26;
17998}
17999else { // Mozilla/Netscape seems to prefer am3
18000 BigInteger.prototype.am = am3;
18001 dbits = 28;
18002}
18003*/
18004
18005BigInteger.prototype.DB = dbits;
18006BigInteger.prototype.DM = ((1<<dbits)-1);
18007var DV = BigInteger.prototype.DV = (1<<dbits);
18008 6226
18009var BI_FP = 52; 6227// if we're already writing something, then just put this
18010BigInteger.prototype.FV = Math.pow(2,BI_FP); 6228// in the queue, and wait our turn. Otherwise, call _write
18011BigInteger.prototype.F1 = BI_FP-dbits; 6229// If we return false, then we need a drain event, so set that flag.
18012BigInteger.prototype.F2 = 2*dbits-BI_FP; 6230function writeOrBuffer(stream, state, chunk, encoding, cb) {
6231 chunk = decodeChunk(state, chunk, encoding);
6232 if (util.isBuffer(chunk))
6233 encoding = 'buffer';
6234 var len = state.objectMode ? 1 : chunk.length;
18013 6235
18014// Digit conversions 6236 state.length += len;
18015var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
18016var BI_RC = new Array();
18017var rr,vv;
18018rr = "0".charCodeAt(0);
18019for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
18020rr = "a".charCodeAt(0);
18021for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
18022rr = "A".charCodeAt(0);
18023for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
18024
18025function int2char(n) { return BI_RM.charAt(n); }
18026function intAt(s,i) {
18027 var c = BI_RC[s.charCodeAt(i)];
18028 return (c==null)?-1:c;
18029}
18030 6237
18031// (protected) copy this to r 6238 var ret = state.length < state.highWaterMark;
18032function bnpCopyTo(r) { 6239 // we must ensure that previous needDrain will not be reset to false.
18033 for(var i = this.t-1; i >= 0; --i) r[i] = this[i]; 6240 if (!ret)
18034 r.t = this.t; 6241 state.needDrain = true;
18035 r.s = this.s;
18036}
18037
18038// (protected) set from integer value x, -DV <= x < DV
18039function bnpFromInt(x) {
18040 this.t = 1;
18041 this.s = (x<0)?-1:0;
18042 if(x > 0) this[0] = x;
18043 else if(x < -1) this[0] = x+DV;
18044 else this.t = 0;
18045}
18046
18047// return bigint initialized to value
18048function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
18049 6242
18050// (protected) set from string and radix 6243 if (state.writing || state.corked)
18051function bnpFromString(s,b) { 6244 state.buffer.push(new WriteReq(chunk, encoding, cb));
18052 var self = this; 6245 else
6246 doWrite(stream, state, false, len, chunk, encoding, cb);
18053 6247
18054 var k; 6248 return ret;
18055 if(b == 16) k = 4;
18056 else if(b == 8) k = 3;
18057 else if(b == 256) k = 8; // byte array
18058 else if(b == 2) k = 1;
18059 else if(b == 32) k = 5;
18060 else if(b == 4) k = 2;
18061 else { self.fromRadix(s,b); return; }
18062 self.t = 0;
18063 self.s = 0;
18064 var i = s.length, mi = false, sh = 0;
18065 while(--i >= 0) {
18066 var x = (k==8)?s[i]&0xff:intAt(s,i);
18067 if(x < 0) {
18068 if(s.charAt(i) == "-") mi = true;
18069 continue;
18070 }
18071 mi = false;
18072 if(sh == 0)
18073 self[self.t++] = x;
18074 else if(sh+k > self.DB) {
18075 self[self.t-1] |= (x&((1<<(self.DB-sh))-1))<<sh;
18076 self[self.t++] = (x>>(self.DB-sh));
18077 }
18078 else
18079 self[self.t-1] |= x<<sh;
18080 sh += k;
18081 if(sh >= self.DB) sh -= self.DB;
18082 }
18083 if(k == 8 && (s[0]&0x80) != 0) {
18084 self.s = -1;
18085 if(sh > 0) self[self.t-1] |= ((1<<(self.DB-sh))-1)<<sh;
18086 }
18087 self.clamp();
18088 if(mi) BigInteger.ZERO.subTo(self,self);
18089} 6249}
18090 6250
18091// (protected) clamp off excess high words 6251function doWrite(stream, state, writev, len, chunk, encoding, cb) {
18092function bnpClamp() { 6252 state.writelen = len;
18093 var c = this.s&this.DM; 6253 state.writecb = cb;
18094 while(this.t > 0 && this[this.t-1] == c) --this.t; 6254 state.writing = true;
6255 state.sync = true;
6256 if (writev)
6257 stream._writev(chunk, state.onwrite);
6258 else
6259 stream._write(chunk, encoding, state.onwrite);
6260 state.sync = false;
18095} 6261}
18096 6262
18097// (public) return string representation in given radix 6263function onwriteError(stream, state, sync, er, cb) {
18098function bnToString(b) { 6264 if (sync)
18099 var self = this; 6265 process.nextTick(function() {
18100 if(self.s < 0) return "-"+self.negate().toString(b); 6266 state.pendingcb--;
18101 var k; 6267 cb(er);
18102 if(b == 16) k = 4; 6268 });
18103 else if(b == 8) k = 3; 6269 else {
18104 else if(b == 2) k = 1; 6270 state.pendingcb--;
18105 else if(b == 32) k = 5; 6271 cb(er);
18106 else if(b == 4) k = 2;
18107 else return self.toRadix(b);
18108 var km = (1<<k)-1, d, m = false, r = "", i = self.t;
18109 var p = self.DB-(i*self.DB)%k;
18110 if(i-- > 0) {
18111 if(p < self.DB && (d = self[i]>>p) > 0) { m = true; r = int2char(d); }
18112 while(i >= 0) {
18113 if(p < k) {
18114 d = (self[i]&((1<<p)-1))<<(k-p);
18115 d |= self[--i]>>(p+=self.DB-k);
18116 }
18117 else {
18118 d = (self[i]>>(p-=k))&km;
18119 if(p <= 0) { p += self.DB; --i; }
18120 }
18121 if(d > 0) m = true;
18122 if(m) r += int2char(d);
18123 }
18124 } 6272 }
18125 return m?r:"0";
18126}
18127
18128// (public) -this
18129function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
18130
18131// (public) |this|
18132function bnAbs() { return (this.s<0)?this.negate():this; }
18133
18134// (public) return + if this > a, - if this < a, 0 if equal
18135function bnCompareTo(a) {
18136 var r = this.s-a.s;
18137 if(r != 0) return r;
18138 var i = this.t;
18139 r = i-a.t;
18140 if(r != 0) return (this.s<0)?-r:r;
18141 while(--i >= 0) if((r=this[i]-a[i]) != 0) return r;
18142 return 0;
18143}
18144
18145// returns bit length of the integer x
18146function nbits(x) {
18147 var r = 1, t;
18148 if((t=x>>>16) != 0) { x = t; r += 16; }
18149 if((t=x>>8) != 0) { x = t; r += 8; }
18150 if((t=x>>4) != 0) { x = t; r += 4; }
18151 if((t=x>>2) != 0) { x = t; r += 2; }
18152 if((t=x>>1) != 0) { x = t; r += 1; }
18153 return r;
18154}
18155 6273
18156// (public) return the number of bits in "this" 6274 stream._writableState.errorEmitted = true;
18157function bnBitLength() { 6275 stream.emit('error', er);
18158 if(this.t <= 0) return 0;
18159 return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM));
18160} 6276}
18161 6277
18162// (protected) r = this << n*DB 6278function onwriteStateUpdate(state) {
18163function bnpDLShiftTo(n,r) { 6279 state.writing = false;
18164 var i; 6280 state.writecb = null;
18165 for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; 6281 state.length -= state.writelen;
18166 for(i = n-1; i >= 0; --i) r[i] = 0; 6282 state.writelen = 0;
18167 r.t = this.t+n;
18168 r.s = this.s;
18169} 6283}
18170 6284
18171// (protected) r = this >> n*DB 6285function onwrite(stream, er) {
18172function bnpDRShiftTo(n,r) { 6286 var state = stream._writableState;
18173 for(var i = n; i < this.t; ++i) r[i-n] = this[i]; 6287 var sync = state.sync;
18174 r.t = Math.max(this.t-n,0); 6288 var cb = state.writecb;
18175 r.s = this.s;
18176}
18177
18178// (protected) r = this << n
18179function bnpLShiftTo(n,r) {
18180 var self = this;
18181 var bs = n%self.DB;
18182 var cbs = self.DB-bs;
18183 var bm = (1<<cbs)-1;
18184 var ds = Math.floor(n/self.DB), c = (self.s<<bs)&self.DM, i;
18185 for(i = self.t-1; i >= 0; --i) {
18186 r[i+ds+1] = (self[i]>>cbs)|c;
18187 c = (self[i]&bm)<<bs;
18188 }
18189 for(i = ds-1; i >= 0; --i) r[i] = 0;
18190 r[ds] = c;
18191 r.t = self.t+ds+1;
18192 r.s = self.s;
18193 r.clamp();
18194}
18195 6289
18196// (protected) r = this >> n 6290 onwriteStateUpdate(state);
18197function bnpRShiftTo(n,r) {
18198 var self = this;
18199 r.s = self.s;
18200 var ds = Math.floor(n/self.DB);
18201 if(ds >= self.t) { r.t = 0; return; }
18202 var bs = n%self.DB;
18203 var cbs = self.DB-bs;
18204 var bm = (1<<bs)-1;
18205 r[0] = self[ds]>>bs;
18206 for(var i = ds+1; i < self.t; ++i) {
18207 r[i-ds-1] |= (self[i]&bm)<<cbs;
18208 r[i-ds] = self[i]>>bs;
18209 }
18210 if(bs > 0) r[self.t-ds-1] |= (self.s&bm)<<cbs;
18211 r.t = self.t-ds;
18212 r.clamp();
18213}
18214 6291
18215// (protected) r = this - a 6292 if (er)
18216function bnpSubTo(a,r) { 6293 onwriteError(stream, state, sync, er, cb);
18217 var self = this;
18218 var i = 0, c = 0, m = Math.min(a.t,self.t);
18219 while(i < m) {
18220 c += self[i]-a[i];
18221 r[i++] = c&self.DM;
18222 c >>= self.DB;
18223 }
18224 if(a.t < self.t) {
18225 c -= a.s;
18226 while(i < self.t) {
18227 c += self[i];
18228 r[i++] = c&self.DM;
18229 c >>= self.DB;
18230 }
18231 c += self.s;
18232 }
18233 else { 6294 else {
18234 c += self.s; 6295 // Check if we're actually ready to finish, but don't emit yet
18235 while(i < a.t) { 6296 var finished = needFinish(stream, state);
18236 c -= a[i];
18237 r[i++] = c&self.DM;
18238 c >>= self.DB;
18239 }
18240 c -= a.s;
18241 }
18242 r.s = (c<0)?-1:0;
18243 if(c < -1) r[i++] = self.DV+c;
18244 else if(c > 0) r[i++] = c;
18245 r.t = i;
18246 r.clamp();
18247}
18248 6297
18249// (protected) r = this * a, r != this,a (HAC 14.12) 6298 if (!finished &&
18250// "this" should be the larger one if appropriate. 6299 !state.corked &&
18251function bnpMultiplyTo(a,r) { 6300 !state.bufferProcessing &&
18252 var x = this.abs(), y = a.abs(); 6301 state.buffer.length) {
18253 var i = x.t; 6302 clearBuffer(stream, state);
18254 r.t = i+y.t;
18255 while(--i >= 0) r[i] = 0;
18256 for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t);
18257 r.s = 0;
18258 r.clamp();
18259 if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
18260}
18261
18262// (protected) r = this^2, r != this (HAC 14.16)
18263function bnpSquareTo(r) {
18264 var x = this.abs();
18265 var i = r.t = 2*x.t;
18266 while(--i >= 0) r[i] = 0;
18267 for(i = 0; i < x.t-1; ++i) {
18268 var c = x.am(i,x[i],r,2*i,0,1);
18269 if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
18270 r[i+x.t] -= x.DV;
18271 r[i+x.t+1] = 1;
18272 } 6303 }
18273 }
18274 if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1);
18275 r.s = 0;
18276 r.clamp();
18277}
18278 6304
18279// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) 6305 if (sync) {
18280// r != q, this != m. q or r may be null. 6306 process.nextTick(function() {
18281function bnpDivRemTo(m,q,r) { 6307 afterWrite(stream, state, finished, cb);
18282 var self = this; 6308 });
18283 var pm = m.abs(); 6309 } else {
18284 if(pm.t <= 0) return; 6310 afterWrite(stream, state, finished, cb);
18285 var pt = self.abs();
18286 if(pt.t < pm.t) {
18287 if(q != null) q.fromInt(0);
18288 if(r != null) self.copyTo(r);
18289 return;
18290 }
18291 if(r == null) r = nbi();
18292 var y = nbi(), ts = self.s, ms = m.s;
18293 var nsh = self.DB-nbits(pm[pm.t-1]); // normalize modulus
18294 if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
18295 else { pm.copyTo(y); pt.copyTo(r); }
18296 var ys = y.t;
18297 var y0 = y[ys-1];
18298 if(y0 == 0) return;
18299 var yt = y0*(1<<self.F1)+((ys>1)?y[ys-2]>>self.F2:0);
18300 var d1 = self.FV/yt, d2 = (1<<self.F1)/yt, e = 1<<self.F2;
18301 var i = r.t, j = i-ys, t = (q==null)?nbi():q;
18302 y.dlShiftTo(j,t);
18303 if(r.compareTo(t) >= 0) {
18304 r[r.t++] = 1;
18305 r.subTo(t,r);
18306 }
18307 BigInteger.ONE.dlShiftTo(ys,t);
18308 t.subTo(y,y); // "negative" y so we can replace sub with am later
18309 while(y.t < ys) y[y.t++] = 0;
18310 while(--j >= 0) {
18311 // Estimate quotient digit
18312 var qd = (r[--i]==y0)?self.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2);
18313 if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
18314 y.dlShiftTo(j,t);
18315 r.subTo(t,r);
18316 while(r[i] < --qd) r.subTo(t,r);
18317 } 6311 }
18318 } 6312 }
18319 if(q != null) {
18320 r.drShiftTo(ys,q);
18321 if(ts != ms) BigInteger.ZERO.subTo(q,q);
18322 }
18323 r.t = ys;
18324 r.clamp();
18325 if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
18326 if(ts < 0) BigInteger.ZERO.subTo(r,r);
18327} 6313}
18328 6314
18329// (public) this mod a 6315function afterWrite(stream, state, finished, cb) {
18330function bnMod(a) { 6316 if (!finished)
18331 var r = nbi(); 6317 onwriteDrain(stream, state);
18332 this.abs().divRemTo(a,null,r); 6318 state.pendingcb--;
18333 if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); 6319 cb();
18334 return r; 6320 finishMaybe(stream, state);
18335} 6321}
18336 6322
18337// Modular reduction using "classic" algorithm 6323// Must force callback to be called on nextTick, so that we don't
18338function Classic(m) { this.m = m; } 6324// emit 'drain' before the write() consumer gets the 'false' return
18339function cConvert(x) { 6325// value, and has a chance to attach a 'drain' listener.
18340 if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); 6326function onwriteDrain(stream, state) {
18341 else return x; 6327 if (state.length === 0 && state.needDrain) {
6328 state.needDrain = false;
6329 stream.emit('drain');
6330 }
18342} 6331}
18343function cRevert(x) { return x; }
18344function cReduce(x) { x.divRemTo(this.m,null,x); }
18345function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
18346function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
18347 6332
18348Classic.prototype.convert = cConvert;
18349Classic.prototype.revert = cRevert;
18350Classic.prototype.reduce = cReduce;
18351Classic.prototype.mulTo = cMulTo;
18352Classic.prototype.sqrTo = cSqrTo;
18353 6333
18354// (protected) return "-1/this % 2^DB"; useful for Mont. reduction 6334// if there's something in the buffer waiting, then process it
18355// justification: 6335function clearBuffer(stream, state) {
18356// xy == 1 (mod m) 6336 state.bufferProcessing = true;
18357// xy = 1+km
18358// xy(2-xy) = (1+km)(1-km)
18359// x[y(2-xy)] = 1-k^2m^2
18360// x[y(2-xy)] == 1 (mod m^2)
18361// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
18362// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
18363// JS multiply "overflows" differently from C/C++, so care is needed here.
18364function bnpInvDigit() {
18365 if(this.t < 1) return 0;
18366 var x = this[0];
18367 if((x&1) == 0) return 0;
18368 var y = x&3; // y == 1/x mod 2^2
18369 y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
18370 y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
18371 y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
18372 // last step - calculate inverse mod DV directly;
18373 // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
18374 y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
18375 // we really want the negative inverse, and -DV < y < DV
18376 return (y>0)?this.DV-y:-y;
18377}
18378 6337
18379// Montgomery reduction 6338 if (stream._writev && state.buffer.length > 1) {
18380function Montgomery(m) { 6339 // Fast case, write everything using _writev()
18381 this.m = m; 6340 var cbs = [];
18382 this.mp = m.invDigit(); 6341 for (var c = 0; c < state.buffer.length; c++)
18383 this.mpl = this.mp&0x7fff; 6342 cbs.push(state.buffer[c].callback);
18384 this.mph = this.mp>>15;
18385 this.um = (1<<(m.DB-15))-1;
18386 this.mt2 = 2*m.t;
18387}
18388 6343
18389// xR mod m 6344 // count the one we are adding, as well.
18390function montConvert(x) { 6345 // TODO(isaacs) clean this up
18391 var r = nbi(); 6346 state.pendingcb++;
18392 x.abs().dlShiftTo(this.m.t,r); 6347 doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
18393 r.divRemTo(this.m,null,r); 6348 for (var i = 0; i < cbs.length; i++) {
18394 if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); 6349 state.pendingcb--;
18395 return r; 6350 cbs[i](err);
18396} 6351 }
6352 });
18397 6353
18398// x/R mod m 6354 // Clear buffer
18399function montRevert(x) { 6355 state.buffer = [];
18400 var r = nbi(); 6356 } else {
18401 x.copyTo(r); 6357 // Slow case, write chunks one-by-one
18402 this.reduce(r); 6358 for (var c = 0; c < state.buffer.length; c++) {
18403 return r; 6359 var entry = state.buffer[c];
18404} 6360 var chunk = entry.chunk;
6361 var encoding = entry.encoding;
6362 var cb = entry.callback;
6363 var len = state.objectMode ? 1 : chunk.length;
6364
6365 doWrite(stream, state, false, len, chunk, encoding, cb);
6366
6367 // if we didn't call the onwrite immediately, then
6368 // it means that we need to wait until it does.
6369 // also, that means that the chunk and cb are currently
6370 // being processed, so move the buffer counter past them.
6371 if (state.writing) {
6372 c++;
6373 break;
6374 }
6375 }
18405 6376
18406// x = x/R mod m (HAC 14.32) 6377 if (c < state.buffer.length)
18407function montReduce(x) { 6378 state.buffer = state.buffer.slice(c);
18408 while(x.t <= this.mt2) // pad x so am has enough room later 6379 else
18409 x[x.t++] = 0; 6380 state.buffer.length = 0;
18410 for(var i = 0; i < this.m.t; ++i) {
18411 // faster way of calculating u0 = x[i]*mp mod DV
18412 var j = x[i]&0x7fff;
18413 var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
18414 // use am to combine the multiply-shift-add into one call
18415 j = i+this.m.t;
18416 x[j] += this.m.am(0,u0,x,i,0,this.m.t);
18417 // propagate carry
18418 while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; }
18419 } 6381 }
18420 x.clamp();
18421 x.drShiftTo(this.m.t,x);
18422 if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
18423}
18424 6382
18425// r = "x^2/R mod m"; x != r 6383 state.bufferProcessing = false;
18426function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
18427
18428// r = "xy/R mod m"; x,y != r
18429function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
18430
18431Montgomery.prototype.convert = montConvert;
18432Montgomery.prototype.revert = montRevert;
18433Montgomery.prototype.reduce = montReduce;
18434Montgomery.prototype.mulTo = montMulTo;
18435Montgomery.prototype.sqrTo = montSqrTo;
18436
18437// (protected) true iff this is even
18438function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
18439
18440// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
18441function bnpExp(e,z) {
18442 if(e > 0xffffffff || e < 1) return BigInteger.ONE;
18443 var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
18444 g.copyTo(r);
18445 while(--i >= 0) {
18446 z.sqrTo(r,r2);
18447 if((e&(1<<i)) > 0) z.mulTo(r2,g,r);
18448 else { var t = r; r = r2; r2 = t; }
18449 }
18450 return z.revert(r);
18451} 6384}
18452 6385
18453// (public) this^e % m, 0 <= e < 2^32 6386Writable.prototype._write = function(chunk, encoding, cb) {
18454function bnModPowInt(e,m) { 6387 cb(new Error('not implemented'));
18455 var z;
18456 if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
18457 return this.exp(e,z);
18458}
18459 6388
18460// protected 6389};
18461proto.copyTo = bnpCopyTo;
18462proto.fromInt = bnpFromInt;
18463proto.fromString = bnpFromString;
18464proto.clamp = bnpClamp;
18465proto.dlShiftTo = bnpDLShiftTo;
18466proto.drShiftTo = bnpDRShiftTo;
18467proto.lShiftTo = bnpLShiftTo;
18468proto.rShiftTo = bnpRShiftTo;
18469proto.subTo = bnpSubTo;
18470proto.multiplyTo = bnpMultiplyTo;
18471proto.squareTo = bnpSquareTo;
18472proto.divRemTo = bnpDivRemTo;
18473proto.invDigit = bnpInvDigit;
18474proto.isEven = bnpIsEven;
18475proto.exp = bnpExp;
18476 6390
18477// public 6391Writable.prototype._writev = null;
18478proto.toString = bnToString;
18479proto.negate = bnNegate;
18480proto.abs = bnAbs;
18481proto.compareTo = bnCompareTo;
18482proto.bitLength = bnBitLength;
18483proto.mod = bnMod;
18484proto.modPowInt = bnModPowInt;
18485 6392
18486//// jsbn2 6393Writable.prototype.end = function(chunk, encoding, cb) {
6394 var state = this._writableState;
18487 6395
18488function nbi() { return new BigInteger(null); } 6396 if (util.isFunction(chunk)) {
6397 cb = chunk;
6398 chunk = null;
6399 encoding = null;
6400 } else if (util.isFunction(encoding)) {
6401 cb = encoding;
6402 encoding = null;
6403 }
18489 6404
18490// (public) 6405 if (!util.isNullOrUndefined(chunk))
18491function bnClone() { var r = nbi(); this.copyTo(r); return r; } 6406 this.write(chunk, encoding);
18492 6407
18493// (public) return value as integer 6408 // .end() fully uncorks
18494function bnIntValue() { 6409 if (state.corked) {
18495 if(this.s < 0) { 6410 state.corked = 1;
18496 if(this.t == 1) return this[0]-this.DV; 6411 this.uncork();
18497 else if(this.t == 0) return -1;
18498 } 6412 }
18499 else if(this.t == 1) return this[0];
18500 else if(this.t == 0) return 0;
18501 // assumes 16 < DB < 32
18502 return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0];
18503}
18504 6413
18505// (public) return value as byte 6414 // ignore unnecessary end() calls.
18506function bnByteValue() { return (this.t==0)?this.s:(this[0]<<24)>>24; } 6415 if (!state.ending && !state.finished)
18507 6416 endWritable(this, state, cb);
18508// (public) return value as short (assumes DB>=16) 6417};
18509function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; }
18510 6418
18511// (protected) return x s.t. r^x < DV
18512function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
18513 6419
18514// (public) 0 if this == 0, 1 if this > 0 6420function needFinish(stream, state) {
18515function bnSigNum() { 6421 return (state.ending &&
18516 if(this.s < 0) return -1; 6422 state.length === 0 &&
18517 else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; 6423 !state.finished &&
18518 else return 1; 6424 !state.writing);
18519} 6425}
18520 6426
18521// (protected) convert to radix string 6427function prefinish(stream, state) {
18522function bnpToRadix(b) { 6428 if (!state.prefinished) {
18523 if(b == null) b = 10; 6429 state.prefinished = true;
18524 if(this.signum() == 0 || b < 2 || b > 36) return "0"; 6430 stream.emit('prefinish');
18525 var cs = this.chunkSize(b);
18526 var a = Math.pow(b,cs);
18527 var d = nbv(a), y = nbi(), z = nbi(), r = "";
18528 this.divRemTo(d,y,z);
18529 while(y.signum() > 0) {
18530 r = (a+z.intValue()).toString(b).substr(1) + r;
18531 y.divRemTo(d,y,z);
18532 } 6431 }
18533 return z.intValue().toString(b) + r;
18534} 6432}
18535 6433
18536// (protected) convert from radix string 6434function finishMaybe(stream, state) {
18537function bnpFromRadix(s,b) { 6435 var need = needFinish(stream, state);
18538 var self = this; 6436 if (need) {
18539 self.fromInt(0); 6437 if (state.pendingcb === 0) {
18540 if(b == null) b = 10; 6438 prefinish(stream, state);
18541 var cs = self.chunkSize(b); 6439 state.finished = true;
18542 var d = Math.pow(b,cs), mi = false, j = 0, w = 0; 6440 stream.emit('finish');
18543 for(var i = 0; i < s.length; ++i) { 6441 } else
18544 var x = intAt(s,i); 6442 prefinish(stream, state);
18545 if(x < 0) {
18546 if(s.charAt(i) == "-" && self.signum() == 0) mi = true;
18547 continue;
18548 }
18549 w = b*w+x;
18550 if(++j >= cs) {
18551 self.dMultiply(d);
18552 self.dAddOffset(w,0);
18553 j = 0;
18554 w = 0;
18555 }
18556 }
18557 if(j > 0) {
18558 self.dMultiply(Math.pow(b,j));
18559 self.dAddOffset(w,0);
18560 }
18561 if(mi) BigInteger.ZERO.subTo(self,self);
18562}
18563
18564// (protected) alternate constructor
18565function bnpFromNumber(a,b,c) {
18566 var self = this;
18567 if("number" == typeof b) {
18568 // new BigInteger(int,int,RNG)
18569 if(a < 2) self.fromInt(1);
18570 else {
18571 self.fromNumber(a,c);
18572 if(!self.testBit(a-1)) // force MSB set
18573 self.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,self);
18574 if(self.isEven()) self.dAddOffset(1,0); // force odd
18575 while(!self.isProbablePrime(b)) {
18576 self.dAddOffset(2,0);
18577 if(self.bitLength() > a) self.subTo(BigInteger.ONE.shiftLeft(a-1),self);
18578 }
18579 }
18580 }
18581 else {
18582 // new BigInteger(int,RNG)
18583 var x = new Array(), t = a&7;
18584 x.length = (a>>3)+1;
18585 b.nextBytes(x);
18586 if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0;
18587 self.fromString(x,256);
18588 } 6443 }
6444 return need;
18589} 6445}
18590 6446
18591// (public) convert to bigendian byte array 6447function endWritable(stream, state, cb) {
18592function bnToByteArray() { 6448 state.ending = true;
18593 var self = this; 6449 finishMaybe(stream, state);
18594 var i = self.t, r = new Array(); 6450 if (cb) {
18595 r[0] = self.s; 6451 if (state.finished)
18596 var p = self.DB-(i*self.DB)%8, d, k = 0; 6452 process.nextTick(cb);
18597 if(i-- > 0) { 6453 else
18598 if(p < self.DB && (d = self[i]>>p) != (self.s&self.DM)>>p) 6454 stream.once('finish', cb);
18599 r[k++] = d|(self.s<<(self.DB-p));
18600 while(i >= 0) {
18601 if(p < 8) {
18602 d = (self[i]&((1<<p)-1))<<(8-p);
18603 d |= self[--i]>>(p+=self.DB-8);
18604 }
18605 else {
18606 d = (self[i]>>(p-=8))&0xff;
18607 if(p <= 0) { p += self.DB; --i; }
18608 }
18609 if((d&0x80) != 0) d |= -256;
18610 if(k === 0 && (self.s&0x80) != (d&0x80)) ++k;
18611 if(k > 0 || d != self.s) r[k++] = d;
18612 }
18613 } 6455 }
18614 return r; 6456 state.ended = true;
18615} 6457}
18616 6458
18617function bnEquals(a) { return(this.compareTo(a)==0); } 6459}).call(this,require('_process'))
18618function bnMin(a) { return(this.compareTo(a)<0)?this:a; } 6460},{"./_stream_duplex":16,"_process":14,"buffer":7,"core-util-is":21,"inherits":12,"stream":26}],21:[function(require,module,exports){
18619function bnMax(a) { return(this.compareTo(a)>0)?this:a; } 6461(function (Buffer){
6462// Copyright Joyent, Inc. and other Node contributors.
6463//
6464// Permission is hereby granted, free of charge, to any person obtaining a
6465// copy of this software and associated documentation files (the
6466// "Software"), to deal in the Software without restriction, including
6467// without limitation the rights to use, copy, modify, merge, publish,
6468// distribute, sublicense, and/or sell copies of the Software, and to permit
6469// persons to whom the Software is furnished to do so, subject to the
6470// following conditions:
6471//
6472// The above copyright notice and this permission notice shall be included
6473// in all copies or substantial portions of the Software.
6474//
6475// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6476// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6477// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6478// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6479// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6480// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6481// USE OR OTHER DEALINGS IN THE SOFTWARE.
18620 6482
18621// (protected) r = this op a (bitwise) 6483// NOTE: These type checking functions intentionally don't use `instanceof`
18622function bnpBitwiseTo(a,op,r) { 6484// because it is fragile and can be easily faked with `Object.create()`.
18623 var self = this; 6485function isArray(ar) {
18624 var i, f, m = Math.min(a.t,self.t); 6486 return Array.isArray(ar);
18625 for(i = 0; i < m; ++i) r[i] = op(self[i],a[i]);
18626 if(a.t < self.t) {
18627 f = a.s&self.DM;
18628 for(i = m; i < self.t; ++i) r[i] = op(self[i],f);
18629 r.t = self.t;
18630 }
18631 else {
18632 f = self.s&self.DM;
18633 for(i = m; i < a.t; ++i) r[i] = op(f,a[i]);
18634 r.t = a.t;
18635 }
18636 r.s = op(self.s,a.s);
18637 r.clamp();
18638} 6487}
6488exports.isArray = isArray;
18639 6489
18640// (public) this & a 6490function isBoolean(arg) {
18641function op_and(x,y) { return x&y; } 6491 return typeof arg === 'boolean';
18642function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
18643
18644// (public) this | a
18645function op_or(x,y) { return x|y; }
18646function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
18647
18648// (public) this ^ a
18649function op_xor(x,y) { return x^y; }
18650function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
18651
18652// (public) this & ~a
18653function op_andnot(x,y) { return x&~y; }
18654function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
18655
18656// (public) ~this
18657function bnNot() {
18658 var r = nbi();
18659 for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i];
18660 r.t = this.t;
18661 r.s = ~this.s;
18662 return r;
18663} 6492}
6493exports.isBoolean = isBoolean;
18664 6494
18665// (public) this << n 6495function isNull(arg) {
18666function bnShiftLeft(n) { 6496 return arg === null;
18667 var r = nbi();
18668 if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
18669 return r;
18670} 6497}
6498exports.isNull = isNull;
18671 6499
18672// (public) this >> n 6500function isNullOrUndefined(arg) {
18673function bnShiftRight(n) { 6501 return arg == null;
18674 var r = nbi();
18675 if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
18676 return r;
18677} 6502}
6503exports.isNullOrUndefined = isNullOrUndefined;
18678 6504
18679// return index of lowest 1-bit in x, x < 2^31 6505function isNumber(arg) {
18680function lbit(x) { 6506 return typeof arg === 'number';
18681 if(x == 0) return -1;
18682 var r = 0;
18683 if((x&0xffff) == 0) { x >>= 16; r += 16; }
18684 if((x&0xff) == 0) { x >>= 8; r += 8; }
18685 if((x&0xf) == 0) { x >>= 4; r += 4; }
18686 if((x&3) == 0) { x >>= 2; r += 2; }
18687 if((x&1) == 0) ++r;
18688 return r;
18689} 6507}
6508exports.isNumber = isNumber;
18690 6509
18691// (public) returns index of lowest 1-bit (or -1 if none) 6510function isString(arg) {
18692function bnGetLowestSetBit() { 6511 return typeof arg === 'string';
18693 for(var i = 0; i < this.t; ++i)
18694 if(this[i] != 0) return i*this.DB+lbit(this[i]);
18695 if(this.s < 0) return this.t*this.DB;
18696 return -1;
18697} 6512}
6513exports.isString = isString;
18698 6514
18699// return number of 1 bits in x 6515function isSymbol(arg) {
18700function cbit(x) { 6516 return typeof arg === 'symbol';
18701 var r = 0;
18702 while(x != 0) { x &= x-1; ++r; }
18703 return r;
18704} 6517}
6518exports.isSymbol = isSymbol;
18705 6519
18706// (public) return number of set bits 6520function isUndefined(arg) {
18707function bnBitCount() { 6521 return arg === void 0;
18708 var r = 0, x = this.s&this.DM;
18709 for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x);
18710 return r;
18711} 6522}
6523exports.isUndefined = isUndefined;
18712 6524
18713// (public) true iff nth bit is set 6525function isRegExp(re) {
18714function bnTestBit(n) { 6526 return isObject(re) && objectToString(re) === '[object RegExp]';
18715 var j = Math.floor(n/this.DB);
18716 if(j >= this.t) return(this.s!=0);
18717 return((this[j]&(1<<(n%this.DB)))!=0);
18718} 6527}
6528exports.isRegExp = isRegExp;
18719 6529
18720// (protected) this op (1<<n) 6530function isObject(arg) {
18721function bnpChangeBit(n,op) { 6531 return typeof arg === 'object' && arg !== null;
18722 var r = BigInteger.ONE.shiftLeft(n);
18723 this.bitwiseTo(r,op,r);
18724 return r;
18725} 6532}
6533exports.isObject = isObject;
18726 6534
18727// (public) this | (1<<n) 6535function isDate(d) {
18728function bnSetBit(n) { return this.changeBit(n,op_or); } 6536 return isObject(d) && objectToString(d) === '[object Date]';
18729
18730// (public) this & ~(1<<n)
18731function bnClearBit(n) { return this.changeBit(n,op_andnot); }
18732
18733// (public) this ^ (1<<n)
18734function bnFlipBit(n) { return this.changeBit(n,op_xor); }
18735
18736// (protected) r = this + a
18737function bnpAddTo(a,r) {
18738 var self = this;
18739
18740 var i = 0, c = 0, m = Math.min(a.t,self.t);
18741 while(i < m) {
18742 c += self[i]+a[i];
18743 r[i++] = c&self.DM;
18744 c >>= self.DB;
18745 }
18746 if(a.t < self.t) {
18747 c += a.s;
18748 while(i < self.t) {
18749 c += self[i];
18750 r[i++] = c&self.DM;
18751 c >>= self.DB;
18752 }
18753 c += self.s;
18754 }
18755 else {
18756 c += self.s;
18757 while(i < a.t) {
18758 c += a[i];
18759 r[i++] = c&self.DM;
18760 c >>= self.DB;
18761 }
18762 c += a.s;
18763 }
18764 r.s = (c<0)?-1:0;
18765 if(c > 0) r[i++] = c;
18766 else if(c < -1) r[i++] = self.DV+c;
18767 r.t = i;
18768 r.clamp();
18769} 6537}
6538exports.isDate = isDate;
18770 6539
18771// (public) this + a 6540function isError(e) {
18772function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } 6541 return isObject(e) &&
18773 6542 (objectToString(e) === '[object Error]' || e instanceof Error);
18774// (public) this - a
18775function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
18776
18777// (public) this * a
18778function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
18779
18780// (public) this^2
18781function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
18782
18783// (public) this / a
18784function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
18785
18786// (public) this % a
18787function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
18788
18789// (public) [this/a,this%a]
18790function bnDivideAndRemainder(a) {
18791 var q = nbi(), r = nbi();
18792 this.divRemTo(a,q,r);
18793 return new Array(q,r);
18794} 6543}
6544exports.isError = isError;
18795 6545
18796// (protected) this *= n, this >= 0, 1 < n < DV 6546function isFunction(arg) {
18797function bnpDMultiply(n) { 6547 return typeof arg === 'function';
18798 this[this.t] = this.am(0,n-1,this,0,0,this.t);
18799 ++this.t;
18800 this.clamp();
18801} 6548}
6549exports.isFunction = isFunction;
18802 6550
18803// (protected) this += n << w words, this >= 0 6551function isPrimitive(arg) {
18804function bnpDAddOffset(n,w) { 6552 return arg === null ||
18805 if(n == 0) return; 6553 typeof arg === 'boolean' ||
18806 while(this.t <= w) this[this.t++] = 0; 6554 typeof arg === 'number' ||
18807 this[w] += n; 6555 typeof arg === 'string' ||
18808 while(this[w] >= this.DV) { 6556 typeof arg === 'symbol' || // ES6 symbol
18809 this[w] -= this.DV; 6557 typeof arg === 'undefined';
18810 if(++w >= this.t) this[this.t++] = 0;
18811 ++this[w];
18812 }
18813} 6558}
6559exports.isPrimitive = isPrimitive;
18814 6560
18815// A "null" reducer 6561function isBuffer(arg) {
18816function NullExp() {} 6562 return Buffer.isBuffer(arg);
18817function nNop(x) { return x; }
18818function nMulTo(x,y,r) { x.multiplyTo(y,r); }
18819function nSqrTo(x,r) { x.squareTo(r); }
18820
18821NullExp.prototype.convert = nNop;
18822NullExp.prototype.revert = nNop;
18823NullExp.prototype.mulTo = nMulTo;
18824NullExp.prototype.sqrTo = nSqrTo;
18825
18826// (public) this^e
18827function bnPow(e) { return this.exp(e,new NullExp()); }
18828
18829// (protected) r = lower n words of "this * a", a.t <= n
18830// "this" should be the larger one if appropriate.
18831function bnpMultiplyLowerTo(a,n,r) {
18832 var i = Math.min(this.t+a.t,n);
18833 r.s = 0; // assumes a,this >= 0
18834 r.t = i;
18835 while(i > 0) r[--i] = 0;
18836 var j;
18837 for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t);
18838 for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i);
18839 r.clamp();
18840} 6563}
6564exports.isBuffer = isBuffer;
18841 6565
18842// (protected) r = "this * a" without lower n words, n > 0 6566function objectToString(o) {
18843// "this" should be the larger one if appropriate. 6567 return Object.prototype.toString.call(o);
18844function bnpMultiplyUpperTo(a,n,r) {
18845 --n;
18846 var i = r.t = this.t+a.t-n;
18847 r.s = 0; // assumes a,this >= 0
18848 while(--i >= 0) r[i] = 0;
18849 for(i = Math.max(n-this.t,0); i < a.t; ++i)
18850 r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n);
18851 r.clamp();
18852 r.drShiftTo(1,r);
18853} 6568}
6569}).call(this,require("buffer").Buffer)
6570},{"buffer":7}],22:[function(require,module,exports){
6571module.exports = require("./lib/_stream_passthrough.js")
18854 6572
18855// Barrett modular reduction 6573},{"./lib/_stream_passthrough.js":17}],23:[function(require,module,exports){
18856function Barrett(m) { 6574exports = module.exports = require('./lib/_stream_readable.js');
18857 // setup Barrett 6575exports.Stream = require('stream');
18858 this.r2 = nbi(); 6576exports.Readable = exports;
18859 this.q3 = nbi(); 6577exports.Writable = require('./lib/_stream_writable.js');
18860 BigInteger.ONE.dlShiftTo(2*m.t,this.r2); 6578exports.Duplex = require('./lib/_stream_duplex.js');
18861 this.mu = this.r2.divide(m); 6579exports.Transform = require('./lib/_stream_transform.js');
18862 this.m = m; 6580exports.PassThrough = require('./lib/_stream_passthrough.js');
18863}
18864 6581
18865function barrettConvert(x) { 6582},{"./lib/_stream_duplex.js":16,"./lib/_stream_passthrough.js":17,"./lib/_stream_readable.js":18,"./lib/_stream_transform.js":19,"./lib/_stream_writable.js":20,"stream":26}],24:[function(require,module,exports){
18866 if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); 6583module.exports = require("./lib/_stream_transform.js")
18867 else if(x.compareTo(this.m) < 0) return x;
18868 else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
18869}
18870 6584
18871function barrettRevert(x) { return x; } 6585},{"./lib/_stream_transform.js":19}],25:[function(require,module,exports){
6586module.exports = require("./lib/_stream_writable.js")
18872 6587
18873// x = x mod m (HAC 14.42) 6588},{"./lib/_stream_writable.js":20}],26:[function(require,module,exports){
18874function barrettReduce(x) { 6589// Copyright Joyent, Inc. and other Node contributors.
18875 var self = this; 6590//
18876 x.drShiftTo(self.m.t-1,self.r2); 6591// Permission is hereby granted, free of charge, to any person obtaining a
18877 if(x.t > self.m.t+1) { x.t = self.m.t+1; x.clamp(); } 6592// copy of this software and associated documentation files (the
18878 self.mu.multiplyUpperTo(self.r2,self.m.t+1,self.q3); 6593// "Software"), to deal in the Software without restriction, including
18879 self.m.multiplyLowerTo(self.q3,self.m.t+1,self.r2); 6594// without limitation the rights to use, copy, modify, merge, publish,
18880 while(x.compareTo(self.r2) < 0) x.dAddOffset(1,self.m.t+1); 6595// distribute, sublicense, and/or sell copies of the Software, and to permit
18881 x.subTo(self.r2,x); 6596// persons to whom the Software is furnished to do so, subject to the
18882 while(x.compareTo(self.m) >= 0) x.subTo(self.m,x); 6597// following conditions:
18883} 6598//
6599// The above copyright notice and this permission notice shall be included
6600// in all copies or substantial portions of the Software.
6601//
6602// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
6603// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6604// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
6605// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
6606// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
6607// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
6608// USE OR OTHER DEALINGS IN THE SOFTWARE.
18884 6609
18885// r = x^2 mod m; x != r 6610module.exports = Stream;
18886function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
18887 6611
18888// r = x*y mod m; x,y != r 6612var EE = require('events').EventEmitter;
18889function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } 6613var inherits = require('inherits');
18890 6614
18891Barrett.prototype.convert = barrettConvert; 6615inherits(Stream, EE);
18892Barrett.prototype.revert = barrettRevert; 6616Stream.Readable = require('readable-stream/readable.js');
18893Barrett.prototype.reduce = barrettReduce; 6617Stream.Writable = require('readable-stream/writable.js');
18894Barrett.prototype.mulTo = barrettMulTo; 6618Stream.Duplex = require('readable-stream/duplex.js');
18895Barrett.prototype.sqrTo = barrettSqrTo; 6619Stream.Transform = require('readable-stream/transform.js');
6620Stream.PassThrough = require('readable-stream/passthrough.js');
18896 6621
18897// (public) this^e % m (HAC 14.85) 6622// Backwards-compat with node 0.4.x
18898function bnModPow(e,m) { 6623Stream.Stream = Stream;
18899 var i = e.bitLength(), k, r = nbv(1), z;
18900 if(i <= 0) return r;
18901 else if(i < 18) k = 1;
18902 else if(i < 48) k = 3;
18903 else if(i < 144) k = 4;
18904 else if(i < 768) k = 5;
18905 else k = 6;
18906 if(i < 8)
18907 z = new Classic(m);
18908 else if(m.isEven())
18909 z = new Barrett(m);
18910 else
18911 z = new Montgomery(m);
18912 6624
18913 // precomputation
18914 var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;
18915 g[1] = z.convert(this);
18916 if(k > 1) {
18917 var g2 = nbi();
18918 z.sqrTo(g[1],g2);
18919 while(n <= km) {
18920 g[n] = nbi();
18921 z.mulTo(g2,g[n-2],g[n]);
18922 n += 2;
18923 }
18924 }
18925 6625
18926 var j = e.t-1, w, is1 = true, r2 = nbi(), t;
18927 i = nbits(e[j])-1;
18928 while(j >= 0) {
18929 if(i >= k1) w = (e[j]>>(i-k1))&km;
18930 else {
18931 w = (e[j]&((1<<(i+1))-1))<<(k1-i);
18932 if(j > 0) w |= e[j-1]>>(this.DB+i-k1);
18933 }
18934 6626
18935 n = k; 6627// old-style streams. Note that the pipe method (the only relevant
18936 while((w&1) == 0) { w >>= 1; --n; } 6628// part of this class) is overridden in the Readable class.
18937 if((i -= n) < 0) { i += this.DB; --j; }
18938 if(is1) { // ret == 1, don't bother squaring or multiplying it
18939 g[w].copyTo(r);
18940 is1 = false;
18941 }
18942 else {
18943 while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
18944 if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
18945 z.mulTo(r2,g[w],r);
18946 }
18947 6629
18948 while(j >= 0 && (e[j]&(1<<i)) == 0) { 6630function Stream() {
18949 z.sqrTo(r,r2); t = r; r = r2; r2 = t; 6631 EE.call(this);
18950 if(--i < 0) { i = this.DB-1; --j; }
18951 }
18952 }
18953 return z.revert(r);
18954} 6632}
18955 6633
18956// (public) gcd(this,a) (HAC 14.54) 6634Stream.prototype.pipe = function(dest, options) {
18957function bnGCD(a) { 6635 var source = this;
18958 var x = (this.s<0)?this.negate():this.clone(); 6636
18959 var y = (a.s<0)?a.negate():a.clone(); 6637 function ondata(chunk) {
18960 if(x.compareTo(y) < 0) { var t = x; x = y; y = t; } 6638 if (dest.writable) {
18961 var i = x.getLowestSetBit(), g = y.getLowestSetBit(); 6639 if (false === dest.write(chunk) && source.pause) {
18962 if(g < 0) return x; 6640 source.pause();
18963 if(i < g) g = i; 6641 }
18964 if(g > 0) {
18965 x.rShiftTo(g,x);
18966 y.rShiftTo(g,y);
18967 }
18968 while(x.signum() > 0) {
18969 if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
18970 if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
18971 if(x.compareTo(y) >= 0) {
18972 x.subTo(y,x);
18973 x.rShiftTo(1,x);
18974 }
18975 else {
18976 y.subTo(x,y);
18977 y.rShiftTo(1,y);
18978 } 6642 }
18979 } 6643 }
18980 if(g > 0) y.lShiftTo(g,y);
18981 return y;
18982}
18983 6644
18984// (protected) this % n, n < 2^26 6645 source.on('data', ondata);
18985function bnpModInt(n) {
18986 if(n <= 0) return 0;
18987 var d = this.DV%n, r = (this.s<0)?n-1:0;
18988 if(this.t > 0)
18989 if(d == 0) r = this[0]%n;
18990 else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n;
18991 return r;
18992}
18993 6646
18994// (public) 1/this % m (HAC 14.61) 6647 function ondrain() {
18995function bnModInverse(m) { 6648 if (source.readable && source.resume) {
18996 var ac = m.isEven(); 6649 source.resume();
18997 if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
18998 var u = m.clone(), v = this.clone();
18999 var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
19000 while(u.signum() != 0) {
19001 while(u.isEven()) {
19002 u.rShiftTo(1,u);
19003 if(ac) {
19004 if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
19005 a.rShiftTo(1,a);
19006 }
19007 else if(!b.isEven()) b.subTo(m,b);
19008 b.rShiftTo(1,b);
19009 }
19010 while(v.isEven()) {
19011 v.rShiftTo(1,v);
19012 if(ac) {
19013 if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
19014 c.rShiftTo(1,c);
19015 }
19016 else if(!d.isEven()) d.subTo(m,d);
19017 d.rShiftTo(1,d);
19018 }
19019 if(u.compareTo(v) >= 0) {
19020 u.subTo(v,u);
19021 if(ac) a.subTo(c,a);
19022 b.subTo(d,b);
19023 }
19024 else {
19025 v.subTo(u,v);
19026 if(ac) c.subTo(a,c);
19027 d.subTo(b,d);
19028 } 6650 }
19029 } 6651 }
19030 if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
19031 if(d.compareTo(m) >= 0) return d.subtract(m);
19032 if(d.signum() < 0) d.addTo(m,d); else return d;
19033 if(d.signum() < 0) return d.add(m); else return d;
19034}
19035 6652
19036// protected 6653 dest.on('drain', ondrain);
19037proto.chunkSize = bnpChunkSize;
19038proto.toRadix = bnpToRadix;
19039proto.fromRadix = bnpFromRadix;
19040proto.fromNumber = bnpFromNumber;
19041proto.bitwiseTo = bnpBitwiseTo;
19042proto.changeBit = bnpChangeBit;
19043proto.addTo = bnpAddTo;
19044proto.dMultiply = bnpDMultiply;
19045proto.dAddOffset = bnpDAddOffset;
19046proto.multiplyLowerTo = bnpMultiplyLowerTo;
19047proto.multiplyUpperTo = bnpMultiplyUpperTo;
19048proto.modInt = bnpModInt;
19049 6654
19050// public 6655 // If the 'end' option is not supplied, dest.end() will be called when
19051proto.clone = bnClone; 6656 // source gets the 'end' or 'close' events. Only dest.end() once.
19052proto.intValue = bnIntValue; 6657 if (!dest._isStdio && (!options || options.end !== false)) {
19053proto.byteValue = bnByteValue; 6658 source.on('end', onend);
19054proto.shortValue = bnShortValue; 6659 source.on('close', onclose);
19055proto.signum = bnSigNum; 6660 }
19056proto.toByteArray = bnToByteArray;
19057proto.equals = bnEquals;
19058proto.min = bnMin;
19059proto.max = bnMax;
19060proto.and = bnAnd;
19061proto.or = bnOr;
19062proto.xor = bnXor;
19063proto.andNot = bnAndNot;
19064proto.not = bnNot;
19065proto.shiftLeft = bnShiftLeft;
19066proto.shiftRight = bnShiftRight;
19067proto.getLowestSetBit = bnGetLowestSetBit;
19068proto.bitCount = bnBitCount;
19069proto.testBit = bnTestBit;
19070proto.setBit = bnSetBit;
19071proto.clearBit = bnClearBit;
19072proto.flipBit = bnFlipBit;
19073proto.add = bnAdd;
19074proto.subtract = bnSubtract;
19075proto.multiply = bnMultiply;
19076proto.divide = bnDivide;
19077proto.remainder = bnRemainder;
19078proto.divideAndRemainder = bnDivideAndRemainder;
19079proto.modPow = bnModPow;
19080proto.modInverse = bnModInverse;
19081proto.pow = bnPow;
19082proto.gcd = bnGCD;
19083 6661
19084// JSBN-specific extension 6662 var didOnEnd = false;
19085proto.square = bnSquare; 6663 function onend() {
6664 if (didOnEnd) return;
6665 didOnEnd = true;
19086 6666
19087// BigInteger interfaces not implemented in jsbn: 6667 dest.end();
6668 }
19088 6669
19089// BigInteger(int signum, byte[] magnitude)
19090// double doubleValue()
19091// float floatValue()
19092// int hashCode()
19093// long longValue()
19094// static BigInteger valueOf(long val)
19095 6670
19096// "constants" 6671 function onclose() {
19097BigInteger.ZERO = nbv(0); 6672 if (didOnEnd) return;
19098BigInteger.ONE = nbv(1); 6673 didOnEnd = true;
19099BigInteger.valueOf = nbv;
19100 6674
19101},{"assert":4}],2:[function(_dereq_,module,exports){ 6675 if (typeof dest.destroy === 'function') dest.destroy();
19102(function (Buffer){ 6676 }
19103// FIXME: Kind of a weird way to throw exceptions, consider removing
19104var assert = _dereq_('assert')
19105var BigInteger = _dereq_('./bigi')
19106 6677
19107/** 6678 // don't leave dangling pipes when there are errors.
19108 * Turns a byte array into a big integer. 6679 function onerror(er) {
19109 * 6680 cleanup();
19110 * This function will interpret a byte array as a big integer in big 6681 if (EE.listenerCount(this, 'error') === 0) {
19111 * endian notation. 6682 throw er; // Unhandled stream error in pipe.
19112 */ 6683 }
19113BigInteger.fromByteArrayUnsigned = function(byteArray) {
19114 // BigInteger expects a DER integer conformant byte array
19115 if (byteArray[0] & 0x80) {
19116 return new BigInteger([0].concat(byteArray))
19117 } 6684 }
19118 6685
19119 return new BigInteger(byteArray) 6686 source.on('error', onerror);
19120} 6687 dest.on('error', onerror);
19121 6688
19122/** 6689 // remove all the event listeners that were added.
19123 * Returns a byte array representation of the big integer. 6690 function cleanup() {
19124 * 6691 source.removeListener('data', ondata);
19125 * This returns the absolute of the contained value in big endian 6692 dest.removeListener('drain', ondrain);
19126 * form. A value of zero results in an empty array.
19127 */
19128BigInteger.prototype.toByteArrayUnsigned = function() {
19129 var byteArray = this.toByteArray()
19130 return byteArray[0] === 0 ? byteArray.slice(1) : byteArray
19131}
19132 6693
19133BigInteger.fromDERInteger = function(byteArray) { 6694 source.removeListener('end', onend);
19134 return new BigInteger(byteArray) 6695 source.removeListener('close', onclose);
19135}
19136 6696
19137/* 6697 source.removeListener('error', onerror);
19138 * Converts BigInteger to a DER integer representation. 6698 dest.removeListener('error', onerror);
19139 *
19140 * The format for this value uses the most significant bit as a sign
19141 * bit. If the most significant bit is already set and the integer is
19142 * positive, a 0x00 is prepended.
19143 *
19144 * Examples:
19145 *
19146 * 0 => 0x00
19147 * 1 => 0x01
19148 * -1 => 0x81
19149 * 127 => 0x7f
19150 * -127 => 0xff
19151 * 128 => 0x0080
19152 * -128 => 0x80
19153 * 255 => 0x00ff
19154 * -255 => 0xff
19155 * 16300 => 0x3fac
19156 * -16300 => 0xbfac
19157 * 62300 => 0x00f35c
19158 * -62300 => 0xf35c
19159*/
19160BigInteger.prototype.toDERInteger = BigInteger.prototype.toByteArray
19161 6699
19162BigInteger.fromBuffer = function(buffer) { 6700 source.removeListener('end', cleanup);
19163 // BigInteger expects a DER integer conformant byte array 6701 source.removeListener('close', cleanup);
19164 if (buffer[0] & 0x80) {
19165 var byteArray = Array.prototype.slice.call(buffer)
19166 6702
19167 return new BigInteger([0].concat(byteArray)) 6703 dest.removeListener('close', cleanup);
19168 } 6704 }
19169 6705
19170 return new BigInteger(buffer) 6706 source.on('end', cleanup);
19171} 6707 source.on('close', cleanup);
19172
19173BigInteger.fromHex = function(hex) {
19174 if (hex === '') return BigInteger.ZERO
19175
19176 assert.equal(hex, hex.match(/^[A-Fa-f0-9]+/), 'Invalid hex string')
19177 assert.equal(hex.length % 2, 0, 'Incomplete hex')
19178 return new BigInteger(hex, 16)
19179}
19180
19181BigInteger.prototype.toBuffer = function(size) {
19182 var byteArray = this.toByteArrayUnsigned()
19183 var zeros = []
19184 6708
19185 var padding = size - byteArray.length 6709 dest.on('close', cleanup);
19186 while (zeros.length < padding) zeros.push(0)
19187
19188 return new Buffer(zeros.concat(byteArray))
19189}
19190
19191BigInteger.prototype.toHex = function(size) {
19192 return this.toBuffer(size).toString('hex')
19193}
19194 6710
19195}).call(this,_dereq_("buffer").Buffer) 6711 dest.emit('pipe', source);
19196},{"./bigi":1,"assert":4,"buffer":8}],3:[function(_dereq_,module,exports){
19197var BigInteger = _dereq_('./bigi')
19198 6712
19199//addons 6713 // Allow for unix-like usage: A.pipe(B).pipe(C)
19200_dereq_('./convert') 6714 return dest;
6715};
19201 6716
19202module.exports = BigInteger 6717},{"events":11,"inherits":12,"readable-stream/duplex.js":15,"readable-stream/passthrough.js":22,"readable-stream/readable.js":23,"readable-stream/transform.js":24,"readable-stream/writable.js":25}],27:[function(require,module,exports){
19203},{"./bigi":1,"./convert":2}],4:[function(_dereq_,module,exports){ 6718// Copyright Joyent, Inc. and other Node contributors.
19204// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
19205//
19206// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
19207//
19208// Originally from narwhal.js (http://narwhaljs.org)
19209// Copyright (c) 2009 Thomas Robinson <280north.com>
19210// 6719//
19211// Permission is hereby granted, free of charge, to any person obtaining a copy 6720// Permission is hereby granted, free of charge, to any person obtaining a
19212// of this software and associated documentation files (the 'Software'), to 6721// copy of this software and associated documentation files (the
19213// deal in the Software without restriction, including without limitation the 6722// "Software"), to deal in the Software without restriction, including
19214// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 6723// without limitation the rights to use, copy, modify, merge, publish,
19215// sell copies of the Software, and to permit persons to whom the Software is 6724// distribute, sublicense, and/or sell copies of the Software, and to permit
19216// furnished to do so, subject to the following conditions: 6725// persons to whom the Software is furnished to do so, subject to the
6726// following conditions:
19217// 6727//
19218// The above copyright notice and this permission notice shall be included in 6728// The above copyright notice and this permission notice shall be included
19219// all copies or substantial portions of the Software. 6729// in all copies or substantial portions of the Software.
19220// 6730//
19221// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 6731// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19222// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6732// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19223// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 6733// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
19224// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 6734// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
19225// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 6735// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19226// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 6736// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
19227 6737// USE OR OTHER DEALINGS IN THE SOFTWARE.
19228// when used in node, this will actually load the util module we depend on
19229// versus loading the builtin util module as happens otherwise
19230// this is a bug in node module loading as far as I am concerned
19231var util = _dereq_('util/');
19232
19233var pSlice = Array.prototype.slice;
19234var hasOwn = Object.prototype.hasOwnProperty;
19235
19236// 1. The assert module provides functions that throw
19237// AssertionError's when particular conditions are not met. The
19238// assert module must conform to the following interface.
19239
19240var assert = module.exports = ok;
19241
19242// 2. The AssertionError is defined in assert.
19243// new assert.AssertionError({ message: message,
19244// actual: actual,
19245// expected: expected })
19246
19247assert.AssertionError = function AssertionError(options) {
19248 this.name = 'AssertionError';
19249 this.actual = options.actual;
19250 this.expected = options.expected;
19251 this.operator = options.operator;
19252 if (options.message) {
19253 this.message = options.message;
19254 this.generatedMessage = false;
19255 } else {
19256 this.message = getMessage(this);
19257 this.generatedMessage = true;
19258 }
19259 var stackStartFunction = options.stackStartFunction || fail;
19260
19261 if (Error.captureStackTrace) {
19262 Error.captureStackTrace(this, stackStartFunction);
19263 }
19264 else {
19265 // non v8 browsers so we can have a stacktrace
19266 var err = new Error();
19267 if (err.stack) {
19268 var out = err.stack;
19269
19270 // try to strip useless frames
19271 var fn_name = stackStartFunction.name;
19272 var idx = out.indexOf('\n' + fn_name);
19273 if (idx >= 0) {
19274 // once we have located the function frame
19275 // we need to strip out everything before it (and its line)
19276 var next_line = out.indexOf('\n', idx + 1);
19277 out = out.substring(next_line + 1);
19278 }
19279 6738
19280 this.stack = out; 6739var Buffer = require('buffer').Buffer;
19281 }
19282 }
19283};
19284 6740
19285// assert.AssertionError instanceof Error 6741var isBufferEncoding = Buffer.isEncoding
19286util.inherits(assert.AssertionError, Error); 6742 || function(encoding) {
6743 switch (encoding && encoding.toLowerCase()) {
6744 case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
6745 default: return false;
6746 }
6747 }
19287 6748
19288function replacer(key, value) {
19289 if (util.isUndefined(value)) {
19290 return '' + value;
19291 }
19292 if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) {
19293 return value.toString();
19294 }
19295 if (util.isFunction(value) || util.isRegExp(value)) {
19296 return value.toString();
19297 }
19298 return value;
19299}
19300 6749
19301function truncate(s, n) { 6750function assertEncoding(encoding) {
19302 if (util.isString(s)) { 6751 if (encoding && !isBufferEncoding(encoding)) {
19303 return s.length < n ? s : s.slice(0, n); 6752 throw new Error('Unknown encoding: ' + encoding);
19304 } else {
19305 return s;
19306 } 6753 }
19307} 6754}
19308 6755
19309function getMessage(self) { 6756// StringDecoder provides an interface for efficiently splitting a series of
19310 return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + 6757// buffers into a series of JS strings without breaking apart multi-byte
19311 self.operator + ' ' + 6758// characters. CESU-8 is handled as part of the UTF-8 encoding.
19312 truncate(JSON.stringify(self.expected, replacer), 128); 6759//
19313} 6760// @TODO Handling all encodings inside a single object makes it very difficult
19314 6761// to reason about this code, so it should be split up in the future.
19315// At present only the three keys mentioned above are used and 6762// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
19316// understood by the spec. Implementations or sub modules can pass 6763// points as used by CESU-8.
19317// other keys to the AssertionError's constructor - they will be 6764var StringDecoder = exports.StringDecoder = function(encoding) {
19318// ignored. 6765 this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
19319 6766 assertEncoding(encoding);
19320// 3. All of the following functions must throw an AssertionError 6767 switch (this.encoding) {
19321// when a corresponding condition is not met, with a message that 6768 case 'utf8':
19322// may be undefined if not provided. All assertion methods provide 6769 // CESU-8 represents each of Surrogate Pair by 3-bytes
19323// both the actual and expected values to the assertion error for 6770 this.surrogateSize = 3;
19324// display purposes. 6771 break;
19325 6772 case 'ucs2':
19326function fail(actual, expected, message, operator, stackStartFunction) { 6773 case 'utf16le':
19327 throw new assert.AssertionError({ 6774 // UTF-16 represents each of Surrogate Pair by 2-bytes
19328 message: message, 6775 this.surrogateSize = 2;
19329 actual: actual, 6776 this.detectIncompleteChar = utf16DetectIncompleteChar;
19330 expected: expected, 6777 break;
19331 operator: operator, 6778 case 'base64':
19332 stackStartFunction: stackStartFunction 6779 // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
19333 }); 6780 this.surrogateSize = 3;
19334} 6781 this.detectIncompleteChar = base64DetectIncompleteChar;
19335 6782 break;
19336// EXTENSION! allows for well behaved errors defined elsewhere. 6783 default:
19337assert.fail = fail; 6784 this.write = passThroughWrite;
19338 6785 return;
19339// 4. Pure assertion tests whether a value is truthy, as determined
19340// by !!guard.
19341// assert.ok(guard, message_opt);
19342// This statement is equivalent to assert.equal(true, !!guard,
19343// message_opt);. To test strictly for the value true, use
19344// assert.strictEqual(true, guard, message_opt);.
19345
19346function ok(value, message) {
19347 if (!value) fail(value, true, message, '==', assert.ok);
19348}
19349assert.ok = ok;
19350
19351// 5. The equality assertion tests shallow, coercive equality with
19352// ==.
19353// assert.equal(actual, expected, message_opt);
19354
19355assert.equal = function equal(actual, expected, message) {
19356 if (actual != expected) fail(actual, expected, message, '==', assert.equal);
19357};
19358
19359// 6. The non-equality assertion tests for whether two objects are not equal
19360// with != assert.notEqual(actual, expected, message_opt);
19361
19362assert.notEqual = function notEqual(actual, expected, message) {
19363 if (actual == expected) {
19364 fail(actual, expected, message, '!=', assert.notEqual);
19365 } 6786 }
19366};
19367
19368// 7. The equivalence assertion tests a deep equality relation.
19369// assert.deepEqual(actual, expected, message_opt);
19370 6787
19371assert.deepEqual = function deepEqual(actual, expected, message) { 6788 // Enough space to store all bytes of a single character. UTF-8 needs 4
19372 if (!_deepEqual(actual, expected)) { 6789 // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
19373 fail(actual, expected, message, 'deepEqual', assert.deepEqual); 6790 this.charBuffer = new Buffer(6);
19374 } 6791 // Number of bytes received for the current incomplete multi-byte character.
6792 this.charReceived = 0;
6793 // Number of bytes expected for the current incomplete multi-byte character.
6794 this.charLength = 0;
19375}; 6795};
19376 6796
19377function _deepEqual(actual, expected) {
19378 // 7.1. All identical values are equivalent, as determined by ===.
19379 if (actual === expected) {
19380 return true;
19381 6797
19382 } else if (util.isBuffer(actual) && util.isBuffer(expected)) { 6798// write decodes the given buffer and returns it as JS string that is
19383 if (actual.length != expected.length) return false; 6799// guaranteed to not contain any partial multi-byte characters. Any partial
19384 6800// character found at the end of the buffer is buffered up, and will be
19385 for (var i = 0; i < actual.length; i++) { 6801// returned when calling write again with the remaining bytes.
19386 if (actual[i] !== expected[i]) return false; 6802//
6803// Note: Converting a Buffer containing an orphan surrogate to a String
6804// currently works, but converting a String to a Buffer (via `new Buffer`, or
6805// Buffer#write) will replace incomplete surrogates with the unicode
6806// replacement character. See https://codereview.chromium.org/121173009/ .
6807StringDecoder.prototype.write = function(buffer) {
6808 var charStr = '';
6809 // if our last write ended with an incomplete multibyte character
6810 while (this.charLength) {
6811 // determine how many remaining bytes this buffer has to offer for this char
6812 var available = (buffer.length >= this.charLength - this.charReceived) ?
6813 this.charLength - this.charReceived :
6814 buffer.length;
6815
6816 // add the new bytes to the char buffer
6817 buffer.copy(this.charBuffer, this.charReceived, 0, available);
6818 this.charReceived += available;
6819
6820 if (this.charReceived < this.charLength) {
6821 // still not enough chars in this buffer? wait for more ...
6822 return '';
6823 }
6824
6825 // remove bytes belonging to the current character from the buffer
6826 buffer = buffer.slice(available, buffer.length);
6827
6828 // get the character that was split
6829 charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
6830
6831 // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
6832 var charCode = charStr.charCodeAt(charStr.length - 1);
6833 if (charCode >= 0xD800 && charCode <= 0xDBFF) {
6834 this.charLength += this.surrogateSize;
6835 charStr = '';
6836 continue;
19387 } 6837 }
6838 this.charReceived = this.charLength = 0;
19388 6839
19389 return true; 6840 // if there are no more bytes in this buffer, just emit our char
19390 6841 if (buffer.length === 0) {
19391 // 7.2. If the expected value is a Date object, the actual value is 6842 return charStr;
19392 // equivalent if it is also a Date object that refers to the same time.
19393 } else if (util.isDate(actual) && util.isDate(expected)) {
19394 return actual.getTime() === expected.getTime();
19395
19396 // 7.3 If the expected value is a RegExp object, the actual value is
19397 // equivalent if it is also a RegExp object with the same source and
19398 // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
19399 } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
19400 return actual.source === expected.source &&
19401 actual.global === expected.global &&
19402 actual.multiline === expected.multiline &&
19403 actual.lastIndex === expected.lastIndex &&
19404 actual.ignoreCase === expected.ignoreCase;
19405
19406 // 7.4. Other pairs that do not both pass typeof value == 'object',
19407 // equivalence is determined by ==.
19408 } else if (!util.isObject(actual) && !util.isObject(expected)) {
19409 return actual == expected;
19410
19411 // 7.5 For all other Object pairs, including Array objects, equivalence is
19412 // determined by having the same number of owned properties (as verified
19413 // with Object.prototype.hasOwnProperty.call), the same set of keys
19414 // (although not necessarily the same order), equivalent values for every
19415 // corresponding key, and an identical 'prototype' property. Note: this
19416 // accounts for both named and indexed properties on Arrays.
19417 } else {
19418 return objEquiv(actual, expected);
19419 }
19420}
19421
19422function isArguments(object) {
19423 return Object.prototype.toString.call(object) == '[object Arguments]';
19424}
19425
19426function objEquiv(a, b) {
19427 if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
19428 return false;
19429 // an identical 'prototype' property.
19430 if (a.prototype !== b.prototype) return false;
19431 //~~~I've managed to break Object.keys through screwy arguments passing.
19432 // Converting to array solves the problem.
19433 if (isArguments(a)) {
19434 if (!isArguments(b)) {
19435 return false;
19436 } 6843 }
19437 a = pSlice.call(a); 6844 break;
19438 b = pSlice.call(b);
19439 return _deepEqual(a, b);
19440 }
19441 try {
19442 var ka = objectKeys(a),
19443 kb = objectKeys(b),
19444 key, i;
19445 } catch (e) {//happens when one is a string literal and the other isn't
19446 return false;
19447 } 6845 }
19448 // having the same number of owned properties (keys incorporates
19449 // hasOwnProperty)
19450 if (ka.length != kb.length)
19451 return false;
19452 //the same set of keys (although not necessarily the same order),
19453 ka.sort();
19454 kb.sort();
19455 //~~~cheap key test
19456 for (i = ka.length - 1; i >= 0; i--) {
19457 if (ka[i] != kb[i])
19458 return false;
19459 }
19460 //equivalent values for every corresponding key, and
19461 //~~~possibly expensive deep test
19462 for (i = ka.length - 1; i >= 0; i--) {
19463 key = ka[i];
19464 if (!_deepEqual(a[key], b[key])) return false;
19465 }
19466 return true;
19467}
19468 6846
19469// 8. The non-equivalence assertion tests for any deep inequality. 6847 // determine and set charLength / charReceived
19470// assert.notDeepEqual(actual, expected, message_opt); 6848 this.detectIncompleteChar(buffer);
19471 6849
19472assert.notDeepEqual = function notDeepEqual(actual, expected, message) { 6850 var end = buffer.length;
19473 if (_deepEqual(actual, expected)) { 6851 if (this.charLength) {
19474 fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); 6852 // buffer the incomplete character bytes we got
6853 buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
6854 end -= this.charReceived;
19475 } 6855 }
19476};
19477 6856
19478// 9. The strict equality assertion tests strict equality, as determined by ===. 6857 charStr += buffer.toString(this.encoding, 0, end);
19479// assert.strictEqual(actual, expected, message_opt);
19480 6858
19481assert.strictEqual = function strictEqual(actual, expected, message) { 6859 var end = charStr.length - 1;
19482 if (actual !== expected) { 6860 var charCode = charStr.charCodeAt(end);
19483 fail(actual, expected, message, '===', assert.strictEqual); 6861 // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
6862 if (charCode >= 0xD800 && charCode <= 0xDBFF) {
6863 var size = this.surrogateSize;
6864 this.charLength += size;
6865 this.charReceived += size;
6866 this.charBuffer.copy(this.charBuffer, size, 0, size);
6867 buffer.copy(this.charBuffer, 0, 0, size);
6868 return charStr.substring(0, end);
19484 } 6869 }
19485};
19486
19487// 10. The strict non-equality assertion tests for strict inequality, as
19488// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
19489 6870
19490assert.notStrictEqual = function notStrictEqual(actual, expected, message) { 6871 // or just emit the charStr
19491 if (actual === expected) { 6872 return charStr;
19492 fail(actual, expected, message, '!==', assert.notStrictEqual);
19493 }
19494}; 6873};
19495 6874
19496function expectedException(actual, expected) { 6875// detectIncompleteChar determines if there is an incomplete UTF-8 character at
19497 if (!actual || !expected) { 6876// the end of the given buffer. If so, it sets this.charLength to the byte
19498 return false; 6877// length that character, and sets this.charReceived to the number of bytes
19499 } 6878// that are available for this character.
19500 6879StringDecoder.prototype.detectIncompleteChar = function(buffer) {
19501 if (Object.prototype.toString.call(expected) == '[object RegExp]') { 6880 // determine how many bytes we have to check at the end of this buffer
19502 return expected.test(actual); 6881 var i = (buffer.length >= 3) ? 3 : buffer.length;
19503 } else if (actual instanceof expected) {
19504 return true;
19505 } else if (expected.call({}, actual) === true) {
19506 return true;
19507 }
19508
19509 return false;
19510}
19511 6882
19512function _throws(shouldThrow, block, expected, message) { 6883 // Figure out if one of the last i bytes of our buffer announces an
19513 var actual; 6884 // incomplete char.
6885 for (; i > 0; i--) {
6886 var c = buffer[buffer.length - i];
19514 6887
19515 if (util.isString(expected)) { 6888 // See http://en.wikipedia.org/wiki/UTF-8#Description
19516 message = expected;
19517 expected = null;
19518 }
19519 6889
19520 try { 6890 // 110XXXXX
19521 block(); 6891 if (i == 1 && c >> 5 == 0x06) {
19522 } catch (e) { 6892 this.charLength = 2;
19523 actual = e; 6893 break;
19524 } 6894 }
19525 6895
19526 message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + 6896 // 1110XXXX
19527 (message ? ' ' + message : '.'); 6897 if (i <= 2 && c >> 4 == 0x0E) {
6898 this.charLength = 3;
6899 break;
6900 }
19528 6901
19529 if (shouldThrow && !actual) { 6902 // 11110XXX
19530 fail(actual, expected, 'Missing expected exception' + message); 6903 if (i <= 3 && c >> 3 == 0x1E) {
6904 this.charLength = 4;
6905 break;
6906 }
19531 } 6907 }
6908 this.charReceived = i;
6909};
19532 6910
19533 if (!shouldThrow && expectedException(actual, expected)) { 6911StringDecoder.prototype.end = function(buffer) {
19534 fail(actual, expected, 'Got unwanted exception' + message); 6912 var res = '';
19535 } 6913 if (buffer && buffer.length)
6914 res = this.write(buffer);
19536 6915
19537 if ((shouldThrow && actual && expected && 6916 if (this.charReceived) {
19538 !expectedException(actual, expected)) || (!shouldThrow && actual)) { 6917 var cr = this.charReceived;
19539 throw actual; 6918 var buf = this.charBuffer;
6919 var enc = this.encoding;
6920 res += buf.slice(0, cr).toString(enc);
19540 } 6921 }
19541}
19542
19543// 11. Expected to throw an error:
19544// assert.throws(block, Error_opt, message_opt);
19545 6922
19546assert.throws = function(block, /*optional*/error, /*optional*/message) { 6923 return res;
19547 _throws.apply(this, [true].concat(pSlice.call(arguments)));
19548}; 6924};
19549 6925
19550// EXTENSION! This is annoying to write outside this module. 6926function passThroughWrite(buffer) {
19551assert.doesNotThrow = function(block, /*optional*/message) { 6927 return buffer.toString(this.encoding);
19552 _throws.apply(this, [false].concat(pSlice.call(arguments))); 6928}
19553};
19554 6929
19555assert.ifError = function(err) { if (err) {throw err;}}; 6930function utf16DetectIncompleteChar(buffer) {
6931 this.charReceived = buffer.length % 2;
6932 this.charLength = this.charReceived ? 2 : 0;
6933}
19556 6934
19557var objectKeys = Object.keys || function (obj) { 6935function base64DetectIncompleteChar(buffer) {
19558 var keys = []; 6936 this.charReceived = buffer.length % 3;
19559 for (var key in obj) { 6937 this.charLength = this.charReceived ? 3 : 0;
19560 if (hasOwn.call(obj, key)) keys.push(key); 6938}
19561 }
19562 return keys;
19563};
19564 6939
19565},{"util/":6}],5:[function(_dereq_,module,exports){ 6940},{"buffer":7}],28:[function(require,module,exports){
19566module.exports = function isBuffer(arg) { 6941module.exports = function isBuffer(arg) {
19567 return arg && typeof arg === 'object' 6942 return arg && typeof arg === 'object'
19568 && typeof arg.copy === 'function' 6943 && typeof arg.copy === 'function'
19569 && typeof arg.fill === 'function' 6944 && typeof arg.fill === 'function'
19570 && typeof arg.readUInt8 === 'function'; 6945 && typeof arg.readUInt8 === 'function';
19571} 6946}
19572},{}],6:[function(_dereq_,module,exports){ 6947},{}],29:[function(require,module,exports){
19573(function (process,global){ 6948(function (process,global){
19574// Copyright Joyent, Inc. and other Node contributors. 6949// Copyright Joyent, Inc. and other Node contributors.
19575// 6950//
@@ -20096,7 +7471,7 @@ function isPrimitive(arg) {
20096} 7471}
20097exports.isPrimitive = isPrimitive; 7472exports.isPrimitive = isPrimitive;
20098 7473
20099exports.isBuffer = _dereq_('./support/isBuffer'); 7474exports.isBuffer = require('./support/isBuffer');
20100 7475
20101function objectToString(o) { 7476function objectToString(o) {
20102 return Object.prototype.toString.call(o); 7477 return Object.prototype.toString.call(o);
@@ -20140,7 +7515,7 @@ exports.log = function() {
20140 * prototype. 7515 * prototype.
20141 * @param {function} superCtor Constructor function to inherit prototype from. 7516 * @param {function} superCtor Constructor function to inherit prototype from.
20142 */ 7517 */
20143exports.inherits = _dereq_('inherits'); 7518exports.inherits = require('inherits');
20144 7519
20145exports._extend = function(origin, add) { 7520exports._extend = function(origin, add) {
20146 // Don't do anything if add isn't an object 7521 // Don't do anything if add isn't an object
@@ -20158,1627 +7533,236 @@ function hasOwnProperty(obj, prop) {
20158 return Object.prototype.hasOwnProperty.call(obj, prop); 7533 return Object.prototype.hasOwnProperty.call(obj, prop);
20159} 7534}
20160 7535
20161}).call(this,_dereq_("FWaASH"),typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) 7536}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
20162},{"./support/isBuffer":5,"FWaASH":12,"inherits":11}],7:[function(_dereq_,module,exports){ 7537},{"./support/isBuffer":28,"_process":14,"inherits":12}],30:[function(require,module,exports){
20163 7538// Base58 encoding/decoding
20164},{}],8:[function(_dereq_,module,exports){ 7539// Originally written by Mike Hearn for BitcoinJ
20165/*! 7540// Copyright (c) 2011 Google Inc
20166 * The buffer module from node.js, for the browser. 7541// Ported to JavaScript by Stefan Thomas
20167 * 7542// Merged Buffer refactorings from base58-native by Stephen Pair
20168 * at author Feross Aboukhadijeh <feross@feross.org> <http://feross.org> 7543// Copyright (c) 2013 BitPay Inc
20169 * at license MIT
20170 */
20171
20172var base64 = _dereq_('base64-js')
20173var ieee754 = _dereq_('ieee754')
20174
20175exports.Buffer = Buffer
20176exports.SlowBuffer = Buffer
20177exports.INSPECT_MAX_BYTES = 50
20178Buffer.poolSize = 8192
20179
20180/**
20181 * If `Buffer._useTypedArrays`:
20182 * === true Use Uint8Array implementation (fastest)
20183 * === false Use Object implementation (compatible down to IE6)
20184 */
20185Buffer._useTypedArrays = (function () {
20186 // Detect if browser supports Typed Arrays. Supported browsers are IE 10+, Firefox 4+,
20187 // Chrome 7+, Safari 5.1+, Opera 11.6+, iOS 4.2+. If the browser does not support adding
20188 // properties to `Uint8Array` instances, then that's the same as no `Uint8Array` support
20189 // because we need to be able to add all the node Buffer API methods. This is an issue
20190 // in Firefox 4-29. Now fixed: https://bugzilla.mozilla.org/show_bug.cgi?id=695438
20191 try {
20192 var buf = new ArrayBuffer(0)
20193 var arr = new Uint8Array(buf)
20194 arr.foo = function () { return 42 }
20195 return 42 === arr.foo() &&
20196 typeof arr.subarray === 'function' // Chrome 9-10 lack `subarray`
20197 } catch (e) {
20198 return false
20199 }
20200})()
20201
20202/**
20203 * Class: Buffer
20204 * =============
20205 *
20206 * The Buffer constructor returns instances of `Uint8Array` that are augmented
20207 * with function properties for all the node `Buffer` API functions. We use
20208 * `Uint8Array` so that square bracket notation works as expected -- it returns
20209 * a single octet.
20210 *
20211 * By augmenting the instances, we can avoid modifying the `Uint8Array`
20212 * prototype.
20213 */
20214function Buffer (subject, encoding, noZero) {
20215 if (!(this instanceof Buffer))
20216 return new Buffer(subject, encoding, noZero)
20217
20218 var type = typeof subject
20219
20220 if (encoding === 'base64' && type === 'string') {
20221 subject = base64clean(subject)
20222 }
20223
20224 // Find the length
20225 var length
20226 if (type === 'number')
20227 length = coerce(subject)
20228 else if (type === 'string')
20229 length = Buffer.byteLength(subject, encoding)
20230 else if (type === 'object')
20231 length = coerce(subject.length) // assume that object is array-like
20232 else
20233 throw new Error('First argument needs to be a number, array or string.')
20234
20235 var buf
20236 if (Buffer._useTypedArrays) {
20237 // Preferred: Return an augmented `Uint8Array` instance for best performance
20238 buf = Buffer._augment(new Uint8Array(length))
20239 } else {
20240 // Fallback: Return THIS instance of Buffer (created by `new`)
20241 buf = this
20242 buf.length = length
20243 buf._isBuffer = true
20244 }
20245
20246 var i
20247 if (Buffer._useTypedArrays && typeof subject.byteLength === 'number') {
20248 // Speed optimization -- use set if we're copying from a typed array
20249 buf._set(subject)
20250 } else if (isArrayish(subject)) {
20251 // Treat array-ish objects as a byte array
20252 if (Buffer.isBuffer(subject)) {
20253 for (i = 0; i < length; i++)
20254 buf[i] = subject.readUInt8(i)
20255 } else {
20256 for (i = 0; i < length; i++)
20257 buf[i] = ((subject[i] % 256) + 256) % 256
20258 }
20259 } else if (type === 'string') {
20260 buf.write(subject, 0, encoding)
20261 } else if (type === 'number' && !Buffer._useTypedArrays && !noZero) {
20262 for (i = 0; i < length; i++) {
20263 buf[i] = 0
20264 }
20265 }
20266
20267 return buf
20268}
20269
20270// STATIC METHODS
20271// ==============
20272
20273Buffer.isEncoding = function (encoding) {
20274 switch (String(encoding).toLowerCase()) {
20275 case 'hex':
20276 case 'utf8':
20277 case 'utf-8':
20278 case 'ascii':
20279 case 'binary':
20280 case 'base64':
20281 case 'raw':
20282 case 'ucs2':
20283 case 'ucs-2':
20284 case 'utf16le':
20285 case 'utf-16le':
20286 return true
20287 default:
20288 return false
20289 }
20290}
20291
20292Buffer.isBuffer = function (b) {
20293 return !!(b !== null && b !== undefined && b._isBuffer)
20294}
20295 7544
20296Buffer.byteLength = function (str, encoding) { 7545var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
20297 var ret 7546var ALPHABET_MAP = {}
20298 str = str.toString() 7547for(var i = 0; i < ALPHABET.length; i++) {
20299 switch (encoding || 'utf8') { 7548 ALPHABET_MAP[ALPHABET.charAt(i)] = i
20300 case 'hex':
20301 ret = str.length / 2
20302 break
20303 case 'utf8':
20304 case 'utf-8':
20305 ret = utf8ToBytes(str).length
20306 break
20307 case 'ascii':
20308 case 'binary':
20309 case 'raw':
20310 ret = str.length
20311 break
20312 case 'base64':
20313 ret = base64ToBytes(str).length
20314 break
20315 case 'ucs2':
20316 case 'ucs-2':
20317 case 'utf16le':
20318 case 'utf-16le':
20319 ret = str.length * 2
20320 break
20321 default:
20322 throw new Error('Unknown encoding')
20323 }
20324 return ret
20325} 7549}
7550var BASE = 58
20326 7551
20327Buffer.concat = function (list, totalLength) { 7552function encode(buffer) {
20328 assert(isArray(list), 'Usage: Buffer.concat(list[, length])') 7553 if (buffer.length === 0) return ''
20329
20330 if (list.length === 0) {
20331 return new Buffer(0)
20332 } else if (list.length === 1) {
20333 return list[0]
20334 }
20335
20336 var i
20337 if (totalLength === undefined) {
20338 totalLength = 0
20339 for (i = 0; i < list.length; i++) {
20340 totalLength += list[i].length
20341 }
20342 }
20343 7554
20344 var buf = new Buffer(totalLength) 7555 var i, j, digits = [0]
20345 var pos = 0 7556 for (i = 0; i < buffer.length; i++) {
20346 for (i = 0; i < list.length; i++) { 7557 for (j = 0; j < digits.length; j++) digits[j] <<= 8
20347 var item = list[i]
20348 item.copy(buf, pos)
20349 pos += item.length
20350 }
20351 return buf
20352}
20353 7558
20354Buffer.compare = function (a, b) { 7559 digits[0] += buffer[i]
20355 assert(Buffer.isBuffer(a) && Buffer.isBuffer(b), 'Arguments must be Buffers')
20356 var x = a.length
20357 var y = b.length
20358 for (var i = 0, len = Math.min(x, y); i < len && a[i] === b[i]; i++) {}
20359 if (i !== len) {
20360 x = a[i]
20361 y = b[i]
20362 }
20363 if (x < y) {
20364 return -1
20365 }
20366 if (y < x) {
20367 return 1
20368 }
20369 return 0
20370}
20371 7560
20372// BUFFER INSTANCE METHODS 7561 var carry = 0
20373// ======================= 7562 for (j = 0; j < digits.length; ++j) {
7563 digits[j] += carry
20374 7564
20375function hexWrite (buf, string, offset, length) { 7565 carry = (digits[j] / BASE) | 0
20376 offset = Number(offset) || 0 7566 digits[j] %= BASE
20377 var remaining = buf.length - offset
20378 if (!length) {
20379 length = remaining
20380 } else {
20381 length = Number(length)
20382 if (length > remaining) {
20383 length = remaining
20384 } 7567 }
20385 }
20386 7568
20387 // must be an even number of digits 7569 while (carry) {
20388 var strLen = string.length 7570 digits.push(carry % BASE)
20389 assert(strLen % 2 === 0, 'Invalid hex string')
20390 7571
20391 if (length > strLen / 2) { 7572 carry = (carry / BASE) | 0
20392 length = strLen / 2
20393 }
20394 for (var i = 0; i < length; i++) {
20395 var byte = parseInt(string.substr(i * 2, 2), 16)
20396 assert(!isNaN(byte), 'Invalid hex string')
20397 buf[offset + i] = byte
20398 }
20399 return i
20400}
20401
20402function utf8Write (buf, string, offset, length) {
20403 var charsWritten = blitBuffer(utf8ToBytes(string), buf, offset, length)
20404 return charsWritten
20405}
20406
20407function asciiWrite (buf, string, offset, length) {
20408 var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length)
20409 return charsWritten
20410}
20411
20412function binaryWrite (buf, string, offset, length) {
20413 return asciiWrite(buf, string, offset, length)
20414}
20415
20416function base64Write (buf, string, offset, length) {
20417 var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length)
20418 return charsWritten
20419}
20420
20421function utf16leWrite (buf, string, offset, length) {
20422 var charsWritten = blitBuffer(utf16leToBytes(string), buf, offset, length)
20423 return charsWritten
20424}
20425
20426Buffer.prototype.write = function (string, offset, length, encoding) {
20427 // Support both (string, offset, length, encoding)
20428 // and the legacy (string, encoding, offset, length)
20429 if (isFinite(offset)) {
20430 if (!isFinite(length)) {
20431 encoding = length
20432 length = undefined
20433 }
20434 } else { // legacy
20435 var swap = encoding
20436 encoding = offset
20437 offset = length
20438 length = swap
20439 }
20440
20441 offset = Number(offset) || 0
20442 var remaining = this.length - offset
20443 if (!length) {
20444 length = remaining
20445 } else {
20446 length = Number(length)
20447 if (length > remaining) {
20448 length = remaining
20449 } 7573 }
20450 } 7574 }
20451 encoding = String(encoding || 'utf8').toLowerCase()
20452
20453 var ret
20454 switch (encoding) {
20455 case 'hex':
20456 ret = hexWrite(this, string, offset, length)
20457 break
20458 case 'utf8':
20459 case 'utf-8':
20460 ret = utf8Write(this, string, offset, length)
20461 break
20462 case 'ascii':
20463 ret = asciiWrite(this, string, offset, length)
20464 break
20465 case 'binary':
20466 ret = binaryWrite(this, string, offset, length)
20467 break
20468 case 'base64':
20469 ret = base64Write(this, string, offset, length)
20470 break
20471 case 'ucs2':
20472 case 'ucs-2':
20473 case 'utf16le':
20474 case 'utf-16le':
20475 ret = utf16leWrite(this, string, offset, length)
20476 break
20477 default:
20478 throw new Error('Unknown encoding')
20479 }
20480 return ret
20481}
20482
20483Buffer.prototype.toString = function (encoding, start, end) {
20484 var self = this
20485 7575
20486 encoding = String(encoding || 'utf8').toLowerCase() 7576 // deal with leading zeros
20487 start = Number(start) || 0 7577 for (i = 0; buffer[i] === 0 && i < buffer.length - 1; i++) digits.push(0)
20488 end = (end === undefined) ? self.length : Number(end)
20489
20490 // Fastpath empty strings
20491 if (end === start)
20492 return ''
20493
20494 var ret
20495 switch (encoding) {
20496 case 'hex':
20497 ret = hexSlice(self, start, end)
20498 break
20499 case 'utf8':
20500 case 'utf-8':
20501 ret = utf8Slice(self, start, end)
20502 break
20503 case 'ascii':
20504 ret = asciiSlice(self, start, end)
20505 break
20506 case 'binary':
20507 ret = binarySlice(self, start, end)
20508 break
20509 case 'base64':
20510 ret = base64Slice(self, start, end)
20511 break
20512 case 'ucs2':
20513 case 'ucs-2':
20514 case 'utf16le':
20515 case 'utf-16le':
20516 ret = utf16leSlice(self, start, end)
20517 break
20518 default:
20519 throw new Error('Unknown encoding')
20520 }
20521 return ret
20522}
20523 7578
20524Buffer.prototype.toJSON = function () { 7579 // convert digits to a string
20525 return { 7580 var stringOutput = ""
20526 type: 'Buffer', 7581 for (var i = digits.length - 1; i >= 0; i--) {
20527 data: Array.prototype.slice.call(this._arr || this, 0) 7582 stringOutput = stringOutput + ALPHABET[digits[i]]
20528 } 7583 }
7584 return stringOutput
20529} 7585}
20530 7586
20531Buffer.prototype.equals = function (b) { 7587function decode(string) {
20532 assert(Buffer.isBuffer(b), 'Argument must be a Buffer') 7588 if (string.length === 0) return []
20533 return Buffer.compare(this, b) === 0
20534}
20535
20536Buffer.prototype.compare = function (b) {
20537 assert(Buffer.isBuffer(b), 'Argument must be a Buffer')
20538 return Buffer.compare(this, b)
20539}
20540
20541// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
20542Buffer.prototype.copy = function (target, target_start, start, end) {
20543 var source = this
20544
20545 if (!start) start = 0
20546 if (!end && end !== 0) end = this.length
20547 if (!target_start) target_start = 0
20548
20549 // Copy 0 bytes; we're done
20550 if (end === start) return
20551 if (target.length === 0 || source.length === 0) return
20552
20553 // Fatal error conditions
20554 assert(end >= start, 'sourceEnd < sourceStart')
20555 assert(target_start >= 0 && target_start < target.length,
20556 'targetStart out of bounds')
20557 assert(start >= 0 && start < source.length, 'sourceStart out of bounds')
20558 assert(end >= 0 && end <= source.length, 'sourceEnd out of bounds')
20559
20560 // Are we oob?
20561 if (end > this.length)
20562 end = this.length
20563 if (target.length - target_start < end - start)
20564 end = target.length - target_start + start
20565
20566 var len = end - start
20567 7589
20568 if (len < 100 || !Buffer._useTypedArrays) { 7590 var i, j, bytes = [0]
20569 for (var i = 0; i < len; i++) { 7591 for (i = 0; i < string.length; i++) {
20570 target[i + target_start] = this[i + start] 7592 var c = string[i]
20571 } 7593 if (!(c in ALPHABET_MAP)) throw new Error('Non-base58 character')
20572 } else {
20573 target._set(this.subarray(start, start + len), target_start)
20574 }
20575}
20576 7594
20577function base64Slice (buf, start, end) { 7595 for (j = 0; j < bytes.length; j++) bytes[j] *= BASE
20578 if (start === 0 && end === buf.length) { 7596 bytes[0] += ALPHABET_MAP[c]
20579 return base64.fromByteArray(buf)
20580 } else {
20581 return base64.fromByteArray(buf.slice(start, end))
20582 }
20583}
20584 7597
20585function utf8Slice (buf, start, end) { 7598 var carry = 0
20586 var res = '' 7599 for (j = 0; j < bytes.length; ++j) {
20587 var tmp = '' 7600 bytes[j] += carry
20588 end = Math.min(buf.length, end)
20589 7601
20590 for (var i = start; i < end; i++) { 7602 carry = bytes[j] >> 8
20591 if (buf[i] <= 0x7F) { 7603 bytes[j] &= 0xff
20592 res += decodeUtf8Char(tmp) + String.fromCharCode(buf[i])
20593 tmp = ''
20594 } else {
20595 tmp += '%' + buf[i].toString(16)
20596 } 7604 }
20597 }
20598
20599 return res + decodeUtf8Char(tmp)
20600}
20601
20602function asciiSlice (buf, start, end) {
20603 var ret = ''
20604 end = Math.min(buf.length, end)
20605
20606 for (var i = start; i < end; i++) {
20607 ret += String.fromCharCode(buf[i])
20608 }
20609 return ret
20610}
20611
20612function binarySlice (buf, start, end) {
20613 return asciiSlice(buf, start, end)
20614}
20615
20616function hexSlice (buf, start, end) {
20617 var len = buf.length
20618
20619 if (!start || start < 0) start = 0
20620 if (!end || end < 0 || end > len) end = len
20621
20622 var out = ''
20623 for (var i = start; i < end; i++) {
20624 out += toHex(buf[i])
20625 }
20626 return out
20627}
20628 7605
20629function utf16leSlice (buf, start, end) { 7606 while (carry) {
20630 var bytes = buf.slice(start, end) 7607 bytes.push(carry & 0xff)
20631 var res = ''
20632 for (var i = 0; i < bytes.length; i += 2) {
20633 res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
20634 }
20635 return res
20636}
20637 7608
20638Buffer.prototype.slice = function (start, end) { 7609 carry >>= 8
20639 var len = this.length
20640 start = clamp(start, len, 0)
20641 end = clamp(end, len, len)
20642
20643 if (Buffer._useTypedArrays) {
20644 return Buffer._augment(this.subarray(start, end))
20645 } else {
20646 var sliceLen = end - start
20647 var newBuf = new Buffer(sliceLen, undefined, true)
20648 for (var i = 0; i < sliceLen; i++) {
20649 newBuf[i] = this[i + start]
20650 } 7610 }
20651 return newBuf
20652 }
20653}
20654
20655// `get` will be removed in Node 0.13+
20656Buffer.prototype.get = function (offset) {
20657 console.log('.get() is deprecated. Access using array indexes instead.')
20658 return this.readUInt8(offset)
20659}
20660
20661// `set` will be removed in Node 0.13+
20662Buffer.prototype.set = function (v, offset) {
20663 console.log('.set() is deprecated. Access using array indexes instead.')
20664 return this.writeUInt8(v, offset)
20665}
20666
20667Buffer.prototype.readUInt8 = function (offset, noAssert) {
20668 if (!noAssert) {
20669 assert(offset !== undefined && offset !== null, 'missing offset')
20670 assert(offset < this.length, 'Trying to read beyond buffer length')
20671 }
20672
20673 if (offset >= this.length)
20674 return
20675
20676 return this[offset]
20677}
20678
20679function readUInt16 (buf, offset, littleEndian, noAssert) {
20680 if (!noAssert) {
20681 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20682 assert(offset !== undefined && offset !== null, 'missing offset')
20683 assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')
20684 }
20685
20686 var len = buf.length
20687 if (offset >= len)
20688 return
20689
20690 var val
20691 if (littleEndian) {
20692 val = buf[offset]
20693 if (offset + 1 < len)
20694 val |= buf[offset + 1] << 8
20695 } else {
20696 val = buf[offset] << 8
20697 if (offset + 1 < len)
20698 val |= buf[offset + 1]
20699 }
20700 return val
20701}
20702
20703Buffer.prototype.readUInt16LE = function (offset, noAssert) {
20704 return readUInt16(this, offset, true, noAssert)
20705}
20706
20707Buffer.prototype.readUInt16BE = function (offset, noAssert) {
20708 return readUInt16(this, offset, false, noAssert)
20709}
20710
20711function readUInt32 (buf, offset, littleEndian, noAssert) {
20712 if (!noAssert) {
20713 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20714 assert(offset !== undefined && offset !== null, 'missing offset')
20715 assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
20716 } 7611 }
20717 7612
20718 var len = buf.length 7613 // deal with leading zeros
20719 if (offset >= len) 7614 for (i = 0; string[i] === '1' && i < string.length - 1; i++) bytes.push(0)
20720 return
20721
20722 var val
20723 if (littleEndian) {
20724 if (offset + 2 < len)
20725 val = buf[offset + 2] << 16
20726 if (offset + 1 < len)
20727 val |= buf[offset + 1] << 8
20728 val |= buf[offset]
20729 if (offset + 3 < len)
20730 val = val + (buf[offset + 3] << 24 >>> 0)
20731 } else {
20732 if (offset + 1 < len)
20733 val = buf[offset + 1] << 16
20734 if (offset + 2 < len)
20735 val |= buf[offset + 2] << 8
20736 if (offset + 3 < len)
20737 val |= buf[offset + 3]
20738 val = val + (buf[offset] << 24 >>> 0)
20739 }
20740 return val
20741}
20742
20743Buffer.prototype.readUInt32LE = function (offset, noAssert) {
20744 return readUInt32(this, offset, true, noAssert)
20745}
20746
20747Buffer.prototype.readUInt32BE = function (offset, noAssert) {
20748 return readUInt32(this, offset, false, noAssert)
20749}
20750
20751Buffer.prototype.readInt8 = function (offset, noAssert) {
20752 if (!noAssert) {
20753 assert(offset !== undefined && offset !== null,
20754 'missing offset')
20755 assert(offset < this.length, 'Trying to read beyond buffer length')
20756 }
20757
20758 if (offset >= this.length)
20759 return
20760
20761 var neg = this[offset] & 0x80
20762 if (neg)
20763 return (0xff - this[offset] + 1) * -1
20764 else
20765 return this[offset]
20766}
20767
20768function readInt16 (buf, offset, littleEndian, noAssert) {
20769 if (!noAssert) {
20770 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20771 assert(offset !== undefined && offset !== null, 'missing offset')
20772 assert(offset + 1 < buf.length, 'Trying to read beyond buffer length')
20773 }
20774
20775 var len = buf.length
20776 if (offset >= len)
20777 return
20778
20779 var val = readUInt16(buf, offset, littleEndian, true)
20780 var neg = val & 0x8000
20781 if (neg)
20782 return (0xffff - val + 1) * -1
20783 else
20784 return val
20785}
20786
20787Buffer.prototype.readInt16LE = function (offset, noAssert) {
20788 return readInt16(this, offset, true, noAssert)
20789}
20790
20791Buffer.prototype.readInt16BE = function (offset, noAssert) {
20792 return readInt16(this, offset, false, noAssert)
20793}
20794
20795function readInt32 (buf, offset, littleEndian, noAssert) {
20796 if (!noAssert) {
20797 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20798 assert(offset !== undefined && offset !== null, 'missing offset')
20799 assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
20800 }
20801
20802 var len = buf.length
20803 if (offset >= len)
20804 return
20805
20806 var val = readUInt32(buf, offset, littleEndian, true)
20807 var neg = val & 0x80000000
20808 if (neg)
20809 return (0xffffffff - val + 1) * -1
20810 else
20811 return val
20812}
20813
20814Buffer.prototype.readInt32LE = function (offset, noAssert) {
20815 return readInt32(this, offset, true, noAssert)
20816}
20817
20818Buffer.prototype.readInt32BE = function (offset, noAssert) {
20819 return readInt32(this, offset, false, noAssert)
20820}
20821
20822function readFloat (buf, offset, littleEndian, noAssert) {
20823 if (!noAssert) {
20824 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20825 assert(offset + 3 < buf.length, 'Trying to read beyond buffer length')
20826 }
20827
20828 return ieee754.read(buf, offset, littleEndian, 23, 4)
20829}
20830
20831Buffer.prototype.readFloatLE = function (offset, noAssert) {
20832 return readFloat(this, offset, true, noAssert)
20833}
20834
20835Buffer.prototype.readFloatBE = function (offset, noAssert) {
20836 return readFloat(this, offset, false, noAssert)
20837}
20838
20839function readDouble (buf, offset, littleEndian, noAssert) {
20840 if (!noAssert) {
20841 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20842 assert(offset + 7 < buf.length, 'Trying to read beyond buffer length')
20843 }
20844
20845 return ieee754.read(buf, offset, littleEndian, 52, 8)
20846}
20847
20848Buffer.prototype.readDoubleLE = function (offset, noAssert) {
20849 return readDouble(this, offset, true, noAssert)
20850}
20851
20852Buffer.prototype.readDoubleBE = function (offset, noAssert) {
20853 return readDouble(this, offset, false, noAssert)
20854}
20855
20856Buffer.prototype.writeUInt8 = function (value, offset, noAssert) {
20857 if (!noAssert) {
20858 assert(value !== undefined && value !== null, 'missing value')
20859 assert(offset !== undefined && offset !== null, 'missing offset')
20860 assert(offset < this.length, 'trying to write beyond buffer length')
20861 verifuint(value, 0xff)
20862 }
20863
20864 if (offset >= this.length) return
20865
20866 this[offset] = value
20867 return offset + 1
20868}
20869
20870function writeUInt16 (buf, value, offset, littleEndian, noAssert) {
20871 if (!noAssert) {
20872 assert(value !== undefined && value !== null, 'missing value')
20873 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20874 assert(offset !== undefined && offset !== null, 'missing offset')
20875 assert(offset + 1 < buf.length, 'trying to write beyond buffer length')
20876 verifuint(value, 0xffff)
20877 }
20878
20879 var len = buf.length
20880 if (offset >= len)
20881 return
20882
20883 for (var i = 0, j = Math.min(len - offset, 2); i < j; i++) {
20884 buf[offset + i] =
20885 (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
20886 (littleEndian ? i : 1 - i) * 8
20887 }
20888 return offset + 2
20889}
20890 7615
20891Buffer.prototype.writeUInt16LE = function (value, offset, noAssert) { 7616 return bytes.reverse()
20892 return writeUInt16(this, value, offset, true, noAssert)
20893} 7617}
20894 7618
20895Buffer.prototype.writeUInt16BE = function (value, offset, noAssert) { 7619module.exports = {
20896 return writeUInt16(this, value, offset, false, noAssert) 7620 encode: encode,
7621 decode: decode
20897} 7622}
20898 7623
20899function writeUInt32 (buf, value, offset, littleEndian, noAssert) { 7624},{}],31:[function(require,module,exports){
20900 if (!noAssert) { 7625(function (Buffer){
20901 assert(value !== undefined && value !== null, 'missing value') 7626'use strict'
20902 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20903 assert(offset !== undefined && offset !== null, 'missing offset')
20904 assert(offset + 3 < buf.length, 'trying to write beyond buffer length')
20905 verifuint(value, 0xffffffff)
20906 }
20907
20908 var len = buf.length
20909 if (offset >= len)
20910 return
20911
20912 for (var i = 0, j = Math.min(len - offset, 4); i < j; i++) {
20913 buf[offset + i] =
20914 (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
20915 }
20916 return offset + 4
20917}
20918 7627
20919Buffer.prototype.writeUInt32LE = function (value, offset, noAssert) { 7628var base58 = require('bs58')
20920 return writeUInt32(this, value, offset, true, noAssert) 7629var createHash = require('create-hash')
20921}
20922 7630
20923Buffer.prototype.writeUInt32BE = function (value, offset, noAssert) { 7631// SHA256(SHA256(buffer))
20924 return writeUInt32(this, value, offset, false, noAssert) 7632function sha256x2 (buffer) {
7633 buffer = createHash('sha256').update(buffer).digest()
7634 return createHash('sha256').update(buffer).digest()
20925} 7635}
20926 7636
20927Buffer.prototype.writeInt8 = function (value, offset, noAssert) { 7637// Encode a buffer as a base58-check encoded string
20928 if (!noAssert) { 7638function encode (payload) {
20929 assert(value !== undefined && value !== null, 'missing value') 7639 var checksum = sha256x2(payload).slice(0, 4)
20930 assert(offset !== undefined && offset !== null, 'missing offset')
20931 assert(offset < this.length, 'Trying to write beyond buffer length')
20932 verifsint(value, 0x7f, -0x80)
20933 }
20934 7640
20935 if (offset >= this.length) 7641 return base58.encode(Buffer.concat([
20936 return 7642 payload,
20937 7643 checksum
20938 if (value >= 0) 7644 ]))
20939 this.writeUInt8(value, offset, noAssert)
20940 else
20941 this.writeUInt8(0xff + value + 1, offset, noAssert)
20942 return offset + 1
20943} 7645}
20944 7646
20945function writeInt16 (buf, value, offset, littleEndian, noAssert) { 7647// Decode a base58-check encoded string to a buffer
20946 if (!noAssert) { 7648function decode (string) {
20947 assert(value !== undefined && value !== null, 'missing value') 7649 var buffer = new Buffer(base58.decode(string))
20948 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20949 assert(offset !== undefined && offset !== null, 'missing offset')
20950 assert(offset + 1 < buf.length, 'Trying to write beyond buffer length')
20951 verifsint(value, 0x7fff, -0x8000)
20952 }
20953
20954 var len = buf.length
20955 if (offset >= len)
20956 return
20957 7650
20958 if (value >= 0) 7651 var payload = buffer.slice(0, -4)
20959 writeUInt16(buf, value, offset, littleEndian, noAssert) 7652 var checksum = buffer.slice(-4)
20960 else 7653 var newChecksum = sha256x2(payload).slice(0, 4)
20961 writeUInt16(buf, 0xffff + value + 1, offset, littleEndian, noAssert)
20962 return offset + 2
20963}
20964 7654
20965Buffer.prototype.writeInt16LE = function (value, offset, noAssert) { 7655 for (var i = 0; i < newChecksum.length; ++i) {
20966 return writeInt16(this, value, offset, true, noAssert) 7656 if (newChecksum[i] === checksum[i]) continue
20967}
20968 7657
20969Buffer.prototype.writeInt16BE = function (value, offset, noAssert) { 7658 throw new Error('Invalid checksum')
20970 return writeInt16(this, value, offset, false, noAssert)
20971}
20972
20973function writeInt32 (buf, value, offset, littleEndian, noAssert) {
20974 if (!noAssert) {
20975 assert(value !== undefined && value !== null, 'missing value')
20976 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
20977 assert(offset !== undefined && offset !== null, 'missing offset')
20978 assert(offset + 3 < buf.length, 'Trying to write beyond buffer length')
20979 verifsint(value, 0x7fffffff, -0x80000000)
20980 } 7659 }
20981 7660
20982 var len = buf.length 7661 return payload
20983 if (offset >= len)
20984 return
20985
20986 if (value >= 0)
20987 writeUInt32(buf, value, offset, littleEndian, noAssert)
20988 else
20989 writeUInt32(buf, 0xffffffff + value + 1, offset, littleEndian, noAssert)
20990 return offset + 4
20991}
20992
20993Buffer.prototype.writeInt32LE = function (value, offset, noAssert) {
20994 return writeInt32(this, value, offset, true, noAssert)
20995} 7662}
20996 7663
20997Buffer.prototype.writeInt32BE = function (value, offset, noAssert) { 7664module.exports = {
20998 return writeInt32(this, value, offset, false, noAssert) 7665 encode: encode,
7666 decode: decode
20999} 7667}
21000 7668
21001function writeFloat (buf, value, offset, littleEndian, noAssert) { 7669}).call(this,require("buffer").Buffer)
21002 if (!noAssert) { 7670},{"bs58":30,"buffer":7,"create-hash":32}],32:[function(require,module,exports){
21003 assert(value !== undefined && value !== null, 'missing value') 7671(function (Buffer){
21004 assert(typeof littleEndian === 'boolean', 'missing or invalid endian') 7672'use strict';
21005 assert(offset !== undefined && offset !== null, 'missing offset') 7673var inherits = require('inherits')
21006 assert(offset + 3 < buf.length, 'Trying to write beyond buffer length') 7674var md5 = require('./md5')
21007 verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38) 7675var rmd160 = require('ripemd160')
21008 } 7676var sha = require('sha.js')
21009
21010 var len = buf.length
21011 if (offset >= len)
21012 return
21013 7677
21014 ieee754.write(buf, value, offset, littleEndian, 23, 4) 7678var Transform = require('stream').Transform
21015 return offset + 4
21016}
21017 7679
21018Buffer.prototype.writeFloatLE = function (value, offset, noAssert) { 7680function HashNoConstructor(hash) {
21019 return writeFloat(this, value, offset, true, noAssert) 7681 Transform.call(this)
21020}
21021 7682
21022Buffer.prototype.writeFloatBE = function (value, offset, noAssert) { 7683 this._hash = hash
21023 return writeFloat(this, value, offset, false, noAssert) 7684 this.buffers = []
21024} 7685}
21025 7686
21026function writeDouble (buf, value, offset, littleEndian, noAssert) { 7687inherits(HashNoConstructor, Transform)
21027 if (!noAssert) {
21028 assert(value !== undefined && value !== null, 'missing value')
21029 assert(typeof littleEndian === 'boolean', 'missing or invalid endian')
21030 assert(offset !== undefined && offset !== null, 'missing offset')
21031 assert(offset + 7 < buf.length,
21032 'Trying to write beyond buffer length')
21033 verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308)
21034 }
21035 7688
21036 var len = buf.length 7689HashNoConstructor.prototype._transform = function (data, _, next) {
21037 if (offset >= len) 7690 this.buffers.push(data)
21038 return
21039 7691
21040 ieee754.write(buf, value, offset, littleEndian, 52, 8) 7692 next()
21041 return offset + 8
21042} 7693}
21043 7694
21044Buffer.prototype.writeDoubleLE = function (value, offset, noAssert) { 7695HashNoConstructor.prototype._flush = function (next) {
21045 return writeDouble(this, value, offset, true, noAssert) 7696 this.push(this.digest())
21046} 7697 next()
21047
21048Buffer.prototype.writeDoubleBE = function (value, offset, noAssert) {
21049 return writeDouble(this, value, offset, false, noAssert)
21050} 7698}
21051 7699
21052// fill(value, start=0, end=buffer.length) 7700HashNoConstructor.prototype.update = function (data, enc) {
21053Buffer.prototype.fill = function (value, start, end) { 7701 if (typeof data === 'string') {
21054 if (!value) value = 0 7702 data = new Buffer(data, enc)
21055 if (!start) start = 0
21056 if (!end) end = this.length
21057
21058 assert(end >= start, 'end < start')
21059
21060 // Fill 0 bytes; we're done
21061 if (end === start) return
21062 if (this.length === 0) return
21063
21064 assert(start >= 0 && start < this.length, 'start out of bounds')
21065 assert(end >= 0 && end <= this.length, 'end out of bounds')
21066
21067 var i
21068 if (typeof value === 'number') {
21069 for (i = start; i < end; i++) {
21070 this[i] = value
21071 }
21072 } else {
21073 var bytes = utf8ToBytes(value.toString())
21074 var len = bytes.length
21075 for (i = start; i < end; i++) {
21076 this[i] = bytes[i % len]
21077 }
21078 } 7703 }
21079 7704
7705 this.buffers.push(data)
21080 return this 7706 return this
21081} 7707}
21082 7708
21083Buffer.prototype.inspect = function () { 7709HashNoConstructor.prototype.digest = function (enc) {
21084 var out = [] 7710 var buf = Buffer.concat(this.buffers)
21085 var len = this.length 7711 var r = this._hash(buf)
21086 for (var i = 0; i < len; i++) { 7712 this.buffers = null
21087 out[i] = toHex(this[i])
21088 if (i === exports.INSPECT_MAX_BYTES) {
21089 out[i + 1] = '...'
21090 break
21091 }
21092 }
21093 return '<Buffer ' + out.join(' ') + '>'
21094}
21095
21096/**
21097 * Creates a new `ArrayBuffer` with the *copied* memory of the buffer instance.
21098 * Added in Node 0.12. Only available in browsers that support ArrayBuffer.
21099 */
21100Buffer.prototype.toArrayBuffer = function () {
21101 if (typeof Uint8Array !== 'undefined') {
21102 if (Buffer._useTypedArrays) {
21103 return (new Buffer(this)).buffer
21104 } else {
21105 var buf = new Uint8Array(this.length)
21106 for (var i = 0, len = buf.length; i < len; i += 1) {
21107 buf[i] = this[i]
21108 }
21109 return buf.buffer
21110 }
21111 } else {
21112 throw new Error('Buffer.toArrayBuffer not supported in this browser')
21113 }
21114}
21115
21116// HELPER FUNCTIONS
21117// ================
21118
21119var BP = Buffer.prototype
21120
21121/**
21122 * Augment a Uint8Array *instance* (not the Uint8Array class!) with Buffer methods
21123 */
21124Buffer._augment = function (arr) {
21125 arr._isBuffer = true
21126 7713
21127 // save reference to original Uint8Array get/set methods before overwriting 7714 return enc ? r.toString(enc) : r
21128 arr._get = arr.get
21129 arr._set = arr.set
21130
21131 // deprecated, will be removed in node 0.13+
21132 arr.get = BP.get
21133 arr.set = BP.set
21134
21135 arr.write = BP.write
21136 arr.toString = BP.toString
21137 arr.toLocaleString = BP.toString
21138 arr.toJSON = BP.toJSON
21139 arr.equals = BP.equals
21140 arr.compare = BP.compare
21141 arr.copy = BP.copy
21142 arr.slice = BP.slice
21143 arr.readUInt8 = BP.readUInt8
21144 arr.readUInt16LE = BP.readUInt16LE
21145 arr.readUInt16BE = BP.readUInt16BE
21146 arr.readUInt32LE = BP.readUInt32LE
21147 arr.readUInt32BE = BP.readUInt32BE
21148 arr.readInt8 = BP.readInt8
21149 arr.readInt16LE = BP.readInt16LE
21150 arr.readInt16BE = BP.readInt16BE
21151 arr.readInt32LE = BP.readInt32LE
21152 arr.readInt32BE = BP.readInt32BE
21153 arr.readFloatLE = BP.readFloatLE
21154 arr.readFloatBE = BP.readFloatBE
21155 arr.readDoubleLE = BP.readDoubleLE
21156 arr.readDoubleBE = BP.readDoubleBE
21157 arr.writeUInt8 = BP.writeUInt8
21158 arr.writeUInt16LE = BP.writeUInt16LE
21159 arr.writeUInt16BE = BP.writeUInt16BE
21160 arr.writeUInt32LE = BP.writeUInt32LE
21161 arr.writeUInt32BE = BP.writeUInt32BE
21162 arr.writeInt8 = BP.writeInt8
21163 arr.writeInt16LE = BP.writeInt16LE
21164 arr.writeInt16BE = BP.writeInt16BE
21165 arr.writeInt32LE = BP.writeInt32LE
21166 arr.writeInt32BE = BP.writeInt32BE
21167 arr.writeFloatLE = BP.writeFloatLE
21168 arr.writeFloatBE = BP.writeFloatBE
21169 arr.writeDoubleLE = BP.writeDoubleLE
21170 arr.writeDoubleBE = BP.writeDoubleBE
21171 arr.fill = BP.fill
21172 arr.inspect = BP.inspect
21173 arr.toArrayBuffer = BP.toArrayBuffer
21174
21175 return arr
21176} 7715}
21177 7716
21178var INVALID_BASE64_RE = /[^+\/0-9A-z]/g 7717function Hash(hash) {
7718 Transform.call(this)
21179 7719
21180function base64clean (str) { 7720 this._hash = hash
21181 // Node strips out invalid characters like \n and \t from the string, base64-js does not
21182 str = stringtrim(str).replace(INVALID_BASE64_RE, '')
21183 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
21184 while (str.length % 4 !== 0) {
21185 str = str + '='
21186 }
21187 return str
21188} 7721}
21189 7722
21190function stringtrim (str) { 7723inherits(Hash, Transform)
21191 if (str.trim) return str.trim()
21192 return str.replace(/^\s+|\s+$/g, '')
21193}
21194 7724
21195// slice(start, end) 7725Hash.prototype._transform = function (data, enc, next) {
21196function clamp (index, len, defaultValue) { 7726 if (enc) data = new Buffer(data, enc)
21197 if (typeof index !== 'number') return defaultValue
21198 index = ~~index; // Coerce to integer.
21199 if (index >= len) return len
21200 if (index >= 0) return index
21201 index += len
21202 if (index >= 0) return index
21203 return 0
21204}
21205 7727
21206function coerce (length) { 7728 this._hash.update(data)
21207 // Coerce length to a number (possibly NaN), round up
21208 // in case it's fractional (e.g. 123.456) then do a
21209 // double negate to coerce a NaN to 0. Easy, right?
21210 length = ~~Math.ceil(+length)
21211 return length < 0 ? 0 : length
21212}
21213 7729
21214function isArray (subject) { 7730 next()
21215 return (Array.isArray || function (subject) {
21216 return Object.prototype.toString.call(subject) === '[object Array]'
21217 })(subject)
21218} 7731}
21219 7732
21220function isArrayish (subject) { 7733Hash.prototype._flush = function (next) {
21221 return isArray(subject) || Buffer.isBuffer(subject) || 7734 this.push(this._hash.digest())
21222 subject && typeof subject === 'object' && 7735 this._hash = null
21223 typeof subject.length === 'number'
21224}
21225 7736
21226function toHex (n) { 7737 next()
21227 if (n < 16) return '0' + n.toString(16)
21228 return n.toString(16)
21229} 7738}
21230 7739
21231function utf8ToBytes (str) { 7740Hash.prototype.update = function (data, enc) {
21232 var byteArray = [] 7741 if (typeof data === 'string') {
21233 for (var i = 0; i < str.length; i++) { 7742 data = new Buffer(data, enc)
21234 var b = str.charCodeAt(i)
21235 if (b <= 0x7F) {
21236 byteArray.push(b)
21237 } else {
21238 var start = i
21239 if (b >= 0xD800 && b <= 0xDFFF) i++
21240 var h = encodeURIComponent(str.slice(start, i+1)).substr(1).split('%')
21241 for (var j = 0; j < h.length; j++) {
21242 byteArray.push(parseInt(h[j], 16))
21243 }
21244 }
21245 } 7743 }
21246 return byteArray
21247}
21248
21249function asciiToBytes (str) {
21250 var byteArray = []
21251 for (var i = 0; i < str.length; i++) {
21252 // Node's code seems to be doing this and not & 0x7F..
21253 byteArray.push(str.charCodeAt(i) & 0xFF)
21254 }
21255 return byteArray
21256}
21257
21258function utf16leToBytes (str) {
21259 var c, hi, lo
21260 var byteArray = []
21261 for (var i = 0; i < str.length; i++) {
21262 c = str.charCodeAt(i)
21263 hi = c >> 8
21264 lo = c % 256
21265 byteArray.push(lo)
21266 byteArray.push(hi)
21267 }
21268
21269 return byteArray
21270}
21271
21272function base64ToBytes (str) {
21273 return base64.toByteArray(str)
21274}
21275 7744
21276function blitBuffer (src, dst, offset, length) { 7745 this._hash.update(data)
21277 for (var i = 0; i < length; i++) { 7746 return this
21278 if ((i + offset >= dst.length) || (i >= src.length))
21279 break
21280 dst[i + offset] = src[i]
21281 }
21282 return i
21283}
21284
21285function decodeUtf8Char (str) {
21286 try {
21287 return decodeURIComponent(str)
21288 } catch (err) {
21289 return String.fromCharCode(0xFFFD) // UTF 8 invalid char
21290 }
21291}
21292
21293/*
21294 * We have to make sure that the value is a valid integer. This means that it
21295 * is non-negative. It has no fractional component and that it does not
21296 * exceed the maximum allowed value.
21297 */
21298function verifuint (value, max) {
21299 assert(typeof value === 'number', 'cannot write a non-number as a number')
21300 assert(value >= 0, 'specified a negative value for writing an unsigned value')
21301 assert(value <= max, 'value is larger than maximum value for type')
21302 assert(Math.floor(value) === value, 'value has a fractional component')
21303}
21304
21305function verifsint (value, max, min) {
21306 assert(typeof value === 'number', 'cannot write a non-number as a number')
21307 assert(value <= max, 'value larger than maximum allowed value')
21308 assert(value >= min, 'value smaller than minimum allowed value')
21309 assert(Math.floor(value) === value, 'value has a fractional component')
21310}
21311
21312function verifIEEE754 (value, max, min) {
21313 assert(typeof value === 'number', 'cannot write a non-number as a number')
21314 assert(value <= max, 'value larger than maximum allowed value')
21315 assert(value >= min, 'value smaller than minimum allowed value')
21316}
21317
21318function assert (test, message) {
21319 if (!test) throw new Error(message || 'Failed assertion')
21320}
21321
21322},{"base64-js":9,"ieee754":10}],9:[function(_dereq_,module,exports){
21323var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
21324
21325;(function (exports) {
21326 'use strict';
21327
21328 var Arr = (typeof Uint8Array !== 'undefined')
21329 ? Uint8Array
21330 : Array
21331
21332 var PLUS = '+'.charCodeAt(0)
21333 var SLASH = '/'.charCodeAt(0)
21334 var NUMBER = '0'.charCodeAt(0)
21335 var LOWER = 'a'.charCodeAt(0)
21336 var UPPER = 'A'.charCodeAt(0)
21337
21338 function decode (elt) {
21339 var code = elt.charCodeAt(0)
21340 if (code === PLUS)
21341 return 62 // '+'
21342 if (code === SLASH)
21343 return 63 // '/'
21344 if (code < NUMBER)
21345 return -1 //no match
21346 if (code < NUMBER + 10)
21347 return code - NUMBER + 26 + 26
21348 if (code < UPPER + 26)
21349 return code - UPPER
21350 if (code < LOWER + 26)
21351 return code - LOWER + 26
21352 }
21353
21354 function b64ToByteArray (b64) {
21355 var i, j, l, tmp, placeHolders, arr
21356
21357 if (b64.length % 4 > 0) {
21358 throw new Error('Invalid string. Length must be a multiple of 4')
21359 }
21360
21361 // the number of equal signs (place holders)
21362 // if there are two placeholders, than the two characters before it
21363 // represent one byte
21364 // if there is only one, then the three characters before it represent 2 bytes
21365 // this is just a cheap hack to not do indexOf twice
21366 var len = b64.length
21367 placeHolders = '=' === b64.charAt(len - 2) ? 2 : '=' === b64.charAt(len - 1) ? 1 : 0
21368
21369 // base64 is 4/3 + up to two characters of the original data
21370 arr = new Arr(b64.length * 3 / 4 - placeHolders)
21371
21372 // if there are placeholders, only get up to the last complete 4 chars
21373 l = placeHolders > 0 ? b64.length - 4 : b64.length
21374
21375 var L = 0
21376
21377 function push (v) {
21378 arr[L++] = v
21379 }
21380
21381 for (i = 0, j = 0; i < l; i += 4, j += 3) {
21382 tmp = (decode(b64.charAt(i)) << 18) | (decode(b64.charAt(i + 1)) << 12) | (decode(b64.charAt(i + 2)) << 6) | decode(b64.charAt(i + 3))
21383 push((tmp & 0xFF0000) >> 16)
21384 push((tmp & 0xFF00) >> 8)
21385 push(tmp & 0xFF)
21386 }
21387
21388 if (placeHolders === 2) {
21389 tmp = (decode(b64.charAt(i)) << 2) | (decode(b64.charAt(i + 1)) >> 4)
21390 push(tmp & 0xFF)
21391 } else if (placeHolders === 1) {
21392 tmp = (decode(b64.charAt(i)) << 10) | (decode(b64.charAt(i + 1)) << 4) | (decode(b64.charAt(i + 2)) >> 2)
21393 push((tmp >> 8) & 0xFF)
21394 push(tmp & 0xFF)
21395 }
21396
21397 return arr
21398 }
21399
21400 function uint8ToBase64 (uint8) {
21401 var i,
21402 extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes
21403 output = "",
21404 temp, length
21405
21406 function encode (num) {
21407 return lookup.charAt(num)
21408 }
21409
21410 function tripletToBase64 (num) {
21411 return encode(num >> 18 & 0x3F) + encode(num >> 12 & 0x3F) + encode(num >> 6 & 0x3F) + encode(num & 0x3F)
21412 }
21413
21414 // go through the array every three bytes, we'll deal with trailing stuff later
21415 for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) {
21416 temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
21417 output += tripletToBase64(temp)
21418 }
21419
21420 // pad the end with zeros, but make sure to not forget the extra bytes
21421 switch (extraBytes) {
21422 case 1:
21423 temp = uint8[uint8.length - 1]
21424 output += encode(temp >> 2)
21425 output += encode((temp << 4) & 0x3F)
21426 output += '=='
21427 break
21428 case 2:
21429 temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1])
21430 output += encode(temp >> 10)
21431 output += encode((temp >> 4) & 0x3F)
21432 output += encode((temp << 2) & 0x3F)
21433 output += '='
21434 break
21435 }
21436
21437 return output
21438 }
21439
21440 exports.toByteArray = b64ToByteArray
21441 exports.fromByteArray = uint8ToBase64
21442}(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
21443
21444},{}],10:[function(_dereq_,module,exports){
21445exports.read = function(buffer, offset, isLE, mLen, nBytes) {
21446 var e, m,
21447 eLen = nBytes * 8 - mLen - 1,
21448 eMax = (1 << eLen) - 1,
21449 eBias = eMax >> 1,
21450 nBits = -7,
21451 i = isLE ? (nBytes - 1) : 0,
21452 d = isLE ? -1 : 1,
21453 s = buffer[offset + i];
21454
21455 i += d;
21456
21457 e = s & ((1 << (-nBits)) - 1);
21458 s >>= (-nBits);
21459 nBits += eLen;
21460 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8){};
21461
21462 m = e & ((1 << (-nBits)) - 1);
21463 e >>= (-nBits);
21464 nBits += mLen;
21465 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8){};
21466
21467 if (e === 0) {
21468 e = 1 - eBias;
21469 } else if (e === eMax) {
21470 return m ? NaN : ((s ? -1 : 1) * Infinity);
21471 } else {
21472 m = m + Math.pow(2, mLen);
21473 e = e - eBias;
21474 }
21475 return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
21476};
21477
21478exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
21479 var e, m, c,
21480 eLen = nBytes * 8 - mLen - 1,
21481 eMax = (1 << eLen) - 1,
21482 eBias = eMax >> 1,
21483 rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0),
21484 i = isLE ? 0 : (nBytes - 1),
21485 d = isLE ? 1 : -1,
21486 s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;
21487
21488 value = Math.abs(value);
21489
21490 if (isNaN(value) || value === Infinity) {
21491 m = isNaN(value) ? 1 : 0;
21492 e = eMax;
21493 } else {
21494 e = Math.floor(Math.log(value) / Math.LN2);
21495 if (value * (c = Math.pow(2, -e)) < 1) {
21496 e--;
21497 c *= 2;
21498 }
21499 if (e + eBias >= 1) {
21500 value += rt / c;
21501 } else {
21502 value += rt * Math.pow(2, 1 - eBias);
21503 }
21504 if (value * c >= 2) {
21505 e++;
21506 c /= 2;
21507 }
21508
21509 if (e + eBias >= eMax) {
21510 m = 0;
21511 e = eMax;
21512 } else if (e + eBias >= 1) {
21513 m = (value * c - 1) * Math.pow(2, mLen);
21514 e = e + eBias;
21515 } else {
21516 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
21517 e = 0;
21518 }
21519 }
21520
21521 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8){};
21522
21523 e = (e << mLen) | m;
21524 eLen += mLen;
21525 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8){};
21526
21527 buffer[offset + i - d] |= s * 128;
21528};
21529
21530},{}],11:[function(_dereq_,module,exports){
21531if (typeof Object.create === 'function') {
21532 // implementation from standard node.js 'util' module
21533 module.exports = function inherits(ctor, superCtor) {
21534 ctor.super_ = superCtor
21535 ctor.prototype = Object.create(superCtor.prototype, {
21536 constructor: {
21537 value: ctor,
21538 enumerable: false,
21539 writable: true,
21540 configurable: true
21541 }
21542 });
21543 };
21544} else {
21545 // old school shim for old browsers
21546 module.exports = function inherits(ctor, superCtor) {
21547 ctor.super_ = superCtor
21548 var TempCtor = function () {}
21549 TempCtor.prototype = superCtor.prototype
21550 ctor.prototype = new TempCtor()
21551 ctor.prototype.constructor = ctor
21552 }
21553}
21554
21555},{}],12:[function(_dereq_,module,exports){
21556// shim for using process in browser
21557
21558var process = module.exports = {};
21559
21560process.nextTick = (function () {
21561 var canSetImmediate = typeof window !== 'undefined'
21562 && window.setImmediate;
21563 var canPost = typeof window !== 'undefined'
21564 && window.postMessage && window.addEventListener
21565 ;
21566
21567 if (canSetImmediate) {
21568 return function (f) { return window.setImmediate(f) };
21569 }
21570
21571 if (canPost) {
21572 var queue = [];
21573 window.addEventListener('message', function (ev) {
21574 var source = ev.source;
21575 if ((source === window || source === null) && ev.data === 'process-tick') {
21576 ev.stopPropagation();
21577 if (queue.length > 0) {
21578 var fn = queue.shift();
21579 fn();
21580 }
21581 }
21582 }, true);
21583
21584 return function nextTick(fn) {
21585 queue.push(fn);
21586 window.postMessage('process-tick', '*');
21587 };
21588 }
21589
21590 return function nextTick(fn) {
21591 setTimeout(fn, 0);
21592 };
21593})();
21594
21595process.title = 'browser';
21596process.browser = true;
21597process.env = {};
21598process.argv = [];
21599
21600function noop() {}
21601
21602process.on = noop;
21603process.addListener = noop;
21604process.once = noop;
21605process.off = noop;
21606process.removeListener = noop;
21607process.removeAllListeners = noop;
21608process.emit = noop;
21609
21610process.binding = function (name) {
21611 throw new Error('process.binding is not supported');
21612}
21613
21614// TODO(shtylman)
21615process.cwd = function () { return '/' };
21616process.chdir = function (dir) {
21617 throw new Error('process.chdir is not supported');
21618};
21619
21620},{}],13:[function(_dereq_,module,exports){
21621module.exports=_dereq_(5)
21622},{}],14:[function(_dereq_,module,exports){
21623module.exports=_dereq_(6)
21624},{"./support/isBuffer":13,"FWaASH":12,"inherits":11}],15:[function(_dereq_,module,exports){
21625(function (Buffer){
21626// Base58 encoding/decoding
21627// Originally written by Mike Hearn for BitcoinJ
21628// Copyright (c) 2011 Google Inc
21629// Ported to JavaScript by Stefan Thomas
21630// Merged Buffer refactorings from base58-native by Stephen Pair
21631// Copyright (c) 2013 BitPay Inc
21632
21633var assert = _dereq_('assert')
21634var BigInteger = _dereq_('bigi')
21635
21636var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
21637var ALPHABET_BUF = new Buffer(ALPHABET, 'ascii')
21638var ALPHABET_MAP = {}
21639for(var i = 0; i < ALPHABET.length; i++) {
21640 ALPHABET_MAP[ALPHABET.charAt(i)] = BigInteger.valueOf(i)
21641}
21642var BASE = new BigInteger('58')
21643
21644function encode(buffer) {
21645 var bi = BigInteger.fromBuffer(buffer)
21646 var result = new Buffer(buffer.length << 1)
21647
21648 var i = result.length - 1
21649 while (bi.signum() > 0) {
21650 var remainder = bi.mod(BASE)
21651 bi = bi.divide(BASE)
21652
21653 result[i] = ALPHABET_BUF[remainder.intValue()]
21654 i--
21655 }
21656
21657 // deal with leading zeros
21658 var j = 0
21659 while (buffer[j] === 0) {
21660 result[i] = ALPHABET_BUF[0]
21661 j++
21662 i--
21663 }
21664
21665 return result.slice(i + 1, result.length).toString('ascii')
21666}
21667
21668function decode(string) {
21669 if (string.length === 0) return new Buffer(0)
21670
21671 var num = BigInteger.ZERO
21672
21673 for (var i = 0; i < string.length; i++) {
21674 num = num.multiply(BASE)
21675
21676 var figure = ALPHABET_MAP[string.charAt(i)]
21677 assert.notEqual(figure, undefined, 'Non-base58 character')
21678
21679 num = num.add(figure)
21680 }
21681
21682 // deal with leading zeros
21683 var j = 0
21684 while ((j < string.length) && (string[j] === ALPHABET[0])) {
21685 j++
21686 }
21687
21688 var buffer = num.toBuffer()
21689 var leadingZeros = new Buffer(j)
21690 leadingZeros.fill(0)
21691
21692 return Buffer.concat([leadingZeros, buffer])
21693}
21694
21695module.exports = {
21696 encode: encode,
21697 decode: decode
21698}
21699
21700}).call(this,_dereq_("buffer").Buffer)
21701},{"assert":4,"bigi":3,"buffer":8}],16:[function(_dereq_,module,exports){
21702(function (Buffer){
21703var createHash = _dereq_('sha.js')
21704
21705var md5 = toConstructor(_dereq_('./md5'))
21706var rmd160 = toConstructor(_dereq_('ripemd160'))
21707
21708function toConstructor (fn) {
21709 return function () {
21710 var buffers = []
21711 var m= {
21712 update: function (data, enc) {
21713 if(!Buffer.isBuffer(data)) data = new Buffer(data, enc)
21714 buffers.push(data)
21715 return this
21716 },
21717 digest: function (enc) {
21718 var buf = Buffer.concat(buffers)
21719 var r = fn(buf)
21720 buffers = null
21721 return enc ? r.toString(enc) : r
21722 }
21723 }
21724 return m
21725 }
21726}
21727
21728module.exports = function (alg) {
21729 if('md5' === alg) return new md5()
21730 if('rmd160' === alg) return new rmd160()
21731 return createHash(alg)
21732} 7747}
21733 7748
21734}).call(this,_dereq_("buffer").Buffer) 7749Hash.prototype.digest = function (enc) {
21735},{"./md5":20,"buffer":8,"ripemd160":21,"sha.js":23}],17:[function(_dereq_,module,exports){ 7750 var outData = this._hash.digest()
21736(function (Buffer){
21737var createHash = _dereq_('./create-hash')
21738
21739var blocksize = 64
21740var zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0)
21741
21742module.exports = Hmac
21743
21744function Hmac (alg, key) {
21745 if(!(this instanceof Hmac)) return new Hmac(alg, key)
21746 this._opad = opad
21747 this._alg = alg
21748
21749 key = this._key = !Buffer.isBuffer(key) ? new Buffer(key) : key
21750
21751 if(key.length > blocksize) {
21752 key = createHash(alg).update(key).digest()
21753 } else if(key.length < blocksize) {
21754 key = Buffer.concat([key, zeroBuffer], blocksize)
21755 }
21756
21757 var ipad = this._ipad = new Buffer(blocksize)
21758 var opad = this._opad = new Buffer(blocksize)
21759
21760 for(var i = 0; i < blocksize; i++) {
21761 ipad[i] = key[i] ^ 0x36
21762 opad[i] = key[i] ^ 0x5C
21763 }
21764 7751
21765 this._hash = createHash(alg).update(ipad) 7752 return enc ? outData.toString(enc) : outData
21766} 7753}
21767 7754
21768Hmac.prototype.update = function (data, enc) { 7755module.exports = function createHash (alg) {
21769 this._hash.update(data, enc) 7756 if ('md5' === alg) return new HashNoConstructor(md5)
21770 return this 7757 if ('rmd160' === alg) return new HashNoConstructor(rmd160)
21771}
21772 7758
21773Hmac.prototype.digest = function (enc) { 7759 return new Hash(sha(alg))
21774 var h = this._hash.digest()
21775 return createHash(this._alg).update(this._opad).update(h).digest(enc)
21776} 7760}
21777 7761
21778 7762}).call(this,require("buffer").Buffer)
21779}).call(this,_dereq_("buffer").Buffer) 7763},{"./md5":34,"buffer":7,"inherits":35,"ripemd160":36,"sha.js":38,"stream":26}],33:[function(require,module,exports){
21780},{"./create-hash":16,"buffer":8}],18:[function(_dereq_,module,exports){
21781(function (Buffer){ 7764(function (Buffer){
7765'use strict';
21782var intSize = 4; 7766var intSize = 4;
21783var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); 7767var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
21784var chrsz = 8; 7768var chrsz = 8;
@@ -21811,69 +7795,10 @@ function hash(buf, fn, hashSize, bigEndian) {
21811 var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); 7795 var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
21812 return toBuffer(arr, hashSize, bigEndian); 7796 return toBuffer(arr, hashSize, bigEndian);
21813} 7797}
21814 7798exports.hash = hash;
21815module.exports = { hash: hash }; 7799}).call(this,require("buffer").Buffer)
21816 7800},{"buffer":7}],34:[function(require,module,exports){
21817}).call(this,_dereq_("buffer").Buffer) 7801'use strict';
21818},{"buffer":8}],19:[function(_dereq_,module,exports){
21819(function (Buffer){
21820var rng = _dereq_('./rng')
21821
21822function error () {
21823 var m = [].slice.call(arguments).join(' ')
21824 throw new Error([
21825 m,
21826 'we accept pull requests',
21827 'http://github.com/dominictarr/crypto-browserify'
21828 ].join('\n'))
21829}
21830
21831exports.createHash = _dereq_('./create-hash')
21832
21833exports.createHmac = _dereq_('./create-hmac')
21834
21835exports.randomBytes = function(size, callback) {
21836 if (callback && callback.call) {
21837 try {
21838 callback.call(this, undefined, new Buffer(rng(size)))
21839 } catch (err) { callback(err) }
21840 } else {
21841 return new Buffer(rng(size))
21842 }
21843}
21844
21845function each(a, f) {
21846 for(var i in a)
21847 f(a[i], i)
21848}
21849
21850exports.getHashes = function () {
21851 return ['sha1', 'sha256', 'md5', 'rmd160']
21852
21853}
21854
21855var p = _dereq_('./pbkdf2')(exports.createHmac)
21856exports.pbkdf2 = p.pbkdf2
21857exports.pbkdf2Sync = p.pbkdf2Sync
21858
21859
21860// the least I can do is make error messages for the rest of the node.js/crypto api.
21861each(['createCredentials'
21862, 'createCipher'
21863, 'createCipheriv'
21864, 'createDecipher'
21865, 'createDecipheriv'
21866, 'createSign'
21867, 'createVerify'
21868, 'createDiffieHellman'
21869], function (name) {
21870 exports[name] = function () {
21871 error('sorry,', name, 'is not implemented yet')
21872 }
21873})
21874
21875}).call(this,_dereq_("buffer").Buffer)
21876},{"./create-hash":16,"./create-hmac":17,"./pbkdf2":27,"./rng":28,"buffer":8}],20:[function(_dereq_,module,exports){
21877/* 7802/*
21878 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message 7803 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
21879 * Digest Algorithm, as defined in RFC 1321. 7804 * Digest Algorithm, as defined in RFC 1321.
@@ -21883,7 +7808,7 @@ each(['createCredentials'
21883 * See http://pajhome.org.uk/crypt/md5 for more info. 7808 * See http://pajhome.org.uk/crypt/md5 for more info.
21884 */ 7809 */
21885 7810
21886var helpers = _dereq_('./helpers'); 7811var helpers = require('./helpers');
21887 7812
21888/* 7813/*
21889 * Calculate the MD5 of an array of little-endian words, and a bit length 7814 * Calculate the MD5 of an array of little-endian words, and a bit length
@@ -22029,14 +7954,10 @@ function bit_rol(num, cnt)
22029module.exports = function md5(buf) { 7954module.exports = function md5(buf) {
22030 return helpers.hash(buf, core_md5, 16); 7955 return helpers.hash(buf, core_md5, 16);
22031}; 7956};
22032 7957},{"./helpers":33}],35:[function(require,module,exports){
22033},{"./helpers":18}],21:[function(_dereq_,module,exports){ 7958arguments[4][12][0].apply(exports,arguments)
7959},{"dup":12}],36:[function(require,module,exports){
22034(function (Buffer){ 7960(function (Buffer){
22035
22036module.exports = ripemd160
22037
22038
22039
22040/* 7961/*
22041CryptoJS v3.1.2 7962CryptoJS v3.1.2
22042code.google.com/p/crypto-js 7963code.google.com/p/crypto-js
@@ -22054,306 +7975,396 @@ Redistribution and use in source and binary forms, with or without modification,
22054THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 7975THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22055*/ 7976*/
22056 7977
22057// Constants table 7978// constants table
22058var zl = [ 7979var zl = [
22059 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7980 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
22060 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 7981 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
22061 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 7982 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
22062 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 7983 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
22063 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]; 7984 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
7985]
7986
22064var zr = [ 7987var zr = [
22065 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 7988 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
22066 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 7989 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
22067 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 7990 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
22068 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 7991 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
22069 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]; 7992 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
7993]
7994
22070var sl = [ 7995var sl = [
22071 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7996 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
22072 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 7997 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
22073 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 7998 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
22074 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 7999 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
22075 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]; 8000 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
8001]
8002
22076var sr = [ 8003var sr = [
22077 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 8004 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
22078 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 8005 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
22079 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 8006 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
22080 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8007 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
22081 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]; 8008 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
8009]
22082 8010
22083var hl = [ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]; 8011var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]
22084var hr = [ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]; 8012var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]
22085 8013
22086var bytesToWords = function (bytes) { 8014function bytesToWords (bytes) {
22087 var words = []; 8015 var words = []
22088 for (var i = 0, b = 0; i < bytes.length; i++, b += 8) { 8016 for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {
22089 words[b >>> 5] |= bytes[i] << (24 - b % 32); 8017 words[b >>> 5] |= bytes[i] << (24 - b % 32)
22090 } 8018 }
22091 return words; 8019 return words
22092}; 8020}
22093 8021
22094var wordsToBytes = function (words) { 8022function wordsToBytes (words) {
22095 var bytes = []; 8023 var bytes = []
22096 for (var b = 0; b < words.length * 32; b += 8) { 8024 for (var b = 0; b < words.length * 32; b += 8) {
22097 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); 8025 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)
22098 } 8026 }
22099 return bytes; 8027 return bytes
22100}; 8028}
22101
22102var processBlock = function (H, M, offset) {
22103 8029
22104 // Swap endian 8030function processBlock (H, M, offset) {
8031 // swap endian
22105 for (var i = 0; i < 16; i++) { 8032 for (var i = 0; i < 16; i++) {
22106 var offset_i = offset + i; 8033 var offset_i = offset + i
22107 var M_offset_i = M[offset_i]; 8034 var M_offset_i = M[offset_i]
22108 8035
22109 // Swap 8036 // Swap
22110 M[offset_i] = ( 8037 M[offset_i] = (
22111 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | 8038 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
22112 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) 8039 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
22113 ); 8040 )
22114 } 8041 }
22115 8042
22116 // Working variables 8043 // Working variables
22117 var al, bl, cl, dl, el; 8044 var al, bl, cl, dl, el
22118 var ar, br, cr, dr, er; 8045 var ar, br, cr, dr, er
22119 8046
22120 ar = al = H[0]; 8047 ar = al = H[0]
22121 br = bl = H[1]; 8048 br = bl = H[1]
22122 cr = cl = H[2]; 8049 cr = cl = H[2]
22123 dr = dl = H[3]; 8050 dr = dl = H[3]
22124 er = el = H[4]; 8051 er = el = H[4]
22125 // Computation 8052
22126 var t; 8053 // computation
22127 for (var i = 0; i < 80; i += 1) { 8054 var t
22128 t = (al + M[offset+zl[i]])|0; 8055 for (i = 0; i < 80; i += 1) {
22129 if (i<16){ 8056 t = (al + M[offset + zl[i]]) | 0
22130 t += f1(bl,cl,dl) + hl[0]; 8057 if (i < 16) {
22131 } else if (i<32) { 8058 t += f1(bl, cl, dl) + hl[0]
22132 t += f2(bl,cl,dl) + hl[1]; 8059 } else if (i < 32) {
22133 } else if (i<48) { 8060 t += f2(bl, cl, dl) + hl[1]
22134 t += f3(bl,cl,dl) + hl[2]; 8061 } else if (i < 48) {
22135 } else if (i<64) { 8062 t += f3(bl, cl, dl) + hl[2]
22136 t += f4(bl,cl,dl) + hl[3]; 8063 } else if (i < 64) {
8064 t += f4(bl, cl, dl) + hl[3]
22137 } else {// if (i<80) { 8065 } else {// if (i<80) {
22138 t += f5(bl,cl,dl) + hl[4]; 8066 t += f5(bl, cl, dl) + hl[4]
22139 } 8067 }
22140 t = t|0; 8068 t = t | 0
22141 t = rotl(t,sl[i]); 8069 t = rotl(t, sl[i])
22142 t = (t+el)|0; 8070 t = (t + el) | 0
22143 al = el; 8071 al = el
22144 el = dl; 8072 el = dl
22145 dl = rotl(cl, 10); 8073 dl = rotl(cl, 10)
22146 cl = bl; 8074 cl = bl
22147 bl = t; 8075 bl = t
22148 8076
22149 t = (ar + M[offset+zr[i]])|0; 8077 t = (ar + M[offset + zr[i]]) | 0
22150 if (i<16){ 8078 if (i < 16) {
22151 t += f5(br,cr,dr) + hr[0]; 8079 t += f5(br, cr, dr) + hr[0]
22152 } else if (i<32) { 8080 } else if (i < 32) {
22153 t += f4(br,cr,dr) + hr[1]; 8081 t += f4(br, cr, dr) + hr[1]
22154 } else if (i<48) { 8082 } else if (i < 48) {
22155 t += f3(br,cr,dr) + hr[2]; 8083 t += f3(br, cr, dr) + hr[2]
22156 } else if (i<64) { 8084 } else if (i < 64) {
22157 t += f2(br,cr,dr) + hr[3]; 8085 t += f2(br, cr, dr) + hr[3]
22158 } else {// if (i<80) { 8086 } else {// if (i<80) {
22159 t += f1(br,cr,dr) + hr[4]; 8087 t += f1(br, cr, dr) + hr[4]
22160 } 8088 }
22161 t = t|0;
22162 t = rotl(t,sr[i]) ;
22163 t = (t+er)|0;
22164 ar = er;
22165 er = dr;
22166 dr = rotl(cr, 10);
22167 cr = br;
22168 br = t;
22169 }
22170 // Intermediate hash value
22171 t = (H[1] + cl + dr)|0;
22172 H[1] = (H[2] + dl + er)|0;
22173 H[2] = (H[3] + el + ar)|0;
22174 H[3] = (H[4] + al + br)|0;
22175 H[4] = (H[0] + bl + cr)|0;
22176 H[0] = t;
22177};
22178 8089
22179function f1(x, y, z) { 8090 t = t | 0
22180 return ((x) ^ (y) ^ (z)); 8091 t = rotl(t, sr[i])
8092 t = (t + er) | 0
8093 ar = er
8094 er = dr
8095 dr = rotl(cr, 10)
8096 cr = br
8097 br = t
8098 }
8099
8100 // intermediate hash value
8101 t = (H[1] + cl + dr) | 0
8102 H[1] = (H[2] + dl + er) | 0
8103 H[2] = (H[3] + el + ar) | 0
8104 H[3] = (H[4] + al + br) | 0
8105 H[4] = (H[0] + bl + cr) | 0
8106 H[0] = t
22181} 8107}
22182 8108
22183function f2(x, y, z) { 8109function f1 (x, y, z) {
22184 return (((x)&(y)) | ((~x)&(z))); 8110 return ((x) ^ (y) ^ (z))
22185} 8111}
22186 8112
22187function f3(x, y, z) { 8113function f2 (x, y, z) {
22188 return (((x) | (~(y))) ^ (z)); 8114 return (((x) & (y)) | ((~x) & (z)))
22189} 8115}
22190 8116
22191function f4(x, y, z) { 8117function f3 (x, y, z) {
22192 return (((x) & (z)) | ((y)&(~(z)))); 8118 return (((x) | (~(y))) ^ (z))
22193} 8119}
22194 8120
22195function f5(x, y, z) { 8121function f4 (x, y, z) {
22196 return ((x) ^ ((y) |(~(z)))); 8122 return (((x) & (z)) | ((y) & (~(z))))
22197} 8123}
22198 8124
22199function rotl(x,n) { 8125function f5 (x, y, z) {
22200 return (x<<n) | (x>>>(32-n)); 8126 return ((x) ^ ((y) | (~(z))))
22201} 8127}
22202 8128
22203function ripemd160(message) { 8129function rotl (x, n) {
22204 var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]; 8130 return (x << n) | (x >>> (32 - n))
8131}
8132
8133function ripemd160 (message) {
8134 var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]
22205 8135
22206 if (typeof message == 'string') 8136 if (typeof message === 'string') {
22207 message = new Buffer(message, 'utf8'); 8137 message = new Buffer(message, 'utf8')
8138 }
22208 8139
22209 var m = bytesToWords(message); 8140 var m = bytesToWords(message)
22210 8141
22211 var nBitsLeft = message.length * 8; 8142 var nBitsLeft = message.length * 8
22212 var nBitsTotal = message.length * 8; 8143 var nBitsTotal = message.length * 8
22213 8144
22214 // Add padding 8145 // Add padding
22215 m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); 8146 m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)
22216 m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( 8147 m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
22217 (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | 8148 (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
22218 (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) 8149 (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
22219 ); 8150 )
22220 8151
22221 for (var i=0 ; i<m.length; i += 16) { 8152 for (var i = 0; i < m.length; i += 16) {
22222 processBlock(H, m, i); 8153 processBlock(H, m, i)
22223 } 8154 }
22224 8155
22225 // Swap endian 8156 // swap endian
22226 for (var i = 0; i < 5; i++) { 8157 for (i = 0; i < 5; i++) {
22227 // Shortcut 8158 // shortcut
22228 var H_i = H[i]; 8159 var H_i = H[i]
22229 8160
22230 // Swap 8161 // Swap
22231 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | 8162 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
22232 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); 8163 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)
22233 } 8164 }
22234 8165
22235 var digestbytes = wordsToBytes(H); 8166 var digestbytes = wordsToBytes(H)
22236 return new Buffer(digestbytes); 8167 return new Buffer(digestbytes)
8168}
8169
8170module.exports = ripemd160
8171
8172}).call(this,require("buffer").Buffer)
8173},{"buffer":7}],37:[function(require,module,exports){
8174(function (Buffer){
8175// prototype class for hash functions
8176function Hash (blockSize, finalSize) {
8177 this._block = new Buffer(blockSize)
8178 this._finalSize = finalSize
8179 this._blockSize = blockSize
8180 this._len = 0
8181 this._s = 0
22237} 8182}
22238 8183
8184Hash.prototype.update = function (data, enc) {
8185 if (typeof data === 'string') {
8186 enc = enc || 'utf8'
8187 data = new Buffer(data, enc)
8188 }
22239 8189
8190 var l = this._len += data.length
8191 var s = this._s || 0
8192 var f = 0
8193 var buffer = this._block
22240 8194
22241}).call(this,_dereq_("buffer").Buffer) 8195 while (s < l) {
22242},{"buffer":8}],22:[function(_dereq_,module,exports){ 8196 var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
22243var u = _dereq_('./util') 8197 var ch = (t - f)
22244var write = u.write
22245var fill = u.zeroFill
22246 8198
22247module.exports = function (Buffer) { 8199 for (var i = 0; i < ch; i++) {
8200 buffer[(s % this._blockSize) + i] = data[i + f]
8201 }
22248 8202
22249 //prototype class for hash functions 8203 s += ch
22250 function Hash (blockSize, finalSize) { 8204 f += ch
22251 this._block = new Buffer(blockSize) //new Uint32Array(blockSize/4)
22252 this._finalSize = finalSize
22253 this._blockSize = blockSize
22254 this._len = 0
22255 this._s = 0
22256 }
22257 8205
22258 Hash.prototype.init = function () { 8206 if ((s % this._blockSize) === 0) {
22259 this._s = 0 8207 this._update(buffer)
22260 this._len = 0 8208 }
22261 } 8209 }
8210 this._s = s
22262 8211
22263 function lengthOf(data, enc) { 8212 return this
22264 if(enc == null) return data.byteLength || data.length 8213}
22265 if(enc == 'ascii' || enc == 'binary') return data.length 8214
22266 if(enc == 'hex') return data.length/2 8215Hash.prototype.digest = function (enc) {
22267 if(enc == 'base64') return data.length/3 8216 // Suppose the length of the message M, in bits, is l
8217 var l = this._len * 8
8218
8219 // Append the bit 1 to the end of the message
8220 this._block[this._len % this._blockSize] = 0x80
8221
8222 // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize
8223 this._block.fill(0, this._len % this._blockSize + 1)
8224
8225 if (l % (this._blockSize * 8) >= this._finalSize * 8) {
8226 this._update(this._block)
8227 this._block.fill(0)
22268 } 8228 }
22269 8229
22270 Hash.prototype.update = function (data, enc) { 8230 // to this append the block which is equal to the number l written in binary
22271 var bl = this._blockSize 8231 // TODO: handle case where l is > Math.pow(2, 29)
8232 this._block.writeInt32BE(l, this._blockSize - 4)
22272 8233
22273 //I'd rather do this with a streaming encoder, like the opposite of 8234 var hash = this._update(this._block) || this._hash()
22274 //http://nodejs.org/api/string_decoder.html
22275 var length
22276 if(!enc && 'string' === typeof data)
22277 enc = 'utf8'
22278 8235
22279 if(enc) { 8236 return enc ? hash.toString(enc) : hash
22280 if(enc === 'utf-8') 8237}
22281 enc = 'utf8'
22282 8238
22283 if(enc === 'base64' || enc === 'utf8') 8239Hash.prototype._update = function () {
22284 data = new Buffer(data, enc), enc = null 8240 throw new Error('_update must be implemented by subclass')
8241}
22285 8242
22286 length = lengthOf(data, enc) 8243module.exports = Hash
22287 } else
22288 length = data.byteLength || data.length
22289
22290 var l = this._len += length
22291 var s = this._s = (this._s || 0)
22292 var f = 0
22293 var buffer = this._block
22294 while(s < l) {
22295 var t = Math.min(length, f + bl)
22296 write(buffer, data, enc, s%bl, f, t)
22297 var ch = (t - f);
22298 s += ch; f += ch
22299
22300 if(!(s%bl))
22301 this._update(buffer)
22302 }
22303 this._s = s
22304 8244
22305 return this 8245}).call(this,require("buffer").Buffer)
8246},{"buffer":7}],38:[function(require,module,exports){
8247var exports = module.exports = function SHA (algorithm) {
8248 algorithm = algorithm.toLowerCase()
22306 8249
22307 } 8250 var Algorithm = exports[algorithm]
8251 if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
22308 8252
22309 Hash.prototype.digest = function (enc) { 8253 return new Algorithm()
22310 var bl = this._blockSize 8254}
22311 var fl = this._finalSize
22312 var len = this._len*8
22313 8255
22314 var x = this._block 8256exports.sha = require('./sha')
8257exports.sha1 = require('./sha1')
8258exports.sha224 = require('./sha224')
8259exports.sha256 = require('./sha256')
8260exports.sha384 = require('./sha384')
8261exports.sha512 = require('./sha512')
22315 8262
22316 var bits = len % (bl*8) 8263},{"./sha":39,"./sha1":40,"./sha224":41,"./sha256":42,"./sha384":43,"./sha512":44}],39:[function(require,module,exports){
8264(function (Buffer){
8265/*
8266 * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
8267 * in FIPS PUB 180-1
8268 * This source code is derived from sha1.js of the same repository.
8269 * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
8270 * operation was added.
8271 */
22317 8272
22318 //add end marker, so that appending 0's creats a different hash. 8273var inherits = require('inherits')
22319 x[this._len % bl] = 0x80 8274var Hash = require('./hash')
22320 fill(this._block, this._len % bl + 1)
22321 8275
22322 if(bits >= fl*8) { 8276var W = new Array(80)
22323 this._update(this._block)
22324 u.zeroFill(this._block, 0)
22325 }
22326 8277
22327 //TODO: handle case where the bit length is > Math.pow(2, 29) 8278function Sha () {
22328 x.writeInt32BE(len, fl + 4) //big endian 8279 this.init()
8280 this._w = W
22329 8281
22330 var hash = this._update(this._block) || this._hash() 8282 Hash.call(this, 64, 56)
22331 if(enc == null) return hash 8283}
22332 return hash.toString(enc) 8284
22333 } 8285inherits(Sha, Hash)
8286
8287Sha.prototype.init = function () {
8288 this._a = 0x67452301 | 0
8289 this._b = 0xefcdab89 | 0
8290 this._c = 0x98badcfe | 0
8291 this._d = 0x10325476 | 0
8292 this._e = 0xc3d2e1f0 | 0
8293
8294 return this
8295}
22334 8296
22335 Hash.prototype._update = function () { 8297/*
22336 throw new Error('_update must be implemented by subclass') 8298 * Bitwise rotate a 32-bit number to the left.
8299 */
8300function rol (num, cnt) {
8301 return (num << cnt) | (num >>> (32 - cnt))
8302}
8303
8304Sha.prototype._update = function (M) {
8305 var W = this._w
8306
8307 var a = this._a
8308 var b = this._b
8309 var c = this._c
8310 var d = this._d
8311 var e = this._e
8312
8313 var j = 0, k
8314
8315 /*
8316 * SHA-1 has a bitwise rotate left operation. But, SHA is not
8317 * function calcW() { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) }
8318 */
8319 function calcW () { return W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16] }
8320 function loop (w, f) {
8321 W[j] = w
8322
8323 var t = rol(a, 5) + f + e + w + k
8324
8325 e = d
8326 d = c
8327 c = rol(b, 30)
8328 b = a
8329 a = t
8330 j++
22337 } 8331 }
22338 8332
22339 return Hash 8333 k = 1518500249
8334 while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))
8335 while (j < 20) loop(calcW(), (b & c) | ((~b) & d))
8336 k = 1859775393
8337 while (j < 40) loop(calcW(), b ^ c ^ d)
8338 k = -1894007588
8339 while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))
8340 k = -899497514
8341 while (j < 80) loop(calcW(), b ^ c ^ d)
8342
8343 this._a = (a + this._a) | 0
8344 this._b = (b + this._b) | 0
8345 this._c = (c + this._c) | 0
8346 this._d = (d + this._d) | 0
8347 this._e = (e + this._e) | 0
22340} 8348}
22341 8349
22342},{"./util":26}],23:[function(_dereq_,module,exports){ 8350Sha.prototype._hash = function () {
22343var exports = module.exports = function (alg) { 8351 var H = new Buffer(20)
22344 var Alg = exports[alg] 8352
22345 if(!Alg) throw new Error(alg + ' is not supported (we accept pull requests)') 8353 H.writeInt32BE(this._a | 0, 0)
22346 return new Alg() 8354 H.writeInt32BE(this._b | 0, 4)
8355 H.writeInt32BE(this._c | 0, 8)
8356 H.writeInt32BE(this._d | 0, 12)
8357 H.writeInt32BE(this._e | 0, 16)
8358
8359 return H
22347} 8360}
22348 8361
22349var Buffer = _dereq_('buffer').Buffer 8362module.exports = Sha
22350var Hash = _dereq_('./hash')(Buffer)
22351 8363
22352exports.sha =
22353exports.sha1 = _dereq_('./sha1')(Buffer, Hash)
22354exports.sha256 = _dereq_('./sha256')(Buffer, Hash)
22355 8364
22356},{"./hash":22,"./sha1":24,"./sha256":25,"buffer":8}],24:[function(_dereq_,module,exports){ 8365}).call(this,require("buffer").Buffer)
8366},{"./hash":37,"buffer":7,"inherits":35}],40:[function(require,module,exports){
8367(function (Buffer){
22357/* 8368/*
22358 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined 8369 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
22359 * in FIPS PUB 180-1 8370 * in FIPS PUB 180-1
@@ -22362,160 +8373,153 @@ exports.sha256 = _dereq_('./sha256')(Buffer, Hash)
22362 * Distributed under the BSD License 8373 * Distributed under the BSD License
22363 * See http://pajhome.org.uk/crypt/md5 for details. 8374 * See http://pajhome.org.uk/crypt/md5 for details.
22364 */ 8375 */
22365module.exports = function (Buffer, Hash) {
22366 8376
22367 var inherits = _dereq_('util').inherits 8377var inherits = require('inherits')
8378var Hash = require('./hash')
22368 8379
22369 inherits(Sha1, Hash) 8380var W = new Array(80)
22370 8381
22371 var A = 0|0 8382function Sha1 () {
22372 var B = 4|0 8383 this.init()
22373 var C = 8|0 8384 this._w = W
22374 var D = 12|0
22375 var E = 16|0
22376 8385
22377 var BE = false 8386 Hash.call(this, 64, 56)
22378 var LE = true 8387}
22379 8388
22380 var W = new Int32Array(80) 8389inherits(Sha1, Hash)
22381 8390
22382 var POOL = [] 8391Sha1.prototype.init = function () {
8392 this._a = 0x67452301 | 0
8393 this._b = 0xefcdab89 | 0
8394 this._c = 0x98badcfe | 0
8395 this._d = 0x10325476 | 0
8396 this._e = 0xc3d2e1f0 | 0
22383 8397
22384 function Sha1 () { 8398 return this
22385 if(POOL.length) 8399}
22386 return POOL.pop().init()
22387 8400
22388 if(!(this instanceof Sha1)) return new Sha1() 8401/*
22389 this._w = W 8402 * Bitwise rotate a 32-bit number to the left.
22390 Hash.call(this, 16*4, 14*4) 8403 */
22391 8404function rol (num, cnt) {
22392 this._h = null 8405 return (num << cnt) | (num >>> (32 - cnt))
22393 this.init() 8406}
22394 }
22395 8407
22396 Sha1.prototype.init = function () { 8408Sha1.prototype._update = function (M) {
22397 this._a = 0x67452301 8409 var W = this._w
22398 this._b = 0xefcdab89
22399 this._c = 0x98badcfe
22400 this._d = 0x10325476
22401 this._e = 0xc3d2e1f0
22402 8410
22403 Hash.prototype.init.call(this) 8411 var a = this._a
22404 return this 8412 var b = this._b
22405 } 8413 var c = this._c
8414 var d = this._d
8415 var e = this._e
22406 8416
22407 Sha1.prototype._POOL = POOL 8417 var j = 0, k
22408 8418
22409 // assume that array is a Uint32Array with length=16, 8419 function calcW () { return rol(W[j - 3] ^ W[j - 8] ^ W[j - 14] ^ W[j - 16], 1) }
22410 // and that if it is the last block, it already has the length and the 1 bit appended. 8420 function loop (w, f) {
8421 W[j] = w
22411 8422
8423 var t = rol(a, 5) + f + e + w + k
22412 8424
22413 var isDV = new Buffer(1) instanceof DataView 8425 e = d
22414 function readInt32BE (X, i) { 8426 d = c
22415 return isDV 8427 c = rol(b, 30)
22416 ? X.getInt32(i, false) 8428 b = a
22417 : X.readInt32BE(i) 8429 a = t
8430 j++
22418 } 8431 }
22419 8432
22420 Sha1.prototype._update = function (array) { 8433 k = 1518500249
8434 while (j < 16) loop(M.readInt32BE(j * 4), (b & c) | ((~b) & d))
8435 while (j < 20) loop(calcW(), (b & c) | ((~b) & d))
8436 k = 1859775393
8437 while (j < 40) loop(calcW(), b ^ c ^ d)
8438 k = -1894007588
8439 while (j < 60) loop(calcW(), (b & c) | (b & d) | (c & d))
8440 k = -899497514
8441 while (j < 80) loop(calcW(), b ^ c ^ d)
22421 8442
22422 var X = this._block 8443 this._a = (a + this._a) | 0
22423 var h = this._h 8444 this._b = (b + this._b) | 0
22424 var a, b, c, d, e, _a, _b, _c, _d, _e 8445 this._c = (c + this._c) | 0
8446 this._d = (d + this._d) | 0
8447 this._e = (e + this._e) | 0
8448}
22425 8449
22426 a = _a = this._a 8450Sha1.prototype._hash = function () {
22427 b = _b = this._b 8451 var H = new Buffer(20)
22428 c = _c = this._c
22429 d = _d = this._d
22430 e = _e = this._e
22431 8452
22432 var w = this._w 8453 H.writeInt32BE(this._a | 0, 0)
8454 H.writeInt32BE(this._b | 0, 4)
8455 H.writeInt32BE(this._c | 0, 8)
8456 H.writeInt32BE(this._d | 0, 12)
8457 H.writeInt32BE(this._e | 0, 16)
22433 8458
22434 for(var j = 0; j < 80; j++) { 8459 return H
22435 var W = w[j] 8460}
22436 = j < 16
22437 //? X.getInt32(j*4, false)
22438 //? readInt32BE(X, j*4) //*/ X.readInt32BE(j*4) //*/
22439 ? X.readInt32BE(j*4)
22440 : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1)
22441 8461
22442 var t = 8462module.exports = Sha1
22443 add(
22444 add(rol(a, 5), sha1_ft(j, b, c, d)),
22445 add(add(e, W), sha1_kt(j))
22446 );
22447 8463
22448 e = d 8464}).call(this,require("buffer").Buffer)
22449 d = c 8465},{"./hash":37,"buffer":7,"inherits":35}],41:[function(require,module,exports){
22450 c = rol(b, 30) 8466(function (Buffer){
22451 b = a 8467/**
22452 a = t 8468 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
22453 } 8469 * in FIPS 180-2
8470 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
8471 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
8472 *
8473 */
22454 8474
22455 this._a = add(a, _a) 8475var inherits = require('inherits')
22456 this._b = add(b, _b) 8476var Sha256 = require('./sha256')
22457 this._c = add(c, _c) 8477var Hash = require('./hash')
22458 this._d = add(d, _d)
22459 this._e = add(e, _e)
22460 }
22461 8478
22462 Sha1.prototype._hash = function () { 8479var W = new Array(64)
22463 if(POOL.length < 100) POOL.push(this)
22464 var H = new Buffer(20)
22465 //console.log(this._a|0, this._b|0, this._c|0, this._d|0, this._e|0)
22466 H.writeInt32BE(this._a|0, A)
22467 H.writeInt32BE(this._b|0, B)
22468 H.writeInt32BE(this._c|0, C)
22469 H.writeInt32BE(this._d|0, D)
22470 H.writeInt32BE(this._e|0, E)
22471 return H
22472 }
22473 8480
22474 /* 8481function Sha224 () {
22475 * Perform the appropriate triplet combination function for the current 8482 this.init()
22476 * iteration
22477 */
22478 function sha1_ft(t, b, c, d) {
22479 if(t < 20) return (b & c) | ((~b) & d);
22480 if(t < 40) return b ^ c ^ d;
22481 if(t < 60) return (b & c) | (b & d) | (c & d);
22482 return b ^ c ^ d;
22483 }
22484 8483
22485 /* 8484 this._w = W // new Array(64)
22486 * Determine the appropriate additive constant for the current iteration
22487 */
22488 function sha1_kt(t) {
22489 return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
22490 (t < 60) ? -1894007588 : -899497514;
22491 }
22492 8485
22493 /* 8486 Hash.call(this, 64, 56)
22494 * Add integers, wrapping at 2^32. This uses 16-bit operations internally 8487}
22495 * to work around bugs in some JS interpreters.
22496 * //dominictarr: this is 10 years old, so maybe this can be dropped?)
22497 *
22498 */
22499 function add(x, y) {
22500 return (x + y ) | 0
22501 //lets see how this goes on testling.
22502 // var lsw = (x & 0xFFFF) + (y & 0xFFFF);
22503 // var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
22504 // return (msw << 16) | (lsw & 0xFFFF);
22505 }
22506 8488
22507 /* 8489inherits(Sha224, Sha256)
22508 * Bitwise rotate a 32-bit number to the left. 8490
22509 */ 8491Sha224.prototype.init = function () {
22510 function rol(num, cnt) { 8492 this._a = 0xc1059ed8 | 0
22511 return (num << cnt) | (num >>> (32 - cnt)); 8493 this._b = 0x367cd507 | 0
22512 } 8494 this._c = 0x3070dd17 | 0
8495 this._d = 0xf70e5939 | 0
8496 this._e = 0xffc00b31 | 0
8497 this._f = 0x68581511 | 0
8498 this._g = 0x64f98fa7 | 0
8499 this._h = 0xbefa4fa4 | 0
22513 8500
22514 return Sha1 8501 return this
22515} 8502}
22516 8503
22517},{"util":14}],25:[function(_dereq_,module,exports){ 8504Sha224.prototype._hash = function () {
8505 var H = new Buffer(28)
8506
8507 H.writeInt32BE(this._a, 0)
8508 H.writeInt32BE(this._b, 4)
8509 H.writeInt32BE(this._c, 8)
8510 H.writeInt32BE(this._d, 12)
8511 H.writeInt32BE(this._e, 16)
8512 H.writeInt32BE(this._f, 20)
8513 H.writeInt32BE(this._g, 24)
22518 8514
8515 return H
8516}
8517
8518module.exports = Sha224
8519
8520}).call(this,require("buffer").Buffer)
8521},{"./hash":37,"./sha256":42,"buffer":7,"inherits":35}],42:[function(require,module,exports){
8522(function (Buffer){
22519/** 8523/**
22520 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined 8524 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
22521 * in FIPS 180-2 8525 * in FIPS 180-2
@@ -22524,6884 +8528,537 @@ module.exports = function (Buffer, Hash) {
22524 * 8528 *
22525 */ 8529 */
22526 8530
22527var inherits = _dereq_('util').inherits 8531var inherits = require('inherits')
22528var BE = false 8532var Hash = require('./hash')
22529var LE = true 8533
22530var u = _dereq_('./util') 8534var K = [
22531 8535 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
22532module.exports = function (Buffer, Hash) { 8536 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
22533 8537 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
22534 var K = [ 8538 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
22535 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 8539 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
22536 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 8540 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
22537 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 8541 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
22538 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 8542 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
22539 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 8543 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
22540 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 8544 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
22541 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 8545 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
22542 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, 8546 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
22543 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 8547 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
22544 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 8548 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
22545 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 8549 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
22546 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 8550 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
22547 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 8551]
22548 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 8552
22549 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 8553var W = new Array(64)
22550 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 8554
22551 ] 8555function Sha256 () {
8556 this.init()
8557
8558 this._w = W // new Array(64)
8559
8560 Hash.call(this, 64, 56)
8561}
8562
8563inherits(Sha256, Hash)
8564
8565Sha256.prototype.init = function () {
8566 this._a = 0x6a09e667 | 0
8567 this._b = 0xbb67ae85 | 0
8568 this._c = 0x3c6ef372 | 0
8569 this._d = 0xa54ff53a | 0
8570 this._e = 0x510e527f | 0
8571 this._f = 0x9b05688c | 0
8572 this._g = 0x1f83d9ab | 0
8573 this._h = 0x5be0cd19 | 0
22552 8574
22553 inherits(Sha256, Hash) 8575 return this
22554 var W = new Array(64) 8576}
22555 var POOL = []
22556 function Sha256() {
22557 // Closure compiler warning - this code lacks side effects - thus commented out
22558 // if(POOL.length) {
22559 // return POOL.shift().init()
22560 // }
22561 //this._data = new Buffer(32)
22562 8577
22563 this.init() 8578function S (X, n) {
8579 return (X >>> n) | (X << (32 - n))
8580}
22564 8581
22565 this._w = W //new Array(64) 8582function R (X, n) {
8583 return (X >>> n)
8584}
22566 8585
22567 Hash.call(this, 16*4, 14*4) 8586function Ch (x, y, z) {
22568 }; 8587 return ((x & y) ^ ((~x) & z))
8588}
22569 8589
22570 Sha256.prototype.init = function () { 8590function Maj (x, y, z) {
8591 return ((x & y) ^ (x & z) ^ (y & z))
8592}
22571 8593
22572 this._a = 0x6a09e667|0 8594function Sigma0256 (x) {
22573 this._b = 0xbb67ae85|0 8595 return (S(x, 2) ^ S(x, 13) ^ S(x, 22))
22574 this._c = 0x3c6ef372|0 8596}
22575 this._d = 0xa54ff53a|0
22576 this._e = 0x510e527f|0
22577 this._f = 0x9b05688c|0
22578 this._g = 0x1f83d9ab|0
22579 this._h = 0x5be0cd19|0
22580 8597
22581 this._len = this._s = 0 8598function Sigma1256 (x) {
8599 return (S(x, 6) ^ S(x, 11) ^ S(x, 25))
8600}
22582 8601
22583 return this 8602function Gamma0256 (x) {
22584 } 8603 return (S(x, 7) ^ S(x, 18) ^ R(x, 3))
8604}
22585 8605
22586 var safe_add = function(x, y) { 8606function Gamma1256 (x) {
22587 var lsw = (x & 0xFFFF) + (y & 0xFFFF); 8607 return (S(x, 17) ^ S(x, 19) ^ R(x, 10))
22588 var msw = (x >> 16) + (y >> 16) + (lsw >> 16); 8608}
22589 return (msw << 16) | (lsw & 0xFFFF);
22590 }
22591 8609
22592 function S (X, n) { 8610Sha256.prototype._update = function (M) {
22593 return (X >>> n) | (X << (32 - n)); 8611 var W = this._w
22594 }
22595 8612
22596 function R (X, n) { 8613 var a = this._a | 0
22597 return (X >>> n); 8614 var b = this._b | 0
22598 } 8615 var c = this._c | 0
8616 var d = this._d | 0
8617 var e = this._e | 0
8618 var f = this._f | 0
8619 var g = this._g | 0
8620 var h = this._h | 0
22599 8621
22600 function Ch (x, y, z) { 8622 var j = 0
22601 return ((x & y) ^ ((~x) & z));
22602 }
22603 8623
22604 function Maj (x, y, z) { 8624 function calcW () { return Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] }
22605 return ((x & y) ^ (x & z) ^ (y & z)); 8625 function loop (w) {
22606 } 8626 W[j] = w
22607 8627
22608 function Sigma0256 (x) { 8628 var T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w
22609 return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); 8629 var T2 = Sigma0256(a) + Maj(a, b, c)
22610 }
22611 8630
22612 function Sigma1256 (x) { 8631 h = g
22613 return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); 8632 g = f
22614 } 8633 f = e
8634 e = d + T1
8635 d = c
8636 c = b
8637 b = a
8638 a = T1 + T2
22615 8639
22616 function Gamma0256 (x) { 8640 j++
22617 return (S(x, 7) ^ S(x, 18) ^ R(x, 3));
22618 } 8641 }
22619 8642
22620 function Gamma1256 (x) { 8643 while (j < 16) loop(M.readInt32BE(j * 4))
22621 return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); 8644 while (j < 64) loop(calcW())
22622 }
22623 8645
22624 Sha256.prototype._update = function(m) { 8646 this._a = (a + this._a) | 0
22625 var M = this._block 8647 this._b = (b + this._b) | 0
22626 var W = this._w 8648 this._c = (c + this._c) | 0
22627 var a, b, c, d, e, f, g, h 8649 this._d = (d + this._d) | 0
22628 var T1, T2 8650 this._e = (e + this._e) | 0
8651 this._f = (f + this._f) | 0
8652 this._g = (g + this._g) | 0
8653 this._h = (h + this._h) | 0
8654}
22629 8655
22630 a = this._a | 0 8656Sha256.prototype._hash = function () {
22631 b = this._b | 0 8657 var H = new Buffer(32)
22632 c = this._c | 0
22633 d = this._d | 0
22634 e = this._e | 0
22635 f = this._f | 0
22636 g = this._g | 0
22637 h = this._h | 0
22638 8658
22639 for (var j = 0; j < 64; j++) { 8659 H.writeInt32BE(this._a, 0)
22640 var w = W[j] = j < 16 8660 H.writeInt32BE(this._b, 4)
22641 ? M.readInt32BE(j * 4) 8661 H.writeInt32BE(this._c, 8)
22642 : Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] 8662 H.writeInt32BE(this._d, 12)
8663 H.writeInt32BE(this._e, 16)
8664 H.writeInt32BE(this._f, 20)
8665 H.writeInt32BE(this._g, 24)
8666 H.writeInt32BE(this._h, 28)
22643 8667
22644 T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w 8668 return H
8669}
22645 8670
22646 T2 = Sigma0256(a) + Maj(a, b, c); 8671module.exports = Sha256
22647 h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2;
22648 }
22649 8672
22650 this._a = (a + this._a) | 0 8673}).call(this,require("buffer").Buffer)
22651 this._b = (b + this._b) | 0 8674},{"./hash":37,"buffer":7,"inherits":35}],43:[function(require,module,exports){
22652 this._c = (c + this._c) | 0 8675(function (Buffer){
22653 this._d = (d + this._d) | 0 8676var inherits = require('inherits')
22654 this._e = (e + this._e) | 0 8677var SHA512 = require('./sha512')
22655 this._f = (f + this._f) | 0 8678var Hash = require('./hash')
22656 this._g = (g + this._g) | 0
22657 this._h = (h + this._h) | 0
22658 8679
22659 }; 8680var W = new Array(160)
22660 8681
22661 Sha256.prototype._hash = function () { 8682function Sha384 () {
22662 if(POOL.length < 10) 8683 this.init()
22663 POOL.push(this) 8684 this._w = W
22664 8685
22665 var H = new Buffer(32) 8686 Hash.call(this, 128, 112)
8687}
22666 8688
22667 H.writeInt32BE(this._a, 0) 8689inherits(Sha384, SHA512)
22668 H.writeInt32BE(this._b, 4)
22669 H.writeInt32BE(this._c, 8)
22670 H.writeInt32BE(this._d, 12)
22671 H.writeInt32BE(this._e, 16)
22672 H.writeInt32BE(this._f, 20)
22673 H.writeInt32BE(this._g, 24)
22674 H.writeInt32BE(this._h, 28)
22675 8690
22676 return H 8691Sha384.prototype.init = function () {
22677 } 8692 this._a = 0xcbbb9d5d | 0
8693 this._b = 0x629a292a | 0
8694 this._c = 0x9159015a | 0
8695 this._d = 0x152fecd8 | 0
8696 this._e = 0x67332667 | 0
8697 this._f = 0x8eb44a87 | 0
8698 this._g = 0xdb0c2e0d | 0
8699 this._h = 0x47b5481d | 0
22678 8700
22679 return Sha256 8701 this._al = 0xc1059ed8 | 0
8702 this._bl = 0x367cd507 | 0
8703 this._cl = 0x3070dd17 | 0
8704 this._dl = 0xf70e5939 | 0
8705 this._el = 0xffc00b31 | 0
8706 this._fl = 0x68581511 | 0
8707 this._gl = 0x64f98fa7 | 0
8708 this._hl = 0xbefa4fa4 | 0
22680 8709
8710 return this
22681} 8711}
22682 8712
22683},{"./util":26,"util":14}],26:[function(_dereq_,module,exports){ 8713Sha384.prototype._hash = function () {
22684exports.write = write 8714 var H = new Buffer(48)
22685exports.zeroFill = zeroFill
22686
22687exports.toString = toString
22688 8715
22689function write (buffer, string, enc, start, from, to, LE) { 8716 function writeInt64BE (h, l, offset) {
22690 var l = (to - from) 8717 H.writeInt32BE(h, offset)
22691 if(enc === 'ascii' || enc === 'binary') { 8718 H.writeInt32BE(l, offset + 4)
22692 for( var i = 0; i < l; i++) {
22693 buffer[start + i] = string.charCodeAt(i + from)
22694 }
22695 } 8719 }
22696 else if(enc == null) {
22697 for( var i = 0; i < l; i++) {
22698 buffer[start + i] = string[i + from]
22699 }
22700 }
22701 else if(enc === 'hex') {
22702 for(var i = 0; i < l; i++) {
22703 var j = from + i
22704 buffer[start + i] = parseInt(string[j*2] + string[(j*2)+1], 16)
22705 }
22706 }
22707 else if(enc === 'base64') {
22708 throw new Error('base64 encoding not yet supported')
22709 }
22710 else
22711 throw new Error(enc +' encoding not yet supported')
22712}
22713 8720
22714//always fill to the end! 8721 writeInt64BE(this._a, this._al, 0)
22715function zeroFill(buf, from) { 8722 writeInt64BE(this._b, this._bl, 8)
22716 for(var i = from; i < buf.length; i++) 8723 writeInt64BE(this._c, this._cl, 16)
22717 buf[i] = 0 8724 writeInt64BE(this._d, this._dl, 24)
8725 writeInt64BE(this._e, this._el, 32)
8726 writeInt64BE(this._f, this._fl, 40)
8727
8728 return H
22718} 8729}
22719 8730
8731module.exports = Sha384
22720 8732
22721},{}],27:[function(_dereq_,module,exports){ 8733}).call(this,require("buffer").Buffer)
8734},{"./hash":37,"./sha512":44,"buffer":7,"inherits":35}],44:[function(require,module,exports){
22722(function (Buffer){ 8735(function (Buffer){
22723// JavaScript PBKDF2 Implementation 8736var inherits = require('inherits')
22724// Based on http://git.io/qsv2zw 8737var Hash = require('./hash')
22725// Licensed under LGPL v3 8738
22726// Copyright (c) 2013 jduncanator 8739var K = [
22727 8740 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
22728var blocksize = 64 8741 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
22729var zeroBuffer = new Buffer(blocksize); zeroBuffer.fill(0) 8742 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
22730 8743 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
22731module.exports = function (createHmac, exports) { 8744 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
22732 exports = exports || {} 8745 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
22733 8746 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
22734 exports.pbkdf2 = function(password, salt, iterations, keylen, cb) { 8747 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
22735 if('function' !== typeof cb) 8748 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
22736 throw new Error('No callback provided to pbkdf2'); 8749 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
22737 setTimeout(function () { 8750 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
22738 cb(null, exports.pbkdf2Sync(password, salt, iterations, keylen)) 8751 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
22739 }) 8752 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
22740 } 8753 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
22741 8754 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
22742 exports.pbkdf2Sync = function(key, salt, iterations, keylen) { 8755 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
22743 if('number' !== typeof iterations) 8756 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
22744 throw new TypeError('Iterations not a number') 8757 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
22745 if(iterations < 0) 8758 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
22746 throw new TypeError('Bad iterations') 8759 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
22747 if('number' !== typeof keylen) 8760 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
22748 throw new TypeError('Key length not a number') 8761 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
22749 if(keylen < 0) 8762 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
22750 throw new TypeError('Bad key length') 8763 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
22751 8764 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
22752 //stretch key to the correct length that hmac wants it, 8765 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
22753 //otherwise this will happen every time hmac is called 8766 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
22754 //twice per iteration. 8767 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
22755 var key = !Buffer.isBuffer(key) ? new Buffer(key) : key 8768 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
22756 8769 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
22757 if(key.length > blocksize) { 8770 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
22758 key = createHash(alg).update(key).digest() 8771 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
22759 } else if(key.length < blocksize) { 8772 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
22760 key = Buffer.concat([key, zeroBuffer], blocksize) 8773 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
22761 } 8774 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
8775 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
8776 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
8777 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
8778 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
8779 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
8780]
8781
8782var W = new Array(160)
8783
8784function Sha512 () {
8785 this.init()
8786 this._w = W
8787
8788 Hash.call(this, 128, 112)
8789}
8790
8791inherits(Sha512, Hash)
8792
8793Sha512.prototype.init = function () {
8794 this._a = 0x6a09e667 | 0
8795 this._b = 0xbb67ae85 | 0
8796 this._c = 0x3c6ef372 | 0
8797 this._d = 0xa54ff53a | 0
8798 this._e = 0x510e527f | 0
8799 this._f = 0x9b05688c | 0
8800 this._g = 0x1f83d9ab | 0
8801 this._h = 0x5be0cd19 | 0
8802
8803 this._al = 0xf3bcc908 | 0
8804 this._bl = 0x84caa73b | 0
8805 this._cl = 0xfe94f82b | 0
8806 this._dl = 0x5f1d36f1 | 0
8807 this._el = 0xade682d1 | 0
8808 this._fl = 0x2b3e6c1f | 0
8809 this._gl = 0xfb41bd6b | 0
8810 this._hl = 0x137e2179 | 0
22762 8811
22763 var HMAC; 8812 return this
22764 var cplen, p = 0, i = 1, itmp = new Buffer(4), digtmp;
22765 var out = new Buffer(keylen);
22766 out.fill(0);
22767 while(keylen) {
22768 if(keylen > 20)
22769 cplen = 20;
22770 else
22771 cplen = keylen;
22772
22773 /* We are unlikely to ever use more than 256 blocks (5120 bits!)
22774 * but just in case...
22775 */
22776 itmp[0] = (i >> 24) & 0xff;
22777 itmp[1] = (i >> 16) & 0xff;
22778 itmp[2] = (i >> 8) & 0xff;
22779 itmp[3] = i & 0xff;
22780
22781 HMAC = createHmac('sha1', key);
22782 HMAC.update(salt)
22783 HMAC.update(itmp);
22784 digtmp = HMAC.digest();
22785 digtmp.copy(out, p, 0, cplen);
22786
22787 for(var j = 1; j < iterations; j++) {
22788 HMAC = createHmac('sha1', key);
22789 HMAC.update(digtmp);
22790 digtmp = HMAC.digest();
22791 for(var k = 0; k < cplen; k++) {
22792 out[k] ^= digtmp[k];
22793 }
22794 }
22795 keylen -= cplen;
22796 i++;
22797 p += cplen;
22798 }
22799
22800 return out;
22801 }
22802
22803 return exports
22804} 8813}
22805 8814
22806}).call(this,_dereq_("buffer").Buffer) 8815function S (X, Xl, n) {
22807},{"buffer":8}],28:[function(_dereq_,module,exports){ 8816 return (X >>> n) | (Xl << (32 - n))
22808(function (Buffer){ 8817}
22809// Original code adapted from Robert Kieffer. 8818
22810// details at https://github.com/broofa/node-uuid 8819function Ch (x, y, z) {
8820 return ((x & y) ^ ((~x) & z))
8821}
8822
8823function Maj (x, y, z) {
8824 return ((x & y) ^ (x & z) ^ (y & z))
8825}
8826
8827Sha512.prototype._update = function (M) {
8828 var W = this._w
8829
8830 var a = this._a | 0
8831 var b = this._b | 0
8832 var c = this._c | 0
8833 var d = this._d | 0
8834 var e = this._e | 0
8835 var f = this._f | 0
8836 var g = this._g | 0
8837 var h = this._h | 0
8838
8839 var al = this._al | 0
8840 var bl = this._bl | 0
8841 var cl = this._cl | 0
8842 var dl = this._dl | 0
8843 var el = this._el | 0
8844 var fl = this._fl | 0
8845 var gl = this._gl | 0
8846 var hl = this._hl | 0
8847
8848 var i = 0, j = 0
8849 var Wi, Wil
8850 function calcW () {
8851 var x = W[j - 15 * 2]
8852 var xl = W[j - 15 * 2 + 1]
8853 var gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ (x >>> 7)
8854 var gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7)
8855
8856 x = W[j - 2 * 2]
8857 xl = W[j - 2 * 2 + 1]
8858 var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ (x >>> 6)
8859 var gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6)
8860
8861 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
8862 var Wi7 = W[j - 7 * 2]
8863 var Wi7l = W[j - 7 * 2 + 1]
8864
8865 var Wi16 = W[j - 16 * 2]
8866 var Wi16l = W[j - 16 * 2 + 1]
22811 8867
8868 Wil = gamma0l + Wi7l
8869 Wi = gamma0 + Wi7 + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0)
8870 Wil = Wil + gamma1l
8871 Wi = Wi + gamma1 + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0)
8872 Wil = Wil + Wi16l
8873 Wi = Wi + Wi16 + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0)
8874 }
8875
8876 function loop () {
8877 W[j] = Wi
8878 W[j + 1] = Wil
22812 8879
22813(function() { 8880 var maj = Maj(a, b, c)
22814 var _global = this; 8881 var majl = Maj(al, bl, cl)
22815 8882
22816 var mathRNG, whatwgRNG; 8883 var sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7)
8884 var sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7)
8885 var sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9)
8886 var sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9)
22817 8887
22818 // NOTE: Math.random() does not guarantee "cryptographic quality" 8888 // t1 = h + sigma1 + ch + K[i] + W[i]
22819 mathRNG = function(size) { 8889 var Ki = K[j]
22820 var bytes = new Buffer(size); 8890 var Kil = K[j + 1]
22821 var r;
22822 8891
22823 for (var i = 0, r; i < size; i++) { 8892 var ch = Ch(e, f, g)
22824 if ((i & 0x03) == 0) r = Math.random() * 0x100000000; 8893 var chl = Ch(el, fl, gl)
22825 bytes[i] = r >>> ((i & 0x03) << 3) & 0xff;
22826 }
22827 8894
22828 return bytes; 8895 var t1l = hl + sigma1l
22829 } 8896 var t1 = h + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0)
8897 t1l = t1l + chl
8898 t1 = t1 + ch + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0)
8899 t1l = t1l + Kil
8900 t1 = t1 + Ki + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0)
8901 t1l = t1l + Wil
8902 t1 = t1 + Wi + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0)
22830 8903
22831 if (_global.crypto && crypto.getRandomValues) { 8904 // t2 = sigma0 + maj
22832 whatwgRNG = function(size) { 8905 var t2l = sigma0l + majl
22833 var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array 8906 var t2 = sigma0h + maj + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0)
22834 crypto.getRandomValues(bytes);
22835 return bytes;
22836 }
22837 }
22838 8907
22839 module.exports = whatwgRNG || mathRNG; 8908 h = g
8909 hl = gl
8910 g = f
8911 gl = fl
8912 f = e
8913 fl = el
8914 el = (dl + t1l) | 0
8915 e = (d + t1 + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0
8916 d = c
8917 dl = cl
8918 c = b
8919 cl = bl
8920 b = a
8921 bl = al
8922 al = (t1l + t2l) | 0
8923 a = (t1 + t2 + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0
8924
8925 i++
8926 j += 2
8927 }
8928
8929 while (i < 16) {
8930 Wi = M.readInt32BE(j * 4)
8931 Wil = M.readInt32BE(j * 4 + 4)
8932
8933 loop()
8934 }
8935
8936 while (i < 80) {
8937 calcW()
8938 loop()
8939 }
8940
8941 this._al = (this._al + al) | 0
8942 this._bl = (this._bl + bl) | 0
8943 this._cl = (this._cl + cl) | 0
8944 this._dl = (this._dl + dl) | 0
8945 this._el = (this._el + el) | 0
8946 this._fl = (this._fl + fl) | 0
8947 this._gl = (this._gl + gl) | 0
8948 this._hl = (this._hl + hl) | 0
8949
8950 this._a = (this._a + a + ((this._al >>> 0) < (al >>> 0) ? 1 : 0)) | 0
8951 this._b = (this._b + b + ((this._bl >>> 0) < (bl >>> 0) ? 1 : 0)) | 0
8952 this._c = (this._c + c + ((this._cl >>> 0) < (cl >>> 0) ? 1 : 0)) | 0
8953 this._d = (this._d + d + ((this._dl >>> 0) < (dl >>> 0) ? 1 : 0)) | 0
8954 this._e = (this._e + e + ((this._el >>> 0) < (el >>> 0) ? 1 : 0)) | 0
8955 this._f = (this._f + f + ((this._fl >>> 0) < (fl >>> 0) ? 1 : 0)) | 0
8956 this._g = (this._g + g + ((this._gl >>> 0) < (gl >>> 0) ? 1 : 0)) | 0
8957 this._h = (this._h + h + ((this._hl >>> 0) < (hl >>> 0) ? 1 : 0)) | 0
8958}
8959
8960Sha512.prototype._hash = function () {
8961 var H = new Buffer(64)
8962
8963 function writeInt64BE (h, l, offset) {
8964 H.writeInt32BE(h, offset)
8965 H.writeInt32BE(l, offset + 4)
8966 }
8967
8968 writeInt64BE(this._a, this._al, 0)
8969 writeInt64BE(this._b, this._bl, 8)
8970 writeInt64BE(this._c, this._cl, 16)
8971 writeInt64BE(this._d, this._dl, 24)
8972 writeInt64BE(this._e, this._el, 32)
8973 writeInt64BE(this._f, this._fl, 40)
8974 writeInt64BE(this._g, this._gl, 48)
8975 writeInt64BE(this._h, this._hl, 56)
8976
8977 return H
8978}
8979
8980module.exports = Sha512
8981
8982}).call(this,require("buffer").Buffer)
8983},{"./hash":37,"buffer":7,"inherits":35}],45:[function(require,module,exports){
8984(function (Buffer){
8985'use strict';
8986var createHash = require('create-hash/browser');
8987var inherits = require('inherits')
22840 8988
22841}()) 8989var Transform = require('stream').Transform
22842 8990
22843}).call(this,_dereq_("buffer").Buffer) 8991var ZEROS = new Buffer(128)
22844},{"buffer":8}],29:[function(_dereq_,module,exports){ 8992ZEROS.fill(0)
22845;(function (root, factory, undef) {
22846 if (typeof exports === "object") {
22847 // CommonJS
22848 module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core"));
22849 }
22850 else if (typeof define === "function" && define.amd) {
22851 // AMD
22852 define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
22853 }
22854 else {
22855 // Global (browser)
22856 factory(root.CryptoJS);
22857 }
22858}(this, function (CryptoJS) {
22859
22860 (function () {
22861 // Shortcuts
22862 var C = CryptoJS;
22863 var C_lib = C.lib;
22864 var BlockCipher = C_lib.BlockCipher;
22865 var C_algo = C.algo;
22866
22867 // Lookup tables
22868 var SBOX = [];
22869 var INV_SBOX = [];
22870 var SUB_MIX_0 = [];
22871 var SUB_MIX_1 = [];
22872 var SUB_MIX_2 = [];
22873 var SUB_MIX_3 = [];
22874 var INV_SUB_MIX_0 = [];
22875 var INV_SUB_MIX_1 = [];
22876 var INV_SUB_MIX_2 = [];
22877 var INV_SUB_MIX_3 = [];
22878
22879 // Compute lookup tables
22880 (function () {
22881 // Compute double table
22882 var d = [];
22883 for (var i = 0; i < 256; i++) {
22884 if (i < 128) {
22885 d[i] = i << 1;
22886 } else {
22887 d[i] = (i << 1) ^ 0x11b;
22888 }
22889 }
22890
22891 // Walk GF(2^8)
22892 var x = 0;
22893 var xi = 0;
22894 for (var i = 0; i < 256; i++) {
22895 // Compute sbox
22896 var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
22897 sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
22898 SBOX[x] = sx;
22899 INV_SBOX[sx] = x;
22900
22901 // Compute multiplication
22902 var x2 = d[x];
22903 var x4 = d[x2];
22904 var x8 = d[x4];
22905
22906 // Compute sub bytes, mix columns tables
22907 var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
22908 SUB_MIX_0[x] = (t << 24) | (t >>> 8);
22909 SUB_MIX_1[x] = (t << 16) | (t >>> 16);
22910 SUB_MIX_2[x] = (t << 8) | (t >>> 24);
22911 SUB_MIX_3[x] = t;
22912
22913 // Compute inv sub bytes, inv mix columns tables
22914 var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
22915 INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
22916 INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
22917 INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
22918 INV_SUB_MIX_3[sx] = t;
22919
22920 // Compute next counter
22921 if (!x) {
22922 x = xi = 1;
22923 } else {
22924 x = x2 ^ d[d[d[x8 ^ x2]]];
22925 xi ^= d[d[xi]];
22926 }
22927 }
22928 }());
22929
22930 // Precomputed Rcon lookup
22931 var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
22932
22933 /**
22934 * AES block cipher algorithm.
22935 */
22936 var AES = C_algo.AES = BlockCipher.extend({
22937 _doReset: function () {
22938 // Shortcuts
22939 var key = this._key;
22940 var keyWords = key.words;
22941 var keySize = key.sigBytes / 4;
22942
22943 // Compute number of rounds
22944 var nRounds = this._nRounds = keySize + 6
22945
22946 // Compute number of key schedule rows
22947 var ksRows = (nRounds + 1) * 4;
22948
22949 // Compute key schedule
22950 var keySchedule = this._keySchedule = [];
22951 for (var ksRow = 0; ksRow < ksRows; ksRow++) {
22952 if (ksRow < keySize) {
22953 keySchedule[ksRow] = keyWords[ksRow];
22954 } else {
22955 var t = keySchedule[ksRow - 1];
22956
22957 if (!(ksRow % keySize)) {
22958 // Rot word
22959 t = (t << 8) | (t >>> 24);
22960
22961 // Sub word
22962 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
22963
22964 // Mix Rcon
22965 t ^= RCON[(ksRow / keySize) | 0] << 24;
22966 } else if (keySize > 6 && ksRow % keySize == 4) {
22967 // Sub word
22968 t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
22969 }
22970
22971 keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
22972 }
22973 }
22974
22975 // Compute inv key schedule
22976 var invKeySchedule = this._invKeySchedule = [];
22977 for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
22978 var ksRow = ksRows - invKsRow;
22979
22980 if (invKsRow % 4) {
22981 var t = keySchedule[ksRow];
22982 } else {
22983 var t = keySchedule[ksRow - 4];
22984 }
22985
22986 if (invKsRow < 4 || ksRow <= 4) {
22987 invKeySchedule[invKsRow] = t;
22988 } else {
22989 invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
22990 INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
22991 }
22992 }
22993 },
22994
22995 encryptBlock: function (M, offset) {
22996 this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
22997 },
22998
22999 decryptBlock: function (M, offset) {
23000 // Swap 2nd and 4th rows
23001 var t = M[offset + 1];
23002 M[offset + 1] = M[offset + 3];
23003 M[offset + 3] = t;
23004
23005 this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
23006
23007 // Inv swap 2nd and 4th rows
23008 var t = M[offset + 1];
23009 M[offset + 1] = M[offset + 3];
23010 M[offset + 3] = t;
23011 },
23012
23013 _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
23014 // Shortcut
23015 var nRounds = this._nRounds;
23016
23017 // Get input, add round key
23018 var s0 = M[offset] ^ keySchedule[0];
23019 var s1 = M[offset + 1] ^ keySchedule[1];
23020 var s2 = M[offset + 2] ^ keySchedule[2];
23021 var s3 = M[offset + 3] ^ keySchedule[3];
23022
23023 // Key schedule row counter
23024 var ksRow = 4;
23025
23026 // Rounds
23027 for (var round = 1; round < nRounds; round++) {
23028 // Shift rows, sub bytes, mix columns, add round key
23029 var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
23030 var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
23031 var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
23032 var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
23033
23034 // Update state
23035 s0 = t0;
23036 s1 = t1;
23037 s2 = t2;
23038 s3 = t3;
23039 }
23040
23041 // Shift rows, sub bytes, add round key
23042 var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
23043 var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
23044 var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
23045 var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
23046
23047 // Set output
23048 M[offset] = t0;
23049 M[offset + 1] = t1;
23050 M[offset + 2] = t2;
23051 M[offset + 3] = t3;
23052 },
23053
23054 keySize: 256/32
23055 });
23056
23057 /**
23058 * Shortcut functions to the cipher's object interface.
23059 *
23060 * @example
23061 *
23062 * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
23063 * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
23064 */
23065 C.AES = BlockCipher._createHelper(AES);
23066 }());
23067
23068
23069 return CryptoJS.AES;
23070
23071}));
23072},{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],30:[function(_dereq_,module,exports){
23073;(function (root, factory) {
23074 if (typeof exports === "object") {
23075 // CommonJS
23076 module.exports = exports = factory(_dereq_("./core"));
23077 }
23078 else if (typeof define === "function" && define.amd) {
23079 // AMD
23080 define(["./core"], factory);
23081 }
23082 else {
23083 // Global (browser)
23084 factory(root.CryptoJS);
23085 }
23086}(this, function (CryptoJS) {
23087
23088 /**
23089 * Cipher core components.
23090 */
23091 CryptoJS.lib.Cipher || (function (undefined) {
23092 // Shortcuts
23093 var C = CryptoJS;
23094 var C_lib = C.lib;
23095 var Base = C_lib.Base;
23096 var WordArray = C_lib.WordArray;
23097 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
23098 var C_enc = C.enc;
23099 var Utf8 = C_enc.Utf8;
23100 var Base64 = C_enc.Base64;
23101 var C_algo = C.algo;
23102 var EvpKDF = C_algo.EvpKDF;
23103
23104 /**
23105 * Abstract base cipher template.
23106 *
23107 * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
23108 * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
23109 * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
23110 * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
23111 */
23112 var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
23113 /**
23114 * Configuration options.
23115 *
23116 * @property {WordArray} iv The IV to use for this operation.
23117 */
23118 cfg: Base.extend(),
23119
23120 /**
23121 * Creates this cipher in encryption mode.
23122 *
23123 * @param {WordArray} key The key.
23124 * @param {Object} cfg (Optional) The configuration options to use for this operation.
23125 *
23126 * @return {Cipher} A cipher instance.
23127 *
23128 * @static
23129 *
23130 * @example
23131 *
23132 * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
23133 */
23134 createEncryptor: function (key, cfg) {
23135 return this.create(this._ENC_XFORM_MODE, key, cfg);
23136 },
23137
23138 /**
23139 * Creates this cipher in decryption mode.
23140 *
23141 * @param {WordArray} key The key.
23142 * @param {Object} cfg (Optional) The configuration options to use for this operation.
23143 *
23144 * @return {Cipher} A cipher instance.
23145 *
23146 * @static
23147 *
23148 * @example
23149 *
23150 * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
23151 */
23152 createDecryptor: function (key, cfg) {
23153 return this.create(this._DEC_XFORM_MODE, key, cfg);
23154 },
23155
23156 /**
23157 * Initializes a newly created cipher.
23158 *
23159 * @param {number} xformMode Either the encryption or decryption transormation mode constant.
23160 * @param {WordArray} key The key.
23161 * @param {Object} cfg (Optional) The configuration options to use for this operation.
23162 *
23163 * @example
23164 *
23165 * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
23166 */
23167 init: function (xformMode, key, cfg) {
23168 // Apply config defaults
23169 this.cfg = this.cfg.extend(cfg);
23170
23171 // Store transform mode and key
23172 this._xformMode = xformMode;
23173 this._key = key;
23174
23175 // Set initial values
23176 this.reset();
23177 },
23178
23179 /**
23180 * Resets this cipher to its initial state.
23181 *
23182 * @example
23183 *
23184 * cipher.reset();
23185 */
23186 reset: function () {
23187 // Reset data buffer
23188 BufferedBlockAlgorithm.reset.call(this);
23189
23190 // Perform concrete-cipher logic
23191 this._doReset();
23192 },
23193
23194 /**
23195 * Adds data to be encrypted or decrypted.
23196 *
23197 * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
23198 *
23199 * @return {WordArray} The data after processing.
23200 *
23201 * @example
23202 *
23203 * var encrypted = cipher.process('data');
23204 * var encrypted = cipher.process(wordArray);
23205 */
23206 process: function (dataUpdate) {
23207 // Append
23208 this._append(dataUpdate);
23209
23210 // Process available blocks
23211 return this._process();
23212 },
23213
23214 /**
23215 * Finalizes the encryption or decryption process.
23216 * Note that the finalize operation is effectively a destructive, read-once operation.
23217 *
23218 * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
23219 *
23220 * @return {WordArray} The data after final processing.
23221 *
23222 * @example
23223 *
23224 * var encrypted = cipher.finalize();
23225 * var encrypted = cipher.finalize('data');
23226 * var encrypted = cipher.finalize(wordArray);
23227 */
23228 finalize: function (dataUpdate) {
23229 // Final data update
23230 if (dataUpdate) {
23231 this._append(dataUpdate);
23232 }
23233
23234 // Perform concrete-cipher logic
23235 var finalProcessedData = this._doFinalize();
23236
23237 return finalProcessedData;
23238 },
23239
23240 keySize: 128/32,
23241
23242 ivSize: 128/32,
23243
23244 _ENC_XFORM_MODE: 1,
23245
23246 _DEC_XFORM_MODE: 2,
23247
23248 /**
23249 * Creates shortcut functions to a cipher's object interface.
23250 *
23251 * @param {Cipher} cipher The cipher to create a helper for.
23252 *
23253 * @return {Object} An object with encrypt and decrypt shortcut functions.
23254 *
23255 * @static
23256 *
23257 * @example
23258 *
23259 * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
23260 */
23261 _createHelper: (function () {
23262 function selectCipherStrategy(key) {
23263 if (typeof key == 'string') {
23264 return PasswordBasedCipher;
23265 } else {
23266 return SerializableCipher;
23267 }
23268 }
23269
23270 return function (cipher) {
23271 return {
23272 encrypt: function (message, key, cfg) {
23273 return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
23274 },
23275
23276 decrypt: function (ciphertext, key, cfg) {
23277 return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
23278 }
23279 };
23280 };
23281 }())
23282 });
23283
23284 /**
23285 * Abstract base stream cipher template.
23286 *
23287 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
23288 */
23289 var StreamCipher = C_lib.StreamCipher = Cipher.extend({
23290 _doFinalize: function () {
23291 // Process partial blocks
23292 var finalProcessedBlocks = this._process(!!'flush');
23293
23294 return finalProcessedBlocks;
23295 },
23296
23297 blockSize: 1
23298 });
23299
23300 /**
23301 * Mode namespace.
23302 */
23303 var C_mode = C.mode = {};
23304
23305 /**
23306 * Abstract base block cipher mode template.
23307 */
23308 var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
23309 /**
23310 * Creates this mode for encryption.
23311 *
23312 * @param {Cipher} cipher A block cipher instance.
23313 * @param {Array} iv The IV words.
23314 *
23315 * @static
23316 *
23317 * @example
23318 *
23319 * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
23320 */
23321 createEncryptor: function (cipher, iv) {
23322 return this.Encryptor.create(cipher, iv);
23323 },
23324
23325 /**
23326 * Creates this mode for decryption.
23327 *
23328 * @param {Cipher} cipher A block cipher instance.
23329 * @param {Array} iv The IV words.
23330 *
23331 * @static
23332 *
23333 * @example
23334 *
23335 * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
23336 */
23337 createDecryptor: function (cipher, iv) {
23338 return this.Decryptor.create(cipher, iv);
23339 },
23340
23341 /**
23342 * Initializes a newly created mode.
23343 *
23344 * @param {Cipher} cipher A block cipher instance.
23345 * @param {Array} iv The IV words.
23346 *
23347 * @example
23348 *
23349 * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
23350 */
23351 init: function (cipher, iv) {
23352 this._cipher = cipher;
23353 this._iv = iv;
23354 }
23355 });
23356
23357 /**
23358 * Cipher Block Chaining mode.
23359 */
23360 var CBC = C_mode.CBC = (function () {
23361 /**
23362 * Abstract base CBC mode.
23363 */
23364 var CBC = BlockCipherMode.extend();
23365
23366 /**
23367 * CBC encryptor.
23368 */
23369 CBC.Encryptor = CBC.extend({
23370 /**
23371 * Processes the data block at offset.
23372 *
23373 * @param {Array} words The data words to operate on.
23374 * @param {number} offset The offset where the block starts.
23375 *
23376 * @example
23377 *
23378 * mode.processBlock(data.words, offset);
23379 */
23380 processBlock: function (words, offset) {
23381 // Shortcuts
23382 var cipher = this._cipher;
23383 var blockSize = cipher.blockSize;
23384
23385 // XOR and encrypt
23386 xorBlock.call(this, words, offset, blockSize);
23387 cipher.encryptBlock(words, offset);
23388
23389 // Remember this block to use with next block
23390 this._prevBlock = words.slice(offset, offset + blockSize);
23391 }
23392 });
23393
23394 /**
23395 * CBC decryptor.
23396 */
23397 CBC.Decryptor = CBC.extend({
23398 /**
23399 * Processes the data block at offset.
23400 *
23401 * @param {Array} words The data words to operate on.
23402 * @param {number} offset The offset where the block starts.
23403 *
23404 * @example
23405 *
23406 * mode.processBlock(data.words, offset);
23407 */
23408 processBlock: function (words, offset) {
23409 // Shortcuts
23410 var cipher = this._cipher;
23411 var blockSize = cipher.blockSize;
23412
23413 // Remember this block to use with next block
23414 var thisBlock = words.slice(offset, offset + blockSize);
23415
23416 // Decrypt and XOR
23417 cipher.decryptBlock(words, offset);
23418 xorBlock.call(this, words, offset, blockSize);
23419
23420 // This block becomes the previous block
23421 this._prevBlock = thisBlock;
23422 }
23423 });
23424
23425 function xorBlock(words, offset, blockSize) {
23426 // Shortcut
23427 var iv = this._iv;
23428
23429 // Choose mixing block
23430 if (iv) {
23431 var block = iv;
23432
23433 // Remove IV for subsequent blocks
23434 this._iv = undefined;
23435 } else {
23436 var block = this._prevBlock;
23437 }
23438
23439 // XOR blocks
23440 for (var i = 0; i < blockSize; i++) {
23441 words[offset + i] ^= block[i];
23442 }
23443 }
23444
23445 return CBC;
23446 }());
23447
23448 /**
23449 * Padding namespace.
23450 */
23451 var C_pad = C.pad = {};
23452
23453 /**
23454 * PKCS #5/7 padding strategy.
23455 */
23456 var Pkcs7 = C_pad.Pkcs7 = {
23457 /**
23458 * Pads data using the algorithm defined in PKCS #5/7.
23459 *
23460 * @param {WordArray} data The data to pad.
23461 * @param {number} blockSize The multiple that the data should be padded to.
23462 *
23463 * @static
23464 *
23465 * @example
23466 *
23467 * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
23468 */
23469 pad: function (data, blockSize) {
23470 // Shortcut
23471 var blockSizeBytes = blockSize * 4;
23472
23473 // Count padding bytes
23474 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
23475
23476 // Create padding word
23477 var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;
23478
23479 // Create padding
23480 var paddingWords = [];
23481 for (var i = 0; i < nPaddingBytes; i += 4) {
23482 paddingWords.push(paddingWord);
23483 }
23484 var padding = WordArray.create(paddingWords, nPaddingBytes);
23485
23486 // Add padding
23487 data.concat(padding);
23488 },
23489
23490 /**
23491 * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
23492 *
23493 * @param {WordArray} data The data to unpad.
23494 *
23495 * @static
23496 *
23497 * @example
23498 *
23499 * CryptoJS.pad.Pkcs7.unpad(wordArray);
23500 */
23501 unpad: function (data) {
23502 // Get number of padding bytes from last byte
23503 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
23504
23505 // Remove padding
23506 data.sigBytes -= nPaddingBytes;
23507 }
23508 };
23509
23510 /**
23511 * Abstract base block cipher template.
23512 *
23513 * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
23514 */
23515 var BlockCipher = C_lib.BlockCipher = Cipher.extend({
23516 /**
23517 * Configuration options.
23518 *
23519 * @property {Mode} mode The block mode to use. Default: CBC
23520 * @property {Padding} padding The padding strategy to use. Default: Pkcs7
23521 */
23522 cfg: Cipher.cfg.extend({
23523 mode: CBC,
23524 padding: Pkcs7
23525 }),
23526
23527 reset: function () {
23528 // Reset cipher
23529 Cipher.reset.call(this);
23530
23531 // Shortcuts
23532 var cfg = this.cfg;
23533 var iv = cfg.iv;
23534 var mode = cfg.mode;
23535
23536 // Reset block mode
23537 if (this._xformMode == this._ENC_XFORM_MODE) {
23538 var modeCreator = mode.createEncryptor;
23539 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
23540 var modeCreator = mode.createDecryptor;
23541
23542 // Keep at least one block in the buffer for unpadding
23543 this._minBufferSize = 1;
23544 }
23545 this._mode = modeCreator.call(mode, this, iv && iv.words);
23546 },
23547
23548 _doProcessBlock: function (words, offset) {
23549 this._mode.processBlock(words, offset);
23550 },
23551
23552 _doFinalize: function () {
23553 // Shortcut
23554 var padding = this.cfg.padding;
23555
23556 // Finalize
23557 if (this._xformMode == this._ENC_XFORM_MODE) {
23558 // Pad data
23559 padding.pad(this._data, this.blockSize);
23560
23561 // Process final blocks
23562 var finalProcessedBlocks = this._process(!!'flush');
23563 } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
23564 // Process final blocks
23565 var finalProcessedBlocks = this._process(!!'flush');
23566
23567 // Unpad data
23568 padding.unpad(finalProcessedBlocks);
23569 }
23570
23571 return finalProcessedBlocks;
23572 },
23573
23574 blockSize: 128/32
23575 });
23576
23577 /**
23578 * A collection of cipher parameters.
23579 *
23580 * @property {WordArray} ciphertext The raw ciphertext.
23581 * @property {WordArray} key The key to this ciphertext.
23582 * @property {WordArray} iv The IV used in the ciphering operation.
23583 * @property {WordArray} salt The salt used with a key derivation function.
23584 * @property {Cipher} algorithm The cipher algorithm.
23585 * @property {Mode} mode The block mode used in the ciphering operation.
23586 * @property {Padding} padding The padding scheme used in the ciphering operation.
23587 * @property {number} blockSize The block size of the cipher.
23588 * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
23589 */
23590 var CipherParams = C_lib.CipherParams = Base.extend({
23591 /**
23592 * Initializes a newly created cipher params object.
23593 *
23594 * @param {Object} cipherParams An object with any of the possible cipher parameters.
23595 *
23596 * @example
23597 *
23598 * var cipherParams = CryptoJS.lib.CipherParams.create({
23599 * ciphertext: ciphertextWordArray,
23600 * key: keyWordArray,
23601 * iv: ivWordArray,
23602 * salt: saltWordArray,
23603 * algorithm: CryptoJS.algo.AES,
23604 * mode: CryptoJS.mode.CBC,
23605 * padding: CryptoJS.pad.PKCS7,
23606 * blockSize: 4,
23607 * formatter: CryptoJS.format.OpenSSL
23608 * });
23609 */
23610 init: function (cipherParams) {
23611 this.mixIn(cipherParams);
23612 },
23613
23614 /**
23615 * Converts this cipher params object to a string.
23616 *
23617 * @param {Format} formatter (Optional) The formatting strategy to use.
23618 *
23619 * @return {string} The stringified cipher params.
23620 *
23621 * @throws Error If neither the formatter nor the default formatter is set.
23622 *
23623 * @example
23624 *
23625 * var string = cipherParams + '';
23626 * var string = cipherParams.toString();
23627 * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
23628 */
23629 toString: function (formatter) {
23630 return (formatter || this.formatter).stringify(this);
23631 }
23632 });
23633
23634 /**
23635 * Format namespace.
23636 */
23637 var C_format = C.format = {};
23638
23639 /**
23640 * OpenSSL formatting strategy.
23641 */
23642 var OpenSSLFormatter = C_format.OpenSSL = {
23643 /**
23644 * Converts a cipher params object to an OpenSSL-compatible string.
23645 *
23646 * @param {CipherParams} cipherParams The cipher params object.
23647 *
23648 * @return {string} The OpenSSL-compatible string.
23649 *
23650 * @static
23651 *
23652 * @example
23653 *
23654 * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
23655 */
23656 stringify: function (cipherParams) {
23657 // Shortcuts
23658 var ciphertext = cipherParams.ciphertext;
23659 var salt = cipherParams.salt;
23660
23661 // Format
23662 if (salt) {
23663 var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
23664 } else {
23665 var wordArray = ciphertext;
23666 }
23667
23668 return wordArray.toString(Base64);
23669 },
23670
23671 /**
23672 * Converts an OpenSSL-compatible string to a cipher params object.
23673 *
23674 * @param {string} openSSLStr The OpenSSL-compatible string.
23675 *
23676 * @return {CipherParams} The cipher params object.
23677 *
23678 * @static
23679 *
23680 * @example
23681 *
23682 * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
23683 */
23684 parse: function (openSSLStr) {
23685 // Parse base64
23686 var ciphertext = Base64.parse(openSSLStr);
23687
23688 // Shortcut
23689 var ciphertextWords = ciphertext.words;
23690
23691 // Test for salt
23692 if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
23693 // Extract salt
23694 var salt = WordArray.create(ciphertextWords.slice(2, 4));
23695
23696 // Remove salt from ciphertext
23697 ciphertextWords.splice(0, 4);
23698 ciphertext.sigBytes -= 16;
23699 }
23700
23701 return CipherParams.create({ ciphertext: ciphertext, salt: salt });
23702 }
23703 };
23704
23705 /**
23706 * A cipher wrapper that returns ciphertext as a serializable cipher params object.
23707 */
23708 var SerializableCipher = C_lib.SerializableCipher = Base.extend({
23709 /**
23710 * Configuration options.
23711 *
23712 * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
23713 */
23714 cfg: Base.extend({
23715 format: OpenSSLFormatter
23716 }),
23717
23718 /**
23719 * Encrypts a message.
23720 *
23721 * @param {Cipher} cipher The cipher algorithm to use.
23722 * @param {WordArray|string} message The message to encrypt.
23723 * @param {WordArray} key The key.
23724 * @param {Object} cfg (Optional) The configuration options to use for this operation.
23725 *
23726 * @return {CipherParams} A cipher params object.
23727 *
23728 * @static
23729 *
23730 * @example
23731 *
23732 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
23733 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
23734 * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
23735 */
23736 encrypt: function (cipher, message, key, cfg) {
23737 // Apply config defaults
23738 cfg = this.cfg.extend(cfg);
23739
23740 // Encrypt
23741 var encryptor = cipher.createEncryptor(key, cfg);
23742 var ciphertext = encryptor.finalize(message);
23743
23744 // Shortcut
23745 var cipherCfg = encryptor.cfg;
23746
23747 // Create and return serializable cipher params
23748 return CipherParams.create({
23749 ciphertext: ciphertext,
23750 key: key,
23751 iv: cipherCfg.iv,
23752 algorithm: cipher,
23753 mode: cipherCfg.mode,
23754 padding: cipherCfg.padding,
23755 blockSize: cipher.blockSize,
23756 formatter: cfg.format
23757 });
23758 },
23759
23760 /**
23761 * Decrypts serialized ciphertext.
23762 *
23763 * @param {Cipher} cipher The cipher algorithm to use.
23764 * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
23765 * @param {WordArray} key The key.
23766 * @param {Object} cfg (Optional) The configuration options to use for this operation.
23767 *
23768 * @return {WordArray} The plaintext.
23769 *
23770 * @static
23771 *
23772 * @example
23773 *
23774 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
23775 * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
23776 */
23777 decrypt: function (cipher, ciphertext, key, cfg) {
23778 // Apply config defaults
23779 cfg = this.cfg.extend(cfg);
23780
23781 // Convert string to CipherParams
23782 ciphertext = this._parse(ciphertext, cfg.format);
23783
23784 // Decrypt
23785 var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
23786
23787 return plaintext;
23788 },
23789
23790 /**
23791 * Converts serialized ciphertext to CipherParams,
23792 * else assumed CipherParams already and returns ciphertext unchanged.
23793 *
23794 * @param {CipherParams|string} ciphertext The ciphertext.
23795 * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
23796 *
23797 * @return {CipherParams} The unserialized ciphertext.
23798 *
23799 * @static
23800 *
23801 * @example
23802 *
23803 * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
23804 */
23805 _parse: function (ciphertext, format) {
23806 if (typeof ciphertext == 'string') {
23807 return format.parse(ciphertext, this);
23808 } else {
23809 return ciphertext;
23810 }
23811 }
23812 });
23813
23814 /**
23815 * Key derivation function namespace.
23816 */
23817 var C_kdf = C.kdf = {};
23818
23819 /**
23820 * OpenSSL key derivation function.
23821 */
23822 var OpenSSLKdf = C_kdf.OpenSSL = {
23823 /**
23824 * Derives a key and IV from a password.
23825 *
23826 * @param {string} password The password to derive from.
23827 * @param {number} keySize The size in words of the key to generate.
23828 * @param {number} ivSize The size in words of the IV to generate.
23829 * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
23830 *
23831 * @return {CipherParams} A cipher params object with the key, IV, and salt.
23832 *
23833 * @static
23834 *
23835 * @example
23836 *
23837 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
23838 * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
23839 */
23840 execute: function (password, keySize, ivSize, salt) {
23841 // Generate random salt
23842 if (!salt) {
23843 salt = WordArray.random(64/8);
23844 }
23845
23846 // Derive key and IV
23847 var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
23848
23849 // Separate key and IV
23850 var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
23851 key.sigBytes = keySize * 4;
23852
23853 // Return params
23854 return CipherParams.create({ key: key, iv: iv, salt: salt });
23855 }
23856 };
23857
23858 /**
23859 * A serializable cipher wrapper that derives the key from a password,
23860 * and returns ciphertext as a serializable cipher params object.
23861 */
23862 var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
23863 /**
23864 * Configuration options.
23865 *
23866 * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
23867 */
23868 cfg: SerializableCipher.cfg.extend({
23869 kdf: OpenSSLKdf
23870 }),
23871
23872 /**
23873 * Encrypts a message using a password.
23874 *
23875 * @param {Cipher} cipher The cipher algorithm to use.
23876 * @param {WordArray|string} message The message to encrypt.
23877 * @param {string} password The password.
23878 * @param {Object} cfg (Optional) The configuration options to use for this operation.
23879 *
23880 * @return {CipherParams} A cipher params object.
23881 *
23882 * @static
23883 *
23884 * @example
23885 *
23886 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
23887 * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
23888 */
23889 encrypt: function (cipher, message, password, cfg) {
23890 // Apply config defaults
23891 cfg = this.cfg.extend(cfg);
23892
23893 // Derive key and other params
23894 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);
23895
23896 // Add IV to config
23897 cfg.iv = derivedParams.iv;
23898
23899 // Encrypt
23900 var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);
23901
23902 // Mix in derived params
23903 ciphertext.mixIn(derivedParams);
23904
23905 return ciphertext;
23906 },
23907
23908 /**
23909 * Decrypts serialized ciphertext using a password.
23910 *
23911 * @param {Cipher} cipher The cipher algorithm to use.
23912 * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
23913 * @param {string} password The password.
23914 * @param {Object} cfg (Optional) The configuration options to use for this operation.
23915 *
23916 * @return {WordArray} The plaintext.
23917 *
23918 * @static
23919 *
23920 * @example
23921 *
23922 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
23923 * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
23924 */
23925 decrypt: function (cipher, ciphertext, password, cfg) {
23926 // Apply config defaults
23927 cfg = this.cfg.extend(cfg);
23928
23929 // Convert string to CipherParams
23930 ciphertext = this._parse(ciphertext, cfg.format);
23931
23932 // Derive key and other params
23933 var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);
23934
23935 // Add IV to config
23936 cfg.iv = derivedParams.iv;
23937
23938 // Decrypt
23939 var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);
23940
23941 return plaintext;
23942 }
23943 });
23944 }());
23945
23946
23947}));
23948},{"./core":31}],31:[function(_dereq_,module,exports){
23949;(function (root, factory) {
23950 if (typeof exports === "object") {
23951 // CommonJS
23952 module.exports = exports = factory();
23953 }
23954 else if (typeof define === "function" && define.amd) {
23955 // AMD
23956 define([], factory);
23957 }
23958 else {
23959 // Global (browser)
23960 root.CryptoJS = factory();
23961 }
23962}(this, function () {
23963
23964 /**
23965 * CryptoJS core components.
23966 */
23967 var CryptoJS = CryptoJS || (function (Math, undefined) {
23968 /**
23969 * CryptoJS namespace.
23970 */
23971 var C = {};
23972
23973 /**
23974 * Library namespace.
23975 */
23976 var C_lib = C.lib = {};
23977
23978 /**
23979 * Base object for prototypal inheritance.
23980 */
23981 var Base = C_lib.Base = (function () {
23982 function F() {}
23983
23984 return {
23985 /**
23986 * Creates a new object that inherits from this object.
23987 *
23988 * @param {Object} overrides Properties to copy into the new object.
23989 *
23990 * @return {Object} The new object.
23991 *
23992 * @static
23993 *
23994 * @example
23995 *
23996 * var MyType = CryptoJS.lib.Base.extend({
23997 * field: 'value',
23998 *
23999 * method: function () {
24000 * }
24001 * });
24002 */
24003 extend: function (overrides) {
24004 // Spawn
24005 F.prototype = this;
24006 var subtype = new F();
24007
24008 // Augment
24009 if (overrides) {
24010 subtype.mixIn(overrides);
24011 }
24012
24013 // Create default initializer
24014 if (!subtype.hasOwnProperty('init')) {
24015 subtype.init = function () {
24016 subtype.$super.init.apply(this, arguments);
24017 };
24018 }
24019
24020 // Initializer's prototype is the subtype object
24021 subtype.init.prototype = subtype;
24022
24023 // Reference supertype
24024 subtype.$super = this;
24025
24026 return subtype;
24027 },
24028
24029 /**
24030 * Extends this object and runs the init method.
24031 * Arguments to create() will be passed to init().
24032 *
24033 * @return {Object} The new object.
24034 *
24035 * @static
24036 *
24037 * @example
24038 *
24039 * var instance = MyType.create();
24040 */
24041 create: function () {
24042 var instance = this.extend();
24043 instance.init.apply(instance, arguments);
24044
24045 return instance;
24046 },
24047
24048 /**
24049 * Initializes a newly created object.
24050 * Override this method to add some logic when your objects are created.
24051 *
24052 * @example
24053 *
24054 * var MyType = CryptoJS.lib.Base.extend({
24055 * init: function () {
24056 * // ...
24057 * }
24058 * });
24059 */
24060 init: function () {
24061 },
24062
24063 /**
24064 * Copies properties into this object.
24065 *
24066 * @param {Object} properties The properties to mix in.
24067 *
24068 * @example
24069 *
24070 * MyType.mixIn({
24071 * field: 'value'
24072 * });
24073 */
24074 mixIn: function (properties) {
24075 for (var propertyName in properties) {
24076 if (properties.hasOwnProperty(propertyName)) {
24077 this[propertyName] = properties[propertyName];
24078 }
24079 }
24080
24081 // IE won't copy toString using the loop above
24082 if (properties.hasOwnProperty('toString')) {
24083 this.toString = properties.toString;
24084 }
24085 },
24086
24087 /**
24088 * Creates a copy of this object.
24089 *
24090 * @return {Object} The clone.
24091 *
24092 * @example
24093 *
24094 * var clone = instance.clone();
24095 */
24096 clone: function () {
24097 return this.init.prototype.extend(this);
24098 }
24099 };
24100 }());
24101
24102 /**
24103 * An array of 32-bit words.
24104 *
24105 * @property {Array} words The array of 32-bit words.
24106 * @property {number} sigBytes The number of significant bytes in this word array.
24107 */
24108 var WordArray = C_lib.WordArray = Base.extend({
24109 /**
24110 * Initializes a newly created word array.
24111 *
24112 * @param {Array} words (Optional) An array of 32-bit words.
24113 * @param {number} sigBytes (Optional) The number of significant bytes in the words.
24114 *
24115 * @example
24116 *
24117 * var wordArray = CryptoJS.lib.WordArray.create();
24118 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
24119 * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
24120 */
24121 init: function (words, sigBytes) {
24122 words = this.words = words || [];
24123
24124 if (sigBytes != undefined) {
24125 this.sigBytes = sigBytes;
24126 } else {
24127 this.sigBytes = words.length * 4;
24128 }
24129 },
24130
24131 /**
24132 * Converts this word array to a string.
24133 *
24134 * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
24135 *
24136 * @return {string} The stringified word array.
24137 *
24138 * @example
24139 *
24140 * var string = wordArray + '';
24141 * var string = wordArray.toString();
24142 * var string = wordArray.toString(CryptoJS.enc.Utf8);
24143 */
24144 toString: function (encoder) {
24145 return (encoder || Hex).stringify(this);
24146 },
24147
24148 /**
24149 * Concatenates a word array to this word array.
24150 *
24151 * @param {WordArray} wordArray The word array to append.
24152 *
24153 * @return {WordArray} This word array.
24154 *
24155 * @example
24156 *
24157 * wordArray1.concat(wordArray2);
24158 */
24159 concat: function (wordArray) {
24160 // Shortcuts
24161 var thisWords = this.words;
24162 var thatWords = wordArray.words;
24163 var thisSigBytes = this.sigBytes;
24164 var thatSigBytes = wordArray.sigBytes;
24165
24166 // Clamp excess bits
24167 this.clamp();
24168
24169 // Concat
24170 if (thisSigBytes % 4) {
24171 // Copy one byte at a time
24172 for (var i = 0; i < thatSigBytes; i++) {
24173 var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
24174 thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
24175 }
24176 } else if (thatWords.length > 0xffff) {
24177 // Copy one word at a time
24178 for (var i = 0; i < thatSigBytes; i += 4) {
24179 thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
24180 }
24181 } else {
24182 // Copy all words at once
24183 thisWords.push.apply(thisWords, thatWords);
24184 }
24185 this.sigBytes += thatSigBytes;
24186
24187 // Chainable
24188 return this;
24189 },
24190
24191 /**
24192 * Removes insignificant bits.
24193 *
24194 * @example
24195 *
24196 * wordArray.clamp();
24197 */
24198 clamp: function () {
24199 // Shortcuts
24200 var words = this.words;
24201 var sigBytes = this.sigBytes;
24202
24203 // Clamp
24204 words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
24205 words.length = Math.ceil(sigBytes / 4);
24206 },
24207
24208 /**
24209 * Creates a copy of this word array.
24210 *
24211 * @return {WordArray} The clone.
24212 *
24213 * @example
24214 *
24215 * var clone = wordArray.clone();
24216 */
24217 clone: function () {
24218 var clone = Base.clone.call(this);
24219 clone.words = this.words.slice(0);
24220
24221 return clone;
24222 },
24223
24224 /**
24225 * Creates a word array filled with random bytes.
24226 *
24227 * @param {number} nBytes The number of random bytes to generate.
24228 *
24229 * @return {WordArray} The random word array.
24230 *
24231 * @static
24232 *
24233 * @example
24234 *
24235 * var wordArray = CryptoJS.lib.WordArray.random(16);
24236 */
24237 random: function (nBytes) {
24238 var words = [];
24239 for (var i = 0; i < nBytes; i += 4) {
24240 words.push((Math.random() * 0x100000000) | 0);
24241 }
24242
24243 return new WordArray.init(words, nBytes);
24244 }
24245 });
24246
24247 /**
24248 * Encoder namespace.
24249 */
24250 var C_enc = C.enc = {};
24251
24252 /**
24253 * Hex encoding strategy.
24254 */
24255 var Hex = C_enc.Hex = {
24256 /**
24257 * Converts a word array to a hex string.
24258 *
24259 * @param {WordArray} wordArray The word array.
24260 *
24261 * @return {string} The hex string.
24262 *
24263 * @static
24264 *
24265 * @example
24266 *
24267 * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
24268 */
24269 stringify: function (wordArray) {
24270 // Shortcuts
24271 var words = wordArray.words;
24272 var sigBytes = wordArray.sigBytes;
24273
24274 // Convert
24275 var hexChars = [];
24276 for (var i = 0; i < sigBytes; i++) {
24277 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
24278 hexChars.push((bite >>> 4).toString(16));
24279 hexChars.push((bite & 0x0f).toString(16));
24280 }
24281
24282 return hexChars.join('');
24283 },
24284
24285 /**
24286 * Converts a hex string to a word array.
24287 *
24288 * @param {string} hexStr The hex string.
24289 *
24290 * @return {WordArray} The word array.
24291 *
24292 * @static
24293 *
24294 * @example
24295 *
24296 * var wordArray = CryptoJS.enc.Hex.parse(hexString);
24297 */
24298 parse: function (hexStr) {
24299 // Shortcut
24300 var hexStrLength = hexStr.length;
24301
24302 // Convert
24303 var words = [];
24304 for (var i = 0; i < hexStrLength; i += 2) {
24305 words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
24306 }
24307
24308 return new WordArray.init(words, hexStrLength / 2);
24309 }
24310 };
24311
24312 /**
24313 * Latin1 encoding strategy.
24314 */
24315 var Latin1 = C_enc.Latin1 = {
24316 /**
24317 * Converts a word array to a Latin1 string.
24318 *
24319 * @param {WordArray} wordArray The word array.
24320 *
24321 * @return {string} The Latin1 string.
24322 *
24323 * @static
24324 *
24325 * @example
24326 *
24327 * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
24328 */
24329 stringify: function (wordArray) {
24330 // Shortcuts
24331 var words = wordArray.words;
24332 var sigBytes = wordArray.sigBytes;
24333
24334 // Convert
24335 var latin1Chars = [];
24336 for (var i = 0; i < sigBytes; i++) {
24337 var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
24338 latin1Chars.push(String.fromCharCode(bite));
24339 }
24340
24341 return latin1Chars.join('');
24342 },
24343
24344 /**
24345 * Converts a Latin1 string to a word array.
24346 *
24347 * @param {string} latin1Str The Latin1 string.
24348 *
24349 * @return {WordArray} The word array.
24350 *
24351 * @static
24352 *
24353 * @example
24354 *
24355 * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
24356 */
24357 parse: function (latin1Str) {
24358 // Shortcut
24359 var latin1StrLength = latin1Str.length;
24360
24361 // Convert
24362 var words = [];
24363 for (var i = 0; i < latin1StrLength; i++) {
24364 words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
24365 }
24366
24367 return new WordArray.init(words, latin1StrLength);
24368 }
24369 };
24370
24371 /**
24372 * UTF-8 encoding strategy.
24373 */
24374 var Utf8 = C_enc.Utf8 = {
24375 /**
24376 * Converts a word array to a UTF-8 string.
24377 *
24378 * @param {WordArray} wordArray The word array.
24379 *
24380 * @return {string} The UTF-8 string.
24381 *
24382 * @static
24383 *
24384 * @example
24385 *
24386 * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
24387 */
24388 stringify: function (wordArray) {
24389 try {
24390 return decodeURIComponent(escape(Latin1.stringify(wordArray)));
24391 } catch (e) {
24392 throw new Error('Malformed UTF-8 data');
24393 }
24394 },
24395
24396 /**
24397 * Converts a UTF-8 string to a word array.
24398 *
24399 * @param {string} utf8Str The UTF-8 string.
24400 *
24401 * @return {WordArray} The word array.
24402 *
24403 * @static
24404 *
24405 * @example
24406 *
24407 * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
24408 */
24409 parse: function (utf8Str) {
24410 return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
24411 }
24412 };
24413
24414 /**
24415 * Abstract buffered block algorithm template.
24416 *
24417 * The property blockSize must be implemented in a concrete subtype.
24418 *
24419 * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
24420 */
24421 var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
24422 /**
24423 * Resets this block algorithm's data buffer to its initial state.
24424 *
24425 * @example
24426 *
24427 * bufferedBlockAlgorithm.reset();
24428 */
24429 reset: function () {
24430 // Initial values
24431 this._data = new WordArray.init();
24432 this._nDataBytes = 0;
24433 },
24434
24435 /**
24436 * Adds new data to this block algorithm's buffer.
24437 *
24438 * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
24439 *
24440 * @example
24441 *
24442 * bufferedBlockAlgorithm._append('data');
24443 * bufferedBlockAlgorithm._append(wordArray);
24444 */
24445 _append: function (data) {
24446 // Convert string to WordArray, else assume WordArray already
24447 if (typeof data == 'string') {
24448 data = Utf8.parse(data);
24449 }
24450
24451 // Append
24452 this._data.concat(data);
24453 this._nDataBytes += data.sigBytes;
24454 },
24455
24456 /**
24457 * Processes available data blocks.
24458 *
24459 * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
24460 *
24461 * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
24462 *
24463 * @return {WordArray} The processed data.
24464 *
24465 * @example
24466 *
24467 * var processedData = bufferedBlockAlgorithm._process();
24468 * var processedData = bufferedBlockAlgorithm._process(!!'flush');
24469 */
24470 _process: function (doFlush) {
24471 // Shortcuts
24472 var data = this._data;
24473 var dataWords = data.words;
24474 var dataSigBytes = data.sigBytes;
24475 var blockSize = this.blockSize;
24476 var blockSizeBytes = blockSize * 4;
24477
24478 // Count blocks ready
24479 var nBlocksReady = dataSigBytes / blockSizeBytes;
24480 if (doFlush) {
24481 // Round up to include partial blocks
24482 nBlocksReady = Math.ceil(nBlocksReady);
24483 } else {
24484 // Round down to include only full blocks,
24485 // less the number of blocks that must remain in the buffer
24486 nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
24487 }
24488
24489 // Count words ready
24490 var nWordsReady = nBlocksReady * blockSize;
24491
24492 // Count bytes ready
24493 var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);
24494
24495 // Process blocks
24496 if (nWordsReady) {
24497 for (var offset = 0; offset < nWordsReady; offset += blockSize) {
24498 // Perform concrete-algorithm logic
24499 this._doProcessBlock(dataWords, offset);
24500 }
24501
24502 // Remove processed words
24503 var processedWords = dataWords.splice(0, nWordsReady);
24504 data.sigBytes -= nBytesReady;
24505 }
24506
24507 // Return processed words
24508 return new WordArray.init(processedWords, nBytesReady);
24509 },
24510
24511 /**
24512 * Creates a copy of this object.
24513 *
24514 * @return {Object} The clone.
24515 *
24516 * @example
24517 *
24518 * var clone = bufferedBlockAlgorithm.clone();
24519 */
24520 clone: function () {
24521 var clone = Base.clone.call(this);
24522 clone._data = this._data.clone();
24523
24524 return clone;
24525 },
24526
24527 _minBufferSize: 0
24528 });
24529
24530 /**
24531 * Abstract hasher template.
24532 *
24533 * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
24534 */
24535 var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
24536 /**
24537 * Configuration options.
24538 */
24539 cfg: Base.extend(),
24540
24541 /**
24542 * Initializes a newly created hasher.
24543 *
24544 * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
24545 *
24546 * @example
24547 *
24548 * var hasher = CryptoJS.algo.SHA256.create();
24549 */
24550 init: function (cfg) {
24551 // Apply config defaults
24552 this.cfg = this.cfg.extend(cfg);
24553
24554 // Set initial values
24555 this.reset();
24556 },
24557
24558 /**
24559 * Resets this hasher to its initial state.
24560 *
24561 * @example
24562 *
24563 * hasher.reset();
24564 */
24565 reset: function () {
24566 // Reset data buffer
24567 BufferedBlockAlgorithm.reset.call(this);
24568
24569 // Perform concrete-hasher logic
24570 this._doReset();
24571 },
24572
24573 /**
24574 * Updates this hasher with a message.
24575 *
24576 * @param {WordArray|string} messageUpdate The message to append.
24577 *
24578 * @return {Hasher} This hasher.
24579 *
24580 * @example
24581 *
24582 * hasher.update('message');
24583 * hasher.update(wordArray);
24584 */
24585 update: function (messageUpdate) {
24586 // Append
24587 this._append(messageUpdate);
24588
24589 // Update the hash
24590 this._process();
24591
24592 // Chainable
24593 return this;
24594 },
24595
24596 /**
24597 * Finalizes the hash computation.
24598 * Note that the finalize operation is effectively a destructive, read-once operation.
24599 *
24600 * @param {WordArray|string} messageUpdate (Optional) A final message update.
24601 *
24602 * @return {WordArray} The hash.
24603 *
24604 * @example
24605 *
24606 * var hash = hasher.finalize();
24607 * var hash = hasher.finalize('message');
24608 * var hash = hasher.finalize(wordArray);
24609 */
24610 finalize: function (messageUpdate) {
24611 // Final message update
24612 if (messageUpdate) {
24613 this._append(messageUpdate);
24614 }
24615
24616 // Perform concrete-hasher logic
24617 var hash = this._doFinalize();
24618
24619 return hash;
24620 },
24621
24622 blockSize: 512/32,
24623
24624 /**
24625 * Creates a shortcut function to a hasher's object interface.
24626 *
24627 * @param {Hasher} hasher The hasher to create a helper for.
24628 *
24629 * @return {Function} The shortcut function.
24630 *
24631 * @static
24632 *
24633 * @example
24634 *
24635 * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
24636 */
24637 _createHelper: function (hasher) {
24638 return function (message, cfg) {
24639 return new hasher.init(cfg).finalize(message);
24640 };
24641 },
24642
24643 /**
24644 * Creates a shortcut function to the HMAC's object interface.
24645 *
24646 * @param {Hasher} hasher The hasher to use in this HMAC helper.
24647 *
24648 * @return {Function} The shortcut function.
24649 *
24650 * @static
24651 *
24652 * @example
24653 *
24654 * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
24655 */
24656 _createHmacHelper: function (hasher) {
24657 return function (message, key) {
24658 return new C_algo.HMAC.init(hasher, key).finalize(message);
24659 };
24660 }
24661 });
24662
24663 /**
24664 * Algorithm namespace.
24665 */
24666 var C_algo = C.algo = {};
24667
24668 return C;
24669 }(Math));
24670
24671
24672 return CryptoJS;
24673
24674}));
24675},{}],32:[function(_dereq_,module,exports){
24676;(function (root, factory) {
24677 if (typeof exports === "object") {
24678 // CommonJS
24679 module.exports = exports = factory(_dereq_("./core"));
24680 }
24681 else if (typeof define === "function" && define.amd) {
24682 // AMD
24683 define(["./core"], factory);
24684 }
24685 else {
24686 // Global (browser)
24687 factory(root.CryptoJS);
24688 }
24689}(this, function (CryptoJS) {
24690
24691 (function () {
24692 // Shortcuts
24693 var C = CryptoJS;
24694 var C_lib = C.lib;
24695 var WordArray = C_lib.WordArray;
24696 var C_enc = C.enc;
24697
24698 /**
24699 * Base64 encoding strategy.
24700 */
24701 var Base64 = C_enc.Base64 = {
24702 /**
24703 * Converts a word array to a Base64 string.
24704 *
24705 * @param {WordArray} wordArray The word array.
24706 *
24707 * @return {string} The Base64 string.
24708 *
24709 * @static
24710 *
24711 * @example
24712 *
24713 * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
24714 */
24715 stringify: function (wordArray) {
24716 // Shortcuts
24717 var words = wordArray.words;
24718 var sigBytes = wordArray.sigBytes;
24719 var map = this._map;
24720
24721 // Clamp excess bits
24722 wordArray.clamp();
24723
24724 // Convert
24725 var base64Chars = [];
24726 for (var i = 0; i < sigBytes; i += 3) {
24727 var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
24728 var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
24729 var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
24730
24731 var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
24732
24733 for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
24734 base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
24735 }
24736 }
24737
24738 // Add padding
24739 var paddingChar = map.charAt(64);
24740 if (paddingChar) {
24741 while (base64Chars.length % 4) {
24742 base64Chars.push(paddingChar);
24743 }
24744 }
24745
24746 return base64Chars.join('');
24747 },
24748
24749 /**
24750 * Converts a Base64 string to a word array.
24751 *
24752 * @param {string} base64Str The Base64 string.
24753 *
24754 * @return {WordArray} The word array.
24755 *
24756 * @static
24757 *
24758 * @example
24759 *
24760 * var wordArray = CryptoJS.enc.Base64.parse(base64String);
24761 */
24762 parse: function (base64Str) {
24763 // Shortcuts
24764 var base64StrLength = base64Str.length;
24765 var map = this._map;
24766
24767 // Ignore padding
24768 var paddingChar = map.charAt(64);
24769 if (paddingChar) {
24770 var paddingIndex = base64Str.indexOf(paddingChar);
24771 if (paddingIndex != -1) {
24772 base64StrLength = paddingIndex;
24773 }
24774 }
24775
24776 // Convert
24777 var words = [];
24778 var nBytes = 0;
24779 for (var i = 0; i < base64StrLength; i++) {
24780 if (i % 4) {
24781 var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2);
24782 var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2);
24783 words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
24784 nBytes++;
24785 }
24786 }
24787
24788 return WordArray.create(words, nBytes);
24789 },
24790
24791 _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
24792 };
24793 }());
24794
24795
24796 return CryptoJS.enc.Base64;
24797
24798}));
24799},{"./core":31}],33:[function(_dereq_,module,exports){
24800;(function (root, factory) {
24801 if (typeof exports === "object") {
24802 // CommonJS
24803 module.exports = exports = factory(_dereq_("./core"));
24804 }
24805 else if (typeof define === "function" && define.amd) {
24806 // AMD
24807 define(["./core"], factory);
24808 }
24809 else {
24810 // Global (browser)
24811 factory(root.CryptoJS);
24812 }
24813}(this, function (CryptoJS) {
24814
24815 (function () {
24816 // Shortcuts
24817 var C = CryptoJS;
24818 var C_lib = C.lib;
24819 var WordArray = C_lib.WordArray;
24820 var C_enc = C.enc;
24821
24822 /**
24823 * UTF-16 BE encoding strategy.
24824 */
24825 var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
24826 /**
24827 * Converts a word array to a UTF-16 BE string.
24828 *
24829 * @param {WordArray} wordArray The word array.
24830 *
24831 * @return {string} The UTF-16 BE string.
24832 *
24833 * @static
24834 *
24835 * @example
24836 *
24837 * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
24838 */
24839 stringify: function (wordArray) {
24840 // Shortcuts
24841 var words = wordArray.words;
24842 var sigBytes = wordArray.sigBytes;
24843
24844 // Convert
24845 var utf16Chars = [];
24846 for (var i = 0; i < sigBytes; i += 2) {
24847 var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
24848 utf16Chars.push(String.fromCharCode(codePoint));
24849 }
24850
24851 return utf16Chars.join('');
24852 },
24853
24854 /**
24855 * Converts a UTF-16 BE string to a word array.
24856 *
24857 * @param {string} utf16Str The UTF-16 BE string.
24858 *
24859 * @return {WordArray} The word array.
24860 *
24861 * @static
24862 *
24863 * @example
24864 *
24865 * var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
24866 */
24867 parse: function (utf16Str) {
24868 // Shortcut
24869 var utf16StrLength = utf16Str.length;
24870
24871 // Convert
24872 var words = [];
24873 for (var i = 0; i < utf16StrLength; i++) {
24874 words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
24875 }
24876
24877 return WordArray.create(words, utf16StrLength * 2);
24878 }
24879 };
24880
24881 /**
24882 * UTF-16 LE encoding strategy.
24883 */
24884 C_enc.Utf16LE = {
24885 /**
24886 * Converts a word array to a UTF-16 LE string.
24887 *
24888 * @param {WordArray} wordArray The word array.
24889 *
24890 * @return {string} The UTF-16 LE string.
24891 *
24892 * @static
24893 *
24894 * @example
24895 *
24896 * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
24897 */
24898 stringify: function (wordArray) {
24899 // Shortcuts
24900 var words = wordArray.words;
24901 var sigBytes = wordArray.sigBytes;
24902
24903 // Convert
24904 var utf16Chars = [];
24905 for (var i = 0; i < sigBytes; i += 2) {
24906 var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
24907 utf16Chars.push(String.fromCharCode(codePoint));
24908 }
24909
24910 return utf16Chars.join('');
24911 },
24912
24913 /**
24914 * Converts a UTF-16 LE string to a word array.
24915 *
24916 * @param {string} utf16Str The UTF-16 LE string.
24917 *
24918 * @return {WordArray} The word array.
24919 *
24920 * @static
24921 *
24922 * @example
24923 *
24924 * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
24925 */
24926 parse: function (utf16Str) {
24927 // Shortcut
24928 var utf16StrLength = utf16Str.length;
24929
24930 // Convert
24931 var words = [];
24932 for (var i = 0; i < utf16StrLength; i++) {
24933 words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
24934 }
24935
24936 return WordArray.create(words, utf16StrLength * 2);
24937 }
24938 };
24939
24940 function swapEndian(word) {
24941 return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
24942 }
24943 }());
24944
24945
24946 return CryptoJS.enc.Utf16;
24947
24948}));
24949},{"./core":31}],34:[function(_dereq_,module,exports){
24950;(function (root, factory, undef) {
24951 if (typeof exports === "object") {
24952 // CommonJS
24953 module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac"));
24954 }
24955 else if (typeof define === "function" && define.amd) {
24956 // AMD
24957 define(["./core", "./sha1", "./hmac"], factory);
24958 }
24959 else {
24960 // Global (browser)
24961 factory(root.CryptoJS);
24962 }
24963}(this, function (CryptoJS) {
24964
24965 (function () {
24966 // Shortcuts
24967 var C = CryptoJS;
24968 var C_lib = C.lib;
24969 var Base = C_lib.Base;
24970 var WordArray = C_lib.WordArray;
24971 var C_algo = C.algo;
24972 var MD5 = C_algo.MD5;
24973
24974 /**
24975 * This key derivation function is meant to conform with EVP_BytesToKey.
24976 * www.openssl.org/docs/crypto/EVP_BytesToKey.html
24977 */
24978 var EvpKDF = C_algo.EvpKDF = Base.extend({
24979 /**
24980 * Configuration options.
24981 *
24982 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
24983 * @property {Hasher} hasher The hash algorithm to use. Default: MD5
24984 * @property {number} iterations The number of iterations to perform. Default: 1
24985 */
24986 cfg: Base.extend({
24987 keySize: 128/32,
24988 hasher: MD5,
24989 iterations: 1
24990 }),
24991
24992 /**
24993 * Initializes a newly created key derivation function.
24994 *
24995 * @param {Object} cfg (Optional) The configuration options to use for the derivation.
24996 *
24997 * @example
24998 *
24999 * var kdf = CryptoJS.algo.EvpKDF.create();
25000 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
25001 * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
25002 */
25003 init: function (cfg) {
25004 this.cfg = this.cfg.extend(cfg);
25005 },
25006
25007 /**
25008 * Derives a key from a password.
25009 *
25010 * @param {WordArray|string} password The password.
25011 * @param {WordArray|string} salt A salt.
25012 *
25013 * @return {WordArray} The derived key.
25014 *
25015 * @example
25016 *
25017 * var key = kdf.compute(password, salt);
25018 */
25019 compute: function (password, salt) {
25020 // Shortcut
25021 var cfg = this.cfg;
25022
25023 // Init hasher
25024 var hasher = cfg.hasher.create();
25025
25026 // Initial values
25027 var derivedKey = WordArray.create();
25028
25029 // Shortcuts
25030 var derivedKeyWords = derivedKey.words;
25031 var keySize = cfg.keySize;
25032 var iterations = cfg.iterations;
25033
25034 // Generate key
25035 while (derivedKeyWords.length < keySize) {
25036 if (block) {
25037 hasher.update(block);
25038 }
25039 var block = hasher.update(password).finalize(salt);
25040 hasher.reset();
25041
25042 // Iterations
25043 for (var i = 1; i < iterations; i++) {
25044 block = hasher.finalize(block);
25045 hasher.reset();
25046 }
25047
25048 derivedKey.concat(block);
25049 }
25050 derivedKey.sigBytes = keySize * 4;
25051
25052 return derivedKey;
25053 }
25054 });
25055
25056 /**
25057 * Derives a key from a password.
25058 *
25059 * @param {WordArray|string} password The password.
25060 * @param {WordArray|string} salt A salt.
25061 * @param {Object} cfg (Optional) The configuration options to use for this computation.
25062 *
25063 * @return {WordArray} The derived key.
25064 *
25065 * @static
25066 *
25067 * @example
25068 *
25069 * var key = CryptoJS.EvpKDF(password, salt);
25070 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
25071 * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
25072 */
25073 C.EvpKDF = function (password, salt, cfg) {
25074 return EvpKDF.create(cfg).compute(password, salt);
25075 };
25076 }());
25077
25078
25079 return CryptoJS.EvpKDF;
25080
25081}));
25082},{"./core":31,"./hmac":36,"./sha1":55}],35:[function(_dereq_,module,exports){
25083;(function (root, factory, undef) {
25084 if (typeof exports === "object") {
25085 // CommonJS
25086 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
25087 }
25088 else if (typeof define === "function" && define.amd) {
25089 // AMD
25090 define(["./core", "./cipher-core"], factory);
25091 }
25092 else {
25093 // Global (browser)
25094 factory(root.CryptoJS);
25095 }
25096}(this, function (CryptoJS) {
25097
25098 (function (undefined) {
25099 // Shortcuts
25100 var C = CryptoJS;
25101 var C_lib = C.lib;
25102 var CipherParams = C_lib.CipherParams;
25103 var C_enc = C.enc;
25104 var Hex = C_enc.Hex;
25105 var C_format = C.format;
25106
25107 var HexFormatter = C_format.Hex = {
25108 /**
25109 * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
25110 *
25111 * @param {CipherParams} cipherParams The cipher params object.
25112 *
25113 * @return {string} The hexadecimally encoded string.
25114 *
25115 * @static
25116 *
25117 * @example
25118 *
25119 * var hexString = CryptoJS.format.Hex.stringify(cipherParams);
25120 */
25121 stringify: function (cipherParams) {
25122 return cipherParams.ciphertext.toString(Hex);
25123 },
25124
25125 /**
25126 * Converts a hexadecimally encoded ciphertext string to a cipher params object.
25127 *
25128 * @param {string} input The hexadecimally encoded string.
25129 *
25130 * @return {CipherParams} The cipher params object.
25131 *
25132 * @static
25133 *
25134 * @example
25135 *
25136 * var cipherParams = CryptoJS.format.Hex.parse(hexString);
25137 */
25138 parse: function (input) {
25139 var ciphertext = Hex.parse(input);
25140 return CipherParams.create({ ciphertext: ciphertext });
25141 }
25142 };
25143 }());
25144
25145
25146 return CryptoJS.format.Hex;
25147
25148}));
25149},{"./cipher-core":30,"./core":31}],36:[function(_dereq_,module,exports){
25150;(function (root, factory) {
25151 if (typeof exports === "object") {
25152 // CommonJS
25153 module.exports = exports = factory(_dereq_("./core"));
25154 }
25155 else if (typeof define === "function" && define.amd) {
25156 // AMD
25157 define(["./core"], factory);
25158 }
25159 else {
25160 // Global (browser)
25161 factory(root.CryptoJS);
25162 }
25163}(this, function (CryptoJS) {
25164
25165 (function () {
25166 // Shortcuts
25167 var C = CryptoJS;
25168 var C_lib = C.lib;
25169 var Base = C_lib.Base;
25170 var C_enc = C.enc;
25171 var Utf8 = C_enc.Utf8;
25172 var C_algo = C.algo;
25173
25174 /**
25175 * HMAC algorithm.
25176 */
25177 var HMAC = C_algo.HMAC = Base.extend({
25178 /**
25179 * Initializes a newly created HMAC.
25180 *
25181 * @param {Hasher} hasher The hash algorithm to use.
25182 * @param {WordArray|string} key The secret key.
25183 *
25184 * @example
25185 *
25186 * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
25187 */
25188 init: function (hasher, key) {
25189 // Init hasher
25190 hasher = this._hasher = new hasher.init();
25191
25192 // Convert string to WordArray, else assume WordArray already
25193 if (typeof key == 'string') {
25194 key = Utf8.parse(key);
25195 }
25196
25197 // Shortcuts
25198 var hasherBlockSize = hasher.blockSize;
25199 var hasherBlockSizeBytes = hasherBlockSize * 4;
25200
25201 // Allow arbitrary length keys
25202 if (key.sigBytes > hasherBlockSizeBytes) {
25203 key = hasher.finalize(key);
25204 }
25205
25206 // Clamp excess bits
25207 key.clamp();
25208
25209 // Clone key for inner and outer pads
25210 var oKey = this._oKey = key.clone();
25211 var iKey = this._iKey = key.clone();
25212
25213 // Shortcuts
25214 var oKeyWords = oKey.words;
25215 var iKeyWords = iKey.words;
25216
25217 // XOR keys with pad constants
25218 for (var i = 0; i < hasherBlockSize; i++) {
25219 oKeyWords[i] ^= 0x5c5c5c5c;
25220 iKeyWords[i] ^= 0x36363636;
25221 }
25222 oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
25223
25224 // Set initial values
25225 this.reset();
25226 },
25227
25228 /**
25229 * Resets this HMAC to its initial state.
25230 *
25231 * @example
25232 *
25233 * hmacHasher.reset();
25234 */
25235 reset: function () {
25236 // Shortcut
25237 var hasher = this._hasher;
25238
25239 // Reset
25240 hasher.reset();
25241 hasher.update(this._iKey);
25242 },
25243
25244 /**
25245 * Updates this HMAC with a message.
25246 *
25247 * @param {WordArray|string} messageUpdate The message to append.
25248 *
25249 * @return {HMAC} This HMAC instance.
25250 *
25251 * @example
25252 *
25253 * hmacHasher.update('message');
25254 * hmacHasher.update(wordArray);
25255 */
25256 update: function (messageUpdate) {
25257 this._hasher.update(messageUpdate);
25258
25259 // Chainable
25260 return this;
25261 },
25262
25263 /**
25264 * Finalizes the HMAC computation.
25265 * Note that the finalize operation is effectively a destructive, read-once operation.
25266 *
25267 * @param {WordArray|string} messageUpdate (Optional) A final message update.
25268 *
25269 * @return {WordArray} The HMAC.
25270 *
25271 * @example
25272 *
25273 * var hmac = hmacHasher.finalize();
25274 * var hmac = hmacHasher.finalize('message');
25275 * var hmac = hmacHasher.finalize(wordArray);
25276 */
25277 finalize: function (messageUpdate) {
25278 // Shortcut
25279 var hasher = this._hasher;
25280
25281 // Compute HMAC
25282 var innerHash = hasher.finalize(messageUpdate);
25283 hasher.reset();
25284 var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));
25285
25286 return hmac;
25287 }
25288 });
25289 }());
25290
25291
25292}));
25293},{"./core":31}],37:[function(_dereq_,module,exports){
25294;(function (root, factory, undef) {
25295 if (typeof exports === "object") {
25296 // CommonJS
25297 module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./lib-typedarrays"), _dereq_("./enc-utf16"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./sha1"), _dereq_("./sha256"), _dereq_("./sha224"), _dereq_("./sha512"), _dereq_("./sha384"), _dereq_("./sha3"), _dereq_("./ripemd160"), _dereq_("./hmac"), _dereq_("./pbkdf2"), _dereq_("./evpkdf"), _dereq_("./cipher-core"), _dereq_("./mode-cfb"), _dereq_("./mode-ctr"), _dereq_("./mode-ctr-gladman"), _dereq_("./mode-ofb"), _dereq_("./mode-ecb"), _dereq_("./pad-ansix923"), _dereq_("./pad-iso10126"), _dereq_("./pad-iso97971"), _dereq_("./pad-zeropadding"), _dereq_("./pad-nopadding"), _dereq_("./format-hex"), _dereq_("./aes"), _dereq_("./tripledes"), _dereq_("./rc4"), _dereq_("./rabbit"), _dereq_("./rabbit-legacy"));
25298 }
25299 else if (typeof define === "function" && define.amd) {
25300 // AMD
25301 define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory);
25302 }
25303 else {
25304 // Global (browser)
25305 factory(root.CryptoJS);
25306 }
25307}(this, function (CryptoJS) {
25308 8993
25309 return CryptoJS; 8994function Hmac(alg, key) {
8995 Transform.call(this)
25310 8996
25311})); 8997 if (typeof key === 'string') {
25312},{"./aes":29,"./cipher-core":30,"./core":31,"./enc-base64":32,"./enc-utf16":33,"./evpkdf":34,"./format-hex":35,"./hmac":36,"./lib-typedarrays":38,"./md5":39,"./mode-cfb":40,"./mode-ctr":42,"./mode-ctr-gladman":41,"./mode-ecb":43,"./mode-ofb":44,"./pad-ansix923":45,"./pad-iso10126":46,"./pad-iso97971":47,"./pad-nopadding":48,"./pad-zeropadding":49,"./pbkdf2":50,"./rabbit":52,"./rabbit-legacy":51,"./rc4":53,"./ripemd160":54,"./sha1":55,"./sha224":56,"./sha256":57,"./sha3":58,"./sha384":59,"./sha512":60,"./tripledes":61,"./x64-core":62}],38:[function(_dereq_,module,exports){ 8998 key = new Buffer(key)
25313;(function (root, factory) { 8999 }
25314 if (typeof exports === "object") {
25315 // CommonJS
25316 module.exports = exports = factory(_dereq_("./core"));
25317 }
25318 else if (typeof define === "function" && define.amd) {
25319 // AMD
25320 define(["./core"], factory);
25321 }
25322 else {
25323 // Global (browser)
25324 factory(root.CryptoJS);
25325 }
25326}(this, function (CryptoJS) {
25327
25328 (function () {
25329 // Check if typed arrays are supported
25330 if (typeof ArrayBuffer != 'function') {
25331 return;
25332 }
25333
25334 // Shortcuts
25335 var C = CryptoJS;
25336 var C_lib = C.lib;
25337 var WordArray = C_lib.WordArray;
25338
25339 // Reference original init
25340 var superInit = WordArray.init;
25341
25342 // Augment WordArray.init to handle typed arrays
25343 var subInit = WordArray.init = function (typedArray) {
25344 // Convert buffers to uint8
25345 if (typedArray instanceof ArrayBuffer) {
25346 typedArray = new Uint8Array(typedArray);
25347 }
25348
25349 // Convert other array views to uint8
25350 if (
25351 typedArray instanceof Int8Array ||
25352 typedArray instanceof Uint8ClampedArray ||
25353 typedArray instanceof Int16Array ||
25354 typedArray instanceof Uint16Array ||
25355 typedArray instanceof Int32Array ||
25356 typedArray instanceof Uint32Array ||
25357 typedArray instanceof Float32Array ||
25358 typedArray instanceof Float64Array
25359 ) {
25360 typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
25361 }
25362
25363 // Handle Uint8Array
25364 if (typedArray instanceof Uint8Array) {
25365 // Shortcut
25366 var typedArrayByteLength = typedArray.byteLength;
25367
25368 // Extract bytes
25369 var words = [];
25370 for (var i = 0; i < typedArrayByteLength; i++) {
25371 words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
25372 }
25373
25374 // Initialize this word array
25375 superInit.call(this, words, typedArrayByteLength);
25376 } else {
25377 // Else call normal init
25378 superInit.apply(this, arguments);
25379 }
25380 };
25381
25382 subInit.prototype = WordArray;
25383 }());
25384
25385
25386 return CryptoJS.lib.WordArray;
25387
25388}));
25389},{"./core":31}],39:[function(_dereq_,module,exports){
25390;(function (root, factory) {
25391 if (typeof exports === "object") {
25392 // CommonJS
25393 module.exports = exports = factory(_dereq_("./core"));
25394 }
25395 else if (typeof define === "function" && define.amd) {
25396 // AMD
25397 define(["./core"], factory);
25398 }
25399 else {
25400 // Global (browser)
25401 factory(root.CryptoJS);
25402 }
25403}(this, function (CryptoJS) {
25404
25405 (function (Math) {
25406 // Shortcuts
25407 var C = CryptoJS;
25408 var C_lib = C.lib;
25409 var WordArray = C_lib.WordArray;
25410 var Hasher = C_lib.Hasher;
25411 var C_algo = C.algo;
25412
25413 // Constants table
25414 var T = [];
25415
25416 // Compute constants
25417 (function () {
25418 for (var i = 0; i < 64; i++) {
25419 T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
25420 }
25421 }());
25422
25423 /**
25424 * MD5 hash algorithm.
25425 */
25426 var MD5 = C_algo.MD5 = Hasher.extend({
25427 _doReset: function () {
25428 this._hash = new WordArray.init([
25429 0x67452301, 0xefcdab89,
25430 0x98badcfe, 0x10325476
25431 ]);
25432 },
25433
25434 _doProcessBlock: function (M, offset) {
25435 // Swap endian
25436 for (var i = 0; i < 16; i++) {
25437 // Shortcuts
25438 var offset_i = offset + i;
25439 var M_offset_i = M[offset_i];
25440
25441 M[offset_i] = (
25442 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
25443 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
25444 );
25445 }
25446
25447 // Shortcuts
25448 var H = this._hash.words;
25449
25450 var M_offset_0 = M[offset + 0];
25451 var M_offset_1 = M[offset + 1];
25452 var M_offset_2 = M[offset + 2];
25453 var M_offset_3 = M[offset + 3];
25454 var M_offset_4 = M[offset + 4];
25455 var M_offset_5 = M[offset + 5];
25456 var M_offset_6 = M[offset + 6];
25457 var M_offset_7 = M[offset + 7];
25458 var M_offset_8 = M[offset + 8];
25459 var M_offset_9 = M[offset + 9];
25460 var M_offset_10 = M[offset + 10];
25461 var M_offset_11 = M[offset + 11];
25462 var M_offset_12 = M[offset + 12];
25463 var M_offset_13 = M[offset + 13];
25464 var M_offset_14 = M[offset + 14];
25465 var M_offset_15 = M[offset + 15];
25466
25467 // Working varialbes
25468 var a = H[0];
25469 var b = H[1];
25470 var c = H[2];
25471 var d = H[3];
25472
25473 // Computation
25474 a = FF(a, b, c, d, M_offset_0, 7, T[0]);
25475 d = FF(d, a, b, c, M_offset_1, 12, T[1]);
25476 c = FF(c, d, a, b, M_offset_2, 17, T[2]);
25477 b = FF(b, c, d, a, M_offset_3, 22, T[3]);
25478 a = FF(a, b, c, d, M_offset_4, 7, T[4]);
25479 d = FF(d, a, b, c, M_offset_5, 12, T[5]);
25480 c = FF(c, d, a, b, M_offset_6, 17, T[6]);
25481 b = FF(b, c, d, a, M_offset_7, 22, T[7]);
25482 a = FF(a, b, c, d, M_offset_8, 7, T[8]);
25483 d = FF(d, a, b, c, M_offset_9, 12, T[9]);
25484 c = FF(c, d, a, b, M_offset_10, 17, T[10]);
25485 b = FF(b, c, d, a, M_offset_11, 22, T[11]);
25486 a = FF(a, b, c, d, M_offset_12, 7, T[12]);
25487 d = FF(d, a, b, c, M_offset_13, 12, T[13]);
25488 c = FF(c, d, a, b, M_offset_14, 17, T[14]);
25489 b = FF(b, c, d, a, M_offset_15, 22, T[15]);
25490
25491 a = GG(a, b, c, d, M_offset_1, 5, T[16]);
25492 d = GG(d, a, b, c, M_offset_6, 9, T[17]);
25493 c = GG(c, d, a, b, M_offset_11, 14, T[18]);
25494 b = GG(b, c, d, a, M_offset_0, 20, T[19]);
25495 a = GG(a, b, c, d, M_offset_5, 5, T[20]);
25496 d = GG(d, a, b, c, M_offset_10, 9, T[21]);
25497 c = GG(c, d, a, b, M_offset_15, 14, T[22]);
25498 b = GG(b, c, d, a, M_offset_4, 20, T[23]);
25499 a = GG(a, b, c, d, M_offset_9, 5, T[24]);
25500 d = GG(d, a, b, c, M_offset_14, 9, T[25]);
25501 c = GG(c, d, a, b, M_offset_3, 14, T[26]);
25502 b = GG(b, c, d, a, M_offset_8, 20, T[27]);
25503 a = GG(a, b, c, d, M_offset_13, 5, T[28]);
25504 d = GG(d, a, b, c, M_offset_2, 9, T[29]);
25505 c = GG(c, d, a, b, M_offset_7, 14, T[30]);
25506 b = GG(b, c, d, a, M_offset_12, 20, T[31]);
25507
25508 a = HH(a, b, c, d, M_offset_5, 4, T[32]);
25509 d = HH(d, a, b, c, M_offset_8, 11, T[33]);
25510 c = HH(c, d, a, b, M_offset_11, 16, T[34]);
25511 b = HH(b, c, d, a, M_offset_14, 23, T[35]);
25512 a = HH(a, b, c, d, M_offset_1, 4, T[36]);
25513 d = HH(d, a, b, c, M_offset_4, 11, T[37]);
25514 c = HH(c, d, a, b, M_offset_7, 16, T[38]);
25515 b = HH(b, c, d, a, M_offset_10, 23, T[39]);
25516 a = HH(a, b, c, d, M_offset_13, 4, T[40]);
25517 d = HH(d, a, b, c, M_offset_0, 11, T[41]);
25518 c = HH(c, d, a, b, M_offset_3, 16, T[42]);
25519 b = HH(b, c, d, a, M_offset_6, 23, T[43]);
25520 a = HH(a, b, c, d, M_offset_9, 4, T[44]);
25521 d = HH(d, a, b, c, M_offset_12, 11, T[45]);
25522 c = HH(c, d, a, b, M_offset_15, 16, T[46]);
25523 b = HH(b, c, d, a, M_offset_2, 23, T[47]);
25524
25525 a = II(a, b, c, d, M_offset_0, 6, T[48]);
25526 d = II(d, a, b, c, M_offset_7, 10, T[49]);
25527 c = II(c, d, a, b, M_offset_14, 15, T[50]);
25528 b = II(b, c, d, a, M_offset_5, 21, T[51]);
25529 a = II(a, b, c, d, M_offset_12, 6, T[52]);
25530 d = II(d, a, b, c, M_offset_3, 10, T[53]);
25531 c = II(c, d, a, b, M_offset_10, 15, T[54]);
25532 b = II(b, c, d, a, M_offset_1, 21, T[55]);
25533 a = II(a, b, c, d, M_offset_8, 6, T[56]);
25534 d = II(d, a, b, c, M_offset_15, 10, T[57]);
25535 c = II(c, d, a, b, M_offset_6, 15, T[58]);
25536 b = II(b, c, d, a, M_offset_13, 21, T[59]);
25537 a = II(a, b, c, d, M_offset_4, 6, T[60]);
25538 d = II(d, a, b, c, M_offset_11, 10, T[61]);
25539 c = II(c, d, a, b, M_offset_2, 15, T[62]);
25540 b = II(b, c, d, a, M_offset_9, 21, T[63]);
25541
25542 // Intermediate hash value
25543 H[0] = (H[0] + a) | 0;
25544 H[1] = (H[1] + b) | 0;
25545 H[2] = (H[2] + c) | 0;
25546 H[3] = (H[3] + d) | 0;
25547 },
25548
25549 _doFinalize: function () {
25550 // Shortcuts
25551 var data = this._data;
25552 var dataWords = data.words;
25553
25554 var nBitsTotal = this._nDataBytes * 8;
25555 var nBitsLeft = data.sigBytes * 8;
25556
25557 // Add padding
25558 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
25559
25560 var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
25561 var nBitsTotalL = nBitsTotal;
25562 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
25563 (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
25564 (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)
25565 );
25566 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
25567 (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
25568 (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)
25569 );
25570
25571 data.sigBytes = (dataWords.length + 1) * 4;
25572
25573 // Hash final blocks
25574 this._process();
25575
25576 // Shortcuts
25577 var hash = this._hash;
25578 var H = hash.words;
25579
25580 // Swap endian
25581 for (var i = 0; i < 4; i++) {
25582 // Shortcut
25583 var H_i = H[i];
25584
25585 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
25586 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
25587 }
25588
25589 // Return final computed hash
25590 return hash;
25591 },
25592
25593 clone: function () {
25594 var clone = Hasher.clone.call(this);
25595 clone._hash = this._hash.clone();
25596
25597 return clone;
25598 }
25599 });
25600
25601 function FF(a, b, c, d, x, s, t) {
25602 var n = a + ((b & c) | (~b & d)) + x + t;
25603 return ((n << s) | (n >>> (32 - s))) + b;
25604 }
25605
25606 function GG(a, b, c, d, x, s, t) {
25607 var n = a + ((b & d) | (c & ~d)) + x + t;
25608 return ((n << s) | (n >>> (32 - s))) + b;
25609 }
25610
25611 function HH(a, b, c, d, x, s, t) {
25612 var n = a + (b ^ c ^ d) + x + t;
25613 return ((n << s) | (n >>> (32 - s))) + b;
25614 }
25615
25616 function II(a, b, c, d, x, s, t) {
25617 var n = a + (c ^ (b | ~d)) + x + t;
25618 return ((n << s) | (n >>> (32 - s))) + b;
25619 }
25620
25621 /**
25622 * Shortcut function to the hasher's object interface.
25623 *
25624 * @param {WordArray|string} message The message to hash.
25625 *
25626 * @return {WordArray} The hash.
25627 *
25628 * @static
25629 *
25630 * @example
25631 *
25632 * var hash = CryptoJS.MD5('message');
25633 * var hash = CryptoJS.MD5(wordArray);
25634 */
25635 C.MD5 = Hasher._createHelper(MD5);
25636
25637 /**
25638 * Shortcut function to the HMAC's object interface.
25639 *
25640 * @param {WordArray|string} message The message to hash.
25641 * @param {WordArray|string} key The secret key.
25642 *
25643 * @return {WordArray} The HMAC.
25644 *
25645 * @static
25646 *
25647 * @example
25648 *
25649 * var hmac = CryptoJS.HmacMD5(message, key);
25650 */
25651 C.HmacMD5 = Hasher._createHmacHelper(MD5);
25652 }(Math));
25653
25654
25655 return CryptoJS.MD5;
25656
25657}));
25658},{"./core":31}],40:[function(_dereq_,module,exports){
25659;(function (root, factory, undef) {
25660 if (typeof exports === "object") {
25661 // CommonJS
25662 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
25663 }
25664 else if (typeof define === "function" && define.amd) {
25665 // AMD
25666 define(["./core", "./cipher-core"], factory);
25667 }
25668 else {
25669 // Global (browser)
25670 factory(root.CryptoJS);
25671 }
25672}(this, function (CryptoJS) {
25673
25674 /**
25675 * Cipher Feedback block mode.
25676 */
25677 CryptoJS.mode.CFB = (function () {
25678 var CFB = CryptoJS.lib.BlockCipherMode.extend();
25679
25680 CFB.Encryptor = CFB.extend({
25681 processBlock: function (words, offset) {
25682 // Shortcuts
25683 var cipher = this._cipher;
25684 var blockSize = cipher.blockSize;
25685
25686 generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
25687
25688 // Remember this block to use with next block
25689 this._prevBlock = words.slice(offset, offset + blockSize);
25690 }
25691 });
25692
25693 CFB.Decryptor = CFB.extend({
25694 processBlock: function (words, offset) {
25695 // Shortcuts
25696 var cipher = this._cipher;
25697 var blockSize = cipher.blockSize;
25698
25699 // Remember this block to use with next block
25700 var thisBlock = words.slice(offset, offset + blockSize);
25701
25702 generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);
25703
25704 // This block becomes the previous block
25705 this._prevBlock = thisBlock;
25706 }
25707 });
25708
25709 function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
25710 // Shortcut
25711 var iv = this._iv;
25712
25713 // Generate keystream
25714 if (iv) {
25715 var keystream = iv.slice(0);
25716
25717 // Remove IV for subsequent blocks
25718 this._iv = undefined;
25719 } else {
25720 var keystream = this._prevBlock;
25721 }
25722 cipher.encryptBlock(keystream, 0);
25723
25724 // Encrypt
25725 for (var i = 0; i < blockSize; i++) {
25726 words[offset + i] ^= keystream[i];
25727 }
25728 }
25729
25730 return CFB;
25731 }());
25732
25733
25734 return CryptoJS.mode.CFB;
25735
25736}));
25737},{"./cipher-core":30,"./core":31}],41:[function(_dereq_,module,exports){
25738;(function (root, factory, undef) {
25739 if (typeof exports === "object") {
25740 // CommonJS
25741 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
25742 }
25743 else if (typeof define === "function" && define.amd) {
25744 // AMD
25745 define(["./core", "./cipher-core"], factory);
25746 }
25747 else {
25748 // Global (browser)
25749 factory(root.CryptoJS);
25750 }
25751}(this, function (CryptoJS) {
25752
25753 /** @preserve
25754 * Counter block mode compatible with Dr Brian Gladman fileenc.c
25755 * derived from CryptoJS.mode.CTR
25756 * Jan Hruby jhruby.web@gmail.com
25757 */
25758 CryptoJS.mode.CTRGladman = (function () {
25759 var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();
25760
25761 function incWord(word)
25762 {
25763 if (((word >> 24) & 0xff) === 0xff) { //overflow
25764 var b1 = (word >> 16)&0xff;
25765 var b2 = (word >> 8)&0xff;
25766 var b3 = word & 0xff;
25767
25768 if (b1 === 0xff) // overflow b1
25769 {
25770 b1 = 0;
25771 if (b2 === 0xff)
25772 {
25773 b2 = 0;
25774 if (b3 === 0xff)
25775 {
25776 b3 = 0;
25777 }
25778 else
25779 {
25780 ++b3;
25781 }
25782 }
25783 else
25784 {
25785 ++b2;
25786 }
25787 }
25788 else
25789 {
25790 ++b1;
25791 }
25792
25793 word = 0;
25794 word += (b1 << 16);
25795 word += (b2 << 8);
25796 word += b3;
25797 }
25798 else
25799 {
25800 word += (0x01 << 24);
25801 }
25802 return word;
25803 }
25804 9000
25805 function incCounter(counter) 9001 var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
25806 {
25807 if ((counter[0] = incWord(counter[0])) === 0)
25808 {
25809 // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8
25810 counter[1] = incWord(counter[1]);
25811 }
25812 return counter;
25813 }
25814 9002
25815 var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ 9003 this._alg = alg
25816 processBlock: function (words, offset) { 9004 this._key = key
25817 // Shortcuts
25818 var cipher = this._cipher
25819 var blockSize = cipher.blockSize;
25820 var iv = this._iv;
25821 var counter = this._counter;
25822 9005
25823 // Generate keystream 9006 if (key.length > blocksize) {
25824 if (iv) { 9007 key = createHash(alg).update(key).digest()
25825 counter = this._counter = iv.slice(0);
25826 9008
25827 // Remove IV for subsequent blocks 9009 } else if (key.length < blocksize) {
25828 this._iv = undefined; 9010 key = Buffer.concat([key, ZEROS], blocksize)
25829 } 9011 }
25830 9012
25831 incCounter(counter); 9013 var ipad = this._ipad = new Buffer(blocksize)
9014 var opad = this._opad = new Buffer(blocksize)
25832 9015
25833 var keystream = counter.slice(0); 9016 for (var i = 0; i < blocksize; i++) {
25834 cipher.encryptBlock(keystream, 0); 9017 ipad[i] = key[i] ^ 0x36
9018 opad[i] = key[i] ^ 0x5C
9019 }
25835 9020
25836 // Encrypt 9021 this._hash = createHash(alg).update(ipad)
25837 for (var i = 0; i < blockSize; i++) { 9022}
25838 words[offset + i] ^= keystream[i];
25839 }
25840 }
25841 });
25842 9023
25843 CTRGladman.Decryptor = Encryptor; 9024inherits(Hmac, Transform)
25844 9025
25845 return CTRGladman; 9026Hmac.prototype.update = function (data, enc) {
25846 }()); 9027 this._hash.update(data, enc)
25847 9028
9029 return this
9030}
25848 9031
9032Hmac.prototype._transform = function (data, _, next) {
9033 this._hash.update(data)
25849 9034
9035 next()
9036}
25850 9037
25851 return CryptoJS.mode.CTRGladman; 9038Hmac.prototype._flush = function (next) {
9039 this.push(this.digest())
25852 9040
25853})); 9041 next()
25854},{"./cipher-core":30,"./core":31}],42:[function(_dereq_,module,exports){ 9042}
25855;(function (root, factory, undef) {
25856 if (typeof exports === "object") {
25857 // CommonJS
25858 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
25859 }
25860 else if (typeof define === "function" && define.amd) {
25861 // AMD
25862 define(["./core", "./cipher-core"], factory);
25863 }
25864 else {
25865 // Global (browser)
25866 factory(root.CryptoJS);
25867 }
25868}(this, function (CryptoJS) {
25869
25870 /**
25871 * Counter block mode.
25872 */
25873 CryptoJS.mode.CTR = (function () {
25874 var CTR = CryptoJS.lib.BlockCipherMode.extend();
25875
25876 var Encryptor = CTR.Encryptor = CTR.extend({
25877 processBlock: function (words, offset) {
25878 // Shortcuts
25879 var cipher = this._cipher
25880 var blockSize = cipher.blockSize;
25881 var iv = this._iv;
25882 var counter = this._counter;
25883
25884 // Generate keystream
25885 if (iv) {
25886 counter = this._counter = iv.slice(0);
25887
25888 // Remove IV for subsequent blocks
25889 this._iv = undefined;
25890 }
25891 var keystream = counter.slice(0);
25892 cipher.encryptBlock(keystream, 0);
25893
25894 // Increment counter
25895 counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0
25896
25897 // Encrypt
25898 for (var i = 0; i < blockSize; i++) {
25899 words[offset + i] ^= keystream[i];
25900 }
25901 }
25902 });
25903
25904 CTR.Decryptor = Encryptor;
25905
25906 return CTR;
25907 }());
25908
25909
25910 return CryptoJS.mode.CTR;
25911
25912}));
25913},{"./cipher-core":30,"./core":31}],43:[function(_dereq_,module,exports){
25914;(function (root, factory, undef) {
25915 if (typeof exports === "object") {
25916 // CommonJS
25917 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
25918 }
25919 else if (typeof define === "function" && define.amd) {
25920 // AMD
25921 define(["./core", "./cipher-core"], factory);
25922 }
25923 else {
25924 // Global (browser)
25925 factory(root.CryptoJS);
25926 }
25927}(this, function (CryptoJS) {
25928
25929 /**
25930 * Electronic Codebook block mode.
25931 */
25932 CryptoJS.mode.ECB = (function () {
25933 var ECB = CryptoJS.lib.BlockCipherMode.extend();
25934
25935 ECB.Encryptor = ECB.extend({
25936 processBlock: function (words, offset) {
25937 this._cipher.encryptBlock(words, offset);
25938 }
25939 });
25940
25941 ECB.Decryptor = ECB.extend({
25942 processBlock: function (words, offset) {
25943 this._cipher.decryptBlock(words, offset);
25944 }
25945 });
25946
25947 return ECB;
25948 }());
25949
25950
25951 return CryptoJS.mode.ECB;
25952
25953}));
25954},{"./cipher-core":30,"./core":31}],44:[function(_dereq_,module,exports){
25955;(function (root, factory, undef) {
25956 if (typeof exports === "object") {
25957 // CommonJS
25958 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
25959 }
25960 else if (typeof define === "function" && define.amd) {
25961 // AMD
25962 define(["./core", "./cipher-core"], factory);
25963 }
25964 else {
25965 // Global (browser)
25966 factory(root.CryptoJS);
25967 }
25968}(this, function (CryptoJS) {
25969
25970 /**
25971 * Output Feedback block mode.
25972 */
25973 CryptoJS.mode.OFB = (function () {
25974 var OFB = CryptoJS.lib.BlockCipherMode.extend();
25975
25976 var Encryptor = OFB.Encryptor = OFB.extend({
25977 processBlock: function (words, offset) {
25978 // Shortcuts
25979 var cipher = this._cipher
25980 var blockSize = cipher.blockSize;
25981 var iv = this._iv;
25982 var keystream = this._keystream;
25983
25984 // Generate keystream
25985 if (iv) {
25986 keystream = this._keystream = iv.slice(0);
25987
25988 // Remove IV for subsequent blocks
25989 this._iv = undefined;
25990 }
25991 cipher.encryptBlock(keystream, 0);
25992
25993 // Encrypt
25994 for (var i = 0; i < blockSize; i++) {
25995 words[offset + i] ^= keystream[i];
25996 }
25997 }
25998 });
25999
26000 OFB.Decryptor = Encryptor;
26001
26002 return OFB;
26003 }());
26004
26005
26006 return CryptoJS.mode.OFB;
26007
26008}));
26009},{"./cipher-core":30,"./core":31}],45:[function(_dereq_,module,exports){
26010;(function (root, factory, undef) {
26011 if (typeof exports === "object") {
26012 // CommonJS
26013 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
26014 }
26015 else if (typeof define === "function" && define.amd) {
26016 // AMD
26017 define(["./core", "./cipher-core"], factory);
26018 }
26019 else {
26020 // Global (browser)
26021 factory(root.CryptoJS);
26022 }
26023}(this, function (CryptoJS) {
26024
26025 /**
26026 * ANSI X.923 padding strategy.
26027 */
26028 CryptoJS.pad.AnsiX923 = {
26029 pad: function (data, blockSize) {
26030 // Shortcuts
26031 var dataSigBytes = data.sigBytes;
26032 var blockSizeBytes = blockSize * 4;
26033
26034 // Count padding bytes
26035 var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;
26036
26037 // Compute last byte position
26038 var lastBytePos = dataSigBytes + nPaddingBytes - 1;
26039
26040 // Pad
26041 data.clamp();
26042 data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
26043 data.sigBytes += nPaddingBytes;
26044 },
26045
26046 unpad: function (data) {
26047 // Get number of padding bytes from last byte
26048 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
26049
26050 // Remove padding
26051 data.sigBytes -= nPaddingBytes;
26052 }
26053 };
26054
26055
26056 return CryptoJS.pad.Ansix923;
26057
26058}));
26059},{"./cipher-core":30,"./core":31}],46:[function(_dereq_,module,exports){
26060;(function (root, factory, undef) {
26061 if (typeof exports === "object") {
26062 // CommonJS
26063 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
26064 }
26065 else if (typeof define === "function" && define.amd) {
26066 // AMD
26067 define(["./core", "./cipher-core"], factory);
26068 }
26069 else {
26070 // Global (browser)
26071 factory(root.CryptoJS);
26072 }
26073}(this, function (CryptoJS) {
26074
26075 /**
26076 * ISO 10126 padding strategy.
26077 */
26078 CryptoJS.pad.Iso10126 = {
26079 pad: function (data, blockSize) {
26080 // Shortcut
26081 var blockSizeBytes = blockSize * 4;
26082
26083 // Count padding bytes
26084 var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
26085
26086 // Pad
26087 data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
26088 concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
26089 },
26090
26091 unpad: function (data) {
26092 // Get number of padding bytes from last byte
26093 var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;
26094
26095 // Remove padding
26096 data.sigBytes -= nPaddingBytes;
26097 }
26098 };
26099
26100
26101 return CryptoJS.pad.Iso10126;
26102
26103}));
26104},{"./cipher-core":30,"./core":31}],47:[function(_dereq_,module,exports){
26105;(function (root, factory, undef) {
26106 if (typeof exports === "object") {
26107 // CommonJS
26108 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
26109 }
26110 else if (typeof define === "function" && define.amd) {
26111 // AMD
26112 define(["./core", "./cipher-core"], factory);
26113 }
26114 else {
26115 // Global (browser)
26116 factory(root.CryptoJS);
26117 }
26118}(this, function (CryptoJS) {
26119
26120 /**
26121 * ISO/IEC 9797-1 Padding Method 2.
26122 */
26123 CryptoJS.pad.Iso97971 = {
26124 pad: function (data, blockSize) {
26125 // Add 0x80 byte
26126 data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));
26127
26128 // Zero pad the rest
26129 CryptoJS.pad.ZeroPadding.pad(data, blockSize);
26130 },
26131
26132 unpad: function (data) {
26133 // Remove zero padding
26134 CryptoJS.pad.ZeroPadding.unpad(data);
26135
26136 // Remove one more byte -- the 0x80 byte
26137 data.sigBytes--;
26138 }
26139 };
26140
26141
26142 return CryptoJS.pad.Iso97971;
26143
26144}));
26145},{"./cipher-core":30,"./core":31}],48:[function(_dereq_,module,exports){
26146;(function (root, factory, undef) {
26147 if (typeof exports === "object") {
26148 // CommonJS
26149 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
26150 }
26151 else if (typeof define === "function" && define.amd) {
26152 // AMD
26153 define(["./core", "./cipher-core"], factory);
26154 }
26155 else {
26156 // Global (browser)
26157 factory(root.CryptoJS);
26158 }
26159}(this, function (CryptoJS) {
26160 9043
26161 /** 9044Hmac.prototype.digest = function (enc) {
26162 * A noop padding strategy. 9045 var h = this._hash.digest()
26163 */
26164 CryptoJS.pad.NoPadding = {
26165 pad: function () {
26166 },
26167 9046
26168 unpad: function () { 9047 return createHash(this._alg).update(this._opad).update(h).digest(enc)
26169 } 9048}
26170 };
26171 9049
9050module.exports = function createHmac(alg, key) {
9051 return new Hmac(alg, key)
9052}
26172 9053
26173 return CryptoJS.pad.NoPadding; 9054}).call(this,require("buffer").Buffer)
9055},{"buffer":7,"create-hash/browser":32,"inherits":46,"stream":26}],46:[function(require,module,exports){
9056arguments[4][12][0].apply(exports,arguments)
9057},{"dup":12}],47:[function(require,module,exports){
9058var assert = require('assert')
9059var BigInteger = require('bigi')
26174 9060
26175})); 9061var Point = require('./point')
26176},{"./cipher-core":30,"./core":31}],49:[function(_dereq_,module,exports){
26177;(function (root, factory, undef) {
26178 if (typeof exports === "object") {
26179 // CommonJS
26180 module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core"));
26181 }
26182 else if (typeof define === "function" && define.amd) {
26183 // AMD
26184 define(["./core", "./cipher-core"], factory);
26185 }
26186 else {
26187 // Global (browser)
26188 factory(root.CryptoJS);
26189 }
26190}(this, function (CryptoJS) {
26191
26192 /**
26193 * Zero padding strategy.
26194 */
26195 CryptoJS.pad.ZeroPadding = {
26196 pad: function (data, blockSize) {
26197 // Shortcut
26198 var blockSizeBytes = blockSize * 4;
26199
26200 // Pad
26201 data.clamp();
26202 data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
26203 },
26204
26205 unpad: function (data) {
26206 // Shortcut
26207 var dataWords = data.words;
26208
26209 // Unpad
26210 var i = data.sigBytes - 1;
26211 while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
26212 i--;
26213 }
26214 data.sigBytes = i + 1;
26215 }
26216 };
26217
26218
26219 return CryptoJS.pad.ZeroPadding;
26220
26221}));
26222},{"./cipher-core":30,"./core":31}],50:[function(_dereq_,module,exports){
26223;(function (root, factory, undef) {
26224 if (typeof exports === "object") {
26225 // CommonJS
26226 module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac"));
26227 }
26228 else if (typeof define === "function" && define.amd) {
26229 // AMD
26230 define(["./core", "./sha1", "./hmac"], factory);
26231 }
26232 else {
26233 // Global (browser)
26234 factory(root.CryptoJS);
26235 }
26236}(this, function (CryptoJS) {
26237
26238 (function () {
26239 // Shortcuts
26240 var C = CryptoJS;
26241 var C_lib = C.lib;
26242 var Base = C_lib.Base;
26243 var WordArray = C_lib.WordArray;
26244 var C_algo = C.algo;
26245 var SHA1 = C_algo.SHA1;
26246 var HMAC = C_algo.HMAC;
26247
26248 /**
26249 * Password-Based Key Derivation Function 2 algorithm.
26250 */
26251 var PBKDF2 = C_algo.PBKDF2 = Base.extend({
26252 /**
26253 * Configuration options.
26254 *
26255 * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
26256 * @property {Hasher} hasher The hasher to use. Default: SHA1
26257 * @property {number} iterations The number of iterations to perform. Default: 1
26258 */
26259 cfg: Base.extend({
26260 keySize: 128/32,
26261 hasher: SHA1,
26262 iterations: 1
26263 }),
26264
26265 /**
26266 * Initializes a newly created key derivation function.
26267 *
26268 * @param {Object} cfg (Optional) The configuration options to use for the derivation.
26269 *
26270 * @example
26271 *
26272 * var kdf = CryptoJS.algo.PBKDF2.create();
26273 * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
26274 * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
26275 */
26276 init: function (cfg) {
26277 this.cfg = this.cfg.extend(cfg);
26278 },
26279
26280 /**
26281 * Computes the Password-Based Key Derivation Function 2.
26282 *
26283 * @param {WordArray|string} password The password.
26284 * @param {WordArray|string} salt A salt.
26285 *
26286 * @return {WordArray} The derived key.
26287 *
26288 * @example
26289 *
26290 * var key = kdf.compute(password, salt);
26291 */
26292 compute: function (password, salt) {
26293 // Shortcut
26294 var cfg = this.cfg;
26295
26296 // Init HMAC
26297 var hmac = HMAC.create(cfg.hasher, password);
26298
26299 // Initial values
26300 var derivedKey = WordArray.create();
26301 var blockIndex = WordArray.create([0x00000001]);
26302
26303 // Shortcuts
26304 var derivedKeyWords = derivedKey.words;
26305 var blockIndexWords = blockIndex.words;
26306 var keySize = cfg.keySize;
26307 var iterations = cfg.iterations;
26308
26309 // Generate key
26310 while (derivedKeyWords.length < keySize) {
26311 var block = hmac.update(salt).finalize(blockIndex);
26312 hmac.reset();
26313
26314 // Shortcuts
26315 var blockWords = block.words;
26316 var blockWordsLength = blockWords.length;
26317
26318 // Iterations
26319 var intermediate = block;
26320 for (var i = 1; i < iterations; i++) {
26321 intermediate = hmac.finalize(intermediate);
26322 hmac.reset();
26323
26324 // Shortcut
26325 var intermediateWords = intermediate.words;
26326
26327 // XOR intermediate with block
26328 for (var j = 0; j < blockWordsLength; j++) {
26329 blockWords[j] ^= intermediateWords[j];
26330 }
26331 }
26332
26333 derivedKey.concat(block);
26334 blockIndexWords[0]++;
26335 }
26336 derivedKey.sigBytes = keySize * 4;
26337
26338 return derivedKey;
26339 }
26340 });
26341
26342 /**
26343 * Computes the Password-Based Key Derivation Function 2.
26344 *
26345 * @param {WordArray|string} password The password.
26346 * @param {WordArray|string} salt A salt.
26347 * @param {Object} cfg (Optional) The configuration options to use for this computation.
26348 *
26349 * @return {WordArray} The derived key.
26350 *
26351 * @static
26352 *
26353 * @example
26354 *
26355 * var key = CryptoJS.PBKDF2(password, salt);
26356 * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
26357 * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
26358 */
26359 C.PBKDF2 = function (password, salt, cfg) {
26360 return PBKDF2.create(cfg).compute(password, salt);
26361 };
26362 }());
26363
26364
26365 return CryptoJS.PBKDF2;
26366
26367}));
26368},{"./core":31,"./hmac":36,"./sha1":55}],51:[function(_dereq_,module,exports){
26369;(function (root, factory, undef) {
26370 if (typeof exports === "object") {
26371 // CommonJS
26372 module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core"));
26373 }
26374 else if (typeof define === "function" && define.amd) {
26375 // AMD
26376 define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
26377 }
26378 else {
26379 // Global (browser)
26380 factory(root.CryptoJS);
26381 }
26382}(this, function (CryptoJS) {
26383
26384 (function () {
26385 // Shortcuts
26386 var C = CryptoJS;
26387 var C_lib = C.lib;
26388 var StreamCipher = C_lib.StreamCipher;
26389 var C_algo = C.algo;
26390
26391 // Reusable objects
26392 var S = [];
26393 var C_ = [];
26394 var G = [];
26395
26396 /**
26397 * Rabbit stream cipher algorithm.
26398 *
26399 * This is a legacy version that neglected to convert the key to little-endian.
26400 * This error doesn't affect the cipher's security,
26401 * but it does affect its compatibility with other implementations.
26402 */
26403 var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
26404 _doReset: function () {
26405 // Shortcuts
26406 var K = this._key.words;
26407 var iv = this.cfg.iv;
26408
26409 // Generate initial state values
26410 var X = this._X = [
26411 K[0], (K[3] << 16) | (K[2] >>> 16),
26412 K[1], (K[0] << 16) | (K[3] >>> 16),
26413 K[2], (K[1] << 16) | (K[0] >>> 16),
26414 K[3], (K[2] << 16) | (K[1] >>> 16)
26415 ];
26416
26417 // Generate initial counter values
26418 var C = this._C = [
26419 (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
26420 (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
26421 (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
26422 (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
26423 ];
26424
26425 // Carry bit
26426 this._b = 0;
26427
26428 // Iterate the system four times
26429 for (var i = 0; i < 4; i++) {
26430 nextState.call(this);
26431 }
26432
26433 // Modify the counters
26434 for (var i = 0; i < 8; i++) {
26435 C[i] ^= X[(i + 4) & 7];
26436 }
26437
26438 // IV setup
26439 if (iv) {
26440 // Shortcuts
26441 var IV = iv.words;
26442 var IV_0 = IV[0];
26443 var IV_1 = IV[1];
26444
26445 // Generate four subvectors
26446 var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
26447 var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
26448 var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
26449 var i3 = (i2 << 16) | (i0 & 0x0000ffff);
26450
26451 // Modify counter values
26452 C[0] ^= i0;
26453 C[1] ^= i1;
26454 C[2] ^= i2;
26455 C[3] ^= i3;
26456 C[4] ^= i0;
26457 C[5] ^= i1;
26458 C[6] ^= i2;
26459 C[7] ^= i3;
26460
26461 // Iterate the system four times
26462 for (var i = 0; i < 4; i++) {
26463 nextState.call(this);
26464 }
26465 }
26466 },
26467
26468 _doProcessBlock: function (M, offset) {
26469 // Shortcut
26470 var X = this._X;
26471
26472 // Iterate the system
26473 nextState.call(this);
26474
26475 // Generate four keystream words
26476 S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
26477 S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
26478 S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
26479 S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
26480
26481 for (var i = 0; i < 4; i++) {
26482 // Swap endian
26483 S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
26484 (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
26485
26486 // Encrypt
26487 M[offset + i] ^= S[i];
26488 }
26489 },
26490
26491 blockSize: 128/32,
26492
26493 ivSize: 64/32
26494 });
26495
26496 function nextState() {
26497 // Shortcuts
26498 var X = this._X;
26499 var C = this._C;
26500
26501 // Save old counter values
26502 for (var i = 0; i < 8; i++) {
26503 C_[i] = C[i];
26504 }
26505
26506 // Calculate new counter values
26507 C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
26508 C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
26509 C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
26510 C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
26511 C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
26512 C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
26513 C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
26514 C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
26515 this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
26516
26517 // Calculate the g-values
26518 for (var i = 0; i < 8; i++) {
26519 var gx = X[i] + C[i];
26520
26521 // Construct high and low argument for squaring
26522 var ga = gx & 0xffff;
26523 var gb = gx >>> 16;
26524
26525 // Calculate high and low result of squaring
26526 var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
26527 var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
26528
26529 // High XOR low
26530 G[i] = gh ^ gl;
26531 }
26532
26533 // Calculate new state values
26534 X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
26535 X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
26536 X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
26537 X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
26538 X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
26539 X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
26540 X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
26541 X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
26542 }
26543
26544 /**
26545 * Shortcut functions to the cipher's object interface.
26546 *
26547 * @example
26548 *
26549 * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
26550 * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
26551 */
26552 C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
26553 }());
26554
26555
26556 return CryptoJS.RabbitLegacy;
26557
26558}));
26559},{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],52:[function(_dereq_,module,exports){
26560;(function (root, factory, undef) {
26561 if (typeof exports === "object") {
26562 // CommonJS
26563 module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core"));
26564 }
26565 else if (typeof define === "function" && define.amd) {
26566 // AMD
26567 define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
26568 }
26569 else {
26570 // Global (browser)
26571 factory(root.CryptoJS);
26572 }
26573}(this, function (CryptoJS) {
26574
26575 (function () {
26576 // Shortcuts
26577 var C = CryptoJS;
26578 var C_lib = C.lib;
26579 var StreamCipher = C_lib.StreamCipher;
26580 var C_algo = C.algo;
26581
26582 // Reusable objects
26583 var S = [];
26584 var C_ = [];
26585 var G = [];
26586
26587 /**
26588 * Rabbit stream cipher algorithm
26589 */
26590 var Rabbit = C_algo.Rabbit = StreamCipher.extend({
26591 _doReset: function () {
26592 // Shortcuts
26593 var K = this._key.words;
26594 var iv = this.cfg.iv;
26595
26596 // Swap endian
26597 for (var i = 0; i < 4; i++) {
26598 K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) |
26599 (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00);
26600 }
26601
26602 // Generate initial state values
26603 var X = this._X = [
26604 K[0], (K[3] << 16) | (K[2] >>> 16),
26605 K[1], (K[0] << 16) | (K[3] >>> 16),
26606 K[2], (K[1] << 16) | (K[0] >>> 16),
26607 K[3], (K[2] << 16) | (K[1] >>> 16)
26608 ];
26609
26610 // Generate initial counter values
26611 var C = this._C = [
26612 (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
26613 (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
26614 (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
26615 (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
26616 ];
26617
26618 // Carry bit
26619 this._b = 0;
26620
26621 // Iterate the system four times
26622 for (var i = 0; i < 4; i++) {
26623 nextState.call(this);
26624 }
26625
26626 // Modify the counters
26627 for (var i = 0; i < 8; i++) {
26628 C[i] ^= X[(i + 4) & 7];
26629 }
26630
26631 // IV setup
26632 if (iv) {
26633 // Shortcuts
26634 var IV = iv.words;
26635 var IV_0 = IV[0];
26636 var IV_1 = IV[1];
26637
26638 // Generate four subvectors
26639 var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
26640 var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
26641 var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
26642 var i3 = (i2 << 16) | (i0 & 0x0000ffff);
26643
26644 // Modify counter values
26645 C[0] ^= i0;
26646 C[1] ^= i1;
26647 C[2] ^= i2;
26648 C[3] ^= i3;
26649 C[4] ^= i0;
26650 C[5] ^= i1;
26651 C[6] ^= i2;
26652 C[7] ^= i3;
26653
26654 // Iterate the system four times
26655 for (var i = 0; i < 4; i++) {
26656 nextState.call(this);
26657 }
26658 }
26659 },
26660
26661 _doProcessBlock: function (M, offset) {
26662 // Shortcut
26663 var X = this._X;
26664
26665 // Iterate the system
26666 nextState.call(this);
26667
26668 // Generate four keystream words
26669 S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
26670 S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
26671 S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
26672 S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);
26673
26674 for (var i = 0; i < 4; i++) {
26675 // Swap endian
26676 S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) |
26677 (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00);
26678
26679 // Encrypt
26680 M[offset + i] ^= S[i];
26681 }
26682 },
26683
26684 blockSize: 128/32,
26685
26686 ivSize: 64/32
26687 });
26688
26689 function nextState() {
26690 // Shortcuts
26691 var X = this._X;
26692 var C = this._C;
26693
26694 // Save old counter values
26695 for (var i = 0; i < 8; i++) {
26696 C_[i] = C[i];
26697 }
26698
26699 // Calculate new counter values
26700 C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
26701 C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
26702 C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
26703 C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
26704 C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
26705 C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
26706 C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
26707 C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
26708 this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;
26709
26710 // Calculate the g-values
26711 for (var i = 0; i < 8; i++) {
26712 var gx = X[i] + C[i];
26713
26714 // Construct high and low argument for squaring
26715 var ga = gx & 0xffff;
26716 var gb = gx >>> 16;
26717
26718 // Calculate high and low result of squaring
26719 var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
26720 var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);
26721
26722 // High XOR low
26723 G[i] = gh ^ gl;
26724 }
26725
26726 // Calculate new state values
26727 X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
26728 X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0;
26729 X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
26730 X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0;
26731 X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
26732 X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0;
26733 X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
26734 X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0;
26735 }
26736
26737 /**
26738 * Shortcut functions to the cipher's object interface.
26739 *
26740 * @example
26741 *
26742 * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
26743 * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
26744 */
26745 C.Rabbit = StreamCipher._createHelper(Rabbit);
26746 }());
26747
26748
26749 return CryptoJS.Rabbit;
26750
26751}));
26752},{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],53:[function(_dereq_,module,exports){
26753;(function (root, factory, undef) {
26754 if (typeof exports === "object") {
26755 // CommonJS
26756 module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core"));
26757 }
26758 else if (typeof define === "function" && define.amd) {
26759 // AMD
26760 define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
26761 }
26762 else {
26763 // Global (browser)
26764 factory(root.CryptoJS);
26765 }
26766}(this, function (CryptoJS) {
26767
26768 (function () {
26769 // Shortcuts
26770 var C = CryptoJS;
26771 var C_lib = C.lib;
26772 var StreamCipher = C_lib.StreamCipher;
26773 var C_algo = C.algo;
26774
26775 /**
26776 * RC4 stream cipher algorithm.
26777 */
26778 var RC4 = C_algo.RC4 = StreamCipher.extend({
26779 _doReset: function () {
26780 // Shortcuts
26781 var key = this._key;
26782 var keyWords = key.words;
26783 var keySigBytes = key.sigBytes;
26784
26785 // Init sbox
26786 var S = this._S = [];
26787 for (var i = 0; i < 256; i++) {
26788 S[i] = i;
26789 }
26790
26791 // Key setup
26792 for (var i = 0, j = 0; i < 256; i++) {
26793 var keyByteIndex = i % keySigBytes;
26794 var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;
26795
26796 j = (j + S[i] + keyByte) % 256;
26797
26798 // Swap
26799 var t = S[i];
26800 S[i] = S[j];
26801 S[j] = t;
26802 }
26803
26804 // Counters
26805 this._i = this._j = 0;
26806 },
26807
26808 _doProcessBlock: function (M, offset) {
26809 M[offset] ^= generateKeystreamWord.call(this);
26810 },
26811
26812 keySize: 256/32,
26813
26814 ivSize: 0
26815 });
26816
26817 function generateKeystreamWord() {
26818 // Shortcuts
26819 var S = this._S;
26820 var i = this._i;
26821 var j = this._j;
26822
26823 // Generate keystream word
26824 var keystreamWord = 0;
26825 for (var n = 0; n < 4; n++) {
26826 i = (i + 1) % 256;
26827 j = (j + S[i]) % 256;
26828
26829 // Swap
26830 var t = S[i];
26831 S[i] = S[j];
26832 S[j] = t;
26833
26834 keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
26835 }
26836
26837 // Update counters
26838 this._i = i;
26839 this._j = j;
26840
26841 return keystreamWord;
26842 }
26843
26844 /**
26845 * Shortcut functions to the cipher's object interface.
26846 *
26847 * @example
26848 *
26849 * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
26850 * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
26851 */
26852 C.RC4 = StreamCipher._createHelper(RC4);
26853
26854 /**
26855 * Modified RC4 stream cipher algorithm.
26856 */
26857 var RC4Drop = C_algo.RC4Drop = RC4.extend({
26858 /**
26859 * Configuration options.
26860 *
26861 * @property {number} drop The number of keystream words to drop. Default 192
26862 */
26863 cfg: RC4.cfg.extend({
26864 drop: 192
26865 }),
26866
26867 _doReset: function () {
26868 RC4._doReset.call(this);
26869
26870 // Drop
26871 for (var i = this.cfg.drop; i > 0; i--) {
26872 generateKeystreamWord.call(this);
26873 }
26874 }
26875 });
26876
26877 /**
26878 * Shortcut functions to the cipher's object interface.
26879 *
26880 * @example
26881 *
26882 * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
26883 * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
26884 */
26885 C.RC4Drop = StreamCipher._createHelper(RC4Drop);
26886 }());
26887
26888
26889 return CryptoJS.RC4;
26890
26891}));
26892},{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],54:[function(_dereq_,module,exports){
26893;(function (root, factory) {
26894 if (typeof exports === "object") {
26895 // CommonJS
26896 module.exports = exports = factory(_dereq_("./core"));
26897 }
26898 else if (typeof define === "function" && define.amd) {
26899 // AMD
26900 define(["./core"], factory);
26901 }
26902 else {
26903 // Global (browser)
26904 factory(root.CryptoJS);
26905 }
26906}(this, function (CryptoJS) {
26907
26908 /** @preserve
26909 (c) 2012 by Cédric Mesnil. All rights reserved.
26910
26911 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
26912
26913 - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
26914 - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
26915
26916 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26917 */
26918
26919 (function (Math) {
26920 // Shortcuts
26921 var C = CryptoJS;
26922 var C_lib = C.lib;
26923 var WordArray = C_lib.WordArray;
26924 var Hasher = C_lib.Hasher;
26925 var C_algo = C.algo;
26926
26927 // Constants table
26928 var _zl = WordArray.create([
26929 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
26930 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
26931 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
26932 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
26933 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]);
26934 var _zr = WordArray.create([
26935 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
26936 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
26937 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
26938 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
26939 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]);
26940 var _sl = WordArray.create([
26941 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
26942 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
26943 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
26944 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
26945 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]);
26946 var _sr = WordArray.create([
26947 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
26948 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
26949 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
26950 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
26951 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]);
26952
26953 var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
26954 var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);
26955
26956 /**
26957 * RIPEMD160 hash algorithm.
26958 */
26959 var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
26960 _doReset: function () {
26961 this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
26962 },
26963
26964 _doProcessBlock: function (M, offset) {
26965
26966 // Swap endian
26967 for (var i = 0; i < 16; i++) {
26968 // Shortcuts
26969 var offset_i = offset + i;
26970 var M_offset_i = M[offset_i];
26971
26972 // Swap
26973 M[offset_i] = (
26974 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
26975 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
26976 );
26977 }
26978 // Shortcut
26979 var H = this._hash.words;
26980 var hl = _hl.words;
26981 var hr = _hr.words;
26982 var zl = _zl.words;
26983 var zr = _zr.words;
26984 var sl = _sl.words;
26985 var sr = _sr.words;
26986
26987 // Working variables
26988 var al, bl, cl, dl, el;
26989 var ar, br, cr, dr, er;
26990
26991 ar = al = H[0];
26992 br = bl = H[1];
26993 cr = cl = H[2];
26994 dr = dl = H[3];
26995 er = el = H[4];
26996 // Computation
26997 var t;
26998 for (var i = 0; i < 80; i += 1) {
26999 t = (al + M[offset+zl[i]])|0;
27000 if (i<16){
27001 t += f1(bl,cl,dl) + hl[0];
27002 } else if (i<32) {
27003 t += f2(bl,cl,dl) + hl[1];
27004 } else if (i<48) {
27005 t += f3(bl,cl,dl) + hl[2];
27006 } else if (i<64) {
27007 t += f4(bl,cl,dl) + hl[3];
27008 } else {// if (i<80) {
27009 t += f5(bl,cl,dl) + hl[4];
27010 }
27011 t = t|0;
27012 t = rotl(t,sl[i]);
27013 t = (t+el)|0;
27014 al = el;
27015 el = dl;
27016 dl = rotl(cl, 10);
27017 cl = bl;
27018 bl = t;
27019
27020 t = (ar + M[offset+zr[i]])|0;
27021 if (i<16){
27022 t += f5(br,cr,dr) + hr[0];
27023 } else if (i<32) {
27024 t += f4(br,cr,dr) + hr[1];
27025 } else if (i<48) {
27026 t += f3(br,cr,dr) + hr[2];
27027 } else if (i<64) {
27028 t += f2(br,cr,dr) + hr[3];
27029 } else {// if (i<80) {
27030 t += f1(br,cr,dr) + hr[4];
27031 }
27032 t = t|0;
27033 t = rotl(t,sr[i]) ;
27034 t = (t+er)|0;
27035 ar = er;
27036 er = dr;
27037 dr = rotl(cr, 10);
27038 cr = br;
27039 br = t;
27040 }
27041 // Intermediate hash value
27042 t = (H[1] + cl + dr)|0;
27043 H[1] = (H[2] + dl + er)|0;
27044 H[2] = (H[3] + el + ar)|0;
27045 H[3] = (H[4] + al + br)|0;
27046 H[4] = (H[0] + bl + cr)|0;
27047 H[0] = t;
27048 },
27049
27050 _doFinalize: function () {
27051 // Shortcuts
27052 var data = this._data;
27053 var dataWords = data.words;
27054
27055 var nBitsTotal = this._nDataBytes * 8;
27056 var nBitsLeft = data.sigBytes * 8;
27057
27058 // Add padding
27059 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
27060 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
27061 (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
27062 (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
27063 );
27064 data.sigBytes = (dataWords.length + 1) * 4;
27065
27066 // Hash final blocks
27067 this._process();
27068
27069 // Shortcuts
27070 var hash = this._hash;
27071 var H = hash.words;
27072
27073 // Swap endian
27074 for (var i = 0; i < 5; i++) {
27075 // Shortcut
27076 var H_i = H[i];
27077
27078 // Swap
27079 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
27080 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);
27081 }
27082
27083 // Return final computed hash
27084 return hash;
27085 },
27086
27087 clone: function () {
27088 var clone = Hasher.clone.call(this);
27089 clone._hash = this._hash.clone();
27090
27091 return clone;
27092 }
27093 });
27094
27095
27096 function f1(x, y, z) {
27097 return ((x) ^ (y) ^ (z));
27098
27099 }
27100
27101 function f2(x, y, z) {
27102 return (((x)&(y)) | ((~x)&(z)));
27103 }
27104
27105 function f3(x, y, z) {
27106 return (((x) | (~(y))) ^ (z));
27107 }
27108
27109 function f4(x, y, z) {
27110 return (((x) & (z)) | ((y)&(~(z))));
27111 }
27112
27113 function f5(x, y, z) {
27114 return ((x) ^ ((y) |(~(z))));
27115
27116 }
27117
27118 function rotl(x,n) {
27119 return (x<<n) | (x>>>(32-n));
27120 }
27121
27122
27123 /**
27124 * Shortcut function to the hasher's object interface.
27125 *
27126 * @param {WordArray|string} message The message to hash.
27127 *
27128 * @return {WordArray} The hash.
27129 *
27130 * @static
27131 *
27132 * @example
27133 *
27134 * var hash = CryptoJS.RIPEMD160('message');
27135 * var hash = CryptoJS.RIPEMD160(wordArray);
27136 */
27137 C.RIPEMD160 = Hasher._createHelper(RIPEMD160);
27138
27139 /**
27140 * Shortcut function to the HMAC's object interface.
27141 *
27142 * @param {WordArray|string} message The message to hash.
27143 * @param {WordArray|string} key The secret key.
27144 *
27145 * @return {WordArray} The HMAC.
27146 *
27147 * @static
27148 *
27149 * @example
27150 *
27151 * var hmac = CryptoJS.HmacRIPEMD160(message, key);
27152 */
27153 C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
27154 }(Math));
27155
27156
27157 return CryptoJS.RIPEMD160;
27158
27159}));
27160},{"./core":31}],55:[function(_dereq_,module,exports){
27161;(function (root, factory) {
27162 if (typeof exports === "object") {
27163 // CommonJS
27164 module.exports = exports = factory(_dereq_("./core"));
27165 }
27166 else if (typeof define === "function" && define.amd) {
27167 // AMD
27168 define(["./core"], factory);
27169 }
27170 else {
27171 // Global (browser)
27172 factory(root.CryptoJS);
27173 }
27174}(this, function (CryptoJS) {
27175
27176 (function () {
27177 // Shortcuts
27178 var C = CryptoJS;
27179 var C_lib = C.lib;
27180 var WordArray = C_lib.WordArray;
27181 var Hasher = C_lib.Hasher;
27182 var C_algo = C.algo;
27183
27184 // Reusable object
27185 var W = [];
27186
27187 /**
27188 * SHA-1 hash algorithm.
27189 */
27190 var SHA1 = C_algo.SHA1 = Hasher.extend({
27191 _doReset: function () {
27192 this._hash = new WordArray.init([
27193 0x67452301, 0xefcdab89,
27194 0x98badcfe, 0x10325476,
27195 0xc3d2e1f0
27196 ]);
27197 },
27198
27199 _doProcessBlock: function (M, offset) {
27200 // Shortcut
27201 var H = this._hash.words;
27202
27203 // Working variables
27204 var a = H[0];
27205 var b = H[1];
27206 var c = H[2];
27207 var d = H[3];
27208 var e = H[4];
27209
27210 // Computation
27211 for (var i = 0; i < 80; i++) {
27212 if (i < 16) {
27213 W[i] = M[offset + i] | 0;
27214 } else {
27215 var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
27216 W[i] = (n << 1) | (n >>> 31);
27217 }
27218
27219 var t = ((a << 5) | (a >>> 27)) + e + W[i];
27220 if (i < 20) {
27221 t += ((b & c) | (~b & d)) + 0x5a827999;
27222 } else if (i < 40) {
27223 t += (b ^ c ^ d) + 0x6ed9eba1;
27224 } else if (i < 60) {
27225 t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
27226 } else /* if (i < 80) */ {
27227 t += (b ^ c ^ d) - 0x359d3e2a;
27228 }
27229
27230 e = d;
27231 d = c;
27232 c = (b << 30) | (b >>> 2);
27233 b = a;
27234 a = t;
27235 }
27236
27237 // Intermediate hash value
27238 H[0] = (H[0] + a) | 0;
27239 H[1] = (H[1] + b) | 0;
27240 H[2] = (H[2] + c) | 0;
27241 H[3] = (H[3] + d) | 0;
27242 H[4] = (H[4] + e) | 0;
27243 },
27244
27245 _doFinalize: function () {
27246 // Shortcuts
27247 var data = this._data;
27248 var dataWords = data.words;
27249
27250 var nBitsTotal = this._nDataBytes * 8;
27251 var nBitsLeft = data.sigBytes * 8;
27252
27253 // Add padding
27254 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
27255 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
27256 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
27257 data.sigBytes = dataWords.length * 4;
27258
27259 // Hash final blocks
27260 this._process();
27261
27262 // Return final computed hash
27263 return this._hash;
27264 },
27265
27266 clone: function () {
27267 var clone = Hasher.clone.call(this);
27268 clone._hash = this._hash.clone();
27269
27270 return clone;
27271 }
27272 });
27273
27274 /**
27275 * Shortcut function to the hasher's object interface.
27276 *
27277 * @param {WordArray|string} message The message to hash.
27278 *
27279 * @return {WordArray} The hash.
27280 *
27281 * @static
27282 *
27283 * @example
27284 *
27285 * var hash = CryptoJS.SHA1('message');
27286 * var hash = CryptoJS.SHA1(wordArray);
27287 */
27288 C.SHA1 = Hasher._createHelper(SHA1);
27289
27290 /**
27291 * Shortcut function to the HMAC's object interface.
27292 *
27293 * @param {WordArray|string} message The message to hash.
27294 * @param {WordArray|string} key The secret key.
27295 *
27296 * @return {WordArray} The HMAC.
27297 *
27298 * @static
27299 *
27300 * @example
27301 *
27302 * var hmac = CryptoJS.HmacSHA1(message, key);
27303 */
27304 C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
27305 }());
27306
27307
27308 return CryptoJS.SHA1;
27309
27310}));
27311},{"./core":31}],56:[function(_dereq_,module,exports){
27312;(function (root, factory, undef) {
27313 if (typeof exports === "object") {
27314 // CommonJS
27315 module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha256"));
27316 }
27317 else if (typeof define === "function" && define.amd) {
27318 // AMD
27319 define(["./core", "./sha256"], factory);
27320 }
27321 else {
27322 // Global (browser)
27323 factory(root.CryptoJS);
27324 }
27325}(this, function (CryptoJS) {
27326
27327 (function () {
27328 // Shortcuts
27329 var C = CryptoJS;
27330 var C_lib = C.lib;
27331 var WordArray = C_lib.WordArray;
27332 var C_algo = C.algo;
27333 var SHA256 = C_algo.SHA256;
27334
27335 /**
27336 * SHA-224 hash algorithm.
27337 */
27338 var SHA224 = C_algo.SHA224 = SHA256.extend({
27339 _doReset: function () {
27340 this._hash = new WordArray.init([
27341 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
27342 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
27343 ]);
27344 },
27345
27346 _doFinalize: function () {
27347 var hash = SHA256._doFinalize.call(this);
27348
27349 hash.sigBytes -= 4;
27350
27351 return hash;
27352 }
27353 });
27354
27355 /**
27356 * Shortcut function to the hasher's object interface.
27357 *
27358 * @param {WordArray|string} message The message to hash.
27359 *
27360 * @return {WordArray} The hash.
27361 *
27362 * @static
27363 *
27364 * @example
27365 *
27366 * var hash = CryptoJS.SHA224('message');
27367 * var hash = CryptoJS.SHA224(wordArray);
27368 */
27369 C.SHA224 = SHA256._createHelper(SHA224);
27370
27371 /**
27372 * Shortcut function to the HMAC's object interface.
27373 *
27374 * @param {WordArray|string} message The message to hash.
27375 * @param {WordArray|string} key The secret key.
27376 *
27377 * @return {WordArray} The HMAC.
27378 *
27379 * @static
27380 *
27381 * @example
27382 *
27383 * var hmac = CryptoJS.HmacSHA224(message, key);
27384 */
27385 C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
27386 }());
27387
27388
27389 return CryptoJS.SHA224;
27390
27391}));
27392},{"./core":31,"./sha256":57}],57:[function(_dereq_,module,exports){
27393;(function (root, factory) {
27394 if (typeof exports === "object") {
27395 // CommonJS
27396 module.exports = exports = factory(_dereq_("./core"));
27397 }
27398 else if (typeof define === "function" && define.amd) {
27399 // AMD
27400 define(["./core"], factory);
27401 }
27402 else {
27403 // Global (browser)
27404 factory(root.CryptoJS);
27405 }
27406}(this, function (CryptoJS) {
27407
27408 (function (Math) {
27409 // Shortcuts
27410 var C = CryptoJS;
27411 var C_lib = C.lib;
27412 var WordArray = C_lib.WordArray;
27413 var Hasher = C_lib.Hasher;
27414 var C_algo = C.algo;
27415
27416 // Initialization and round constants tables
27417 var H = [];
27418 var K = [];
27419
27420 // Compute constants
27421 (function () {
27422 function isPrime(n) {
27423 var sqrtN = Math.sqrt(n);
27424 for (var factor = 2; factor <= sqrtN; factor++) {
27425 if (!(n % factor)) {
27426 return false;
27427 }
27428 }
27429
27430 return true;
27431 }
27432
27433 function getFractionalBits(n) {
27434 return ((n - (n | 0)) * 0x100000000) | 0;
27435 }
27436
27437 var n = 2;
27438 var nPrime = 0;
27439 while (nPrime < 64) {
27440 if (isPrime(n)) {
27441 if (nPrime < 8) {
27442 H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
27443 }
27444 K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));
27445
27446 nPrime++;
27447 }
27448
27449 n++;
27450 }
27451 }());
27452
27453 // Reusable object
27454 var W = [];
27455
27456 /**
27457 * SHA-256 hash algorithm.
27458 */
27459 var SHA256 = C_algo.SHA256 = Hasher.extend({
27460 _doReset: function () {
27461 this._hash = new WordArray.init(H.slice(0));
27462 },
27463
27464 _doProcessBlock: function (M, offset) {
27465 // Shortcut
27466 var H = this._hash.words;
27467
27468 // Working variables
27469 var a = H[0];
27470 var b = H[1];
27471 var c = H[2];
27472 var d = H[3];
27473 var e = H[4];
27474 var f = H[5];
27475 var g = H[6];
27476 var h = H[7];
27477
27478 // Computation
27479 for (var i = 0; i < 64; i++) {
27480 if (i < 16) {
27481 W[i] = M[offset + i] | 0;
27482 } else {
27483 var gamma0x = W[i - 15];
27484 var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^
27485 ((gamma0x << 14) | (gamma0x >>> 18)) ^
27486 (gamma0x >>> 3);
27487
27488 var gamma1x = W[i - 2];
27489 var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^
27490 ((gamma1x << 13) | (gamma1x >>> 19)) ^
27491 (gamma1x >>> 10);
27492
27493 W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
27494 }
27495
27496 var ch = (e & f) ^ (~e & g);
27497 var maj = (a & b) ^ (a & c) ^ (b & c);
27498
27499 var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
27500 var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25));
27501
27502 var t1 = h + sigma1 + ch + K[i] + W[i];
27503 var t2 = sigma0 + maj;
27504
27505 h = g;
27506 g = f;
27507 f = e;
27508 e = (d + t1) | 0;
27509 d = c;
27510 c = b;
27511 b = a;
27512 a = (t1 + t2) | 0;
27513 }
27514
27515 // Intermediate hash value
27516 H[0] = (H[0] + a) | 0;
27517 H[1] = (H[1] + b) | 0;
27518 H[2] = (H[2] + c) | 0;
27519 H[3] = (H[3] + d) | 0;
27520 H[4] = (H[4] + e) | 0;
27521 H[5] = (H[5] + f) | 0;
27522 H[6] = (H[6] + g) | 0;
27523 H[7] = (H[7] + h) | 0;
27524 },
27525
27526 _doFinalize: function () {
27527 // Shortcuts
27528 var data = this._data;
27529 var dataWords = data.words;
27530
27531 var nBitsTotal = this._nDataBytes * 8;
27532 var nBitsLeft = data.sigBytes * 8;
27533
27534 // Add padding
27535 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
27536 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
27537 dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
27538 data.sigBytes = dataWords.length * 4;
27539
27540 // Hash final blocks
27541 this._process();
27542
27543 // Return final computed hash
27544 return this._hash;
27545 },
27546
27547 clone: function () {
27548 var clone = Hasher.clone.call(this);
27549 clone._hash = this._hash.clone();
27550
27551 return clone;
27552 }
27553 });
27554
27555 /**
27556 * Shortcut function to the hasher's object interface.
27557 *
27558 * @param {WordArray|string} message The message to hash.
27559 *
27560 * @return {WordArray} The hash.
27561 *
27562 * @static
27563 *
27564 * @example
27565 *
27566 * var hash = CryptoJS.SHA256('message');
27567 * var hash = CryptoJS.SHA256(wordArray);
27568 */
27569 C.SHA256 = Hasher._createHelper(SHA256);
27570
27571 /**
27572 * Shortcut function to the HMAC's object interface.
27573 *
27574 * @param {WordArray|string} message The message to hash.
27575 * @param {WordArray|string} key The secret key.
27576 *
27577 * @return {WordArray} The HMAC.
27578 *
27579 * @static
27580 *
27581 * @example
27582 *
27583 * var hmac = CryptoJS.HmacSHA256(message, key);
27584 */
27585 C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
27586 }(Math));
27587
27588
27589 return CryptoJS.SHA256;
27590
27591}));
27592},{"./core":31}],58:[function(_dereq_,module,exports){
27593;(function (root, factory, undef) {
27594 if (typeof exports === "object") {
27595 // CommonJS
27596 module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"));
27597 }
27598 else if (typeof define === "function" && define.amd) {
27599 // AMD
27600 define(["./core", "./x64-core"], factory);
27601 }
27602 else {
27603 // Global (browser)
27604 factory(root.CryptoJS);
27605 }
27606}(this, function (CryptoJS) {
27607
27608 (function (Math) {
27609 // Shortcuts
27610 var C = CryptoJS;
27611 var C_lib = C.lib;
27612 var WordArray = C_lib.WordArray;
27613 var Hasher = C_lib.Hasher;
27614 var C_x64 = C.x64;
27615 var X64Word = C_x64.Word;
27616 var C_algo = C.algo;
27617
27618 // Constants tables
27619 var RHO_OFFSETS = [];
27620 var PI_INDEXES = [];
27621 var ROUND_CONSTANTS = [];
27622
27623 // Compute Constants
27624 (function () {
27625 // Compute rho offset constants
27626 var x = 1, y = 0;
27627 for (var t = 0; t < 24; t++) {
27628 RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;
27629
27630 var newX = y % 5;
27631 var newY = (2 * x + 3 * y) % 5;
27632 x = newX;
27633 y = newY;
27634 }
27635
27636 // Compute pi index constants
27637 for (var x = 0; x < 5; x++) {
27638 for (var y = 0; y < 5; y++) {
27639 PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
27640 }
27641 }
27642
27643 // Compute round constants
27644 var LFSR = 0x01;
27645 for (var i = 0; i < 24; i++) {
27646 var roundConstantMsw = 0;
27647 var roundConstantLsw = 0;
27648
27649 for (var j = 0; j < 7; j++) {
27650 if (LFSR & 0x01) {
27651 var bitPosition = (1 << j) - 1;
27652 if (bitPosition < 32) {
27653 roundConstantLsw ^= 1 << bitPosition;
27654 } else /* if (bitPosition >= 32) */ {
27655 roundConstantMsw ^= 1 << (bitPosition - 32);
27656 }
27657 }
27658
27659 // Compute next LFSR
27660 if (LFSR & 0x80) {
27661 // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
27662 LFSR = (LFSR << 1) ^ 0x71;
27663 } else {
27664 LFSR <<= 1;
27665 }
27666 }
27667
27668 ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
27669 }
27670 }());
27671
27672 // Reusable objects for temporary values
27673 var T = [];
27674 (function () {
27675 for (var i = 0; i < 25; i++) {
27676 T[i] = X64Word.create();
27677 }
27678 }());
27679
27680 /**
27681 * SHA-3 hash algorithm.
27682 */
27683 var SHA3 = C_algo.SHA3 = Hasher.extend({
27684 /**
27685 * Configuration options.
27686 *
27687 * @property {number} outputLength
27688 * The desired number of bits in the output hash.
27689 * Only values permitted are: 224, 256, 384, 512.
27690 * Default: 512
27691 */
27692 cfg: Hasher.cfg.extend({
27693 outputLength: 512
27694 }),
27695
27696 _doReset: function () {
27697 var state = this._state = []
27698 for (var i = 0; i < 25; i++) {
27699 state[i] = new X64Word.init();
27700 }
27701
27702 this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
27703 },
27704
27705 _doProcessBlock: function (M, offset) {
27706 // Shortcuts
27707 var state = this._state;
27708 var nBlockSizeLanes = this.blockSize / 2;
27709
27710 // Absorb
27711 for (var i = 0; i < nBlockSizeLanes; i++) {
27712 // Shortcuts
27713 var M2i = M[offset + 2 * i];
27714 var M2i1 = M[offset + 2 * i + 1];
27715
27716 // Swap endian
27717 M2i = (
27718 (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |
27719 (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)
27720 );
27721 M2i1 = (
27722 (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |
27723 (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)
27724 );
27725
27726 // Absorb message into state
27727 var lane = state[i];
27728 lane.high ^= M2i1;
27729 lane.low ^= M2i;
27730 }
27731
27732 // Rounds
27733 for (var round = 0; round < 24; round++) {
27734 // Theta
27735 for (var x = 0; x < 5; x++) {
27736 // Mix column lanes
27737 var tMsw = 0, tLsw = 0;
27738 for (var y = 0; y < 5; y++) {
27739 var lane = state[x + 5 * y];
27740 tMsw ^= lane.high;
27741 tLsw ^= lane.low;
27742 }
27743
27744 // Temporary values
27745 var Tx = T[x];
27746 Tx.high = tMsw;
27747 Tx.low = tLsw;
27748 }
27749 for (var x = 0; x < 5; x++) {
27750 // Shortcuts
27751 var Tx4 = T[(x + 4) % 5];
27752 var Tx1 = T[(x + 1) % 5];
27753 var Tx1Msw = Tx1.high;
27754 var Tx1Lsw = Tx1.low;
27755
27756 // Mix surrounding columns
27757 var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
27758 var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
27759 for (var y = 0; y < 5; y++) {
27760 var lane = state[x + 5 * y];
27761 lane.high ^= tMsw;
27762 lane.low ^= tLsw;
27763 }
27764 }
27765
27766 // Rho Pi
27767 for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
27768 // Shortcuts
27769 var lane = state[laneIndex];
27770 var laneMsw = lane.high;
27771 var laneLsw = lane.low;
27772 var rhoOffset = RHO_OFFSETS[laneIndex];
27773
27774 // Rotate lanes
27775 if (rhoOffset < 32) {
27776 var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
27777 var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
27778 } else /* if (rhoOffset >= 32) */ {
27779 var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
27780 var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
27781 }
27782
27783 // Transpose lanes
27784 var TPiLane = T[PI_INDEXES[laneIndex]];
27785 TPiLane.high = tMsw;
27786 TPiLane.low = tLsw;
27787 }
27788
27789 // Rho pi at x = y = 0
27790 var T0 = T[0];
27791 var state0 = state[0];
27792 T0.high = state0.high;
27793 T0.low = state0.low;
27794
27795 // Chi
27796 for (var x = 0; x < 5; x++) {
27797 for (var y = 0; y < 5; y++) {
27798 // Shortcuts
27799 var laneIndex = x + 5 * y;
27800 var lane = state[laneIndex];
27801 var TLane = T[laneIndex];
27802 var Tx1Lane = T[((x + 1) % 5) + 5 * y];
27803 var Tx2Lane = T[((x + 2) % 5) + 5 * y];
27804
27805 // Mix rows
27806 lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
27807 lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);
27808 }
27809 }
27810
27811 // Iota
27812 var lane = state[0];
27813 var roundConstant = ROUND_CONSTANTS[round];
27814 lane.high ^= roundConstant.high;
27815 lane.low ^= roundConstant.low;;
27816 }
27817 },
27818
27819 _doFinalize: function () {
27820 // Shortcuts
27821 var data = this._data;
27822 var dataWords = data.words;
27823 var nBitsTotal = this._nDataBytes * 8;
27824 var nBitsLeft = data.sigBytes * 8;
27825 var blockSizeBits = this.blockSize * 32;
27826
27827 // Add padding
27828 dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
27829 dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
27830 data.sigBytes = dataWords.length * 4;
27831
27832 // Hash final blocks
27833 this._process();
27834
27835 // Shortcuts
27836 var state = this._state;
27837 var outputLengthBytes = this.cfg.outputLength / 8;
27838 var outputLengthLanes = outputLengthBytes / 8;
27839
27840 // Squeeze
27841 var hashWords = [];
27842 for (var i = 0; i < outputLengthLanes; i++) {
27843 // Shortcuts
27844 var lane = state[i];
27845 var laneMsw = lane.high;
27846 var laneLsw = lane.low;
27847
27848 // Swap endian
27849 laneMsw = (
27850 (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |
27851 (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)
27852 );
27853 laneLsw = (
27854 (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |
27855 (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)
27856 );
27857
27858 // Squeeze state to retrieve hash
27859 hashWords.push(laneLsw);
27860 hashWords.push(laneMsw);
27861 }
27862
27863 // Return final computed hash
27864 return new WordArray.init(hashWords, outputLengthBytes);
27865 },
27866
27867 clone: function () {
27868 var clone = Hasher.clone.call(this);
27869
27870 var state = clone._state = this._state.slice(0);
27871 for (var i = 0; i < 25; i++) {
27872 state[i] = state[i].clone();
27873 }
27874
27875 return clone;
27876 }
27877 });
27878
27879 /**
27880 * Shortcut function to the hasher's object interface.
27881 *
27882 * @param {WordArray|string} message The message to hash.
27883 *
27884 * @return {WordArray} The hash.
27885 *
27886 * @static
27887 *
27888 * @example
27889 *
27890 * var hash = CryptoJS.SHA3('message');
27891 * var hash = CryptoJS.SHA3(wordArray);
27892 */
27893 C.SHA3 = Hasher._createHelper(SHA3);
27894
27895 /**
27896 * Shortcut function to the HMAC's object interface.
27897 *
27898 * @param {WordArray|string} message The message to hash.
27899 * @param {WordArray|string} key The secret key.
27900 *
27901 * @return {WordArray} The HMAC.
27902 *
27903 * @static
27904 *
27905 * @example
27906 *
27907 * var hmac = CryptoJS.HmacSHA3(message, key);
27908 */
27909 C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
27910 }(Math));
27911
27912
27913 return CryptoJS.SHA3;
27914
27915}));
27916},{"./core":31,"./x64-core":62}],59:[function(_dereq_,module,exports){
27917;(function (root, factory, undef) {
27918 if (typeof exports === "object") {
27919 // CommonJS
27920 module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./sha512"));
27921 }
27922 else if (typeof define === "function" && define.amd) {
27923 // AMD
27924 define(["./core", "./x64-core", "./sha512"], factory);
27925 }
27926 else {
27927 // Global (browser)
27928 factory(root.CryptoJS);
27929 }
27930}(this, function (CryptoJS) {
27931
27932 (function () {
27933 // Shortcuts
27934 var C = CryptoJS;
27935 var C_x64 = C.x64;
27936 var X64Word = C_x64.Word;
27937 var X64WordArray = C_x64.WordArray;
27938 var C_algo = C.algo;
27939 var SHA512 = C_algo.SHA512;
27940
27941 /**
27942 * SHA-384 hash algorithm.
27943 */
27944 var SHA384 = C_algo.SHA384 = SHA512.extend({
27945 _doReset: function () {
27946 this._hash = new X64WordArray.init([
27947 new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
27948 new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
27949 new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
27950 new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
27951 ]);
27952 },
27953
27954 _doFinalize: function () {
27955 var hash = SHA512._doFinalize.call(this);
27956
27957 hash.sigBytes -= 16;
27958
27959 return hash;
27960 }
27961 });
27962
27963 /**
27964 * Shortcut function to the hasher's object interface.
27965 *
27966 * @param {WordArray|string} message The message to hash.
27967 *
27968 * @return {WordArray} The hash.
27969 *
27970 * @static
27971 *
27972 * @example
27973 *
27974 * var hash = CryptoJS.SHA384('message');
27975 * var hash = CryptoJS.SHA384(wordArray);
27976 */
27977 C.SHA384 = SHA512._createHelper(SHA384);
27978
27979 /**
27980 * Shortcut function to the HMAC's object interface.
27981 *
27982 * @param {WordArray|string} message The message to hash.
27983 * @param {WordArray|string} key The secret key.
27984 *
27985 * @return {WordArray} The HMAC.
27986 *
27987 * @static
27988 *
27989 * @example
27990 *
27991 * var hmac = CryptoJS.HmacSHA384(message, key);
27992 */
27993 C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
27994 }());
27995
27996
27997 return CryptoJS.SHA384;
27998
27999}));
28000},{"./core":31,"./sha512":60,"./x64-core":62}],60:[function(_dereq_,module,exports){
28001;(function (root, factory, undef) {
28002 if (typeof exports === "object") {
28003 // CommonJS
28004 module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"));
28005 }
28006 else if (typeof define === "function" && define.amd) {
28007 // AMD
28008 define(["./core", "./x64-core"], factory);
28009 }
28010 else {
28011 // Global (browser)
28012 factory(root.CryptoJS);
28013 }
28014}(this, function (CryptoJS) {
28015
28016 (function () {
28017 // Shortcuts
28018 var C = CryptoJS;
28019 var C_lib = C.lib;
28020 var Hasher = C_lib.Hasher;
28021 var C_x64 = C.x64;
28022 var X64Word = C_x64.Word;
28023 var X64WordArray = C_x64.WordArray;
28024 var C_algo = C.algo;
28025
28026 function X64Word_create() {
28027 return X64Word.create.apply(X64Word, arguments);
28028 }
28029
28030 // Constants
28031 var K = [
28032 X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
28033 X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
28034 X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
28035 X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
28036 X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
28037 X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
28038 X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
28039 X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
28040 X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
28041 X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
28042 X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
28043 X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
28044 X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
28045 X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
28046 X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
28047 X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
28048 X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
28049 X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
28050 X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
28051 X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
28052 X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
28053 X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
28054 X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
28055 X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
28056 X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
28057 X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
28058 X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
28059 X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
28060 X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
28061 X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
28062 X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
28063 X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
28064 X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
28065 X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
28066 X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
28067 X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
28068 X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
28069 X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
28070 X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
28071 X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
28072 ];
28073
28074 // Reusable objects
28075 var W = [];
28076 (function () {
28077 for (var i = 0; i < 80; i++) {
28078 W[i] = X64Word_create();
28079 }
28080 }());
28081
28082 /**
28083 * SHA-512 hash algorithm.
28084 */
28085 var SHA512 = C_algo.SHA512 = Hasher.extend({
28086 _doReset: function () {
28087 this._hash = new X64WordArray.init([
28088 new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
28089 new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
28090 new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
28091 new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
28092 ]);
28093 },
28094
28095 _doProcessBlock: function (M, offset) {
28096 // Shortcuts
28097 var H = this._hash.words;
28098
28099 var H0 = H[0];
28100 var H1 = H[1];
28101 var H2 = H[2];
28102 var H3 = H[3];
28103 var H4 = H[4];
28104 var H5 = H[5];
28105 var H6 = H[6];
28106 var H7 = H[7];
28107
28108 var H0h = H0.high;
28109 var H0l = H0.low;
28110 var H1h = H1.high;
28111 var H1l = H1.low;
28112 var H2h = H2.high;
28113 var H2l = H2.low;
28114 var H3h = H3.high;
28115 var H3l = H3.low;
28116 var H4h = H4.high;
28117 var H4l = H4.low;
28118 var H5h = H5.high;
28119 var H5l = H5.low;
28120 var H6h = H6.high;
28121 var H6l = H6.low;
28122 var H7h = H7.high;
28123 var H7l = H7.low;
28124
28125 // Working variables
28126 var ah = H0h;
28127 var al = H0l;
28128 var bh = H1h;
28129 var bl = H1l;
28130 var ch = H2h;
28131 var cl = H2l;
28132 var dh = H3h;
28133 var dl = H3l;
28134 var eh = H4h;
28135 var el = H4l;
28136 var fh = H5h;
28137 var fl = H5l;
28138 var gh = H6h;
28139 var gl = H6l;
28140 var hh = H7h;
28141 var hl = H7l;
28142
28143 // Rounds
28144 for (var i = 0; i < 80; i++) {
28145 // Shortcut
28146 var Wi = W[i];
28147
28148 // Extend message
28149 if (i < 16) {
28150 var Wih = Wi.high = M[offset + i * 2] | 0;
28151 var Wil = Wi.low = M[offset + i * 2 + 1] | 0;
28152 } else {
28153 // Gamma0
28154 var gamma0x = W[i - 15];
28155 var gamma0xh = gamma0x.high;
28156 var gamma0xl = gamma0x.low;
28157 var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
28158 var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));
28159
28160 // Gamma1
28161 var gamma1x = W[i - 2];
28162 var gamma1xh = gamma1x.high;
28163 var gamma1xl = gamma1x.low;
28164 var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
28165 var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));
28166
28167 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
28168 var Wi7 = W[i - 7];
28169 var Wi7h = Wi7.high;
28170 var Wi7l = Wi7.low;
28171
28172 var Wi16 = W[i - 16];
28173 var Wi16h = Wi16.high;
28174 var Wi16l = Wi16.low;
28175
28176 var Wil = gamma0l + Wi7l;
28177 var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
28178 var Wil = Wil + gamma1l;
28179 var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
28180 var Wil = Wil + Wi16l;
28181 var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);
28182
28183 Wi.high = Wih;
28184 Wi.low = Wil;
28185 }
28186
28187 var chh = (eh & fh) ^ (~eh & gh);
28188 var chl = (el & fl) ^ (~el & gl);
28189 var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
28190 var majl = (al & bl) ^ (al & cl) ^ (bl & cl);
28191
28192 var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
28193 var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
28194 var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
28195 var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));
28196
28197 // t1 = h + sigma1 + ch + K[i] + W[i]
28198 var Ki = K[i];
28199 var Kih = Ki.high;
28200 var Kil = Ki.low;
28201
28202 var t1l = hl + sigma1l;
28203 var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
28204 var t1l = t1l + chl;
28205 var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
28206 var t1l = t1l + Kil;
28207 var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
28208 var t1l = t1l + Wil;
28209 var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);
28210
28211 // t2 = sigma0 + maj
28212 var t2l = sigma0l + majl;
28213 var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);
28214
28215 // Update working variables
28216 hh = gh;
28217 hl = gl;
28218 gh = fh;
28219 gl = fl;
28220 fh = eh;
28221 fl = el;
28222 el = (dl + t1l) | 0;
28223 eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
28224 dh = ch;
28225 dl = cl;
28226 ch = bh;
28227 cl = bl;
28228 bh = ah;
28229 bl = al;
28230 al = (t1l + t2l) | 0;
28231 ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
28232 }
28233
28234 // Intermediate hash value
28235 H0l = H0.low = (H0l + al);
28236 H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
28237 H1l = H1.low = (H1l + bl);
28238 H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
28239 H2l = H2.low = (H2l + cl);
28240 H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
28241 H3l = H3.low = (H3l + dl);
28242 H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
28243 H4l = H4.low = (H4l + el);
28244 H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
28245 H5l = H5.low = (H5l + fl);
28246 H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
28247 H6l = H6.low = (H6l + gl);
28248 H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
28249 H7l = H7.low = (H7l + hl);
28250 H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
28251 },
28252
28253 _doFinalize: function () {
28254 // Shortcuts
28255 var data = this._data;
28256 var dataWords = data.words;
28257
28258 var nBitsTotal = this._nDataBytes * 8;
28259 var nBitsLeft = data.sigBytes * 8;
28260
28261 // Add padding
28262 dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
28263 dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
28264 dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
28265 data.sigBytes = dataWords.length * 4;
28266
28267 // Hash final blocks
28268 this._process();
28269
28270 // Convert hash to 32-bit word array before returning
28271 var hash = this._hash.toX32();
28272
28273 // Return final computed hash
28274 return hash;
28275 },
28276
28277 clone: function () {
28278 var clone = Hasher.clone.call(this);
28279 clone._hash = this._hash.clone();
28280
28281 return clone;
28282 },
28283
28284 blockSize: 1024/32
28285 });
28286
28287 /**
28288 * Shortcut function to the hasher's object interface.
28289 *
28290 * @param {WordArray|string} message The message to hash.
28291 *
28292 * @return {WordArray} The hash.
28293 *
28294 * @static
28295 *
28296 * @example
28297 *
28298 * var hash = CryptoJS.SHA512('message');
28299 * var hash = CryptoJS.SHA512(wordArray);
28300 */
28301 C.SHA512 = Hasher._createHelper(SHA512);
28302
28303 /**
28304 * Shortcut function to the HMAC's object interface.
28305 *
28306 * @param {WordArray|string} message The message to hash.
28307 * @param {WordArray|string} key The secret key.
28308 *
28309 * @return {WordArray} The HMAC.
28310 *
28311 * @static
28312 *
28313 * @example
28314 *
28315 * var hmac = CryptoJS.HmacSHA512(message, key);
28316 */
28317 C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
28318 }());
28319
28320
28321 return CryptoJS.SHA512;
28322
28323}));
28324},{"./core":31,"./x64-core":62}],61:[function(_dereq_,module,exports){
28325;(function (root, factory, undef) {
28326 if (typeof exports === "object") {
28327 // CommonJS
28328 module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core"));
28329 }
28330 else if (typeof define === "function" && define.amd) {
28331 // AMD
28332 define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
28333 }
28334 else {
28335 // Global (browser)
28336 factory(root.CryptoJS);
28337 }
28338}(this, function (CryptoJS) {
28339
28340 (function () {
28341 // Shortcuts
28342 var C = CryptoJS;
28343 var C_lib = C.lib;
28344 var WordArray = C_lib.WordArray;
28345 var BlockCipher = C_lib.BlockCipher;
28346 var C_algo = C.algo;
28347
28348 // Permuted Choice 1 constants
28349 var PC1 = [
28350 57, 49, 41, 33, 25, 17, 9, 1,
28351 58, 50, 42, 34, 26, 18, 10, 2,
28352 59, 51, 43, 35, 27, 19, 11, 3,
28353 60, 52, 44, 36, 63, 55, 47, 39,
28354 31, 23, 15, 7, 62, 54, 46, 38,
28355 30, 22, 14, 6, 61, 53, 45, 37,
28356 29, 21, 13, 5, 28, 20, 12, 4
28357 ];
28358
28359 // Permuted Choice 2 constants
28360 var PC2 = [
28361 14, 17, 11, 24, 1, 5,
28362 3, 28, 15, 6, 21, 10,
28363 23, 19, 12, 4, 26, 8,
28364 16, 7, 27, 20, 13, 2,
28365 41, 52, 31, 37, 47, 55,
28366 30, 40, 51, 45, 33, 48,
28367 44, 49, 39, 56, 34, 53,
28368 46, 42, 50, 36, 29, 32
28369 ];
28370
28371 // Cumulative bit shift constants
28372 var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
28373
28374 // SBOXes and round permutation constants
28375 var SBOX_P = [
28376 {
28377 0x0: 0x808200,
28378 0x10000000: 0x8000,
28379 0x20000000: 0x808002,
28380 0x30000000: 0x2,
28381 0x40000000: 0x200,
28382 0x50000000: 0x808202,
28383 0x60000000: 0x800202,
28384 0x70000000: 0x800000,
28385 0x80000000: 0x202,
28386 0x90000000: 0x800200,
28387 0xa0000000: 0x8200,
28388 0xb0000000: 0x808000,
28389 0xc0000000: 0x8002,
28390 0xd0000000: 0x800002,
28391 0xe0000000: 0x0,
28392 0xf0000000: 0x8202,
28393 0x8000000: 0x0,
28394 0x18000000: 0x808202,
28395 0x28000000: 0x8202,
28396 0x38000000: 0x8000,
28397 0x48000000: 0x808200,
28398 0x58000000: 0x200,
28399 0x68000000: 0x808002,
28400 0x78000000: 0x2,
28401 0x88000000: 0x800200,
28402 0x98000000: 0x8200,
28403 0xa8000000: 0x808000,
28404 0xb8000000: 0x800202,
28405 0xc8000000: 0x800002,
28406 0xd8000000: 0x8002,
28407 0xe8000000: 0x202,
28408 0xf8000000: 0x800000,
28409 0x1: 0x8000,
28410 0x10000001: 0x2,
28411 0x20000001: 0x808200,
28412 0x30000001: 0x800000,
28413 0x40000001: 0x808002,
28414 0x50000001: 0x8200,
28415 0x60000001: 0x200,
28416 0x70000001: 0x800202,
28417 0x80000001: 0x808202,
28418 0x90000001: 0x808000,
28419 0xa0000001: 0x800002,
28420 0xb0000001: 0x8202,
28421 0xc0000001: 0x202,
28422 0xd0000001: 0x800200,
28423 0xe0000001: 0x8002,
28424 0xf0000001: 0x0,
28425 0x8000001: 0x808202,
28426 0x18000001: 0x808000,
28427 0x28000001: 0x800000,
28428 0x38000001: 0x200,
28429 0x48000001: 0x8000,
28430 0x58000001: 0x800002,
28431 0x68000001: 0x2,
28432 0x78000001: 0x8202,
28433 0x88000001: 0x8002,
28434 0x98000001: 0x800202,
28435 0xa8000001: 0x202,
28436 0xb8000001: 0x808200,
28437 0xc8000001: 0x800200,
28438 0xd8000001: 0x0,
28439 0xe8000001: 0x8200,
28440 0xf8000001: 0x808002
28441 },
28442 {
28443 0x0: 0x40084010,
28444 0x1000000: 0x4000,
28445 0x2000000: 0x80000,
28446 0x3000000: 0x40080010,
28447 0x4000000: 0x40000010,
28448 0x5000000: 0x40084000,
28449 0x6000000: 0x40004000,
28450 0x7000000: 0x10,
28451 0x8000000: 0x84000,
28452 0x9000000: 0x40004010,
28453 0xa000000: 0x40000000,
28454 0xb000000: 0x84010,
28455 0xc000000: 0x80010,
28456 0xd000000: 0x0,
28457 0xe000000: 0x4010,
28458 0xf000000: 0x40080000,
28459 0x800000: 0x40004000,
28460 0x1800000: 0x84010,
28461 0x2800000: 0x10,
28462 0x3800000: 0x40004010,
28463 0x4800000: 0x40084010,
28464 0x5800000: 0x40000000,
28465 0x6800000: 0x80000,
28466 0x7800000: 0x40080010,
28467 0x8800000: 0x80010,
28468 0x9800000: 0x0,
28469 0xa800000: 0x4000,
28470 0xb800000: 0x40080000,
28471 0xc800000: 0x40000010,
28472 0xd800000: 0x84000,
28473 0xe800000: 0x40084000,
28474 0xf800000: 0x4010,
28475 0x10000000: 0x0,
28476 0x11000000: 0x40080010,
28477 0x12000000: 0x40004010,
28478 0x13000000: 0x40084000,
28479 0x14000000: 0x40080000,
28480 0x15000000: 0x10,
28481 0x16000000: 0x84010,
28482 0x17000000: 0x4000,
28483 0x18000000: 0x4010,
28484 0x19000000: 0x80000,
28485 0x1a000000: 0x80010,
28486 0x1b000000: 0x40000010,
28487 0x1c000000: 0x84000,
28488 0x1d000000: 0x40004000,
28489 0x1e000000: 0x40000000,
28490 0x1f000000: 0x40084010,
28491 0x10800000: 0x84010,
28492 0x11800000: 0x80000,
28493 0x12800000: 0x40080000,
28494 0x13800000: 0x4000,
28495 0x14800000: 0x40004000,
28496 0x15800000: 0x40084010,
28497 0x16800000: 0x10,
28498 0x17800000: 0x40000000,
28499 0x18800000: 0x40084000,
28500 0x19800000: 0x40000010,
28501 0x1a800000: 0x40004010,
28502 0x1b800000: 0x80010,
28503 0x1c800000: 0x0,
28504 0x1d800000: 0x4010,
28505 0x1e800000: 0x40080010,
28506 0x1f800000: 0x84000
28507 },
28508 {
28509 0x0: 0x104,
28510 0x100000: 0x0,
28511 0x200000: 0x4000100,
28512 0x300000: 0x10104,
28513 0x400000: 0x10004,
28514 0x500000: 0x4000004,
28515 0x600000: 0x4010104,
28516 0x700000: 0x4010000,
28517 0x800000: 0x4000000,
28518 0x900000: 0x4010100,
28519 0xa00000: 0x10100,
28520 0xb00000: 0x4010004,
28521 0xc00000: 0x4000104,
28522 0xd00000: 0x10000,
28523 0xe00000: 0x4,
28524 0xf00000: 0x100,
28525 0x80000: 0x4010100,
28526 0x180000: 0x4010004,
28527 0x280000: 0x0,
28528 0x380000: 0x4000100,
28529 0x480000: 0x4000004,
28530 0x580000: 0x10000,
28531 0x680000: 0x10004,
28532 0x780000: 0x104,
28533 0x880000: 0x4,
28534 0x980000: 0x100,
28535 0xa80000: 0x4010000,
28536 0xb80000: 0x10104,
28537 0xc80000: 0x10100,
28538 0xd80000: 0x4000104,
28539 0xe80000: 0x4010104,
28540 0xf80000: 0x4000000,
28541 0x1000000: 0x4010100,
28542 0x1100000: 0x10004,
28543 0x1200000: 0x10000,
28544 0x1300000: 0x4000100,
28545 0x1400000: 0x100,
28546 0x1500000: 0x4010104,
28547 0x1600000: 0x4000004,
28548 0x1700000: 0x0,
28549 0x1800000: 0x4000104,
28550 0x1900000: 0x4000000,
28551 0x1a00000: 0x4,
28552 0x1b00000: 0x10100,
28553 0x1c00000: 0x4010000,
28554 0x1d00000: 0x104,
28555 0x1e00000: 0x10104,
28556 0x1f00000: 0x4010004,
28557 0x1080000: 0x4000000,
28558 0x1180000: 0x104,
28559 0x1280000: 0x4010100,
28560 0x1380000: 0x0,
28561 0x1480000: 0x10004,
28562 0x1580000: 0x4000100,
28563 0x1680000: 0x100,
28564 0x1780000: 0x4010004,
28565 0x1880000: 0x10000,
28566 0x1980000: 0x4010104,
28567 0x1a80000: 0x10104,
28568 0x1b80000: 0x4000004,
28569 0x1c80000: 0x4000104,
28570 0x1d80000: 0x4010000,
28571 0x1e80000: 0x4,
28572 0x1f80000: 0x10100
28573 },
28574 {
28575 0x0: 0x80401000,
28576 0x10000: 0x80001040,
28577 0x20000: 0x401040,
28578 0x30000: 0x80400000,
28579 0x40000: 0x0,
28580 0x50000: 0x401000,
28581 0x60000: 0x80000040,
28582 0x70000: 0x400040,
28583 0x80000: 0x80000000,
28584 0x90000: 0x400000,
28585 0xa0000: 0x40,
28586 0xb0000: 0x80001000,
28587 0xc0000: 0x80400040,
28588 0xd0000: 0x1040,
28589 0xe0000: 0x1000,
28590 0xf0000: 0x80401040,
28591 0x8000: 0x80001040,
28592 0x18000: 0x40,
28593 0x28000: 0x80400040,
28594 0x38000: 0x80001000,
28595 0x48000: 0x401000,
28596 0x58000: 0x80401040,
28597 0x68000: 0x0,
28598 0x78000: 0x80400000,
28599 0x88000: 0x1000,
28600 0x98000: 0x80401000,
28601 0xa8000: 0x400000,
28602 0xb8000: 0x1040,
28603 0xc8000: 0x80000000,
28604 0xd8000: 0x400040,
28605 0xe8000: 0x401040,
28606 0xf8000: 0x80000040,
28607 0x100000: 0x400040,
28608 0x110000: 0x401000,
28609 0x120000: 0x80000040,
28610 0x130000: 0x0,
28611 0x140000: 0x1040,
28612 0x150000: 0x80400040,
28613 0x160000: 0x80401000,
28614 0x170000: 0x80001040,
28615 0x180000: 0x80401040,
28616 0x190000: 0x80000000,
28617 0x1a0000: 0x80400000,
28618 0x1b0000: 0x401040,
28619 0x1c0000: 0x80001000,
28620 0x1d0000: 0x400000,
28621 0x1e0000: 0x40,
28622 0x1f0000: 0x1000,
28623 0x108000: 0x80400000,
28624 0x118000: 0x80401040,
28625 0x128000: 0x0,
28626 0x138000: 0x401000,
28627 0x148000: 0x400040,
28628 0x158000: 0x80000000,
28629 0x168000: 0x80001040,
28630 0x178000: 0x40,
28631 0x188000: 0x80000040,
28632 0x198000: 0x1000,
28633 0x1a8000: 0x80001000,
28634 0x1b8000: 0x80400040,
28635 0x1c8000: 0x1040,
28636 0x1d8000: 0x80401000,
28637 0x1e8000: 0x400000,
28638 0x1f8000: 0x401040
28639 },
28640 {
28641 0x0: 0x80,
28642 0x1000: 0x1040000,
28643 0x2000: 0x40000,
28644 0x3000: 0x20000000,
28645 0x4000: 0x20040080,
28646 0x5000: 0x1000080,
28647 0x6000: 0x21000080,
28648 0x7000: 0x40080,
28649 0x8000: 0x1000000,
28650 0x9000: 0x20040000,
28651 0xa000: 0x20000080,
28652 0xb000: 0x21040080,
28653 0xc000: 0x21040000,
28654 0xd000: 0x0,
28655 0xe000: 0x1040080,
28656 0xf000: 0x21000000,
28657 0x800: 0x1040080,
28658 0x1800: 0x21000080,
28659 0x2800: 0x80,
28660 0x3800: 0x1040000,
28661 0x4800: 0x40000,
28662 0x5800: 0x20040080,
28663 0x6800: 0x21040000,
28664 0x7800: 0x20000000,
28665 0x8800: 0x20040000,
28666 0x9800: 0x0,
28667 0xa800: 0x21040080,
28668 0xb800: 0x1000080,
28669 0xc800: 0x20000080,
28670 0xd800: 0x21000000,
28671 0xe800: 0x1000000,
28672 0xf800: 0x40080,
28673 0x10000: 0x40000,
28674 0x11000: 0x80,
28675 0x12000: 0x20000000,
28676 0x13000: 0x21000080,
28677 0x14000: 0x1000080,
28678 0x15000: 0x21040000,
28679 0x16000: 0x20040080,
28680 0x17000: 0x1000000,
28681 0x18000: 0x21040080,
28682 0x19000: 0x21000000,
28683 0x1a000: 0x1040000,
28684 0x1b000: 0x20040000,
28685 0x1c000: 0x40080,
28686 0x1d000: 0x20000080,
28687 0x1e000: 0x0,
28688 0x1f000: 0x1040080,
28689 0x10800: 0x21000080,
28690 0x11800: 0x1000000,
28691 0x12800: 0x1040000,
28692 0x13800: 0x20040080,
28693 0x14800: 0x20000000,
28694 0x15800: 0x1040080,
28695 0x16800: 0x80,
28696 0x17800: 0x21040000,
28697 0x18800: 0x40080,
28698 0x19800: 0x21040080,
28699 0x1a800: 0x0,
28700 0x1b800: 0x21000000,
28701 0x1c800: 0x1000080,
28702 0x1d800: 0x40000,
28703 0x1e800: 0x20040000,
28704 0x1f800: 0x20000080
28705 },
28706 {
28707 0x0: 0x10000008,
28708 0x100: 0x2000,
28709 0x200: 0x10200000,
28710 0x300: 0x10202008,
28711 0x400: 0x10002000,
28712 0x500: 0x200000,
28713 0x600: 0x200008,
28714 0x700: 0x10000000,
28715 0x800: 0x0,
28716 0x900: 0x10002008,
28717 0xa00: 0x202000,
28718 0xb00: 0x8,
28719 0xc00: 0x10200008,
28720 0xd00: 0x202008,
28721 0xe00: 0x2008,
28722 0xf00: 0x10202000,
28723 0x80: 0x10200000,
28724 0x180: 0x10202008,
28725 0x280: 0x8,
28726 0x380: 0x200000,
28727 0x480: 0x202008,
28728 0x580: 0x10000008,
28729 0x680: 0x10002000,
28730 0x780: 0x2008,
28731 0x880: 0x200008,
28732 0x980: 0x2000,
28733 0xa80: 0x10002008,
28734 0xb80: 0x10200008,
28735 0xc80: 0x0,
28736 0xd80: 0x10202000,
28737 0xe80: 0x202000,
28738 0xf80: 0x10000000,
28739 0x1000: 0x10002000,
28740 0x1100: 0x10200008,
28741 0x1200: 0x10202008,
28742 0x1300: 0x2008,
28743 0x1400: 0x200000,
28744 0x1500: 0x10000000,
28745 0x1600: 0x10000008,
28746 0x1700: 0x202000,
28747 0x1800: 0x202008,
28748 0x1900: 0x0,
28749 0x1a00: 0x8,
28750 0x1b00: 0x10200000,
28751 0x1c00: 0x2000,
28752 0x1d00: 0x10002008,
28753 0x1e00: 0x10202000,
28754 0x1f00: 0x200008,
28755 0x1080: 0x8,
28756 0x1180: 0x202000,
28757 0x1280: 0x200000,
28758 0x1380: 0x10000008,
28759 0x1480: 0x10002000,
28760 0x1580: 0x2008,
28761 0x1680: 0x10202008,
28762 0x1780: 0x10200000,
28763 0x1880: 0x10202000,
28764 0x1980: 0x10200008,
28765 0x1a80: 0x2000,
28766 0x1b80: 0x202008,
28767 0x1c80: 0x200008,
28768 0x1d80: 0x0,
28769 0x1e80: 0x10000000,
28770 0x1f80: 0x10002008
28771 },
28772 {
28773 0x0: 0x100000,
28774 0x10: 0x2000401,
28775 0x20: 0x400,
28776 0x30: 0x100401,
28777 0x40: 0x2100401,
28778 0x50: 0x0,
28779 0x60: 0x1,
28780 0x70: 0x2100001,
28781 0x80: 0x2000400,
28782 0x90: 0x100001,
28783 0xa0: 0x2000001,
28784 0xb0: 0x2100400,
28785 0xc0: 0x2100000,
28786 0xd0: 0x401,
28787 0xe0: 0x100400,
28788 0xf0: 0x2000000,
28789 0x8: 0x2100001,
28790 0x18: 0x0,
28791 0x28: 0x2000401,
28792 0x38: 0x2100400,
28793 0x48: 0x100000,
28794 0x58: 0x2000001,
28795 0x68: 0x2000000,
28796 0x78: 0x401,
28797 0x88: 0x100401,
28798 0x98: 0x2000400,
28799 0xa8: 0x2100000,
28800 0xb8: 0x100001,
28801 0xc8: 0x400,
28802 0xd8: 0x2100401,
28803 0xe8: 0x1,
28804 0xf8: 0x100400,
28805 0x100: 0x2000000,
28806 0x110: 0x100000,
28807 0x120: 0x2000401,
28808 0x130: 0x2100001,
28809 0x140: 0x100001,
28810 0x150: 0x2000400,
28811 0x160: 0x2100400,
28812 0x170: 0x100401,
28813 0x180: 0x401,
28814 0x190: 0x2100401,
28815 0x1a0: 0x100400,
28816 0x1b0: 0x1,
28817 0x1c0: 0x0,
28818 0x1d0: 0x2100000,
28819 0x1e0: 0x2000001,
28820 0x1f0: 0x400,
28821 0x108: 0x100400,
28822 0x118: 0x2000401,
28823 0x128: 0x2100001,
28824 0x138: 0x1,
28825 0x148: 0x2000000,
28826 0x158: 0x100000,
28827 0x168: 0x401,
28828 0x178: 0x2100400,
28829 0x188: 0x2000001,
28830 0x198: 0x2100000,
28831 0x1a8: 0x0,
28832 0x1b8: 0x2100401,
28833 0x1c8: 0x100401,
28834 0x1d8: 0x400,
28835 0x1e8: 0x2000400,
28836 0x1f8: 0x100001
28837 },
28838 {
28839 0x0: 0x8000820,
28840 0x1: 0x20000,
28841 0x2: 0x8000000,
28842 0x3: 0x20,
28843 0x4: 0x20020,
28844 0x5: 0x8020820,
28845 0x6: 0x8020800,
28846 0x7: 0x800,
28847 0x8: 0x8020000,
28848 0x9: 0x8000800,
28849 0xa: 0x20800,
28850 0xb: 0x8020020,
28851 0xc: 0x820,
28852 0xd: 0x0,
28853 0xe: 0x8000020,
28854 0xf: 0x20820,
28855 0x80000000: 0x800,
28856 0x80000001: 0x8020820,
28857 0x80000002: 0x8000820,
28858 0x80000003: 0x8000000,
28859 0x80000004: 0x8020000,
28860 0x80000005: 0x20800,
28861 0x80000006: 0x20820,
28862 0x80000007: 0x20,
28863 0x80000008: 0x8000020,
28864 0x80000009: 0x820,
28865 0x8000000a: 0x20020,
28866 0x8000000b: 0x8020800,
28867 0x8000000c: 0x0,
28868 0x8000000d: 0x8020020,
28869 0x8000000e: 0x8000800,
28870 0x8000000f: 0x20000,
28871 0x10: 0x20820,
28872 0x11: 0x8020800,
28873 0x12: 0x20,
28874 0x13: 0x800,
28875 0x14: 0x8000800,
28876 0x15: 0x8000020,
28877 0x16: 0x8020020,
28878 0x17: 0x20000,
28879 0x18: 0x0,
28880 0x19: 0x20020,
28881 0x1a: 0x8020000,
28882 0x1b: 0x8000820,
28883 0x1c: 0x8020820,
28884 0x1d: 0x20800,
28885 0x1e: 0x820,
28886 0x1f: 0x8000000,
28887 0x80000010: 0x20000,
28888 0x80000011: 0x800,
28889 0x80000012: 0x8020020,
28890 0x80000013: 0x20820,
28891 0x80000014: 0x20,
28892 0x80000015: 0x8020000,
28893 0x80000016: 0x8000000,
28894 0x80000017: 0x8000820,
28895 0x80000018: 0x8020820,
28896 0x80000019: 0x8000020,
28897 0x8000001a: 0x8000800,
28898 0x8000001b: 0x0,
28899 0x8000001c: 0x20800,
28900 0x8000001d: 0x820,
28901 0x8000001e: 0x20020,
28902 0x8000001f: 0x8020800
28903 }
28904 ];
28905
28906 // Masks that select the SBOX input
28907 var SBOX_MASK = [
28908 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
28909 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
28910 ];
28911
28912 /**
28913 * DES block cipher algorithm.
28914 */
28915 var DES = C_algo.DES = BlockCipher.extend({
28916 _doReset: function () {
28917 // Shortcuts
28918 var key = this._key;
28919 var keyWords = key.words;
28920
28921 // Select 56 bits according to PC1
28922 var keyBits = [];
28923 for (var i = 0; i < 56; i++) {
28924 var keyBitPos = PC1[i] - 1;
28925 keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
28926 }
28927
28928 // Assemble 16 subkeys
28929 var subKeys = this._subKeys = [];
28930 for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
28931 // Create subkey
28932 var subKey = subKeys[nSubKey] = [];
28933
28934 // Shortcut
28935 var bitShift = BIT_SHIFTS[nSubKey];
28936
28937 // Select 48 bits according to PC2
28938 for (var i = 0; i < 24; i++) {
28939 // Select from the left 28 key bits
28940 subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
28941
28942 // Select from the right 28 key bits
28943 subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
28944 }
28945
28946 // Since each subkey is applied to an expanded 32-bit input,
28947 // the subkey can be broken into 8 values scaled to 32-bits,
28948 // which allows the key to be used without expansion
28949 subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
28950 for (var i = 1; i < 7; i++) {
28951 subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
28952 }
28953 subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
28954 }
28955
28956 // Compute inverse subkeys
28957 var invSubKeys = this._invSubKeys = [];
28958 for (var i = 0; i < 16; i++) {
28959 invSubKeys[i] = subKeys[15 - i];
28960 }
28961 },
28962
28963 encryptBlock: function (M, offset) {
28964 this._doCryptBlock(M, offset, this._subKeys);
28965 },
28966
28967 decryptBlock: function (M, offset) {
28968 this._doCryptBlock(M, offset, this._invSubKeys);
28969 },
28970
28971 _doCryptBlock: function (M, offset, subKeys) {
28972 // Get input
28973 this._lBlock = M[offset];
28974 this._rBlock = M[offset + 1];
28975
28976 // Initial permutation
28977 exchangeLR.call(this, 4, 0x0f0f0f0f);
28978 exchangeLR.call(this, 16, 0x0000ffff);
28979 exchangeRL.call(this, 2, 0x33333333);
28980 exchangeRL.call(this, 8, 0x00ff00ff);
28981 exchangeLR.call(this, 1, 0x55555555);
28982
28983 // Rounds
28984 for (var round = 0; round < 16; round++) {
28985 // Shortcuts
28986 var subKey = subKeys[round];
28987 var lBlock = this._lBlock;
28988 var rBlock = this._rBlock;
28989
28990 // Feistel function
28991 var f = 0;
28992 for (var i = 0; i < 8; i++) {
28993 f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
28994 }
28995 this._lBlock = rBlock;
28996 this._rBlock = lBlock ^ f;
28997 }
28998
28999 // Undo swap from last round
29000 var t = this._lBlock;
29001 this._lBlock = this._rBlock;
29002 this._rBlock = t;
29003
29004 // Final permutation
29005 exchangeLR.call(this, 1, 0x55555555);
29006 exchangeRL.call(this, 8, 0x00ff00ff);
29007 exchangeRL.call(this, 2, 0x33333333);
29008 exchangeLR.call(this, 16, 0x0000ffff);
29009 exchangeLR.call(this, 4, 0x0f0f0f0f);
29010
29011 // Set output
29012 M[offset] = this._lBlock;
29013 M[offset + 1] = this._rBlock;
29014 },
29015
29016 keySize: 64/32,
29017
29018 ivSize: 64/32,
29019
29020 blockSize: 64/32
29021 });
29022
29023 // Swap bits across the left and right words
29024 function exchangeLR(offset, mask) {
29025 var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
29026 this._rBlock ^= t;
29027 this._lBlock ^= t << offset;
29028 }
29029
29030 function exchangeRL(offset, mask) {
29031 var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
29032 this._lBlock ^= t;
29033 this._rBlock ^= t << offset;
29034 }
29035
29036 /**
29037 * Shortcut functions to the cipher's object interface.
29038 *
29039 * @example
29040 *
29041 * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
29042 * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg);
29043 */
29044 C.DES = BlockCipher._createHelper(DES);
29045
29046 /**
29047 * Triple-DES block cipher algorithm.
29048 */
29049 var TripleDES = C_algo.TripleDES = BlockCipher.extend({
29050 _doReset: function () {
29051 // Shortcuts
29052 var key = this._key;
29053 var keyWords = key.words;
29054
29055 // Create DES instances
29056 this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2)));
29057 this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4)));
29058 this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6)));
29059 },
29060
29061 encryptBlock: function (M, offset) {
29062 this._des1.encryptBlock(M, offset);
29063 this._des2.decryptBlock(M, offset);
29064 this._des3.encryptBlock(M, offset);
29065 },
29066
29067 decryptBlock: function (M, offset) {
29068 this._des3.decryptBlock(M, offset);
29069 this._des2.encryptBlock(M, offset);
29070 this._des1.decryptBlock(M, offset);
29071 },
29072
29073 keySize: 192/32,
29074
29075 ivSize: 64/32,
29076
29077 blockSize: 64/32
29078 });
29079
29080 /**
29081 * Shortcut functions to the cipher's object interface.
29082 *
29083 * @example
29084 *
29085 * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
29086 * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
29087 */
29088 C.TripleDES = BlockCipher._createHelper(TripleDES);
29089 }());
29090
29091
29092 return CryptoJS.TripleDES;
29093
29094}));
29095},{"./cipher-core":30,"./core":31,"./enc-base64":32,"./evpkdf":34,"./md5":39}],62:[function(_dereq_,module,exports){
29096;(function (root, factory) {
29097 if (typeof exports === "object") {
29098 // CommonJS
29099 module.exports = exports = factory(_dereq_("./core"));
29100 }
29101 else if (typeof define === "function" && define.amd) {
29102 // AMD
29103 define(["./core"], factory);
29104 }
29105 else {
29106 // Global (browser)
29107 factory(root.CryptoJS);
29108 }
29109}(this, function (CryptoJS) {
29110
29111 (function (undefined) {
29112 // Shortcuts
29113 var C = CryptoJS;
29114 var C_lib = C.lib;
29115 var Base = C_lib.Base;
29116 var X32WordArray = C_lib.WordArray;
29117
29118 /**
29119 * x64 namespace.
29120 */
29121 var C_x64 = C.x64 = {};
29122
29123 /**
29124 * A 64-bit word.
29125 */
29126 var X64Word = C_x64.Word = Base.extend({
29127 /**
29128 * Initializes a newly created 64-bit word.
29129 *
29130 * @param {number} high The high 32 bits.
29131 * @param {number} low The low 32 bits.
29132 *
29133 * @example
29134 *
29135 * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
29136 */
29137 init: function (high, low) {
29138 this.high = high;
29139 this.low = low;
29140 }
29141
29142 /**
29143 * Bitwise NOTs this word.
29144 *
29145 * @return {X64Word} A new x64-Word object after negating.
29146 *
29147 * @example
29148 *
29149 * var negated = x64Word.not();
29150 */
29151 // not: function () {
29152 // var high = ~this.high;
29153 // var low = ~this.low;
29154
29155 // return X64Word.create(high, low);
29156 // },
29157
29158 /**
29159 * Bitwise ANDs this word with the passed word.
29160 *
29161 * @param {X64Word} word The x64-Word to AND with this word.
29162 *
29163 * @return {X64Word} A new x64-Word object after ANDing.
29164 *
29165 * @example
29166 *
29167 * var anded = x64Word.and(anotherX64Word);
29168 */
29169 // and: function (word) {
29170 // var high = this.high & word.high;
29171 // var low = this.low & word.low;
29172
29173 // return X64Word.create(high, low);
29174 // },
29175
29176 /**
29177 * Bitwise ORs this word with the passed word.
29178 *
29179 * @param {X64Word} word The x64-Word to OR with this word.
29180 *
29181 * @return {X64Word} A new x64-Word object after ORing.
29182 *
29183 * @example
29184 *
29185 * var ored = x64Word.or(anotherX64Word);
29186 */
29187 // or: function (word) {
29188 // var high = this.high | word.high;
29189 // var low = this.low | word.low;
29190
29191 // return X64Word.create(high, low);
29192 // },
29193
29194 /**
29195 * Bitwise XORs this word with the passed word.
29196 *
29197 * @param {X64Word} word The x64-Word to XOR with this word.
29198 *
29199 * @return {X64Word} A new x64-Word object after XORing.
29200 *
29201 * @example
29202 *
29203 * var xored = x64Word.xor(anotherX64Word);
29204 */
29205 // xor: function (word) {
29206 // var high = this.high ^ word.high;
29207 // var low = this.low ^ word.low;
29208
29209 // return X64Word.create(high, low);
29210 // },
29211
29212 /**
29213 * Shifts this word n bits to the left.
29214 *
29215 * @param {number} n The number of bits to shift.
29216 *
29217 * @return {X64Word} A new x64-Word object after shifting.
29218 *
29219 * @example
29220 *
29221 * var shifted = x64Word.shiftL(25);
29222 */
29223 // shiftL: function (n) {
29224 // if (n < 32) {
29225 // var high = (this.high << n) | (this.low >>> (32 - n));
29226 // var low = this.low << n;
29227 // } else {
29228 // var high = this.low << (n - 32);
29229 // var low = 0;
29230 // }
29231
29232 // return X64Word.create(high, low);
29233 // },
29234
29235 /**
29236 * Shifts this word n bits to the right.
29237 *
29238 * @param {number} n The number of bits to shift.
29239 *
29240 * @return {X64Word} A new x64-Word object after shifting.
29241 *
29242 * @example
29243 *
29244 * var shifted = x64Word.shiftR(7);
29245 */
29246 // shiftR: function (n) {
29247 // if (n < 32) {
29248 // var low = (this.low >>> n) | (this.high << (32 - n));
29249 // var high = this.high >>> n;
29250 // } else {
29251 // var low = this.high >>> (n - 32);
29252 // var high = 0;
29253 // }
29254
29255 // return X64Word.create(high, low);
29256 // },
29257
29258 /**
29259 * Rotates this word n bits to the left.
29260 *
29261 * @param {number} n The number of bits to rotate.
29262 *
29263 * @return {X64Word} A new x64-Word object after rotating.
29264 *
29265 * @example
29266 *
29267 * var rotated = x64Word.rotL(25);
29268 */
29269 // rotL: function (n) {
29270 // return this.shiftL(n).or(this.shiftR(64 - n));
29271 // },
29272
29273 /**
29274 * Rotates this word n bits to the right.
29275 *
29276 * @param {number} n The number of bits to rotate.
29277 *
29278 * @return {X64Word} A new x64-Word object after rotating.
29279 *
29280 * @example
29281 *
29282 * var rotated = x64Word.rotR(7);
29283 */
29284 // rotR: function (n) {
29285 // return this.shiftR(n).or(this.shiftL(64 - n));
29286 // },
29287
29288 /**
29289 * Adds this word with the passed word.
29290 *
29291 * @param {X64Word} word The x64-Word to add with this word.
29292 *
29293 * @return {X64Word} A new x64-Word object after adding.
29294 *
29295 * @example
29296 *
29297 * var added = x64Word.add(anotherX64Word);
29298 */
29299 // add: function (word) {
29300 // var low = (this.low + word.low) | 0;
29301 // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
29302 // var high = (this.high + word.high + carry) | 0;
29303
29304 // return X64Word.create(high, low);
29305 // }
29306 });
29307
29308 /**
29309 * An array of 64-bit words.
29310 *
29311 * @property {Array} words The array of CryptoJS.x64.Word objects.
29312 * @property {number} sigBytes The number of significant bytes in this word array.
29313 */
29314 var X64WordArray = C_x64.WordArray = Base.extend({
29315 /**
29316 * Initializes a newly created word array.
29317 *
29318 * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
29319 * @param {number} sigBytes (Optional) The number of significant bytes in the words.
29320 *
29321 * @example
29322 *
29323 * var wordArray = CryptoJS.x64.WordArray.create();
29324 *
29325 * var wordArray = CryptoJS.x64.WordArray.create([
29326 * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
29327 * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
29328 * ]);
29329 *
29330 * var wordArray = CryptoJS.x64.WordArray.create([
29331 * CryptoJS.x64.Word.create(0x00010203, 0x04050607),
29332 * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
29333 * ], 10);
29334 */
29335 init: function (words, sigBytes) {
29336 words = this.words = words || [];
29337
29338 if (sigBytes != undefined) {
29339 this.sigBytes = sigBytes;
29340 } else {
29341 this.sigBytes = words.length * 8;
29342 }
29343 },
29344
29345 /**
29346 * Converts this 64-bit word array to a 32-bit word array.
29347 *
29348 * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
29349 *
29350 * @example
29351 *
29352 * var x32WordArray = x64WordArray.toX32();
29353 */
29354 toX32: function () {
29355 // Shortcuts
29356 var x64Words = this.words;
29357 var x64WordsLength = x64Words.length;
29358
29359 // Convert
29360 var x32Words = [];
29361 for (var i = 0; i < x64WordsLength; i++) {
29362 var x64Word = x64Words[i];
29363 x32Words.push(x64Word.high);
29364 x32Words.push(x64Word.low);
29365 }
29366
29367 return X32WordArray.create(x32Words, this.sigBytes);
29368 },
29369
29370 /**
29371 * Creates a copy of this word array.
29372 *
29373 * @return {X64WordArray} The clone.
29374 *
29375 * @example
29376 *
29377 * var clone = x64WordArray.clone();
29378 */
29379 clone: function () {
29380 var clone = Base.clone.call(this);
29381
29382 // Clone "words" array
29383 var words = clone.words = this.words.slice(0);
29384
29385 // Clone each X64Word object
29386 var wordsLength = words.length;
29387 for (var i = 0; i < wordsLength; i++) {
29388 words[i] = words[i].clone();
29389 }
29390
29391 return clone;
29392 }
29393 });
29394 }());
29395
29396
29397 return CryptoJS;
29398
29399}));
29400},{"./core":31}],63:[function(_dereq_,module,exports){
29401var assert = _dereq_('assert')
29402var BigInteger = _dereq_('bigi')
29403
29404var Point = _dereq_('./point')
29405 9062
29406function Curve(p, a, b, Gx, Gy, n, h) { 9063function Curve(p, a, b, Gx, Gy, n, h) {
29407 this.p = p 9064 this.p = p
@@ -29419,7 +9076,7 @@ function Curve(p, a, b, Gx, Gy, n, h) {
29419 9076
29420Curve.prototype.pointFromX = function(isOdd, x) { 9077Curve.prototype.pointFromX = function(isOdd, x) {
29421 var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p) 9078 var alpha = x.pow(3).add(this.a.multiply(x)).add(this.b).mod(this.p)
29422 var beta = alpha.modPow(this.pOverFour, this.p) 9079 var beta = alpha.modPow(this.pOverFour, this.p) // XXX: not compatible with all curves
29423 9080
29424 var y = beta 9081 var y = beta
29425 if (beta.isEven() ^ !isOdd) { 9082 if (beta.isEven() ^ !isOdd) {
@@ -29473,7 +9130,7 @@ Curve.prototype.validate = function(Q) {
29473 9130
29474module.exports = Curve 9131module.exports = Curve
29475 9132
29476},{"./point":67,"assert":4,"bigi":3}],64:[function(_dereq_,module,exports){ 9133},{"./point":51,"assert":5,"bigi":3}],48:[function(require,module,exports){
29477module.exports={ 9134module.exports={
29478 "secp128r1": { 9135 "secp128r1": {
29479 "p": "fffffffdffffffffffffffffffffffff", 9136 "p": "fffffffdffffffffffffffffffffffff",
@@ -29520,15 +9177,6 @@ module.exports={
29520 "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012", 9177 "Gx": "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",
29521 "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811" 9178 "Gy": "07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
29522 }, 9179 },
29523 "secp224r1": {
29524 "p": "ffffffffffffffffffffffffffffffff000000000000000000000001",
29525 "a": "fffffffffffffffffffffffffffffffefffffffffffffffffffffffe",
29526 "b": "b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4",
29527 "n": "ffffffffffffffffffffffffffff16a2e0b8f03e13dd29455c5c2a3d",
29528 "h": "01",
29529 "Gx": "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21",
29530 "Gy": "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34"
29531 },
29532 "secp256k1": { 9180 "secp256k1": {
29533 "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", 9181 "p": "fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
29534 "a": "00", 9182 "a": "00",
@@ -29549,11 +9197,11 @@ module.exports={
29549 } 9197 }
29550} 9198}
29551 9199
29552},{}],65:[function(_dereq_,module,exports){ 9200},{}],49:[function(require,module,exports){
29553var Point = _dereq_('./point') 9201var Point = require('./point')
29554var Curve = _dereq_('./curve') 9202var Curve = require('./curve')
29555 9203
29556var getCurveByName = _dereq_('./names') 9204var getCurveByName = require('./names')
29557 9205
29558module.exports = { 9206module.exports = {
29559 Curve: Curve, 9207 Curve: Curve,
@@ -29561,11 +9209,11 @@ module.exports = {
29561 getCurveByName: getCurveByName 9209 getCurveByName: getCurveByName
29562} 9210}
29563 9211
29564},{"./curve":63,"./names":66,"./point":67}],66:[function(_dereq_,module,exports){ 9212},{"./curve":47,"./names":50,"./point":51}],50:[function(require,module,exports){
29565var BigInteger = _dereq_('bigi') 9213var BigInteger = require('bigi')
29566 9214
29567var curves = _dereq_('./curves') 9215var curves = require('./curves')
29568var Curve = _dereq_('./curve') 9216var Curve = require('./curve')
29569 9217
29570function getCurveByName(name) { 9218function getCurveByName(name) {
29571 var curve = curves[name] 9219 var curve = curves[name]
@@ -29584,10 +9232,10 @@ function getCurveByName(name) {
29584 9232
29585module.exports = getCurveByName 9233module.exports = getCurveByName
29586 9234
29587},{"./curve":63,"./curves":64,"bigi":3}],67:[function(_dereq_,module,exports){ 9235},{"./curve":47,"./curves":48,"bigi":3}],51:[function(require,module,exports){
29588(function (Buffer){ 9236(function (Buffer){
29589var assert = _dereq_('assert') 9237var assert = require('assert')
29590var BigInteger = _dereq_('bigi') 9238var BigInteger = require('bigi')
29591 9239
29592var THREE = BigInteger.valueOf(3) 9240var THREE = BigInteger.valueOf(3)
29593 9241
@@ -29814,8 +9462,8 @@ Point.decodeFrom = function(curve, buffer) {
29814 var type = buffer.readUInt8(0) 9462 var type = buffer.readUInt8(0)
29815 var compressed = (type !== 4) 9463 var compressed = (type !== 4)
29816 9464
29817 var x = BigInteger.fromBuffer(buffer.slice(1, 33))
29818 var byteLength = Math.floor((curve.p.bitLength() + 7) / 8) 9465 var byteLength = Math.floor((curve.p.bitLength() + 7) / 8)
9466 var x = BigInteger.fromBuffer(buffer.slice(1, 1 + byteLength))
29819 9467
29820 var Q 9468 var Q
29821 if (compressed) { 9469 if (compressed) {
@@ -29844,99 +9492,329 @@ Point.prototype.toString = function () {
29844 9492
29845module.exports = Point 9493module.exports = Point
29846 9494
29847}).call(this,_dereq_("buffer").Buffer) 9495}).call(this,require("buffer").Buffer)
29848},{"assert":4,"bigi":3,"buffer":8}],68:[function(_dereq_,module,exports){ 9496},{"assert":5,"bigi":3,"buffer":7}],52:[function(require,module,exports){
29849(function (process,Buffer){ 9497(function (process,global,Buffer){
29850// Closure compiler error - result of 'not' operator not being used 9498'use strict';
29851//!function(globals){
29852(function(globals){
29853'use strict'
29854 9499
29855//*** UMD BEGIN 9500var crypto = global.crypto || global.msCrypto
29856if (typeof define !== 'undefined' && define.amd) { //require.js / AMD 9501if(crypto && crypto.getRandomValues) {
29857 define([], function() { 9502 module.exports = randomBytes;
29858 return secureRandom 9503} else {
29859 }) 9504 module.exports = oldBrowser;
29860} else if (typeof module !== 'undefined' && module.exports) { //CommonJS 9505}
29861 module.exports = secureRandom 9506function randomBytes(size, cb) {
29862} else { //script / browser 9507 var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array
29863 globals.secureRandom = secureRandom 9508 /* This will not work in older browsers.
29864} 9509 * See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
29865//*** UMD END 9510 */
29866 9511
29867//options.type is the only valid option 9512 crypto.getRandomValues(bytes);
29868function secureRandom(count, options) { 9513 if (typeof cb === 'function') {
29869 options = options || {type: 'Array'} 9514 return process.nextTick(function () {
29870 //we check for process.pid to prevent browserify from tricking us 9515 cb(null, bytes);
29871 if (typeof process != 'undefined' && typeof process.pid == 'number') { 9516 });
29872 return nodeRandom(count, options)
29873 } else {
29874 var crypto = window.crypto || window.msCrypto
29875 if (!crypto) throw new Error("Your browser does not support window.crypto.")
29876 return browserRandom(count, options)
29877 } 9517 }
9518 return bytes;
9519}
9520function oldBrowser() {
9521 throw new Error(
9522 'secure random number generation not supported by this browser\n'+
9523 'use chrome, FireFox or Internet Explorer 11'
9524 )
29878} 9525}
29879 9526
29880function nodeRandom(count, options) { 9527}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
29881 var crypto = _dereq_('crypto') 9528},{"_process":14,"buffer":7}],53:[function(require,module,exports){
29882 var buf = crypto.randomBytes(count) 9529(function (Buffer){
9530'use strict';
29883 9531
29884 switch (options.type) { 9532function getFunctionName(fn) {
29885 case 'Array': 9533 return fn.name || fn.toString().match(/function (.*?)\s*\(/)[1];
29886 return [].slice.call(buf) 9534}
29887 case 'Buffer': 9535
29888 return buf 9536function getTypeTypeName(type) {
29889 case 'Uint8Array': 9537 if (nativeTypes.Function(type)) {
29890 var arr = new Uint8Array(count) 9538 type = type.toJSON ? type.toJSON() : getFunctionName(type);
29891 for (var i = 0; i < count; ++i) { arr[i] = buf.readUInt8(i) }
29892 return arr
29893 default:
29894 throw new Error(options.type + " is unsupported.")
29895 } 9539 }
9540 if (nativeTypes.Object(type)) return JSON.stringify(type);
9541
9542 return type;
29896} 9543}
29897 9544
29898function browserRandom(count, options) { 9545function getValueTypeName(value) {
29899 var nativeArr = new Uint8Array(count) 9546 if (nativeTypes.Null(value)) return '';
29900 var crypto = window.crypto || window.msCrypto
29901 crypto.getRandomValues(nativeArr)
29902 9547
29903 switch (options.type) { 9548 return getFunctionName(value.constructor);
29904 case 'Array': 9549}
29905 return [].slice.call(nativeArr) 9550
29906 case 'Buffer': 9551function tfErrorString(type, value) {
29907 try { var b = new Buffer(1) } catch(e) { throw new Error('Buffer not supported in this environment. Use Node.js or Browserify for browser support.')} 9552 var typeTypeName = getTypeTypeName(type);
29908 return new Buffer(nativeArr) 9553 var valueTypeName = getValueTypeName(value);
29909 case 'Uint8Array': 9554
29910 return nativeArr 9555 return 'Expected ' + typeTypeName + ', got ' + (valueTypeName && valueTypeName + ' ') + JSON.stringify(value);
29911 default: 9556}
29912 throw new Error(options.type + " is unsupported.") 9557
9558function tfPropertyErrorString(type, name, value) {
9559 return tfErrorString('property \"' + name + '\" of type ' + getTypeTypeName(type), value);
9560}
9561
9562var nativeTypes = {
9563 Array: (function (_Array) {
9564 function Array(_x) {
9565 return _Array.apply(this, arguments);
9566 }
9567
9568 Array.toString = function () {
9569 return _Array.toString();
9570 };
9571
9572 return Array;
9573 })(function (value) {
9574 return value !== null && value !== undefined && value.constructor === Array;
9575 }),
9576 Boolean: function Boolean(value) {
9577 return typeof value === 'boolean';
9578 },
9579 Buffer: (function (_Buffer) {
9580 function Buffer(_x2) {
9581 return _Buffer.apply(this, arguments);
9582 }
9583
9584 Buffer.toString = function () {
9585 return _Buffer.toString();
9586 };
9587
9588 return Buffer;
9589 })(function (value) {
9590 return Buffer.isBuffer(value);
9591 }),
9592 Function: function Function(value) {
9593 return typeof value === 'function';
9594 },
9595 Null: function Null(value) {
9596 return value === undefined || value === null;
9597 },
9598 Number: function Number(value) {
9599 return typeof value === 'number';
9600 },
9601 Object: function Object(value) {
9602 return typeof value === 'object';
9603 },
9604 String: function String(value) {
9605 return typeof value === 'string';
9606 },
9607 '': function _() {
9608 return true;
29913 } 9609 }
9610};
9611
9612function tJSON(type) {
9613 return type && type.toJSON ? type.toJSON() : type;
29914} 9614}
29915 9615
29916secureRandom.randomArray = function(byteCount) { 9616function sJSON(type) {
29917 return secureRandom(byteCount, {type: 'Array'}) 9617 var json = tJSON(type);
9618 return nativeTypes.Object(json) ? JSON.stringify(json) : json;
29918} 9619}
29919 9620
29920secureRandom.randomUint8Array = function(byteCount) { 9621var otherTypes = {
29921 return secureRandom(byteCount, {type: 'Uint8Array'}) 9622 arrayOf: function arrayOf(type) {
9623 function arrayOf(value, strict) {
9624 try {
9625 return nativeTypes.Array(value) && value.every(function (x) {
9626 return typeforce(type, x, strict);
9627 });
9628 } catch (e) {
9629 return false;
9630 }
9631 }
9632 arrayOf.toJSON = function () {
9633 return [tJSON(type)];
9634 };
9635
9636 return arrayOf;
9637 },
9638
9639 maybe: function maybe(type) {
9640 function maybe(value, strict) {
9641 return nativeTypes.Null(value) || typeforce(type, value, strict);
9642 }
9643 maybe.toJSON = function () {
9644 return '?' + sJSON(type);
9645 };
9646
9647 return maybe;
9648 },
9649
9650 object: function object(type) {
9651 function object(value, strict) {
9652 typeforce(nativeTypes.Object, value, strict);
9653
9654 var propertyName, propertyType, propertyValue;
9655
9656 try {
9657 for (propertyName in type) {
9658 propertyType = type[propertyName];
9659 propertyValue = value[propertyName];
9660
9661 typeforce(propertyType, propertyValue, strict);
9662 }
9663 } catch (e) {
9664 throw new TypeError(tfPropertyErrorString(propertyType, propertyName, propertyValue));
9665 }
9666
9667 if (strict) {
9668 for (propertyName in value) {
9669 if (type[propertyName]) continue;
9670
9671 throw new TypeError('Unexpected property "' + propertyName + '"');
9672 }
9673 }
9674
9675 return true;
9676 }
9677 object.toJSON = function () {
9678 return type;
9679 };
9680
9681 return object;
9682 },
9683
9684 oneOf: function oneOf() {
9685 for (var _len = arguments.length, types = Array(_len), _key = 0; _key < _len; _key++) {
9686 types[_key] = arguments[_key];
9687 }
9688
9689 function oneOf(value, strict) {
9690 return types.some(function (type) {
9691 try {
9692 return typeforce(type, value, strict);
9693 } catch (e) {
9694 return false;
9695 }
9696 });
9697 }
9698 oneOf.toJSON = function () {
9699 return types.map(sJSON).join('|');
9700 };
9701
9702 return oneOf;
9703 },
9704
9705 quacksLike: function quacksLike(type) {
9706 function quacksLike(value, strict) {
9707 return type === getValueTypeName(value);
9708 }
9709 quacksLike.toJSON = function () {
9710 return type;
9711 };
9712
9713 return quacksLike;
9714 },
9715
9716 tuple: function tuple() {
9717 for (var _len2 = arguments.length, types = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
9718 types[_key2] = arguments[_key2];
9719 }
9720
9721 function tuple(value, strict) {
9722 return types.every(function (type, i) {
9723 return typeforce(type, value[i], strict);
9724 });
9725 }
9726 tuple.toJSON = function () {
9727 return '(' + types.map(sJSON).join(', ') + ')';
9728 };
9729
9730 return tuple;
9731 },
9732
9733 value: function value(expected) {
9734 function value(actual) {
9735 return actual === expected;
9736 }
9737 value.toJSON = function () {
9738 return expected;
9739 };
9740
9741 return value;
9742 }
9743};
9744
9745function compile(type) {
9746 if (nativeTypes.String(type)) {
9747 if (type[0] === '?') return otherTypes.maybe(compile(type.slice(1)));
9748
9749 return nativeTypes[type] || otherTypes.quacksLike(type);
9750 } else if (type && nativeTypes.Object(type)) {
9751 if (nativeTypes.Array(type)) return otherTypes.arrayOf(compile(type[0]));
9752
9753 var compiled = {};
9754
9755 for (var propertyName in type) {
9756 compiled[propertyName] = compile(type[propertyName]);
9757 }
9758
9759 return otherTypes.object(compiled);
9760 } else if (nativeTypes.Function(type)) {
9761 return type;
9762 }
9763
9764 return otherTypes.value(type);
29922} 9765}
29923 9766
29924secureRandom.randomBuffer = function(byteCount) { 9767function typeforce(_x3, _x4, _x5) {
29925 return secureRandom(byteCount, {type: 'Buffer'}) 9768 var _again = true;
9769
9770 _function: while (_again) {
9771 var type = _x3,
9772 value = _x4,
9773 strict = _x5;
9774 _again = false;
9775
9776 if (nativeTypes.Function(type)) {
9777 if (type(value, strict)) return true;
9778
9779 throw new TypeError(tfErrorString(type, value));
9780 }
9781
9782 // JIT
9783 _x3 = compile(type);
9784 _x4 = value;
9785 _x5 = strict;
9786 _again = true;
9787 continue _function;
9788 }
29926} 9789}
29927 9790
9791// assign all types to typeforce function
9792var typeName;
9793Object.keys(nativeTypes).forEach(function (typeName) {
9794 var nativeType = nativeTypes[typeName];
9795 nativeType.toJSON = function () {
9796 return typeName;
9797 };
9798
9799 typeforce[typeName] = nativeType;
9800});
29928 9801
29929})(this); 9802for (typeName in otherTypes) {
9803 typeforce[typeName] = otherTypes[typeName];
9804}
29930 9805
29931}).call(this,_dereq_("FWaASH"),_dereq_("buffer").Buffer) 9806module.exports = typeforce;
29932},{"FWaASH":12,"buffer":8,"crypto":7}],69:[function(_dereq_,module,exports){ 9807module.exports.compile = compile;
9808}).call(this,require("buffer").Buffer)
9809},{"buffer":7}],54:[function(require,module,exports){
29933(function (Buffer){ 9810(function (Buffer){
29934var assert = _dereq_('assert') 9811var assert = require('assert')
29935var base58check = _dereq_('./base58check') 9812var base58check = require('bs58check')
29936var networks = _dereq_('./networks') 9813var typeForce = require('typeforce')
29937var scripts = _dereq_('./scripts') 9814var networks = require('./networks')
9815var scripts = require('./scripts')
29938 9816
29939function findScriptTypeByVersion(version) { 9817function findScriptTypeByVersion (version) {
29940 for (var networkName in networks) { 9818 for (var networkName in networks) {
29941 var network = networks[networkName] 9819 var network = networks[networkName]
29942 9820
@@ -29945,8 +9823,9 @@ function findScriptTypeByVersion(version) {
29945 } 9823 }
29946} 9824}
29947 9825
29948function Address(hash, version) { 9826function Address (hash, version) {
29949 assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) 9827 typeForce('Buffer', hash)
9828
29950 assert.strictEqual(hash.length, 20, 'Invalid hash length') 9829 assert.strictEqual(hash.length, 20, 'Invalid hash length')
29951 assert.strictEqual(version & 0xff, version, 'Invalid version byte') 9830 assert.strictEqual(version & 0xff, version, 'Invalid version byte')
29952 9831
@@ -29954,8 +9833,7 @@ function Address(hash, version) {
29954 this.version = version 9833 this.version = version
29955} 9834}
29956 9835
29957// Import functions 9836Address.fromBase58Check = function (string) {
29958Address.fromBase58Check = function(string) {
29959 var payload = base58check.decode(string) 9837 var payload = base58check.decode(string)
29960 var version = payload.readUInt8(0) 9838 var version = payload.readUInt8(0)
29961 var hash = payload.slice(1) 9839 var hash = payload.slice(1)
@@ -29963,18 +9841,15 @@ Address.fromBase58Check = function(string) {
29963 return new Address(hash, version) 9841 return new Address(hash, version)
29964} 9842}
29965 9843
29966Address.fromOutputScript = function(script, network) { 9844Address.fromOutputScript = function (script, network) {
29967 network = network || networks.bitcoin 9845 network = network || networks.bitcoin
29968 9846
29969 var type = scripts.classifyOutput(script) 9847 if (scripts.isPubKeyHashOutput(script)) return new Address(script.chunks[2], network.pubKeyHash)
29970 9848 if (scripts.isScriptHashOutput(script)) return new Address(script.chunks[1], network.scriptHash)
29971 if (type === 'pubkeyhash') return new Address(script.chunks[2], network.pubKeyHash)
29972 if (type === 'scripthash') return new Address(script.chunks[1], network.scriptHash)
29973 9849
29974 assert(false, type + ' has no matching Address') 9850 assert(false, script.toASM() + ' has no matching Address')
29975} 9851}
29976 9852
29977// Export functions
29978Address.prototype.toBase58Check = function () { 9853Address.prototype.toBase58Check = function () {
29979 var payload = new Buffer(21) 9854 var payload = new Buffer(21)
29980 payload.writeUInt8(this.version, 0) 9855 payload.writeUInt8(this.version, 0)
@@ -29983,7 +9858,7 @@ Address.prototype.toBase58Check = function () {
29983 return base58check.encode(payload) 9858 return base58check.encode(payload)
29984} 9859}
29985 9860
29986Address.prototype.toOutputScript = function() { 9861Address.prototype.toOutputScript = function () {
29987 var scriptType = findScriptTypeByVersion(this.version) 9862 var scriptType = findScriptTypeByVersion(this.version)
29988 9863
29989 if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash) 9864 if (scriptType === 'pubkeyhash') return scripts.pubKeyHashOutput(this.hash)
@@ -29996,63 +9871,172 @@ Address.prototype.toString = Address.prototype.toBase58Check
29996 9871
29997module.exports = Address 9872module.exports = Address
29998 9873
29999}).call(this,_dereq_("buffer").Buffer) 9874}).call(this,require("buffer").Buffer)
30000},{"./base58check":70,"./networks":81,"./scripts":84,"assert":4,"buffer":8}],70:[function(_dereq_,module,exports){ 9875},{"./networks":66,"./scripts":69,"assert":5,"bs58check":31,"buffer":7,"typeforce":53}],55:[function(require,module,exports){
9876var bs58check = require('bs58check')
9877
9878function decode () {
9879 console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.')
9880
9881 return bs58check.decode.apply(undefined, arguments)
9882}
9883
9884function encode () {
9885 console.warn('bs58check will be removed in 2.0.0. require("bs58check") instead.')
9886
9887 return bs58check.encode.apply(undefined, arguments)
9888}
9889
9890module.exports = {
9891 decode: decode,
9892 encode: encode
9893}
9894
9895},{"bs58check":31}],56:[function(require,module,exports){
30001(function (Buffer){ 9896(function (Buffer){
30002// https://en.bitcoin.it/wiki/Base58Check_encoding 9897var assert = require('assert')
30003var assert = _dereq_('assert') 9898var bufferutils = require('./bufferutils')
30004var base58 = _dereq_('bs58') 9899var crypto = require('./crypto')
30005var crypto = _dereq_('./crypto')
30006 9900
30007// Encode a buffer as a base58-check-encoded string 9901var Transaction = require('./transaction')
30008function encode(payload) {
30009 var checksum = crypto.hash256(payload).slice(0, 4)
30010 9902
30011 return base58.encode(Buffer.concat([ 9903function Block () {
30012 payload, 9904 this.version = 1
30013 checksum 9905 this.prevHash = null
30014 ])) 9906 this.merkleRoot = null
9907 this.timestamp = 0
9908 this.bits = 0
9909 this.nonce = 0
30015} 9910}
30016 9911
30017// Decode a base58-check-encoded string to a buffer 9912Block.fromBuffer = function (buffer) {
30018function decode(string) { 9913 assert(buffer.length >= 80, 'Buffer too small (< 80 bytes)')
30019 var buffer = base58.decode(string)
30020 9914
30021 var payload = buffer.slice(0, -4) 9915 var offset = 0
30022 var checksum = buffer.slice(-4) 9916 function readSlice (n) {
30023 var newChecksum = crypto.hash256(payload).slice(0, 4) 9917 offset += n
9918 return buffer.slice(offset - n, offset)
9919 }
30024 9920
30025 assert.deepEqual(newChecksum, checksum, 'Invalid checksum') 9921 function readUInt32 () {
9922 var i = buffer.readUInt32LE(offset)
9923 offset += 4
9924 return i
9925 }
30026 9926
30027 return payload 9927 var block = new Block()
9928 block.version = readUInt32()
9929 block.prevHash = readSlice(32)
9930 block.merkleRoot = readSlice(32)
9931 block.timestamp = readUInt32()
9932 block.bits = readUInt32()
9933 block.nonce = readUInt32()
9934
9935 if (buffer.length === 80) return block
9936
9937 function readVarInt () {
9938 var vi = bufferutils.readVarInt(buffer, offset)
9939 offset += vi.size
9940 return vi.number
9941 }
9942
9943 // FIXME: poor performance
9944 function readTransaction () {
9945 var tx = Transaction.fromBuffer(buffer.slice(offset), true)
9946
9947 offset += tx.toBuffer().length
9948 return tx
9949 }
9950
9951 var nTransactions = readVarInt()
9952 block.transactions = []
9953
9954 for (var i = 0; i < nTransactions; ++i) {
9955 var tx = readTransaction()
9956 block.transactions.push(tx)
9957 }
9958
9959 return block
30028} 9960}
30029 9961
30030module.exports = { 9962Block.fromHex = function (hex) {
30031 encode: encode, 9963 return Block.fromBuffer(new Buffer(hex, 'hex'))
30032 decode: decode
30033} 9964}
30034 9965
30035}).call(this,_dereq_("buffer").Buffer) 9966Block.prototype.getHash = function () {
30036},{"./crypto":73,"assert":4,"bs58":15,"buffer":8}],71:[function(_dereq_,module,exports){ 9967 return crypto.hash256(this.toBuffer(true))
30037var assert = _dereq_('assert') 9968}
30038var opcodes = _dereq_('./opcodes') 9969
9970Block.prototype.getId = function () {
9971 return bufferutils.reverse(this.getHash()).toString('hex')
9972}
9973
9974Block.prototype.getUTCDate = function () {
9975 var date = new Date(0) // epoch
9976 date.setUTCSeconds(this.timestamp)
9977
9978 return date
9979}
9980
9981Block.prototype.toBuffer = function (headersOnly) {
9982 var buffer = new Buffer(80)
9983
9984 var offset = 0
9985 function writeSlice (slice) {
9986 slice.copy(buffer, offset)
9987 offset += slice.length
9988 }
9989
9990 function writeUInt32 (i) {
9991 buffer.writeUInt32LE(i, offset)
9992 offset += 4
9993 }
9994
9995 writeUInt32(this.version)
9996 writeSlice(this.prevHash)
9997 writeSlice(this.merkleRoot)
9998 writeUInt32(this.timestamp)
9999 writeUInt32(this.bits)
10000 writeUInt32(this.nonce)
10001
10002 if (headersOnly || !this.transactions) return buffer
10003
10004 var txLenBuffer = bufferutils.varIntBuffer(this.transactions.length)
10005 var txBuffers = this.transactions.map(function (tx) {
10006 return tx.toBuffer()
10007 })
10008
10009 return Buffer.concat([buffer, txLenBuffer].concat(txBuffers))
10010}
10011
10012Block.prototype.toHex = function (headersOnly) {
10013 return this.toBuffer(headersOnly).toString('hex')
10014}
10015
10016module.exports = Block
10017
10018}).call(this,require("buffer").Buffer)
10019},{"./bufferutils":57,"./crypto":58,"./transaction":70,"assert":5,"buffer":7}],57:[function(require,module,exports){
10020(function (Buffer){
10021var assert = require('assert')
10022var opcodes = require('./opcodes')
30039 10023
30040// https://github.com/feross/buffer/blob/master/index.js#L1127 10024// https://github.com/feross/buffer/blob/master/index.js#L1127
30041function verifuint(value, max) { 10025function verifuint (value, max) {
30042 assert(typeof value === 'number', 'cannot write a non-number as a number') 10026 assert(typeof value === 'number', 'cannot write a non-number as a number')
30043 assert(value >= 0, 'specified a negative value for writing an unsigned value') 10027 assert(value >= 0, 'specified a negative value for writing an unsigned value')
30044 assert(value <= max, 'value is larger than maximum value for type') 10028 assert(value <= max, 'value is larger than maximum value for type')
30045 assert(Math.floor(value) === value, 'value has a fractional component') 10029 assert(Math.floor(value) === value, 'value has a fractional component')
30046} 10030}
30047 10031
30048function pushDataSize(i) { 10032function pushDataSize (i) {
30049 return i < opcodes.OP_PUSHDATA1 ? 1 10033 return i < opcodes.OP_PUSHDATA1 ? 1
30050 : i < 0xff ? 2 10034 : i < 0xff ? 2
30051 : i < 0xffff ? 3 10035 : i < 0xffff ? 3
30052 : 5 10036 : 5
30053} 10037}
30054 10038
30055function readPushDataInt(buffer, offset) { 10039function readPushDataInt (buffer, offset) {
30056 var opcode = buffer.readUInt8(offset) 10040 var opcode = buffer.readUInt8(offset)
30057 var number, size 10041 var number, size
30058 10042
@@ -30063,21 +10047,23 @@ function readPushDataInt(buffer, offset) {
30063 10047
30064 // 8 bit 10048 // 8 bit
30065 } else if (opcode === opcodes.OP_PUSHDATA1) { 10049 } else if (opcode === opcodes.OP_PUSHDATA1) {
10050 if (offset + 2 > buffer.length) return null
30066 number = buffer.readUInt8(offset + 1) 10051 number = buffer.readUInt8(offset + 1)
30067 size = 2 10052 size = 2
30068 10053
30069 // 16 bit 10054 // 16 bit
30070 } else if (opcode === opcodes.OP_PUSHDATA2) { 10055 } else if (opcode === opcodes.OP_PUSHDATA2) {
10056 if (offset + 3 > buffer.length) return null
30071 number = buffer.readUInt16LE(offset + 1) 10057 number = buffer.readUInt16LE(offset + 1)
30072 size = 3 10058 size = 3
30073 10059
30074 // 32 bit 10060 // 32 bit
30075 } else { 10061 } else {
10062 if (offset + 5 > buffer.length) return null
30076 assert.equal(opcode, opcodes.OP_PUSHDATA4, 'Unexpected opcode') 10063 assert.equal(opcode, opcodes.OP_PUSHDATA4, 'Unexpected opcode')
30077 10064
30078 number = buffer.readUInt32LE(offset + 1) 10065 number = buffer.readUInt32LE(offset + 1)
30079 size = 5 10066 size = 5
30080
30081 } 10067 }
30082 10068
30083 return { 10069 return {
@@ -30087,7 +10073,7 @@ function readPushDataInt(buffer, offset) {
30087 } 10073 }
30088} 10074}
30089 10075
30090function readUInt64LE(buffer, offset) { 10076function readUInt64LE (buffer, offset) {
30091 var a = buffer.readUInt32LE(offset) 10077 var a = buffer.readUInt32LE(offset)
30092 var b = buffer.readUInt32LE(offset + 4) 10078 var b = buffer.readUInt32LE(offset + 4)
30093 b *= 0x100000000 10079 b *= 0x100000000
@@ -30097,7 +10083,7 @@ function readUInt64LE(buffer, offset) {
30097 return b + a 10083 return b + a
30098} 10084}
30099 10085
30100function readVarInt(buffer, offset) { 10086function readVarInt (buffer, offset) {
30101 var t = buffer.readUInt8(offset) 10087 var t = buffer.readUInt8(offset)
30102 var number, size 10088 var number, size
30103 10089
@@ -30128,7 +10114,7 @@ function readVarInt(buffer, offset) {
30128 } 10114 }
30129} 10115}
30130 10116
30131function writePushDataInt(buffer, number, offset) { 10117function writePushDataInt (buffer, number, offset) {
30132 var size = pushDataSize(number) 10118 var size = pushDataSize(number)
30133 10119
30134 // ~6 bit 10120 // ~6 bit
@@ -30149,27 +10135,26 @@ function writePushDataInt(buffer, number, offset) {
30149 } else { 10135 } else {
30150 buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset) 10136 buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset)
30151 buffer.writeUInt32LE(number, offset + 1) 10137 buffer.writeUInt32LE(number, offset + 1)
30152
30153 } 10138 }
30154 10139
30155 return size 10140 return size
30156} 10141}
30157 10142
30158function writeUInt64LE(buffer, value, offset) { 10143function writeUInt64LE (buffer, value, offset) {
30159 verifuint(value, 0x001fffffffffffff) 10144 verifuint(value, 0x001fffffffffffff)
30160 10145
30161 buffer.writeInt32LE(value & -1, offset) 10146 buffer.writeInt32LE(value & -1, offset)
30162 buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4) 10147 buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4)
30163} 10148}
30164 10149
30165function varIntSize(i) { 10150function varIntSize (i) {
30166 return i < 253 ? 1 10151 return i < 253 ? 1
30167 : i < 0x10000 ? 3 10152 : i < 0x10000 ? 3
30168 : i < 0x100000000 ? 5 10153 : i < 0x100000000 ? 5
30169 : 9 10154 : 9
30170} 10155}
30171 10156
30172function writeVarInt(buffer, number, offset) { 10157function writeVarInt (buffer, number, offset) {
30173 var size = varIntSize(number) 10158 var size = varIntSize(number)
30174 10159
30175 // 8 bit 10160 // 8 bit
@@ -30195,96 +10180,68 @@ function writeVarInt(buffer, number, offset) {
30195 return size 10180 return size
30196} 10181}
30197 10182
10183function varIntBuffer (i) {
10184 var size = varIntSize(i)
10185 var buffer = new Buffer(size)
10186 writeVarInt(buffer, i, 0)
10187
10188 return buffer
10189}
10190
10191function reverse (buffer) {
10192 var buffer2 = new Buffer(buffer)
10193 Array.prototype.reverse.call(buffer2)
10194 return buffer2
10195}
10196
30198module.exports = { 10197module.exports = {
30199 pushDataSize: pushDataSize, 10198 pushDataSize: pushDataSize,
30200 readPushDataInt: readPushDataInt, 10199 readPushDataInt: readPushDataInt,
30201 readUInt64LE: readUInt64LE, 10200 readUInt64LE: readUInt64LE,
30202 readVarInt: readVarInt, 10201 readVarInt: readVarInt,
10202 reverse: reverse,
10203 varIntBuffer: varIntBuffer,
30203 varIntSize: varIntSize, 10204 varIntSize: varIntSize,
30204 writePushDataInt: writePushDataInt, 10205 writePushDataInt: writePushDataInt,
30205 writeUInt64LE: writeUInt64LE, 10206 writeUInt64LE: writeUInt64LE,
30206 writeVarInt: writeVarInt 10207 writeVarInt: writeVarInt
30207} 10208}
30208 10209
30209},{"./opcodes":82,"assert":4}],72:[function(_dereq_,module,exports){ 10210}).call(this,require("buffer").Buffer)
30210(function (Buffer){ 10211},{"./opcodes":67,"assert":5,"buffer":7}],58:[function(require,module,exports){
30211var assert = _dereq_('assert') 10212var createHash = require('create-hash')
30212var Crypto = _dereq_('crypto-js')
30213var WordArray = Crypto.lib.WordArray
30214
30215function bufferToWordArray(buffer) {
30216 assert(Buffer.isBuffer(buffer), 'Expected Buffer, got', buffer)
30217
30218 var words = []
30219 for (var i = 0, b = 0; i < buffer.length; i++, b += 8) {
30220 words[b >>> 5] |= buffer[i] << (24 - b % 32)
30221 }
30222
30223 return new WordArray.init(words, buffer.length)
30224}
30225
30226function wordArrayToBuffer(wordArray) {
30227 assert(Array.isArray(wordArray.words), 'Expected WordArray, got' + wordArray)
30228 10213
30229 var words = wordArray.words 10214function hash160 (buffer) {
30230 var buffer = new Buffer(words.length * 4)
30231
30232 words.forEach(function(value, i) {
30233 buffer.writeInt32BE(value & -1, i * 4)
30234 })
30235
30236 return buffer
30237}
30238
30239module.exports = {
30240 bufferToWordArray: bufferToWordArray,
30241 wordArrayToBuffer: wordArrayToBuffer
30242}
30243
30244}).call(this,_dereq_("buffer").Buffer)
30245},{"assert":4,"buffer":8,"crypto-js":37}],73:[function(_dereq_,module,exports){
30246(function (Buffer){
30247// Crypto, crypto, where art thou crypto
30248var assert = _dereq_('assert')
30249var CryptoJS = _dereq_('crypto-js')
30250var crypto = _dereq_('crypto')
30251var convert = _dereq_('./convert')
30252
30253function hash160(buffer) {
30254 return ripemd160(sha256(buffer)) 10215 return ripemd160(sha256(buffer))
30255} 10216}
30256 10217
30257function hash256(buffer) { 10218function hash256 (buffer) {
30258 return sha256(sha256(buffer)) 10219 return sha256(sha256(buffer))
30259} 10220}
30260 10221
30261function ripemd160(buffer) { 10222function ripemd160 (buffer) {
30262 return crypto.createHash('rmd160').update(buffer).digest() 10223 return createHash('rmd160').update(buffer).digest()
30263} 10224}
30264 10225
30265function sha1(buffer) { 10226function sha1 (buffer) {
30266 return crypto.createHash('sha1').update(buffer).digest() 10227 return createHash('sha1').update(buffer).digest()
30267} 10228}
30268 10229
30269function sha256(buffer) { 10230function sha256 (buffer) {
30270 return crypto.createHash('sha256').update(buffer).digest() 10231 return createHash('sha256').update(buffer).digest()
30271} 10232}
30272 10233
30273// FIXME: Name not consistent with others 10234// FIXME: Name not consistent with others
30274function HmacSHA256(buffer, secret) { 10235var createHmac = require('create-hmac')
30275 return crypto.createHmac('sha256', secret).update(buffer).digest()
30276}
30277 10236
30278function HmacSHA512(data, secret) { 10237function HmacSHA256 (buffer, secret) {
30279 assert(Buffer.isBuffer(data), 'Expected Buffer for data, got ' + data) 10238 console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')
30280 assert(Buffer.isBuffer(secret), 'Expected Buffer for secret, got ' + secret) 10239 return createHmac('sha256', secret).update(buffer).digest()
30281 10240}
30282 var dataWords = convert.bufferToWordArray(data)
30283 var secretWords = convert.bufferToWordArray(secret)
30284
30285 var hash = CryptoJS.HmacSHA512(dataWords, secretWords)
30286 10241
30287 return convert.wordArrayToBuffer(hash) 10242function HmacSHA512 (buffer, secret) {
10243 console.warn('Hmac* functions are deprecated for removal in 2.0.0, use node crypto instead')
10244 return createHmac('sha512', secret).update(buffer).digest()
30288} 10245}
30289 10246
30290module.exports = { 10247module.exports = {
@@ -30297,26 +10254,59 @@ module.exports = {
30297 HmacSHA512: HmacSHA512 10254 HmacSHA512: HmacSHA512
30298} 10255}
30299 10256
30300}).call(this,_dereq_("buffer").Buffer) 10257},{"create-hash":32,"create-hmac":45}],59:[function(require,module,exports){
30301},{"./convert":72,"assert":4,"buffer":8,"crypto":19,"crypto-js":37}],74:[function(_dereq_,module,exports){
30302(function (Buffer){ 10258(function (Buffer){
30303var assert = _dereq_('assert') 10259var assert = require('assert')
30304var crypto = _dereq_('./crypto') 10260var createHmac = require('create-hmac')
10261var typeForce = require('typeforce')
30305 10262
30306var BigInteger = _dereq_('bigi') 10263var BigInteger = require('bigi')
30307var ECSignature = _dereq_('./ecsignature') 10264var ECSignature = require('./ecsignature')
30308var Point = _dereq_('ecurve').Point 10265
10266var ZERO = new Buffer([0])
10267var ONE = new Buffer([1])
30309 10268
30310// https://tools.ietf.org/html/rfc6979#section-3.2 10269// https://tools.ietf.org/html/rfc6979#section-3.2
30311function deterministicGenerateK(curve, hash, d) { 10270function deterministicGenerateK (curve, hash, d, checkSig) {
30312 assert(Buffer.isBuffer(hash), 'Hash must be a Buffer, not ' + hash) 10271 typeForce('Buffer', hash)
10272 typeForce('BigInteger', d)
10273
10274 // FIXME: remove/uncomment for 2.0.0
10275 // typeForce('Function', checkSig)
10276
10277 if (typeof checkSig !== 'function') {
10278 console.warn('deterministicGenerateK requires a checkSig callback in 2.0.0, see #337 for more information')
10279
10280 checkSig = function (k) {
10281 var G = curve.G
10282 var n = curve.n
10283 var e = BigInteger.fromBuffer(hash)
10284
10285 var Q = G.multiply(k)
10286
10287 if (curve.isInfinity(Q))
10288 return false
10289
10290 var r = Q.affineX.mod(n)
10291 if (r.signum() === 0)
10292 return false
10293
10294 var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)
10295 if (s.signum() === 0)
10296 return false
10297
10298 return true
10299 }
10300 }
10301
10302 // sanity check
30313 assert.equal(hash.length, 32, 'Hash must be 256 bit') 10303 assert.equal(hash.length, 32, 'Hash must be 256 bit')
30314 assert(d instanceof BigInteger, 'Private key must be a BigInteger')
30315 10304
30316 var x = d.toBuffer(32) 10305 var x = d.toBuffer(32)
30317 var k = new Buffer(32) 10306 var k = new Buffer(32)
30318 var v = new Buffer(32) 10307 var v = new Buffer(32)
30319 10308
10309 // Step A, ignored as hash already provided
30320 // Step B 10310 // Step B
30321 v.fill(1) 10311 v.fill(1)
30322 10312
@@ -30324,47 +10314,74 @@ function deterministicGenerateK(curve, hash, d) {
30324 k.fill(0) 10314 k.fill(0)
30325 10315
30326 // Step D 10316 // Step D
30327 k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0]), x, hash]), k) 10317 k = createHmac('sha256', k)
10318 .update(v)
10319 .update(ZERO)
10320 .update(x)
10321 .update(hash)
10322 .digest()
30328 10323
30329 // Step E 10324 // Step E
30330 v = crypto.HmacSHA256(v, k) 10325 v = createHmac('sha256', k).update(v).digest()
30331 10326
30332 // Step F 10327 // Step F
30333 k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([1]), x, hash]), k) 10328 k = createHmac('sha256', k)
10329 .update(v)
10330 .update(ONE)
10331 .update(x)
10332 .update(hash)
10333 .digest()
30334 10334
30335 // Step G 10335 // Step G
30336 v = crypto.HmacSHA256(v, k) 10336 v = createHmac('sha256', k).update(v).digest()
30337 10337
30338 // Step H1/H2a, ignored as tlen === qlen (256 bit) 10338 // Step H1/H2a, ignored as tlen === qlen (256 bit)
30339 // Step H2b 10339 // Step H2b
30340 v = crypto.HmacSHA256(v, k) 10340 v = createHmac('sha256', k).update(v).digest()
30341 10341
30342 var T = BigInteger.fromBuffer(v) 10342 var T = BigInteger.fromBuffer(v)
30343 10343
30344 // Step H3, repeat until T is within the interval [1, n - 1] 10344 // Step H3, repeat until T is within the interval [1, n - 1] and is suitable for ECDSA
30345 while ((T.signum() <= 0) || (T.compareTo(curve.n) >= 0)) { 10345 while ((T.signum() <= 0) || (T.compareTo(curve.n) >= 0) || !checkSig(T)) {
30346 k = crypto.HmacSHA256(Buffer.concat([v, new Buffer([0])]), k) 10346 k = createHmac('sha256', k)
30347 v = crypto.HmacSHA256(v, k) 10347 .update(v)
10348 .update(ZERO)
10349 .digest()
10350
10351 v = createHmac('sha256', k).update(v).digest()
30348 10352
10353 // Step H1/H2a, again, ignored as tlen === qlen (256 bit)
10354 // Step H2b again
10355 v = createHmac('sha256', k).update(v).digest()
30349 T = BigInteger.fromBuffer(v) 10356 T = BigInteger.fromBuffer(v)
30350 } 10357 }
30351 10358
30352 return T 10359 return T
30353} 10360}
30354 10361
30355function sign(curve, hash, d) { 10362function sign (curve, hash, d) {
30356 var k = deterministicGenerateK(curve, hash, d) 10363 var r, s
30357 10364
10365 var e = BigInteger.fromBuffer(hash)
30358 var n = curve.n 10366 var n = curve.n
30359 var G = curve.G 10367 var G = curve.G
30360 var Q = G.multiply(k)
30361 var e = BigInteger.fromBuffer(hash)
30362 10368
30363 var r = Q.affineX.mod(n) 10369 deterministicGenerateK(curve, hash, d, function (k) {
30364 assert.notEqual(r.signum(), 0, 'Invalid R value') 10370 var Q = G.multiply(k)
10371
10372 if (curve.isInfinity(Q))
10373 return false
10374
10375 r = Q.affineX.mod(n)
10376 if (r.signum() === 0)
10377 return false
30365 10378
30366 var s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n) 10379 s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n)
30367 assert.notEqual(s.signum(), 0, 'Invalid S value') 10380 if (s.signum() === 0)
10381 return false
10382
10383 return true
10384 })
30368 10385
30369 var N_OVER_TWO = n.shiftRight(1) 10386 var N_OVER_TWO = n.shiftRight(1)
30370 10387
@@ -30376,33 +10393,44 @@ function sign(curve, hash, d) {
30376 return new ECSignature(r, s) 10393 return new ECSignature(r, s)
30377} 10394}
30378 10395
30379function verify(curve, hash, signature, Q) { 10396function verifyRaw (curve, e, signature, Q) {
30380 var e = BigInteger.fromBuffer(hash)
30381
30382 return verifyRaw(curve, e, signature, Q)
30383}
30384
30385function verifyRaw(curve, e, signature, Q) {
30386 var n = curve.n 10397 var n = curve.n
30387 var G = curve.G 10398 var G = curve.G
30388 10399
30389 var r = signature.r 10400 var r = signature.r
30390 var s = signature.s 10401 var s = signature.s
30391 10402
30392 if (r.signum() === 0 || r.compareTo(n) >= 0) return false 10403 // 1.4.1 Enforce r and s are both integers in the interval [1, n − 1]
30393 if (s.signum() === 0 || s.compareTo(n) >= 0) return false 10404 if (r.signum() <= 0 || r.compareTo(n) >= 0) return false
10405 if (s.signum() <= 0 || s.compareTo(n) >= 0) return false
30394 10406
10407 // c = s^-1 mod n
30395 var c = s.modInverse(n) 10408 var c = s.modInverse(n)
30396 10409
10410 // 1.4.4 Compute u1 = es^−1 mod n
10411 // u2 = rs^−1 mod n
30397 var u1 = e.multiply(c).mod(n) 10412 var u1 = e.multiply(c).mod(n)
30398 var u2 = r.multiply(c).mod(n) 10413 var u2 = r.multiply(c).mod(n)
30399 10414
30400 var point = G.multiplyTwo(u1, Q, u2) 10415 // 1.4.5 Compute R = (xR, yR) = u1G + u2Q
30401 var v = point.affineX.mod(n) 10416 var R = G.multiplyTwo(u1, Q, u2)
10417 var v = R.affineX.mod(n)
10418
10419 // 1.4.5 (cont.) Enforce R is not at infinity
10420 if (curve.isInfinity(R)) return false
30402 10421
10422 // 1.4.8 If v = r, output "valid", and if v != r, output "invalid"
30403 return v.equals(r) 10423 return v.equals(r)
30404} 10424}
30405 10425
10426function verify (curve, hash, signature, Q) {
10427 // 1.4.2 H = Hash(M), already done by the user
10428 // 1.4.3 e = H
10429 var e = BigInteger.fromBuffer(hash)
10430
10431 return verifyRaw(curve, e, signature, Q)
10432}
10433
30406/** 10434/**
30407 * Recover a public key from a signature. 10435 * Recover a public key from a signature.
30408 * 10436 *
@@ -30411,12 +10439,18 @@ function verifyRaw(curve, e, signature, Q) {
30411 * 10439 *
30412 * http://www.secg.org/download/aid-780/sec1-v2.pdf 10440 * http://www.secg.org/download/aid-780/sec1-v2.pdf
30413 */ 10441 */
30414function recoverPubKey(curve, e, signature, i) { 10442function recoverPubKey (curve, e, signature, i) {
30415 assert.strictEqual(i & 3, i, 'Recovery param is more than two bits') 10443 assert.strictEqual(i & 3, i, 'Recovery param is more than two bits')
30416 10444
10445 var n = curve.n
10446 var G = curve.G
10447
30417 var r = signature.r 10448 var r = signature.r
30418 var s = signature.s 10449 var s = signature.s
30419 10450
10451 assert(r.signum() > 0 && r.compareTo(n) < 0, 'Invalid r value')
10452 assert(s.signum() > 0 && s.compareTo(n) < 0, 'Invalid s value')
10453
30420 // A set LSB signifies that the y-coordinate is odd 10454 // A set LSB signifies that the y-coordinate is odd
30421 var isYOdd = i & 1 10455 var isYOdd = i & 1
30422 10456
@@ -30424,9 +10458,6 @@ function recoverPubKey(curve, e, signature, i) {
30424 // first or second candidate key. 10458 // first or second candidate key.
30425 var isSecondKey = i >> 1 10459 var isSecondKey = i >> 1
30426 10460
30427 var n = curve.n
30428 var G = curve.G
30429
30430 // 1.1 Let x = r + jn 10461 // 1.1 Let x = r + jn
30431 var x = isSecondKey ? r.add(n) : r 10462 var x = isSecondKey ? r.add(n) : r
30432 var R = curve.pointFromX(isYOdd, x) 10463 var R = curve.pointFromX(isYOdd, x)
@@ -30459,7 +10490,7 @@ function recoverPubKey(curve, e, signature, i) {
30459 * This function simply tries all four cases and returns the value 10490 * This function simply tries all four cases and returns the value
30460 * that resulted in a successful pubkey recovery. 10491 * that resulted in a successful pubkey recovery.
30461 */ 10492 */
30462function calcPubKeyRecoveryParam(curve, e, signature, Q) { 10493function calcPubKeyRecoveryParam (curve, e, signature, Q) {
30463 for (var i = 0; i < 4; i++) { 10494 for (var i = 0; i < 4; i++) {
30464 var Qprime = recoverPubKey(curve, e, signature, i) 10495 var Qprime = recoverPubKey(curve, e, signature, i)
30465 10496
@@ -30481,33 +10512,37 @@ module.exports = {
30481 verifyRaw: verifyRaw 10512 verifyRaw: verifyRaw
30482} 10513}
30483 10514
30484}).call(this,_dereq_("buffer").Buffer) 10515}).call(this,require("buffer").Buffer)
30485},{"./crypto":73,"./ecsignature":77,"assert":4,"bigi":3,"buffer":8,"ecurve":65}],75:[function(_dereq_,module,exports){ 10516},{"./ecsignature":62,"assert":5,"bigi":3,"buffer":7,"create-hmac":45,"typeforce":53}],60:[function(require,module,exports){
30486(function (Buffer){ 10517(function (Buffer){
30487var assert = _dereq_('assert') 10518var assert = require('assert')
30488var base58check = _dereq_('./base58check') 10519var base58check = require('bs58check')
30489var ecdsa = _dereq_('./ecdsa') 10520var ecdsa = require('./ecdsa')
30490var networks = _dereq_('./networks') 10521var networks = require('./networks')
30491var secureRandom = _dereq_('secure-random') 10522var randomBytes = require('randombytes')
10523var typeForce = require('typeforce')
30492 10524
30493var BigInteger = _dereq_('bigi') 10525var BigInteger = require('bigi')
30494var ECPubKey = _dereq_('./ecpubkey') 10526var ECPubKey = require('./ecpubkey')
30495 10527
30496var ecurve = _dereq_('ecurve') 10528var ecurve = require('ecurve')
30497var curve = ecurve.getCurveByName('secp256k1') 10529var secp256k1 = ecurve.getCurveByName('secp256k1')
30498 10530
30499function ECKey(d, compressed) { 10531function ECKey (d, compressed) {
30500 assert(d.signum() > 0, 'Private key must be greater than 0') 10532 assert(d.signum() > 0, 'Private key must be greater than 0')
30501 assert(d.compareTo(curve.n) < 0, 'Private key must be less than the curve order') 10533 assert(d.compareTo(ECKey.curve.n) < 0, 'Private key must be less than the curve order')
30502 10534
30503 var Q = curve.G.multiply(d) 10535 var Q = ECKey.curve.G.multiply(d)
30504 10536
30505 this.d = d 10537 this.d = d
30506 this.pub = new ECPubKey(Q, compressed) 10538 this.pub = new ECPubKey(Q, compressed)
30507} 10539}
30508 10540
10541// Constants
10542ECKey.curve = secp256k1
10543
30509// Static constructors 10544// Static constructors
30510ECKey.fromWIF = function(string) { 10545ECKey.fromWIF = function (string) {
30511 var payload = base58check.decode(string) 10546 var payload = base58check.decode(string)
30512 var compressed = false 10547 var compressed = false
30513 10548
@@ -30528,20 +10563,21 @@ ECKey.fromWIF = function(string) {
30528 return new ECKey(d, compressed) 10563 return new ECKey(d, compressed)
30529} 10564}
30530 10565
30531ECKey.makeRandom = function(compressed, rng) { 10566ECKey.makeRandom = function (compressed, rng) {
30532 rng = rng || secureRandom.randomBuffer 10567 rng = rng || randomBytes
30533 10568
30534 var buffer = rng(32) 10569 var buffer = rng(32)
30535 assert(Buffer.isBuffer(buffer), 'Expected Buffer, got ' + buffer) 10570 typeForce('Buffer', buffer)
10571 assert.equal(buffer.length, 32, 'Expected 256-bit Buffer from RNG')
30536 10572
30537 var d = BigInteger.fromBuffer(buffer) 10573 var d = BigInteger.fromBuffer(buffer)
30538 d = d.mod(curve.n) 10574 d = d.mod(ECKey.curve.n)
30539 10575
30540 return new ECKey(d, compressed) 10576 return new ECKey(d, compressed)
30541} 10577}
30542 10578
30543// Export functions 10579// Export functions
30544ECKey.prototype.toWIF = function(network) { 10580ECKey.prototype.toWIF = function (network) {
30545 network = network || networks.bitcoin 10581 network = network || networks.bitcoin
30546 10582
30547 var bufferLen = this.pub.compressed ? 34 : 33 10583 var bufferLen = this.pub.compressed ? 34 : 33
@@ -30558,82 +10594,89 @@ ECKey.prototype.toWIF = function(network) {
30558} 10594}
30559 10595
30560// Operations 10596// Operations
30561ECKey.prototype.sign = function(hash) { 10597ECKey.prototype.sign = function (hash) {
30562 return ecdsa.sign(curve, hash, this.d) 10598 return ecdsa.sign(ECKey.curve, hash, this.d)
30563} 10599}
30564 10600
30565module.exports = ECKey 10601module.exports = ECKey
30566 10602
30567}).call(this,_dereq_("buffer").Buffer) 10603}).call(this,require("buffer").Buffer)
30568},{"./base58check":70,"./ecdsa":74,"./ecpubkey":76,"./networks":81,"assert":4,"bigi":3,"buffer":8,"ecurve":65,"secure-random":68}],76:[function(_dereq_,module,exports){ 10604},{"./ecdsa":59,"./ecpubkey":61,"./networks":66,"assert":5,"bigi":3,"bs58check":31,"buffer":7,"ecurve":49,"randombytes":52,"typeforce":53}],61:[function(require,module,exports){
30569(function (Buffer){ 10605(function (Buffer){
30570var assert = _dereq_('assert') 10606var crypto = require('./crypto')
30571var crypto = _dereq_('./crypto') 10607var ecdsa = require('./ecdsa')
30572var ecdsa = _dereq_('./ecdsa') 10608var typeForce = require('typeforce')
30573var networks = _dereq_('./networks') 10609var networks = require('./networks')
30574 10610
30575var Address = _dereq_('./address') 10611var Address = require('./address')
30576 10612
30577var ecurve = _dereq_('ecurve') 10613var ecurve = require('ecurve')
30578var curve = ecurve.getCurveByName('secp256k1') 10614var secp256k1 = ecurve.getCurveByName('secp256k1')
30579 10615
30580function ECPubKey(Q, compressed) { 10616function ECPubKey (Q, compressed) {
30581 assert(Q instanceof ecurve.Point, 'Expected Point, got ' + Q) 10617 if (compressed === undefined) {
10618 compressed = true
10619 }
30582 10620
30583 if (compressed == undefined) compressed = true 10621 typeForce('Point', Q)
30584 assert.strictEqual(typeof compressed, 'boolean', 'Expected boolean, got ' + compressed) 10622 typeForce('Boolean', compressed)
30585 10623
30586 this.compressed = compressed 10624 this.compressed = compressed
30587 this.Q = Q 10625 this.Q = Q
30588} 10626}
30589 10627
10628// Constants
10629ECPubKey.curve = secp256k1
10630
30590// Static constructors 10631// Static constructors
30591ECPubKey.fromBuffer = function(buffer) { 10632ECPubKey.fromBuffer = function (buffer) {
30592 var Q = ecurve.Point.decodeFrom(curve, buffer) 10633 var Q = ecurve.Point.decodeFrom(ECPubKey.curve, buffer)
30593 return new ECPubKey(Q, Q.compressed) 10634 return new ECPubKey(Q, Q.compressed)
30594} 10635}
30595 10636
30596ECPubKey.fromHex = function(hex) { 10637ECPubKey.fromHex = function (hex) {
30597 return ECPubKey.fromBuffer(new Buffer(hex, 'hex')) 10638 return ECPubKey.fromBuffer(new Buffer(hex, 'hex'))
30598} 10639}
30599 10640
30600// Operations 10641// Operations
30601ECPubKey.prototype.getAddress = function(network) { 10642ECPubKey.prototype.getAddress = function (network) {
30602 network = network || networks.bitcoin 10643 network = network || networks.bitcoin
30603 10644
30604 return new Address(crypto.hash160(this.toBuffer()), network.pubKeyHash) 10645 return new Address(crypto.hash160(this.toBuffer()), network.pubKeyHash)
30605} 10646}
30606 10647
30607ECPubKey.prototype.verify = function(hash, signature) { 10648ECPubKey.prototype.verify = function (hash, signature) {
30608 return ecdsa.verify(curve, hash, signature, this.Q) 10649 return ecdsa.verify(ECPubKey.curve, hash, signature, this.Q)
30609} 10650}
30610 10651
30611// Export functions 10652// Export functions
30612ECPubKey.prototype.toBuffer = function() { 10653ECPubKey.prototype.toBuffer = function () {
30613 return this.Q.getEncoded(this.compressed) 10654 return this.Q.getEncoded(this.compressed)
30614} 10655}
30615 10656
30616ECPubKey.prototype.toHex = function() { 10657ECPubKey.prototype.toHex = function () {
30617 return this.toBuffer().toString('hex') 10658 return this.toBuffer().toString('hex')
30618} 10659}
30619 10660
30620module.exports = ECPubKey 10661module.exports = ECPubKey
30621 10662
30622}).call(this,_dereq_("buffer").Buffer) 10663}).call(this,require("buffer").Buffer)
30623},{"./address":69,"./crypto":73,"./ecdsa":74,"./networks":81,"assert":4,"buffer":8,"ecurve":65}],77:[function(_dereq_,module,exports){ 10664},{"./address":54,"./crypto":58,"./ecdsa":59,"./networks":66,"buffer":7,"ecurve":49,"typeforce":53}],62:[function(require,module,exports){
30624(function (Buffer){ 10665(function (Buffer){
30625var assert = _dereq_('assert') 10666var assert = require('assert')
30626var BigInteger = _dereq_('bigi') 10667var typeForce = require('typeforce')
10668
10669var BigInteger = require('bigi')
10670
10671function ECSignature (r, s) {
10672 typeForce('BigInteger', r)
10673 typeForce('BigInteger', s)
30627 10674
30628function ECSignature(r, s) {
30629 assert(r instanceof BigInteger, 'Expected BigInteger, got ' + r)
30630 assert(s instanceof BigInteger, 'Expected BigInteger, got ' + s)
30631 this.r = r 10675 this.r = r
30632 this.s = s 10676 this.s = s
30633} 10677}
30634 10678
30635// Import operations 10679ECSignature.parseCompact = function (buffer) {
30636ECSignature.parseCompact = function(buffer) {
30637 assert.equal(buffer.length, 65, 'Invalid signature length') 10680 assert.equal(buffer.length, 65, 'Invalid signature length')
30638 var i = buffer.readUInt8(0) - 27 10681 var i = buffer.readUInt8(0) - 27
30639 10682
@@ -30654,7 +10697,7 @@ ECSignature.parseCompact = function(buffer) {
30654 } 10697 }
30655} 10698}
30656 10699
30657ECSignature.fromDER = function(buffer) { 10700ECSignature.fromDER = function (buffer) {
30658 assert.equal(buffer.readUInt8(0), 0x30, 'Not a DER sequence') 10701 assert.equal(buffer.readUInt8(0), 0x30, 'Not a DER sequence')
30659 assert.equal(buffer.readUInt8(1), buffer.length - 2, 'Invalid sequence length') 10702 assert.equal(buffer.readUInt8(1), buffer.length - 2, 'Invalid sequence length')
30660 assert.equal(buffer.readUInt8(2), 0x02, 'Expected a DER integer') 10703 assert.equal(buffer.readUInt8(2), 0x02, 'Expected a DER integer')
@@ -30690,12 +10733,12 @@ ECSignature.fromDER = function(buffer) {
30690 return new ECSignature(r, s) 10733 return new ECSignature(r, s)
30691} 10734}
30692 10735
30693// FIXME: 0x00, 0x04, 0x80 are SIGHASH_* boundary constants, importing Transaction causes a circular dependency 10736// BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed)
30694ECSignature.parseScriptSignature = function(buffer) { 10737ECSignature.parseScriptSignature = function (buffer) {
30695 var hashType = buffer.readUInt8(buffer.length - 1) 10738 var hashType = buffer.readUInt8(buffer.length - 1)
30696 var hashTypeMod = hashType & ~0x80 10739 var hashTypeMod = hashType & ~0x80
30697 10740
30698 assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType') 10741 assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)
30699 10742
30700 return { 10743 return {
30701 signature: ECSignature.fromDER(buffer.slice(0, -1)), 10744 signature: ECSignature.fromDER(buffer.slice(0, -1)),
@@ -30703,9 +10746,11 @@ ECSignature.parseScriptSignature = function(buffer) {
30703 } 10746 }
30704} 10747}
30705 10748
30706// Export operations 10749ECSignature.prototype.toCompact = function (i, compressed) {
30707ECSignature.prototype.toCompact = function(i, compressed) { 10750 if (compressed) {
30708 if (compressed) i += 4 10751 i += 4
10752 }
10753
30709 i += 27 10754 i += 27
30710 10755
30711 var buffer = new Buffer(65) 10756 var buffer = new Buffer(65)
@@ -30717,26 +10762,30 @@ ECSignature.prototype.toCompact = function(i, compressed) {
30717 return buffer 10762 return buffer
30718} 10763}
30719 10764
30720ECSignature.prototype.toDER = function() { 10765ECSignature.prototype.toDER = function () {
30721 var rBa = this.r.toDERInteger() 10766 var rBa = this.r.toDERInteger()
30722 var sBa = this.s.toDERInteger() 10767 var sBa = this.s.toDERInteger()
30723 10768
30724 var sequence = [] 10769 var sequence = []
30725 sequence.push(0x02) // INTEGER 10770
30726 sequence.push(rBa.length) 10771 // INTEGER
10772 sequence.push(0x02, rBa.length)
30727 sequence = sequence.concat(rBa) 10773 sequence = sequence.concat(rBa)
30728 10774
30729 sequence.push(0x02) // INTEGER 10775 // INTEGER
30730 sequence.push(sBa.length) 10776 sequence.push(0x02, sBa.length)
30731 sequence = sequence.concat(sBa) 10777 sequence = sequence.concat(sBa)
30732 10778
30733 sequence.unshift(sequence.length) 10779 // SEQUENCE
30734 sequence.unshift(0x30) // SEQUENCE 10780 sequence.unshift(0x30, sequence.length)
30735 10781
30736 return new Buffer(sequence) 10782 return new Buffer(sequence)
30737} 10783}
30738 10784
30739ECSignature.prototype.toScriptSignature = function(hashType) { 10785ECSignature.prototype.toScriptSignature = function (hashType) {
10786 var hashTypeMod = hashType & ~0x80
10787 assert(hashTypeMod > 0x00 && hashTypeMod < 0x04, 'Invalid hashType ' + hashType)
10788
30740 var hashTypeBuffer = new Buffer(1) 10789 var hashTypeBuffer = new Buffer(1)
30741 hashTypeBuffer.writeUInt8(hashType, 0) 10790 hashTypeBuffer.writeUInt8(hashType, 0)
30742 10791
@@ -30745,52 +10794,59 @@ ECSignature.prototype.toScriptSignature = function(hashType) {
30745 10794
30746module.exports = ECSignature 10795module.exports = ECSignature
30747 10796
30748}).call(this,_dereq_("buffer").Buffer) 10797}).call(this,require("buffer").Buffer)
30749},{"assert":4,"bigi":3,"buffer":8}],78:[function(_dereq_,module,exports){ 10798},{"assert":5,"bigi":3,"buffer":7,"typeforce":53}],63:[function(require,module,exports){
30750(function (Buffer){ 10799(function (Buffer){
30751var assert = _dereq_('assert') 10800var assert = require('assert')
30752var base58check = _dereq_('./base58check') 10801var base58check = require('bs58check')
30753var crypto = _dereq_('./crypto') 10802var bcrypto = require('./crypto')
30754var networks = _dereq_('./networks') 10803var createHmac = require('create-hmac')
30755 10804var typeForce = require('typeforce')
30756var BigInteger = _dereq_('bigi') 10805var networks = require('./networks')
30757var ECKey = _dereq_('./eckey') 10806
30758var ECPubKey = _dereq_('./ecpubkey') 10807var BigInteger = require('bigi')
30759 10808var ECKey = require('./eckey')
30760var ecurve = _dereq_('ecurve') 10809var ECPubKey = require('./ecpubkey')
10810
10811var ecurve = require('ecurve')
30761var curve = ecurve.getCurveByName('secp256k1') 10812var curve = ecurve.getCurveByName('secp256k1')
30762 10813
30763function findBIP32ParamsByVersion(version) { 10814function findBIP32NetworkByVersion (version) {
30764 for (var name in networks) { 10815 for (var name in networks) {
30765 var network = networks[name] 10816 var network = networks[name]
30766 10817
30767 for (var type in network.bip32) { 10818 if (version === network.bip32.private || version === network.bip32.public) {
30768 if (version != network.bip32[type]) continue 10819 return network
30769
30770 return {
30771 isPrivate: (type === 'private'),
30772 network: network
30773 }
30774 } 10820 }
30775 } 10821 }
30776 10822
30777 assert(false, 'Could not find version ' + version.toString(16)) 10823 assert(false, 'Could not find network for ' + version.toString(16))
30778} 10824}
30779 10825
30780function HDNode(K, chainCode, network) { 10826function HDNode (K, chainCode, network) {
30781 network = network || networks.bitcoin 10827 network = network || networks.bitcoin
30782 10828
30783 assert(Buffer.isBuffer(chainCode), 'Expected Buffer, got ' + chainCode) 10829 typeForce('Buffer', chainCode)
10830
10831 assert.equal(chainCode.length, 32, 'Expected chainCode length of 32, got ' + chainCode.length)
30784 assert(network.bip32, 'Unknown BIP32 constants for network') 10832 assert(network.bip32, 'Unknown BIP32 constants for network')
30785 10833
30786 this.chainCode = chainCode 10834 this.chainCode = chainCode
30787 this.depth = 0 10835 this.depth = 0
30788 this.index = 0 10836 this.index = 0
10837 this.parentFingerprint = 0x00000000
30789 this.network = network 10838 this.network = network
30790 10839
30791 if (K instanceof BigInteger) { 10840 if (K instanceof BigInteger) {
30792 this.privKey = new ECKey(K, true) 10841 this.privKey = new ECKey(K, true)
30793 this.pubKey = this.privKey.pub 10842 this.pubKey = this.privKey.pub
10843 } else if (K instanceof ECKey) {
10844 assert(K.pub.compressed, 'ECKey must be compressed')
10845 this.privKey = K
10846 this.pubKey = K.pub
10847 } else if (K instanceof ECPubKey) {
10848 assert(K.compressed, 'ECPubKey must be compressed')
10849 this.pubKey = K
30794 } else { 10850 } else {
30795 this.pubKey = new ECPubKey(K, true) 10851 this.pubKey = new ECPubKey(K, true)
30796 } 10852 }
@@ -30800,8 +10856,13 @@ HDNode.MASTER_SECRET = new Buffer('Bitcoin seed')
30800HDNode.HIGHEST_BIT = 0x80000000 10856HDNode.HIGHEST_BIT = 0x80000000
30801HDNode.LENGTH = 78 10857HDNode.LENGTH = 78
30802 10858
30803HDNode.fromSeedBuffer = function(seed, network) { 10859HDNode.fromSeedBuffer = function (seed, network) {
30804 var I = crypto.HmacSHA512(seed, HDNode.MASTER_SECRET) 10860 typeForce('Buffer', seed)
10861
10862 assert(seed.length >= 16, 'Seed should be at least 128 bits')
10863 assert(seed.length <= 64, 'Seed should be at most 512 bits')
10864
10865 var I = createHmac('sha512', HDNode.MASTER_SECRET).update(seed).digest()
30805 var IL = I.slice(0, 32) 10866 var IL = I.slice(0, 32)
30806 var IR = I.slice(32) 10867 var IR = I.slice(32)
30807 10868
@@ -30812,20 +10873,32 @@ HDNode.fromSeedBuffer = function(seed, network) {
30812 return new HDNode(pIL, IR, network) 10873 return new HDNode(pIL, IR, network)
30813} 10874}
30814 10875
30815HDNode.fromSeedHex = function(hex, network) { 10876HDNode.fromSeedHex = function (hex, network) {
30816 return HDNode.fromSeedBuffer(new Buffer(hex, 'hex'), network) 10877 return HDNode.fromSeedBuffer(new Buffer(hex, 'hex'), network)
30817} 10878}
30818 10879
30819HDNode.fromBase58 = function(string) { 10880HDNode.fromBase58 = function (string, network) {
30820 return HDNode.fromBuffer(base58check.decode(string)) 10881 return HDNode.fromBuffer(base58check.decode(string), network, true)
30821} 10882}
30822 10883
30823HDNode.fromBuffer = function(buffer) { 10884// FIXME: remove in 2.x.y
10885HDNode.fromBuffer = function (buffer, network, __ignoreDeprecation) {
10886 if (!__ignoreDeprecation) {
10887 console.warn('HDNode.fromBuffer() is deprecated for removal in 2.x.y, use fromBase58 instead')
10888 }
10889
30824 assert.strictEqual(buffer.length, HDNode.LENGTH, 'Invalid buffer length') 10890 assert.strictEqual(buffer.length, HDNode.LENGTH, 'Invalid buffer length')
30825 10891
30826 // 4 byte: version bytes 10892 // 4 byte: version bytes
30827 var version = buffer.readUInt32BE(0) 10893 var version = buffer.readUInt32BE(0)
30828 var params = findBIP32ParamsByVersion(version) 10894
10895 if (network) {
10896 assert(version === network.bip32.private || version === network.bip32.public, "Network doesn't match")
10897
10898 // auto-detect
10899 } else {
10900 network = findBIP32NetworkByVersion(version)
10901 }
30829 10902
30830 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ... 10903 // 1 byte: depth: 0x00 for master nodes, 0x01 for level-1 descendants, ...
30831 var depth = buffer.readUInt8(4) 10904 var depth = buffer.readUInt8(4)
@@ -30843,18 +10916,18 @@ HDNode.fromBuffer = function(buffer) {
30843 10916
30844 // 32 bytes: the chain code 10917 // 32 bytes: the chain code
30845 var chainCode = buffer.slice(13, 45) 10918 var chainCode = buffer.slice(13, 45)
30846 var hd 10919 var data, hd
30847 10920
30848 // 33 bytes: private key data (0x00 + k) 10921 // 33 bytes: private key data (0x00 + k)
30849 if (params.isPrivate) { 10922 if (version === network.bip32.private) {
30850 assert.strictEqual(buffer.readUInt8(45), 0x00, 'Invalid private key') 10923 assert.strictEqual(buffer.readUInt8(45), 0x00, 'Invalid private key')
30851 var data = buffer.slice(46, 78) 10924 data = buffer.slice(46, 78)
30852 var d = BigInteger.fromBuffer(data) 10925 var d = BigInteger.fromBuffer(data)
30853 hd = new HDNode(d, chainCode, params.network) 10926 hd = new HDNode(d, chainCode, network)
30854 10927
30855 // 33 bytes: public key data (0x02 + X or 0x03 + X) 10928 // 33 bytes: public key data (0x02 + X or 0x03 + X)
30856 } else { 10929 } else {
30857 var data = buffer.slice(45, 78) 10930 data = buffer.slice(45, 78)
30858 var Q = ecurve.Point.decodeFrom(curve, data) 10931 var Q = ecurve.Point.decodeFrom(curve, data)
30859 assert.equal(Q.compressed, true, 'Invalid public key') 10932 assert.equal(Q.compressed, true, 'Invalid public key')
30860 10933
@@ -30862,7 +10935,7 @@ HDNode.fromBuffer = function(buffer) {
30862 // If not, the extended public key is invalid. 10935 // If not, the extended public key is invalid.
30863 curve.validate(Q) 10936 curve.validate(Q)
30864 10937
30865 hd = new HDNode(Q, chainCode, params.network) 10938 hd = new HDNode(Q, chainCode, network)
30866 } 10939 }
30867 10940
30868 hd.depth = depth 10941 hd.depth = depth
@@ -30872,28 +10945,49 @@ HDNode.fromBuffer = function(buffer) {
30872 return hd 10945 return hd
30873} 10946}
30874 10947
30875HDNode.fromHex = function(hex) { 10948// FIXME: remove in 2.x.y
30876 return HDNode.fromBuffer(new Buffer(hex, 'hex')) 10949HDNode.fromHex = function (hex, network) {
10950 return HDNode.fromBuffer(new Buffer(hex, 'hex'), network)
30877} 10951}
30878 10952
30879HDNode.prototype.getIdentifier = function() { 10953HDNode.prototype.getIdentifier = function () {
30880 return crypto.hash160(this.pubKey.toBuffer()) 10954 return bcrypto.hash160(this.pubKey.toBuffer())
30881} 10955}
30882 10956
30883HDNode.prototype.getFingerprint = function() { 10957HDNode.prototype.getFingerprint = function () {
30884 return this.getIdentifier().slice(0, 4) 10958 return this.getIdentifier().slice(0, 4)
30885} 10959}
30886 10960
30887HDNode.prototype.getAddress = function() { 10961HDNode.prototype.getAddress = function () {
30888 return this.pubKey.getAddress(this.network) 10962 return this.pubKey.getAddress(this.network)
30889} 10963}
30890 10964
30891HDNode.prototype.toBase58 = function(isPrivate) { 10965HDNode.prototype.neutered = function () {
30892 return base58check.encode(this.toBuffer(isPrivate)) 10966 var neutered = new HDNode(this.pubKey.Q, this.chainCode, this.network)
10967 neutered.depth = this.depth
10968 neutered.index = this.index
10969 neutered.parentFingerprint = this.parentFingerprint
10970
10971 return neutered
10972}
10973
10974HDNode.prototype.toBase58 = function (isPrivate) {
10975 return base58check.encode(this.toBuffer(isPrivate, true))
30893} 10976}
30894 10977
30895HDNode.prototype.toBuffer = function(isPrivate) { 10978// FIXME: remove in 2.x.y
30896 if (isPrivate == undefined) isPrivate = !!this.privKey 10979HDNode.prototype.toBuffer = function (isPrivate, __ignoreDeprecation) {
10980 if (isPrivate === undefined) {
10981 isPrivate = !!this.privKey
10982
10983 // FIXME: remove in 2.x.y
10984 } else {
10985 console.warn('isPrivate flag is deprecated, please use the .neutered() method instead')
10986 }
10987
10988 if (!__ignoreDeprecation) {
10989 console.warn('HDNode.toBuffer() is deprecated for removal in 2.x.y, use toBase58 instead')
10990 }
30897 10991
30898 // Version 10992 // Version
30899 var version = isPrivate ? this.network.bip32.private : this.network.bip32.public 10993 var version = isPrivate ? this.network.bip32.private : this.network.bip32.public
@@ -30907,8 +11001,7 @@ HDNode.prototype.toBuffer = function(isPrivate) {
30907 buffer.writeUInt8(this.depth, 4) 11001 buffer.writeUInt8(this.depth, 4)
30908 11002
30909 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key) 11003 // 4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
30910 var fingerprint = (this.depth === 0) ? 0x00000000 : this.parentFingerprint 11004 buffer.writeUInt32BE(this.parentFingerprint, 5)
30911 buffer.writeUInt32BE(fingerprint, 5)
30912 11005
30913 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized. 11006 // 4 bytes: child number. This is the number i in xi = xpar/i, with xi the key being serialized.
30914 // This is encoded in Big endian. (0x00000000 if master key) 11007 // This is encoded in Big endian. (0x00000000 if master key)
@@ -30919,13 +11012,13 @@ HDNode.prototype.toBuffer = function(isPrivate) {
30919 11012
30920 // 33 bytes: the public key or private key data 11013 // 33 bytes: the public key or private key data
30921 if (isPrivate) { 11014 if (isPrivate) {
11015 // FIXME: remove in 2.x.y
30922 assert(this.privKey, 'Missing private key') 11016 assert(this.privKey, 'Missing private key')
30923 11017
30924 // 0x00 + k for private keys 11018 // 0x00 + k for private keys
30925 buffer.writeUInt8(0, 45) 11019 buffer.writeUInt8(0, 45)
30926 this.privKey.d.toBuffer(32).copy(buffer, 46) 11020 this.privKey.d.toBuffer(32).copy(buffer, 46)
30927 } else { 11021 } else {
30928
30929 // X9.62 encoding for public keys 11022 // X9.62 encoding for public keys
30930 this.pubKey.toBuffer().copy(buffer, 45) 11023 this.pubKey.toBuffer().copy(buffer, 45)
30931 } 11024 }
@@ -30933,12 +11026,13 @@ HDNode.prototype.toBuffer = function(isPrivate) {
30933 return buffer 11026 return buffer
30934} 11027}
30935 11028
30936HDNode.prototype.toHex = function(isPrivate) { 11029// FIXME: remove in 2.x.y
11030HDNode.prototype.toHex = function (isPrivate) {
30937 return this.toBuffer(isPrivate).toString('hex') 11031 return this.toBuffer(isPrivate).toString('hex')
30938} 11032}
30939 11033
30940// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions 11034// https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#child-key-derivation-ckd-functions
30941HDNode.prototype.derive = function(index) { 11035HDNode.prototype.derive = function (index) {
30942 var isHardened = index >= HDNode.HIGHEST_BIT 11036 var isHardened = index >= HDNode.HIGHEST_BIT
30943 var indexBuffer = new Buffer(4) 11037 var indexBuffer = new Buffer(4)
30944 indexBuffer.writeUInt32BE(index, 0) 11038 indexBuffer.writeUInt32BE(index, 0)
@@ -30965,7 +11059,7 @@ HDNode.prototype.derive = function(index) {
30965 ]) 11059 ])
30966 } 11060 }
30967 11061
30968 var I = crypto.HmacSHA512(data, this.chainCode) 11062 var I = createHmac('sha512', this.chainCode).update(data).digest()
30969 var IL = I.slice(0, 32) 11063 var IL = I.slice(0, 32)
30970 var IR = I.slice(32) 11064 var IR = I.slice(32)
30971 11065
@@ -31010,7 +11104,7 @@ HDNode.prototype.derive = function(index) {
31010 return hd 11104 return hd
31011} 11105}
31012 11106
31013HDNode.prototype.deriveHardened = function(index) { 11107HDNode.prototype.deriveHardened = function (index) {
31014 // Only derives hardened private keys by default 11108 // Only derives hardened private keys by default
31015 return this.derive(index + HDNode.HIGHEST_BIT) 11109 return this.derive(index + HDNode.HIGHEST_BIT)
31016} 11110}
@@ -31019,56 +11113,53 @@ HDNode.prototype.toString = HDNode.prototype.toBase58
31019 11113
31020module.exports = HDNode 11114module.exports = HDNode
31021 11115
31022}).call(this,_dereq_("buffer").Buffer) 11116}).call(this,require("buffer").Buffer)
31023},{"./base58check":70,"./crypto":73,"./eckey":75,"./ecpubkey":76,"./networks":81,"assert":4,"bigi":3,"buffer":8,"ecurve":65}],79:[function(_dereq_,module,exports){ 11117},{"./crypto":58,"./eckey":60,"./ecpubkey":61,"./networks":66,"assert":5,"bigi":3,"bs58check":31,"buffer":7,"create-hmac":45,"ecurve":49,"typeforce":53}],64:[function(require,module,exports){
31024module.exports = { 11118module.exports = {
31025 Address: _dereq_('./address'), 11119 Address: require('./address'),
31026 base58check: _dereq_('./base58check'), 11120 base58check: require('./base58check'),
31027 bufferutils: _dereq_('./bufferutils'), 11121 Block: require('./block'),
31028 convert: _dereq_('./convert'), 11122 bufferutils: require('./bufferutils'),
31029 crypto: _dereq_('./crypto'), 11123 crypto: require('./crypto'),
31030 ecdsa: _dereq_('./ecdsa'), 11124 ecdsa: require('./ecdsa'),
31031 ECKey: _dereq_('./eckey'), 11125 ECKey: require('./eckey'),
31032 ECPubKey: _dereq_('./ecpubkey'), 11126 ECPubKey: require('./ecpubkey'),
31033 ECSignature: _dereq_('./ecsignature'), 11127 ECSignature: require('./ecsignature'),
31034 Message: _dereq_('./message'), 11128 Message: require('./message'),
31035 opcodes: _dereq_('./opcodes'), 11129 opcodes: require('./opcodes'),
31036 HDNode: _dereq_('./hdnode'), 11130 HDNode: require('./hdnode'),
31037 Script: _dereq_('./script'), 11131 Script: require('./script'),
31038 scripts: _dereq_('./scripts'), 11132 scripts: require('./scripts'),
31039 Transaction: _dereq_('./transaction'), 11133 Transaction: require('./transaction'),
31040 networks: _dereq_('./networks'), 11134 TransactionBuilder: require('./transaction_builder'),
31041 Wallet: _dereq_('./wallet') 11135 networks: require('./networks'),
31042} 11136 Wallet: require('./wallet')
31043 11137}
31044},{"./address":69,"./base58check":70,"./bufferutils":71,"./convert":72,"./crypto":73,"./ecdsa":74,"./eckey":75,"./ecpubkey":76,"./ecsignature":77,"./hdnode":78,"./message":80,"./networks":81,"./opcodes":82,"./script":83,"./scripts":84,"./transaction":85,"./wallet":86}],80:[function(_dereq_,module,exports){ 11138
11139},{"./address":54,"./base58check":55,"./block":56,"./bufferutils":57,"./crypto":58,"./ecdsa":59,"./eckey":60,"./ecpubkey":61,"./ecsignature":62,"./hdnode":63,"./message":65,"./networks":66,"./opcodes":67,"./script":68,"./scripts":69,"./transaction":70,"./transaction_builder":71,"./wallet":72}],65:[function(require,module,exports){
31045(function (Buffer){ 11140(function (Buffer){
31046/// Implements Bitcoin's feature for signing arbitrary messages. 11141var bufferutils = require('./bufferutils')
31047var Address = _dereq_('./address') 11142var crypto = require('./crypto')
31048var BigInteger = _dereq_('bigi') 11143var ecdsa = require('./ecdsa')
31049var bufferutils = _dereq_('./bufferutils') 11144var networks = require('./networks')
31050var crypto = _dereq_('./crypto') 11145
31051var ecdsa = _dereq_('./ecdsa') 11146var BigInteger = require('bigi')
31052var networks = _dereq_('./networks') 11147var ECPubKey = require('./ecpubkey')
31053 11148var ECSignature = require('./ecsignature')
31054var Address = _dereq_('./address') 11149
31055var ECPubKey = _dereq_('./ecpubkey') 11150var ecurve = require('ecurve')
31056var ECSignature = _dereq_('./ecsignature')
31057
31058var ecurve = _dereq_('ecurve')
31059var ecparams = ecurve.getCurveByName('secp256k1') 11151var ecparams = ecurve.getCurveByName('secp256k1')
31060 11152
31061function magicHash(message, network) { 11153function magicHash (message, network) {
31062 var magicPrefix = new Buffer(network.magicPrefix) 11154 var magicPrefix = new Buffer(network.magicPrefix)
31063 var messageBuffer = new Buffer(message) 11155 var messageBuffer = new Buffer(message)
31064 var lengthBuffer = new Buffer(bufferutils.varIntSize(messageBuffer.length)) 11156 var lengthBuffer = bufferutils.varIntBuffer(messageBuffer.length)
31065 bufferutils.writeVarInt(lengthBuffer, messageBuffer.length, 0)
31066 11157
31067 var buffer = Buffer.concat([magicPrefix, lengthBuffer, messageBuffer]) 11158 var buffer = Buffer.concat([magicPrefix, lengthBuffer, messageBuffer])
31068 return crypto.hash256(buffer) 11159 return crypto.hash256(buffer)
31069} 11160}
31070 11161
31071function sign(privKey, message, network) { 11162function sign (privKey, message, network) {
31072 network = network || networks.bitcoin 11163 network = network || networks.bitcoin
31073 11164
31074 var hash = magicHash(message, network) 11165 var hash = magicHash(message, network)
@@ -31080,19 +11171,20 @@ function sign(privKey, message, network) {
31080} 11171}
31081 11172
31082// TODO: network could be implied from address 11173// TODO: network could be implied from address
31083function verify(address, signatureBuffer, message, network) { 11174function verify (address, signature, message, network) {
31084 if (address instanceof Address) { 11175 if (!Buffer.isBuffer(signature)) {
31085 address = address.toString() 11176 signature = new Buffer(signature, 'base64')
31086 } 11177 }
11178
31087 network = network || networks.bitcoin 11179 network = network || networks.bitcoin
31088 11180
31089 var hash = magicHash(message, network) 11181 var hash = magicHash(message, network)
31090 var parsed = ECSignature.parseCompact(signatureBuffer) 11182 var parsed = ECSignature.parseCompact(signature)
31091 var e = BigInteger.fromBuffer(hash) 11183 var e = BigInteger.fromBuffer(hash)
31092 var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i) 11184 var Q = ecdsa.recoverPubKey(ecparams, e, parsed.signature, parsed.i)
31093 11185
31094 var pubKey = new ECPubKey(Q, parsed.compressed) 11186 var pubKey = new ECPubKey(Q, parsed.compressed)
31095 return pubKey.getAddress(network).toString() === address 11187 return pubKey.getAddress(network).toString() === address.toString()
31096} 11188}
31097 11189
31098module.exports = { 11190module.exports = {
@@ -31101,8 +11193,8 @@ module.exports = {
31101 verify: verify 11193 verify: verify
31102} 11194}
31103 11195
31104}).call(this,_dereq_("buffer").Buffer) 11196}).call(this,require("buffer").Buffer)
31105},{"./address":69,"./bufferutils":71,"./crypto":73,"./ecdsa":74,"./ecpubkey":76,"./ecsignature":77,"./networks":81,"bigi":3,"buffer":8,"ecurve":65}],81:[function(_dereq_,module,exports){ 11197},{"./bufferutils":57,"./crypto":58,"./ecdsa":59,"./ecpubkey":61,"./ecsignature":62,"./networks":66,"bigi":3,"buffer":7,"ecurve":49}],66:[function(require,module,exports){
31106// https://en.bitcoin.it/wiki/List_of_address_prefixes 11198// https://en.bitcoin.it/wiki/List_of_address_prefixes
31107// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731 11199// Dogecoin BIP32 is a proposed standard: https://bitcointalk.org/index.php?topic=409731
31108 11200
@@ -31120,31 +11212,32 @@ var networks = {
31120 feePerKb: 10000, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53 11212 feePerKb: 10000, // https://github.com/bitcoin/bitcoin/blob/v0.9.2/src/main.cpp#L53
31121 estimateFee: estimateFee('bitcoin') 11213 estimateFee: estimateFee('bitcoin')
31122 }, 11214 },
31123 shadow: { 11215 testnet: {
31124 magicPrefix: '\x19ShadowCash Signed Message:\n', 11216 magicPrefix: '\x18Bitcoin Signed Message:\n',
31125 bip32: { 11217 bip32: {
31126 public: 0xEE80286A, 11218 public: 0x043587cf,
31127 private: 0xEE8031E8 11219 private: 0x04358394
31128 }, 11220 },
31129 pubKeyHash: 0x3f, 11221 pubKeyHash: 0x6f,
31130 scriptHash: 0x7d, 11222 scriptHash: 0xc4,
31131 wif: 0xbf, 11223 wif: 0xef,
31132 dustThreshold: 0, 11224 dustThreshold: 546,
31133 feePerKb: 10000, 11225 feePerKb: 10000,
31134 estimateFee: estimateFee('shadow') 11226 estimateFee: estimateFee('testnet')
31135 }, 11227 },
31136 shadowtn: { 11228 litecoin: {
31137 magicPrefix: '\x19ShadowCash Signed Message:\n', 11229 magicPrefix: '\x19Litecoin Signed Message:\n',
31138 bip32: { 11230 bip32: {
31139 public: 0x76C0FDFB, 11231 public: 0x019da462,
31140 private: 0x76C1077A 11232 private: 0x019d9cfe
31141 }, 11233 },
31142 pubKeyHash: 0x7f, 11234 pubKeyHash: 0x30,
31143 scriptHash: 0xc4, 11235 scriptHash: 0x05,
31144 wif: 0xff, 11236 wif: 0xb0,
31145 dustThreshold: 0, 11237 dustThreshold: 0, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365
31146 feePerKb: 10000, 11238 dustSoftThreshold: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53
31147 estimateFee: estimateFee('shadowtn') 11239 feePerKb: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56
11240 estimateFee: estimateFee('litecoin')
31148 }, 11241 },
31149 dogecoin: { 11242 dogecoin: {
31150 magicPrefix: '\x19Dogecoin Signed Message:\n', 11243 magicPrefix: '\x19Dogecoin Signed Message:\n',
@@ -31160,45 +11253,87 @@ var networks = {
31160 feePerKb: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58 11253 feePerKb: 100000000, // https://github.com/dogecoin/dogecoin/blob/v1.7.1/src/main.cpp#L58
31161 estimateFee: estimateFee('dogecoin') 11254 estimateFee: estimateFee('dogecoin')
31162 }, 11255 },
31163 litecoin: { 11256 viacoin: {
31164 magicPrefix: '\x19Litecoin Signed Message:\n', 11257 magicPrefix: '\x18Viacoin Signed Message:\n',
31165 bip32: { 11258 bip32: {
31166 public: 0x019da462, 11259 public: 0x0488b21e,
31167 private: 0x019d9cfe 11260 private: 0x0488ade4
31168 }, 11261 },
31169 pubKeyHash: 0x30, 11262 pubKeyHash: 0x47,
31170 scriptHash: 0x05, 11263 scriptHash: 0x21,
31171 wif: 0xb0, 11264 wif: 0xc7,
31172 dustThreshold: 0, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L360-L365 11265 dustThreshold: 560,
31173 dustSoftThreshold: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.h#L53 11266 dustSoftThreshold: 100000,
31174 feePerKb: 100000, // https://github.com/litecoin-project/litecoin/blob/v0.8.7.2/src/main.cpp#L56 11267 feePerKb: 100000, //
31175 estimateFee: estimateFee('litecoin') 11268 estimateFee: estimateFee('viacoin')
31176 }, 11269 },
31177 testnet: { 11270 viacointestnet: {
31178 magicPrefix: '\x18Bitcoin Signed Message:\n', 11271 magicPrefix: '\x18Viacoin Signed Message:\n',
31179 bip32: { 11272 bip32: {
31180 public: 0x043587cf, 11273 public: 0x043587cf,
31181 private: 0x04358394 11274 private: 0x04358394
31182 }, 11275 },
31183 pubKeyHash: 0x6f, 11276 pubKeyHash: 0x7f,
31184 scriptHash: 0xc4, 11277 scriptHash: 0xc4,
31185 wif: 0xef, 11278 wif: 0xff,
31186 dustThreshold: 546, 11279 dustThreshold: 560,
11280 dustSoftThreshold: 100000,
11281 feePerKb: 100000,
11282 estimateFee: estimateFee('viacointestnet')
11283 },
11284 gamerscoin: {
11285 magicPrefix: '\x19Gamerscoin Signed Message:\n',
11286 bip32: {
11287 public: 0x019da462,
11288 private: 0x019d9cfe
11289 },
11290 pubKeyHash: 0x26,
11291 scriptHash: 0x05,
11292 wif: 0xA6,
11293 dustThreshold: 0, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L358-L363
11294 dustSoftThreshold: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L51
11295 feePerKb: 100000, // https://github.com/gamers-coin/gamers-coinv3/blob/master/src/main.cpp#L54
11296 estimateFee: estimateFee('gamerscoin')
11297 },
11298 jumbucks: {
11299 magicPrefix: '\x19Jumbucks Signed Message:\n',
11300 bip32: {
11301 public: 0x037a689a,
11302 private: 0x037a6460
11303 },
11304 pubKeyHash: 0x2b,
11305 scriptHash: 0x05,
11306 wif: 0xab,
11307 dustThreshold: 0,
11308 dustSoftThreshold: 10000,
31187 feePerKb: 10000, 11309 feePerKb: 10000,
31188 estimateFee: estimateFee('testnet') 11310 estimateFee: estimateFee('jumbucks')
11311 },
11312 zetacoin: {
11313 magicPrefix: '\x18Zetacoin Signed Message:\n',
11314 bip32: {
11315 public: 0x0488b21e,
11316 private: 0x0488ade4
11317 },
11318 pubKeyHash: 0x50,
11319 scriptHash: 0x09,
11320 wif: 0xe0,
11321 dustThreshold: 546, // https://github.com/zetacoin/zetacoin/blob/master/src/core.h#L159
11322 feePerKb: 10000, // https://github.com/zetacoin/zetacoin/blob/master/src/main.cpp#L54
11323 estimateFee: estimateFee('zetacoin')
31189 } 11324 }
31190} 11325}
31191 11326
31192function estimateFee(type) { 11327function estimateFee (type) {
31193 return function(tx) { 11328 return function (tx) {
31194 var network = networks[type] 11329 var network = networks[type]
31195 var baseFee = network.feePerKb 11330 var baseFee = network.feePerKb
31196 var byteSize = tx.toBuffer().length 11331 var byteSize = tx.toBuffer().length
31197 11332
31198 var fee = baseFee * Math.ceil(byteSize / 1000) 11333 var fee = baseFee * Math.ceil(byteSize / 1000)
31199 if (network.dustSoftThreshold == undefined) return fee 11334 if (network.dustSoftThreshold === undefined) return fee
31200 11335
31201 tx.outs.forEach(function(e){ 11336 tx.outs.forEach(function (e) {
31202 if (e.value < network.dustSoftThreshold) { 11337 if (e.value < network.dustSoftThreshold) {
31203 fee += baseFee 11338 fee += baseFee
31204 } 11339 }
@@ -31210,169 +11345,170 @@ function estimateFee(type) {
31210 11345
31211module.exports = networks 11346module.exports = networks
31212 11347
31213},{}],82:[function(_dereq_,module,exports){ 11348},{}],67:[function(require,module,exports){
31214module.exports = { 11349module.exports = {
31215 // push value 11350 // push value
31216 OP_FALSE : 0, 11351 OP_FALSE: 0,
31217 OP_0 : 0, 11352 OP_0: 0,
31218 OP_PUSHDATA1 : 76, 11353 OP_PUSHDATA1: 76,
31219 OP_PUSHDATA2 : 77, 11354 OP_PUSHDATA2: 77,
31220 OP_PUSHDATA4 : 78, 11355 OP_PUSHDATA4: 78,
31221 OP_1NEGATE : 79, 11356 OP_1NEGATE: 79,
31222 OP_RESERVED : 80, 11357 OP_RESERVED: 80,
31223 OP_1 : 81, 11358 OP_1: 81,
31224 OP_TRUE : 81, 11359 OP_TRUE: 81,
31225 OP_2 : 82, 11360 OP_2: 82,
31226 OP_3 : 83, 11361 OP_3: 83,
31227 OP_4 : 84, 11362 OP_4: 84,
31228 OP_5 : 85, 11363 OP_5: 85,
31229 OP_6 : 86, 11364 OP_6: 86,
31230 OP_7 : 87, 11365 OP_7: 87,
31231 OP_8 : 88, 11366 OP_8: 88,
31232 OP_9 : 89, 11367 OP_9: 89,
31233 OP_10 : 90, 11368 OP_10: 90,
31234 OP_11 : 91, 11369 OP_11: 91,
31235 OP_12 : 92, 11370 OP_12: 92,
31236 OP_13 : 93, 11371 OP_13: 93,
31237 OP_14 : 94, 11372 OP_14: 94,
31238 OP_15 : 95, 11373 OP_15: 95,
31239 OP_16 : 96, 11374 OP_16: 96,
31240 11375
31241 // control 11376 // control
31242 OP_NOP : 97, 11377 OP_NOP: 97,
31243 OP_VER : 98, 11378 OP_VER: 98,
31244 OP_IF : 99, 11379 OP_IF: 99,
31245 OP_NOTIF : 100, 11380 OP_NOTIF: 100,
31246 OP_VERIF : 101, 11381 OP_VERIF: 101,
31247 OP_VERNOTIF : 102, 11382 OP_VERNOTIF: 102,
31248 OP_ELSE : 103, 11383 OP_ELSE: 103,
31249 OP_ENDIF : 104, 11384 OP_ENDIF: 104,
31250 OP_VERIFY : 105, 11385 OP_VERIFY: 105,
31251 OP_RETURN : 106, 11386 OP_RETURN: 106,
31252 11387
31253 // stack ops 11388 // stack ops
31254 OP_TOALTSTACK : 107, 11389 OP_TOALTSTACK: 107,
31255 OP_FROMALTSTACK : 108, 11390 OP_FROMALTSTACK: 108,
31256 OP_2DROP : 109, 11391 OP_2DROP: 109,
31257 OP_2DUP : 110, 11392 OP_2DUP: 110,
31258 OP_3DUP : 111, 11393 OP_3DUP: 111,
31259 OP_2OVER : 112, 11394 OP_2OVER: 112,
31260 OP_2ROT : 113, 11395 OP_2ROT: 113,
31261 OP_2SWAP : 114, 11396 OP_2SWAP: 114,
31262 OP_IFDUP : 115, 11397 OP_IFDUP: 115,
31263 OP_DEPTH : 116, 11398 OP_DEPTH: 116,
31264 OP_DROP : 117, 11399 OP_DROP: 117,
31265 OP_DUP : 118, 11400 OP_DUP: 118,
31266 OP_NIP : 119, 11401 OP_NIP: 119,
31267 OP_OVER : 120, 11402 OP_OVER: 120,
31268 OP_PICK : 121, 11403 OP_PICK: 121,
31269 OP_ROLL : 122, 11404 OP_ROLL: 122,
31270 OP_ROT : 123, 11405 OP_ROT: 123,
31271 OP_SWAP : 124, 11406 OP_SWAP: 124,
31272 OP_TUCK : 125, 11407 OP_TUCK: 125,
31273 11408
31274 // splice ops 11409 // splice ops
31275 OP_CAT : 126, 11410 OP_CAT: 126,
31276 OP_SUBSTR : 127, 11411 OP_SUBSTR: 127,
31277 OP_LEFT : 128, 11412 OP_LEFT: 128,
31278 OP_RIGHT : 129, 11413 OP_RIGHT: 129,
31279 OP_SIZE : 130, 11414 OP_SIZE: 130,
31280 11415
31281 // bit logic 11416 // bit logic
31282 OP_INVERT : 131, 11417 OP_INVERT: 131,
31283 OP_AND : 132, 11418 OP_AND: 132,
31284 OP_OR : 133, 11419 OP_OR: 133,
31285 OP_XOR : 134, 11420 OP_XOR: 134,
31286 OP_EQUAL : 135, 11421 OP_EQUAL: 135,
31287 OP_EQUALVERIFY : 136, 11422 OP_EQUALVERIFY: 136,
31288 OP_RESERVED1 : 137, 11423 OP_RESERVED1: 137,
31289 OP_RESERVED2 : 138, 11424 OP_RESERVED2: 138,
31290 11425
31291 // numeric 11426 // numeric
31292 OP_1ADD : 139, 11427 OP_1ADD: 139,
31293 OP_1SUB : 140, 11428 OP_1SUB: 140,
31294 OP_2MUL : 141, 11429 OP_2MUL: 141,
31295 OP_2DIV : 142, 11430 OP_2DIV: 142,
31296 OP_NEGATE : 143, 11431 OP_NEGATE: 143,
31297 OP_ABS : 144, 11432 OP_ABS: 144,
31298 OP_NOT : 145, 11433 OP_NOT: 145,
31299 OP_0NOTEQUAL : 146, 11434 OP_0NOTEQUAL: 146,
31300 11435
31301 OP_ADD : 147, 11436 OP_ADD: 147,
31302 OP_SUB : 148, 11437 OP_SUB: 148,
31303 OP_MUL : 149, 11438 OP_MUL: 149,
31304 OP_DIV : 150, 11439 OP_DIV: 150,
31305 OP_MOD : 151, 11440 OP_MOD: 151,
31306 OP_LSHIFT : 152, 11441 OP_LSHIFT: 152,
31307 OP_RSHIFT : 153, 11442 OP_RSHIFT: 153,
31308 11443
31309 OP_BOOLAND : 154, 11444 OP_BOOLAND: 154,
31310 OP_BOOLOR : 155, 11445 OP_BOOLOR: 155,
31311 OP_NUMEQUAL : 156, 11446 OP_NUMEQUAL: 156,
31312 OP_NUMEQUALVERIFY : 157, 11447 OP_NUMEQUALVERIFY: 157,
31313 OP_NUMNOTEQUAL : 158, 11448 OP_NUMNOTEQUAL: 158,
31314 OP_LESSTHAN : 159, 11449 OP_LESSTHAN: 159,
31315 OP_GREATERTHAN : 160, 11450 OP_GREATERTHAN: 160,
31316 OP_LESSTHANOREQUAL : 161, 11451 OP_LESSTHANOREQUAL: 161,
31317 OP_GREATERTHANOREQUAL : 162, 11452 OP_GREATERTHANOREQUAL: 162,
31318 OP_MIN : 163, 11453 OP_MIN: 163,
31319 OP_MAX : 164, 11454 OP_MAX: 164,
31320 11455
31321 OP_WITHIN : 165, 11456 OP_WITHIN: 165,
31322 11457
31323 // crypto 11458 // crypto
31324 OP_RIPEMD160 : 166, 11459 OP_RIPEMD160: 166,
31325 OP_SHA1 : 167, 11460 OP_SHA1: 167,
31326 OP_SHA256 : 168, 11461 OP_SHA256: 168,
31327 OP_HASH160 : 169, 11462 OP_HASH160: 169,
31328 OP_HASH256 : 170, 11463 OP_HASH256: 170,
31329 OP_CODESEPARATOR : 171, 11464 OP_CODESEPARATOR: 171,
31330 OP_CHECKSIG : 172, 11465 OP_CHECKSIG: 172,
31331 OP_CHECKSIGVERIFY : 173, 11466 OP_CHECKSIGVERIFY: 173,
31332 OP_CHECKMULTISIG : 174, 11467 OP_CHECKMULTISIG: 174,
31333 OP_CHECKMULTISIGVERIFY : 175, 11468 OP_CHECKMULTISIGVERIFY: 175,
31334 11469
31335 // expansion 11470 // expansion
31336 OP_NOP1 : 176, 11471 OP_NOP1: 176,
31337 OP_NOP2 : 177, 11472 OP_NOP2: 177,
31338 OP_NOP3 : 178, 11473 OP_NOP3: 178,
31339 OP_NOP4 : 179, 11474 OP_NOP4: 179,
31340 OP_NOP5 : 180, 11475 OP_NOP5: 180,
31341 OP_NOP6 : 181, 11476 OP_NOP6: 181,
31342 OP_NOP7 : 182, 11477 OP_NOP7: 182,
31343 OP_NOP8 : 183, 11478 OP_NOP8: 183,
31344 OP_NOP9 : 184, 11479 OP_NOP9: 184,
31345 OP_NOP10 : 185, 11480 OP_NOP10: 185,
31346 11481
31347 // template matching params 11482 // template matching params
31348 OP_PUBKEYHASH : 253, 11483 OP_PUBKEYHASH: 253,
31349 OP_PUBKEY : 254, 11484 OP_PUBKEY: 254,
31350 OP_INVALIDOPCODE : 255 11485 OP_INVALIDOPCODE: 255
31351} 11486}
31352 11487
31353},{}],83:[function(_dereq_,module,exports){ 11488},{}],68:[function(require,module,exports){
31354(function (Buffer){ 11489(function (Buffer){
31355var assert = _dereq_('assert') 11490var assert = require('assert')
31356var bufferutils = _dereq_('./bufferutils') 11491var bufferutils = require('./bufferutils')
31357var crypto = _dereq_('./crypto') 11492var crypto = require('./crypto')
31358var opcodes = _dereq_('./opcodes') 11493var typeForce = require('typeforce')
11494var opcodes = require('./opcodes')
31359 11495
31360function Script(buffer, chunks) { 11496function Script (buffer, chunks) {
31361 assert(Buffer.isBuffer(buffer), 'Expected Buffer, got ' + buffer) 11497 typeForce('Buffer', buffer)
31362 assert(Array.isArray(chunks), 'Expected Array, got ' + chunks) 11498 typeForce('Array', chunks)
31363 11499
31364 this.buffer = buffer 11500 this.buffer = buffer
31365 this.chunks = chunks 11501 this.chunks = chunks
31366} 11502}
31367 11503
31368// Import operations 11504Script.fromASM = function (asm) {
31369Script.fromASM = function(asm) {
31370 var strChunks = asm.split(' ') 11505 var strChunks = asm.split(' ')
31371 11506 var chunks = strChunks.map(function (strChunk) {
31372 var chunks = strChunks.map(function(strChunk) { 11507 // opcode
31373 if (strChunk in opcodes) { 11508 if (strChunk in opcodes) {
31374 return opcodes[strChunk] 11509 return opcodes[strChunk]
31375 11510
11511 // data chunk
31376 } else { 11512 } else {
31377 return new Buffer(strChunk, 'hex') 11513 return new Buffer(strChunk, 'hex')
31378 } 11514 }
@@ -31381,23 +11517,30 @@ Script.fromASM = function(asm) {
31381 return Script.fromChunks(chunks) 11517 return Script.fromChunks(chunks)
31382} 11518}
31383 11519
31384Script.fromBuffer = function(buffer) { 11520Script.fromBuffer = function (buffer) {
31385 var chunks = [] 11521 var chunks = []
31386
31387 var i = 0 11522 var i = 0
31388 11523
31389 while (i < buffer.length) { 11524 while (i < buffer.length) {
31390 var opcode = buffer.readUInt8(i) 11525 var opcode = buffer.readUInt8(i)
31391 11526
11527 // data chunk
31392 if ((opcode > opcodes.OP_0) && (opcode <= opcodes.OP_PUSHDATA4)) { 11528 if ((opcode > opcodes.OP_0) && (opcode <= opcodes.OP_PUSHDATA4)) {
31393 var d = bufferutils.readPushDataInt(buffer, i) 11529 var d = bufferutils.readPushDataInt(buffer, i)
11530
11531 // did reading a pushDataInt fail? return non-chunked script
11532 if (d === null) return new Script(buffer, [])
31394 i += d.size 11533 i += d.size
31395 11534
11535 // attempt to read too much data?
11536 if (i + d.number > buffer.length) return new Script(buffer, [])
11537
31396 var data = buffer.slice(i, i + d.number) 11538 var data = buffer.slice(i, i + d.number)
31397 i += d.number 11539 i += d.number
31398 11540
31399 chunks.push(data) 11541 chunks.push(data)
31400 11542
11543 // opcode
31401 } else { 11544 } else {
31402 chunks.push(opcode) 11545 chunks.push(opcode)
31403 11546
@@ -31408,27 +11551,31 @@ Script.fromBuffer = function(buffer) {
31408 return new Script(buffer, chunks) 11551 return new Script(buffer, chunks)
31409} 11552}
31410 11553
31411Script.fromChunks = function(chunks) { 11554Script.fromChunks = function (chunks) {
31412 assert(Array.isArray(chunks), 'Expected Array, got ' + chunks) 11555 typeForce('Array', chunks)
31413 11556
31414 var bufferSize = chunks.reduce(function(accum, chunk) { 11557 var bufferSize = chunks.reduce(function (accum, chunk) {
11558 // data chunk
31415 if (Buffer.isBuffer(chunk)) { 11559 if (Buffer.isBuffer(chunk)) {
31416 return accum + bufferutils.pushDataSize(chunk.length) + chunk.length 11560 return accum + bufferutils.pushDataSize(chunk.length) + chunk.length
31417 } 11561 }
31418 11562
11563 // opcode
31419 return accum + 1 11564 return accum + 1
31420 }, 0.0) 11565 }, 0.0)
31421 11566
31422 var buffer = new Buffer(bufferSize) 11567 var buffer = new Buffer(bufferSize)
31423 var offset = 0 11568 var offset = 0
31424 11569
31425 chunks.forEach(function(chunk) { 11570 chunks.forEach(function (chunk) {
11571 // data chunk
31426 if (Buffer.isBuffer(chunk)) { 11572 if (Buffer.isBuffer(chunk)) {
31427 offset += bufferutils.writePushDataInt(buffer, chunk.length, offset) 11573 offset += bufferutils.writePushDataInt(buffer, chunk.length, offset)
31428 11574
31429 chunk.copy(buffer, offset) 11575 chunk.copy(buffer, offset)
31430 offset += chunk.length 11576 offset += chunk.length
31431 11577
11578 // opcode
31432 } else { 11579 } else {
31433 buffer.writeUInt8(chunk, offset) 11580 buffer.writeUInt8(chunk, offset)
31434 offset += 1 11581 offset += 1
@@ -31439,117 +11586,73 @@ Script.fromChunks = function(chunks) {
31439 return new Script(buffer, chunks) 11586 return new Script(buffer, chunks)
31440} 11587}
31441 11588
31442Script.fromHex = function(hex) { 11589Script.fromHex = function (hex) {
31443 return Script.fromBuffer(new Buffer(hex, 'hex')) 11590 return Script.fromBuffer(new Buffer(hex, 'hex'))
31444} 11591}
31445 11592
31446// Constants
31447Script.EMPTY = Script.fromChunks([]) 11593Script.EMPTY = Script.fromChunks([])
31448 11594
31449// Operations 11595Script.prototype.getHash = function () {
31450Script.prototype.getHash = function() {
31451 return crypto.hash160(this.buffer) 11596 return crypto.hash160(this.buffer)
31452} 11597}
31453 11598
31454// FIXME: doesn't work for data chunks, maybe time to use buffertools.compare... 11599// FIXME: doesn't work for data chunks, maybe time to use buffertools.compare...
31455Script.prototype.without = function(needle) { 11600Script.prototype.without = function (needle) {
31456 return Script.fromChunks(this.chunks.filter(function(op) { 11601 return Script.fromChunks(this.chunks.filter(function (op) {
31457 return op !== needle 11602 return op !== needle
31458 })) 11603 }))
31459} 11604}
31460 11605
31461// Export operations
31462var reverseOps = [] 11606var reverseOps = []
31463for (var op in opcodes) { 11607for (var op in opcodes) {
31464 var code = opcodes[op] 11608 var code = opcodes[op]
31465 reverseOps[code] = op 11609 reverseOps[code] = op
31466} 11610}
31467 11611
31468Script.prototype.toASM = function() { 11612Script.prototype.toASM = function () {
31469 return this.chunks.map(function(chunk) { 11613 return this.chunks.map(function (chunk) {
11614 // data chunk
31470 if (Buffer.isBuffer(chunk)) { 11615 if (Buffer.isBuffer(chunk)) {
31471 return chunk.toString('hex') 11616 return chunk.toString('hex')
31472 11617
11618 // opcode
31473 } else { 11619 } else {
31474 return reverseOps[chunk] 11620 return reverseOps[chunk]
31475 } 11621 }
31476 }).join(' ') 11622 }).join(' ')
31477} 11623}
31478 11624
31479Script.prototype.toBuffer = function() { 11625Script.prototype.toBuffer = function () {
31480 return this.buffer 11626 return this.buffer
31481} 11627}
31482 11628
31483Script.prototype.toHex = function() { 11629Script.prototype.toHex = function () {
31484 return this.toBuffer().toString('hex') 11630 return this.toBuffer().toString('hex')
31485} 11631}
31486 11632
31487module.exports = Script 11633module.exports = Script
31488 11634
31489}).call(this,_dereq_("buffer").Buffer) 11635}).call(this,require("buffer").Buffer)
31490},{"./bufferutils":71,"./crypto":73,"./opcodes":82,"assert":4,"buffer":8}],84:[function(_dereq_,module,exports){ 11636},{"./bufferutils":57,"./crypto":58,"./opcodes":67,"assert":5,"buffer":7,"typeforce":53}],69:[function(require,module,exports){
31491(function (Buffer){ 11637(function (Buffer){
31492var assert = _dereq_('assert') 11638var assert = require('assert')
31493var opcodes = _dereq_('./opcodes') 11639var ops = require('./opcodes')
11640var typeForce = require('typeforce')
31494 11641
31495// FIXME: use ECPubKey, currently the circular dependency breaks everything. 11642var ecurve = require('ecurve')
31496//
31497// Solutions:
31498// * Remove ECPubKey.getAddress
31499// - Minimal change, but likely unpopular
31500// * Move all script related functionality out of Address
31501// - Means a lot of changes to Transaction/Wallet
31502// * Ignore it (existing solution)
31503// * Some form of hackery with commonjs
31504//
31505var ecurve = _dereq_('ecurve')
31506var curve = ecurve.getCurveByName('secp256k1') 11643var curve = ecurve.getCurveByName('secp256k1')
31507 11644
31508var ECSignature = _dereq_('./ecsignature') 11645var ECSignature = require('./ecsignature')
31509var Script = _dereq_('./script') 11646var Script = require('./script')
31510 11647
31511function classifyOutput(script) { 11648function isCanonicalPubKey (buffer) {
31512 assert(script instanceof Script, 'Expected Script, got ', script)
31513
31514 if (isPubKeyHashOutput.call(script)) {
31515 return 'pubkeyhash'
31516 } else if (isScriptHashOutput.call(script)) {
31517 return 'scripthash'
31518 } else if (isMultisigOutput.call(script)) {
31519 return 'multisig'
31520 } else if (isPubKeyOutput.call(script)) {
31521 return 'pubkey'
31522 } else if (isNulldataOutput.call(script)) {
31523 return 'nulldata'
31524 } else {
31525 return 'nonstandard'
31526 }
31527}
31528
31529function classifyInput(script) {
31530 assert(script instanceof Script, 'Expected Script, got ', script)
31531
31532 if (isPubKeyHashInput.call(script)) {
31533 return 'pubkeyhash'
31534 } else if (isScriptHashInput.call(script)) {
31535 return 'scripthash'
31536 } else if (isMultisigInput.call(script)) {
31537 return 'multisig'
31538 } else if (isPubKeyInput.call(script)) {
31539 return 'pubkey'
31540 } else {
31541 return 'nonstandard'
31542 }
31543}
31544
31545function isCanonicalPubKey(buffer) {
31546 if (!Buffer.isBuffer(buffer)) return false 11649 if (!Buffer.isBuffer(buffer)) return false
31547 11650
31548 try { 11651 try {
31549 // FIXME: boo
31550 ecurve.Point.decodeFrom(curve, buffer) 11652 ecurve.Point.decodeFrom(curve, buffer)
31551 } catch (e) { 11653 } catch (e) {
31552 if (!(e.message.match(/Invalid sequence (length|tag)/))) throw e 11654 if (!(e.message.match(/Invalid sequence (length|tag)/)))
11655 throw e
31553 11656
31554 return false 11657 return false
31555 } 11658 }
@@ -31557,13 +11660,15 @@ function isCanonicalPubKey(buffer) {
31557 return true 11660 return true
31558} 11661}
31559 11662
31560function isCanonicalSignature(buffer) { 11663function isCanonicalSignature (buffer) {
31561 if (!Buffer.isBuffer(buffer)) return false 11664 if (!Buffer.isBuffer(buffer)) return false
31562 11665
31563 try { 11666 try {
31564 ECSignature.parseScriptSignature(buffer) 11667 ECSignature.parseScriptSignature(buffer)
31565 } catch(e) { 11668 } catch (e) {
31566 if (!(e.message.match(/Not a DER sequence|Invalid sequence length|Expected a DER integer|R length is zero|S length is zero|R value excessively padded|S value excessively padded|R value is negative|S value is negative|Invalid hashType/))) throw e 11669 if (!(e.message.match(/Not a DER sequence|Invalid sequence length|Expected a DER integer|R length is zero|S length is zero|R value excessively padded|S value excessively padded|R value is negative|S value is negative|Invalid hashType/))) {
11670 throw e
11671 }
31567 11672
31568 return false 11673 return false
31569 } 11674 }
@@ -31571,153 +11676,201 @@ function isCanonicalSignature(buffer) {
31571 return true 11676 return true
31572} 11677}
31573 11678
31574function isPubKeyHashInput() { 11679function isPubKeyHashInput (script) {
31575 return this.chunks.length === 2 && 11680 return script.chunks.length === 2 &&
31576 isCanonicalSignature(this.chunks[0]) && 11681 isCanonicalSignature(script.chunks[0]) &&
31577 isCanonicalPubKey(this.chunks[1]) 11682 isCanonicalPubKey(script.chunks[1])
31578} 11683}
31579 11684
31580function isPubKeyHashOutput() { 11685function isPubKeyHashOutput (script) {
31581 return this.chunks.length === 5 && 11686 return script.chunks.length === 5 &&
31582 this.chunks[0] === opcodes.OP_DUP && 11687 script.chunks[0] === ops.OP_DUP &&
31583 this.chunks[1] === opcodes.OP_HASH160 && 11688 script.chunks[1] === ops.OP_HASH160 &&
31584 Buffer.isBuffer(this.chunks[2]) && 11689 Buffer.isBuffer(script.chunks[2]) &&
31585 this.chunks[2].length === 20 && 11690 script.chunks[2].length === 20 &&
31586 this.chunks[3] === opcodes.OP_EQUALVERIFY && 11691 script.chunks[3] === ops.OP_EQUALVERIFY &&
31587 this.chunks[4] === opcodes.OP_CHECKSIG 11692 script.chunks[4] === ops.OP_CHECKSIG
31588} 11693}
31589 11694
31590function isPubKeyInput() { 11695function isPubKeyInput (script) {
31591 return this.chunks.length === 1 && 11696 return script.chunks.length === 1 &&
31592 isCanonicalSignature(this.chunks[0]) 11697 isCanonicalSignature(script.chunks[0])
31593} 11698}
31594 11699
31595function isPubKeyOutput() { 11700function isPubKeyOutput (script) {
31596 return this.chunks.length === 2 && 11701 return script.chunks.length === 2 &&
31597 isCanonicalPubKey(this.chunks[0]) && 11702 isCanonicalPubKey(script.chunks[0]) &&
31598 this.chunks[1] === opcodes.OP_CHECKSIG 11703 script.chunks[1] === ops.OP_CHECKSIG
31599} 11704}
31600 11705
31601function isScriptHashInput() { 11706function isScriptHashInput (script, allowIncomplete) {
31602 if (this.chunks.length < 2) return false 11707 if (script.chunks.length < 2) return false
31603 var lastChunk = this.chunks[this.chunks.length - 1]
31604 11708
11709 var lastChunk = script.chunks[script.chunks.length - 1]
31605 if (!Buffer.isBuffer(lastChunk)) return false 11710 if (!Buffer.isBuffer(lastChunk)) return false
31606 11711
31607 var scriptSig = Script.fromChunks(this.chunks.slice(0, -1)) 11712 var scriptSig = Script.fromChunks(script.chunks.slice(0, -1))
31608 var scriptPubKey = Script.fromBuffer(lastChunk) 11713 var redeemScript = Script.fromBuffer(lastChunk)
31609 11714
31610 return classifyInput(scriptSig) === classifyOutput(scriptPubKey) 11715 // is redeemScript a valid script?
11716 if (redeemScript.chunks.length === 0) return false
11717
11718 return classifyInput(scriptSig, allowIncomplete) === classifyOutput(redeemScript)
31611} 11719}
31612 11720
31613function isScriptHashOutput() { 11721function isScriptHashOutput (script) {
31614 return this.chunks.length === 3 && 11722 return script.chunks.length === 3 &&
31615 this.chunks[0] === opcodes.OP_HASH160 && 11723 script.chunks[0] === ops.OP_HASH160 &&
31616 Buffer.isBuffer(this.chunks[1]) && 11724 Buffer.isBuffer(script.chunks[1]) &&
31617 this.chunks[1].length === 20 && 11725 script.chunks[1].length === 20 &&
31618 this.chunks[2] === opcodes.OP_EQUAL 11726 script.chunks[2] === ops.OP_EQUAL
31619} 11727}
31620 11728
31621function isMultisigInput() { 11729// allowIncomplete is to account for combining signatures
31622 return this.chunks[0] === opcodes.OP_0 && 11730// See https://github.com/bitcoin/bitcoin/blob/f425050546644a36b0b8e0eb2f6934a3e0f6f80f/src/script/sign.cpp#L195-L197
31623 this.chunks.slice(1).every(isCanonicalSignature) 11731function isMultisigInput (script, allowIncomplete) {
11732 if (script.chunks.length < 2) return false
11733 if (script.chunks[0] !== ops.OP_0) return false
11734
11735 if (allowIncomplete) {
11736 return script.chunks.slice(1).every(function (chunk) {
11737 return chunk === ops.OP_0 || isCanonicalSignature(chunk)
11738 })
11739 }
11740
11741 return script.chunks.slice(1).every(isCanonicalSignature)
31624} 11742}
31625 11743
31626function isMultisigOutput() { 11744function isMultisigOutput (script) {
31627 if (this.chunks < 4) return false 11745 if (script.chunks.length < 4) return false
31628 if (this.chunks[this.chunks.length - 1] !== opcodes.OP_CHECKMULTISIG) return false 11746 if (script.chunks[script.chunks.length - 1] !== ops.OP_CHECKMULTISIG) return false
31629 11747
31630 var mOp = this.chunks[0] 11748 var mOp = script.chunks[0]
31631 if (mOp === opcodes.OP_0) return false 11749 if (mOp === ops.OP_0) return false
31632 if (mOp < opcodes.OP_1) return false 11750 if (mOp < ops.OP_1) return false
31633 if (mOp > opcodes.OP_16) return false 11751 if (mOp > ops.OP_16) return false
31634 11752
31635 var nOp = this.chunks[this.chunks.length - 2] 11753 var nOp = script.chunks[script.chunks.length - 2]
31636 if (nOp === opcodes.OP_0) return false 11754 if (nOp === ops.OP_0) return false
31637 if (nOp < opcodes.OP_1) return false 11755 if (nOp < ops.OP_1) return false
31638 if (nOp > opcodes.OP_16) return false 11756 if (nOp > ops.OP_16) return false
31639 11757
31640 var m = mOp - (opcodes.OP_1 - 1) 11758 var m = mOp - (ops.OP_1 - 1)
31641 var n = nOp - (opcodes.OP_1 - 1) 11759 var n = nOp - (ops.OP_1 - 1)
31642 if (n < m) return false 11760 if (n < m) return false
31643 11761
31644 var pubKeys = this.chunks.slice(1, -2) 11762 var pubKeys = script.chunks.slice(1, -2)
31645 if (n < pubKeys.length) return false 11763 if (n < pubKeys.length) return false
31646 11764
31647 return pubKeys.every(isCanonicalPubKey) 11765 return pubKeys.every(isCanonicalPubKey)
31648} 11766}
31649 11767
31650function isNulldataOutput() { 11768function isNullDataOutput (script) {
31651 return this.chunks[0] === opcodes.OP_RETURN 11769 return script.chunks[0] === ops.OP_RETURN
11770}
11771
11772function classifyOutput (script) {
11773 typeForce('Script', script)
11774
11775 if (isPubKeyHashOutput(script)) {
11776 return 'pubkeyhash'
11777 } else if (isScriptHashOutput(script)) {
11778 return 'scripthash'
11779 } else if (isMultisigOutput(script)) {
11780 return 'multisig'
11781 } else if (isPubKeyOutput(script)) {
11782 return 'pubkey'
11783 } else if (isNullDataOutput(script)) {
11784 return 'nulldata'
11785 }
11786
11787 return 'nonstandard'
11788}
11789
11790function classifyInput (script, allowIncomplete) {
11791 typeForce('Script', script)
11792
11793 if (isPubKeyHashInput(script)) {
11794 return 'pubkeyhash'
11795 } else if (isMultisigInput(script, allowIncomplete)) {
11796 return 'multisig'
11797 } else if (isScriptHashInput(script, allowIncomplete)) {
11798 return 'scripthash'
11799 } else if (isPubKeyInput(script)) {
11800 return 'pubkey'
11801 }
11802
11803 return 'nonstandard'
31652} 11804}
31653 11805
31654// Standard Script Templates 11806// Standard Script Templates
31655// {pubKey} OP_CHECKSIG 11807// {pubKey} OP_CHECKSIG
31656function pubKeyOutput(pubKey) { 11808function pubKeyOutput (pubKey) {
31657 return Script.fromChunks([ 11809 return Script.fromChunks([
31658 pubKey.toBuffer(), 11810 pubKey.toBuffer(),
31659 opcodes.OP_CHECKSIG 11811 ops.OP_CHECKSIG
31660 ]) 11812 ])
31661} 11813}
31662 11814
31663// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG 11815// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
31664function pubKeyHashOutput(hash) { 11816function pubKeyHashOutput (hash) {
31665 assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) 11817 typeForce('Buffer', hash)
31666 11818
31667 return Script.fromChunks([ 11819 return Script.fromChunks([
31668 opcodes.OP_DUP, 11820 ops.OP_DUP,
31669 opcodes.OP_HASH160, 11821 ops.OP_HASH160,
31670 hash, 11822 hash,
31671 opcodes.OP_EQUALVERIFY, 11823 ops.OP_EQUALVERIFY,
31672 opcodes.OP_CHECKSIG 11824 ops.OP_CHECKSIG
31673 ]) 11825 ])
31674} 11826}
31675 11827
31676// OP_HASH160 {scriptHash} OP_EQUAL 11828// OP_HASH160 {scriptHash} OP_EQUAL
31677function scriptHashOutput(hash) { 11829function scriptHashOutput (hash) {
31678 assert(Buffer.isBuffer(hash), 'Expected Buffer, got ' + hash) 11830 typeForce('Buffer', hash)
31679 11831
31680 return Script.fromChunks([ 11832 return Script.fromChunks([
31681 opcodes.OP_HASH160, 11833 ops.OP_HASH160,
31682 hash, 11834 hash,
31683 opcodes.OP_EQUAL 11835 ops.OP_EQUAL
31684 ]) 11836 ])
31685} 11837}
31686 11838
31687// m [pubKeys ...] n OP_CHECKMULTISIG 11839// m [pubKeys ...] n OP_CHECKMULTISIG
31688function multisigOutput(m, pubKeys) { 11840function multisigOutput (m, pubKeys) {
31689 assert(Array.isArray(pubKeys), 'Expected Array, got ' + pubKeys) 11841 typeForce(['ECPubKey'], pubKeys)
11842
31690 assert(pubKeys.length >= m, 'Not enough pubKeys provided') 11843 assert(pubKeys.length >= m, 'Not enough pubKeys provided')
31691 11844
31692 var pubKeyBuffers = pubKeys.map(function(pubKey) { 11845 var pubKeyBuffers = pubKeys.map(function (pubKey) {
31693 return pubKey.toBuffer() 11846 return pubKey.toBuffer()
31694 }) 11847 })
31695 var n = pubKeys.length 11848 var n = pubKeys.length
31696 11849
31697 return Script.fromChunks([].concat( 11850 return Script.fromChunks([].concat(
31698 (opcodes.OP_1 - 1) + m, 11851 (ops.OP_1 - 1) + m,
31699 pubKeyBuffers, 11852 pubKeyBuffers,
31700 (opcodes.OP_1 - 1) + n, 11853 (ops.OP_1 - 1) + n,
31701 opcodes.OP_CHECKMULTISIG 11854 ops.OP_CHECKMULTISIG
31702 )) 11855 ))
31703} 11856}
31704 11857
31705// {signature} 11858// {signature}
31706function pubKeyInput(signature) { 11859function pubKeyInput (signature) {
31707 assert(Buffer.isBuffer(signature), 'Expected Buffer, got ' + signature) 11860 typeForce('Buffer', signature)
31708 11861
31709 return Script.fromChunks([signature]) 11862 return Script.fromChunks([signature])
31710} 11863}
31711 11864
31712// {signature} {pubKey} 11865// {signature} {pubKey}
31713function pubKeyHashInput(signature, pubKey) { 11866function pubKeyHashInput (signature, pubKey) {
31714 assert(Buffer.isBuffer(signature), 'Expected Buffer, got ' + signature) 11867 typeForce('Buffer', signature)
31715 11868
31716 return Script.fromChunks([signature, pubKey.toBuffer()]) 11869 return Script.fromChunks([signature, pubKey.toBuffer()])
31717} 11870}
31718 11871
31719// <scriptSig> {serialized scriptPubKey script} 11872// <scriptSig> {serialized scriptPubKey script}
31720function scriptHashInput(scriptSig, scriptPubKey) { 11873function scriptHashInput (scriptSig, scriptPubKey) {
31721 return Script.fromChunks([].concat( 11874 return Script.fromChunks([].concat(
31722 scriptSig.chunks, 11875 scriptSig.chunks,
31723 scriptPubKey.toBuffer() 11876 scriptPubKey.toBuffer()
@@ -31725,44 +11878,75 @@ function scriptHashInput(scriptSig, scriptPubKey) {
31725} 11878}
31726 11879
31727// OP_0 [signatures ...] 11880// OP_0 [signatures ...]
31728function multisigInput(signatures, scriptPubKey) { 11881function multisigInput (signatures, scriptPubKey) {
31729 if (scriptPubKey) { 11882 if (scriptPubKey) {
31730 assert(isMultisigOutput.call(scriptPubKey)) 11883 assert(isMultisigOutput(scriptPubKey))
31731 11884
31732 var m = scriptPubKey.chunks[0] 11885 var mOp = scriptPubKey.chunks[0]
31733 var k = m - (opcodes.OP_1 - 1) 11886 var nOp = scriptPubKey.chunks[scriptPubKey.chunks.length - 2]
31734 assert(k <= signatures.length, 'Not enough signatures provided') 11887 var m = mOp - (ops.OP_1 - 1)
11888 var n = nOp - (ops.OP_1 - 1)
11889
11890 assert(signatures.length >= m, 'Not enough signatures provided')
11891 assert(signatures.length <= n, 'Too many signatures provided')
31735 } 11892 }
31736 11893
31737 return Script.fromChunks([].concat(opcodes.OP_0, signatures)) 11894 return Script.fromChunks([].concat(ops.OP_0, signatures))
11895}
11896
11897function nullDataOutput (data) {
11898 return Script.fromChunks([ops.OP_RETURN, data])
31738} 11899}
31739 11900
31740module.exports = { 11901module.exports = {
31741 classifyInput: classifyInput, 11902 isCanonicalPubKey: isCanonicalPubKey,
11903 isCanonicalSignature: isCanonicalSignature,
11904 isPubKeyHashInput: isPubKeyHashInput,
11905 isPubKeyHashOutput: isPubKeyHashOutput,
11906 isPubKeyInput: isPubKeyInput,
11907 isPubKeyOutput: isPubKeyOutput,
11908 isScriptHashInput: isScriptHashInput,
11909 isScriptHashOutput: isScriptHashOutput,
11910 isMultisigInput: isMultisigInput,
11911 isMultisigOutput: isMultisigOutput,
11912 isNullDataOutput: isNullDataOutput,
31742 classifyOutput: classifyOutput, 11913 classifyOutput: classifyOutput,
31743 multisigInput: multisigInput, 11914 classifyInput: classifyInput,
31744 multisigOutput: multisigOutput, 11915 pubKeyOutput: pubKeyOutput,
31745 pubKeyHashInput: pubKeyHashInput,
31746 pubKeyHashOutput: pubKeyHashOutput, 11916 pubKeyHashOutput: pubKeyHashOutput,
11917 scriptHashOutput: scriptHashOutput,
11918 multisigOutput: multisigOutput,
31747 pubKeyInput: pubKeyInput, 11919 pubKeyInput: pubKeyInput,
31748 pubKeyOutput: pubKeyOutput, 11920 pubKeyHashInput: pubKeyHashInput,
31749 scriptHashInput: scriptHashInput, 11921 scriptHashInput: scriptHashInput,
31750 scriptHashOutput: scriptHashOutput 11922 multisigInput: multisigInput,
11923 dataOutput: function (data) {
11924 console.warn('dataOutput is deprecated, use nullDataOutput by 2.0.0')
11925 return nullDataOutput(data)
11926 },
11927 nullDataOutput: nullDataOutput
31751} 11928}
31752 11929
31753}).call(this,_dereq_("buffer").Buffer) 11930}).call(this,require("buffer").Buffer)
31754},{"./ecsignature":77,"./opcodes":82,"./script":83,"assert":4,"buffer":8,"ecurve":65}],85:[function(_dereq_,module,exports){ 11931},{"./ecsignature":62,"./opcodes":67,"./script":68,"assert":5,"buffer":7,"ecurve":49,"typeforce":53}],70:[function(require,module,exports){
31755(function (Buffer){ 11932(function (Buffer){
31756var assert = _dereq_('assert') 11933var assert = require('assert')
31757var bufferutils = _dereq_('./bufferutils') 11934var bufferutils = require('./bufferutils')
31758var crypto = _dereq_('./crypto') 11935var crypto = require('./crypto')
31759var opcodes = _dereq_('./opcodes') 11936var typeForce = require('typeforce')
31760var scripts = _dereq_('./scripts') 11937var opcodes = require('./opcodes')
31761 11938var scripts = require('./scripts')
31762var Address = _dereq_('./address') 11939
31763var ECKey = _dereq_('./eckey') 11940var Address = require('./address')
31764var ECSignature = _dereq_('./ecsignature') 11941var ECSignature = require('./ecsignature')
31765var Script = _dereq_('./script') 11942var Script = require('./script')
11943
11944function Transaction () {
11945 this.version = 1
11946 this.locktime = 0
11947 this.ins = []
11948 this.outs = []
11949}
31766 11950
31767Transaction.DEFAULT_SEQUENCE = 0xffffffff 11951Transaction.DEFAULT_SEQUENCE = 0xffffffff
31768Transaction.SIGHASH_ALL = 0x01 11952Transaction.SIGHASH_ALL = 0x01
@@ -31770,15 +11954,92 @@ Transaction.SIGHASH_NONE = 0x02
31770Transaction.SIGHASH_SINGLE = 0x03 11954Transaction.SIGHASH_SINGLE = 0x03
31771Transaction.SIGHASH_ANYONECANPAY = 0x80 11955Transaction.SIGHASH_ANYONECANPAY = 0x80
31772 11956
31773function Transaction() { 11957Transaction.fromBuffer = function (buffer, __disableAssert) {
31774 this.version = 1 11958 var offset = 0
31775 this.locktime = 0 11959 function readSlice (n) {
31776 this.ins = [] 11960 offset += n
31777 this.outs = [] 11961 return buffer.slice(offset - n, offset)
11962 }
11963
11964 function readUInt32 () {
11965 var i = buffer.readUInt32LE(offset)
11966 offset += 4
11967 return i
11968 }
11969
11970 function readUInt64 () {
11971 var i = bufferutils.readUInt64LE(buffer, offset)
11972 offset += 8
11973 return i
11974 }
11975
11976 function readVarInt () {
11977 var vi = bufferutils.readVarInt(buffer, offset)
11978 offset += vi.size
11979 return vi.number
11980 }
11981
11982 function readScript () {
11983 return Script.fromBuffer(readSlice(readVarInt()))
11984 }
11985
11986 function readGenerationScript () {
11987 return new Script(readSlice(readVarInt()), [])
11988 }
11989
11990 var tx = new Transaction()
11991 tx.version = readUInt32()
11992
11993 var vinLen = readVarInt()
11994 for (var i = 0; i < vinLen; ++i) {
11995 var hash = readSlice(32)
11996
11997 if (Transaction.isCoinbaseHash(hash)) {
11998 tx.ins.push({
11999 hash: hash,
12000 index: readUInt32(),
12001 script: readGenerationScript(),
12002 sequence: readUInt32()
12003 })
12004 } else {
12005 tx.ins.push({
12006 hash: hash,
12007 index: readUInt32(),
12008 script: readScript(),
12009 sequence: readUInt32()
12010 })
12011 }
12012 }
12013
12014 var voutLen = readVarInt()
12015 for (i = 0; i < voutLen; ++i) {
12016 tx.outs.push({
12017 value: readUInt64(),
12018 script: readScript()
12019 })
12020 }
12021
12022 tx.locktime = readUInt32()
12023
12024 if (!__disableAssert) {
12025 assert.equal(offset, buffer.length, 'Transaction has unexpected data')
12026 }
12027
12028 return tx
12029}
12030
12031Transaction.fromHex = function (hex) {
12032 return Transaction.fromBuffer(new Buffer(hex, 'hex'))
12033}
12034
12035Transaction.isCoinbaseHash = function (buffer) {
12036 return Array.prototype.every.call(buffer, function (x) {
12037 return x === 0
12038 })
31778} 12039}
31779 12040
31780/** 12041/**
31781 * Create a new txin. 12042 * Create a new txIn.
31782 * 12043 *
31783 * Can be called with any of: 12044 * Can be called with any of:
31784 * 12045 *
@@ -31787,38 +12048,38 @@ function Transaction() {
31787 * 12048 *
31788 * Note that this method does not sign the created input. 12049 * Note that this method does not sign the created input.
31789 */ 12050 */
31790Transaction.prototype.addInput = function(tx, index, sequence) { 12051Transaction.prototype.addInput = function (hash, index, sequence, script) {
31791 if (sequence == undefined) sequence = Transaction.DEFAULT_SEQUENCE 12052 if (sequence === undefined || sequence === null) {
31792 12053 sequence = Transaction.DEFAULT_SEQUENCE
31793 var hash 12054 }
31794 12055
31795 if (typeof tx === 'string') { 12056 script = script || Script.EMPTY
31796 hash = new Buffer(tx, 'hex')
31797 12057
12058 if (typeof hash === 'string') {
31798 // TxId hex is big-endian, we need little-endian 12059 // TxId hex is big-endian, we need little-endian
31799 Array.prototype.reverse.call(hash) 12060 hash = bufferutils.reverse(new Buffer(hash, 'hex'))
31800 12061 } else if (hash instanceof Transaction) {
31801 } else if (tx instanceof Transaction) { 12062 hash = hash.getHash()
31802 hash = tx.getHash()
31803
31804 } else {
31805 hash = tx
31806 } 12063 }
31807 12064
31808 assert(Buffer.isBuffer(hash), 'Expected Transaction, txId or txHash, got ' + tx) 12065 typeForce('Buffer', hash)
12066 typeForce('Number', index)
12067 typeForce('Number', sequence)
12068 typeForce('Script', script)
12069
31809 assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length) 12070 assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length)
31810 assert.equal(typeof index, 'number', 'Expected number index, got ' + index)
31811 12071
12072 // Add the input and return the input's index
31812 return (this.ins.push({ 12073 return (this.ins.push({
31813 hash: hash, 12074 hash: hash,
31814 index: index, 12075 index: index,
31815 script: Script.EMPTY, 12076 script: script,
31816 sequence: sequence 12077 sequence: sequence
31817 }) - 1) 12078 }) - 1)
31818} 12079}
31819 12080
31820/** 12081/**
31821 * Create a new txout. 12082 * Create a new txOut.
31822 * 12083 *
31823 * Can be called with: 12084 * Can be called with:
31824 * 12085 *
@@ -31826,7 +12087,7 @@ Transaction.prototype.addInput = function(tx, index, sequence) {
31826 * - An Address object and a value 12087 * - An Address object and a value
31827 * - A scriptPubKey Script and a value 12088 * - A scriptPubKey Script and a value
31828 */ 12089 */
31829Transaction.prototype.addOutput = function(scriptPubKey, value) { 12090Transaction.prototype.addOutput = function (scriptPubKey, value) {
31830 // Attempt to get a valid address if it's a base58 address string 12091 // Attempt to get a valid address if it's a base58 address string
31831 if (typeof scriptPubKey === 'string') { 12092 if (typeof scriptPubKey === 'string') {
31832 scriptPubKey = Address.fromBase58Check(scriptPubKey) 12093 scriptPubKey = Address.fromBase58Check(scriptPubKey)
@@ -31834,77 +12095,41 @@ Transaction.prototype.addOutput = function(scriptPubKey, value) {
31834 12095
31835 // Attempt to get a valid script if it's an Address object 12096 // Attempt to get a valid script if it's an Address object
31836 if (scriptPubKey instanceof Address) { 12097 if (scriptPubKey instanceof Address) {
31837 var address = scriptPubKey 12098 scriptPubKey = scriptPubKey.toOutputScript()
31838
31839 scriptPubKey = address.toOutputScript()
31840 } 12099 }
31841 12100
12101 typeForce('Script', scriptPubKey)
12102 typeForce('Number', value)
12103
12104 // Add the output and return the output's index
31842 return (this.outs.push({ 12105 return (this.outs.push({
31843 script: scriptPubKey, 12106 script: scriptPubKey,
31844 value: value, 12107 value: value
31845 }) - 1) 12108 }) - 1)
31846} 12109}
31847 12110
31848Transaction.prototype.toBuffer = function () { 12111Transaction.prototype.clone = function () {
31849 var txInSize = this.ins.reduce(function(a, x) { 12112 var newTx = new Transaction()
31850 return a + (40 + bufferutils.varIntSize(x.script.buffer.length) + x.script.buffer.length) 12113 newTx.version = this.version
31851 }, 0) 12114 newTx.locktime = this.locktime
31852
31853 var txOutSize = this.outs.reduce(function(a, x) {
31854 return a + (8 + bufferutils.varIntSize(x.script.buffer.length) + x.script.buffer.length)
31855 }, 0)
31856
31857 var buffer = new Buffer(
31858 8 +
31859 bufferutils.varIntSize(this.ins.length) +
31860 bufferutils.varIntSize(this.outs.length) +
31861 txInSize +
31862 txOutSize
31863 )
31864
31865 var offset = 0
31866 function writeSlice(slice) {
31867 slice.copy(buffer, offset)
31868 offset += slice.length
31869 }
31870 function writeUInt32(i) {
31871 buffer.writeUInt32LE(i, offset)
31872 offset += 4
31873 }
31874 function writeUInt64(i) {
31875 bufferutils.writeUInt64LE(buffer, i, offset)
31876 offset += 8
31877 }
31878 function writeVarInt(i) {
31879 var n = bufferutils.writeVarInt(buffer, i, offset)
31880 offset += n
31881 }
31882
31883 writeUInt32(this.version)
31884 writeVarInt(this.ins.length)
31885 12115
31886 this.ins.forEach(function(txin) { 12116 newTx.ins = this.ins.map(function (txIn) {
31887 writeSlice(txin.hash) 12117 return {
31888 writeUInt32(txin.index) 12118 hash: txIn.hash,
31889 writeVarInt(txin.script.buffer.length) 12119 index: txIn.index,
31890 writeSlice(txin.script.buffer) 12120 script: txIn.script,
31891 writeUInt32(txin.sequence) 12121 sequence: txIn.sequence
12122 }
31892 }) 12123 })
31893 12124
31894 writeVarInt(this.outs.length) 12125 newTx.outs = this.outs.map(function (txOut) {
31895 this.outs.forEach(function(txout) { 12126 return {
31896 writeUInt64(txout.value) 12127 script: txOut.script,
31897 writeVarInt(txout.script.buffer.length) 12128 value: txOut.value
31898 writeSlice(txout.script.buffer) 12129 }
31899 }) 12130 })
31900 12131
31901 writeUInt32(this.locktime) 12132 return newTx
31902
31903 return buffer
31904}
31905
31906Transaction.prototype.toHex = function() {
31907 return this.toBuffer().toString('hex')
31908} 12133}
31909 12134
31910/** 12135/**
@@ -31915,27 +12140,39 @@ Transaction.prototype.toHex = function() {
31915 * hashType, serializes and finally hashes the result. This hash can then be 12140 * hashType, serializes and finally hashes the result. This hash can then be
31916 * used to sign the transaction input in question. 12141 * used to sign the transaction input in question.
31917 */ 12142 */
31918Transaction.prototype.hashForSignature = function(prevOutScript, inIndex, hashType) { 12143Transaction.prototype.hashForSignature = function (inIndex, prevOutScript, hashType) {
12144 // FIXME: remove in 2.x.y
12145 if (arguments[0] instanceof Script) {
12146 console.warn('hashForSignature(prevOutScript, inIndex, ...) has been deprecated. Use hashForSignature(inIndex, prevOutScript, ...)')
12147
12148 // swap the arguments (must be stored in tmp, arguments is special)
12149 var tmp = arguments[0]
12150 inIndex = arguments[1]
12151 prevOutScript = tmp
12152 }
12153
12154 typeForce('Number', inIndex)
12155 typeForce('Script', prevOutScript)
12156 typeForce('Number', hashType)
12157
31919 assert(inIndex >= 0, 'Invalid vin index') 12158 assert(inIndex >= 0, 'Invalid vin index')
31920 assert(inIndex < this.ins.length, 'Invalid vin index') 12159 assert(inIndex < this.ins.length, 'Invalid vin index')
31921 assert(prevOutScript instanceof Script, 'Invalid Script object')
31922 12160
31923 var txTmp = this.clone() 12161 var txTmp = this.clone()
31924 var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR) 12162 var hashScript = prevOutScript.without(opcodes.OP_CODESEPARATOR)
31925 12163
31926 // Blank out other inputs' signatures 12164 // Blank out other inputs' signatures
31927 txTmp.ins.forEach(function(txin) { 12165 txTmp.ins.forEach(function (txIn) {
31928 txin.script = Script.EMPTY 12166 txIn.script = Script.EMPTY
31929 }) 12167 })
31930 txTmp.ins[inIndex].script = hashScript 12168 txTmp.ins[inIndex].script = hashScript
31931 12169
31932 var hashTypeModifier = hashType & 0x1f 12170 var hashTypeModifier = hashType & 0x1f
12171
31933 if (hashTypeModifier === Transaction.SIGHASH_NONE) { 12172 if (hashTypeModifier === Transaction.SIGHASH_NONE) {
31934 assert(false, 'SIGHASH_NONE not yet supported') 12173 assert(false, 'SIGHASH_NONE not yet supported')
31935
31936 } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) { 12174 } else if (hashTypeModifier === Transaction.SIGHASH_SINGLE) {
31937 assert(false, 'SIGHASH_SINGLE not yet supported') 12175 assert(false, 'SIGHASH_SINGLE not yet supported')
31938
31939 } 12176 }
31940 12177
31941 if (hashType & Transaction.SIGHASH_ANYONECANPAY) { 12178 if (hashType & Transaction.SIGHASH_ANYONECANPAY) {
@@ -31954,451 +12191,903 @@ Transaction.prototype.getHash = function () {
31954} 12191}
31955 12192
31956Transaction.prototype.getId = function () { 12193Transaction.prototype.getId = function () {
31957 var buffer = this.getHash() 12194 // TxHash is little-endian, we need big-endian
31958 12195 return bufferutils.reverse(this.getHash()).toString('hex')
31959 // Big-endian is used for TxHash
31960 Array.prototype.reverse.call(buffer)
31961
31962 return buffer.toString('hex')
31963} 12196}
31964 12197
31965Transaction.prototype.clone = function () { 12198Transaction.prototype.toBuffer = function () {
31966 var newTx = new Transaction() 12199 function scriptSize (script) {
31967 newTx.version = this.version 12200 var length = script.buffer.length
31968 newTx.locktime = this.locktime
31969
31970 newTx.ins = this.ins.map(function(txin) {
31971 return {
31972 hash: txin.hash,
31973 index: txin.index,
31974 script: txin.script,
31975 sequence: txin.sequence
31976 }
31977 })
31978 12201
31979 newTx.outs = this.outs.map(function(txout) { 12202 return bufferutils.varIntSize(length) + length
31980 return { 12203 }
31981 script: txout.script,
31982 value: txout.value
31983 }
31984 })
31985 12204
31986 return newTx 12205 var buffer = new Buffer(
31987} 12206 8 +
12207 bufferutils.varIntSize(this.ins.length) +
12208 bufferutils.varIntSize(this.outs.length) +
12209 this.ins.reduce(function (sum, input) { return sum + 40 + scriptSize(input.script) }, 0) +
12210 this.outs.reduce(function (sum, output) { return sum + 8 + scriptSize(output.script) }, 0)
12211 )
31988 12212
31989Transaction.fromBuffer = function(buffer) {
31990 var offset = 0 12213 var offset = 0
31991 function readSlice(n) { 12214 function writeSlice (slice) {
31992 offset += n 12215 slice.copy(buffer, offset)
31993 return buffer.slice(offset - n, offset) 12216 offset += slice.length
31994 } 12217 }
31995 function readUInt32() { 12218
31996 var i = buffer.readUInt32LE(offset) 12219 function writeUInt32 (i) {
12220 buffer.writeUInt32LE(i, offset)
31997 offset += 4 12221 offset += 4
31998 return i
31999 } 12222 }
32000 function readUInt64() { 12223
32001 var i = bufferutils.readUInt64LE(buffer, offset) 12224 function writeUInt64 (i) {
12225 bufferutils.writeUInt64LE(buffer, i, offset)
32002 offset += 8 12226 offset += 8
32003 return i
32004 } 12227 }
32005 function readVarInt() { 12228
32006 var vi = bufferutils.readVarInt(buffer, offset) 12229 function writeVarInt (i) {
32007 offset += vi.size 12230 var n = bufferutils.writeVarInt(buffer, i, offset)
32008 return vi.number 12231 offset += n
32009 } 12232 }
32010 12233
32011 var tx = new Transaction() 12234 writeUInt32(this.version)
32012 tx.version = readUInt32() 12235 writeVarInt(this.ins.length)
32013 12236
32014 var vinLen = readVarInt() 12237 this.ins.forEach(function (txIn) {
32015 for (var i = 0; i < vinLen; ++i) { 12238 writeSlice(txIn.hash)
32016 var hash = readSlice(32) 12239 writeUInt32(txIn.index)
32017 var vout = readUInt32() 12240 writeVarInt(txIn.script.buffer.length)
32018 var scriptLen = readVarInt() 12241 writeSlice(txIn.script.buffer)
32019 var script = readSlice(scriptLen) 12242 writeUInt32(txIn.sequence)
32020 var sequence = readUInt32() 12243 })
32021
32022 tx.ins.push({
32023 hash: hash,
32024 index: vout,
32025 script: Script.fromBuffer(script),
32026 sequence: sequence
32027 })
32028 }
32029 12244
32030 var voutLen = readVarInt() 12245 writeVarInt(this.outs.length)
32031 for (i = 0; i < voutLen; ++i) { 12246 this.outs.forEach(function (txOut) {
32032 var value = readUInt64() 12247 writeUInt64(txOut.value)
32033 var scriptLen = readVarInt() 12248 writeVarInt(txOut.script.buffer.length)
32034 var script = readSlice(scriptLen) 12249 writeSlice(txOut.script.buffer)
12250 })
32035 12251
32036 tx.outs.push({ 12252 writeUInt32(this.locktime)
32037 value: value,
32038 script: Script.fromBuffer(script)
32039 })
32040 }
32041 12253
32042 tx.locktime = readUInt32() 12254 return buffer
32043 assert.equal(offset, buffer.length, 'Transaction has unexpected data') 12255}
32044 12256
32045 return tx 12257Transaction.prototype.toHex = function () {
12258 return this.toBuffer().toString('hex')
32046} 12259}
32047 12260
32048Transaction.fromHex = function(hex) { 12261Transaction.prototype.setInputScript = function (index, script) {
32049 return Transaction.fromBuffer(new Buffer(hex, 'hex')) 12262 typeForce('Number', index)
12263 typeForce('Script', script)
12264
12265 this.ins[index].script = script
32050} 12266}
32051 12267
32052/** 12268// FIXME: remove in 2.x.y
32053 * Signs a pubKeyHash output at some index with the given key 12269Transaction.prototype.sign = function (index, privKey, hashType) {
32054 */ 12270 console.warn('Transaction.prototype.sign is deprecated. Use TransactionBuilder instead.')
32055Transaction.prototype.sign = function(index, privKey, hashType) { 12271
32056 var prevOutScript = privKey.pub.getAddress().toOutputScript() 12272 var prevOutScript = privKey.pub.getAddress().toOutputScript()
32057 var signature = this.signInput(index, prevOutScript, privKey, hashType) 12273 var signature = this.signInput(index, prevOutScript, privKey, hashType)
32058 12274
32059 // FIXME: Assumed prior TX was pay-to-pubkey-hash
32060 var scriptSig = scripts.pubKeyHashInput(signature, privKey.pub) 12275 var scriptSig = scripts.pubKeyHashInput(signature, privKey.pub)
32061 this.setInputScript(index, scriptSig) 12276 this.setInputScript(index, scriptSig)
32062} 12277}
32063 12278
32064Transaction.prototype.signInput = function(index, prevOutScript, privKey, hashType) { 12279// FIXME: remove in 2.x.y
12280Transaction.prototype.signInput = function (index, prevOutScript, privKey, hashType) {
12281 console.warn('Transaction.prototype.signInput is deprecated. Use TransactionBuilder instead.')
12282
32065 hashType = hashType || Transaction.SIGHASH_ALL 12283 hashType = hashType || Transaction.SIGHASH_ALL
32066 12284
32067 var hash = this.hashForSignature(prevOutScript, index, hashType) 12285 var hash = this.hashForSignature(index, prevOutScript, hashType)
32068 var signature = privKey.sign(hash) 12286 var signature = privKey.sign(hash)
32069 12287
32070 return signature.toScriptSignature(hashType) 12288 return signature.toScriptSignature(hashType)
32071} 12289}
32072 12290
32073Transaction.prototype.setInputScript = function(index, script) { 12291// FIXME: remove in 2.x.y
32074 this.ins[index].script = script 12292Transaction.prototype.validateInput = function (index, prevOutScript, pubKey, buffer) {
32075} 12293 console.warn('Transaction.prototype.validateInput is deprecated. Use TransactionBuilder instead.')
32076 12294
32077// FIXME: could be validateInput(index, prevTxOut, pub)
32078Transaction.prototype.validateInput = function(index, prevOutScript, pubKey, buffer) {
32079 var parsed = ECSignature.parseScriptSignature(buffer) 12295 var parsed = ECSignature.parseScriptSignature(buffer)
32080 var hash = this.hashForSignature(prevOutScript, index, parsed.hashType) 12296 var hash = this.hashForSignature(index, prevOutScript, parsed.hashType)
32081 12297
32082 return pubKey.verify(hash, parsed.signature) 12298 return pubKey.verify(hash, parsed.signature)
32083} 12299}
32084 12300
32085module.exports = Transaction 12301module.exports = Transaction
32086 12302
32087}).call(this,_dereq_("buffer").Buffer) 12303}).call(this,require("buffer").Buffer)
32088},{"./address":69,"./bufferutils":71,"./crypto":73,"./eckey":75,"./ecsignature":77,"./opcodes":82,"./script":83,"./scripts":84,"assert":4,"buffer":8}],86:[function(_dereq_,module,exports){ 12304},{"./address":54,"./bufferutils":57,"./crypto":58,"./ecsignature":62,"./opcodes":67,"./script":68,"./scripts":69,"assert":5,"buffer":7,"typeforce":53}],71:[function(require,module,exports){
32089(function (Buffer){ 12305(function (Buffer){
32090var assert = _dereq_('assert') 12306var assert = require('assert')
32091var networks = _dereq_('./networks') 12307var ops = require('./opcodes')
32092var rng = _dereq_('secure-random') 12308var scripts = require('./scripts')
12309
12310var ECPubKey = require('./ecpubkey')
12311var ECSignature = require('./ecsignature')
12312var Script = require('./script')
12313var Transaction = require('./transaction')
12314
12315function extractInput (txIn) {
12316 var redeemScript
12317 var scriptSig = txIn.script
12318 var prevOutScript
12319 var prevOutType = scripts.classifyInput(scriptSig, true)
12320 var scriptType
12321
12322 // Re-classify if scriptHash
12323 if (prevOutType === 'scripthash') {
12324 redeemScript = Script.fromBuffer(scriptSig.chunks.slice(-1)[0])
12325 prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())
12326
12327 scriptSig = Script.fromChunks(scriptSig.chunks.slice(0, -1))
12328 scriptType = scripts.classifyInput(scriptSig, true)
12329 } else {
12330 scriptType = prevOutType
12331 }
32093 12332
32094var Address = _dereq_('./address') 12333 // Extract hashType, pubKeys and signatures
32095var HDNode = _dereq_('./hdnode') 12334 var hashType, parsed, pubKeys, signatures
32096var Transaction = _dereq_('./transaction')
32097 12335
32098function Wallet(seed, network) { 12336 switch (scriptType) {
32099 network = network || networks.bitcoin 12337 case 'pubkeyhash': {
12338 parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])
12339 hashType = parsed.hashType
12340 pubKeys = [ECPubKey.fromBuffer(scriptSig.chunks[1])]
12341 signatures = [parsed.signature]
12342 prevOutScript = pubKeys[0].getAddress().toOutputScript()
32100 12343
32101 // Stored in a closure to make accidental serialization less likely 12344 break
32102 var masterkey = null 12345 }
32103 var me = this
32104 var accountZero = null
32105 var internalAccount = null
32106 var externalAccount = null
32107 12346
32108 // Addresses 12347 case 'pubkey': {
32109 this.addresses = [] 12348 parsed = ECSignature.parseScriptSignature(scriptSig.chunks[0])
32110 this.changeAddresses = [] 12349 hashType = parsed.hashType
12350 signatures = [parsed.signature]
32111 12351
32112 // Transaction output data 12352 if (redeemScript) {
32113 this.outputs = {} 12353 pubKeys = [ECPubKey.fromBuffer(redeemScript.chunks[0])]
12354 }
32114 12355
32115 // Make a new master key 12356 break
32116 this.newMasterKey = function(seed) { 12357 }
32117 seed = seed || new Buffer(rng(32))
32118 masterkey = HDNode.fromSeedBuffer(seed, network)
32119 12358
32120 // HD first-level child derivation method should be hardened 12359 case 'multisig': {
32121 // See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254 12360 signatures = scriptSig.chunks.slice(1).map(function (chunk) {
32122 accountZero = masterkey.deriveHardened(0) 12361 if (chunk === ops.OP_0) return chunk
32123 externalAccount = accountZero.derive(0)
32124 internalAccount = accountZero.derive(1)
32125 12362
32126 me.addresses = [] 12363 var parsed = ECSignature.parseScriptSignature(chunk)
32127 me.changeAddresses = [] 12364 hashType = parsed.hashType
32128 12365
32129 me.outputs = {} 12366 return parsed.signature
32130 } 12367 })
32131 12368
32132 this.newMasterKey(seed) 12369 if (redeemScript) {
12370 pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)
12371 }
32133 12372
32134 this.generateAddress = function() { 12373 break
32135 var key = externalAccount.derive(this.addresses.length) 12374 }
32136 this.addresses.push(key.getAddress().toString())
32137 return this.addresses[this.addresses.length - 1]
32138 } 12375 }
32139 12376
32140 this.generateChangeAddress = function() { 12377 return {
32141 var key = internalAccount.derive(this.changeAddresses.length) 12378 hashType: hashType,
32142 this.changeAddresses.push(key.getAddress().toString()) 12379 prevOutScript: prevOutScript,
32143 return this.changeAddresses[this.changeAddresses.length - 1] 12380 prevOutType: prevOutType,
12381 pubKeys: pubKeys,
12382 redeemScript: redeemScript,
12383 scriptType: scriptType,
12384 signatures: signatures
32144 } 12385 }
12386}
12387
12388function TransactionBuilder () {
12389 this.prevTxMap = {}
12390 this.prevOutScripts = {}
12391 this.prevOutTypes = {}
12392
12393 this.inputs = []
12394 this.tx = new Transaction()
12395}
12396
12397TransactionBuilder.fromTransaction = function (transaction) {
12398 var txb = new TransactionBuilder()
12399
12400 // Copy other transaction fields
12401 txb.tx.version = transaction.version
12402 txb.tx.locktime = transaction.locktime
12403
12404 // Extract/add inputs
12405 transaction.ins.forEach(function (txIn) {
12406 txb.addInput(txIn.hash, txIn.index, txIn.sequence)
12407 })
12408
12409 // Extract/add outputs
12410 transaction.outs.forEach(function (txOut) {
12411 txb.addOutput(txOut.script, txOut.value)
12412 })
12413
12414 // Extract/add signatures
12415 txb.inputs = transaction.ins.map(function (txIn) {
12416 // TODO: remove me after testcase added
12417 assert(!Transaction.isCoinbaseHash(txIn.hash), 'coinbase inputs not supported')
12418
12419 // Ignore empty scripts
12420 if (txIn.script.buffer.length === 0) return {}
12421
12422 return extractInput(txIn)
12423 })
32145 12424
32146 this.getBalance = function() { 12425 return txb
32147 return this.getUnspentOutputs().reduce(function(memo, output){ 12426}
32148 return memo + output.value 12427
32149 }, 0) 12428TransactionBuilder.prototype.addInput = function (prevTx, index, sequence, prevOutScript) {
12429 var prevOutHash
12430
12431 // txId
12432 if (typeof prevTx === 'string') {
12433 prevOutHash = new Buffer(prevTx, 'hex')
12434
12435 // TxId hex is big-endian, we want little-endian hash
12436 Array.prototype.reverse.call(prevOutHash)
12437
12438 // Transaction
12439 } else if (prevTx instanceof Transaction) {
12440 prevOutHash = prevTx.getHash()
12441 prevOutScript = prevTx.outs[index].script
12442
12443 // txHash
12444 } else {
12445 prevOutHash = prevTx
32150 } 12446 }
32151 12447
32152 this.getUnspentOutputs = function() { 12448 var input = {}
32153 var utxo = [] 12449 if (prevOutScript) {
12450 var prevOutType = scripts.classifyOutput(prevOutScript)
32154 12451
32155 for(var key in this.outputs){ 12452 // if we can, extract pubKey information
32156 var output = this.outputs[key] 12453 switch (prevOutType) {
32157 if(!output.to) utxo.push(outputToUnspentOutput(output)) 12454 case 'multisig': {
12455 input.pubKeys = prevOutScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)
12456 break
12457 }
12458
12459 case 'pubkey': {
12460 input.pubKeys = prevOutScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)
12461 break
12462 }
32158 } 12463 }
32159 12464
32160 return utxo 12465 if (prevOutType !== 'scripthash') {
12466 input.scriptType = prevOutType
12467 }
12468
12469 input.prevOutScript = prevOutScript
12470 input.prevOutType = prevOutType
32161 } 12471 }
32162 12472
32163 this.setUnspentOutputs = function(utxo) { 12473 assert(this.inputs.every(function (input2) {
32164 var outputs = {} 12474 if (input2.hashType === undefined) return true
32165 12475
32166 utxo.forEach(function(uo){ 12476 return input2.hashType & Transaction.SIGHASH_ANYONECANPAY
32167 validateUnspentOutput(uo) 12477 }), 'No, this would invalidate signatures')
32168 var o = unspentOutputToOutput(uo)
32169 outputs[o.from] = o
32170 })
32171 12478
32172 this.outputs = outputs 12479 var prevOut = prevOutHash.toString('hex') + ':' + index
32173 } 12480 assert(!(prevOut in this.prevTxMap), 'Transaction is already an input')
32174 12481
32175 function outputToUnspentOutput(output){ 12482 var vin = this.tx.addInput(prevOutHash, index, sequence)
32176 var hashAndIndex = output.from.split(":") 12483 this.inputs[vin] = input
12484 this.prevTxMap[prevOut] = vin
32177 12485
32178 return { 12486 return vin
32179 hash: hashAndIndex[0], 12487}
32180 outputIndex: parseInt(hashAndIndex[1]), 12488
32181 address: output.address, 12489TransactionBuilder.prototype.addOutput = function (scriptPubKey, value) {
32182 value: output.value, 12490 assert(this.inputs.every(function (input) {
32183 pending: output.pending 12491 if (input.hashType === undefined) return true
32184 } 12492
12493 return (input.hashType & 0x1f) === Transaction.SIGHASH_SINGLE
12494 }), 'No, this would invalidate signatures')
12495
12496 return this.tx.addOutput(scriptPubKey, value)
12497}
12498
12499TransactionBuilder.prototype.build = function () {
12500 return this.__build(false)
12501}
12502TransactionBuilder.prototype.buildIncomplete = function () {
12503 return this.__build(true)
12504}
12505
12506var canSignTypes = {
12507 'pubkeyhash': true,
12508 'multisig': true,
12509 'pubkey': true
12510}
12511
12512TransactionBuilder.prototype.__build = function (allowIncomplete) {
12513 if (!allowIncomplete) {
12514 assert(this.tx.ins.length > 0, 'Transaction has no inputs')
12515 assert(this.tx.outs.length > 0, 'Transaction has no outputs')
32185 } 12516 }
32186 12517
32187 function unspentOutputToOutput(o) { 12518 var tx = this.tx.clone()
32188 var hash = o.hash 12519
32189 var key = hash + ":" + o.outputIndex 12520 // Create script signatures from signature meta-data
32190 return { 12521 this.inputs.forEach(function (input, index) {
32191 from: key, 12522 var scriptType = input.scriptType
32192 address: o.address, 12523 var scriptSig
32193 value: o.value, 12524
32194 pending: o.pending 12525 if (!allowIncomplete) {
12526 assert(!!scriptType, 'Transaction is not complete')
12527 assert(scriptType in canSignTypes, scriptType + ' not supported')
12528 assert(input.signatures, 'Transaction is missing signatures')
32195 } 12529 }
32196 }
32197 12530
32198 function validateUnspentOutput(uo) { 12531 if (input.signatures) {
32199 var missingField 12532 switch (scriptType) {
12533 case 'pubkeyhash': {
12534 var pkhSignature = input.signatures[0].toScriptSignature(input.hashType)
12535 scriptSig = scripts.pubKeyHashInput(pkhSignature, input.pubKeys[0])
12536 break
12537 }
12538
12539 case 'multisig': {
12540 // Array.prototype.map is sparse-compatible
12541 var msSignatures = input.signatures.map(function (signature) {
12542 return signature && signature.toScriptSignature(input.hashType)
12543 })
12544
12545 // fill in blanks with OP_0
12546 if (allowIncomplete) {
12547 for (var i = 0; i < msSignatures.length; ++i) {
12548 if (msSignatures[i]) continue
32200 12549
32201 if (isNullOrUndefined(uo.hash)) { 12550 msSignatures[i] = ops.OP_0
32202 missingField = "hash" 12551 }
12552 } else {
12553 // Array.prototype.filter returns non-sparse array
12554 msSignatures = msSignatures.filter(function (x) { return x })
12555 }
12556
12557 var redeemScript = allowIncomplete ? undefined : input.redeemScript
12558 scriptSig = scripts.multisigInput(msSignatures, redeemScript)
12559 break
12560 }
12561
12562 case 'pubkey': {
12563 var pkSignature = input.signatures[0].toScriptSignature(input.hashType)
12564 scriptSig = scripts.pubKeyInput(pkSignature)
12565 break
12566 }
12567 }
32203 } 12568 }
32204 12569
32205 var requiredKeys = ['outputIndex', 'address', 'value'] 12570 // did we build a scriptSig?
32206 requiredKeys.forEach(function (key) { 12571 if (scriptSig) {
32207 if (isNullOrUndefined(uo[key])){ 12572 // wrap as scriptHash if necessary
32208 missingField = key 12573 if (input.prevOutType === 'scripthash') {
12574 scriptSig = scripts.scriptHashInput(scriptSig, input.redeemScript)
32209 } 12575 }
32210 })
32211 12576
32212 if (missingField) { 12577 tx.setInputScript(index, scriptSig)
32213 var message = [
32214 'Invalid unspent output: key', missingField, 'is missing.',
32215 'A valid unspent output must contain'
32216 ]
32217 message.push(requiredKeys.join(', '))
32218 message.push("and hash")
32219 throw new Error(message.join(' '))
32220 } 12578 }
32221 } 12579 })
32222 12580
32223 function isNullOrUndefined(value) { 12581 return tx
32224 return value == undefined 12582}
32225 }
32226 12583
32227 this.processPendingTx = function(tx){ 12584TransactionBuilder.prototype.sign = function (index, privKey, redeemScript, hashType) {
32228 processTx(tx, true) 12585 assert(index in this.inputs, 'No input at index: ' + index)
32229 } 12586 hashType = hashType || Transaction.SIGHASH_ALL
32230 12587
32231 this.processConfirmedTx = function(tx){ 12588 var input = this.inputs[index]
32232 processTx(tx, false) 12589 var canSign = input.hashType &&
32233 } 12590 input.prevOutScript &&
12591 input.prevOutType &&
12592 input.pubKeys &&
12593 input.scriptType &&
12594 input.signatures
32234 12595
32235 function processTx(tx, isPending) { 12596 // are we almost ready to sign?
32236 var txid = tx.getId() 12597 if (canSign) {
12598 // if redeemScript was provided, enforce consistency
12599 if (redeemScript) {
12600 assert.deepEqual(input.redeemScript, redeemScript, 'Inconsistent redeemScript')
12601 }
32237 12602
32238 tx.outs.forEach(function(txOut, i) { 12603 assert.equal(input.hashType, hashType, 'Inconsistent hashType')
32239 var address
32240 12604
32241 try { 12605 // no? prepare
32242 address = Address.fromOutputScript(txOut.script, network).toString() 12606 } else {
32243 } catch(e) { 12607 // must be pay-to-scriptHash?
32244 if (!(e.message.match(/has no matching Address/))) throw e 12608 if (redeemScript) {
12609 // if we have a prevOutScript, enforce scriptHash equality to the redeemScript
12610 if (input.prevOutScript) {
12611 assert.equal(input.prevOutType, 'scripthash', 'PrevOutScript must be P2SH')
12612
12613 var scriptHash = input.prevOutScript.chunks[1]
12614 assert.deepEqual(scriptHash, redeemScript.getHash(), 'RedeemScript does not match ' + scriptHash.toString('hex'))
32245 } 12615 }
32246 12616
32247 if (isMyAddress(address)) { 12617 var scriptType = scripts.classifyOutput(redeemScript)
32248 var output = txid + ':' + i 12618 assert(scriptType in canSignTypes, 'RedeemScript not supported (' + scriptType + ')')
12619
12620 var pubKeys = []
12621 switch (scriptType) {
12622 case 'multisig': {
12623 pubKeys = redeemScript.chunks.slice(1, -2).map(ECPubKey.fromBuffer)
12624 break
12625 }
12626
12627 case 'pubkeyhash': {
12628 var pkh1 = redeemScript.chunks[2]
12629 var pkh2 = privKey.pub.getAddress().hash
32249 12630
32250 me.outputs[output] = { 12631 assert.deepEqual(pkh1, pkh2, 'privateKey cannot sign for this input')
32251 from: output, 12632 pubKeys = [privKey.pub]
32252 value: txOut.value, 12633 break
32253 address: address, 12634 }
32254 pending: isPending 12635
12636 case 'pubkey': {
12637 pubKeys = redeemScript.chunks.slice(0, 1).map(ECPubKey.fromBuffer)
12638 break
32255 } 12639 }
32256 } 12640 }
32257 })
32258 12641
32259 tx.ins.forEach(function(txIn, i) { 12642 if (!input.prevOutScript) {
32260 // copy and convert to big-endian hex 12643 input.prevOutScript = scripts.scriptHashOutput(redeemScript.getHash())
32261 var txinId = new Buffer(txIn.hash) 12644 input.prevOutType = 'scripthash'
32262 Array.prototype.reverse.call(txinId) 12645 }
32263 txinId = txinId.toString('hex') 12646
12647 input.pubKeys = pubKeys
12648 input.redeemScript = redeemScript
12649 input.scriptType = scriptType
32264 12650
32265 var output = txinId + ':' + txIn.index 12651 // cannot be pay-to-scriptHash
12652 } else {
12653 assert.notEqual(input.prevOutType, 'scripthash', 'PrevOutScript is P2SH, missing redeemScript')
32266 12654
32267 if (!(output in me.outputs)) return 12655 // can we otherwise sign this?
12656 if (input.scriptType) {
12657 assert(input.pubKeys, input.scriptType + ' not supported')
32268 12658
32269 if (isPending) { 12659 // we know nothin' Jon Snow, assume pubKeyHash
32270 me.outputs[output].to = txid + ':' + i
32271 me.outputs[output].pending = true
32272 } else { 12660 } else {
32273 delete me.outputs[output] 12661 input.prevOutScript = privKey.pub.getAddress().toOutputScript()
12662 input.prevOutType = 'pubkeyhash'
12663 input.pubKeys = [privKey.pub]
12664 input.scriptType = input.prevOutType
32274 } 12665 }
12666 }
12667
12668 input.hashType = hashType
12669 input.signatures = input.signatures || []
12670 }
12671
12672 var signatureScript = input.redeemScript || input.prevOutScript
12673 var signatureHash = this.tx.hashForSignature(index, signatureScript, hashType)
12674
12675 // enforce signature order matches public keys
12676 if (input.scriptType === 'multisig' && input.redeemScript && input.signatures.length !== input.pubKeys.length) {
12677 // maintain a local copy of unmatched signatures
12678 var unmatched = input.signatures.slice()
12679
12680 input.signatures = input.pubKeys.map(function (pubKey) {
12681 var match
12682
12683 // check for any matching signatures
12684 unmatched.some(function (signature, i) {
12685 if (!pubKey.verify(signatureHash, signature)) return false
12686 match = signature
12687
12688 // remove matched signature from unmatched
12689 unmatched.splice(i, 1)
12690
12691 return true
12692 })
12693
12694 return match || undefined
32275 }) 12695 })
32276 } 12696 }
32277 12697
32278 this.createTx = function(to, value, fixedFee, changeAddress) { 12698 // enforce in order signing of public keys
32279 assert(value > network.dustThreshold, value + ' must be above dust threshold (' + network.dustThreshold + ' Satoshis)') 12699 assert(input.pubKeys.some(function (pubKey, i) {
12700 if (!privKey.pub.Q.equals(pubKey.Q)) return false
32280 12701
32281 var utxos = getCandidateOutputs(value) 12702 assert(!input.signatures[i], 'Signature already exists')
32282 var accum = 0 12703 var signature = privKey.sign(signatureHash)
32283 var subTotal = value 12704 input.signatures[i] = signature
32284 var addresses = []
32285 12705
32286 var tx = new Transaction() 12706 return true
32287 tx.addOutput(to, value) 12707 }, this), 'privateKey cannot sign for this input')
12708}
32288 12709
32289 for (var i = 0; i < utxos.length; ++i) { 12710module.exports = TransactionBuilder
32290 var utxo = utxos[i]
32291 addresses.push(utxo.address)
32292 12711
32293 var outpoint = utxo.from.split(':') 12712}).call(this,require("buffer").Buffer)
32294 tx.addInput(outpoint[0], parseInt(outpoint[1])) 12713},{"./ecpubkey":61,"./ecsignature":62,"./opcodes":67,"./script":68,"./scripts":69,"./transaction":70,"assert":5,"buffer":7}],72:[function(require,module,exports){
12714(function (Buffer){
12715var assert = require('assert')
12716var bufferutils = require('./bufferutils')
12717var typeForce = require('typeforce')
12718var networks = require('./networks')
12719var randomBytes = require('randombytes')
32295 12720
32296 var fee = fixedFee == undefined ? estimateFeePadChangeOutput(tx) : fixedFee 12721var Address = require('./address')
12722var HDNode = require('./hdnode')
12723var TransactionBuilder = require('./transaction_builder')
12724var Script = require('./script')
32297 12725
32298 accum += utxo.value 12726function Wallet (seed, network) {
32299 subTotal = value + fee 12727 console.warn('Wallet is deprecated and will be removed in 2.0.0, see #296')
32300 if (accum >= subTotal) {
32301 var change = accum - subTotal
32302 12728
32303 if (change > network.dustThreshold) { 12729 seed = seed || randomBytes(32)
32304 tx.addOutput(changeAddress || getChangeAddress(), change) 12730 network = network || networks.bitcoin
32305 }
32306 12731
32307 break 12732 // Stored in a closure to make accidental serialization less likely
32308 } 12733 var masterKey = HDNode.fromSeedBuffer(seed, network)
32309 }
32310 12734
32311 assert(accum >= subTotal, 'Not enough funds (incl. fee): ' + accum + ' < ' + subTotal) 12735 // HD first-level child derivation method should be hardened
12736 // See https://bitcointalk.org/index.php?topic=405179.msg4415254#msg4415254
12737 var accountZero = masterKey.deriveHardened(0)
12738 var externalAccount = accountZero.derive(0)
12739 var internalAccount = accountZero.derive(1)
32312 12740
32313 this.signWith(tx, addresses) 12741 this.addresses = []
32314 return tx 12742 this.changeAddresses = []
32315 } 12743 this.network = network
12744 this.unspents = []
32316 12745
32317 function getCandidateOutputs() { 12746 // FIXME: remove in 2.0.0
32318 var unspent = [] 12747 this.unspentMap = {}
32319 12748
32320 for (var key in me.outputs) { 12749 // FIXME: remove in 2.0.0
32321 var output = me.outputs[key] 12750 var me = this
32322 if (!output.pending) unspent.push(output) 12751 this.newMasterKey = function (seed) {
32323 } 12752 console.warn('newMasterKey is deprecated, please make a new Wallet instance instead')
32324 12753
32325 var sortByValueDesc = unspent.sort(function(o1, o2){ 12754 seed = seed || randomBytes(32)
32326 return o2.value - o1.value 12755 masterKey = HDNode.fromSeedBuffer(seed, network)
32327 })
32328 12756
32329 return sortByValueDesc 12757 accountZero = masterKey.deriveHardened(0)
32330 } 12758 externalAccount = accountZero.derive(0)
12759 internalAccount = accountZero.derive(1)
12760
12761 me.addresses = []
12762 me.changeAddresses = []
32331 12763
32332 function estimateFeePadChangeOutput(tx) { 12764 me.unspents = []
32333 var tmpTx = tx.clone() 12765 me.unspentMap = {}
32334 tmpTx.addOutput(getChangeAddress(), network.dustSoftThreshold || 0) 12766 }
32335 12767
32336 return network.estimateFee(tmpTx) 12768 this.getMasterKey = function () {
12769 return masterKey
12770 }
12771 this.getAccountZero = function () {
12772 return accountZero
32337 } 12773 }
12774 this.getExternalAccount = function () {
12775 return externalAccount
12776 }
12777 this.getInternalAccount = function () {
12778 return internalAccount
12779 }
12780}
32338 12781
32339 function getChangeAddress() { 12782Wallet.prototype.createTransaction = function (to, value, options) {
32340 if(me.changeAddresses.length === 0) me.generateChangeAddress(); 12783 // FIXME: remove in 2.0.0
32341 return me.changeAddresses[me.changeAddresses.length - 1] 12784 if (typeof options !== 'object') {
12785 if (options !== undefined) {
12786 console.warn('Non options object parameters are deprecated, use options object instead')
12787
12788 options = {
12789 fixedFee: arguments[2],
12790 changeAddress: arguments[3]
12791 }
12792 }
32342 } 12793 }
32343 12794
32344 this.signWith = function(tx, addresses) { 12795 options = options || {}
32345 assert.equal(tx.ins.length, addresses.length, 'Number of addresses must match number of transaction inputs')
32346 12796
32347 addresses.forEach(function(address, i) { 12797 assert(value > this.network.dustThreshold, value + ' must be above dust threshold (' + this.network.dustThreshold + ' Satoshis)')
32348 var key = me.getPrivateKeyForAddress(address)
32349 12798
32350 tx.sign(i, key) 12799 var changeAddress = options.changeAddress
32351 }) 12800 var fixedFee = options.fixedFee
12801 var minConf = options.minConf === undefined ? 0 : options.minConf // FIXME: change minConf:1 by default in 2.0.0
32352 12802
32353 return tx 12803 // filter by minConf, then pending and sort by descending value
32354 } 12804 var unspents = this.unspents.filter(function (unspent) {
12805 return unspent.confirmations >= minConf
12806 }).filter(function (unspent) {
12807 return !unspent.pending
12808 }).sort(function (o1, o2) {
12809 return o2.value - o1.value
12810 })
32355 12811
32356 this.getMasterKey = function() { return masterkey } 12812 var accum = 0
32357 this.getAccountZero = function() { return accountZero } 12813 var addresses = []
32358 this.getInternalAccount = function() { return internalAccount } 12814 var subTotal = value
32359 this.getExternalAccount = function() { return externalAccount }
32360 12815
32361 this.getPrivateKey = function(index) { 12816 var txb = new TransactionBuilder()
32362 return externalAccount.derive(index).privKey 12817 txb.addOutput(to, value)
32363 } 12818
12819 for (var i = 0; i < unspents.length; ++i) {
12820 var unspent = unspents[i]
12821 addresses.push(unspent.address)
12822
12823 txb.addInput(unspent.txHash, unspent.index)
12824
12825 var fee = fixedFee === undefined ? estimatePaddedFee(txb.buildIncomplete(), this.network) : fixedFee
12826
12827 accum += unspent.value
12828 subTotal = value + fee
12829
12830 if (accum >= subTotal) {
12831 var change = accum - subTotal
12832
12833 if (change > this.network.dustThreshold) {
12834 txb.addOutput(changeAddress || this.getChangeAddress(), change)
12835 }
32364 12836
32365 this.getInternalPrivateKey = function(index) { 12837 break
32366 return internalAccount.derive(index).privKey 12838 }
32367 } 12839 }
32368 12840
32369 this.getPrivateKeyForAddress = function(address) { 12841 assert(accum >= subTotal, 'Not enough funds (incl. fee): ' + accum + ' < ' + subTotal)
32370 var index 12842
32371 if((index = this.addresses.indexOf(address)) > -1) { 12843 return this.signWith(txb, addresses).build()
32372 return this.getPrivateKey(index) 12844}
32373 } else if((index = this.changeAddresses.indexOf(address)) > -1) { 12845
32374 return this.getInternalPrivateKey(index) 12846// FIXME: remove in 2.0.0
12847Wallet.prototype.processPendingTx = function (tx) {
12848 this.__processTx(tx, true)
12849}
12850
12851// FIXME: remove in 2.0.0
12852Wallet.prototype.processConfirmedTx = function (tx) {
12853 this.__processTx(tx, false)
12854}
12855
12856// FIXME: remove in 2.0.0
12857Wallet.prototype.__processTx = function (tx, isPending) {
12858 console.warn('processTransaction is considered harmful, see issue #260 for more information')
12859
12860 var txId = tx.getId()
12861 var txHash = tx.getHash()
12862
12863 tx.outs.forEach(function (txOut, i) {
12864 var address
12865
12866 try {
12867 address = Address.fromOutputScript(txOut.script, this.network).toString()
12868 } catch (e) {
12869 if (!(e.message.match(/has no matching Address/)))
12870 throw e
12871 }
12872
12873 var myAddresses = this.addresses.concat(this.changeAddresses)
12874 if (myAddresses.indexOf(address) > -1) {
12875 var lookup = txId + ':' + i
12876 if (lookup in this.unspentMap) return
12877
12878 // its unique, add it
12879 var unspent = {
12880 address: address,
12881 confirmations: 0, // no way to determine this without more information
12882 index: i,
12883 txHash: txHash,
12884 txId: txId,
12885 value: txOut.value,
12886 pending: isPending
12887 }
12888
12889 this.unspentMap[lookup] = unspent
12890 this.unspents.push(unspent)
12891 }
12892 }, this)
12893
12894 tx.ins.forEach(function (txIn) {
12895 // copy and convert to big-endian hex
12896 var txInId = bufferutils.reverse(txIn.hash).toString('hex')
12897
12898 var lookup = txInId + ':' + txIn.index
12899 if (!(lookup in this.unspentMap)) return
12900
12901 var unspent = this.unspentMap[lookup]
12902
12903 if (isPending) {
12904 unspent.pending = true
12905 unspent.spent = true
32375 } else { 12906 } else {
32376 throw new Error('Unknown address. Make sure the address is from the keychain and has been generated.') 12907 delete this.unspentMap[lookup]
12908
12909 this.unspents = this.unspents.filter(function (unspent2) {
12910 return unspent !== unspent2
12911 })
32377 } 12912 }
12913 }, this)
12914}
12915
12916Wallet.prototype.generateAddress = function () {
12917 var k = this.addresses.length
12918 var address = this.getExternalAccount().derive(k).getAddress()
12919
12920 this.addresses.push(address.toString())
12921
12922 return this.getReceiveAddress()
12923}
12924
12925Wallet.prototype.generateChangeAddress = function () {
12926 var k = this.changeAddresses.length
12927 var address = this.getInternalAccount().derive(k).getAddress()
12928
12929 this.changeAddresses.push(address.toString())
12930
12931 return this.getChangeAddress()
12932}
12933
12934Wallet.prototype.getAddress = function () {
12935 if (this.addresses.length === 0) {
12936 this.generateAddress()
32378 } 12937 }
32379 12938
32380 function isReceiveAddress(address){ 12939 return this.addresses[this.addresses.length - 1]
32381 return me.addresses.indexOf(address) > -1 12940}
12941
12942Wallet.prototype.getBalance = function (minConf) {
12943 minConf = minConf || 0
12944
12945 return this.unspents.filter(function (unspent) {
12946 return unspent.confirmations >= minConf
12947
12948 // FIXME: remove spent filter in 2.0.0
12949 }).filter(function (unspent) {
12950 return !unspent.spent
12951 }).reduce(function (accum, unspent) {
12952 return accum + unspent.value
12953 }, 0)
12954}
12955
12956Wallet.prototype.getChangeAddress = function () {
12957 if (this.changeAddresses.length === 0) {
12958 this.generateChangeAddress()
32382 } 12959 }
32383 12960
32384 function isChangeAddress(address){ 12961 return this.changeAddresses[this.changeAddresses.length - 1]
32385 return me.changeAddresses.indexOf(address) > -1 12962}
12963
12964Wallet.prototype.getInternalPrivateKey = function (index) {
12965 return this.getInternalAccount().derive(index).privKey
12966}
12967
12968Wallet.prototype.getPrivateKey = function (index) {
12969 return this.getExternalAccount().derive(index).privKey
12970}
12971
12972Wallet.prototype.getPrivateKeyForAddress = function (address) {
12973 var index
12974
12975 if ((index = this.addresses.indexOf(address)) > -1) {
12976 return this.getPrivateKey(index)
32386 } 12977 }
32387 12978
32388 function isMyAddress(address) { 12979 if ((index = this.changeAddresses.indexOf(address)) > -1) {
32389 return isReceiveAddress(address) || isChangeAddress(address) 12980 return this.getInternalPrivateKey(index)
32390 } 12981 }
12982
12983 assert(false, 'Unknown address. Make sure the address is from the keychain and has been generated')
12984}
12985
12986Wallet.prototype.getUnspentOutputs = function (minConf) {
12987 minConf = minConf || 0
12988
12989 return this.unspents.filter(function (unspent) {
12990 return unspent.confirmations >= minConf
12991
12992 // FIXME: remove spent filter in 2.0.0
12993 }).filter(function (unspent) {
12994 return !unspent.spent
12995 }).map(function (unspent) {
12996 return {
12997 address: unspent.address,
12998 confirmations: unspent.confirmations,
12999 index: unspent.index,
13000 txId: unspent.txId,
13001 value: unspent.value,
13002
13003 // FIXME: remove in 2.0.0
13004 hash: unspent.txId,
13005 pending: unspent.pending
13006 }
13007 })
13008}
13009
13010Wallet.prototype.setUnspentOutputs = function (unspents) {
13011 this.unspentMap = {}
13012 this.unspents = unspents.map(function (unspent) {
13013 // FIXME: remove unspent.hash in 2.0.0
13014 var txId = unspent.txId || unspent.hash
13015 var index = unspent.index
13016
13017 // FIXME: remove in 2.0.0
13018 if (unspent.hash !== undefined) {
13019 console.warn('unspent.hash is deprecated, use unspent.txId instead')
13020 }
13021
13022 // FIXME: remove in 2.0.0
13023 if (index === undefined) {
13024 console.warn('unspent.outputIndex is deprecated, use unspent.index instead')
13025 index = unspent.outputIndex
13026 }
13027
13028 typeForce('String', txId)
13029 typeForce('Number', index)
13030 typeForce('Number', unspent.value)
13031
13032 assert.equal(txId.length, 64, 'Expected valid txId, got ' + txId)
13033 assert.doesNotThrow(function () {
13034 Address.fromBase58Check(unspent.address)
13035 }, 'Expected Base58 Address, got ' + unspent.address)
13036 assert(isFinite(index), 'Expected finite index, got ' + index)
13037
13038 // FIXME: remove branch in 2.0.0
13039 if (unspent.confirmations !== undefined) {
13040 typeForce('Number', unspent.confirmations)
13041 }
13042
13043 var txHash = bufferutils.reverse(new Buffer(txId, 'hex'))
13044
13045 unspent = {
13046 address: unspent.address,
13047 confirmations: unspent.confirmations || 0,
13048 index: index,
13049 txHash: txHash,
13050 txId: txId,
13051 value: unspent.value,
13052
13053 // FIXME: remove in 2.0.0
13054 pending: unspent.pending || false
13055 }
13056
13057 // FIXME: remove in 2.0.0
13058 this.unspentMap[txId + ':' + index] = unspent
13059
13060 return unspent
13061 }, this)
32391} 13062}
32392 13063
13064Wallet.prototype.signWith = function (tx, addresses) {
13065 addresses.forEach(function (address, i) {
13066 var privKey = this.getPrivateKeyForAddress(address)
13067
13068 tx.sign(i, privKey)
13069 }, this)
13070
13071 return tx
13072}
13073
13074function estimatePaddedFee (tx, network) {
13075 var tmpTx = tx.clone()
13076 tmpTx.addOutput(Script.EMPTY, network.dustSoftThreshold || 0)
13077
13078 return network.estimateFee(tmpTx)
13079}
13080
13081// FIXME: 1.0.0 shims, remove in 2.0.0
13082Wallet.prototype.getReceiveAddress = Wallet.prototype.getAddress
13083Wallet.prototype.createTx = Wallet.prototype.createTransaction
13084
32393module.exports = Wallet 13085module.exports = Wallet
32394 13086
32395}).call(this,_dereq_("buffer").Buffer) 13087}).call(this,require("buffer").Buffer)
32396},{"./address":69,"./hdnode":78,"./networks":81,"./transaction":85,"assert":4,"buffer":8,"secure-random":68}]},{},[79]) 13088},{"./address":54,"./bufferutils":57,"./hdnode":63,"./networks":66,"./script":68,"./transaction_builder":71,"assert":5,"buffer":7,"randombytes":52,"typeforce":53}]},{},[64])(64)
32397(79) 13089});</script>
32398}); 13090 <script>// Select components from sjcl to suit the crypto operations bip39 requires.
32399</script>
32400<script>
32401// Select components from sjcl to suit the crypto operations bip39 requires.
32402 13091
32403//// base.js 13092//// base.js
32404 13093
@@ -33458,8 +14147,7 @@ sjcl.hash.sha256.prototype = {
33458 } 14147 }
33459}; 14148};
33460</script> 14149</script>
33461<script> 14150 <script>WORDLISTS = typeof WORDLISTS == "undefined" ? {} : WORDLISTS;
33462WORDLISTS = typeof WORDLISTS == "undefined" ? {} : WORDLISTS;
33463WORDLISTS["english"] = [ 14151WORDLISTS["english"] = [
33464"abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse", 14152"abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse",
33465"access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act", 14153"access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act",
@@ -33667,8 +14355,7 @@ WORDLISTS["english"] = [
33667"worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year", 14355"worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year",
33668"yellow","you","young","youth","zebra","zero","zone","zoo"] 14356"yellow","you","young","youth","zebra","zero","zone","zoo"]
33669</script> 14357</script>
33670<script> 14358 <script>/*
33671/*
33672 * Copyright (c) 2013 Pavol Rusnak 14359 * Copyright (c) 2013 Pavol Rusnak
33673 * 14360 *
33674 * Permission is hereby granted, free of charge, to any person obtaining a copy of 14361 * Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -33878,13 +14565,12 @@ var Mnemonic = function(language) {
33878 14565
33879} 14566}
33880</script> 14567</script>
33881<script> 14568 <script>(function() {
33882(function() {
33883 14569
33884 var mnemonic = new Mnemonic("english"); 14570 var mnemonic = new Mnemonic("english");
33885 var bip32RootKey = null; 14571 var bip32RootKey = null;
33886 var bip32ExtendedKey = null; 14572 var bip32ExtendedKey = null;
33887 var network = Bitcoin.networks.bitcoin; 14573 var network = bitcoin.networks.bitcoin;
33888 var addressRowTemplate = $("#address-row-template"); 14574 var addressRowTemplate = $("#address-row-template");
33889 14575
33890 var showIndex = true; 14576 var showIndex = true;
@@ -33944,38 +14630,14 @@ var Mnemonic = function(language) {
33944 disableForms(); 14630 disableForms();
33945 hidePending(); 14631 hidePending();
33946 hideValidationError(); 14632 hideValidationError();
14633 populateNetworkSelect();
33947 } 14634 }
33948 14635
33949 // Event handlers 14636 // Event handlers
33950 14637
33951 function networkChanged(e) { 14638 function networkChanged(e) {
33952 var n = e.target.value; 14639 var network = e.target.value;
33953 if (n == "bitcoin") { 14640 networks[network].onSelect();
33954 network = Bitcoin.networks.bitcoin;
33955 DOM.bip44coin.val(0);
33956 DOM.myceliumPath.val("m/44'/0'/0'/0");
33957 }
33958 else if (n == "bitcoin-testnet") {
33959 network = Bitcoin.networks.testnet;
33960 DOM.bip44coin.val(1);
33961 DOM.myceliumPath.val("m/44'/1'/0'/0");
33962 }
33963 else if (n == "litecoin") {
33964 network = Bitcoin.networks.litecoin;
33965 DOM.bip44coin.val(2);
33966 }
33967 else if (n == "shadow") {
33968 network = Bitcoin.networks.shadow;
33969 DOM.bip44coin.val(35);
33970 }
33971 else if (n == "shadowtn") {
33972 network = Bitcoin.networks.shadowtn;
33973 DOM.bip44coin.val(1);
33974 }
33975 else if (n == "dogecoin") {
33976 network = Bitcoin.networks.dogecoin;
33977 DOM.bip44coin.val(3);
33978 }
33979 setBip44DerivationPath(); 14641 setBip44DerivationPath();
33980 delayedPhraseChanged(); 14642 delayedPhraseChanged();
33981 } 14643 }
@@ -34092,7 +14754,7 @@ var Mnemonic = function(language) {
34092 14754
34093 function calcBip32Seed(phrase, passphrase, path) { 14755 function calcBip32Seed(phrase, passphrase, path) {
34094 var seed = mnemonic.toSeed(phrase, passphrase); 14756 var seed = mnemonic.toSeed(phrase, passphrase);
34095 bip32RootKey = Bitcoin.HDNode.fromSeedHex(seed, network); 14757 bip32RootKey = bitcoin.HDNode.fromSeedHex(seed, network);
34096 bip32ExtendedKey = bip32RootKey; 14758 bip32ExtendedKey = bip32RootKey;
34097 // Derive the key from the path 14759 // Derive the key from the path
34098 var pathBits = path.split("/"); 14760 var pathBits = path.split("/");
@@ -34290,6 +14952,49 @@ var Mnemonic = function(language) {
34290 .hide(); 14952 .hide();
34291 } 14953 }
34292 14954
14955 function populateNetworkSelect() {
14956 for (var i=0; i<networks.length; i++) {
14957 var network = networks[i];
14958 var option = $("<option>");
14959 option.attr("value", i);
14960 option.text(network.name);
14961 DOM.phraseNetwork.append(option);
14962 }
14963 }
14964
14965 var networks = [
14966 {
14967 name: "Bitcoin",
14968 onSelect: function() {
14969 network = bitcoin.networks.bitcoin;
14970 DOM.bip44coin.val(0);
14971 DOM.myceliumPath.val("m/44'/0'/0'/0");
14972 },
14973 },
14974 {
14975 name: "Bitcoin Testnet",
14976 onSelect: function() {
14977 network = bitcoin.networks.testnet;
14978 DOM.bip44coin.val(1);
14979 DOM.myceliumPath.val("m/44'/1'/0'/0");
14980 },
14981 },
14982 {
14983 name: "Litecoin",
14984 onSelect: function() {
14985 network = bitcoin.networks.litecoin;
14986 DOM.bip44coin.val(2);
14987 },
14988 },
14989 {
14990 name: "Dogecoin",
14991 onSelect: function() {
14992 network = bitcoin.networks.dogecoin;
14993 DOM.bip44coin.val(3);
14994 },
14995 },
14996 ]
14997
34293 init(); 14998 init();
34294 14999
34295})(); 15000})();