aboutsummaryrefslogtreecommitdiff
path: root/bip39-standalone.html
diff options
context:
space:
mode:
Diffstat (limited to 'bip39-standalone.html')
-rw-r--r--bip39-standalone.html25204
1 files changed, 25173 insertions, 31 deletions
diff --git a/bip39-standalone.html b/bip39-standalone.html
index 3b4f0f2..98a33b2 100644
--- a/bip39-standalone.html
+++ b/bip39-standalone.html
@@ -12,6 +12,7 @@
12 <meta content="width=device-width, initial-scale=1.0" name="viewport" /> 12 <meta content="width=device-width, initial-scale=1.0" name="viewport" />
13 <meta content="bitcoin mnemonic converter" name="description" /> 13 <meta content="bitcoin mnemonic converter" name="description" />
14 <meta content="Ian Coleman" name="author" /> 14 <meta content="Ian Coleman" name="author" />
15 <link type="image/x-icon" rel="icon" href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=" />
15 16
16 <style> 17 <style>
17 body { 18 body {
@@ -186,9 +187,9 @@
186 <label class="col-sm-3 control-label" data-translate>Mnemonic Length</label> 187 <label class="col-sm-3 control-label" data-translate>Mnemonic Length</label>
187 <div class="col-sm-9"> 188 <div class="col-sm-9">
188 <select class="mnemonic-length form-control"> 189 <select class="mnemonic-length form-control">
189 <option value="raw" data-translate>From entropy length (3 words per 32 bits)</option> 190 <option value="raw" selected data-translate>Use Raw Entropy (3 words per 32 bits)</option>
190 <option value="12">12 <span data-translate>Words</span></option> 191 <option value="12">12 <span data-translate>Words</span></option>
191 <option value="15" selected>15 <span data-translate>Words</option> 192 <option value="15">15 <span data-translate>Words</option>
192 <option value="18">18 <span data-translate>Words</span></option> 193 <option value="18">18 <span data-translate>Words</span></option>
193 <option value="21">21 <span data-translate>Words</span></option> 194 <option value="21">21 <span data-translate>Words</span></option>
194 <option value="24">24 <span data-translate>Words</span></option> 195 <option value="24">24 <span data-translate>Words</span></option>
@@ -372,6 +373,15 @@
372 </p> 373 </p>
373 </div> 374 </div>
374 <div class="form-group"> 375 <div class="form-group">
376 <label for="bip32-client" class="col-sm-2 control-label" data-translate>Client</label>
377 <div class="col-sm-10">
378 <select id="bip32-client" class="client form-control">
379 <option value="custom">Custom derivation path</option>
380 <!-- populated by javascript -->
381 </select>
382 </div>
383 </div>
384 <div class="form-group">
375 <label for="bip32-path" class="col-sm-2 control-label" data-translate>BIP32 Derivation Path</label> 385 <label for="bip32-path" class="col-sm-2 control-label" data-translate>BIP32 Derivation Path</label>
376 <div class="col-sm-10"> 386 <div class="col-sm-10">
377 <input id="bip32-path" type="text" class="path form-control" value="m/0"> 387 <input id="bip32-path" type="text" class="path form-control" value="m/0">
@@ -397,6 +407,18 @@
397 </div> 407 </div>
398 </div> 408 </div>
399 <div class="form-group"> 409 <div class="form-group">
410 <label for="core-path" class="col-sm-2 control-label" data-translate>Multibit</label>
411 <div class="col-sm-10">
412 <p class="form-control no-border">
413 <span data-translate-html>Use path <code>m/0'/0</code>.</span>
414 </p>
415 <p class="form-control no-border">
416 <span data-translate>For more info see</span>
417 <a href="https://multibit.org/" target="_blank">MultiBit HD</a>
418 </p>
419 </div>
420 </div>
421 <div class="form-group">
400 <label class="col-sm-2 control-label" data-translate>Block Explorers</label> 422 <label class="col-sm-2 control-label" data-translate>Block Explorers</label>
401 <div class="col-sm-10"> 423 <div class="col-sm-10">
402 <p class="form-control no-border"> 424 <p class="form-control no-border">
@@ -655,6 +677,6253 @@
655 <td class="privkey"><span data-show-qr></span></td> 677 <td class="privkey"><span data-show-qr></span></td>
656 </tr> 678 </tr>
657 </script> 679 </script>
680 <script>// From
681// https://raw.githubusercontent.com/inexorabletash/polyfill/a6bc6ced78160c994f76a909b6ff6bbbab3d43de/es6.js
682// Required for ethereumjs-utils.js when run in phantomjs-2.1.1
683// but is not required in any modern browsers.
684// For more information, see
685// https://www.bountysource.com/issues/38485709-error-rendering-plot-with-phantomjs
686
687//----------------------------------------------------------------------
688//
689// ECMAScript 2015 Polyfills
690//
691//----------------------------------------------------------------------
692
693(function (global) {
694 "use strict";
695
696 // Set this to always override native implementations, for testing
697 // the polyfill in browsers with partial/full ES2015 support.
698 var OVERRIDE_NATIVE_FOR_TESTING = false;
699
700 var undefined = (void 0); // Paranoia
701
702 // Helpers
703
704 function strict(o) {
705 return o === global ? undefined : o;
706 }
707
708 function hook(o, p, f) {
709 var op = o[p];
710 console.assert(typeof op === 'function', 'Hooking a non-function');
711 o[p] = function() {
712 var o = strict(this);
713 var r = f.apply(o, arguments);
714 return r !== undefined ? r : op.apply(o, arguments);
715 };
716 }
717
718 function isSymbol(s) {
719 return (typeof s === 'symbol') || ('Symbol' in global && s instanceof global.Symbol);
720 }
721
722 function getPropertyDescriptor(target, name) {
723 var desc = Object.getOwnPropertyDescriptor(target, name);
724 var proto = Object.getPrototypeOf(target);
725 while (!desc && proto) {
726 desc = Object.getOwnPropertyDescriptor(proto, name);
727 proto = Object.getPrototypeOf(proto);
728 }
729 return desc;
730 }
731
732 var enqueue = (function(nativePromise, nativeSetImmediate) {
733 if (nativePromise)
734 return function(job) { nativePromise.resolve().then(function() { job(); }); };
735 if (nativeSetImmediate)
736 return function(job) { nativeSetImmediate(job); };
737 return function(job) { setTimeout(job, 0); };
738 }(global['Promise'], global['setImmediate']));
739
740 function define(o, p, v, override) {
741 if (p in o && !override && !OVERRIDE_NATIVE_FOR_TESTING)
742 return;
743
744 if (typeof v === 'function') {
745 // Sanity check that functions are appropriately named (where possible)
746 console.assert(isSymbol(p) || !('name' in v) || v.name === p || v.name === p + '_', 'Expected function name "' + p.toString() + '", was "' + v.name + '"');
747 Object.defineProperty(o, p, {
748 value: v,
749 configurable: true,
750 enumerable: false,
751 writable: true
752 });
753 } else {
754 Object.defineProperty(o, p, {
755 value: v,
756 configurable: false,
757 enumerable: false,
758 writable: false
759 });
760 }
761 }
762
763 function set_internal(o, p, v) {
764 Object.defineProperty(o, p, {
765 value: v,
766 configurable: false,
767 enumerable: false,
768 writable: true
769 });
770 }
771
772 // Snapshot intrinsic functions
773 var $isNaN = global.isNaN,
774 $parseInt = global.parseInt,
775 $parseFloat = global.parseFloat;
776
777 var E = Math.E,
778 LOG10E = Math.LOG10E,
779 LOG2E = Math.LOG2E,
780 abs = Math.abs,
781 ceil = Math.ceil,
782 exp = Math.exp,
783 floor = Math.floor,
784 log = Math.log,
785 max = Math.max,
786 min = Math.min,
787 pow = Math.pow,
788 random = Math.random,
789 sqrt = Math.sqrt;
790
791 var orig_match = String.prototype.match,
792 orig_replace = String.prototype.replace,
793 orig_search = String.prototype.search,
794 orig_split = String.prototype.split;
795
796 // These are used for implementing the polyfills, but not exported.
797
798 // Inspired by https://gist.github.com/1638059
799 /** @constructor */
800 function EphemeronTable() {
801 var secretKey = ObjectCreate(null);
802
803 function conceal(o) {
804 var oValueOf = o.valueOf, secrets = ObjectCreate(null);
805 Object.defineProperty(o, 'valueOf', {
806 value: (function(secretKey) {
807 return function (k) {
808 return (k === secretKey) ? secrets : oValueOf.apply(o, arguments);
809 };
810 }(secretKey)),
811 configurable: true,
812 writeable: true,
813 enumerable: false
814 });
815 return secrets;
816 }
817
818 function reveal(o) {
819 var v = typeof o.valueOf === 'function' && o.valueOf(secretKey);
820 return v === o ? null : v;
821 }
822
823 return {
824 clear: function() {
825 secretKey = ObjectCreate(null);
826 },
827 remove: function(key) {
828 var secrets = reveal(key);
829 if (secrets && HasOwnProperty(secrets, 'value')) {
830 delete secrets.value;
831 return true;
832 }
833 return false;
834 },
835 get: function(key, defaultValue) {
836 var secrets = reveal(key);
837 return (secrets && HasOwnProperty(secrets, 'value')) ? secrets.value : defaultValue;
838 },
839 has: function(key) {
840 var secrets = reveal(key);
841 return Boolean(secrets && HasOwnProperty(secrets, 'value'));
842 },
843 set: function(key, value) {
844 var secrets = reveal(key) || conceal(key);
845 secrets.value = value;
846 }
847 };
848 }
849
850 var empty = Object.create(null);
851
852 //----------------------------------------------------------------------
853 //
854 // ECMAScript 2015
855 // http://www.ecma-international.org/ecma-262/6.0/
856 //
857 //----------------------------------------------------------------------
858
859 // ---------------------------------------
860 // 19.4 Symbol Objects
861 // ---------------------------------------
862
863 // NOTE: Symbols are defined here - out of spec order - since we need the
864 // properties and prototype to be populated for other polyfills.
865
866 // NOTE: Not secure, nor is obj[$$symbol] hidden from Object.keys()
867
868 var symbolForKey;
869 (function() {
870 var secret = Object.create(null);
871 var symbolMap = {};
872 symbolForKey = function(k) {
873 return symbolMap[k];
874 };
875
876 var GlobalSymbolRegistry = [];
877
878 function unique(bits) {
879 return Array(bits + 1).join('x').replace(/x/g, function() {
880 return random() < 0.5 ? '\u200C' : '\u200D'; // JWNJ / ZWJ
881 });
882 }
883
884 // 19.4.1 The Symbol Constructor
885 // 19.4.1.1 Symbol ( description=undefined )
886 function Symbol(description) {
887 if (!(this instanceof Symbol)) return new Symbol(description, secret);
888 if (this instanceof Symbol && arguments[1] !== secret) throw TypeError();
889
890 var descString = description === undefined ? undefined : String(description);
891
892 set_internal(this, '[[SymbolData]]', unique(128));
893 set_internal(this, '[[Description]]', descString);
894
895 symbolMap[this] = this;
896 return this;
897 }
898
899 if (!('Symbol' in global) || OVERRIDE_NATIVE_FOR_TESTING)
900 global.Symbol = Symbol;
901
902 // 19.4.2 Properties of the Symbol Constructor
903
904 // 19.4.2.1 Symbol.for (key)
905 define(Symbol, 'for', function for_(key) {
906 var stringKey = String(key);
907 for (var i = 0; i < GlobalSymbolRegistry.length; ++i) {
908 var e = GlobalSymbolRegistry[i];
909 if (SameValue(e['[[key]]'], stringKey)) return e['[[symbol]]'];
910 }
911 var newSymbol = Symbol(key);
912 GlobalSymbolRegistry.push({'[[key]]': stringKey, '[[symbol]]': newSymbol});
913 return newSymbol;
914 });
915
916 // 19.4.2.2 Symbol.hasInstance
917 // 19.4.2.3 Symbol.isConcatSpreadable
918
919 // 19.4.2.4 Symbol.iterator
920 define(global.Symbol, 'iterator', global.Symbol('Symbol.iterator'));
921
922 // 19.4.2.5 Symbol.keyFor (sym)
923 define(Symbol, 'keyFor', function keyFor(sym) {
924 if (!(sym instanceof Symbol)) throw TypeError();
925 for (var i = 0; i < GlobalSymbolRegistry.length; ++i) {
926 var e = GlobalSymbolRegistry[i];
927 if (SameValue(e['[[symbol]]'], sym)) return e['[[key]]'];
928 }
929 return undefined;
930 });
931
932 // 19.4.2.6 Symbol.match
933 define(global.Symbol, 'match', global.Symbol('Symbol.match'));
934
935 // 19.4.2.7 Symbol.prototype
936
937 // 19.4.2.8 Symbol.replace
938 define(global.Symbol, 'replace', global.Symbol('Symbol.replace'));
939
940 // 19.4.2.9 Symbol.search
941 define(global.Symbol, 'search', global.Symbol('Symbol.search'));
942
943 // 19.4.2.10 Symbol.species
944
945 // 19.4.2.11 Symbol.search
946 define(global.Symbol, 'split', global.Symbol('Symbol.split'));
947
948 // 19.4.2.12 Symbol.toPrimitive
949
950 // 19.4.2.13 Symbol.toStringTag
951 define(global.Symbol, 'toStringTag', global.Symbol('Symbol.toStringTag'));
952
953 // 19.4.2.14 Symbol.unscopables
954
955 // 19.4.3 Properties of the Symbol Prototype Object
956 // 19.4.3.1 Symbol.prototype.constructor
957
958 // 19.4.3.2 Symbol.prototype.toString ( )
959 Object.defineProperty(Symbol.prototype, 'toString', {
960 value: function toString() {
961 var s = strict(this);
962 var desc = s['[[Description]]'];
963 return 'Symbol(' + (desc === undefined ? '' : desc) + s['[[SymbolData]]'] + ')';
964 },
965 configurable: true, writeable: true, enumerable: false });
966
967 // 19.4.3.3 Symbol.prototype.valueOf ( )
968 Object.defineProperty(Symbol.prototype, 'valueOf', {
969 value: function valueOf() {
970 // To prevent automatic string conversion:
971 throw TypeError();
972
973 // Spec has approximately the following:
974 //var s = strict(this);
975 //if (Type(s) === 'symbol') return s;
976 //if (Type(s) !== 'object') throw TypeError();
977 //if (!('[[SymbolData]]' in s)) throw TypeError();
978 //return s['[[SymbolData]]'];
979 },
980 configurable: true, writeable: true, enumerable: false });
981
982 // 19.4.3.4 Symbol.prototype [ @@toStringTag ]
983 // (Done later to polyfill partial implementations)
984
985 // 19.4.4 Properties of Symbol Instances
986 }());
987
988 console.assert(typeof global.Symbol() === 'symbol' || symbolForKey(String(global.Symbol('x'))));
989
990 // Defined here so that other prototypes can reference it
991 // 25.1.2 The %IteratorPrototype% Object
992 var $IteratorPrototype$ = {};
993
994 //----------------------------------------
995 // 6 ECMAScript Data Types and Values
996 //----------------------------------------
997
998 // 6.1 ECMAScript Language Types
999
1000 // "Type(x)" is used as shorthand for "the type of x"...
1001 function Type(v) {
1002 switch (typeof v) {
1003 case 'undefined': return 'undefined';
1004 case 'boolean': return 'boolean';
1005 case 'number': return 'number';
1006 case 'string': return 'string';
1007 case 'symbol': return 'symbol';
1008 default:
1009 if (v === null) return 'null';
1010 if (v instanceof global.Symbol) return 'symbol';
1011 return 'object';
1012 }
1013 }
1014
1015 // 6.1.5.1 Well-Known Symbols
1016 var $$iterator = global.Symbol.iterator,
1017 $$match = global.Symbol.match,
1018 $$replace = global.Symbol.replace,
1019 $$search = global.Symbol.search,
1020 $$split = global.Symbol.split,
1021 $$toStringTag = global.Symbol.toStringTag;
1022
1023 //----------------------------------------
1024 // 7 Abstract Operations
1025 //----------------------------------------
1026
1027 //----------------------------------------
1028 // 7.1 Type Conversion
1029 //----------------------------------------
1030
1031 // 7.1.1 ToPrimitive ( input [, PreferredType] )
1032 // just use valueOf()
1033
1034 // 7.1.2 ToBoolean ( argument )
1035 // just use Boolean()
1036
1037 // 7.1.3 ToNumber ( argument )
1038 // just use Number()
1039
1040 // 7.1.4 ToInteger ( argument )
1041 function ToInteger(n) {
1042 n = Number(n);
1043 if ($isNaN(n)) return 0;
1044 if (n === 0 || n === Infinity || n === -Infinity) return n;
1045 return ((n < 0) ? -1 : 1) * floor(abs(n));
1046 }
1047
1048 // 7.1.5 ToInt32 ( argument )
1049 function ToInt32(v) { return v >> 0; }
1050
1051 // 7.1.6 ToUint32 ( argument )
1052 function ToUint32(v) { return v >>> 0; }
1053
1054 // 7.1.7 ToInt16 ( argument )
1055 function ToInt16(v) { return (v << 16) >> 16; }
1056
1057 // 7.1.8 ToUint16 ( argument )
1058 function ToUint16(v) { return v & 0xFFFF; }
1059
1060 // 7.1.9 ToInt8 ( argument )
1061 function ToInt8(v) { return (v << 24) >> 24; }
1062
1063 // 7.1.10 ToUint8 ( argument )
1064 function ToUint8(v) { return v & 0xFF; }
1065
1066 // 7.1.11 ToUint8Clamp ( argument )
1067 function ToUint8Clamp(argument) {
1068 var number = Number(argument);
1069 if ($isNaN(number)) return 0;
1070 if (number <= 0) return 0;
1071 if (number >= 255) return 255;
1072 var f = floor(number);
1073 if ((f + 0.5) < number) return f + 1;
1074 if (number < (f + 0.5)) return f;
1075 if (f % 2) return f + 1;
1076 return f;
1077 }
1078
1079 // 7.1.12 ToString ( argument )
1080 // just use String()
1081
1082 // 7.1.13 ToObject ( argument )
1083 function ToObject(v) {
1084 if (v === null || v === undefined) throw TypeError();
1085 return Object(v);
1086 }
1087
1088 // 7.1.14 ToPropertyKey ( argument )
1089 function ToPropertyKey(v) {
1090 return String(v);
1091 }
1092
1093 // 7.1.15 ToLength ( argument )
1094 function ToLength(v) {
1095 var len = ToInteger(v);
1096 if (len <= 0) return 0;
1097 if (len === Infinity) return 0x20000000000000 - 1; // 2^53-1
1098 return min(len, 0x20000000000000 - 1); // 2^53-1
1099 }
1100
1101 // 7.1.16 CanonicalNumericIndexString ( argument )
1102
1103 //----------------------------------------
1104 // 7.2 Testing and Comparison Operations
1105 //----------------------------------------
1106
1107 // 7.2.1 RequireObjectCoercible ( argument )
1108 // 7.2.2 IsArray ( argument )
1109
1110 // 7.2.3 IsCallable ( argument )
1111 function IsCallable(o) { return typeof o === 'function'; }
1112
1113 // 7.2.4 IsConstructor ( argument )
1114 function IsConstructor(o) {
1115 // Hacks for Safari 7 TypedArray XXXConstructor objects
1116 if (/Constructor/.test(Object.prototype.toString.call(o))) return true;
1117 if (/Function/.test(Object.prototype.toString.call(o))) return true;
1118 // TODO: Can this be improved on?
1119 return typeof o === 'function';
1120 }
1121
1122 // 7.2.5 IsExtensible (O)
1123 // 7.2.6 IsInteger ( argument )
1124
1125 // 7.2.7 IsPropertyKey ( argument )
1126 function IsPropertyKey(argument) {
1127 if (Type(argument) === 'string') return true;
1128 if (Type(argument) === 'symbol') return true;
1129 return false;
1130 }
1131
1132 // 7.2.8 IsRegExp ( argument )
1133 // 7.2.5 IsConstructor ( argument )
1134
1135 // 7.2.9 SameValue(x, y)
1136 function SameValue(x, y) {
1137 if (typeof x !== typeof y) return false;
1138 switch (typeof x) {
1139 case 'undefined':
1140 return true;
1141 case 'number':
1142 if (x !== x && y !== y) return true;
1143 if (x === 0 && y === 0) return 1/x === 1/y;
1144 return x === y;
1145 case 'boolean':
1146 case 'string':
1147 case 'object':
1148 default:
1149 return x === y;
1150 }
1151 }
1152
1153 // 7.2.10 SameValueZero(x, y)
1154 function SameValueZero(x, y) {
1155 if (typeof x !== typeof y) return false;
1156 switch (typeof x) {
1157 case 'undefined':
1158 return true;
1159 case 'number':
1160 if (x !== x && y !== y) return true;
1161 return x === y;
1162 case 'boolean':
1163 case 'string':
1164 case 'object':
1165 default:
1166 return x === y;
1167 }
1168 }
1169
1170 //----------------------------------------
1171 // 7.3 Operations on Objects
1172 //----------------------------------------
1173
1174 // 7.3.1 Get (O, P)
1175 // - just use o.p or o[p]
1176
1177 // 7.3.2 GetV (V, P)
1178 function GetV(v, p) {
1179 var o = ToObject(v);
1180 return o[p];
1181 }
1182
1183 // 7.3.3 Set (O, P, V, Throw)
1184 // - just use o.p = v or o[p] = v
1185
1186
1187
1188
1189 // 7.3.9 GetMethod (O, P)
1190 function GetMethod(o, p) {
1191 var func = GetV(o, p);
1192 if (func === undefined || func === null) return undefined;
1193 if (!IsCallable(func)) throw TypeError();
1194 return func;
1195 }
1196
1197 // 7.3.10 HasProperty (O, P)
1198 function HasProperty(o, p) {
1199 while (o) {
1200 if (Object.prototype.hasOwnProperty.call(o, p)) return true;
1201 if (Type(o) !== 'object') return false;
1202 o = Object.getPrototypeOf(o);
1203 }
1204 return false;
1205 }
1206
1207 // 7.3.11 HasOwnProperty (O, P)
1208 function HasOwnProperty(o, p) {
1209 return Object.prototype.hasOwnProperty.call(o, p);
1210 }
1211
1212 //----------------------------------------
1213 // 7.4 Operations on Iterator Objects
1214 //----------------------------------------
1215
1216 // 7.4.1 GetIterator ( obj, method )
1217 function GetIterator(obj, method) {
1218 if (arguments.length < 2)
1219 method = GetMethod(obj, $$iterator);
1220 var iterator = method.call(obj);
1221 if (Type(iterator) !== 'object') throw TypeError();
1222 return iterator;
1223 }
1224
1225 // 7.4.2 IteratorNext ( iterator, value )
1226 function IteratorNext(iterator, value) {
1227 if (arguments.length < 2)
1228 var result = iterator.next();
1229 else
1230 result = iterator.next(value);
1231 if (Type(result) !== 'object') throw TypeError();
1232 return result;
1233 }
1234
1235 // 7.4.3 IteratorComplete ( iterResult )
1236 function IteratorComplete(iterResult) {
1237 console.assert(Type(iterResult) === 'object');
1238 return Boolean(iterResult.done);
1239 }
1240
1241 // 7.4.4 IteratorValue ( iterResult )
1242 function IteratorValue(iterResult) {
1243 console.assert(Type(iterResult) === 'object');
1244 return iterResult.value;
1245 }
1246
1247 // 7.4.5 IteratorStep ( iterator )
1248 function IteratorStep( iterator, value ) {
1249 var result = IteratorNext(iterator, value);
1250 var done = result['done'];
1251 if (Boolean(done) === true) return false;
1252 return result;
1253 }
1254
1255 // 7.4.6 IteratorClose( iterator, completion )
1256 function IteratorClose( iterator, completion ) {
1257 console.assert(Type(iterator) === 'object');
1258 var _return = GetMethod(iterator, 'return');
1259 if (_return === undefined) return completion;
1260 try {
1261 var innerResult = _return[iterator]();
1262 } catch (result) {
1263 // TODO: If completion.[[type]] is throw, return completion
1264 return result;
1265 }
1266 if (Type(innerResult) !== 'object') throw TypeError();
1267 return completion;
1268 }
1269
1270 // 7.4.7 CreateIterResultObject (value, done)
1271 function CreateIterResultObject(value, done) {
1272 console.assert(Type(done) === 'boolean');
1273 var obj = {};
1274 obj["value"] = value;
1275 obj["done"] = done;
1276 return obj;
1277 }
1278
1279 // 7.4.8 CreateListIterator (list)
1280 // 7.4.8.1 ListIterator next( )
1281 // 7.4.9 CreateCompoundIterator ( iterator1, iterator2 )
1282 // 7.4.9.1 CompoundIterator next( )
1283
1284 //----------------------------------------
1285 // 8 Executable Code and Execution Contexts
1286 //----------------------------------------
1287
1288 //----------------------------------------
1289 // 8.4 Jobs and Job Queues
1290 //----------------------------------------
1291
1292 // 8.4.1 EnqueueJob ( queueName, job, arguments)
1293 function EnqueueJob(queueName, job, args) {
1294 var fn = function() { job.apply(undefined, args); };
1295 enqueue(fn);
1296 }
1297
1298 // 8.4.2 NextJob result
1299 function NextJob(result) {
1300 // no-op
1301 }
1302
1303 //----------------------------------------
1304 // 9 Ordinary and Exotic Objects Behaviors
1305 //----------------------------------------
1306
1307 // 9.1.11 [[Enumerate]] ()
1308 function Enumerate(obj) {
1309 var e = [];
1310 if (Object(obj) !== obj) return e;
1311 var visited = new Set;
1312 while (obj !== null) {
1313 Object.getOwnPropertyNames(obj).forEach(function(name) {
1314 if (!visited.has(name)) {
1315 var desc = Object.getOwnPropertyDescriptor(obj, name);
1316 if (desc) {
1317 visited.add(name);
1318 if (desc.enumerable) e.push(name);
1319 }
1320 }
1321 });
1322 obj = Object.getPrototypeOf(obj);
1323 }
1324 return e[$$iterator]();
1325 }
1326
1327 // 9.1.12 [[OwnPropertyKeys]] ( )
1328 function OwnPropertyKeys(o) {
1329 return Object.getOwnPropertyNames(o);
1330 }
1331
1332 // 9.1.13 ObjectCreate(proto, internalSlotsList)
1333 function ObjectCreate(proto, internalSlotsList) {
1334 return Object.create(proto, internalSlotsList);
1335 }
1336
1337 // ---------------------------------------
1338 // 19 Fundamental Objects
1339 // ---------------------------------------
1340
1341 // ---------------------------------------
1342 // 19.1 Object Objects
1343 // ---------------------------------------
1344
1345 // 19.1.1 The Object Constructor
1346 // 19.1.1.1 Object ( [ value ] )
1347 // 19.1.2 Properties of the Object Constructor
1348 // 19.1.2.1 Object.assign ( target, ...sources )
1349 define(
1350 Object, 'assign',
1351 function assign(target, /*...*/sources) {
1352 var to = ToObject(target);
1353 if (arguments.length < 2) return to;
1354
1355 var sourcesIndex = 1;
1356 while (sourcesIndex < arguments.length) {
1357 var nextSource = arguments[sourcesIndex++];
1358 if (nextSource === undefined || nextSource === null) {
1359 var keys = [];
1360 } else {
1361 var from = ToObject(nextSource);
1362 keys = OwnPropertyKeys(from);
1363 }
1364 for (var keysIndex = 0; keysIndex < keys.length; ++keysIndex) {
1365 var nextKey = keys[keysIndex];
1366 var desc = Object.getOwnPropertyDescriptor(from, nextKey);
1367 if (desc !== undefined && desc.enumerable) {
1368 var propValue = from[nextKey];
1369 to[nextKey] = propValue;
1370 }
1371 }
1372 }
1373 return to;
1374 });
1375
1376 // 19.1.2.2 Object.create ( O [ , Properties ] )
1377 // 19.1.2.3 Object.defineProperties ( O, Properties )
1378 // 19.1.2.4 Object.defineProperty ( O, P, Attributes )
1379 // 19.1.2.5 Object.freeze ( O )
1380 // 19.1.2.6 Object.getOwnPropertyDescriptor ( O, P )
1381
1382 (function() {
1383 var nativeSymbols = (typeof global.Symbol() === 'symbol'),
1384 $getOwnPropertyNames = Object.getOwnPropertyNames,
1385 $keys = Object.keys,
1386 $window_names = (typeof window === 'object' ? $getOwnPropertyNames(window) : []);
1387
1388 function isStringKey(k) { return !symbolForKey(k); }
1389
1390 // 19.1.2.7 Object.getOwnPropertyNames ( O )
1391 define(
1392 Object, 'getOwnPropertyNames',
1393 function getOwnPropertyNames(o) {
1394 if (Object.prototype.toString.call(o) === '[object Window]') {
1395 // Workaround for cross-realm calling by IE itself.
1396 // https://github.com/inexorabletash/polyfill/issues/96
1397 try {
1398 return $getOwnPropertyNames(o).filter(isStringKey);
1399 } catch (_) {
1400 return $window_names.slice();
1401 }
1402 }
1403 return $getOwnPropertyNames(o).filter(isStringKey);
1404 }, !nativeSymbols);
1405
1406 // 19.1.2.8 Object.getOwnPropertySymbols ( O )
1407 define(
1408 Object, 'getOwnPropertySymbols',
1409 function getOwnPropertySymbols(o) {
1410 return $getOwnPropertyNames(o).filter(symbolForKey).map(symbolForKey);
1411 }, !nativeSymbols);
1412
1413 // 19.1.2.14 Object.keys ( O )
1414 define(
1415 Object, 'keys',
1416 function keys(o) {
1417 return $keys(o).filter(isStringKey);
1418 }, !nativeSymbols);
1419 }());
1420
1421 // 19.1.2.9 Object.getPrototypeOf ( O )
1422 // 19.1.2.10 Object.is ( value1, value2 )
1423 define(
1424 Object, 'is',
1425 function is(value1, value2) {
1426 return SameValue(value1, value2);
1427 });
1428
1429 // 19.1.2.11 Object.isExtensible ( O )
1430 // 19.1.2.12 Object.isFrozen ( O )
1431 // 19.1.2.13 Object.isSealed ( O )
1432
1433 // 19.1.2.14 Object.keys ( O )
1434 // see above
1435
1436 // 19.1.2.15 Object.preventExtensions ( O )
1437 // 19.1.2.16 Object.prototype
1438 // 19.1.2.17 Object.seal ( O )
1439
1440 // 19.1.2.18 Object.setPrototypeOf ( O, proto )
1441 define(
1442 Object, 'setPrototypeOf',
1443 function setPrototypeOf(o, proto) {
1444 if (Type(o) !== 'object') throw TypeError();
1445 if (Type(proto) !== 'object' && Type(proto) !== 'null') throw TypeError();
1446 o.__proto__ = proto;
1447 return o;
1448 }
1449 );
1450
1451 // 19.1.3 Properties of the Object Prototype Object
1452 // 19.1.3.1 Object.prototype.constructor
1453 // 19.1.3.2 Object.prototype.hasOwnProperty ( V )
1454 // 19.1.3.3 Object.prototype.isPrototypeOf ( V )
1455 // 19.1.3.4 Object.prototype.propertyIsEnumerable ( V )
1456 // 19.1.3.5 Object.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
1457 // 19.1.3.6 Object.prototype.toString ( )
1458 hook(Object.prototype, 'toString',
1459 function() {
1460 var o = strict(this);
1461 if (o === Object(o) && $$toStringTag in o) {
1462 return '[object ' + o[$$toStringTag] + ']';
1463 }
1464 return undefined;
1465 });
1466
1467 // 19.1.3.7 Object.prototype.valueOf ( )
1468 // 19.1.4 Properties of Object Instances
1469
1470 // ---------------------------------------
1471 // 19.2 Function Objects
1472 // ---------------------------------------
1473
1474 // 19.2.1 The Function Constructor
1475 // 19.2.1.1 Function ( p1, p2, … , pn, body )
1476 // 19.2.2 Properties of the Function Constructor
1477 // 19.2.2.1 Function.length
1478 // 19.2.2.2 Function.prototype
1479 // 19.2.3 Properties of the Function Prototype Object
1480 // 19.2.3.1 Function.prototype.apply ( thisArg, argArray )
1481 // 19.2.3.2 Function.prototype.bind ( thisArg , ...args)
1482 // 19.2.3.3 Function.prototype.call (thisArg , ...args)
1483 // 19.2.3.4 Function.prototype.constructor
1484 // 19.2.3.5 Function.prototype.toString ( )
1485 // 19.2.3.6 Function.prototype[@@hasInstance] ( V )
1486 // 19.2.4 Function Instances
1487 // 19.2.4.1 length
1488 // 19.2.4.2 name
1489 // 19.2.4.3 prototype
1490
1491 // (No polyfillable changes from ES5)
1492
1493 // ---------------------------------------
1494 // 19.3 Boolean Objects
1495 // ---------------------------------------
1496
1497 // 19.3.1 The Boolean Constructor
1498 // 19.3.1.1 Boolean ( value )
1499 // 19.3.2 Properties of the Boolean Constructor
1500 // 19.3.2.1 Boolean.prototype
1501 // 19.3.3 Properties of the Boolean Prototype Object
1502 // 19.3.3.1 Boolean.prototype.constructor
1503 // 19.3.3.2 Boolean.prototype.toString ( )
1504 // 19.3.3.3 Boolean.prototype.valueOf ( )
1505 // 19.3.4 Properties of Boolean Instances
1506
1507 // (No polyfillable changes from ES5)
1508
1509 // ---------------------------------------
1510 // 19.4 Symbol Objects
1511 // ---------------------------------------
1512
1513 // Moved earlier in this script, so that other polyfills can depend on them.
1514
1515 // 19.4.3.4 Symbol.prototype [ @@toStringTag ]
1516 define(global.Symbol.prototype, global.Symbol.toStringTag, 'Symbol');
1517
1518 // ---------------------------------------
1519 // 19.5 Error Objects
1520 // ---------------------------------------
1521
1522 // 19.5.1 The Error Constructor
1523 // 19.5.1.1 Error ( message )
1524 // 19.5.1.2 new Error( ...argumentsList )
1525 // 19.5.2 Properties of the Error Constructor
1526 // 19.5.2.1 Error.prototype
1527 // 19.5.3 Properties of the Error Prototype Object
1528 // 19.5.3.1 Error.prototype.constructor
1529 // 19.5.3.2 Error.prototype.message
1530 // 19.5.3.3 Error.prototype.name
1531 // 19.5.3.4 Error.prototype.toString ( )
1532 // 19.5.4 Properties of Error Instances
1533 // 19.5.5 Native Error Types Used in This Standard
1534 // 19.5.5.1 EvalError
1535 // 19.5.5.2 RangeError
1536 // 19.5.5.3 ReferenceError
1537 // 19.5.5.4 SyntaxError
1538 // 19.5.5.5 TypeError
1539 // 19.5.5.6 URIError
1540 // 19.5.6 NativeError Object Structure
1541 // 19.5.6.1 NativeError Constructors
1542 // 19.5.6.1.1 NativeError ( message )
1543 // 19.5.6.1.2 new NativeError ( ...argumentsList )
1544 // 19.5.6.2 Properties of the NativeError Constructors
1545 // 19.5.6.2.1 NativeError.prototype
1546 // 19.5.6.3 Properties of the NativeError Prototype Objects
1547 // 19.5.6.4 Properties of NativeError Instances
1548
1549 // (No polyfillable changes from ES5)
1550
1551 // ---------------------------------------
1552 // 20 Numbers and Dates
1553 // ---------------------------------------
1554
1555 // ---------------------------------------
1556 // 20.1 Number Objects
1557 // ---------------------------------------
1558
1559 // 20.1.1 The Number Constructor
1560 // 20.1.1.1 Number ( [ value ] )
1561 // 20.1.1.2 new Number ( ...argumentsList )
1562 // 20.1.2 Properties of the Number Constructor
1563
1564 // 20.1.2.1 Number.EPSILON
1565 define(
1566 Number, 'EPSILON',
1567 (function () {
1568 var next, result;
1569 for (next = 1; 1 + next !== 1; next = next / 2)
1570 result = next;
1571 return result;
1572 }()));
1573
1574 // 20.1.2.2 Number.isFinite ( number )
1575 define(
1576 Number, 'isFinite',
1577 function isFinite(number) {
1578 if (Type(number) !== 'number') return false;
1579 if (number !== number || number === +Infinity || number === -Infinity) return false;
1580 return true;
1581 });
1582
1583 // 20.1.2.3 Number.isInteger ( number )
1584 define(
1585 Number, 'isInteger',
1586 function isInteger(number) {
1587 if (Type(number) !== 'number') return false;
1588 if (number !== number || number === +Infinity || number === -Infinity) return false;
1589 var integer = ToInteger(number);
1590 if (integer !== number) return false;
1591 return true;
1592 });
1593
1594 // 20.1.2.4 Number.isNaN ( number )
1595 define(
1596 Number, 'isNaN',
1597 function isNaN(number) {
1598 if (Type(number) !== 'number') return false;
1599 if (number !== number) return true;
1600 return false;
1601 });
1602
1603 // 20.1.2.5 Number.isSafeInteger ( number )
1604 define(
1605 Number, 'isSafeInteger',
1606 function isSafeInteger(number) {
1607 if (Type(number) !== 'number') return false;
1608 if (number !== number || number === +Infinity || number === -Infinity) return false;
1609 var integer = ToInteger(number);
1610 if (integer !== number) return false;
1611 if (abs(integer) <= (0x20000000000000 - 1)) // 2^53-1
1612 return true;
1613 return false;
1614 });
1615
1616 // 20.1.2.6 Number.MAX_SAFE_INTEGER
1617 define(
1618 Number, 'MAX_SAFE_INTEGER',
1619 9007199254740991); // 2^53-1
1620
1621 // 20.1.2.7 Number.MAX_VALUE
1622
1623 // 20.1.2.8 Number.MIN_SAFE_INTEGER
1624 define(
1625 Number, 'MIN_SAFE_INTEGER',
1626 -9007199254740991); // -2^53+1
1627
1628 // 20.1.2.9 Number.MIN_VALUE
1629 // 20.1.2.10 Number.NaN
1630 // 20.1.2.11 Number.NEGATIVE_INFINITY
1631
1632 // 20.1.2.12 Number.parseFloat ( string )
1633 define(Number, 'parseFloat', $parseFloat);
1634
1635 // 20.1.2.13 Number.parseInt ( string, radix )
1636 define(Number, 'parseInt', $parseInt);
1637
1638 // 20.1.2.14 Number.POSITIVE_INFINITY
1639 // 20.1.2.15 Number.prototype
1640
1641 // 20.1.3 Properties of the Number Prototype Object
1642 // 20.1.3.1 Number.prototype.constructor
1643 // 20.1.3.2 Number.prototype.toExponential ( fractionDigits )
1644 // 20.1.3.3 Number.prototype.toFixed ( fractionDigits )
1645 // 20.1.3.4 Number.prototype.toLocaleString( [ reserved1 [ , reserved2 ] ])
1646 // 20.1.3.5 Number.prototype.toPrecision ( precision )
1647 // 20.1.3.6 Number.prototype.toString ( [ radix ] )
1648 // 20.1.3.7 Number.prototype.valueOf ( )
1649 // 20.1.4 Properties of Number Instances
1650
1651 // ---------------------------------------
1652 // 20.2 The Math Object
1653 // ---------------------------------------
1654
1655 // 20.2.1 Value Properties of the Math Object
1656 // 20.2.1.1 Math.E
1657 // 20.2.1.2 Math.LN10
1658 // 20.2.1.3 Math.LN2
1659 // 20.2.1.4 Math.LOG10E
1660 // 20.2.1.5 Math.LOG2E
1661 // 20.2.1.6 Math.PI
1662 // 20.2.1.7 Math.SQRT1_2
1663 // 20.2.1.8 Math.SQRT2
1664
1665 // 20.2.1.9 Math [ @@toStringTag ]
1666 define(Math, $$toStringTag, 'Math');
1667
1668 // 20.2.2 Function Properties of the Math Object
1669 // 20.2.2.1 Math.abs ( x )
1670 // 20.2.2.2 Math.acos ( x )
1671
1672 // 20.2.2.3 Math.acosh(x)
1673 define(
1674 Math, 'acosh',
1675 function acosh(x) {
1676 x = Number(x);
1677 return log(x + sqrt(x * x - 1));
1678 });
1679
1680 // 20.2.2.4 Math.asin ( x )
1681
1682 // 20.2.2.5 Math.asinh( x )
1683 define(
1684 Math, 'asinh',
1685 function asinh(x) {
1686 x = Number(x);
1687 if (SameValue(x, -0)) {
1688 return x;
1689 }
1690 var s = sqrt(x * x + 1);
1691 return (s === -x) ? log(0) : log(x + s);
1692 });
1693
1694 // 20.2.2.6 Math.atan ( x )
1695
1696 // 20.2.2.7 Math.atanh( x )
1697 define(
1698 Math, 'atanh',
1699 function atanh(x) {
1700 x = Number(x);
1701 return (x === 0) ? x : log((1 + x) / (1 - x)) / 2;
1702 });
1703
1704 // 20.2.2.8 Math.atan2 ( y, x )
1705
1706 // 20.2.2.9 Math.cbrt ( x )
1707 define(
1708 Math, 'cbrt',
1709 function cbrt(x) {
1710 x = Number(x);
1711 if ($isNaN(x/x)) {
1712 return x;
1713 }
1714 var r = pow(abs(x), 1/3);
1715 var t = x/r/r;
1716 return r + (r * (t-r) / (2*r + t));
1717 });
1718
1719 // 20.2.2.10 Math.ceil ( x )
1720
1721 // 20.2.2.11 Math.clz32 ( x )
1722 define(
1723 Math, 'clz32',
1724 function clz32(x) {
1725 function clz8(x) {
1726 return (x & 0xf0) ? (x & 0x80 ? 0 : x & 0x40 ? 1 : x & 0x20 ? 2 : 3) :
1727 (x & 0x08 ? 4 : x & 0x04 ? 5 : x & 0x02 ? 6 : x & 0x01 ? 7 : 8);
1728 }
1729 x = ToUint32(x);
1730 return x & 0xff000000 ? clz8(x >> 24) :
1731 x & 0xff0000 ? clz8(x >> 16) + 8 :
1732 x & 0xff00 ? clz8(x >> 8) + 16 : clz8(x) + 24;
1733 });
1734
1735
1736
1737 // 20.2.2.12 Math.cos ( x )
1738
1739 // 20.2.2.13 Math.cosh ( x )
1740 define(
1741 Math, 'cosh',
1742 function cosh(x) {
1743 x = Number(x);
1744 return (pow(E, x) + pow(E, -x)) / 2;
1745 });
1746
1747 // 20.2.2.14 Math.exp ( x )
1748
1749 // 20.2.2.15 Math.expm1 ( x )
1750 define(
1751 Math, 'expm1',
1752 function expm1(x) {
1753 x = Number(x);
1754 // from: http://www.johndcook.com/cpp_log1p.html
1755 if (SameValue(x, -0)) {
1756 return -0;
1757 } else if (abs(x) < 1e-5) {
1758 return x + 0.5 * x * x; // two terms of Taylor expansion
1759 } else {
1760 return exp(x) - 1;
1761 }
1762 });
1763
1764 // 20.2.2.16 Math.floor ( x )
1765
1766 // 20.2.2.17 Math.fround ( x )
1767 define(
1768 Math, 'fround',
1769 function fround(x) {
1770 if ($isNaN(x)) {
1771 return NaN;
1772 }
1773 if (1/x === +Infinity || 1/x === -Infinity || x === +Infinity || x === -Infinity) {
1774 return x;
1775 }
1776 return (new Float32Array([x]))[0];
1777 });
1778
1779 // 20.2.2.18 Math.hypot ( value1 [, value2 [ ... ] ] )
1780 define(
1781 Math, 'hypot',
1782 function hypot() {
1783 var values = [];
1784 var m = 0, sawNaN = false;
1785 for (var i = 0; i < arguments.length; ++i) {
1786 var n = abs(Number(arguments[i]));
1787 if (n === Infinity) return n;
1788 if (n !== n) sawNaN = true;
1789 if (n > m) m = n;
1790 values[i] = n;
1791 }
1792 if (sawNaN) return NaN;
1793 if (m === 0) return +0;
1794 var sum = +0;
1795 for (i = 0; i < values.length; ++i) {
1796 var r = values[i] / m;
1797 sum = sum + r * r;
1798 }
1799 return m * sqrt(sum);
1800 });
1801
1802 // 20.2.2.19 Math.imul ( x, y )
1803 define(
1804 Math, 'imul',
1805 function imul(x, y) {
1806 var a = ToUint32(x);
1807 var b = ToUint32(y);
1808 // (slow but accurate)
1809 var ah = (a >>> 16) & 0xffff;
1810 var al = a & 0xffff;
1811 var bh = (b >>> 16) & 0xffff;
1812 var bl = b & 0xffff;
1813 return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0)|0);
1814 }, ('imul' in Math && Math.imul(1, 0x80000000) === 0) // Safari 7 bug
1815 );
1816
1817 // 20.2.2.20 Math.log ( x )
1818
1819 // 20.2.2.21 Math.log1p ( x )
1820 define(
1821 Math, 'log1p',
1822 function log1p(x) {
1823 x = Number(x);
1824 // from: http://www.johndcook.com/cpp_expm1.html
1825 if (x < -1) {
1826 return NaN;
1827 } else if (SameValue(x, -0)) {
1828 return -0;
1829 } else if (abs(x) > 1e-4) {
1830 return log(1 + x);
1831 } else {
1832 return (-0.5 * x + 1) * x;
1833 }
1834 });
1835
1836 // 20.2.2.22 Math.log10 ( x )
1837 define(
1838 Math, 'log10',
1839 function log10(x) {
1840 x = Number(x);
1841 return log(x) * LOG10E;
1842 });
1843
1844 // 20.2.2.23 Math.log2 ( x )
1845 define(
1846 Math, 'log2',
1847 function log2(x) {
1848 x = Number(x);
1849 return log(x) * LOG2E;
1850 });
1851
1852 // 20.2.2.24 Math.max ( value1, value2 , ...values )
1853 // 20.2.2.25 Math.min ( value1, value2 , ...values )
1854 // 20.2.2.26 Math.pow ( x, y )
1855 // 20.2.2.27 Math.random ( )
1856 // 20.2.2.28 Math.round ( x )
1857
1858 // 20.2.2.29 Math.sign(x)
1859 define(
1860 Math, 'sign',
1861 function sign(x) {
1862 x = Number(x);
1863 return x < 0 ? -1 : x > 0 ? 1 : x;
1864 });
1865
1866 // 20.2.2.30 Math.sin ( x )
1867
1868 // 20.2.2.31 Math.sinh( x )
1869 define(
1870 Math, 'sinh',
1871 function sinh(x) {
1872 x = Number(x);
1873 return SameValue(x, -0) ? x : (pow(E, x) - pow(E, -x)) / 2;
1874 });
1875
1876 // 20.2.2.32 Math.sqrt ( x )
1877 // 20.2.2.33 Math.tan ( x )
1878
1879 // 20.2.2.34 Math.tanh ( x )
1880 define(
1881 Math, 'tanh',
1882 function tanh(x) {
1883 x = Number(x);
1884 var n = pow(E, 2 * x) - 1,
1885 d = pow(E, 2 * x) + 1;
1886 if (SameValue(x, -0))
1887 return x;
1888 return (n === d) ? 1 : n / d; // Handle Infinity/Infinity
1889 });
1890
1891 // 20.2.2.35 Math.trunc ( x )
1892 define(
1893 Math, 'trunc',
1894 function trunc(x) {
1895 x = Number(x);
1896 return $isNaN(x) ? NaN :
1897 x < 0 ? ceil(x) : floor(x);
1898 });
1899
1900 // ---------------------------------------
1901 // 20.3 Date Objects
1902 // ---------------------------------------
1903
1904 // 20.3.1 Overview of Date Objects and Definitions of Abstract Operations
1905 // 20.3.1.1 Time Values and Time Range
1906 // 20.3.1.2 Day Number and Time within Day
1907 // 20.3.1.3 Year Number
1908 // 20.3.1.4 Month Number
1909 // 20.3.1.5 Date Number
1910 // 20.3.1.6 Week Day
1911 // 20.3.1.7 Local Time Zone Adjustment
1912 // 20.3.1.8 Daylight Saving Time Adjustment
1913 // 20.3.1.9 Local Time
1914 // 20.3.1.10 Hours, Minutes, Second, and Milliseconds
1915 // 20.3.1.11 MakeTime (hour, min, sec, ms)
1916 // 20.3.1.12 MakeDay (year, month, date)
1917 // 20.3.1.13 MakeDate (day, time)
1918 // 20.3.1.14 TimeClip (time)
1919 // 20.3.1.15 Date Time String Format
1920 // 20.3.1.15.1 Extended years
1921 // 20.3.2 The Date Constructor
1922 // 20.3.2.1 Date ( year, month [, date [ , hours [ , minutes [ , seconds [ , ms ] ] ] ] ] )
1923 // 20.3.2.2 Date ( value )
1924 // 20.3.2.3 Date ( )
1925 // 20.3.3 Properties of the Date Constructor
1926 // 20.3.3.1 Date.now ( )
1927 // 20.3.3.2 Date.parse (string)
1928 // 20.3.3.3 Date.prototype
1929 // 20.3.3.4 Date.UTC ( year, month [ , date [ , hours [ , minutes [ , seconds [ , ms ] ] ] ] ] )
1930 // 20.3.4 Properties of the Date Prototype Object
1931 // 20.3.4.1 Date.prototype.constructor
1932 // 20.3.4.2 Date.prototype.getDate ( )
1933 // 20.3.4.3 Date.prototype.getDay ( )
1934 // 20.3.4.4 Date.prototype.getFullYear ( )
1935 // 20.3.4.5 Date.prototype.getHours ( )
1936 // 20.3.4.6 Date.prototype.getMilliseconds ( )
1937 // 20.3.4.7 Date.prototype.getMinutes ( )
1938 // 20.3.4.8 Date.prototype.getMonth ( )
1939 // 20.3.4.9 Date.prototype.getSeconds ( )
1940 // 20.3.4.10 Date.prototype.getTime ( )
1941 // 20.3.4.11 Date.prototype.getTimezoneOffset ( )
1942 // 20.3.4.12 Date.prototype.getUTCDate ( )
1943 // 20.3.4.13 Date.prototype.getUTCDay ( )
1944 // 20.3.4.14 Date.prototype.getUTCFullYear ( )
1945 // 20.3.4.15 Date.prototype.getUTCHours ( )
1946 // 20.3.4.16 Date.prototype.getUTCMilliseconds ( )
1947 // 20.3.4.17 Date.prototype.getUTCMinutes ( )
1948 // 20.3.4.18 Date.prototype.getUTCMonth ( )
1949 // 20.3.4.19 Date.prototype.getUTCSeconds ( )
1950 // 20.3.4.20 Date.prototype.setDate ( date )
1951 // 20.3.4.21 Date.prototype.setFullYear ( year [ , month [ , date ] ] )
1952 // 20.3.4.22 Date.prototype.setHours ( hour [ , min [ , sec [ , ms ] ] ] )
1953 // 20.3.4.23 Date.prototype.setMilliseconds ( ms )
1954 // 20.3.4.24 Date.prototype.setMinutes ( min [ , sec [ , ms ] ] )
1955 // 20.3.4.25 Date.prototype.setMonth ( month [ , date ] )
1956 // 20.3.4.26 Date.prototype.setSeconds ( sec [ , ms ] )
1957 // 20.3.4.27 Date.prototype.setTime ( time )
1958 // 20.3.4.28 Date.prototype.setUTCDate ( date )
1959 // 20.3.4.29 Date.prototype.setUTCFullYear ( year [ , month [ , date ] ] )
1960 // 20.3.4.30 Date.prototype.setUTCHours ( hour [ , min [ , sec [ , ms ] ] ] )
1961 // 20.3.4.31 Date.prototype.setUTCMilliseconds ( ms )
1962 // 20.3.4.32 Date.prototype.setUTCMinutes ( min [ , sec [, ms ] ] )
1963 // 20.3.4.33 Date.prototype.setUTCMonth ( month [ , date ] )
1964 // 20.3.4.34 Date.prototype.setUTCSeconds ( sec [ , ms ] )
1965 // 20.3.4.35 Date.prototype.toDateString ( )
1966 // 20.3.4.36 Date.prototype.toISOString ( )
1967 // 20.3.4.37 Date.prototype.toJSON ( key )
1968 // 20.3.4.38 Date.prototype.toLocaleDateString ( [ reserved1 [ , reserved2 ] ] )
1969 // 20.3.4.39 Date.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
1970 // 20.3.4.40 Date.prototype.toLocaleTimeString ( [ reserved1 [ , reserved2 ] ] )
1971 // 20.3.4.41 Date.prototype.toString ( )
1972 // 20.3.4.42 Date.prototype.toTimeString ( )
1973 // 20.3.4.43 Date.prototype.toUTCString ( )
1974 // 20.3.4.44 Date.prototype.valueOf ( )
1975 // 20.3.4.45 Date.prototype [ @@toPrimitive ] ( hint )
1976 // 20.3.5 Properties of Date Instances
1977
1978 // (No polyfillable changes from ES5)
1979
1980 // ---------------------------------------
1981 // 21 Text Processing
1982 // ---------------------------------------
1983
1984 var string_regexp_dispatch = (function() {
1985 var faux = {}, secret = Symbol();
1986 faux[Symbol.match] = function() { return secret; };
1987 return ("").match(faux) === secret;
1988 }());
1989
1990 // 21.1 String Objects
1991 // 21.1.1 The String Constructor
1992 // 21.1.1.1 String ( value )
1993 // 21.1.2 Properties of the String Constructor
1994 // 21.1.2.1 String.fromCharCode ( ...codeUnits )
1995
1996 // 21.1.2.2 String.fromCodePoint ( ...codePoints )
1997 define(
1998 String, 'fromCodePoint',
1999 function fromCodePoint(/*...codePoints*/) {
2000 var codePoints = arguments,
2001 length = codePoints.length,
2002 elements = [],
2003 nextIndex = 0;
2004 while (nextIndex < length) {
2005 var next = codePoints[nextIndex];
2006 var nextCP = Number(next);
2007 if (!SameValue(nextCP, ToInteger(nextCP)) ||
2008 nextCP < 0 || nextCP > 0x10FFFF) {
2009 throw RangeError('Invalid code point ' + nextCP);
2010 }
2011 if (nextCP < 0x10000) {
2012 elements.push(String.fromCharCode(nextCP));
2013 } else {
2014 nextCP -= 0x10000;
2015 elements.push(String.fromCharCode((nextCP >> 10) + 0xD800));
2016 elements.push(String.fromCharCode((nextCP % 0x400) + 0xDC00));
2017 }
2018 nextIndex += 1;
2019 }
2020 return elements.join('');
2021 });
2022
2023 // 21.1.2.3 String.prototype
2024
2025 // 21.1.2.4 String.raw ( template , ...substitutions )
2026 define(
2027 String, 'raw',
2028 function raw(template /*, ...substitutions*/) {
2029 var substitutions = [].slice.call(arguments, 1);
2030
2031 var cooked = Object(template);
2032 var rawValue = cooked['raw'];
2033 var raw = Object(rawValue);
2034 var len = raw['length'];
2035 var literalSegments = ToLength(len);
2036 if (literalSegments <= 0) return '';
2037 var stringElements = [];
2038 var nextIndex = 0;
2039 while (true) {
2040 var next = raw[nextIndex];
2041 var nextSeg = String(next);
2042 stringElements.push(nextSeg);
2043 if (nextIndex + 1 === literalSegments)
2044 return stringElements.join('');
2045 next = substitutions[nextIndex];
2046 var nextSub = String(next);
2047 stringElements.push(nextSub);
2048 nextIndex = nextIndex + 1;
2049 }
2050 });
2051
2052 // See https://githib.com/inexorabletash/uate for a more useful version.
2053
2054 // 21.1.3 Properties of the String Prototype Object
2055 // 21.1.3.1 String.prototype.charAt ( pos )
2056 // 21.1.3.2 String.prototype.charCodeAt ( pos )
2057
2058 // 21.1.3.3 String.prototype.codePointAt ( pos )
2059 define(
2060 String.prototype, 'codePointAt',
2061 function codePointAt(pos) {
2062 var o = strict(this);
2063 var s = String(o);
2064 var position = ToInteger(pos);
2065 var size = s.length;
2066 if (position < 0 || position >= size) return undefined;
2067 var first = s.charCodeAt(position);
2068 if (first < 0xD800 || first > 0xDBFF || position + 1 === size) return first;
2069 var second = s.charCodeAt(position + 1);
2070 if (second < 0xDC00 || second > 0xDFFF) return first;
2071 return ((first - 0xD800) * 1024) + (second - 0xDC00) + 0x10000;
2072 });
2073
2074 // 21.1.3.4 String.prototype.concat ( ...args )
2075 // 21.1.3.5 String.prototype.constructor
2076
2077 // 21.1.3.6 String.prototype.endsWith ( searchString [ , endPosition] )
2078 define(
2079 String.prototype, 'endsWith',
2080 function endsWith(searchString) {
2081 var endPosition = arguments[1];
2082
2083 var o = strict(this);
2084 var s = String(o);
2085 var searchStr = String(searchString);
2086 var len = s.length;
2087 var pos = (endPosition === undefined) ? len : ToInteger(endPosition);
2088 var end = min(max(pos, 0), len);
2089 var searchLength = searchStr.length;
2090 var start = end - searchLength;
2091 if (start < 0) return false;
2092 if (s.substring(start, start + searchLength) === searchStr) return true;
2093 return false;
2094 });
2095
2096 // 21.1.3.7 String.prototype.includes ( searchString [ , position ] )
2097 define(
2098 String.prototype, 'includes',
2099 function includes(searchString) {
2100 var position = arguments[1];
2101
2102 var o = strict(this);
2103 var s = String(o);
2104 var searchStr = String(searchString);
2105 var pos = ToInteger(position);
2106 var len = s.length;
2107 var start = min(max(pos, 0), len);
2108 return s.indexOf(searchStr, start) !== -1;
2109 });
2110
2111 // 21.1.3.8 String.prototype.indexOf ( searchString [ , position ] )
2112 // 21.1.3.9 String.prototype.lastIndexOf ( searchString [ , position ] )
2113 // 21.1.3.10 String.prototype.localeCompare ( that [, reserved1 [ , reserved2 ] ] )
2114 // 21.1.3.11 String.prototype.match ( regexp )
2115 define(
2116 String.prototype, 'match',
2117 function match(regexp) {
2118 var o = strict(this);
2119 var s = String(o);
2120 if (HasProperty(regexp, $$match)) var rx = regexp;
2121 else rx = new RegExp(regexp);
2122 return rx[$$match](s);
2123 }, !string_regexp_dispatch);
2124
2125 // 21.1.3.12 String.prototype.normalize ( [ form ] )
2126
2127 // Not practical due to table sizes; if needed, pull in:
2128 // https://github.com/walling/unorm/
2129
2130 // 21.1.3.13 String.prototype.repeat ( count )
2131 define(
2132 String.prototype, 'repeat',
2133 function repeat(count) {
2134 var o = strict(this);
2135 var s = String(o);
2136 var n = ToInteger(count);
2137 if (n < 0) throw RangeError();
2138 if (n === Infinity) throw RangeError();
2139 var t = new Array(n + 1).join(s);
2140 return t;
2141 });
2142
2143 // 21.1.3.14 String.prototype.replace (searchValue, replaceValue )
2144 define(
2145 String.prototype, 'replace',
2146 function replace(searchValue, replaceValue) {
2147 var o = strict(this);
2148 if (HasProperty(searchValue, $$replace))
2149 return searchValue[$$replace](o, replaceValue);
2150 return orig_replace.call(o, searchValue, replaceValue);
2151 }, !string_regexp_dispatch);
2152
2153 // 21.1.3.15 String.prototype.search ( regexp )
2154 define(
2155 String.prototype, 'search',
2156 function search(regexp) {
2157 var o = strict(this);
2158 var string = String(o);
2159 if (HasProperty(regexp, $$search)) var rx = regexp;
2160 else rx = new RegExp(regexp);
2161 return rx[$$search](string);
2162 }, !string_regexp_dispatch);
2163
2164 // 21.1.3.16 String.prototype.slice ( start, end )
2165 // 21.1.3.17 String.prototype.split ( separator, limit )
2166 define(
2167 String.prototype, 'split',
2168 function split(separator, limit) {
2169 var o = strict(this);
2170 if (HasProperty(separator, $$split))
2171 return separator[$$split](o, limit);
2172 return orig_split.call(o, separator, limit);
2173 }, !string_regexp_dispatch);
2174
2175 // 21.1.3.18 String.prototype.startsWith ( searchString [, position ] )
2176 define(
2177 String.prototype, 'startsWith',
2178 function startsWith(searchString) {
2179 var position = arguments[1];
2180
2181 var o = strict(this);
2182 var s = String(o);
2183 var searchStr = String(searchString);
2184 var pos = ToInteger(position);
2185 var len = s.length;
2186 var start = min(max(pos, 0), len);
2187 var searchLength = searchStr.length;
2188 if (searchLength + start > len) return false;
2189 if (s.substring(start, start + searchLength) === searchStr) return true;
2190 return false;
2191 });
2192
2193 // 21.1.3.19 String.prototype.substring ( start, end )
2194 // 21.1.3.20 String.prototype.toLocaleLowerCase ( [ reserved1 [ , reserved2 ] ] )
2195 // 21.1.3.21 String.prototype.toLocaleUpperCase ([ reserved1 [ , reserved2 ] ] )
2196 // 21.1.3.22 String.prototype.toLowerCase ( )
2197 // 21.1.3.23 String.prototype.toString ( )
2198 // 21.1.3.24 String.prototype.toUpperCase ( )
2199 // 21.1.3.25 String.prototype.trim ( )
2200 // 21.1.3.26 String.prototype.valueOf ( )
2201
2202 // 21.1.3.27 String.prototype [ @@iterator ]( )
2203 define(
2204 String.prototype, $$iterator,
2205 function entries() {
2206 return CreateStringIterator(this, 'value');
2207 });
2208
2209 // 21.1.4 Properties of String Instances
2210 // 21.1.4.1 length
2211
2212 // 21.1.5 String Iterator Objects
2213 /** @constructor */
2214 function StringIterator() {}
2215
2216 // 21.1.5.1 CreateStringIterator Abstract Operation
2217 function CreateStringIterator(string, kind) {
2218 var s = String(string);
2219 var iterator = new StringIterator;
2220 set_internal(iterator, '[[IteratedString]]', s);
2221 set_internal(iterator, '[[StringIteratorNextIndex]]', 0);
2222 set_internal(iterator, '[[StringIterationKind]]', kind);
2223 return iterator;
2224 }
2225
2226 // 21.1.5.2 The %StringIteratorPrototype% Object
2227 var $StringIteratorPrototype$ = Object.create($IteratorPrototype$);
2228 StringIterator.prototype = $StringIteratorPrototype$;
2229
2230 // 21.1.5.2.1 %StringIteratorPrototype%.next ( )
2231 define(
2232 $StringIteratorPrototype$, 'next',
2233 function next() {
2234 var o = ToObject(this);
2235 var s = String(o['[[IteratedString]]']),
2236 index = o['[[StringIteratorNextIndex]]'],
2237 len = s.length;
2238 if (index >= len) {
2239 set_internal(o, '[[StringIteratorNextIndex]]', Infinity);
2240 return CreateIterResultObject(undefined, true);
2241 }
2242 var cp = s.codePointAt(index);
2243 set_internal(o, '[[StringIteratorNextIndex]]', index + (cp > 0xFFFF ? 2 : 1));
2244 return CreateIterResultObject(String.fromCodePoint(cp), false);
2245 });
2246
2247 // 21.1.5.2.2 %StringIteratorPrototype% [ @@toStringTag ]
2248 define($StringIteratorPrototype$, $$toStringTag, 'String Iterator');
2249
2250 // 21.1.5.3 Properties of String Iterator Instances
2251
2252 // ---------------------------------------
2253 // 21.2 RegExp (Regular Expression) Objects
2254 // ---------------------------------------
2255
2256 // 21.2.1 Patterns
2257 // 21.2.2 Pattern Semantics
2258 // 21.2.2.1 Notation
2259 // 21.2.2.2 Pattern
2260 // 21.2.2.3 Disjunction
2261 // 21.2.2.4 Alternative
2262 // 21.2.2.5 Term
2263 // 21.2.2.6 Assertion
2264 // 21.2.2.7 Quantifier
2265 // 21.2.2.8 Atom
2266 // 21.2.2.9 AtomEscape
2267 // 21.2.2.10 CharacterEscape
2268 // 21.2.2.11 DecimalEscape
2269 // 21.2.2.12 CharacterClassEscape
2270 // 21.2.2.13 CharacterClass
2271 // 21.2.2.14 ClassRanges
2272 // 21.2.2.15 NonemptyClassRanges
2273 // 21.2.2.16 NonemptyClassRangesNoDash
2274 // 21.2.2.17 ClassAtom
2275 // 21.2.2.18 ClassAtomNoDash
2276 // 21.2.2.19 ClassEscape
2277 // 21.2.3 The RegExp Constructor
2278 // 21.2.3.1 RegExp ( pattern, flags )
2279 // 21.2.3.2 new RegExp( ...argumentsList )
2280 // 21.2.3.3 Abstract Operations for the RegExp Constructor
2281 // 21.2.4 Properties of the RegExp Constructor
2282 // 21.2.4.1 RegExp.prototype
2283 // 21.2.5 Properties of the RegExp Prototype Object
2284 // 21.2.5.1 RegExp.prototype.constructor
2285 // 21.2.5.2 RegExp.prototype.exec ( string )
2286
2287 // 21.2.5.3 get RegExp.prototype.flags
2288 if (!('flags' in RegExp.prototype)) {
2289 Object.defineProperty(
2290 RegExp.prototype, 'flags', {
2291 get: function() {
2292 var s = String(this);
2293 return s.substring(s.lastIndexOf('/') + 1);
2294 }
2295 });
2296 }
2297
2298 // 21.2.5.4 get RegExp.prototype.global
2299 // 21.2.5.5 get RegExp.prototype.ignoreCase
2300
2301 // 21.2.5.6 RegExp.prototype [ @@match ] ( string )
2302 define(RegExp.prototype, $$match, function(string) {
2303 var o = strict(this);
2304 return orig_match.call(string, o);
2305 });
2306
2307 // 21.2.5.7 get RegExp.prototype.multiline
2308
2309 // 21.2.5.8 RegExp.prototype [ @@replace ] ( string, replaceValue )
2310 define(RegExp.prototype, $$replace, function(string, replaceValue) {
2311 var o = strict(this);
2312 return orig_replace.call(string, o, replaceValue);
2313 });
2314
2315 // 21.2.5.9 RegExp.prototype [ @@search ] ( string )
2316 define(RegExp.prototype, $$search, function(string) {
2317 var o = strict(this);
2318 return orig_search.call(string, o);
2319 });
2320
2321 // 21.2.5.10 get RegExp.prototype.source
2322
2323 // 21.2.5.11 RegExp.prototype [ @@split ] ( string, limit )
2324 define(RegExp.prototype, $$split, function(string, limit) {
2325 var o = strict(this);
2326 return orig_split.call(string, o, limit);
2327 });
2328
2329 // 21.2.5.12 get RegExp.prototype.sticky
2330 // 21.2.5.13 RegExp.prototype.test( S )
2331 // 21.2.5.14 RegExp.prototype.toString ( )
2332 // 21.2.5.15 get RegExp.prototype.unicode
2333
2334 // 21.2.6 Properties of RegExp Instances
2335 // 21.2.6.1 lastIndex
2336
2337 // (No polyfillable changes from ES5)
2338
2339 // ---------------------------------------
2340 // 22 Indexed Collections
2341 // ---------------------------------------
2342
2343 // ---------------------------------------
2344 // 22.1 Array Objects
2345 // ---------------------------------------
2346
2347 // 22.1.1 The Array Constructor
2348 // 22.1.1.1 Array ( )
2349 // 22.1.1.2 Array (len)
2350 // 22.1.1.3 Array (...items )
2351
2352 // 22.1.2 Properties of the Array Constructor
2353
2354 // 22.1.2.1 Array.from ( items [ , mapfn [ , thisArg ] ] )
2355 define(
2356 Array, 'from',
2357 function from(items) {
2358 var mapfn = arguments[1];
2359 var thisArg = arguments[2];
2360
2361 var c = strict(this);
2362 if (mapfn === undefined) {
2363 var mapping = false;
2364 } else {
2365 if (!IsCallable(mapfn)) throw TypeError();
2366 var t = thisArg;
2367 mapping = true;
2368 }
2369 var usingIterator = GetMethod(items, $$iterator);
2370 if (usingIterator !== undefined) {
2371 if (IsConstructor(c)) {
2372 var a = new c();
2373 } else {
2374 a = new Array(0);
2375 }
2376 var iterator = GetIterator(items, usingIterator);
2377 var k = 0;
2378 while (true) {
2379 var next = IteratorStep(iterator);
2380 if (next === false) {
2381 a.length = k;
2382 return a;
2383 }
2384 var nextValue = IteratorValue(next);
2385 if (mapping)
2386 var mappedValue = mapfn.call(t, nextValue);
2387 else
2388 mappedValue = nextValue;
2389 a[k] = mappedValue;
2390 k += 1;
2391 }
2392 }
2393 var arrayLike = ToObject(items);
2394 var lenValue = arrayLike.length;
2395 var len = ToLength(lenValue);
2396 if (IsConstructor(c)) {
2397 a = new c(len);
2398 } else {
2399 a = new Array(len);
2400 }
2401 k = 0;
2402 while (k < len) {
2403 var kValue = arrayLike[k];
2404 if (mapping)
2405 mappedValue = mapfn.call(t, kValue, k);
2406 else
2407 mappedValue = kValue;
2408 a[k] = mappedValue;
2409 k += 1;
2410 }
2411 a.length = len;
2412 return a;
2413 });
2414
2415 // 22.1.2.2 Array.isArray ( arg )
2416
2417 // 22.1.2.3 Array.of ( ...items )
2418 define(
2419 Array, 'of',
2420 function of() {
2421 var items = arguments;
2422
2423 var lenValue = items.length;
2424 var len = ToUint32(lenValue);
2425 var c = strict(this), a;
2426 if (IsConstructor(c)) {
2427 a = new c(len);
2428 a = ToObject(a);
2429 } else {
2430 a = new Array(len);
2431 }
2432 var k = 0;
2433 while (k < len) {
2434 a[k] = items[k];
2435 k += 1;
2436 }
2437 a.length = len;
2438 return a;
2439 });
2440
2441 // 22.1.2.4 Array.prototype
2442 // 22.1.2.5 get Array [ @@species ]
2443 // 22.1.3 Properties of the Array Prototype Object
2444 // 22.1.3.1 Array.prototype.concat ( ...arguments )
2445 // 22.1.3.1.1 Runtime Semantics: IsConcatSpreadable ( O )
2446 // 22.1.3.2 Array.prototype.constructor
2447 // 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
2448 define(
2449 Array.prototype, 'copyWithin',
2450 function copyWithin(target, start/*, end*/) {
2451 var end = arguments[2];
2452
2453 var o = ToObject(this);
2454 var lenVal = o.length;
2455 var len = ToLength(lenVal);
2456 len = max(len, 0);
2457 var relativeTarget = ToInteger(target);
2458 var to;
2459 if (relativeTarget < 0)
2460 to = max(len + relativeTarget, 0);
2461 else
2462 to = min(relativeTarget, len);
2463 var relativeStart = ToInteger(start);
2464 var from;
2465 if (relativeStart < 0)
2466 from = max(len + relativeStart, 0);
2467 else
2468 from = min(relativeStart, len);
2469 var relativeEnd;
2470 if (end === undefined)
2471 relativeEnd = len;
2472 else
2473 relativeEnd = ToInteger(end);
2474 var final;
2475 if (relativeEnd < 0)
2476 final = max(len + relativeEnd, 0);
2477 else
2478 final = min(relativeEnd, len);
2479 var count = min(final - from, len - to);
2480 var direction;
2481 if (from < to && to < from + count) {
2482 direction = -1;
2483 from = from + count - 1;
2484 to = to + count - 1;
2485 } else {
2486 direction = 1;
2487 }
2488 while (count > 0) {
2489 var fromKey = String(from);
2490 var toKey = String(to);
2491 var fromPresent = HasProperty(o, fromKey);
2492 if (fromPresent) {
2493 var fromVal = o[fromKey];
2494 o[toKey] = fromVal;
2495 } else {
2496 delete o[toKey];
2497 }
2498 from = from + direction;
2499 to = to + direction;
2500 count = count - 1;
2501 }
2502 return o;
2503 });
2504
2505 // 22.1.3.4 Array.prototype.entries ( )
2506 var nativeArrayIteratorMethods =
2507 ('entries' in Array.prototype && 'next' in [].entries());
2508
2509 define(
2510 Array.prototype, 'entries',
2511 function entries() {
2512 return CreateArrayIterator(this, 'key+value');
2513 }, !nativeArrayIteratorMethods);
2514
2515 // 22.1.3.5 Array.prototype.every ( callbackfn [ , thisArg] )
2516
2517 // 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] )
2518 define(
2519 Array.prototype, 'fill',
2520 function fill(value/*, start, end*/) {
2521 var start = arguments[1],
2522 end = arguments[2];
2523
2524 var o = ToObject(this);
2525 var lenVal = o.length;
2526 var len = ToLength(lenVal);
2527 len = max(len, 0);
2528 var relativeStart = ToInteger(start);
2529 var k;
2530 if (relativeStart < 0)
2531 k = max((len + relativeStart), 0);
2532 else
2533 k = min(relativeStart, len);
2534 var relativeEnd;
2535 if (end === undefined)
2536 relativeEnd = len;
2537 else
2538 relativeEnd = ToInteger(end);
2539 var final;
2540 if (relativeEnd < 0)
2541 final = max((len + relativeEnd), 0);
2542 else
2543 final = min(relativeEnd, len);
2544 while (k < final) {
2545 var pk = String(k);
2546 o[pk] = value;
2547 k += 1;
2548 }
2549 return o;
2550 });
2551
2552 // 22.1.3.7 Array.prototype.filter ( callbackfn [ , thisArg ] )
2553
2554 // 22.1.3.8 Array.prototype.find ( predicate [ , thisArg ] )
2555 define(
2556 Array.prototype, 'find',
2557 function find(predicate) {
2558 var o = ToObject(this);
2559 var lenValue = o.length;
2560 var len = ToInteger(lenValue);
2561 if (!IsCallable(predicate)) throw TypeError();
2562 var t = arguments.length > 1 ? arguments[1] : undefined;
2563 var k = 0;
2564 while (k < len) {
2565 var pk = String(k);
2566 var kPresent = HasProperty(o, pk);
2567 if (kPresent) {
2568 var kValue = o[pk];
2569 var testResult = predicate.call(t, kValue, k, o);
2570 if (Boolean(testResult)) {
2571 return kValue;
2572 }
2573 }
2574 ++k;
2575 }
2576 return undefined;
2577 });
2578
2579 // 22.1.3.9 Array.prototype.findIndex ( predicate [ , thisArg ] )
2580 define(
2581 Array.prototype, 'findIndex',
2582 function findIndex(predicate) {
2583 var o = ToObject(this);
2584 var lenValue = o.length;
2585 var len = ToLength(lenValue);
2586 if (!IsCallable(predicate)) throw TypeError();
2587 var t = arguments.length > 1 ? arguments[1] : undefined;
2588 var k = 0;
2589 while (k < len) {
2590 var pk = String(k);
2591 var kPresent = HasProperty(o, pk);
2592 if (kPresent) {
2593 var kValue = o[pk];
2594 var testResult = predicate.call(t, kValue, k, o);
2595 if (Boolean(testResult)) {
2596 return k;
2597 }
2598 }
2599 ++k;
2600 }
2601 return -1;
2602 });
2603
2604 // 22.1.3.10 Array.prototype.forEach ( callbackfn [ , thisArg ] )
2605 // 22.1.3.11 Array.prototype.indexOf ( searchElement [ , fromIndex ] )
2606 // 22.1.3.12 Array.prototype.join (separator)
2607
2608 // 22.1.3.13 Array.prototype.keys ( )
2609 define(
2610 Array.prototype, 'keys',
2611 function keys() {
2612 return CreateArrayIterator(this, 'key');
2613 }, !nativeArrayIteratorMethods);
2614
2615 // 22.1.3.14 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
2616 // 22.1.3.15 Array.prototype.map ( callbackfn [ , thisArg ] )
2617 // 22.1.3.16 Array.prototype.pop ( )
2618 // 22.1.3.17 Array.prototype.push ( ...items )
2619 // 22.1.3.18 Array.prototype.reduce ( callbackfn [ , initialValue ] )
2620 // 22.1.3.19 Array.prototype.reduceRight ( callbackfn [ , initialValue ] )
2621 // 22.1.3.20 Array.prototype.reverse ( )
2622 // 22.1.3.21 Array.prototype.shift ( )
2623 // 22.1.3.22 Array.prototype.slice (start, end)
2624 // 22.1.3.23 Array.prototype.some ( callbackfn [ , thisArg ] )
2625 // 22.1.3.24 Array.prototype.sort (comparefn)
2626 // 22.1.3.25 Array.prototype.splice (start, deleteCount , ...items )
2627 // 22.1.3.26 Array.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )
2628 // 22.1.3.27 Array.prototype.toString ( )
2629 // 22.1.3.28 Array.prototype.unshift ( ...items )
2630
2631 // 22.1.3.29 Array.prototype.values ( )
2632 define(
2633 Array.prototype, 'values',
2634 function values() {
2635 return CreateArrayIterator(this, 'value');
2636 }, !nativeArrayIteratorMethods);
2637
2638 // 22.1.3.30 Array.prototype [ @@iterator ] ( )
2639 define(
2640 Array.prototype, $$iterator,
2641 Array.prototype.values
2642 );
2643
2644 // 22.1.3.31 Array.prototype [ @@unscopables ]
2645 // 22.1.4 Properties of Array Instances
2646 // 22.1.4.1 length
2647
2648 // 22.1.5 Array Iterator Objects
2649 function ArrayIterator() {}
2650
2651 // 22.1.5.1 CreateArrayIterator Abstract Operation
2652 function CreateArrayIterator(array, kind) {
2653 var o = ToObject(array);
2654 var iterator = new ArrayIterator;
2655 set_internal(iterator, '[[IteratedObject]]', o);
2656 set_internal(iterator, '[[ArrayIteratorNextIndex]]', 0);
2657 set_internal(iterator, '[[ArrayIterationKind]]', kind);
2658 return iterator;
2659 }
2660
2661 // 22.1.5.2 The %ArrayIteratorPrototype% Object
2662 var $ArrayIteratorPrototype$ = Object.create($IteratorPrototype$);
2663 ArrayIterator.prototype = $ArrayIteratorPrototype$;
2664
2665 // 22.1.5.2.1 %ArrayIteratorPrototype%. next( )
2666 define(
2667 $ArrayIteratorPrototype$, 'next',
2668 function next() {
2669 var o = strict(this);
2670 if (Type(o) !== 'object') throw TypeError();
2671 var a = o['[[IteratedObject]]'],
2672 index = o['[[ArrayIteratorNextIndex]]'],
2673 itemKind = o['[[ArrayIterationKind]]'],
2674 lenValue = a.length,
2675 len = ToUint32(lenValue),
2676 elementKey,
2677 elementValue;
2678 if (itemKind.indexOf('sparse') !== -1) {
2679 var found = false;
2680 while (!found && index < len) {
2681 elementKey = String(index);
2682 found = HasProperty(a, elementKey);
2683 if (!found) {
2684 index += 1;
2685 }
2686 }
2687 }
2688 if (index >= len) {
2689 set_internal(o, '[[ArrayIteratorNextIndex]]', Infinity);
2690 return CreateIterResultObject(undefined, true);
2691 }
2692 elementKey = index;
2693 set_internal(o, '[[ArrayIteratorNextIndex]]', index + 1);
2694 if (itemKind.indexOf('value') !== -1)
2695 elementValue = a[elementKey];
2696 if (itemKind.indexOf('key+value') !== -1)
2697 return CreateIterResultObject([elementKey, elementValue], false);
2698 if (itemKind.indexOf('key') !== -1)
2699 return CreateIterResultObject(elementKey, false);
2700 if (itemKind === 'value')
2701 return CreateIterResultObject(elementValue, false);
2702 throw Error('Internal error');
2703 });
2704
2705 // 22.1.5.2.2 %ArrayIteratorPrototype% [ @@toStringTag ]
2706 define($ArrayIteratorPrototype$, $$toStringTag, 'Array Iterator');
2707
2708 // 22.1.5.3 Properties of Array Iterator Instances
2709
2710
2711 // ---------------------------------------
2712 // 22.2 TypedArray Objects
2713 // ---------------------------------------
2714
2715 // See typedarray.js for TypedArray polyfill
2716
2717 ['Int8Array', 'Uint8Array', 'Uint8ClampedArray',
2718 'Int16Array', 'Uint16Array',
2719 'Int32Array', 'Uint32Array',
2720 'Float32Array', 'Float64Array'].forEach(function ($TypedArrayName$) {
2721 if (!($TypedArrayName$ in global))
2722 return;
2723 var $TypedArray$ = global[$TypedArrayName$];
2724
2725 // 22.2.1 The %TypedArray% Intrinsic Object
2726 // 22.2.1.1 %TypedArray% ( length )
2727 // 22.2.1.2 %TypedArray% ( typedArray )
2728 // 22.2.1.3 %TypedArray% ( object )
2729 // 22.2.1.4 %TypedArray% ( buffer [ , byteOffset [ , length ] ] )
2730 // 22.2.1.5 %TypedArray% ( all other argument combinations )
2731 // 22.2.2 Properties of the %TypedArray% Intrinsic Object
2732
2733 // 22.2.2.1 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] )
2734 define(
2735 $TypedArray$, 'from',
2736 function from(source) {
2737 var mapfn = arguments[1];
2738 var thisArg = arguments[2];
2739
2740 var c = strict(this);
2741 if (!IsConstructor(c)) throw TypeError();
2742 if (mapfn === undefined) {
2743 var mapping = false;
2744 } else {
2745 if (IsCallable(mapfn)) throw TypeError();
2746 var t = thisArg;
2747 mapping = true;
2748 }
2749 var usingIterator = GetMethod(source, $$iterator);
2750 if (usingIterator !== undefined) {
2751 var iterator = GetIterator(source, usingIterator);
2752 var values = [];
2753 var next = true;
2754 while (next !== false) {
2755 next = IteratorStep(iterator);
2756 if (next !== false) {
2757 var nextValue = IteratorValue(next);
2758 values.push(nextValue);
2759 }
2760 }
2761 var len = values.length;
2762 var newObj = new c(len);
2763 var k = 0;
2764 while (k < len) {
2765 var kValue = values.shift();
2766 if (mapping) {
2767 var mappedValue = mapfn.call(t, kValue);
2768 } else {
2769 mappedValue = kValue;
2770 }
2771 newObj[k] = mappedValue;
2772 ++k;
2773 }
2774 console.assert(values.length === 0);
2775 return newObj;
2776 }
2777 var arrayLike = ToObject(source);
2778 var lenValue = arrayLike.length;
2779 len = ToLength(lenValue);
2780 newObj = new c(len);
2781 k = 0;
2782 while (k < len) {
2783 kValue = arrayLike[k];
2784 if (mapping) {
2785 mappedValue = mapfn.call(t, kValue, k);
2786 } else {
2787 mappedValue = kValue;
2788 }
2789 newObj[k] = mappedValue;
2790 ++k;
2791 }
2792 return newObj;
2793 });
2794
2795 // 22.2.2.2 %TypedArray%.of ( ...items )
2796 define(
2797 $TypedArray$, 'of',
2798 function of() {
2799 var items = arguments;
2800
2801 var len = items.length;
2802 var c = strict(this);
2803 var newObj = new c(len);
2804 var k = 0;
2805 while (k < len) {
2806 newObj[k] = items[k];
2807 ++k;
2808 }
2809 return newObj;
2810 });
2811
2812 // 22.2.2.3 %TypedArray%.prototype
2813 // 22.2.2.4 get %TypedArray% [ @@species ]
2814 // 22.2.3 Properties of the %TypedArrayPrototype% Object
2815 // 22.2.3.1 get %TypedArray%.prototype.buffer
2816 // 22.2.3.2 get %TypedArray%.prototype.byteLength
2817 // 22.2.3.3 get %TypedArray%.prototype.byteOffset
2818 // 22.2.3.4 %TypedArray%.prototype.constructor
2819
2820 // 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
2821 define($TypedArray$.prototype, 'copyWithin', Array.prototype.copyWithin);
2822
2823 // 22.2.3.6 %TypedArray%.prototype.entries ( )
2824 define($TypedArray$.prototype, 'entries', Array.prototype.entries);
2825
2826 // 22.2.3.7 %TypedArray%.prototype.every ( callbackfn [ , thisArg ] )
2827 define($TypedArray$.prototype, 'every', Array.prototype.every);
2828
2829 // 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] )
2830 define(
2831 $TypedArray$.prototype, 'fill',
2832 //Array.prototype.fill // Doesn't work in Safari 7
2833 function fill(value/*, start, end*/) {
2834 var start = arguments[1],
2835 end = arguments[2];
2836
2837 var o = ToObject(this);
2838 var lenVal = o.length;
2839 var len = ToLength(lenVal);
2840 len = max(len, 0);
2841 var relativeStart = ToInteger(start);
2842 var k;
2843 if (relativeStart < 0) k = max((len + relativeStart), 0);
2844 else k = min(relativeStart, len);
2845 var relativeEnd;
2846 if (end === undefined) relativeEnd = len;
2847 else relativeEnd = ToInteger(end);
2848 var final;
2849 if (relativeEnd < 0) final = max((len + relativeEnd), 0);
2850 else final = min(relativeEnd, len);
2851 while (k < final) {
2852 var pk = String(k);
2853 o[pk] = value;
2854 k += 1;
2855 }
2856 return o;
2857 });
2858
2859 // 22.2.3.9 %TypedArray%.prototype.filter ( callbackfn [ , thisArg ] )
2860 define(
2861 $TypedArray$.prototype, 'filter',
2862 function filter(callbackfn) {
2863 var thisArg = arguments[1];
2864
2865 var o = ToObject(this);
2866 var lenVal = o.length;
2867 var len = ToLength(lenVal);
2868 if (!IsCallable(callbackfn)) throw TypeError();
2869 var t = thisArg;
2870 var c = o.constructor;
2871 var kept = [];
2872 var k = 0;
2873 var captured = 0;
2874 while (k < len) {
2875 var kValue = o[k];
2876 var selected = callbackfn.call(t, kValue, k, o);
2877 if (selected) {
2878 kept.push(kValue);
2879 ++captured;
2880 }
2881 ++k;
2882 }
2883 var a = new c(captured);
2884 var n = 0;
2885 for (var i = 0; i < kept.length; ++i) {
2886 var e = kept[i];
2887 a[n] = e;
2888 ++n;
2889 }
2890 return a;
2891 });
2892
2893 // 22.2.3.10 %TypedArray%.prototype.find (predicate [ , thisArg ] )
2894 define($TypedArray$.prototype, 'find', Array.prototype.find);
2895
2896 // 22.2.3.11 %TypedArray%.prototype.findIndex ( predicate [ , thisArg ] )
2897 define($TypedArray$.prototype, 'findIndex', Array.prototype.findIndex);
2898
2899 // 22.2.3.12 %TypedArray%.prototype.forEach ( callbackfn [ , thisArg ] )
2900 define($TypedArray$.prototype, 'forEach', Array.prototype.forEach);
2901
2902 // 22.2.3.13 %TypedArray%.prototype.indexOf (searchElement [ , fromIndex ] )
2903 define($TypedArray$.prototype, 'indexOf', Array.prototype.indexOf);
2904
2905 // 22.2.3.14 %TypedArray%.prototype.join ( separator )
2906 define($TypedArray$.prototype, 'join', Array.prototype.join);
2907
2908 // 22.2.3.15 %TypedArray%.prototype.keys ( )
2909 define($TypedArray$.prototype, 'keys', Array.prototype.keys);
2910
2911 // 22.2.3.16 %TypedArray%.prototype.lastIndexOf ( searchElement [ , fromIndex ] )
2912 define($TypedArray$.prototype, 'lastIndexOf', Array.prototype.lastIndexOf);
2913
2914 // 22.2.3.17 get %TypedArray%.prototype.length
2915
2916 // 22.2.3.18 %TypedArray%.prototype.map ( callbackfn [ , thisArg ] )
2917 define(
2918 $TypedArray$.prototype, 'map',
2919 function map(callbackfn) {
2920 var thisArg = arguments[1];
2921
2922 var o = ToObject(this);
2923 var lenValue = o.length;
2924 var len = ToLength(lenValue);
2925 if (!IsCallable(callbackfn)) throw TypeError();
2926 var t = thisArg;
2927 var a = undefined;
2928 var c = o.constructor;
2929 if (IsConstructor(c))
2930 a = new c(len);
2931 if (a === undefined)
2932 a = new Array(len);
2933 var k = 0;
2934 while (k < len) {
2935 var kPresent = HasProperty(o, k);
2936 if (kPresent) {
2937 var kValue = o[k];
2938 var mappedValue = callbackfn.call(t, kValue, k, o);
2939 a[k] = mappedValue;
2940 }
2941 ++k;
2942 }
2943 return a;
2944 });
2945
2946 // 22.2.3.19 %TypedArray%.prototype.reduce ( callbackfn [, initialValue] )
2947 define($TypedArray$.prototype, 'reduce', Array.prototype.reduce);
2948
2949 // 22.2.3.20 %TypedArray%.prototype.reduceRight ( callbackfn [, initialValue] )
2950 define($TypedArray$.prototype, 'reduceRight', Array.prototype.reduceRight);
2951
2952 // 22.2.3.21 %TypedArray%.prototype.reverse ( )
2953 define($TypedArray$.prototype, 'reverse', Array.prototype.reverse);
2954
2955 // 22.2.3.22 %TypedArray%.prototype.set ( overloaded [ , offset ])
2956 // 22.2.3.22.1 %TypedArray%.prototype.set (array [ , offset ] )
2957 // 22.2.3.22.2 %TypedArray%.prototype.set(typedArray [, offset ] )
2958
2959 // 22.2.3.23 %TypedArray%.prototype.slice ( start, end )
2960 define(
2961 $TypedArray$.prototype, 'slice',
2962 function slice(start, end) {
2963 var o = ToObject(this);
2964 var lenVal = o.length;
2965 var len = ToLength(lenVal);
2966 var relativeStart = ToInteger(start);
2967 var k = (relativeStart < 0) ? max(len + relativeStart, 0) : min(relativeStart, len);
2968 var relativeEnd = (end === undefined) ? len : ToInteger(end);
2969 var final = (relativeEnd < 0) ? max(len + relativeEnd, 0) : min(relativeEnd, len);
2970 var count = final - k;
2971 var c = o.constructor;
2972 if (IsConstructor(c)) {
2973 var a = new c(count);
2974 } else {
2975 throw TypeError();
2976 }
2977 var n = 0;
2978 while (k < final) {
2979 var kValue = o[k];
2980 a[n] = kValue;
2981 ++k;
2982 ++n;
2983 }
2984 return a;
2985 });
2986
2987 // 22.2.3.24 %TypedArray%.prototype.some ( callbackfn [ , thisArg ] )
2988 define($TypedArray$.prototype, 'some', Array.prototype.some);
2989
2990 // 22.2.3.25 %TypedArray%.prototype.sort ( comparefn )
2991 define(
2992 $TypedArray$.prototype, 'sort',
2993 function sort() {
2994 var comparefn = arguments[0];
2995
2996 function sortCompare(x, y) {
2997 console.assert(Type(x) === 'number' && Type(y) === 'number');
2998 if (x !== x && y !== y) return +0;
2999 if (x !== x) return 1;
3000 if (y !== y) return -1;
3001 if (comparefn !== undefined) {
3002 return comparefn(x, y);
3003 }
3004 if (x < y) return -1;
3005 if (x > y) return 1;
3006 return +0;
3007 }
3008 return Array.prototype.sort.call(this, sortCompare);
3009 });
3010
3011 // 22.2.3.26 %TypedArray%.prototype.subarray( [ begin [ , end ] ] )
3012 // 22.2.3.27 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
3013 // 22.2.3.28 %TypedArray%.prototype.toString ( )
3014
3015 // 22.2.3.29 %TypedArray%.prototype.values ( )
3016 define($TypedArray$.prototype, 'values', Array.prototype.values);
3017
3018 // 22.2.3.30 %TypedArray%.prototype [ @@iterator ] ( )
3019 define(
3020 $TypedArray$.prototype, $$iterator,
3021 $TypedArray$.prototype.values
3022 );
3023
3024 // 22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
3025 define($TypedArray$.prototype, $$toStringTag, $TypedArrayName$);
3026
3027 // 22.2.4 The TypedArray Constructors
3028 // 22.2.4.1TypedArray( ... argumentsList)
3029 // 22.2.5 Properties of the TypedArray Constructors
3030 // 22.2.5.1 TypedArray.BYTES_PER_ELEMENT
3031 // 22.2.5.2 TypedArray.prototype
3032 // 22.2.6 Properties of TypedArray Prototype Objects
3033 // 22.2.6.1 TypedArray.prototype.BYTES_PER_ELEMENT
3034 // 22.2.6.2 TypedArray.prototype.constructor
3035 // 22.2.7 Properties of TypedArray Instances
3036 });
3037
3038 // ---------------------------------------
3039 // 23 Keyed Collection
3040 // ---------------------------------------
3041
3042 // ---------------------------------------
3043 // 23.1 Map Objects
3044 // ---------------------------------------
3045
3046 (function() {
3047 // 23.1.1 The Map Constructor
3048
3049 // 23.1.1.1 Map ( [ iterable ] )
3050 /** @constructor */
3051 function Map(/*iterable*/) {
3052 var map = strict(this);
3053 var iterable = arguments[0];
3054
3055 if (Type(map) !== 'object') throw TypeError();
3056 if ('[[MapData]]' in map) throw TypeError();
3057
3058 if (iterable !== undefined) {
3059 var adder = map['set'];
3060 if (!IsCallable(adder)) throw TypeError();
3061 var iter = GetIterator(ToObject(iterable));
3062 }
3063 set_internal(map, '[[MapData]]', { keys: [], values: [] });
3064 if (iter === undefined) return map;
3065 while (true) {
3066 var next = IteratorStep(iter);
3067 if (next === false)
3068 return map;
3069 var nextItem = IteratorValue(next);
3070 if (Type(nextItem) !== 'object') throw TypeError();
3071 var k = nextItem[0];
3072 var v = nextItem[1];
3073 adder.call(map, k, v);
3074 }
3075
3076 return map;
3077 }
3078
3079 if (!('Map' in global) || OVERRIDE_NATIVE_FOR_TESTING ||
3080 (function() { try { new global.Map([]); return false; } catch (_) { return true; } }()) ||
3081 (function() { try { return !new global.Map().entries().next; } catch (_) { return true; } }()) ||
3082 (new global.Map([['a', 1]]).size !== 1))
3083 global.Map = Map;
3084
3085
3086 function MapDataIndexOf(mapData, key) {
3087 var i;
3088 if (key === key) return mapData.keys.indexOf(key);
3089 // Slow case for NaN
3090 for (i = 0; i < mapData.keys.length; i += 1)
3091 if (SameValueZero(mapData.keys[i], key)) return i;
3092 return -1;
3093 }
3094
3095 // 23.1.1.2 new Map ( ... argumentsList )
3096 // 23.1.2 Properties of the Map Constructor
3097 // 23.1.2.1 Map.prototype
3098 var $MapPrototype$ = {};
3099 Map.prototype = $MapPrototype$;
3100
3101 // 23.1.2.2 get Map [ @@species ]
3102
3103 // 23.1.3 Properties of the Map Prototype Object
3104 // 23.1.3.1 Map.prototype.clear ()
3105 define(
3106 Map.prototype, 'clear',
3107 function clear() {
3108 var m = strict(this);
3109 if (Type(m) !== 'object') throw TypeError();
3110 if (!('[[MapData]]' in m)) throw TypeError();
3111 if (m['[[MapData]]'] === undefined) throw TypeError();
3112 var entries = m['[[MapData]]'];
3113 entries.keys.length = 0;
3114 entries.values.length = 0;
3115 return undefined;
3116 });
3117
3118 // 23.1.3.2 Map.prototype.constructor
3119
3120 // 23.1.3.3 Map.prototype.delete ( key )
3121 define(
3122 Map.prototype, 'delete',
3123 function delete_(key) {
3124 var m = strict(this);
3125 if (Type(m) !== 'object') throw TypeError();
3126 if (!('[[MapData]]' in m)) throw TypeError();
3127 if (m['[[MapData]]'] === undefined) throw TypeError();
3128 var entries = m['[[MapData]]'];
3129 var i = MapDataIndexOf(entries, key);
3130 if (i < 0) return false;
3131 entries.keys[i] = empty;
3132 entries.values[i] = empty;
3133 return true;
3134 });
3135
3136 // 23.1.3.4 Map.prototype.entries ( )
3137 define(
3138 Map.prototype, 'entries',
3139 function entries() {
3140 var m = strict(this);
3141 if (Type(m) !== 'object') throw TypeError();
3142 return CreateMapIterator(m, 'key+value');
3143 });
3144
3145 // 23.1.3.5 Map.prototype.forEach ( callbackfn [ , thisArg ] )
3146 define(
3147 Map.prototype, 'forEach',
3148 function forEach(callbackfn /*, thisArg*/) {
3149 var thisArg = arguments[1];
3150
3151 var m = strict(this);
3152 if (Type(m) !== 'object') throw TypeError();
3153 if (!('[[MapData]]' in m)) throw TypeError();
3154 if (m['[[MapData]]'] === undefined) throw TypeError();
3155 var entries = m['[[MapData]]'];
3156
3157 if (!IsCallable(callbackfn)) {
3158 throw TypeError('First argument to forEach is not callable.');
3159 }
3160 for (var i = 0; i < entries.keys.length; ++i) {
3161 if (entries.keys[i] !== empty) {
3162 callbackfn.call(thisArg, entries.values[i], entries.keys[i], m);
3163 }
3164 }
3165 return undefined;
3166 });
3167
3168 // 23.1.3.6 Map.prototype.get ( key )
3169 define(
3170 Map.prototype, 'get',
3171 function get(key) {
3172 var m = strict(this);
3173 if (Type(m) !== 'object') throw TypeError();
3174 if (!('[[MapData]]' in m)) throw TypeError();
3175 if (m['[[MapData]]'] === undefined) throw TypeError();
3176 var entries = m['[[MapData]]'];
3177 var i = MapDataIndexOf(entries, key);
3178 if (i >= 0) return entries.values[i];
3179 return undefined;
3180 });
3181
3182 // 23.1.3.7 Map.prototype.has ( key )
3183 define(
3184 Map.prototype, 'has',
3185 function has(key) {
3186 var m = strict(this);
3187 if (Type(m) !== 'object') throw TypeError();
3188 if (!('[[MapData]]' in m)) throw TypeError();
3189 if (m['[[MapData]]'] === undefined) throw TypeError();
3190 var entries = m['[[MapData]]'];
3191 if (MapDataIndexOf(entries, key) >= 0) return true;
3192 return false;
3193 });
3194
3195 // 23.1.3.8 Map.prototype.keys ( )
3196 define(
3197 Map.prototype, 'keys',
3198 function keys() {
3199 var m = strict(this);
3200 if (Type(m) !== 'object') throw TypeError();
3201 return CreateMapIterator(m, 'key');
3202 });
3203
3204 // 23.1.3.9 Map.prototype.set ( key , value )
3205 define(
3206 Map.prototype, 'set',
3207 function set(key, value) {
3208 var m = strict(this);
3209 if (Type(m) !== 'object') throw TypeError();
3210 if (!('[[MapData]]' in m)) throw TypeError();
3211 if (m['[[MapData]]'] === undefined) throw TypeError();
3212 var entries = m['[[MapData]]'];
3213 var i = MapDataIndexOf(entries, key);
3214 if (i < 0) i = entries.keys.length;
3215 if (SameValue(key, -0)) key = 0;
3216 entries.keys[i] = key;
3217 entries.values[i] = value;
3218 return m;
3219 });
3220
3221 // 23.1.3.10 get Map.prototype.size
3222 Object.defineProperty(
3223 Map.prototype, 'size', {
3224 get: function() {
3225 var m = strict(this);
3226 if (Type(m) !== 'object') throw TypeError();
3227 if (!('[[MapData]]' in m)) throw TypeError();
3228 if (m['[[MapData]]'] === undefined) throw TypeError();
3229 var entries = m['[[MapData]]'];
3230 var count = 0;
3231 for (var i = 0; i < entries.keys.length; ++i) {
3232 if (entries.keys[i] !== empty)
3233 count = count + 1;
3234 }
3235 return count;
3236 }
3237 });
3238
3239 // 23.1.3.11 Map.prototype.values ( )
3240 define(
3241 Map.prototype, 'values',
3242 function values() {
3243 var m = strict(this);
3244 if (Type(m) !== 'object') throw TypeError();
3245 return CreateMapIterator(m, 'value');
3246 });
3247
3248 // 23.1.3.12 Map.prototype [ @@iterator ]( )
3249 define(
3250 Map.prototype, $$iterator,
3251 function() {
3252 var m = strict(this);
3253 if (Type(m) !== 'object') throw TypeError();
3254 return CreateMapIterator(m, 'key+value');
3255 });
3256
3257 // 23.1.3.13 Map.prototype [ @@toStringTag ]
3258 define(global.Map.prototype, $$toStringTag, 'Map');
3259
3260 // 23.1.4 Properties of Map Instances
3261 // 23.1.5 Map Iterator Objects
3262
3263 /** @constructor */
3264 function MapIterator() {}
3265
3266 // 23.1.5.1 CreateMapIterator Abstract Operation
3267 function CreateMapIterator(map, kind) {
3268 if (Type(map) !== 'object') throw TypeError();
3269 if (!('[[MapData]]' in map)) throw TypeError();
3270 if (map['[[MapData]]'] === undefined) throw TypeError();
3271 var iterator = new MapIterator;
3272 set_internal(iterator, '[[Map]]', map);
3273 set_internal(iterator, '[[MapNextIndex]]', 0);
3274 set_internal(iterator, '[[MapIterationKind]]', kind);
3275 return iterator;
3276 }
3277
3278 // 23.1.5.2 The %MapIteratorPrototype% Object
3279 var $MapIteratorPrototype$ = Object.create($IteratorPrototype$);
3280 MapIterator.prototype = $MapIteratorPrototype$;
3281
3282 // 23.1.5.2.1 %MapIteratorPrototype%.next ( )
3283 define(
3284 $MapIteratorPrototype$, 'next',
3285 function next() {
3286 var o = strict(this);
3287 if (Type(o) !== 'object') throw TypeError();
3288 var m = o['[[Map]]'],
3289 index = o['[[MapNextIndex]]'],
3290 itemKind = o['[[MapIterationKind]]'],
3291 entries = m['[[MapData]]'];
3292 while (index < entries.keys.length) {
3293 var e = {key: entries.keys[index], value: entries.values[index]};
3294 index = index += 1;
3295 set_internal(o, '[[MapNextIndex]]', index);
3296 if (e.key !== empty) {
3297 if (itemKind === 'key') {
3298 return CreateIterResultObject(e.key, false);
3299 } else if (itemKind === 'value') {
3300 return CreateIterResultObject(e.value, false);
3301 } else {
3302 return CreateIterResultObject([e.key, e.value], false);
3303 }
3304 }
3305 }
3306 return CreateIterResultObject(undefined, true);
3307 });
3308
3309 // 23.1.5.2.2 %MapIteratorPrototype% [ @@toStringTag ]
3310 define($MapIteratorPrototype$, $$toStringTag, 'Map Iterator');
3311
3312 // 23.1.5.3 Properties of Map Iterator Instances
3313 }());
3314
3315 // ---------------------------------------
3316 // 23.2 Set Objects
3317 // ---------------------------------------
3318
3319 (function() {
3320 // 23.2.1 The Set Constructor
3321 // 23.2.1.1 Set ( [ iterable ] )
3322
3323 /** @constructor */
3324 function Set(/*iterable*/) {
3325 var set = strict(this);
3326 var iterable = arguments[0];
3327
3328 if (Type(set) !== 'object') throw TypeError();
3329 if ('[[SetData]]' in set) throw TypeError();
3330
3331 if (iterable !== undefined) {
3332 var adder = set['add'];
3333 if (!IsCallable(adder)) throw TypeError();
3334 var iter = GetIterator(ToObject(iterable));
3335 }
3336 set_internal(set, '[[SetData]]', []);
3337 if (iter === undefined) return set;
3338 while (true) {
3339 var next = IteratorStep(iter);
3340 if (next === false)
3341 return set;
3342 var nextValue = IteratorValue(next);
3343 adder.call(set, nextValue);
3344 }
3345
3346 return set;
3347 }
3348
3349 if (!('Set' in global) || OVERRIDE_NATIVE_FOR_TESTING ||
3350 (function() { try { return !new global.Set().entries().next; } catch (_) { return true; } }()) ||
3351 (new global.Set([1]).size !== 1))
3352 global.Set = Set;
3353
3354 function SetDataIndexOf(setData, key) {
3355 var i;
3356 if (key === key)
3357 return setData.indexOf(key);
3358 // Slow case for NaN
3359 for (i = 0; i < setData.length; i += 1)
3360 if (SameValueZero(setData[i], key)) return i;
3361 return -1;
3362 }
3363
3364 // 23.2.1.2 new Set ( ...argumentsList )
3365 // 23.2.2 Properties of the Set Constructor
3366
3367 // 23.2.2.1 Set.prototype
3368 var $SetPrototype$ = {};
3369 Set.prototype = $SetPrototype$;
3370
3371 // 23.2.2.2 get Set [ @@species ]
3372 // 23.2.3 Properties of the Set Prototype Object
3373
3374 // 23.2.3.1 Set.prototype.add (value )
3375 define(
3376 Set.prototype, 'add',
3377 function add(value) {
3378 var s = strict(this);
3379 if (Type(s) !== 'object') throw TypeError();
3380 if (!('[[SetData]]' in s)) throw TypeError();
3381 if (s['[[SetData]]'] === undefined) throw TypeError();
3382 if (SameValue(value, -0)) value = 0;
3383 var entries = s['[[SetData]]'];
3384 var i = SetDataIndexOf(entries, value);
3385 if (i < 0) i = s['[[SetData]]'].length;
3386 s['[[SetData]]'][i] = value;
3387
3388 return s;
3389 });
3390
3391 // 23.2.3.2 Set.prototype.clear ()
3392 define(
3393 Set.prototype, 'clear',
3394 function clear() {
3395 var s = strict(this);
3396 if (Type(s) !== 'object') throw TypeError();
3397 if (!('[[SetData]]' in s)) throw TypeError();
3398 if (s['[[SetData]]'] === undefined) throw TypeError();
3399 var entries = s['[[SetData]]'];
3400 entries.length = 0;
3401 return undefined;
3402 });
3403
3404 // 23.2.3.3 Set.prototype.constructor
3405 // 23.2.3.4 Set.prototype.delete ( value )
3406 define(
3407 Set.prototype, 'delete',
3408 function delete_(value) {
3409 var s = strict(this);
3410 if (Type(s) !== 'object') throw TypeError();
3411 if (!('[[SetData]]' in s)) throw TypeError();
3412 if (s['[[SetData]]'] === undefined) throw TypeError();
3413 var entries = s['[[SetData]]'];
3414 var i = SetDataIndexOf(entries, value);
3415 if (i < 0) return false;
3416 entries[i] = empty;
3417 return true;
3418 });
3419
3420 // 23.2.3.5 Set.prototype.entries ( )
3421 define(
3422 Set.prototype, 'entries',
3423 function entries() {
3424 var s = strict(this);
3425 if (Type(s) !== 'object') throw TypeError();
3426 return CreateSetIterator(s, 'key+value');
3427 });
3428
3429 // 23.2.3.6 Set.prototype.forEach ( callbackfn [ , thisArg ] )
3430 define(
3431 Set.prototype, 'forEach',
3432 function forEach(callbackfn/*, thisArg*/) {
3433 var thisArg = arguments[1];
3434
3435 var s = strict(this);
3436 if (Type(s) !== 'object') throw TypeError();
3437 if (!('[[SetData]]' in s)) throw TypeError();
3438 if (s['[[SetData]]'] === undefined) throw TypeError();
3439 var entries = s['[[SetData]]'];
3440
3441 if (!IsCallable(callbackfn)) {
3442 throw TypeError('First argument to forEach is not callable.');
3443 }
3444 for (var i = 0; i < entries.length; ++i) {
3445 if (entries[i] !== empty) {
3446 callbackfn.call(thisArg, entries[i], entries[i], s);
3447 }
3448 }
3449 });
3450
3451 // 23.2.3.7 Set.prototype.has ( value )
3452 define(
3453 Set.prototype, 'has',
3454 function has(key) {
3455 var s = strict(this);
3456 if (Type(s) !== 'object') throw TypeError();
3457 if (!('[[SetData]]' in s)) throw TypeError();
3458 if (s['[[SetData]]'] === undefined) throw TypeError();
3459 var entries = s['[[SetData]]'];
3460 return SetDataIndexOf(entries, key) !== -1;
3461 });
3462
3463 // 23.2.3.8 Set.prototype.keys ( )
3464 // See Set.prototype.values
3465
3466 // 23.2.3.9 get Set.prototype.size
3467 Object.defineProperty(
3468 Set.prototype, 'size', {
3469 get: function() {
3470 var s = strict(this);
3471 if (Type(s) !== 'object') throw TypeError();
3472 if (!('[[SetData]]' in s)) throw TypeError();
3473 if (s['[[SetData]]'] === undefined) throw TypeError();
3474 var entries = s['[[SetData]]'];
3475 var count = 0;
3476 for (var i = 0; i < entries.length; ++i) {
3477 if (entries[i] !== empty)
3478 count = count + 1;
3479 }
3480 return count;
3481 }
3482 });
3483
3484 // 23.2.3.10 Set.prototype.values ( )
3485 define(
3486 Set.prototype, 'values',
3487 function values() {
3488 var s = strict(this);
3489 if (Type(s) !== 'object') throw TypeError();
3490 return CreateSetIterator(s, 'value');
3491 });
3492 // NOTE: function name is still 'values':
3493 Set.prototype.keys = Set.prototype.values;
3494
3495 // 23.2.3.11 Set.prototype [@@iterator ] ( )
3496 define(
3497 Set.prototype, $$iterator,
3498 function() {
3499 var s = strict(this);
3500 if (Type(s) !== 'object') throw TypeError();
3501 return CreateSetIterator(s);
3502 });
3503
3504 // 23.2.3.12 Set.prototype [ @@toStringTag ]
3505 define(global.Set.prototype, $$toStringTag, 'Set');
3506
3507 // 23.2.4 Properties of Set Instances
3508 // 23.2.5 Set Iterator Objects
3509 /** @constructor */
3510 function SetIterator() {}
3511
3512 // 23.2.5.1 CreateSetIterator Abstract Operation
3513 function CreateSetIterator(set, kind) {
3514 if (Type(set) !== 'object') throw TypeError();
3515 if (!('[[SetData]]' in set)) throw TypeError();
3516 if (set['[[SetData]]'] === undefined) throw TypeError();
3517 var iterator = new SetIterator;
3518 set_internal(iterator, '[[IteratedSet]]', set);
3519 set_internal(iterator, '[[SetNextIndex]]', 0);
3520 set_internal(iterator, '[[SetIterationKind]]', kind);
3521 return iterator;
3522 }
3523
3524 // 23.2.5.2 The %SetIteratorPrototype% Object
3525 var $SetIteratorPrototype$ = Object.create($IteratorPrototype$);
3526 SetIterator.prototype = $SetIteratorPrototype$;
3527
3528 // 23.2.5.2.1 %SetIteratorPrototype%.next( )
3529 define(
3530 $SetIteratorPrototype$, 'next',
3531 function next() {
3532 var o = strict(this);
3533 if (Type(o) !== 'object') throw TypeError();
3534 var s = o['[[IteratedSet]]'],
3535 index = o['[[SetNextIndex]]'],
3536 itemKind = o['[[SetIterationKind]]'],
3537 entries = s['[[SetData]]'];
3538 while (index < entries.length) {
3539 var e = entries[index];
3540 index = index += 1;
3541 set_internal(o, '[[SetNextIndex]]', index);
3542 if (e !== empty) {
3543 if (itemKind === 'key+value')
3544 return CreateIterResultObject([e, e], false);
3545 return CreateIterResultObject(e, false);
3546 }
3547 }
3548 return CreateIterResultObject(undefined, true);
3549 });
3550
3551 // 23.2.5.2.2 %SetIteratorPrototype% [ @@toStringTag ]
3552 define($SetIteratorPrototype$, $$toStringTag, 'Set Iterator');
3553
3554 // 23.2.5.3 Properties of Set Iterator Instances
3555
3556 }());
3557
3558 // ---------------------------------------
3559 // 23.3 WeakMap Objects
3560 // ---------------------------------------
3561
3562 (function() {
3563 // 23.3.1 The WeakMap Constructor
3564 // 23.3.1.1 WeakMap ( [ iterable ] )
3565 /** @constructor */
3566 function WeakMap(/*iterable*/) {
3567 var map = strict(this);
3568 var iterable = arguments[0];
3569
3570 if (Type(map) !== 'object') throw TypeError();
3571 if ('[[WeakMapData]]' in map) throw TypeError();
3572
3573 if (iterable !== undefined) {
3574 var adder = map['set'];
3575 if (!IsCallable(adder)) throw TypeError();
3576 var iter = GetIterator(ToObject(iterable));
3577 }
3578 set_internal(map, '[[WeakMapData]]', new EphemeronTable);
3579 if (iter === undefined) return map;
3580 while (true) {
3581 var next = IteratorStep(iter);
3582 if (next === false)
3583 return map;
3584 var nextValue = IteratorValue(next);
3585 if (Type(nextValue) !== 'object') throw TypeError();
3586 var k = nextValue[0];
3587 var v = nextValue[1];
3588 adder.call(map, k, v);
3589 }
3590
3591 return map;
3592 }
3593
3594 if (!('WeakMap' in global) || OVERRIDE_NATIVE_FOR_TESTING)
3595 global.WeakMap = WeakMap;
3596
3597 // 23.3.2 Properties of the WeakMap Constructor
3598 // 23.3.2.1 WeakMap.prototype
3599 var $WeakMapPrototype$ = {};
3600 WeakMap.prototype = $WeakMapPrototype$;
3601
3602
3603
3604 // 23.3.2.2 WeakMap[ @@create ] ( )
3605 // 23.3.3 Properties of the WeakMap Prototype Object
3606
3607 // 23.3.3.1 WeakMap.prototype.constructor
3608
3609 // 23.3.3.2 WeakMap.prototype.delete ( key )
3610 define(
3611 WeakMap.prototype, 'delete',
3612 function delete_(key) {
3613 var M = strict(this);
3614 if (Type(M) !== 'object') throw TypeError();
3615 if (M['[[WeakMapData]]'] === undefined) throw TypeError();
3616 if (Type(key) !== 'object') throw TypeError('Expected object');
3617 return M['[[WeakMapData]]'].remove(key);
3618 });
3619
3620 // 23.3.3.3 WeakMap.prototype.get ( key )
3621 define(
3622 WeakMap.prototype, 'get',
3623 function get(key, defaultValue) {
3624 var M = strict(this);
3625 if (Type(M) !== 'object') throw TypeError();
3626 if (M['[[WeakMapData]]'] === undefined) throw TypeError();
3627 if (Type(key) !== 'object') throw TypeError('Expected object');
3628 return M['[[WeakMapData]]'].get(key, defaultValue);
3629 });
3630
3631 // 23.3.3.4 WeakMap.prototype.has ( key )
3632 define(
3633 WeakMap.prototype, 'has',
3634 function has(key) {
3635 var M = strict(this);
3636 if (Type(M) !== 'object') throw TypeError();
3637 if (M['[[WeakMapData]]'] === undefined) throw TypeError();
3638 if (Type(key) !== 'object') throw TypeError('Expected object');
3639 return M['[[WeakMapData]]'].has(key);
3640 });
3641
3642 // 23.3.3.5 WeakMap.prototype.set ( key , value )
3643 define(
3644 WeakMap.prototype, 'set',
3645 function set(key, value) {
3646 var M = strict(this);
3647 if (Type(M) !== 'object') throw TypeError();
3648 if (M['[[WeakMapData]]'] === undefined) throw TypeError();
3649 if (Type(key) !== 'object') throw TypeError('Expected object');
3650 M['[[WeakMapData]]'].set(key, value);
3651 return M;
3652 });
3653
3654 // 23.3.3.6 WeakMap.prototype [ @@toStringTag ]
3655 define(global.WeakMap.prototype, $$toStringTag, 'WeakMap');
3656
3657 // 23.3.4 Properties of WeakMap Instances
3658
3659 // Polyfills for incomplete native implementations:
3660 (function() {
3661 var wm = new global.WeakMap();
3662 var orig = global.WeakMap.prototype.set;
3663 define(global.WeakMap.prototype, 'set', function set() {
3664 orig.apply(this, arguments);
3665 return this;
3666 }, wm.set({}, 0) !== wm);
3667 }());
3668 }());
3669
3670 // ---------------------------------------
3671 // 23.4 WeakSet Objects
3672 // ---------------------------------------
3673
3674 (function() {
3675 // 23.4.1 The WeakSet Constructor
3676 // 23.4.1.1 WeakSet ( [ iterable ] )
3677 /** @constructor */
3678 function WeakSet(/*iterable*/) {
3679 var set = strict(this);
3680 var iterable = arguments[0];
3681
3682 if (Type(set) !== 'object') throw TypeError();
3683 if ('[[WeakSetData]]' in set) throw TypeError();
3684
3685 if (iterable !== undefined) {
3686 var adder = set['add'];
3687 if (!IsCallable(adder)) throw TypeError();
3688 var iter = GetIterator(ToObject(iterable));
3689 }
3690 set_internal(set, '[[WeakSetData]]', new EphemeronTable);
3691 if (iter === undefined) return set;
3692 while (true) {
3693 var next = IteratorStep(iter);
3694 if (next === false)
3695 return set;
3696 var nextValue = IteratorValue(next);
3697 adder.call(set, nextValue);
3698 }
3699
3700 return set;
3701 }
3702
3703 if (!('WeakSet' in global) || OVERRIDE_NATIVE_FOR_TESTING)
3704 global.WeakSet = WeakSet;
3705
3706 // 23.4.2 Properties of the WeakSet Constructor
3707 // 23.4.2.1 WeakSet.prototype
3708 var $WeakSetPrototype$ = {};
3709 WeakSet.prototype = $WeakSetPrototype$;
3710
3711 // 23.4.3 Properties of the WeakSet Prototype Object
3712 // 23.4.3.1 WeakSet.prototype.add (value )
3713 define(
3714 WeakSet.prototype, 'add',
3715 function add(value) {
3716 var S = strict(this);
3717 if (Type(S) !== 'object') throw TypeError();
3718 if (S['[[WeakSetData]]'] === undefined) throw TypeError();
3719 if (Type(value) !== 'object') throw TypeError('Expected object');
3720 S['[[WeakSetData]]'].set(value, true);
3721 return S;
3722 });
3723
3724 // 23.4.3.2 WeakSet.prototype.constructor
3725 // 23.4.3.3 WeakSet.prototype.delete ( value )
3726 define(
3727 WeakSet.prototype, 'delete',
3728 function delete_(value) {
3729 var S = strict(this);
3730 if (Type(S) !== 'object') throw TypeError();
3731 if (S['[[WeakSetData]]'] === undefined) throw TypeError();
3732 if (Type(value) !== 'object') throw TypeError('Expected object');
3733 return S['[[WeakSetData]]'].remove(value);
3734 });
3735
3736 // 23.4.3.4 WeakSet.prototype.has ( value )
3737 define(
3738 WeakSet.prototype, 'has',
3739 function has(key) {
3740 var S = strict(this);
3741 if (Type(S) !== 'object') throw TypeError();
3742 if (S['[[WeakSetData]]'] === undefined) throw TypeError();
3743 if (Type(key) !== 'object') throw TypeError('Expected object');
3744 return S['[[WeakSetData]]'].has(key);
3745 });
3746
3747 // 23.4.3.5 WeakSet.prototype [ @@toStringTag ]
3748 define(global.WeakSet.prototype, $$toStringTag, 'WeakSet');
3749
3750 // 23.4.4 Properties of WeakSet Instances
3751
3752 // Polyfills for incomplete native implementations:
3753 (function() {
3754 var ws = new global.WeakSet();
3755 var orig = global.WeakSet.prototype.add;
3756 define(global.WeakSet.prototype, 'add', function add() {
3757 orig.apply(this, arguments);
3758 return this;
3759 }, ws.add({}) !== ws);
3760 }());
3761 }());
3762
3763 // ---------------------------------------
3764 // 24 Structured Data
3765 // ---------------------------------------
3766
3767 // ---------------------------------------
3768 // 24.1 ArrayBuffer Objects
3769 // ---------------------------------------
3770
3771 // See typedarray.js for TypedArray polyfill
3772
3773 (function() {
3774 if (!('ArrayBuffer' in global))
3775 return;
3776
3777 // 24.1.1 Abstract Operations For ArrayBuffer Objects
3778 // 24.1.1.1 AllocateArrayBuffer( constructor, byteLength )
3779 // 24.1.1.2 IsDetachedBuffer( arrayBuffer )
3780 // 24.1.1.3 DetachArrayBuffer( arrayBuffer )
3781 // 24.1.1.4 CloneArrayBuffer( srcBuffer, srcByteOffset [, cloneConstructor] )
3782 // 24.1.1.5 GetValueFromBuffer ( arrayBuffer, byteIndex, type, isLittleEndian )
3783 // 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value, isLittleEndian )
3784 // 24.1.2 The ArrayBuffer Constructor
3785 // 24.1.2.1 ArrayBuffer( length )
3786 // 24.1.3 Properties of the ArrayBuffer Constructor
3787
3788 // 24.1.3.1 ArrayBuffer.isView ( arg )
3789 define(
3790 ArrayBuffer, 'isView',
3791 function isView(arg) {
3792 if (Type(arg) !== 'object') return false;
3793 if ('buffer' in arg && arg.buffer instanceof ArrayBuffer) return true;
3794 return false;
3795 });
3796
3797 // 24.1.3.2 ArrayBuffer.prototype
3798 // 24.1.3.3 get ArrayBuffer [ @@species ]
3799 // 24.1.4 Properties of the ArrayBuffer Prototype Object
3800 // 24.1.4.1 get ArrayBuffer.prototype.byteLength
3801 // 24.1.4.2 ArrayBuffer.prototype.constructor
3802 // 24.1.4.3 ArrayBuffer.prototype.slice ( start , end)
3803
3804 // 24.1.4.4 ArrayBuffer.prototype [ @@toStringTag ]
3805 define(ArrayBuffer.prototype, $$toStringTag, 'ArrayBuffer');
3806
3807 // 24.1.5 Properties of the ArrayBuffer Instances
3808 }());
3809
3810 // ---------------------------------------
3811 // 24.2 DataView Objects
3812 // ---------------------------------------
3813
3814 // See typedarray.js for TypedArray polyfill
3815
3816 (function() {
3817 if (!('DataView' in global))
3818 return;
3819
3820 // 24.2.1 Abstract Operations For DataView Objects
3821 // 24.2.1.1 GetViewValue(view, requestIndex, isLittleEndian, type)
3822 // 24.2.1.2 SetViewValue(view, requestIndex, isLittleEndian, type, value)
3823 // 24.2.2 The DataView Constructor
3824 // 24.2.2.1 DataView (buffer [ , byteOffset [ , byteLength ] ] )
3825 // 24.2.3 Properties of the DataView Constructor
3826 // 24.2.3.1 DataView.prototype
3827 // 24.2.4 Properties of the DataView Prototype Object
3828 // 24.2.4.1 get DataView.prototype.buffer
3829 // 24.2.4.2 get DataView.prototype.byteLength
3830 // 24.2.4.3 get DataView.prototype.byteOffset
3831 // 24.2.4.4 DataView.prototype.constructor
3832 // 24.2.4.5 DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] )
3833 // 24.2.4.6 DataView.prototype.getFloat64 ( byteOffset [ , littleEndian ] )
3834 // 24.2.4.7 DataView.prototype.getInt8 ( byteOffset )
3835 // 24.2.4.8 DataView.prototype.getInt16 ( byteOffset [ , littleEndian ] )
3836 // 24.2.4.9 DataView.prototype.getInt32 ( byteOffset [ , littleEndian ] )
3837 // 24.2.4.10 DataView.prototype.getUint8 ( byteOffset )
3838 // 24.2.4.11 DataView.prototype.getUint16 ( byteOffset [ , littleEndian ] )
3839 // 24.2.4.12 DataView.prototype.getUint32 ( byteOffset [ , littleEndian ] )
3840 // 24.2.4.13 DataView.prototype.setFloat32 ( byteOffset, value [ , littleEndian ] )
3841 // 24.2.4.14 DataView.prototype.setFloat64 ( byteOffset, value [ , littleEndian ] )
3842 // 24.2.4.15 DataView.prototype.setInt8 ( byteOffset, value )
3843 // 24.2.4.16 DataView.prototype.setInt16 ( byteOffset, value [ , littleEndian ] )
3844 // 24.2.4.17 DataView.prototype.setInt32 ( byteOffset, value [ , littleEndian ] )
3845 // 24.2.4.18 DataView.prototype.setUint8 ( byteOffset, value )
3846 // 24.2.4.19 DataView.prototype.setUint16 ( byteOffset, value [ , littleEndian ] )
3847 // 24.2.4.20 DataView.prototype.setUint32 ( byteOffset, value [ , littleEndian ] )
3848
3849 // 24.2.4.21 DataView.prototype[ @@toStringTag ]
3850 define(DataView.prototype, $$toStringTag, 'DataView');
3851
3852 // 24.2.5 Properties of DataView Instances
3853 }());
3854
3855 // ---------------------------------------
3856 // 24.3 The JSON Object
3857 // ---------------------------------------
3858
3859 // 24.3.1 JSON.parse ( text [ , reviver ] )
3860 // 24.3.2 JSON.stringify ( value [ , replacer [ , space ] ] )
3861 // 24.3.3 JSON [ @@toStringTag ]
3862 define(JSON, $$toStringTag, 'JSON');
3863
3864 // ---------------------------------------
3865 // 25.1 Iteration
3866 // ---------------------------------------
3867
3868 // 25.1.1 Common Iteration Interfaces
3869 // 25.1.1.1 The Iterable Interface
3870 // 25.1.1.2 The Iterator Interface
3871 // 25.1.1.3 The IteratorResult Interface
3872
3873 // 25.1.2 The %IteratorPrototype% Object
3874 // Defined earlier, so other prototypes can reference it.
3875 // 25.1.2.1 %IteratorPrototype% [ @@iterator ] ( )
3876 define($IteratorPrototype$, $$iterator, function() {
3877 return this;
3878 });
3879
3880
3881 // ---------------------------------------
3882 // 25.4 Promise Objects
3883 // ---------------------------------------
3884
3885 (function() {
3886 // 25.4 Promise Objects
3887
3888 // 25.4.1 Promise Abstract Operations
3889
3890 // 25.4.1.1 PromiseCapability Records
3891 // 25.4.1.1.1 IfAbruptRejectPromise ( value, capability )
3892
3893 function IfAbruptRejectPromise(value, capability) {
3894 var rejectResult = capability['[[Reject]]'].call(undefined, value);
3895 return capability['[[Promise]]'];
3896 }
3897
3898 // 25.4.1.2 PromiseReaction Records
3899
3900 // 25.4.1.3 CreateResolvingFunctions ( promise )
3901
3902 function CreateResolvingFunctions(promise) {
3903 var alreadyResolved = {'[[value]]': false};
3904 var resolve = PromiseResolveFunction();
3905 set_internal(resolve, '[[Promise]]', promise);
3906 set_internal(resolve, '[[AlreadyResolved]]', alreadyResolved);
3907 var reject = PromiseRejectFunction();
3908 set_internal(reject, '[[Promise]]', promise);
3909 set_internal(reject, '[[AlreadyResolved]]', alreadyResolved);
3910 return { '[[Resolve]]': resolve, '[[Reject]]': reject};
3911 }
3912
3913 // 25.4.1.3.1 Promise Reject Functions
3914
3915 function PromiseRejectFunction() {
3916 var F = function(reason) {
3917 console.assert(Type(F['[[Promise]]']) === 'object');
3918 var promise = F['[[Promise]]'];
3919 var alreadyResolved = F['[[AlreadyResolved]]'];
3920 if (alreadyResolved['[[value]]']) return undefined;
3921 set_internal(alreadyResolved, '[[value]]', true);
3922 return RejectPromise(promise, reason);
3923 };
3924 return F;
3925 }
3926
3927 // 25.4.1.3.2 Promise Resolve Functions
3928
3929 function PromiseResolveFunction() {
3930 var F = function(resolution) {
3931 console.assert(Type(F['[[Promise]]']) === 'object');
3932 var promise = F['[[Promise]]'];
3933 var alreadyResolved = F['[[AlreadyResolved]]'];
3934 if (alreadyResolved['[[value]]']) return undefined;
3935 set_internal(alreadyResolved, '[[value]]', true);
3936
3937 if (SameValue(resolution, promise)) {
3938 var selfResolutionError = TypeError();
3939 return RejectPromise(promise, selfResolutionError);
3940 }
3941 if (Type(resolution) !== 'object')
3942 return FulfillPromise(promise, resolution);
3943 try {
3944 var then = resolution['then'];
3945 } catch(then) {
3946 return RejectPromise(promise, then);
3947 }
3948 if (!IsCallable(then))
3949 return FulfillPromise(promise, resolution);
3950 EnqueueJob('PromiseJobs', PromiseResolveThenableJob, [promise, resolution, then]);
3951 return undefined;
3952 };
3953 return F;
3954 }
3955
3956 // 25.4.1.4 FulfillPromise ( promise, value )
3957
3958 function FulfillPromise(promise, value) {
3959 console.assert(promise['[[PromiseState]]'] === 'pending');
3960 var reactions = promise['[[PromiseFulfillReactions]]'];
3961 set_internal(promise, '[[PromiseResult]]', value);
3962 set_internal(promise, '[[PromiseFulfillReactions]]', undefined);
3963 set_internal(promise, '[[PromiseRejectReactions]]', undefined);
3964 set_internal(promise, '[[PromiseState]]', 'fulfilled');
3965 return TriggerPromiseReactions(reactions, value);
3966 }
3967
3968 // 25.4.1.5 NewPromiseCapability ( C )
3969
3970 function NewPromiseCapability(c) {
3971 // To keep Promise hermetic, this doesn't look much like the spec.
3972 return CreatePromiseCapabilityRecord(undefined, c);
3973 }
3974
3975 // 25.4.1.5.1 CreatePromiseCapabilityRecord ( promise, constructor )
3976
3977 function CreatePromiseCapabilityRecord(promise, constructor) {
3978 // To keep Promise hermetic, this doesn't look much like the spec.
3979 console.assert(IsConstructor(constructor));
3980 var promiseCapability = {};
3981 set_internal(promiseCapability, '[[Promise]]', promise);
3982 set_internal(promiseCapability, '[[Resolve]]', undefined);
3983 set_internal(promiseCapability, '[[Reject]]', undefined);
3984 var executor = GetCapabilitiesExecutor();
3985 set_internal(executor, '[[Capability]]', promiseCapability);
3986
3987 // NOTE: Differs from spec; object is constructed here
3988 var constructorResult = promise = new constructor(executor);
3989 set_internal(promiseCapability, '[[Promise]]', promise);
3990
3991 if (!IsCallable(promiseCapability['[[Resolve]]'])) throw TypeError();
3992 if (!IsCallable(promiseCapability['[[Reject]]'])) throw TypeError();
3993 if (Type(constructorResult) === 'object' && !SameValue(promise, constructorResult)) throw TypeError();
3994 return promiseCapability;
3995 }
3996
3997 // 25.4.1.5.2 GetCapabilitiesExecutor Functions
3998
3999 function GetCapabilitiesExecutor() {
4000 var F = function(resolve, reject) {
4001 console.assert(F['[[Capability]]']);
4002 var promiseCapability = F['[[Capability]]'];
4003 if (promiseCapability['[[Resolve]]'] !== undefined) throw TypeError();
4004 if (promiseCapability['[[Reject]]'] !== undefined) throw TypeError();
4005 set_internal(promiseCapability, '[[Resolve]]', resolve);
4006 set_internal(promiseCapability, '[[Reject]]', reject);
4007 return undefined;
4008 };
4009 return F;
4010 }
4011
4012 // 25.4.1.6 IsPromise ( x )
4013
4014 function IsPromise(x) {
4015 if (Type(x) !== 'object') return false;
4016 if (!('[[PromiseState]]' in x)) return false;
4017 if (x['[[PromiseState]]'] === undefined) return false;
4018 return true;
4019 }
4020
4021 // 25.4.1.7 RejectPromise ( promise, reason )
4022
4023 function RejectPromise(promise, reason) {
4024 console.assert(promise['[[PromiseState]]'] === 'pending');
4025 var reactions = promise['[[PromiseRejectReactions]]'];
4026 set_internal(promise, '[[PromiseResult]]', reason);
4027 set_internal(promise, '[[PromiseFulfillReactions]]', undefined);
4028 set_internal(promise, '[[PromiseRejectReactions]]', undefined);
4029 set_internal(promise, '[[PromiseState]]', 'rejected');
4030 return TriggerPromiseReactions(reactions, reason);
4031 }
4032
4033 // 25.4.1.8 TriggerPromiseReactions ( reactions, argument )
4034
4035 function TriggerPromiseReactions(reactions, argument) {
4036 for (var i = 0, len = reactions.length; i < len; ++i)
4037 EnqueueJob('PromiseJobs', PromiseReactionJob, [reactions[i], argument]);
4038 return undefined;
4039 }
4040
4041 // 25.4.2 Promise Jobs
4042
4043 // 25.4.2.1 PromiseReactionJob ( reaction, argument )
4044
4045 function PromiseReactionJob(reaction, argument) {
4046 var promiseCapability = reaction['[[Capabilities]]'];
4047 var handler = reaction['[[Handler]]'];
4048 var handlerResult, status;
4049 try {
4050 if (handler === 'Identity') handlerResult = argument;
4051 else if (handler === 'Thrower') throw argument;
4052 else handlerResult = handler.call(undefined, argument);
4053 } catch (handlerResult) {
4054 status = promiseCapability['[[Reject]]'].call(undefined, handlerResult);
4055 NextJob(status); return;
4056 }
4057 status = promiseCapability['[[Resolve]]'].call(undefined, handlerResult);
4058 NextJob(status);
4059 }
4060
4061 // 25.4.2.2 PromiseResolveThenableJob ( promiseToResolve, thenable, then)
4062
4063 function PromiseResolveThenableJob(promiseToResolve, thenable, then) {
4064 // SPEC BUG: promise vs. promiseToResolve
4065 var resolvingFunctions = CreateResolvingFunctions(promiseToResolve);
4066 try {
4067 var thenCallResult = then.call(thenable, resolvingFunctions['[[Resolve]]'],
4068 resolvingFunctions['[[Reject]]']);
4069 } catch (thenCallResult) {
4070 var status = resolvingFunctions['[[Reject]]'].call(undefined, thenCallResult);
4071 NextJob(status); return;
4072 }
4073 NextJob(thenCallResult);
4074 }
4075
4076 // 25.4.3 The Promise Constructor
4077
4078 // 25.4.3.1 Promise ( executor )
4079
4080 function Promise(executor) {
4081 var config = { configurable: false, enumerable: false, writable: true, value: undefined };
4082 Object.defineProperty(this, '[[PromiseState]]', config);
4083 Object.defineProperty(this, '[[PromiseConstructor]]', config);
4084 Object.defineProperty(this, '[[PromiseResult]]', config);
4085 Object.defineProperty(this, '[[PromiseFulfillReactions]]', config);
4086 Object.defineProperty(this, '[[PromiseRejectReactions]]', config);
4087
4088 var promise = this;
4089 if (Type(promise) !== 'object') throw new TypeError();
4090 if (!('[[PromiseState]]' in promise)) throw TypeError();
4091 if (promise['[[PromiseState]]'] !== undefined) throw TypeError();
4092 if (!IsCallable(executor)) throw TypeError();
4093
4094 set_internal(promise, '[[PromiseConstructor]]', Promise);
4095
4096 return InitializePromise(promise, executor);
4097 }
4098
4099 // 25.4.3.1.1 InitializePromise ( promise, executor )
4100
4101 function InitializePromise(promise, executor) {
4102 console.assert('[[PromiseState]]' in promise);
4103 console.assert(IsCallable(executor));
4104 set_internal(promise, '[[PromiseState]]', 'pending');
4105 set_internal(promise, '[[PromiseFulfillReactions]]', []);
4106 set_internal(promise, '[[PromiseRejectReactions]]', []);
4107 var resolvingFunctions = CreateResolvingFunctions(promise);
4108 try {
4109 var completion = executor.call(undefined, resolvingFunctions['[[Resolve]]'],
4110 resolvingFunctions['[[Reject]]']);
4111 } catch (completion) {
4112 var status = resolvingFunctions['[[Reject]]'].call(undefined, completion);
4113 }
4114 return promise;
4115 }
4116
4117 // 25.4.4 Properties of the Promise Constructor
4118 // 25.4.4.1 Promise.all ( iterable )
4119
4120 define(Promise, 'all', function all(iterable) {
4121 var c = strict(this);
4122 var promiseCapability = NewPromiseCapability(c);
4123 try {
4124 var iterator = GetIterator(iterable);
4125 } catch (value) {
4126 promiseCapability['[[Reject]]'].call(undefined, value);
4127 return promiseCapability['[[Promise]]'];
4128 }
4129 var values = [];
4130 var remainingElementsCount = { value: 1 };
4131 var index = 0;
4132 while (true) {
4133 try {
4134 var next = IteratorStep(iterator);
4135 } catch (value) {
4136 promiseCapability['[[Reject]]'].call(undefined, value);
4137 return promiseCapability['[[Promise]]'];
4138 }
4139 if (!next) {
4140 remainingElementsCount.value -= 1;
4141 if (remainingElementsCount.value === 0) {
4142 var resolveResult = promiseCapability['[[Resolve]]'].apply(undefined, values);
4143
4144
4145 }
4146 return promiseCapability['[[Promise]]'];
4147 }
4148 try {
4149 var nextValue = IteratorValue(next);
4150 } catch (value) {
4151 promiseCapability['[[Reject]]'].call(undefined, value);
4152 return promiseCapability['[[Promise]]'];
4153 }
4154 try {
4155 var nextPromise = c.resolve(nextValue);
4156 } catch (value) {
4157 promiseCapability['[[Reject]]'].call(undefined, value);
4158 return promiseCapability['[[Promise]]'];
4159 }
4160 var resolveElement = PromiseAllResolveElementFunction();
4161 set_internal(resolveElement, '[[AlreadyCalled]]', { value: false });
4162 set_internal(resolveElement, '[[Index]]', index);
4163 set_internal(resolveElement, '[[Values]]', values);
4164 set_internal(resolveElement, '[[Capabilities]]', promiseCapability);
4165 set_internal(resolveElement, '[[RemainingElements]]', remainingElementsCount);
4166 remainingElementsCount.value += 1;
4167 try {
4168 var result = nextPromise.then(resolveElement, promiseCapability['[[Reject]]']);
4169 } catch (value) {
4170 promiseCapability['[[Reject]]'].call(undefined, value);
4171 return promiseCapability['[[Promise]]'];
4172 }
4173 index += 1;
4174 }
4175 });
4176
4177 // 25.4.4.1.1 Promise.all Resolve Element Functions
4178
4179 function PromiseAllResolveElementFunction() {
4180 var F = function(x) {
4181 var alreadyCalled = F['[[AlreadyCalled]]'];
4182 if (alreadyCalled.value) return undefined;
4183 alreadyCalled.value = true;
4184 var index = F['[[Index]]'];
4185 var values = F['[[Values]]'];
4186 var promiseCapability = F['[[Capabilities]]'];
4187 var remainingElementsCount = F['[[RemainingElements]]'];
4188 try {
4189 values[index] = x;
4190 } catch (result) {
4191 promiseCapability['[[Reject]]'].call(undefined, result);
4192 return promiseCapability['[[Promise]]'];
4193 }
4194 remainingElementsCount.value -= 1;
4195 if (remainingElementsCount.value === 0)
4196 return promiseCapability['[[Resolve]]'].call(undefined, values);
4197 return undefined;
4198 };
4199 return F;
4200 }
4201
4202 // 25.4.4.2 Promise.prototype
4203
4204 Promise.prototype = {};
4205
4206 // 25.4.4.3 Promise.race ( iterable )
4207
4208 define(Promise, 'race', function race(iterable) {
4209 var c = strict(this);
4210 var promiseCapability = NewPromiseCapability(c);
4211 try {
4212 var iterator = GetIterator(iterable);
4213 } catch (value) {
4214 promiseCapability['[[Reject]]'].call(undefined, value);
4215 return promiseCapability['[[Promise]]'];
4216 }
4217 while (true) {
4218 try {
4219 var next = IteratorStep(iterator);
4220 } catch (value) {
4221 promiseCapability['[[Reject]]'].call(undefined, value);
4222 return promiseCapability['[[Promise]]'];
4223 }
4224 if (!next) return promiseCapability['[[Promise]]'];
4225 try {
4226 var nextValue = IteratorValue(next);
4227 } catch (value) {
4228 promiseCapability['[[Reject]]'].call(undefined, value);
4229 return promiseCapability['[[Promise]]'];
4230 }
4231 try {
4232 var nextPromise = c.resolve(nextValue);
4233 } catch (value) {
4234 promiseCapability['[[Reject]]'].call(undefined, value);
4235 return promiseCapability['[[Promise]]'];
4236 }
4237 try {
4238 nextPromise.then(promiseCapability['[[Resolve]]'], promiseCapability['[[Reject]]']);
4239 } catch (value) {
4240 promiseCapability['[[Reject]]'].call(undefined, value);
4241 return promiseCapability['[[Promise]]'];
4242 }
4243 }
4244 });
4245
4246 // 25.4.4.4 Promise.reject ( r )
4247
4248 define(Promise, 'reject', function reject(r) {
4249 var c = strict(this);
4250 var promiseCapability = NewPromiseCapability(c);
4251 var rejectResult = promiseCapability['[[Reject]]'].call(undefined, r);
4252 return promiseCapability['[[Promise]]'];
4253 });
4254
4255 // 25.4.4.5 Promise.resolve ( x )
4256
4257 define(Promise, 'resolve', function resolve(x) {
4258 var c = strict(this);
4259 if (IsPromise(x)) {
4260 var constructor = x['[[PromiseConstructor]]'];
4261 if (SameValue(constructor, c)) return x;
4262 }
4263 var promiseCapability = NewPromiseCapability(c);
4264 var resolveResult = promiseCapability['[[Resolve]]'].call(undefined, x);
4265 return promiseCapability['[[Promise]]'];
4266 });
4267
4268 // 25.4.4.6 Promise [ @@create ] ( )
4269 // 25.4.4.6.1 AllocatePromise ( constructor )
4270 // 25.4.5 Properties of the Promise Prototype Object
4271 // 25.4.5.1 Promise.prototype.catch ( onRejected )
4272
4273 define(Promise.prototype, 'catch', function catch_(onRejected) {
4274 var promise = this;
4275 return promise.then(undefined, onRejected);
4276 });
4277
4278 // 25.4.5.2 Promise.prototype.constructor
4279
4280 Promise.prototype.constructor = Promise;
4281
4282 // 25.4.5.3 Promise.prototype.then ( onFulfilled , onRejected )
4283
4284 define(Promise.prototype, 'then', function then(onFulfilled, onRejected) {
4285 var promise = this;
4286 if (!IsPromise(promise)) throw TypeError();
4287 if (!IsCallable(onFulfilled)) onFulfilled = 'Identity';
4288 if (!IsCallable(onRejected)) onRejected = 'Thrower';
4289 var c = promise.constructor;
4290 var promiseCapability = NewPromiseCapability(c);
4291 var fulfillReaction = { '[[Capabilities]]': promiseCapability,
4292 '[[Handler]]': onFulfilled };
4293 var rejectReaction = { '[[Capabilities]]': promiseCapability,
4294 '[[Handler]]': onRejected };
4295 if (promise['[[PromiseState]]'] === 'pending') {
4296 promise['[[PromiseFulfillReactions]]'].push(fulfillReaction);
4297 promise['[[PromiseRejectReactions]]'].push(rejectReaction);
4298 } else if (promise['[[PromiseState]]'] === 'fulfilled') {
4299 var value = promise['[[PromiseResult]]'];
4300 EnqueueJob('PromiseJobs', PromiseReactionJob, [fulfillReaction, value]);
4301 } else if (promise['[[PromiseState]]'] === 'rejected') {
4302 var reason = promise['[[PromiseResult]]'];
4303 EnqueueJob('PromiseJobs', PromiseReactionJob, [rejectReaction, reason]);
4304 }
4305 return promiseCapability['[[Promise]]'];
4306 });
4307
4308 // 25.4.6 Properties of Promise Instances
4309
4310 if (!('Promise' in global) || OVERRIDE_NATIVE_FOR_TESTING)
4311 global.Promise = Promise;
4312
4313 // Patch early Promise.cast vs. Promise.resolve implementations
4314 if ('cast' in global.Promise) global.Promise.resolve = global.Promise.cast;
4315 }());
4316
4317 // 25.4.5.1 Promise.prototype [ @@toStringTag ]
4318 define(Promise.prototype, $$toStringTag, 'Promise');
4319
4320 // ---------------------------------------
4321 // 26 Reflection
4322 // ---------------------------------------
4323
4324 (function() {
4325 // 26.1 The Reflect Object
4326 if (!('Reflect' in global) || OVERRIDE_NATIVE_FOR_TESTING)
4327 global.Reflect = {};
4328
4329 // 26.1.1 Reflect.apply ( target, thisArgument, argumentsList )
4330 define(
4331 Reflect, 'apply',
4332 function apply(target, thisArgument, argumentsList) {
4333 if (!IsCallable(target)) throw TypeError();
4334 return Function.prototype.apply.call(target, thisArgument, argumentsList);
4335 });
4336
4337 // 26.1.2 Reflect.construct ( target, argumentsList [, newTarget] )
4338 define(
4339 Reflect, 'construct',
4340 function construct(target, argumentsList) {
4341 return __cons(target, argumentsList);
4342 });
4343
4344 // 26.1.3 Reflect.defineProperty ( target, propertyKey, attributes )
4345 define(
4346 Reflect, 'defineProperty',
4347 function defineProperty(target, propertyKey, attributes) {
4348 try {
4349 Object.defineProperty(target, propertyKey, attributes);
4350 return true;
4351 } catch (_) {
4352 return false;
4353 }
4354 });
4355
4356 // 26.1.4 Reflect.deleteProperty ( target, propertyKey )
4357 define(
4358 Reflect, 'deleteProperty',
4359 function deleteProperty(target,name) {
4360 try {
4361 delete target[name];
4362 return !HasOwnProperty(target, name);
4363 } catch (_) {
4364 return false;
4365 }
4366 });
4367
4368 // 26.1.5 Reflect.enumerate ( target )
4369 define(
4370 Reflect, 'enumerate',
4371 function enumerate(target) {
4372 target = ToObject(target);
4373 var iterator = Enumerate(target);
4374 return iterator;
4375 });
4376
4377 // 26.1.6 Reflect.get ( target, propertyKey [ , receiver ])
4378 define(
4379 Reflect, 'get',
4380 function get(target, name, receiver) {
4381 target = ToObject(target);
4382 name = String(name);
4383 receiver = (receiver === undefined) ? target : ToObject(receiver);
4384 var desc = getPropertyDescriptor(target, name);
4385 if (desc && 'get' in desc)
4386 return Function.prototype.call.call(desc['get'], receiver);
4387 return target[name];
4388 });
4389
4390 // 26.1.7 Reflect.getOwnPropertyDescriptor ( target, propertyKey )
4391 define(
4392 Reflect, 'getOwnPropertyDescriptor',
4393 Object.getOwnPropertyDescriptor);
4394
4395 // 26.1.8 Reflect.getPrototypeOf ( target )
4396 define(
4397 Reflect, 'getPrototypeOf',
4398 Object.getPrototypeOf);
4399
4400 // 26.1.9 Reflect.has ( target, propertyKey )
4401 define(
4402 Reflect, 'has',
4403 function has(target,name) {
4404 return String(name) in ToObject(target);
4405 });
4406
4407 // 26.1.10 Reflect.isExtensible (target)
4408 define(
4409 Reflect, 'isExtensible',
4410 Object.isExtensible);
4411
4412 // 26.1.11 Reflect.ownKeys ( target )
4413 define(
4414 Reflect, 'ownKeys',
4415 function ownKeys(target) {
4416 var obj = ToObject(target);
4417 return Object.getOwnPropertyNames(obj);
4418 });
4419
4420 // 26.1.12 Reflect.preventExtensions ( target )
4421 define(
4422 Reflect, 'preventExtensions',
4423 function preventExtensions(target) {
4424 try { Object.preventExtensions(target); return true; } catch (_) { return false; }
4425 });
4426
4427 // 26.1.13 Reflect.set ( target, propertyKey, V [ , receiver ] )
4428 define(
4429 Reflect, 'set',
4430 function set(target, name, value, receiver) {
4431 target = ToObject(target);
4432 name = String(name);
4433 receiver = (receiver === undefined) ? target : ToObject(receiver);
4434 var desc = getPropertyDescriptor(target, name);
4435 try {
4436 if (desc && 'set' in desc)
4437 Function.prototype.call.call(desc['set'], receiver, value);
4438 else
4439 target[name] = value;
4440 return true;
4441 } catch (_) {
4442 return false;
4443 }
4444 });
4445
4446 // 26.1.14 Reflect.setPrototypeOf ( target, proto )
4447 define(
4448 Reflect, 'setPrototypeOf',
4449 function setPrototypeOf(target, proto) {
4450 try {
4451 target.__proto__ = proto;
4452 return Reflect.getPrototypeOf(target) === proto;
4453 } catch(_) {
4454 return false;
4455 }
4456 });
4457
4458 }());
4459
4460 // ---------------------------------------
4461 // 26.2 Proxy Objects
4462 // ---------------------------------------
4463
4464 // Not polyfillable.
4465
4466}(self));
4467
4468// This helper is defined outside the main scope so that the use of
4469// 'eval' does not taint the scope for minifiers.
4470function __cons(t, a) {
4471 return eval('new t(' + a.map(function(_, i) { return 'a[' + i + ']'; }).join(',') + ')');
4472}
4473</script>
4474 <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.foo = 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){
4475'use strict'
4476
4477exports.byteLength = byteLength
4478exports.toByteArray = toByteArray
4479exports.fromByteArray = fromByteArray
4480
4481var lookup = []
4482var revLookup = []
4483var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
4484
4485var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
4486for (var i = 0, len = code.length; i < len; ++i) {
4487 lookup[i] = code[i]
4488 revLookup[code.charCodeAt(i)] = i
4489}
4490
4491revLookup['-'.charCodeAt(0)] = 62
4492revLookup['_'.charCodeAt(0)] = 63
4493
4494function placeHoldersCount (b64) {
4495 var len = b64.length
4496 if (len % 4 > 0) {
4497 throw new Error('Invalid string. Length must be a multiple of 4')
4498 }
4499
4500 // the number of equal signs (place holders)
4501 // if there are two placeholders, than the two characters before it
4502 // represent one byte
4503 // if there is only one, then the three characters before it represent 2 bytes
4504 // this is just a cheap hack to not do indexOf twice
4505 return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
4506}
4507
4508function byteLength (b64) {
4509 // base64 is 4/3 + up to two characters of the original data
4510 return b64.length * 3 / 4 - placeHoldersCount(b64)
4511}
4512
4513function toByteArray (b64) {
4514 var i, j, l, tmp, placeHolders, arr
4515 var len = b64.length
4516 placeHolders = placeHoldersCount(b64)
4517
4518 arr = new Arr(len * 3 / 4 - placeHolders)
4519
4520 // if there are placeholders, only get up to the last complete 4 chars
4521 l = placeHolders > 0 ? len - 4 : len
4522
4523 var L = 0
4524
4525 for (i = 0, j = 0; i < l; i += 4, j += 3) {
4526 tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
4527 arr[L++] = (tmp >> 16) & 0xFF
4528 arr[L++] = (tmp >> 8) & 0xFF
4529 arr[L++] = tmp & 0xFF
4530 }
4531
4532 if (placeHolders === 2) {
4533 tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
4534 arr[L++] = tmp & 0xFF
4535 } else if (placeHolders === 1) {
4536 tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
4537 arr[L++] = (tmp >> 8) & 0xFF
4538 arr[L++] = tmp & 0xFF
4539 }
4540
4541 return arr
4542}
4543
4544function tripletToBase64 (num) {
4545 return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
4546}
4547
4548function encodeChunk (uint8, start, end) {
4549 var tmp
4550 var output = []
4551 for (var i = start; i < end; i += 3) {
4552 tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
4553 output.push(tripletToBase64(tmp))
4554 }
4555 return output.join('')
4556}
4557
4558function fromByteArray (uint8) {
4559 var tmp
4560 var len = uint8.length
4561 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
4562 var output = ''
4563 var parts = []
4564 var maxChunkLength = 16383 // must be multiple of 3
4565
4566 // go through the array every three bytes, we'll deal with trailing stuff later
4567 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
4568 parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
4569 }
4570
4571 // pad the end with zeros, but make sure to not forget the extra bytes
4572 if (extraBytes === 1) {
4573 tmp = uint8[len - 1]
4574 output += lookup[tmp >> 2]
4575 output += lookup[(tmp << 4) & 0x3F]
4576 output += '=='
4577 } else if (extraBytes === 2) {
4578 tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
4579 output += lookup[tmp >> 10]
4580 output += lookup[(tmp >> 4) & 0x3F]
4581 output += lookup[(tmp << 2) & 0x3F]
4582 output += '='
4583 }
4584
4585 parts.push(output)
4586
4587 return parts.join('')
4588}
4589
4590},{}],2:[function(require,module,exports){
4591/*!
4592 * The buffer module from node.js, for the browser.
4593 *
4594 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
4595 * @license MIT
4596 */
4597/* eslint-disable no-proto */
4598
4599'use strict'
4600
4601var base64 = require('base64-js')
4602var ieee754 = require('ieee754')
4603
4604exports.Buffer = Buffer
4605exports.SlowBuffer = SlowBuffer
4606exports.INSPECT_MAX_BYTES = 50
4607
4608var K_MAX_LENGTH = 0x7fffffff
4609exports.kMaxLength = K_MAX_LENGTH
4610
4611/**
4612 * If `Buffer.TYPED_ARRAY_SUPPORT`:
4613 * === true Use Uint8Array implementation (fastest)
4614 * === false Print warning and recommend using `buffer` v4.x which has an Object
4615 * implementation (most compatible, even IE6)
4616 *
4617 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
4618 * Opera 11.6+, iOS 4.2+.
4619 *
4620 * We report that the browser does not support typed arrays if the are not subclassable
4621 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
4622 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
4623 * for __proto__ and has a buggy typed array implementation.
4624 */
4625Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
4626
4627if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
4628 typeof console.error === 'function') {
4629 console.error(
4630 'This browser lacks typed array (Uint8Array) support which is required by ' +
4631 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
4632 )
4633}
4634
4635function typedArraySupport () {
4636 // Can typed array instances can be augmented?
4637 try {
4638 var arr = new Uint8Array(1)
4639 arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
4640 return arr.foo() === 42
4641 } catch (e) {
4642 return false
4643 }
4644}
4645
4646function createBuffer (length) {
4647 if (length > K_MAX_LENGTH) {
4648 throw new RangeError('Invalid typed array length')
4649 }
4650 // Return an augmented `Uint8Array` instance
4651 var buf = new Uint8Array(length)
4652 buf.__proto__ = Buffer.prototype
4653 return buf
4654}
4655
4656/**
4657 * The Buffer constructor returns instances of `Uint8Array` that have their
4658 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
4659 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
4660 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
4661 * returns a single octet.
4662 *
4663 * The `Uint8Array` prototype remains unmodified.
4664 */
4665
4666function Buffer (arg, encodingOrOffset, length) {
4667 // Common case.
4668 if (typeof arg === 'number') {
4669 if (typeof encodingOrOffset === 'string') {
4670 throw new Error(
4671 'If encoding is specified then the first argument must be a string'
4672 )
4673 }
4674 return allocUnsafe(arg)
4675 }
4676 return from(arg, encodingOrOffset, length)
4677}
4678
4679// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
4680if (typeof Symbol !== 'undefined' && Symbol.species &&
4681 Buffer[Symbol.species] === Buffer) {
4682 Object.defineProperty(Buffer, Symbol.species, {
4683 value: null,
4684 configurable: true,
4685 enumerable: false,
4686 writable: false
4687 })
4688}
4689
4690Buffer.poolSize = 8192 // not used by this implementation
4691
4692function from (value, encodingOrOffset, length) {
4693 if (typeof value === 'number') {
4694 throw new TypeError('"value" argument must not be a number')
4695 }
4696
4697 if (value instanceof ArrayBuffer) {
4698 return fromArrayBuffer(value, encodingOrOffset, length)
4699 }
4700
4701 if (typeof value === 'string') {
4702 return fromString(value, encodingOrOffset)
4703 }
4704
4705 return fromObject(value)
4706}
4707
4708/**
4709 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
4710 * if value is a number.
4711 * Buffer.from(str[, encoding])
4712 * Buffer.from(array)
4713 * Buffer.from(buffer)
4714 * Buffer.from(arrayBuffer[, byteOffset[, length]])
4715 **/
4716Buffer.from = function (value, encodingOrOffset, length) {
4717 return from(value, encodingOrOffset, length)
4718}
4719
4720// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
4721// https://github.com/feross/buffer/pull/148
4722Buffer.prototype.__proto__ = Uint8Array.prototype
4723Buffer.__proto__ = Uint8Array
4724
4725function assertSize (size) {
4726 if (typeof size !== 'number') {
4727 throw new TypeError('"size" argument must be a number')
4728 } else if (size < 0) {
4729 throw new RangeError('"size" argument must not be negative')
4730 }
4731}
4732
4733function alloc (size, fill, encoding) {
4734 assertSize(size)
4735 if (size <= 0) {
4736 return createBuffer(size)
4737 }
4738 if (fill !== undefined) {
4739 // Only pay attention to encoding if it's a string. This
4740 // prevents accidentally sending in a number that would
4741 // be interpretted as a start offset.
4742 return typeof encoding === 'string'
4743 ? createBuffer(size).fill(fill, encoding)
4744 : createBuffer(size).fill(fill)
4745 }
4746 return createBuffer(size)
4747}
4748
4749/**
4750 * Creates a new filled Buffer instance.
4751 * alloc(size[, fill[, encoding]])
4752 **/
4753Buffer.alloc = function (size, fill, encoding) {
4754 return alloc(size, fill, encoding)
4755}
4756
4757function allocUnsafe (size) {
4758 assertSize(size)
4759 return createBuffer(size < 0 ? 0 : checked(size) | 0)
4760}
4761
4762/**
4763 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
4764 * */
4765Buffer.allocUnsafe = function (size) {
4766 return allocUnsafe(size)
4767}
4768/**
4769 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
4770 */
4771Buffer.allocUnsafeSlow = function (size) {
4772 return allocUnsafe(size)
4773}
4774
4775function fromString (string, encoding) {
4776 if (typeof encoding !== 'string' || encoding === '') {
4777 encoding = 'utf8'
4778 }
4779
4780 if (!Buffer.isEncoding(encoding)) {
4781 throw new TypeError('"encoding" must be a valid string encoding')
4782 }
4783
4784 var length = byteLength(string, encoding) | 0
4785 var buf = createBuffer(length)
4786
4787 var actual = buf.write(string, encoding)
4788
4789 if (actual !== length) {
4790 // Writing a hex string, for example, that contains invalid characters will
4791 // cause everything after the first invalid character to be ignored. (e.g.
4792 // 'abxxcd' will be treated as 'ab')
4793 buf = buf.slice(0, actual)
4794 }
4795
4796 return buf
4797}
4798
4799function fromArrayLike (array) {
4800 var length = array.length < 0 ? 0 : checked(array.length) | 0
4801 var buf = createBuffer(length)
4802 for (var i = 0; i < length; i += 1) {
4803 buf[i] = array[i] & 255
4804 }
4805 return buf
4806}
4807
4808function fromArrayBuffer (array, byteOffset, length) {
4809 if (byteOffset < 0 || array.byteLength < byteOffset) {
4810 throw new RangeError('\'offset\' is out of bounds')
4811 }
4812
4813 if (array.byteLength < byteOffset + (length || 0)) {
4814 throw new RangeError('\'length\' is out of bounds')
4815 }
4816
4817 var buf
4818 if (byteOffset === undefined && length === undefined) {
4819 buf = new Uint8Array(array)
4820 } else if (length === undefined) {
4821 buf = new Uint8Array(array, byteOffset)
4822 } else {
4823 buf = new Uint8Array(array, byteOffset, length)
4824 }
4825
4826 // Return an augmented `Uint8Array` instance
4827 buf.__proto__ = Buffer.prototype
4828 return buf
4829}
4830
4831function fromObject (obj) {
4832 if (Buffer.isBuffer(obj)) {
4833 var len = checked(obj.length) | 0
4834 var buf = createBuffer(len)
4835
4836 if (buf.length === 0) {
4837 return buf
4838 }
4839
4840 obj.copy(buf, 0, 0, len)
4841 return buf
4842 }
4843
4844 if (obj) {
4845 if (isArrayBufferView(obj) || 'length' in obj) {
4846 if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
4847 return createBuffer(0)
4848 }
4849 return fromArrayLike(obj)
4850 }
4851
4852 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
4853 return fromArrayLike(obj.data)
4854 }
4855 }
4856
4857 throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
4858}
4859
4860function checked (length) {
4861 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
4862 // length is NaN (which is otherwise coerced to zero.)
4863 if (length >= K_MAX_LENGTH) {
4864 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
4865 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
4866 }
4867 return length | 0
4868}
4869
4870function SlowBuffer (length) {
4871 if (+length != length) { // eslint-disable-line eqeqeq
4872 length = 0
4873 }
4874 return Buffer.alloc(+length)
4875}
4876
4877Buffer.isBuffer = function isBuffer (b) {
4878 return b != null && b._isBuffer === true
4879}
4880
4881Buffer.compare = function compare (a, b) {
4882 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
4883 throw new TypeError('Arguments must be Buffers')
4884 }
4885
4886 if (a === b) return 0
4887
4888 var x = a.length
4889 var y = b.length
4890
4891 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
4892 if (a[i] !== b[i]) {
4893 x = a[i]
4894 y = b[i]
4895 break
4896 }
4897 }
4898
4899 if (x < y) return -1
4900 if (y < x) return 1
4901 return 0
4902}
4903
4904Buffer.isEncoding = function isEncoding (encoding) {
4905 switch (String(encoding).toLowerCase()) {
4906 case 'hex':
4907 case 'utf8':
4908 case 'utf-8':
4909 case 'ascii':
4910 case 'latin1':
4911 case 'binary':
4912 case 'base64':
4913 case 'ucs2':
4914 case 'ucs-2':
4915 case 'utf16le':
4916 case 'utf-16le':
4917 return true
4918 default:
4919 return false
4920 }
4921}
4922
4923Buffer.concat = function concat (list, length) {
4924 if (!Array.isArray(list)) {
4925 throw new TypeError('"list" argument must be an Array of Buffers')
4926 }
4927
4928 if (list.length === 0) {
4929 return Buffer.alloc(0)
4930 }
4931
4932 var i
4933 if (length === undefined) {
4934 length = 0
4935 for (i = 0; i < list.length; ++i) {
4936 length += list[i].length
4937 }
4938 }
4939
4940 var buffer = Buffer.allocUnsafe(length)
4941 var pos = 0
4942 for (i = 0; i < list.length; ++i) {
4943 var buf = list[i]
4944 if (!Buffer.isBuffer(buf)) {
4945 throw new TypeError('"list" argument must be an Array of Buffers')
4946 }
4947 buf.copy(buffer, pos)
4948 pos += buf.length
4949 }
4950 return buffer
4951}
4952
4953function byteLength (string, encoding) {
4954 if (Buffer.isBuffer(string)) {
4955 return string.length
4956 }
4957 if (isArrayBufferView(string) || string instanceof ArrayBuffer) {
4958 return string.byteLength
4959 }
4960 if (typeof string !== 'string') {
4961 string = '' + string
4962 }
4963
4964 var len = string.length
4965 if (len === 0) return 0
4966
4967 // Use a for loop to avoid recursion
4968 var loweredCase = false
4969 for (;;) {
4970 switch (encoding) {
4971 case 'ascii':
4972 case 'latin1':
4973 case 'binary':
4974 return len
4975 case 'utf8':
4976 case 'utf-8':
4977 case undefined:
4978 return utf8ToBytes(string).length
4979 case 'ucs2':
4980 case 'ucs-2':
4981 case 'utf16le':
4982 case 'utf-16le':
4983 return len * 2
4984 case 'hex':
4985 return len >>> 1
4986 case 'base64':
4987 return base64ToBytes(string).length
4988 default:
4989 if (loweredCase) return utf8ToBytes(string).length // assume utf8
4990 encoding = ('' + encoding).toLowerCase()
4991 loweredCase = true
4992 }
4993 }
4994}
4995Buffer.byteLength = byteLength
4996
4997function slowToString (encoding, start, end) {
4998 var loweredCase = false
4999
5000 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
5001 // property of a typed array.
5002
5003 // This behaves neither like String nor Uint8Array in that we set start/end
5004 // to their upper/lower bounds if the value passed is out of range.
5005 // undefined is handled specially as per ECMA-262 6th Edition,
5006 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
5007 if (start === undefined || start < 0) {
5008 start = 0
5009 }
5010 // Return early if start > this.length. Done here to prevent potential uint32
5011 // coercion fail below.
5012 if (start > this.length) {
5013 return ''
5014 }
5015
5016 if (end === undefined || end > this.length) {
5017 end = this.length
5018 }
5019
5020 if (end <= 0) {
5021 return ''
5022 }
5023
5024 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
5025 end >>>= 0
5026 start >>>= 0
5027
5028 if (end <= start) {
5029 return ''
5030 }
5031
5032 if (!encoding) encoding = 'utf8'
5033
5034 while (true) {
5035 switch (encoding) {
5036 case 'hex':
5037 return hexSlice(this, start, end)
5038
5039 case 'utf8':
5040 case 'utf-8':
5041 return utf8Slice(this, start, end)
5042
5043 case 'ascii':
5044 return asciiSlice(this, start, end)
5045
5046 case 'latin1':
5047 case 'binary':
5048 return latin1Slice(this, start, end)
5049
5050 case 'base64':
5051 return base64Slice(this, start, end)
5052
5053 case 'ucs2':
5054 case 'ucs-2':
5055 case 'utf16le':
5056 case 'utf-16le':
5057 return utf16leSlice(this, start, end)
5058
5059 default:
5060 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
5061 encoding = (encoding + '').toLowerCase()
5062 loweredCase = true
5063 }
5064 }
5065}
5066
5067// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
5068// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
5069// reliably in a browserify context because there could be multiple different
5070// copies of the 'buffer' package in use. This method works even for Buffer
5071// instances that were created from another copy of the `buffer` package.
5072// See: https://github.com/feross/buffer/issues/154
5073Buffer.prototype._isBuffer = true
5074
5075function swap (b, n, m) {
5076 var i = b[n]
5077 b[n] = b[m]
5078 b[m] = i
5079}
5080
5081Buffer.prototype.swap16 = function swap16 () {
5082 var len = this.length
5083 if (len % 2 !== 0) {
5084 throw new RangeError('Buffer size must be a multiple of 16-bits')
5085 }
5086 for (var i = 0; i < len; i += 2) {
5087 swap(this, i, i + 1)
5088 }
5089 return this
5090}
5091
5092Buffer.prototype.swap32 = function swap32 () {
5093 var len = this.length
5094 if (len % 4 !== 0) {
5095 throw new RangeError('Buffer size must be a multiple of 32-bits')
5096 }
5097 for (var i = 0; i < len; i += 4) {
5098 swap(this, i, i + 3)
5099 swap(this, i + 1, i + 2)
5100 }
5101 return this
5102}
5103
5104Buffer.prototype.swap64 = function swap64 () {
5105 var len = this.length
5106 if (len % 8 !== 0) {
5107 throw new RangeError('Buffer size must be a multiple of 64-bits')
5108 }
5109 for (var i = 0; i < len; i += 8) {
5110 swap(this, i, i + 7)
5111 swap(this, i + 1, i + 6)
5112 swap(this, i + 2, i + 5)
5113 swap(this, i + 3, i + 4)
5114 }
5115 return this
5116}
5117
5118Buffer.prototype.toString = function toString () {
5119 var length = this.length
5120 if (length === 0) return ''
5121 if (arguments.length === 0) return utf8Slice(this, 0, length)
5122 return slowToString.apply(this, arguments)
5123}
5124
5125Buffer.prototype.equals = function equals (b) {
5126 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
5127 if (this === b) return true
5128 return Buffer.compare(this, b) === 0
5129}
5130
5131Buffer.prototype.inspect = function inspect () {
5132 var str = ''
5133 var max = exports.INSPECT_MAX_BYTES
5134 if (this.length > 0) {
5135 str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
5136 if (this.length > max) str += ' ... '
5137 }
5138 return '<Buffer ' + str + '>'
5139}
5140
5141Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
5142 if (!Buffer.isBuffer(target)) {
5143 throw new TypeError('Argument must be a Buffer')
5144 }
5145
5146 if (start === undefined) {
5147 start = 0
5148 }
5149 if (end === undefined) {
5150 end = target ? target.length : 0
5151 }
5152 if (thisStart === undefined) {
5153 thisStart = 0
5154 }
5155 if (thisEnd === undefined) {
5156 thisEnd = this.length
5157 }
5158
5159 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
5160 throw new RangeError('out of range index')
5161 }
5162
5163 if (thisStart >= thisEnd && start >= end) {
5164 return 0
5165 }
5166 if (thisStart >= thisEnd) {
5167 return -1
5168 }
5169 if (start >= end) {
5170 return 1
5171 }
5172
5173 start >>>= 0
5174 end >>>= 0
5175 thisStart >>>= 0
5176 thisEnd >>>= 0
5177
5178 if (this === target) return 0
5179
5180 var x = thisEnd - thisStart
5181 var y = end - start
5182 var len = Math.min(x, y)
5183
5184 var thisCopy = this.slice(thisStart, thisEnd)
5185 var targetCopy = target.slice(start, end)
5186
5187 for (var i = 0; i < len; ++i) {
5188 if (thisCopy[i] !== targetCopy[i]) {
5189 x = thisCopy[i]
5190 y = targetCopy[i]
5191 break
5192 }
5193 }
5194
5195 if (x < y) return -1
5196 if (y < x) return 1
5197 return 0
5198}
5199
5200// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
5201// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
5202//
5203// Arguments:
5204// - buffer - a Buffer to search
5205// - val - a string, Buffer, or number
5206// - byteOffset - an index into `buffer`; will be clamped to an int32
5207// - encoding - an optional encoding, relevant is val is a string
5208// - dir - true for indexOf, false for lastIndexOf
5209function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
5210 // Empty buffer means no match
5211 if (buffer.length === 0) return -1
5212
5213 // Normalize byteOffset
5214 if (typeof byteOffset === 'string') {
5215 encoding = byteOffset
5216 byteOffset = 0
5217 } else if (byteOffset > 0x7fffffff) {
5218 byteOffset = 0x7fffffff
5219 } else if (byteOffset < -0x80000000) {
5220 byteOffset = -0x80000000
5221 }
5222 byteOffset = +byteOffset // Coerce to Number.
5223 if (numberIsNaN(byteOffset)) {
5224 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
5225 byteOffset = dir ? 0 : (buffer.length - 1)
5226 }
5227
5228 // Normalize byteOffset: negative offsets start from the end of the buffer
5229 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
5230 if (byteOffset >= buffer.length) {
5231 if (dir) return -1
5232 else byteOffset = buffer.length - 1
5233 } else if (byteOffset < 0) {
5234 if (dir) byteOffset = 0
5235 else return -1
5236 }
5237
5238 // Normalize val
5239 if (typeof val === 'string') {
5240 val = Buffer.from(val, encoding)
5241 }
5242
5243 // Finally, search either indexOf (if dir is true) or lastIndexOf
5244 if (Buffer.isBuffer(val)) {
5245 // Special case: looking for empty string/buffer always fails
5246 if (val.length === 0) {
5247 return -1
5248 }
5249 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
5250 } else if (typeof val === 'number') {
5251 val = val & 0xFF // Search for a byte value [0-255]
5252 if (typeof Uint8Array.prototype.indexOf === 'function') {
5253 if (dir) {
5254 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
5255 } else {
5256 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
5257 }
5258 }
5259 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
5260 }
5261
5262 throw new TypeError('val must be string, number or Buffer')
5263}
5264
5265function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
5266 var indexSize = 1
5267 var arrLength = arr.length
5268 var valLength = val.length
5269
5270 if (encoding !== undefined) {
5271 encoding = String(encoding).toLowerCase()
5272 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
5273 encoding === 'utf16le' || encoding === 'utf-16le') {
5274 if (arr.length < 2 || val.length < 2) {
5275 return -1
5276 }
5277 indexSize = 2
5278 arrLength /= 2
5279 valLength /= 2
5280 byteOffset /= 2
5281 }
5282 }
5283
5284 function read (buf, i) {
5285 if (indexSize === 1) {
5286 return buf[i]
5287 } else {
5288 return buf.readUInt16BE(i * indexSize)
5289 }
5290 }
5291
5292 var i
5293 if (dir) {
5294 var foundIndex = -1
5295 for (i = byteOffset; i < arrLength; i++) {
5296 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
5297 if (foundIndex === -1) foundIndex = i
5298 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
5299 } else {
5300 if (foundIndex !== -1) i -= i - foundIndex
5301 foundIndex = -1
5302 }
5303 }
5304 } else {
5305 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
5306 for (i = byteOffset; i >= 0; i--) {
5307 var found = true
5308 for (var j = 0; j < valLength; j++) {
5309 if (read(arr, i + j) !== read(val, j)) {
5310 found = false
5311 break
5312 }
5313 }
5314 if (found) return i
5315 }
5316 }
5317
5318 return -1
5319}
5320
5321Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
5322 return this.indexOf(val, byteOffset, encoding) !== -1
5323}
5324
5325Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
5326 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
5327}
5328
5329Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
5330 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
5331}
5332
5333function hexWrite (buf, string, offset, length) {
5334 offset = Number(offset) || 0
5335 var remaining = buf.length - offset
5336 if (!length) {
5337 length = remaining
5338 } else {
5339 length = Number(length)
5340 if (length > remaining) {
5341 length = remaining
5342 }
5343 }
5344
5345 // must be an even number of digits
5346 var strLen = string.length
5347 if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
5348
5349 if (length > strLen / 2) {
5350 length = strLen / 2
5351 }
5352 for (var i = 0; i < length; ++i) {
5353 var parsed = parseInt(string.substr(i * 2, 2), 16)
5354 if (numberIsNaN(parsed)) return i
5355 buf[offset + i] = parsed
5356 }
5357 return i
5358}
5359
5360function utf8Write (buf, string, offset, length) {
5361 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
5362}
5363
5364function asciiWrite (buf, string, offset, length) {
5365 return blitBuffer(asciiToBytes(string), buf, offset, length)
5366}
5367
5368function latin1Write (buf, string, offset, length) {
5369 return asciiWrite(buf, string, offset, length)
5370}
5371
5372function base64Write (buf, string, offset, length) {
5373 return blitBuffer(base64ToBytes(string), buf, offset, length)
5374}
5375
5376function ucs2Write (buf, string, offset, length) {
5377 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
5378}
5379
5380Buffer.prototype.write = function write (string, offset, length, encoding) {
5381 // Buffer#write(string)
5382 if (offset === undefined) {
5383 encoding = 'utf8'
5384 length = this.length
5385 offset = 0
5386 // Buffer#write(string, encoding)
5387 } else if (length === undefined && typeof offset === 'string') {
5388 encoding = offset
5389 length = this.length
5390 offset = 0
5391 // Buffer#write(string, offset[, length][, encoding])
5392 } else if (isFinite(offset)) {
5393 offset = offset >>> 0
5394 if (isFinite(length)) {
5395 length = length >>> 0
5396 if (encoding === undefined) encoding = 'utf8'
5397 } else {
5398 encoding = length
5399 length = undefined
5400 }
5401 } else {
5402 throw new Error(
5403 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
5404 )
5405 }
5406
5407 var remaining = this.length - offset
5408 if (length === undefined || length > remaining) length = remaining
5409
5410 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
5411 throw new RangeError('Attempt to write outside buffer bounds')
5412 }
5413
5414 if (!encoding) encoding = 'utf8'
5415
5416 var loweredCase = false
5417 for (;;) {
5418 switch (encoding) {
5419 case 'hex':
5420 return hexWrite(this, string, offset, length)
5421
5422 case 'utf8':
5423 case 'utf-8':
5424 return utf8Write(this, string, offset, length)
5425
5426 case 'ascii':
5427 return asciiWrite(this, string, offset, length)
5428
5429 case 'latin1':
5430 case 'binary':
5431 return latin1Write(this, string, offset, length)
5432
5433 case 'base64':
5434 // Warning: maxLength not taken into account in base64Write
5435 return base64Write(this, string, offset, length)
5436
5437 case 'ucs2':
5438 case 'ucs-2':
5439 case 'utf16le':
5440 case 'utf-16le':
5441 return ucs2Write(this, string, offset, length)
5442
5443 default:
5444 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
5445 encoding = ('' + encoding).toLowerCase()
5446 loweredCase = true
5447 }
5448 }
5449}
5450
5451Buffer.prototype.toJSON = function toJSON () {
5452 return {
5453 type: 'Buffer',
5454 data: Array.prototype.slice.call(this._arr || this, 0)
5455 }
5456}
5457
5458function base64Slice (buf, start, end) {
5459 if (start === 0 && end === buf.length) {
5460 return base64.fromByteArray(buf)
5461 } else {
5462 return base64.fromByteArray(buf.slice(start, end))
5463 }
5464}
5465
5466function utf8Slice (buf, start, end) {
5467 end = Math.min(buf.length, end)
5468 var res = []
5469
5470 var i = start
5471 while (i < end) {
5472 var firstByte = buf[i]
5473 var codePoint = null
5474 var bytesPerSequence = (firstByte > 0xEF) ? 4
5475 : (firstByte > 0xDF) ? 3
5476 : (firstByte > 0xBF) ? 2
5477 : 1
5478
5479 if (i + bytesPerSequence <= end) {
5480 var secondByte, thirdByte, fourthByte, tempCodePoint
5481
5482 switch (bytesPerSequence) {
5483 case 1:
5484 if (firstByte < 0x80) {
5485 codePoint = firstByte
5486 }
5487 break
5488 case 2:
5489 secondByte = buf[i + 1]
5490 if ((secondByte & 0xC0) === 0x80) {
5491 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
5492 if (tempCodePoint > 0x7F) {
5493 codePoint = tempCodePoint
5494 }
5495 }
5496 break
5497 case 3:
5498 secondByte = buf[i + 1]
5499 thirdByte = buf[i + 2]
5500 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
5501 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
5502 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
5503 codePoint = tempCodePoint
5504 }
5505 }
5506 break
5507 case 4:
5508 secondByte = buf[i + 1]
5509 thirdByte = buf[i + 2]
5510 fourthByte = buf[i + 3]
5511 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
5512 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
5513 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
5514 codePoint = tempCodePoint
5515 }
5516 }
5517 }
5518 }
5519
5520 if (codePoint === null) {
5521 // we did not generate a valid codePoint so insert a
5522 // replacement char (U+FFFD) and advance only 1 byte
5523 codePoint = 0xFFFD
5524 bytesPerSequence = 1
5525 } else if (codePoint > 0xFFFF) {
5526 // encode to utf16 (surrogate pair dance)
5527 codePoint -= 0x10000
5528 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
5529 codePoint = 0xDC00 | codePoint & 0x3FF
5530 }
5531
5532 res.push(codePoint)
5533 i += bytesPerSequence
5534 }
5535
5536 return decodeCodePointsArray(res)
5537}
5538
5539// Based on http://stackoverflow.com/a/22747272/680742, the browser with
5540// the lowest limit is Chrome, with 0x10000 args.
5541// We go 1 magnitude less, for safety
5542var MAX_ARGUMENTS_LENGTH = 0x1000
5543
5544function decodeCodePointsArray (codePoints) {
5545 var len = codePoints.length
5546 if (len <= MAX_ARGUMENTS_LENGTH) {
5547 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
5548 }
5549
5550 // Decode in chunks to avoid "call stack size exceeded".
5551 var res = ''
5552 var i = 0
5553 while (i < len) {
5554 res += String.fromCharCode.apply(
5555 String,
5556 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
5557 )
5558 }
5559 return res
5560}
5561
5562function asciiSlice (buf, start, end) {
5563 var ret = ''
5564 end = Math.min(buf.length, end)
5565
5566 for (var i = start; i < end; ++i) {
5567 ret += String.fromCharCode(buf[i] & 0x7F)
5568 }
5569 return ret
5570}
5571
5572function latin1Slice (buf, start, end) {
5573 var ret = ''
5574 end = Math.min(buf.length, end)
5575
5576 for (var i = start; i < end; ++i) {
5577 ret += String.fromCharCode(buf[i])
5578 }
5579 return ret
5580}
5581
5582function hexSlice (buf, start, end) {
5583 var len = buf.length
5584
5585 if (!start || start < 0) start = 0
5586 if (!end || end < 0 || end > len) end = len
5587
5588 var out = ''
5589 for (var i = start; i < end; ++i) {
5590 out += toHex(buf[i])
5591 }
5592 return out
5593}
5594
5595function utf16leSlice (buf, start, end) {
5596 var bytes = buf.slice(start, end)
5597 var res = ''
5598 for (var i = 0; i < bytes.length; i += 2) {
5599 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
5600 }
5601 return res
5602}
5603
5604Buffer.prototype.slice = function slice (start, end) {
5605 var len = this.length
5606 start = ~~start
5607 end = end === undefined ? len : ~~end
5608
5609 if (start < 0) {
5610 start += len
5611 if (start < 0) start = 0
5612 } else if (start > len) {
5613 start = len
5614 }
5615
5616 if (end < 0) {
5617 end += len
5618 if (end < 0) end = 0
5619 } else if (end > len) {
5620 end = len
5621 }
5622
5623 if (end < start) end = start
5624
5625 var newBuf = this.subarray(start, end)
5626 // Return an augmented `Uint8Array` instance
5627 newBuf.__proto__ = Buffer.prototype
5628 return newBuf
5629}
5630
5631/*
5632 * Need to make sure that buffer isn't trying to write out of bounds.
5633 */
5634function checkOffset (offset, ext, length) {
5635 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
5636 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
5637}
5638
5639Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
5640 offset = offset >>> 0
5641 byteLength = byteLength >>> 0
5642 if (!noAssert) checkOffset(offset, byteLength, this.length)
5643
5644 var val = this[offset]
5645 var mul = 1
5646 var i = 0
5647 while (++i < byteLength && (mul *= 0x100)) {
5648 val += this[offset + i] * mul
5649 }
5650
5651 return val
5652}
5653
5654Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
5655 offset = offset >>> 0
5656 byteLength = byteLength >>> 0
5657 if (!noAssert) {
5658 checkOffset(offset, byteLength, this.length)
5659 }
5660
5661 var val = this[offset + --byteLength]
5662 var mul = 1
5663 while (byteLength > 0 && (mul *= 0x100)) {
5664 val += this[offset + --byteLength] * mul
5665 }
5666
5667 return val
5668}
5669
5670Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
5671 offset = offset >>> 0
5672 if (!noAssert) checkOffset(offset, 1, this.length)
5673 return this[offset]
5674}
5675
5676Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
5677 offset = offset >>> 0
5678 if (!noAssert) checkOffset(offset, 2, this.length)
5679 return this[offset] | (this[offset + 1] << 8)
5680}
5681
5682Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
5683 offset = offset >>> 0
5684 if (!noAssert) checkOffset(offset, 2, this.length)
5685 return (this[offset] << 8) | this[offset + 1]
5686}
5687
5688Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
5689 offset = offset >>> 0
5690 if (!noAssert) checkOffset(offset, 4, this.length)
5691
5692 return ((this[offset]) |
5693 (this[offset + 1] << 8) |
5694 (this[offset + 2] << 16)) +
5695 (this[offset + 3] * 0x1000000)
5696}
5697
5698Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
5699 offset = offset >>> 0
5700 if (!noAssert) checkOffset(offset, 4, this.length)
5701
5702 return (this[offset] * 0x1000000) +
5703 ((this[offset + 1] << 16) |
5704 (this[offset + 2] << 8) |
5705 this[offset + 3])
5706}
5707
5708Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
5709 offset = offset >>> 0
5710 byteLength = byteLength >>> 0
5711 if (!noAssert) checkOffset(offset, byteLength, this.length)
5712
5713 var val = this[offset]
5714 var mul = 1
5715 var i = 0
5716 while (++i < byteLength && (mul *= 0x100)) {
5717 val += this[offset + i] * mul
5718 }
5719 mul *= 0x80
5720
5721 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5722
5723 return val
5724}
5725
5726Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
5727 offset = offset >>> 0
5728 byteLength = byteLength >>> 0
5729 if (!noAssert) checkOffset(offset, byteLength, this.length)
5730
5731 var i = byteLength
5732 var mul = 1
5733 var val = this[offset + --i]
5734 while (i > 0 && (mul *= 0x100)) {
5735 val += this[offset + --i] * mul
5736 }
5737 mul *= 0x80
5738
5739 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
5740
5741 return val
5742}
5743
5744Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
5745 offset = offset >>> 0
5746 if (!noAssert) checkOffset(offset, 1, this.length)
5747 if (!(this[offset] & 0x80)) return (this[offset])
5748 return ((0xff - this[offset] + 1) * -1)
5749}
5750
5751Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
5752 offset = offset >>> 0
5753 if (!noAssert) checkOffset(offset, 2, this.length)
5754 var val = this[offset] | (this[offset + 1] << 8)
5755 return (val & 0x8000) ? val | 0xFFFF0000 : val
5756}
5757
5758Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
5759 offset = offset >>> 0
5760 if (!noAssert) checkOffset(offset, 2, this.length)
5761 var val = this[offset + 1] | (this[offset] << 8)
5762 return (val & 0x8000) ? val | 0xFFFF0000 : val
5763}
5764
5765Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
5766 offset = offset >>> 0
5767 if (!noAssert) checkOffset(offset, 4, this.length)
5768
5769 return (this[offset]) |
5770 (this[offset + 1] << 8) |
5771 (this[offset + 2] << 16) |
5772 (this[offset + 3] << 24)
5773}
5774
5775Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
5776 offset = offset >>> 0
5777 if (!noAssert) checkOffset(offset, 4, this.length)
5778
5779 return (this[offset] << 24) |
5780 (this[offset + 1] << 16) |
5781 (this[offset + 2] << 8) |
5782 (this[offset + 3])
5783}
5784
5785Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
5786 offset = offset >>> 0
5787 if (!noAssert) checkOffset(offset, 4, this.length)
5788 return ieee754.read(this, offset, true, 23, 4)
5789}
5790
5791Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
5792 offset = offset >>> 0
5793 if (!noAssert) checkOffset(offset, 4, this.length)
5794 return ieee754.read(this, offset, false, 23, 4)
5795}
5796
5797Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
5798 offset = offset >>> 0
5799 if (!noAssert) checkOffset(offset, 8, this.length)
5800 return ieee754.read(this, offset, true, 52, 8)
5801}
5802
5803Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
5804 offset = offset >>> 0
5805 if (!noAssert) checkOffset(offset, 8, this.length)
5806 return ieee754.read(this, offset, false, 52, 8)
5807}
5808
5809function checkInt (buf, value, offset, ext, max, min) {
5810 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
5811 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
5812 if (offset + ext > buf.length) throw new RangeError('Index out of range')
5813}
5814
5815Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
5816 value = +value
5817 offset = offset >>> 0
5818 byteLength = byteLength >>> 0
5819 if (!noAssert) {
5820 var maxBytes = Math.pow(2, 8 * byteLength) - 1
5821 checkInt(this, value, offset, byteLength, maxBytes, 0)
5822 }
5823
5824 var mul = 1
5825 var i = 0
5826 this[offset] = value & 0xFF
5827 while (++i < byteLength && (mul *= 0x100)) {
5828 this[offset + i] = (value / mul) & 0xFF
5829 }
5830
5831 return offset + byteLength
5832}
5833
5834Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
5835 value = +value
5836 offset = offset >>> 0
5837 byteLength = byteLength >>> 0
5838 if (!noAssert) {
5839 var maxBytes = Math.pow(2, 8 * byteLength) - 1
5840 checkInt(this, value, offset, byteLength, maxBytes, 0)
5841 }
5842
5843 var i = byteLength - 1
5844 var mul = 1
5845 this[offset + i] = value & 0xFF
5846 while (--i >= 0 && (mul *= 0x100)) {
5847 this[offset + i] = (value / mul) & 0xFF
5848 }
5849
5850 return offset + byteLength
5851}
5852
5853Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
5854 value = +value
5855 offset = offset >>> 0
5856 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
5857 this[offset] = (value & 0xff)
5858 return offset + 1
5859}
5860
5861Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
5862 value = +value
5863 offset = offset >>> 0
5864 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
5865 this[offset] = (value & 0xff)
5866 this[offset + 1] = (value >>> 8)
5867 return offset + 2
5868}
5869
5870Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
5871 value = +value
5872 offset = offset >>> 0
5873 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
5874 this[offset] = (value >>> 8)
5875 this[offset + 1] = (value & 0xff)
5876 return offset + 2
5877}
5878
5879Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
5880 value = +value
5881 offset = offset >>> 0
5882 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
5883 this[offset + 3] = (value >>> 24)
5884 this[offset + 2] = (value >>> 16)
5885 this[offset + 1] = (value >>> 8)
5886 this[offset] = (value & 0xff)
5887 return offset + 4
5888}
5889
5890Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
5891 value = +value
5892 offset = offset >>> 0
5893 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
5894 this[offset] = (value >>> 24)
5895 this[offset + 1] = (value >>> 16)
5896 this[offset + 2] = (value >>> 8)
5897 this[offset + 3] = (value & 0xff)
5898 return offset + 4
5899}
5900
5901Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
5902 value = +value
5903 offset = offset >>> 0
5904 if (!noAssert) {
5905 var limit = Math.pow(2, (8 * byteLength) - 1)
5906
5907 checkInt(this, value, offset, byteLength, limit - 1, -limit)
5908 }
5909
5910 var i = 0
5911 var mul = 1
5912 var sub = 0
5913 this[offset] = value & 0xFF
5914 while (++i < byteLength && (mul *= 0x100)) {
5915 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
5916 sub = 1
5917 }
5918 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
5919 }
5920
5921 return offset + byteLength
5922}
5923
5924Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
5925 value = +value
5926 offset = offset >>> 0
5927 if (!noAssert) {
5928 var limit = Math.pow(2, (8 * byteLength) - 1)
5929
5930 checkInt(this, value, offset, byteLength, limit - 1, -limit)
5931 }
5932
5933 var i = byteLength - 1
5934 var mul = 1
5935 var sub = 0
5936 this[offset + i] = value & 0xFF
5937 while (--i >= 0 && (mul *= 0x100)) {
5938 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
5939 sub = 1
5940 }
5941 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
5942 }
5943
5944 return offset + byteLength
5945}
5946
5947Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
5948 value = +value
5949 offset = offset >>> 0
5950 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
5951 if (value < 0) value = 0xff + value + 1
5952 this[offset] = (value & 0xff)
5953 return offset + 1
5954}
5955
5956Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
5957 value = +value
5958 offset = offset >>> 0
5959 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
5960 this[offset] = (value & 0xff)
5961 this[offset + 1] = (value >>> 8)
5962 return offset + 2
5963}
5964
5965Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
5966 value = +value
5967 offset = offset >>> 0
5968 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
5969 this[offset] = (value >>> 8)
5970 this[offset + 1] = (value & 0xff)
5971 return offset + 2
5972}
5973
5974Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
5975 value = +value
5976 offset = offset >>> 0
5977 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
5978 this[offset] = (value & 0xff)
5979 this[offset + 1] = (value >>> 8)
5980 this[offset + 2] = (value >>> 16)
5981 this[offset + 3] = (value >>> 24)
5982 return offset + 4
5983}
5984
5985Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
5986 value = +value
5987 offset = offset >>> 0
5988 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
5989 if (value < 0) value = 0xffffffff + value + 1
5990 this[offset] = (value >>> 24)
5991 this[offset + 1] = (value >>> 16)
5992 this[offset + 2] = (value >>> 8)
5993 this[offset + 3] = (value & 0xff)
5994 return offset + 4
5995}
5996
5997function checkIEEE754 (buf, value, offset, ext, max, min) {
5998 if (offset + ext > buf.length) throw new RangeError('Index out of range')
5999 if (offset < 0) throw new RangeError('Index out of range')
6000}
6001
6002function writeFloat (buf, value, offset, littleEndian, noAssert) {
6003 value = +value
6004 offset = offset >>> 0
6005 if (!noAssert) {
6006 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
6007 }
6008 ieee754.write(buf, value, offset, littleEndian, 23, 4)
6009 return offset + 4
6010}
6011
6012Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
6013 return writeFloat(this, value, offset, true, noAssert)
6014}
6015
6016Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
6017 return writeFloat(this, value, offset, false, noAssert)
6018}
6019
6020function writeDouble (buf, value, offset, littleEndian, noAssert) {
6021 value = +value
6022 offset = offset >>> 0
6023 if (!noAssert) {
6024 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
6025 }
6026 ieee754.write(buf, value, offset, littleEndian, 52, 8)
6027 return offset + 8
6028}
6029
6030Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
6031 return writeDouble(this, value, offset, true, noAssert)
6032}
6033
6034Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
6035 return writeDouble(this, value, offset, false, noAssert)
6036}
6037
6038// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
6039Buffer.prototype.copy = function copy (target, targetStart, start, end) {
6040 if (!start) start = 0
6041 if (!end && end !== 0) end = this.length
6042 if (targetStart >= target.length) targetStart = target.length
6043 if (!targetStart) targetStart = 0
6044 if (end > 0 && end < start) end = start
6045
6046 // Copy 0 bytes; we're done
6047 if (end === start) return 0
6048 if (target.length === 0 || this.length === 0) return 0
6049
6050 // Fatal error conditions
6051 if (targetStart < 0) {
6052 throw new RangeError('targetStart out of bounds')
6053 }
6054 if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
6055 if (end < 0) throw new RangeError('sourceEnd out of bounds')
6056
6057 // Are we oob?
6058 if (end > this.length) end = this.length
6059 if (target.length - targetStart < end - start) {
6060 end = target.length - targetStart + start
6061 }
6062
6063 var len = end - start
6064 var i
6065
6066 if (this === target && start < targetStart && targetStart < end) {
6067 // descending copy from end
6068 for (i = len - 1; i >= 0; --i) {
6069 target[i + targetStart] = this[i + start]
6070 }
6071 } else if (len < 1000) {
6072 // ascending copy from start
6073 for (i = 0; i < len; ++i) {
6074 target[i + targetStart] = this[i + start]
6075 }
6076 } else {
6077 Uint8Array.prototype.set.call(
6078 target,
6079 this.subarray(start, start + len),
6080 targetStart
6081 )
6082 }
6083
6084 return len
6085}
6086
6087// Usage:
6088// buffer.fill(number[, offset[, end]])
6089// buffer.fill(buffer[, offset[, end]])
6090// buffer.fill(string[, offset[, end]][, encoding])
6091Buffer.prototype.fill = function fill (val, start, end, encoding) {
6092 // Handle string cases:
6093 if (typeof val === 'string') {
6094 if (typeof start === 'string') {
6095 encoding = start
6096 start = 0
6097 end = this.length
6098 } else if (typeof end === 'string') {
6099 encoding = end
6100 end = this.length
6101 }
6102 if (val.length === 1) {
6103 var code = val.charCodeAt(0)
6104 if (code < 256) {
6105 val = code
6106 }
6107 }
6108 if (encoding !== undefined && typeof encoding !== 'string') {
6109 throw new TypeError('encoding must be a string')
6110 }
6111 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
6112 throw new TypeError('Unknown encoding: ' + encoding)
6113 }
6114 } else if (typeof val === 'number') {
6115 val = val & 255
6116 }
6117
6118 // Invalid ranges are not set to a default, so can range check early.
6119 if (start < 0 || this.length < start || this.length < end) {
6120 throw new RangeError('Out of range index')
6121 }
6122
6123 if (end <= start) {
6124 return this
6125 }
6126
6127 start = start >>> 0
6128 end = end === undefined ? this.length : end >>> 0
6129
6130 if (!val) val = 0
6131
6132 var i
6133 if (typeof val === 'number') {
6134 for (i = start; i < end; ++i) {
6135 this[i] = val
6136 }
6137 } else {
6138 var bytes = Buffer.isBuffer(val)
6139 ? val
6140 : new Buffer(val, encoding)
6141 var len = bytes.length
6142 for (i = 0; i < end - start; ++i) {
6143 this[i + start] = bytes[i % len]
6144 }
6145 }
6146
6147 return this
6148}
6149
6150// HELPER FUNCTIONS
6151// ================
6152
6153var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
6154
6155function base64clean (str) {
6156 // Node strips out invalid characters like \n and \t from the string, base64-js does not
6157 str = str.trim().replace(INVALID_BASE64_RE, '')
6158 // Node converts strings with length < 2 to ''
6159 if (str.length < 2) return ''
6160 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
6161 while (str.length % 4 !== 0) {
6162 str = str + '='
6163 }
6164 return str
6165}
6166
6167function toHex (n) {
6168 if (n < 16) return '0' + n.toString(16)
6169 return n.toString(16)
6170}
6171
6172function utf8ToBytes (string, units) {
6173 units = units || Infinity
6174 var codePoint
6175 var length = string.length
6176 var leadSurrogate = null
6177 var bytes = []
6178
6179 for (var i = 0; i < length; ++i) {
6180 codePoint = string.charCodeAt(i)
6181
6182 // is surrogate component
6183 if (codePoint > 0xD7FF && codePoint < 0xE000) {
6184 // last char was a lead
6185 if (!leadSurrogate) {
6186 // no lead yet
6187 if (codePoint > 0xDBFF) {
6188 // unexpected trail
6189 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
6190 continue
6191 } else if (i + 1 === length) {
6192 // unpaired lead
6193 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
6194 continue
6195 }
6196
6197 // valid lead
6198 leadSurrogate = codePoint
6199
6200 continue
6201 }
6202
6203 // 2 leads in a row
6204 if (codePoint < 0xDC00) {
6205 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
6206 leadSurrogate = codePoint
6207 continue
6208 }
6209
6210 // valid surrogate pair
6211 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
6212 } else if (leadSurrogate) {
6213 // valid bmp char, but last char was a lead
6214 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
6215 }
6216
6217 leadSurrogate = null
6218
6219 // encode utf8
6220 if (codePoint < 0x80) {
6221 if ((units -= 1) < 0) break
6222 bytes.push(codePoint)
6223 } else if (codePoint < 0x800) {
6224 if ((units -= 2) < 0) break
6225 bytes.push(
6226 codePoint >> 0x6 | 0xC0,
6227 codePoint & 0x3F | 0x80
6228 )
6229 } else if (codePoint < 0x10000) {
6230 if ((units -= 3) < 0) break
6231 bytes.push(
6232 codePoint >> 0xC | 0xE0,
6233 codePoint >> 0x6 & 0x3F | 0x80,
6234 codePoint & 0x3F | 0x80
6235 )
6236 } else if (codePoint < 0x110000) {
6237 if ((units -= 4) < 0) break
6238 bytes.push(
6239 codePoint >> 0x12 | 0xF0,
6240 codePoint >> 0xC & 0x3F | 0x80,
6241 codePoint >> 0x6 & 0x3F | 0x80,
6242 codePoint & 0x3F | 0x80
6243 )
6244 } else {
6245 throw new Error('Invalid code point')
6246 }
6247 }
6248
6249 return bytes
6250}
6251
6252function asciiToBytes (str) {
6253 var byteArray = []
6254 for (var i = 0; i < str.length; ++i) {
6255 // Node's code seems to be doing this and not & 0x7F..
6256 byteArray.push(str.charCodeAt(i) & 0xFF)
6257 }
6258 return byteArray
6259}
6260
6261function utf16leToBytes (str, units) {
6262 var c, hi, lo
6263 var byteArray = []
6264 for (var i = 0; i < str.length; ++i) {
6265 if ((units -= 2) < 0) break
6266
6267 c = str.charCodeAt(i)
6268 hi = c >> 8
6269 lo = c % 256
6270 byteArray.push(lo)
6271 byteArray.push(hi)
6272 }
6273
6274 return byteArray
6275}
6276
6277function base64ToBytes (str) {
6278 return base64.toByteArray(base64clean(str))
6279}
6280
6281function blitBuffer (src, dst, offset, length) {
6282 for (var i = 0; i < length; ++i) {
6283 if ((i + offset >= dst.length) || (i >= src.length)) break
6284 dst[i + offset] = src[i]
6285 }
6286 return i
6287}
6288
6289// Node 0.10 supports `ArrayBuffer` but lacks `ArrayBuffer.isView`
6290function isArrayBufferView (obj) {
6291 return (typeof ArrayBuffer.isView === 'function') && ArrayBuffer.isView(obj)
6292}
6293
6294function numberIsNaN (obj) {
6295 return obj !== obj // eslint-disable-line no-self-compare
6296}
6297
6298},{"base64-js":1,"ieee754":3}],3:[function(require,module,exports){
6299exports.read = function (buffer, offset, isLE, mLen, nBytes) {
6300 var e, m
6301 var eLen = nBytes * 8 - mLen - 1
6302 var eMax = (1 << eLen) - 1
6303 var eBias = eMax >> 1
6304 var nBits = -7
6305 var i = isLE ? (nBytes - 1) : 0
6306 var d = isLE ? -1 : 1
6307 var s = buffer[offset + i]
6308
6309 i += d
6310
6311 e = s & ((1 << (-nBits)) - 1)
6312 s >>= (-nBits)
6313 nBits += eLen
6314 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
6315
6316 m = e & ((1 << (-nBits)) - 1)
6317 e >>= (-nBits)
6318 nBits += mLen
6319 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
6320
6321 if (e === 0) {
6322 e = 1 - eBias
6323 } else if (e === eMax) {
6324 return m ? NaN : ((s ? -1 : 1) * Infinity)
6325 } else {
6326 m = m + Math.pow(2, mLen)
6327 e = e - eBias
6328 }
6329 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
6330}
6331
6332exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
6333 var e, m, c
6334 var eLen = nBytes * 8 - mLen - 1
6335 var eMax = (1 << eLen) - 1
6336 var eBias = eMax >> 1
6337 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
6338 var i = isLE ? 0 : (nBytes - 1)
6339 var d = isLE ? 1 : -1
6340 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
6341
6342 value = Math.abs(value)
6343
6344 if (isNaN(value) || value === Infinity) {
6345 m = isNaN(value) ? 1 : 0
6346 e = eMax
6347 } else {
6348 e = Math.floor(Math.log(value) / Math.LN2)
6349 if (value * (c = Math.pow(2, -e)) < 1) {
6350 e--
6351 c *= 2
6352 }
6353 if (e + eBias >= 1) {
6354 value += rt / c
6355 } else {
6356 value += rt * Math.pow(2, 1 - eBias)
6357 }
6358 if (value * c >= 2) {
6359 e++
6360 c /= 2
6361 }
6362
6363 if (e + eBias >= eMax) {
6364 m = 0
6365 e = eMax
6366 } else if (e + eBias >= 1) {
6367 m = (value * c - 1) * Math.pow(2, mLen)
6368 e = e + eBias
6369 } else {
6370 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
6371 e = 0
6372 }
6373 }
6374
6375 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
6376
6377 e = (e << mLen) | m
6378 eLen += mLen
6379 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
6380
6381 buffer[offset + i - d] |= s * 128
6382}
6383
6384},{}],4:[function(require,module,exports){
6385window.basex = require('base-x')
6386},{"base-x":5}],5:[function(require,module,exports){
6387// base-x encoding
6388// Forked from https://github.com/cryptocoinjs/bs58
6389// Originally written by Mike Hearn for BitcoinJ
6390// Copyright (c) 2011 Google Inc
6391// Ported to JavaScript by Stefan Thomas
6392// Merged Buffer refactorings from base58-native by Stephen Pair
6393// Copyright (c) 2013 BitPay Inc
6394
6395var Buffer = require('safe-buffer').Buffer
6396
6397module.exports = function base (ALPHABET) {
6398 var ALPHABET_MAP = {}
6399 var BASE = ALPHABET.length
6400 var LEADER = ALPHABET.charAt(0)
6401
6402 // pre-compute lookup table
6403 for (var z = 0; z < ALPHABET.length; z++) {
6404 var x = ALPHABET.charAt(z)
6405
6406 if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous')
6407 ALPHABET_MAP[x] = z
6408 }
6409
6410 function encode (source) {
6411 if (source.length === 0) return ''
6412
6413 var digits = [0]
6414 for (var i = 0; i < source.length; ++i) {
6415 for (var j = 0, carry = source[i]; j < digits.length; ++j) {
6416 carry += digits[j] << 8
6417 digits[j] = carry % BASE
6418 carry = (carry / BASE) | 0
6419 }
6420
6421 while (carry > 0) {
6422 digits.push(carry % BASE)
6423 carry = (carry / BASE) | 0
6424 }
6425 }
6426
6427 var string = ''
6428
6429 // deal with leading zeros
6430 for (var k = 0; source[k] === 0 && k < source.length - 1; ++k) string += ALPHABET[0]
6431 // convert digits to a string
6432 for (var q = digits.length - 1; q >= 0; --q) string += ALPHABET[digits[q]]
6433
6434 return string
6435 }
6436
6437 function decodeUnsafe (string) {
6438 if (string.length === 0) return Buffer.allocUnsafe(0)
6439
6440 var bytes = [0]
6441 for (var i = 0; i < string.length; i++) {
6442 var value = ALPHABET_MAP[string[i]]
6443 if (value === undefined) return
6444
6445 for (var j = 0, carry = value; j < bytes.length; ++j) {
6446 carry += bytes[j] * BASE
6447 bytes[j] = carry & 0xff
6448 carry >>= 8
6449 }
6450
6451 while (carry > 0) {
6452 bytes.push(carry & 0xff)
6453 carry >>= 8
6454 }
6455 }
6456
6457 // deal with leading zeros
6458 for (var k = 0; string[k] === LEADER && k < string.length - 1; ++k) {
6459 bytes.push(0)
6460 }
6461
6462 return Buffer.from(bytes.reverse())
6463 }
6464
6465 function decode (string) {
6466 var buffer = decodeUnsafe(string)
6467 if (buffer) return buffer
6468
6469 throw new Error('Non-base' + BASE + ' character')
6470 }
6471
6472 return {
6473 encode: encode,
6474 decodeUnsafe: decodeUnsafe,
6475 decode: decode
6476 }
6477}
6478
6479},{"safe-buffer":6}],6:[function(require,module,exports){
6480module.exports = require('buffer')
6481
6482},{"buffer":2}]},{},[4])(4)
6483});</script>
6484 <script>(function (root) {
6485 "use strict";
6486
6487/***** unorm.js *****/
6488
6489/*
6490 * UnicodeNormalizer 1.0.0
6491 * Copyright (c) 2008 Matsuza
6492 * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
6493 * $Date: 2008-06-05 16:44:17 +0200 (Thu, 05 Jun 2008) $
6494 * $Rev: 13309 $
6495 */
6496
6497 var DEFAULT_FEATURE = [null, 0, {}];
6498 var CACHE_THRESHOLD = 10;
6499 var SBase = 0xAC00, LBase = 0x1100, VBase = 0x1161, TBase = 0x11A7, LCount = 19, VCount = 21, TCount = 28;
6500 var NCount = VCount * TCount; // 588
6501 var SCount = LCount * NCount; // 11172
6502
6503 var UChar = function(cp, feature){
6504 this.codepoint = cp;
6505 this.feature = feature;
6506 };
6507
6508 // Strategies
6509 var cache = {};
6510 var cacheCounter = [];
6511 for (var i = 0; i <= 0xFF; ++i){
6512 cacheCounter[i] = 0;
6513 }
6514
6515 function fromCache(next, cp, needFeature){
6516 var ret = cache[cp];
6517 if(!ret){
6518 ret = next(cp, needFeature);
6519 if(!!ret.feature && ++cacheCounter[(cp >> 8) & 0xFF] > CACHE_THRESHOLD){
6520 cache[cp] = ret;
6521 }
6522 }
6523 return ret;
6524 }
6525
6526 function fromData(next, cp, needFeature){
6527 var hash = cp & 0xFF00;
6528 var dunit = UChar.udata[hash] || {};
6529 var f = dunit[cp];
6530 return f ? new UChar(cp, f) : new UChar(cp, DEFAULT_FEATURE);
6531 }
6532 function fromCpOnly(next, cp, needFeature){
6533 return !!needFeature ? next(cp, needFeature) : new UChar(cp, null);
6534 }
6535 function fromRuleBasedJamo(next, cp, needFeature){
6536 var j;
6537 if(cp < LBase || (LBase + LCount <= cp && cp < SBase) || (SBase + SCount < cp)){
6538 return next(cp, needFeature);
6539 }
6540 if(LBase <= cp && cp < LBase + LCount){
6541 var c = {};
6542 var base = (cp - LBase) * VCount;
6543 for (j = 0; j < VCount; ++j){
6544 c[VBase + j] = SBase + TCount * (j + base);
6545 }
6546 return new UChar(cp, [,,c]);
6547 }
6548
6549 var SIndex = cp - SBase;
6550 var TIndex = SIndex % TCount;
6551 var feature = [];
6552 if(TIndex !== 0){
6553 feature[0] = [SBase + SIndex - TIndex, TBase + TIndex];
6554 } else {
6555 feature[0] = [LBase + Math.floor(SIndex / NCount), VBase + Math.floor((SIndex % NCount) / TCount)];
6556 feature[2] = {};
6557 for (j = 1; j < TCount; ++j){
6558 feature[2][TBase + j] = cp + j;
6559 }
6560 }
6561 return new UChar(cp, feature);
6562 }
6563 function fromCpFilter(next, cp, needFeature){
6564 return cp < 60 || 13311 < cp && cp < 42607 ? new UChar(cp, DEFAULT_FEATURE) : next(cp, needFeature);
6565 }
6566
6567 var strategies = [fromCpFilter, fromCache, fromCpOnly, fromRuleBasedJamo, fromData];
6568
6569 UChar.fromCharCode = strategies.reduceRight(function (next, strategy) {
6570 return function (cp, needFeature) {
6571 return strategy(next, cp, needFeature);
6572 };
6573 }, null);
6574
6575 UChar.isHighSurrogate = function(cp){
6576 return cp >= 0xD800 && cp <= 0xDBFF;
6577 };
6578 UChar.isLowSurrogate = function(cp){
6579 return cp >= 0xDC00 && cp <= 0xDFFF;
6580 };
6581
6582 UChar.prototype.prepFeature = function(){
6583 if(!this.feature){
6584 this.feature = UChar.fromCharCode(this.codepoint, true).feature;
6585 }
6586 };
6587
6588 UChar.prototype.toString = function(){
6589 if(this.codepoint < 0x10000){
6590 return String.fromCharCode(this.codepoint);
6591 } else {
6592 var x = this.codepoint - 0x10000;
6593 return String.fromCharCode(Math.floor(x / 0x400) + 0xD800, x % 0x400 + 0xDC00);
6594 }
6595 };
6596
6597 UChar.prototype.getDecomp = function(){
6598 this.prepFeature();
6599 return this.feature[0] || null;
6600 };
6601
6602 UChar.prototype.isCompatibility = function(){
6603 this.prepFeature();
6604 return !!this.feature[1] && (this.feature[1] & (1 << 8));
6605 };
6606 UChar.prototype.isExclude = function(){
6607 this.prepFeature();
6608 return !!this.feature[1] && (this.feature[1] & (1 << 9));
6609 };
6610 UChar.prototype.getCanonicalClass = function(){
6611 this.prepFeature();
6612 return !!this.feature[1] ? (this.feature[1] & 0xff) : 0;
6613 };
6614 UChar.prototype.getComposite = function(following){
6615 this.prepFeature();
6616 if(!this.feature[2]){
6617 return null;
6618 }
6619 var cp = this.feature[2][following.codepoint];
6620 return cp ? UChar.fromCharCode(cp) : null;
6621 };
6622
6623 var UCharIterator = function(str){
6624 this.str = str;
6625 this.cursor = 0;
6626 };
6627 UCharIterator.prototype.next = function(){
6628 if(!!this.str && this.cursor < this.str.length){
6629 var cp = this.str.charCodeAt(this.cursor++);
6630 var d;
6631 if(UChar.isHighSurrogate(cp) && this.cursor < this.str.length && UChar.isLowSurrogate((d = this.str.charCodeAt(this.cursor)))){
6632 cp = (cp - 0xD800) * 0x400 + (d -0xDC00) + 0x10000;
6633 ++this.cursor;
6634 }
6635 return UChar.fromCharCode(cp);
6636 } else {
6637 this.str = null;
6638 return null;
6639 }
6640 };
6641
6642 var RecursDecompIterator = function(it, cano){
6643 this.it = it;
6644 this.canonical = cano;
6645 this.resBuf = [];
6646 };
6647
6648 RecursDecompIterator.prototype.next = function(){
6649 function recursiveDecomp(cano, uchar){
6650 var decomp = uchar.getDecomp();
6651 if(!!decomp && !(cano && uchar.isCompatibility())){
6652 var ret = [];
6653 for(var i = 0; i < decomp.length; ++i){
6654 var a = recursiveDecomp(cano, UChar.fromCharCode(decomp[i]));
6655 ret = ret.concat(a);
6656 }
6657 return ret;
6658 } else {
6659 return [uchar];
6660 }
6661 }
6662 if(this.resBuf.length === 0){
6663 var uchar = this.it.next();
6664 if(!uchar){
6665 return null;
6666 }
6667 this.resBuf = recursiveDecomp(this.canonical, uchar);
6668 }
6669 return this.resBuf.shift();
6670 };
6671
6672 var DecompIterator = function(it){
6673 this.it = it;
6674 this.resBuf = [];
6675 };
6676
6677 DecompIterator.prototype.next = function(){
6678 var cc;
6679 if(this.resBuf.length === 0){
6680 do{
6681 var uchar = this.it.next();
6682 if(!uchar){
6683 break;
6684 }
6685 cc = uchar.getCanonicalClass();
6686 var inspt = this.resBuf.length;
6687 if(cc !== 0){
6688 for(; inspt > 0; --inspt){
6689 var uchar2 = this.resBuf[inspt - 1];
6690 var cc2 = uchar2.getCanonicalClass();
6691 if(cc2 <= cc){
6692 break;
6693 }
6694 }
6695 }
6696 this.resBuf.splice(inspt, 0, uchar);
6697 } while(cc !== 0);
6698 }
6699 return this.resBuf.shift();
6700 };
6701
6702 var CompIterator = function(it){
6703 this.it = it;
6704 this.procBuf = [];
6705 this.resBuf = [];
6706 this.lastClass = null;
6707 };
6708
6709 CompIterator.prototype.next = function(){
6710 while(this.resBuf.length === 0){
6711 var uchar = this.it.next();
6712 if(!uchar){
6713 this.resBuf = this.procBuf;
6714 this.procBuf = [];
6715 break;
6716 }
6717 if(this.procBuf.length === 0){
6718 this.lastClass = uchar.getCanonicalClass();
6719 this.procBuf.push(uchar);
6720 } else {
6721 var starter = this.procBuf[0];
6722 var composite = starter.getComposite(uchar);
6723 var cc = uchar.getCanonicalClass();
6724 if(!!composite && (this.lastClass < cc || this.lastClass === 0)){
6725 this.procBuf[0] = composite;
6726 } else {
6727 if(cc === 0){
6728 this.resBuf = this.procBuf;
6729 this.procBuf = [];
6730 }
6731 this.lastClass = cc;
6732 this.procBuf.push(uchar);
6733 }
6734 }
6735 }
6736 return this.resBuf.shift();
6737 };
6738
6739 var createIterator = function(mode, str){
6740 switch(mode){
6741 case "NFD":
6742 return new DecompIterator(new RecursDecompIterator(new UCharIterator(str), true));
6743 case "NFKD":
6744 return new DecompIterator(new RecursDecompIterator(new UCharIterator(str), false));
6745 case "NFC":
6746 return new CompIterator(new DecompIterator(new RecursDecompIterator(new UCharIterator(str), true)));
6747 case "NFKC":
6748 return new CompIterator(new DecompIterator(new RecursDecompIterator(new UCharIterator(str), false)));
6749 }
6750 throw mode + " is invalid";
6751 };
6752 var normalize = function(mode, str){
6753 var it = createIterator(mode, str);
6754 var ret = "";
6755 var uchar;
6756 while(!!(uchar = it.next())){
6757 ret += uchar.toString();
6758 }
6759 return ret;
6760 };
6761
6762 /* API functions */
6763 function nfd(str){
6764 return normalize("NFD", str);
6765 }
6766
6767 function nfkd(str){
6768 return normalize("NFKD", str);
6769 }
6770
6771 function nfc(str){
6772 return normalize("NFC", str);
6773 }
6774
6775 function nfkc(str){
6776 return normalize("NFKC", str);
6777 }
6778
6779/* Unicode data */
6780UChar.udata={
67810:{60:[,,{824:8814}],61:[,,{824:8800}],62:[,,{824:8815}],65:[,,{768:192,769:193,770:194,771:195,772:256,774:258,775:550,776:196,777:7842,778:197,780:461,783:512,785:514,803:7840,805:7680,808:260}],66:[,,{775:7682,803:7684,817:7686}],67:[,,{769:262,770:264,775:266,780:268,807:199}],68:[,,{775:7690,780:270,803:7692,807:7696,813:7698,817:7694}],69:[,,{768:200,769:201,770:202,771:7868,772:274,774:276,775:278,776:203,777:7866,780:282,783:516,785:518,803:7864,807:552,808:280,813:7704,816:7706}],70:[,,{775:7710}],71:[,,{769:500,770:284,772:7712,774:286,775:288,780:486,807:290}],72:[,,{770:292,775:7714,776:7718,780:542,803:7716,807:7720,814:7722}],73:[,,{768:204,769:205,770:206,771:296,772:298,774:300,775:304,776:207,777:7880,780:463,783:520,785:522,803:7882,808:302,816:7724}],74:[,,{770:308}],75:[,,{769:7728,780:488,803:7730,807:310,817:7732}],76:[,,{769:313,780:317,803:7734,807:315,813:7740,817:7738}],77:[,,{769:7742,775:7744,803:7746}],78:[,,{768:504,769:323,771:209,775:7748,780:327,803:7750,807:325,813:7754,817:7752}],79:[,,{768:210,769:211,770:212,771:213,772:332,774:334,775:558,776:214,777:7886,779:336,780:465,783:524,785:526,795:416,803:7884,808:490}],80:[,,{769:7764,775:7766}],82:[,,{769:340,775:7768,780:344,783:528,785:530,803:7770,807:342,817:7774}],83:[,,{769:346,770:348,775:7776,780:352,803:7778,806:536,807:350}],84:[,,{775:7786,780:356,803:7788,806:538,807:354,813:7792,817:7790}],85:[,,{768:217,769:218,770:219,771:360,772:362,774:364,776:220,777:7910,778:366,779:368,780:467,783:532,785:534,795:431,803:7908,804:7794,808:370,813:7798,816:7796}],86:[,,{771:7804,803:7806}],87:[,,{768:7808,769:7810,770:372,775:7814,776:7812,803:7816}],88:[,,{775:7818,776:7820}],89:[,,{768:7922,769:221,770:374,771:7928,772:562,775:7822,776:376,777:7926,803:7924}],90:[,,{769:377,770:7824,775:379,780:381,803:7826,817:7828}],97:[,,{768:224,769:225,770:226,771:227,772:257,774:259,775:551,776:228,777:7843,778:229,780:462,783:513,785:515,803:7841,805:7681,808:261}],98:[,,{775:7683,803:7685,817:7687}],99:[,,{769:263,770:265,775:267,780:269,807:231}],100:[,,{775:7691,780:271,803:7693,807:7697,813:7699,817:7695}],101:[,,{768:232,769:233,770:234,771:7869,772:275,774:277,775:279,776:235,777:7867,780:283,783:517,785:519,803:7865,807:553,808:281,813:7705,816:7707}],102:[,,{775:7711}],103:[,,{769:501,770:285,772:7713,774:287,775:289,780:487,807:291}],104:[,,{770:293,775:7715,776:7719,780:543,803:7717,807:7721,814:7723,817:7830}],105:[,,{768:236,769:237,770:238,771:297,772:299,774:301,776:239,777:7881,780:464,783:521,785:523,803:7883,808:303,816:7725}],106:[,,{770:309,780:496}],107:[,,{769:7729,780:489,803:7731,807:311,817:7733}],108:[,,{769:314,780:318,803:7735,807:316,813:7741,817:7739}],109:[,,{769:7743,775:7745,803:7747}],110:[,,{768:505,769:324,771:241,775:7749,780:328,803:7751,807:326,813:7755,817:7753}],111:[,,{768:242,769:243,770:244,771:245,772:333,774:335,775:559,776:246,777:7887,779:337,780:466,783:525,785:527,795:417,803:7885,808:491}],112:[,,{769:7765,775:7767}],114:[,,{769:341,775:7769,780:345,783:529,785:531,803:7771,807:343,817:7775}],115:[,,{769:347,770:349,775:7777,780:353,803:7779,806:537,807:351}],116:[,,{775:7787,776:7831,780:357,803:7789,806:539,807:355,813:7793,817:7791}],117:[,,{768:249,769:250,770:251,771:361,772:363,774:365,776:252,777:7911,778:367,779:369,780:468,783:533,785:535,795:432,803:7909,804:7795,808:371,813:7799,816:7797}],118:[,,{771:7805,803:7807}],119:[,,{768:7809,769:7811,770:373,775:7815,776:7813,778:7832,803:7817}],120:[,,{775:7819,776:7821}],121:[,,{768:7923,769:253,770:375,771:7929,772:563,775:7823,776:255,777:7927,778:7833,803:7925}],122:[,,{769:378,770:7825,775:380,780:382,803:7827,817:7829}],160:[[32],256],168:[[32,776],256,{768:8173,769:901,834:8129}],170:[[97],256],175:[[32,772],256],178:[[50],256],179:[[51],256],180:[[32,769],256],181:[[956],256],184:[[32,807],256],185:[[49],256],186:[[111],256],188:[[49,8260,52],256],189:[[49,8260,50],256],190:[[51,8260,52],256],192:[[65,768]],193:[[65,769]],194:[[65,770],,{768:7846,769:7844,771:7850,777:7848}],195:[[65,771]],196:[[65,776],,{772:478}],197:[[65,778],,{769:506}],198:[,,{769:508,772:482}],199:[[67,807],,{769:7688}],200:[[69,768]],201:[[69,769]],202:[[69,770],,{768:7872,769:7870,771:7876,777:7874}],203:[[69,776]],204:[[73,768]],205:[[73,769]],206:[[73,770]],207:[[73,776],,{769:7726}],209:[[78,771]],210:[[79,768]],211:[[79,769]],212:[[79,770],,{768:7890,769:7888,771:7894,777:7892}],213:[[79,771],,{769:7756,772:556,776:7758}],214:[[79,776],,{772:554}],216:[,,{769:510}],217:[[85,768]],218:[[85,769]],219:[[85,770]],220:[[85,776],,{768:475,769:471,772:469,780:473}],221:[[89,769]],224:[[97,768]],225:[[97,769]],226:[[97,770],,{768:7847,769:7845,771:7851,777:7849}],227:[[97,771]],228:[[97,776],,{772:479}],229:[[97,778],,{769:507}],230:[,,{769:509,772:483}],231:[[99,807],,{769:7689}],232:[[101,768]],233:[[101,769]],234:[[101,770],,{768:7873,769:7871,771:7877,777:7875}],235:[[101,776]],236:[[105,768]],237:[[105,769]],238:[[105,770]],239:[[105,776],,{769:7727}],241:[[110,771]],242:[[111,768]],243:[[111,769]],244:[[111,770],,{768:7891,769:7889,771:7895,777:7893}],245:[[111,771],,{769:7757,772:557,776:7759}],246:[[111,776],,{772:555}],248:[,,{769:511}],249:[[117,768]],250:[[117,769]],251:[[117,770]],252:[[117,776],,{768:476,769:472,772:470,780:474}],253:[[121,769]],255:[[121,776]]},
6782256:{256:[[65,772]],257:[[97,772]],258:[[65,774],,{768:7856,769:7854,771:7860,777:7858}],259:[[97,774],,{768:7857,769:7855,771:7861,777:7859}],260:[[65,808]],261:[[97,808]],262:[[67,769]],263:[[99,769]],264:[[67,770]],265:[[99,770]],266:[[67,775]],267:[[99,775]],268:[[67,780]],269:[[99,780]],270:[[68,780]],271:[[100,780]],274:[[69,772],,{768:7700,769:7702}],275:[[101,772],,{768:7701,769:7703}],276:[[69,774]],277:[[101,774]],278:[[69,775]],279:[[101,775]],280:[[69,808]],281:[[101,808]],282:[[69,780]],283:[[101,780]],284:[[71,770]],285:[[103,770]],286:[[71,774]],287:[[103,774]],288:[[71,775]],289:[[103,775]],290:[[71,807]],291:[[103,807]],292:[[72,770]],293:[[104,770]],296:[[73,771]],297:[[105,771]],298:[[73,772]],299:[[105,772]],300:[[73,774]],301:[[105,774]],302:[[73,808]],303:[[105,808]],304:[[73,775]],306:[[73,74],256],307:[[105,106],256],308:[[74,770]],309:[[106,770]],310:[[75,807]],311:[[107,807]],313:[[76,769]],314:[[108,769]],315:[[76,807]],316:[[108,807]],317:[[76,780]],318:[[108,780]],319:[[76,183],256],320:[[108,183],256],323:[[78,769]],324:[[110,769]],325:[[78,807]],326:[[110,807]],327:[[78,780]],328:[[110,780]],329:[[700,110],256],332:[[79,772],,{768:7760,769:7762}],333:[[111,772],,{768:7761,769:7763}],334:[[79,774]],335:[[111,774]],336:[[79,779]],337:[[111,779]],340:[[82,769]],341:[[114,769]],342:[[82,807]],343:[[114,807]],344:[[82,780]],345:[[114,780]],346:[[83,769],,{775:7780}],347:[[115,769],,{775:7781}],348:[[83,770]],349:[[115,770]],350:[[83,807]],351:[[115,807]],352:[[83,780],,{775:7782}],353:[[115,780],,{775:7783}],354:[[84,807]],355:[[116,807]],356:[[84,780]],357:[[116,780]],360:[[85,771],,{769:7800}],361:[[117,771],,{769:7801}],362:[[85,772],,{776:7802}],363:[[117,772],,{776:7803}],364:[[85,774]],365:[[117,774]],366:[[85,778]],367:[[117,778]],368:[[85,779]],369:[[117,779]],370:[[85,808]],371:[[117,808]],372:[[87,770]],373:[[119,770]],374:[[89,770]],375:[[121,770]],376:[[89,776]],377:[[90,769]],378:[[122,769]],379:[[90,775]],380:[[122,775]],381:[[90,780]],382:[[122,780]],383:[[115],256,{775:7835}],416:[[79,795],,{768:7900,769:7898,771:7904,777:7902,803:7906}],417:[[111,795],,{768:7901,769:7899,771:7905,777:7903,803:7907}],431:[[85,795],,{768:7914,769:7912,771:7918,777:7916,803:7920}],432:[[117,795],,{768:7915,769:7913,771:7919,777:7917,803:7921}],439:[,,{780:494}],452:[[68,381],256],453:[[68,382],256],454:[[100,382],256],455:[[76,74],256],456:[[76,106],256],457:[[108,106],256],458:[[78,74],256],459:[[78,106],256],460:[[110,106],256],461:[[65,780]],462:[[97,780]],463:[[73,780]],464:[[105,780]],465:[[79,780]],466:[[111,780]],467:[[85,780]],468:[[117,780]],469:[[220,772]],470:[[252,772]],471:[[220,769]],472:[[252,769]],473:[[220,780]],474:[[252,780]],475:[[220,768]],476:[[252,768]],478:[[196,772]],479:[[228,772]],480:[[550,772]],481:[[551,772]],482:[[198,772]],483:[[230,772]],486:[[71,780]],487:[[103,780]],488:[[75,780]],489:[[107,780]],490:[[79,808],,{772:492}],491:[[111,808],,{772:493}],492:[[490,772]],493:[[491,772]],494:[[439,780]],495:[[658,780]],496:[[106,780]],497:[[68,90],256],498:[[68,122],256],499:[[100,122],256],500:[[71,769]],501:[[103,769]],504:[[78,768]],505:[[110,768]],506:[[197,769]],507:[[229,769]],508:[[198,769]],509:[[230,769]],510:[[216,769]],511:[[248,769]],66045:[,220]},
6783512:{512:[[65,783]],513:[[97,783]],514:[[65,785]],515:[[97,785]],516:[[69,783]],517:[[101,783]],518:[[69,785]],519:[[101,785]],520:[[73,783]],521:[[105,783]],522:[[73,785]],523:[[105,785]],524:[[79,783]],525:[[111,783]],526:[[79,785]],527:[[111,785]],528:[[82,783]],529:[[114,783]],530:[[82,785]],531:[[114,785]],532:[[85,783]],533:[[117,783]],534:[[85,785]],535:[[117,785]],536:[[83,806]],537:[[115,806]],538:[[84,806]],539:[[116,806]],542:[[72,780]],543:[[104,780]],550:[[65,775],,{772:480}],551:[[97,775],,{772:481}],552:[[69,807],,{774:7708}],553:[[101,807],,{774:7709}],554:[[214,772]],555:[[246,772]],556:[[213,772]],557:[[245,772]],558:[[79,775],,{772:560}],559:[[111,775],,{772:561}],560:[[558,772]],561:[[559,772]],562:[[89,772]],563:[[121,772]],658:[,,{780:495}],688:[[104],256],689:[[614],256],690:[[106],256],691:[[114],256],692:[[633],256],693:[[635],256],694:[[641],256],695:[[119],256],696:[[121],256],728:[[32,774],256],729:[[32,775],256],730:[[32,778],256],731:[[32,808],256],732:[[32,771],256],733:[[32,779],256],736:[[611],256],737:[[108],256],738:[[115],256],739:[[120],256],740:[[661],256],66272:[,220]},
6784768:{768:[,230],769:[,230],770:[,230],771:[,230],772:[,230],773:[,230],774:[,230],775:[,230],776:[,230,{769:836}],777:[,230],778:[,230],779:[,230],780:[,230],781:[,230],782:[,230],783:[,230],784:[,230],785:[,230],786:[,230],787:[,230],788:[,230],789:[,232],790:[,220],791:[,220],792:[,220],793:[,220],794:[,232],795:[,216],796:[,220],797:[,220],798:[,220],799:[,220],800:[,220],801:[,202],802:[,202],803:[,220],804:[,220],805:[,220],806:[,220],807:[,202],808:[,202],809:[,220],810:[,220],811:[,220],812:[,220],813:[,220],814:[,220],815:[,220],816:[,220],817:[,220],818:[,220],819:[,220],820:[,1],821:[,1],822:[,1],823:[,1],824:[,1],825:[,220],826:[,220],827:[,220],828:[,220],829:[,230],830:[,230],831:[,230],832:[[768],230],833:[[769],230],834:[,230],835:[[787],230],836:[[776,769],230],837:[,240],838:[,230],839:[,220],840:[,220],841:[,220],842:[,230],843:[,230],844:[,230],845:[,220],846:[,220],848:[,230],849:[,230],850:[,230],851:[,220],852:[,220],853:[,220],854:[,220],855:[,230],856:[,232],857:[,220],858:[,220],859:[,230],860:[,233],861:[,234],862:[,234],863:[,233],864:[,234],865:[,234],866:[,233],867:[,230],868:[,230],869:[,230],870:[,230],871:[,230],872:[,230],873:[,230],874:[,230],875:[,230],876:[,230],877:[,230],878:[,230],879:[,230],884:[[697]],890:[[32,837],256],894:[[59]],900:[[32,769],256],901:[[168,769]],902:[[913,769]],903:[[183]],904:[[917,769]],905:[[919,769]],906:[[921,769]],908:[[927,769]],910:[[933,769]],911:[[937,769]],912:[[970,769]],913:[,,{768:8122,769:902,772:8121,774:8120,787:7944,788:7945,837:8124}],917:[,,{768:8136,769:904,787:7960,788:7961}],919:[,,{768:8138,769:905,787:7976,788:7977,837:8140}],921:[,,{768:8154,769:906,772:8153,774:8152,776:938,787:7992,788:7993}],927:[,,{768:8184,769:908,787:8008,788:8009}],929:[,,{788:8172}],933:[,,{768:8170,769:910,772:8169,774:8168,776:939,788:8025}],937:[,,{768:8186,769:911,787:8040,788:8041,837:8188}],938:[[921,776]],939:[[933,776]],940:[[945,769],,{837:8116}],941:[[949,769]],942:[[951,769],,{837:8132}],943:[[953,769]],944:[[971,769]],945:[,,{768:8048,769:940,772:8113,774:8112,787:7936,788:7937,834:8118,837:8115}],949:[,,{768:8050,769:941,787:7952,788:7953}],951:[,,{768:8052,769:942,787:7968,788:7969,834:8134,837:8131}],953:[,,{768:8054,769:943,772:8145,774:8144,776:970,787:7984,788:7985,834:8150}],959:[,,{768:8056,769:972,787:8000,788:8001}],961:[,,{787:8164,788:8165}],965:[,,{768:8058,769:973,772:8161,774:8160,776:971,787:8016,788:8017,834:8166}],969:[,,{768:8060,769:974,787:8032,788:8033,834:8182,837:8179}],970:[[953,776],,{768:8146,769:912,834:8151}],971:[[965,776],,{768:8162,769:944,834:8167}],972:[[959,769]],973:[[965,769]],974:[[969,769],,{837:8180}],976:[[946],256],977:[[952],256],978:[[933],256,{769:979,776:980}],979:[[978,769]],980:[[978,776]],981:[[966],256],982:[[960],256],1008:[[954],256],1009:[[961],256],1010:[[962],256],1012:[[920],256],1013:[[949],256],1017:[[931],256],66422:[,230],66423:[,230],66424:[,230],66425:[,230],66426:[,230]},
67851024:{1024:[[1045,768]],1025:[[1045,776]],1027:[[1043,769]],1030:[,,{776:1031}],1031:[[1030,776]],1036:[[1050,769]],1037:[[1048,768]],1038:[[1059,774]],1040:[,,{774:1232,776:1234}],1043:[,,{769:1027}],1045:[,,{768:1024,774:1238,776:1025}],1046:[,,{774:1217,776:1244}],1047:[,,{776:1246}],1048:[,,{768:1037,772:1250,774:1049,776:1252}],1049:[[1048,774]],1050:[,,{769:1036}],1054:[,,{776:1254}],1059:[,,{772:1262,774:1038,776:1264,779:1266}],1063:[,,{776:1268}],1067:[,,{776:1272}],1069:[,,{776:1260}],1072:[,,{774:1233,776:1235}],1075:[,,{769:1107}],1077:[,,{768:1104,774:1239,776:1105}],1078:[,,{774:1218,776:1245}],1079:[,,{776:1247}],1080:[,,{768:1117,772:1251,774:1081,776:1253}],1081:[[1080,774]],1082:[,,{769:1116}],1086:[,,{776:1255}],1091:[,,{772:1263,774:1118,776:1265,779:1267}],1095:[,,{776:1269}],1099:[,,{776:1273}],1101:[,,{776:1261}],1104:[[1077,768]],1105:[[1077,776]],1107:[[1075,769]],1110:[,,{776:1111}],1111:[[1110,776]],1116:[[1082,769]],1117:[[1080,768]],1118:[[1091,774]],1140:[,,{783:1142}],1141:[,,{783:1143}],1142:[[1140,783]],1143:[[1141,783]],1155:[,230],1156:[,230],1157:[,230],1158:[,230],1159:[,230],1217:[[1046,774]],1218:[[1078,774]],1232:[[1040,774]],1233:[[1072,774]],1234:[[1040,776]],1235:[[1072,776]],1238:[[1045,774]],1239:[[1077,774]],1240:[,,{776:1242}],1241:[,,{776:1243}],1242:[[1240,776]],1243:[[1241,776]],1244:[[1046,776]],1245:[[1078,776]],1246:[[1047,776]],1247:[[1079,776]],1250:[[1048,772]],1251:[[1080,772]],1252:[[1048,776]],1253:[[1080,776]],1254:[[1054,776]],1255:[[1086,776]],1256:[,,{776:1258}],1257:[,,{776:1259}],1258:[[1256,776]],1259:[[1257,776]],1260:[[1069,776]],1261:[[1101,776]],1262:[[1059,772]],1263:[[1091,772]],1264:[[1059,776]],1265:[[1091,776]],1266:[[1059,779]],1267:[[1091,779]],1268:[[1063,776]],1269:[[1095,776]],1272:[[1067,776]],1273:[[1099,776]]},
67861280:{1415:[[1381,1410],256],1425:[,220],1426:[,230],1427:[,230],1428:[,230],1429:[,230],1430:[,220],1431:[,230],1432:[,230],1433:[,230],1434:[,222],1435:[,220],1436:[,230],1437:[,230],1438:[,230],1439:[,230],1440:[,230],1441:[,230],1442:[,220],1443:[,220],1444:[,220],1445:[,220],1446:[,220],1447:[,220],1448:[,230],1449:[,230],1450:[,220],1451:[,230],1452:[,230],1453:[,222],1454:[,228],1455:[,230],1456:[,10],1457:[,11],1458:[,12],1459:[,13],1460:[,14],1461:[,15],1462:[,16],1463:[,17],1464:[,18],1465:[,19],1466:[,19],1467:[,20],1468:[,21],1469:[,22],1471:[,23],1473:[,24],1474:[,25],1476:[,230],1477:[,220],1479:[,18]},
67871536:{1552:[,230],1553:[,230],1554:[,230],1555:[,230],1556:[,230],1557:[,230],1558:[,230],1559:[,230],1560:[,30],1561:[,31],1562:[,32],1570:[[1575,1619]],1571:[[1575,1620]],1572:[[1608,1620]],1573:[[1575,1621]],1574:[[1610,1620]],1575:[,,{1619:1570,1620:1571,1621:1573}],1608:[,,{1620:1572}],1610:[,,{1620:1574}],1611:[,27],1612:[,28],1613:[,29],1614:[,30],1615:[,31],1616:[,32],1617:[,33],1618:[,34],1619:[,230],1620:[,230],1621:[,220],1622:[,220],1623:[,230],1624:[,230],1625:[,230],1626:[,230],1627:[,230],1628:[,220],1629:[,230],1630:[,230],1631:[,220],1648:[,35],1653:[[1575,1652],256],1654:[[1608,1652],256],1655:[[1735,1652],256],1656:[[1610,1652],256],1728:[[1749,1620]],1729:[,,{1620:1730}],1730:[[1729,1620]],1746:[,,{1620:1747}],1747:[[1746,1620]],1749:[,,{1620:1728}],1750:[,230],1751:[,230],1752:[,230],1753:[,230],1754:[,230],1755:[,230],1756:[,230],1759:[,230],1760:[,230],1761:[,230],1762:[,230],1763:[,220],1764:[,230],1767:[,230],1768:[,230],1770:[,220],1771:[,230],1772:[,230],1773:[,220]},
67881792:{1809:[,36],1840:[,230],1841:[,220],1842:[,230],1843:[,230],1844:[,220],1845:[,230],1846:[,230],1847:[,220],1848:[,220],1849:[,220],1850:[,230],1851:[,220],1852:[,220],1853:[,230],1854:[,220],1855:[,230],1856:[,230],1857:[,230],1858:[,220],1859:[,230],1860:[,220],1861:[,230],1862:[,220],1863:[,230],1864:[,220],1865:[,230],1866:[,230],2027:[,230],2028:[,230],2029:[,230],2030:[,230],2031:[,230],2032:[,230],2033:[,230],2034:[,220],2035:[,230]},
67892048:{2070:[,230],2071:[,230],2072:[,230],2073:[,230],2075:[,230],2076:[,230],2077:[,230],2078:[,230],2079:[,230],2080:[,230],2081:[,230],2082:[,230],2083:[,230],2085:[,230],2086:[,230],2087:[,230],2089:[,230],2090:[,230],2091:[,230],2092:[,230],2093:[,230],2137:[,220],2138:[,220],2139:[,220],2276:[,230],2277:[,230],2278:[,220],2279:[,230],2280:[,230],2281:[,220],2282:[,230],2283:[,230],2284:[,230],2285:[,220],2286:[,220],2287:[,220],2288:[,27],2289:[,28],2290:[,29],2291:[,230],2292:[,230],2293:[,230],2294:[,220],2295:[,230],2296:[,230],2297:[,220],2298:[,220],2299:[,230],2300:[,230],2301:[,230],2302:[,230],2303:[,230]},
67902304:{2344:[,,{2364:2345}],2345:[[2344,2364]],2352:[,,{2364:2353}],2353:[[2352,2364]],2355:[,,{2364:2356}],2356:[[2355,2364]],2364:[,7],2381:[,9],2385:[,230],2386:[,220],2387:[,230],2388:[,230],2392:[[2325,2364],512],2393:[[2326,2364],512],2394:[[2327,2364],512],2395:[[2332,2364],512],2396:[[2337,2364],512],2397:[[2338,2364],512],2398:[[2347,2364],512],2399:[[2351,2364],512],2492:[,7],2503:[,,{2494:2507,2519:2508}],2507:[[2503,2494]],2508:[[2503,2519]],2509:[,9],2524:[[2465,2492],512],2525:[[2466,2492],512],2527:[[2479,2492],512]},
67912560:{2611:[[2610,2620],512],2614:[[2616,2620],512],2620:[,7],2637:[,9],2649:[[2582,2620],512],2650:[[2583,2620],512],2651:[[2588,2620],512],2654:[[2603,2620],512],2748:[,7],2765:[,9],68109:[,220],68111:[,230],68152:[,230],68153:[,1],68154:[,220],68159:[,9],68325:[,230],68326:[,220]},
67922816:{2876:[,7],2887:[,,{2878:2891,2902:2888,2903:2892}],2888:[[2887,2902]],2891:[[2887,2878]],2892:[[2887,2903]],2893:[,9],2908:[[2849,2876],512],2909:[[2850,2876],512],2962:[,,{3031:2964}],2964:[[2962,3031]],3014:[,,{3006:3018,3031:3020}],3015:[,,{3006:3019}],3018:[[3014,3006]],3019:[[3015,3006]],3020:[[3014,3031]],3021:[,9]},
67933072:{3142:[,,{3158:3144}],3144:[[3142,3158]],3149:[,9],3157:[,84],3158:[,91],3260:[,7],3263:[,,{3285:3264}],3264:[[3263,3285]],3270:[,,{3266:3274,3285:3271,3286:3272}],3271:[[3270,3285]],3272:[[3270,3286]],3274:[[3270,3266],,{3285:3275}],3275:[[3274,3285]],3277:[,9]},
67943328:{3398:[,,{3390:3402,3415:3404}],3399:[,,{3390:3403}],3402:[[3398,3390]],3403:[[3399,3390]],3404:[[3398,3415]],3405:[,9],3530:[,9],3545:[,,{3530:3546,3535:3548,3551:3550}],3546:[[3545,3530]],3548:[[3545,3535],,{3530:3549}],3549:[[3548,3530]],3550:[[3545,3551]]},
67953584:{3635:[[3661,3634],256],3640:[,103],3641:[,103],3642:[,9],3656:[,107],3657:[,107],3658:[,107],3659:[,107],3763:[[3789,3762],256],3768:[,118],3769:[,118],3784:[,122],3785:[,122],3786:[,122],3787:[,122],3804:[[3755,3737],256],3805:[[3755,3745],256]},
67963840:{3852:[[3851],256],3864:[,220],3865:[,220],3893:[,220],3895:[,220],3897:[,216],3907:[[3906,4023],512],3917:[[3916,4023],512],3922:[[3921,4023],512],3927:[[3926,4023],512],3932:[[3931,4023],512],3945:[[3904,4021],512],3953:[,129],3954:[,130],3955:[[3953,3954],512],3956:[,132],3957:[[3953,3956],512],3958:[[4018,3968],512],3959:[[4018,3969],256],3960:[[4019,3968],512],3961:[[4019,3969],256],3962:[,130],3963:[,130],3964:[,130],3965:[,130],3968:[,130],3969:[[3953,3968],512],3970:[,230],3971:[,230],3972:[,9],3974:[,230],3975:[,230],3987:[[3986,4023],512],3997:[[3996,4023],512],4002:[[4001,4023],512],4007:[[4006,4023],512],4012:[[4011,4023],512],4025:[[3984,4021],512],4038:[,220]},
67974096:{4133:[,,{4142:4134}],4134:[[4133,4142]],4151:[,7],4153:[,9],4154:[,9],4237:[,220],4348:[[4316],256],69702:[,9],69759:[,9],69785:[,,{69818:69786}],69786:[[69785,69818]],69787:[,,{69818:69788}],69788:[[69787,69818]],69797:[,,{69818:69803}],69803:[[69797,69818]],69817:[,9],69818:[,7]},
67984352:{69888:[,230],69889:[,230],69890:[,230],69934:[[69937,69927]],69935:[[69938,69927]],69937:[,,{69927:69934}],69938:[,,{69927:69935}],69939:[,9],69940:[,9],70003:[,7],70080:[,9]},
67994608:{70197:[,9],70198:[,7],70377:[,7],70378:[,9]},
68004864:{4957:[,230],4958:[,230],4959:[,230],70460:[,7],70471:[,,{70462:70475,70487:70476}],70475:[[70471,70462]],70476:[[70471,70487]],70477:[,9],70502:[,230],70503:[,230],70504:[,230],70505:[,230],70506:[,230],70507:[,230],70508:[,230],70512:[,230],70513:[,230],70514:[,230],70515:[,230],70516:[,230]},
68015120:{70841:[,,{70832:70844,70842:70843,70845:70846}],70843:[[70841,70842]],70844:[[70841,70832]],70846:[[70841,70845]],70850:[,9],70851:[,7]},
68025376:{71096:[,,{71087:71098}],71097:[,,{71087:71099}],71098:[[71096,71087]],71099:[[71097,71087]],71103:[,9],71104:[,7]},
68035632:{71231:[,9],71350:[,9],71351:[,7]},
68045888:{5908:[,9],5940:[,9],6098:[,9],6109:[,230]},
68056144:{6313:[,228]},
68066400:{6457:[,222],6458:[,230],6459:[,220]},
68076656:{6679:[,230],6680:[,220],6752:[,9],6773:[,230],6774:[,230],6775:[,230],6776:[,230],6777:[,230],6778:[,230],6779:[,230],6780:[,230],6783:[,220],6832:[,230],6833:[,230],6834:[,230],6835:[,230],6836:[,230],6837:[,220],6838:[,220],6839:[,220],6840:[,220],6841:[,220],6842:[,220],6843:[,230],6844:[,230],6845:[,220]},
68086912:{6917:[,,{6965:6918}],6918:[[6917,6965]],6919:[,,{6965:6920}],6920:[[6919,6965]],6921:[,,{6965:6922}],6922:[[6921,6965]],6923:[,,{6965:6924}],6924:[[6923,6965]],6925:[,,{6965:6926}],6926:[[6925,6965]],6929:[,,{6965:6930}],6930:[[6929,6965]],6964:[,7],6970:[,,{6965:6971}],6971:[[6970,6965]],6972:[,,{6965:6973}],6973:[[6972,6965]],6974:[,,{6965:6976}],6975:[,,{6965:6977}],6976:[[6974,6965]],6977:[[6975,6965]],6978:[,,{6965:6979}],6979:[[6978,6965]],6980:[,9],7019:[,230],7020:[,220],7021:[,230],7022:[,230],7023:[,230],7024:[,230],7025:[,230],7026:[,230],7027:[,230],7082:[,9],7083:[,9],7142:[,7],7154:[,9],7155:[,9]},
68097168:{7223:[,7],7376:[,230],7377:[,230],7378:[,230],7380:[,1],7381:[,220],7382:[,220],7383:[,220],7384:[,220],7385:[,220],7386:[,230],7387:[,230],7388:[,220],7389:[,220],7390:[,220],7391:[,220],7392:[,230],7394:[,1],7395:[,1],7396:[,1],7397:[,1],7398:[,1],7399:[,1],7400:[,1],7405:[,220],7412:[,230],7416:[,230],7417:[,230]},
68107424:{7468:[[65],256],7469:[[198],256],7470:[[66],256],7472:[[68],256],7473:[[69],256],7474:[[398],256],7475:[[71],256],7476:[[72],256],7477:[[73],256],7478:[[74],256],7479:[[75],256],7480:[[76],256],7481:[[77],256],7482:[[78],256],7484:[[79],256],7485:[[546],256],7486:[[80],256],7487:[[82],256],7488:[[84],256],7489:[[85],256],7490:[[87],256],7491:[[97],256],7492:[[592],256],7493:[[593],256],7494:[[7426],256],7495:[[98],256],7496:[[100],256],7497:[[101],256],7498:[[601],256],7499:[[603],256],7500:[[604],256],7501:[[103],256],7503:[[107],256],7504:[[109],256],7505:[[331],256],7506:[[111],256],7507:[[596],256],7508:[[7446],256],7509:[[7447],256],7510:[[112],256],7511:[[116],256],7512:[[117],256],7513:[[7453],256],7514:[[623],256],7515:[[118],256],7516:[[7461],256],7517:[[946],256],7518:[[947],256],7519:[[948],256],7520:[[966],256],7521:[[967],256],7522:[[105],256],7523:[[114],256],7524:[[117],256],7525:[[118],256],7526:[[946],256],7527:[[947],256],7528:[[961],256],7529:[[966],256],7530:[[967],256],7544:[[1085],256],7579:[[594],256],7580:[[99],256],7581:[[597],256],7582:[[240],256],7583:[[604],256],7584:[[102],256],7585:[[607],256],7586:[[609],256],7587:[[613],256],7588:[[616],256],7589:[[617],256],7590:[[618],256],7591:[[7547],256],7592:[[669],256],7593:[[621],256],7594:[[7557],256],7595:[[671],256],7596:[[625],256],7597:[[624],256],7598:[[626],256],7599:[[627],256],7600:[[628],256],7601:[[629],256],7602:[[632],256],7603:[[642],256],7604:[[643],256],7605:[[427],256],7606:[[649],256],7607:[[650],256],7608:[[7452],256],7609:[[651],256],7610:[[652],256],7611:[[122],256],7612:[[656],256],7613:[[657],256],7614:[[658],256],7615:[[952],256],7616:[,230],7617:[,230],7618:[,220],7619:[,230],7620:[,230],7621:[,230],7622:[,230],7623:[,230],7624:[,230],7625:[,230],7626:[,220],7627:[,230],7628:[,230],7629:[,234],7630:[,214],7631:[,220],7632:[,202],7633:[,230],7634:[,230],7635:[,230],7636:[,230],7637:[,230],7638:[,230],7639:[,230],7640:[,230],7641:[,230],7642:[,230],7643:[,230],7644:[,230],7645:[,230],7646:[,230],7647:[,230],7648:[,230],7649:[,230],7650:[,230],7651:[,230],7652:[,230],7653:[,230],7654:[,230],7655:[,230],7656:[,230],7657:[,230],7658:[,230],7659:[,230],7660:[,230],7661:[,230],7662:[,230],7663:[,230],7664:[,230],7665:[,230],7666:[,230],7667:[,230],7668:[,230],7669:[,230],7676:[,233],7677:[,220],7678:[,230],7679:[,220]},
68117680:{7680:[[65,805]],7681:[[97,805]],7682:[[66,775]],7683:[[98,775]],7684:[[66,803]],7685:[[98,803]],7686:[[66,817]],7687:[[98,817]],7688:[[199,769]],7689:[[231,769]],7690:[[68,775]],7691:[[100,775]],7692:[[68,803]],7693:[[100,803]],7694:[[68,817]],7695:[[100,817]],7696:[[68,807]],7697:[[100,807]],7698:[[68,813]],7699:[[100,813]],7700:[[274,768]],7701:[[275,768]],7702:[[274,769]],7703:[[275,769]],7704:[[69,813]],7705:[[101,813]],7706:[[69,816]],7707:[[101,816]],7708:[[552,774]],7709:[[553,774]],7710:[[70,775]],7711:[[102,775]],7712:[[71,772]],7713:[[103,772]],7714:[[72,775]],7715:[[104,775]],7716:[[72,803]],7717:[[104,803]],7718:[[72,776]],7719:[[104,776]],7720:[[72,807]],7721:[[104,807]],7722:[[72,814]],7723:[[104,814]],7724:[[73,816]],7725:[[105,816]],7726:[[207,769]],7727:[[239,769]],7728:[[75,769]],7729:[[107,769]],7730:[[75,803]],7731:[[107,803]],7732:[[75,817]],7733:[[107,817]],7734:[[76,803],,{772:7736}],7735:[[108,803],,{772:7737}],7736:[[7734,772]],7737:[[7735,772]],7738:[[76,817]],7739:[[108,817]],7740:[[76,813]],7741:[[108,813]],7742:[[77,769]],7743:[[109,769]],7744:[[77,775]],7745:[[109,775]],7746:[[77,803]],7747:[[109,803]],7748:[[78,775]],7749:[[110,775]],7750:[[78,803]],7751:[[110,803]],7752:[[78,817]],7753:[[110,817]],7754:[[78,813]],7755:[[110,813]],7756:[[213,769]],7757:[[245,769]],7758:[[213,776]],7759:[[245,776]],7760:[[332,768]],7761:[[333,768]],7762:[[332,769]],7763:[[333,769]],7764:[[80,769]],7765:[[112,769]],7766:[[80,775]],7767:[[112,775]],7768:[[82,775]],7769:[[114,775]],7770:[[82,803],,{772:7772}],7771:[[114,803],,{772:7773}],7772:[[7770,772]],7773:[[7771,772]],7774:[[82,817]],7775:[[114,817]],7776:[[83,775]],7777:[[115,775]],7778:[[83,803],,{775:7784}],7779:[[115,803],,{775:7785}],7780:[[346,775]],7781:[[347,775]],7782:[[352,775]],7783:[[353,775]],7784:[[7778,775]],7785:[[7779,775]],7786:[[84,775]],7787:[[116,775]],7788:[[84,803]],7789:[[116,803]],7790:[[84,817]],7791:[[116,817]],7792:[[84,813]],7793:[[116,813]],7794:[[85,804]],7795:[[117,804]],7796:[[85,816]],7797:[[117,816]],7798:[[85,813]],7799:[[117,813]],7800:[[360,769]],7801:[[361,769]],7802:[[362,776]],7803:[[363,776]],7804:[[86,771]],7805:[[118,771]],7806:[[86,803]],7807:[[118,803]],7808:[[87,768]],7809:[[119,768]],7810:[[87,769]],7811:[[119,769]],7812:[[87,776]],7813:[[119,776]],7814:[[87,775]],7815:[[119,775]],7816:[[87,803]],7817:[[119,803]],7818:[[88,775]],7819:[[120,775]],7820:[[88,776]],7821:[[120,776]],7822:[[89,775]],7823:[[121,775]],7824:[[90,770]],7825:[[122,770]],7826:[[90,803]],7827:[[122,803]],7828:[[90,817]],7829:[[122,817]],7830:[[104,817]],7831:[[116,776]],7832:[[119,778]],7833:[[121,778]],7834:[[97,702],256],7835:[[383,775]],7840:[[65,803],,{770:7852,774:7862}],7841:[[97,803],,{770:7853,774:7863}],7842:[[65,777]],7843:[[97,777]],7844:[[194,769]],7845:[[226,769]],7846:[[194,768]],7847:[[226,768]],7848:[[194,777]],7849:[[226,777]],7850:[[194,771]],7851:[[226,771]],7852:[[7840,770]],7853:[[7841,770]],7854:[[258,769]],7855:[[259,769]],7856:[[258,768]],7857:[[259,768]],7858:[[258,777]],7859:[[259,777]],7860:[[258,771]],7861:[[259,771]],7862:[[7840,774]],7863:[[7841,774]],7864:[[69,803],,{770:7878}],7865:[[101,803],,{770:7879}],7866:[[69,777]],7867:[[101,777]],7868:[[69,771]],7869:[[101,771]],7870:[[202,769]],7871:[[234,769]],7872:[[202,768]],7873:[[234,768]],7874:[[202,777]],7875:[[234,777]],7876:[[202,771]],7877:[[234,771]],7878:[[7864,770]],7879:[[7865,770]],7880:[[73,777]],7881:[[105,777]],7882:[[73,803]],7883:[[105,803]],7884:[[79,803],,{770:7896}],7885:[[111,803],,{770:7897}],7886:[[79,777]],7887:[[111,777]],7888:[[212,769]],7889:[[244,769]],7890:[[212,768]],7891:[[244,768]],7892:[[212,777]],7893:[[244,777]],7894:[[212,771]],7895:[[244,771]],7896:[[7884,770]],7897:[[7885,770]],7898:[[416,769]],7899:[[417,769]],7900:[[416,768]],7901:[[417,768]],7902:[[416,777]],7903:[[417,777]],7904:[[416,771]],7905:[[417,771]],7906:[[416,803]],7907:[[417,803]],7908:[[85,803]],7909:[[117,803]],7910:[[85,777]],7911:[[117,777]],7912:[[431,769]],7913:[[432,769]],7914:[[431,768]],7915:[[432,768]],7916:[[431,777]],7917:[[432,777]],7918:[[431,771]],7919:[[432,771]],7920:[[431,803]],7921:[[432,803]],7922:[[89,768]],7923:[[121,768]],7924:[[89,803]],7925:[[121,803]],7926:[[89,777]],7927:[[121,777]],7928:[[89,771]],7929:[[121,771]]},
68127936:{7936:[[945,787],,{768:7938,769:7940,834:7942,837:8064}],7937:[[945,788],,{768:7939,769:7941,834:7943,837:8065}],7938:[[7936,768],,{837:8066}],7939:[[7937,768],,{837:8067}],7940:[[7936,769],,{837:8068}],7941:[[7937,769],,{837:8069}],7942:[[7936,834],,{837:8070}],7943:[[7937,834],,{837:8071}],7944:[[913,787],,{768:7946,769:7948,834:7950,837:8072}],7945:[[913,788],,{768:7947,769:7949,834:7951,837:8073}],7946:[[7944,768],,{837:8074}],7947:[[7945,768],,{837:8075}],7948:[[7944,769],,{837:8076}],7949:[[7945,769],,{837:8077}],7950:[[7944,834],,{837:8078}],7951:[[7945,834],,{837:8079}],7952:[[949,787],,{768:7954,769:7956}],7953:[[949,788],,{768:7955,769:7957}],7954:[[7952,768]],7955:[[7953,768]],7956:[[7952,769]],7957:[[7953,769]],7960:[[917,787],,{768:7962,769:7964}],7961:[[917,788],,{768:7963,769:7965}],7962:[[7960,768]],7963:[[7961,768]],7964:[[7960,769]],7965:[[7961,769]],7968:[[951,787],,{768:7970,769:7972,834:7974,837:8080}],7969:[[951,788],,{768:7971,769:7973,834:7975,837:8081}],7970:[[7968,768],,{837:8082}],7971:[[7969,768],,{837:8083}],7972:[[7968,769],,{837:8084}],7973:[[7969,769],,{837:8085}],7974:[[7968,834],,{837:8086}],7975:[[7969,834],,{837:8087}],7976:[[919,787],,{768:7978,769:7980,834:7982,837:8088}],7977:[[919,788],,{768:7979,769:7981,834:7983,837:8089}],7978:[[7976,768],,{837:8090}],7979:[[7977,768],,{837:8091}],7980:[[7976,769],,{837:8092}],7981:[[7977,769],,{837:8093}],7982:[[7976,834],,{837:8094}],7983:[[7977,834],,{837:8095}],7984:[[953,787],,{768:7986,769:7988,834:7990}],7985:[[953,788],,{768:7987,769:7989,834:7991}],7986:[[7984,768]],7987:[[7985,768]],7988:[[7984,769]],7989:[[7985,769]],7990:[[7984,834]],7991:[[7985,834]],7992:[[921,787],,{768:7994,769:7996,834:7998}],7993:[[921,788],,{768:7995,769:7997,834:7999}],7994:[[7992,768]],7995:[[7993,768]],7996:[[7992,769]],7997:[[7993,769]],7998:[[7992,834]],7999:[[7993,834]],8000:[[959,787],,{768:8002,769:8004}],8001:[[959,788],,{768:8003,769:8005}],8002:[[8000,768]],8003:[[8001,768]],8004:[[8000,769]],8005:[[8001,769]],8008:[[927,787],,{768:8010,769:8012}],8009:[[927,788],,{768:8011,769:8013}],8010:[[8008,768]],8011:[[8009,768]],8012:[[8008,769]],8013:[[8009,769]],8016:[[965,787],,{768:8018,769:8020,834:8022}],8017:[[965,788],,{768:8019,769:8021,834:8023}],8018:[[8016,768]],8019:[[8017,768]],8020:[[8016,769]],8021:[[8017,769]],8022:[[8016,834]],8023:[[8017,834]],8025:[[933,788],,{768:8027,769:8029,834:8031}],8027:[[8025,768]],8029:[[8025,769]],8031:[[8025,834]],8032:[[969,787],,{768:8034,769:8036,834:8038,837:8096}],8033:[[969,788],,{768:8035,769:8037,834:8039,837:8097}],8034:[[8032,768],,{837:8098}],8035:[[8033,768],,{837:8099}],8036:[[8032,769],,{837:8100}],8037:[[8033,769],,{837:8101}],8038:[[8032,834],,{837:8102}],8039:[[8033,834],,{837:8103}],8040:[[937,787],,{768:8042,769:8044,834:8046,837:8104}],8041:[[937,788],,{768:8043,769:8045,834:8047,837:8105}],8042:[[8040,768],,{837:8106}],8043:[[8041,768],,{837:8107}],8044:[[8040,769],,{837:8108}],8045:[[8041,769],,{837:8109}],8046:[[8040,834],,{837:8110}],8047:[[8041,834],,{837:8111}],8048:[[945,768],,{837:8114}],8049:[[940]],8050:[[949,768]],8051:[[941]],8052:[[951,768],,{837:8130}],8053:[[942]],8054:[[953,768]],8055:[[943]],8056:[[959,768]],8057:[[972]],8058:[[965,768]],8059:[[973]],8060:[[969,768],,{837:8178}],8061:[[974]],8064:[[7936,837]],8065:[[7937,837]],8066:[[7938,837]],8067:[[7939,837]],8068:[[7940,837]],8069:[[7941,837]],8070:[[7942,837]],8071:[[7943,837]],8072:[[7944,837]],8073:[[7945,837]],8074:[[7946,837]],8075:[[7947,837]],8076:[[7948,837]],8077:[[7949,837]],8078:[[7950,837]],8079:[[7951,837]],8080:[[7968,837]],8081:[[7969,837]],8082:[[7970,837]],8083:[[7971,837]],8084:[[7972,837]],8085:[[7973,837]],8086:[[7974,837]],8087:[[7975,837]],8088:[[7976,837]],8089:[[7977,837]],8090:[[7978,837]],8091:[[7979,837]],8092:[[7980,837]],8093:[[7981,837]],8094:[[7982,837]],8095:[[7983,837]],8096:[[8032,837]],8097:[[8033,837]],8098:[[8034,837]],8099:[[8035,837]],8100:[[8036,837]],8101:[[8037,837]],8102:[[8038,837]],8103:[[8039,837]],8104:[[8040,837]],8105:[[8041,837]],8106:[[8042,837]],8107:[[8043,837]],8108:[[8044,837]],8109:[[8045,837]],8110:[[8046,837]],8111:[[8047,837]],8112:[[945,774]],8113:[[945,772]],8114:[[8048,837]],8115:[[945,837]],8116:[[940,837]],8118:[[945,834],,{837:8119}],8119:[[8118,837]],8120:[[913,774]],8121:[[913,772]],8122:[[913,768]],8123:[[902]],8124:[[913,837]],8125:[[32,787],256],8126:[[953]],8127:[[32,787],256,{768:8141,769:8142,834:8143}],8128:[[32,834],256],8129:[[168,834]],8130:[[8052,837]],8131:[[951,837]],8132:[[942,837]],8134:[[951,834],,{837:8135}],8135:[[8134,837]],8136:[[917,768]],8137:[[904]],8138:[[919,768]],8139:[[905]],8140:[[919,837]],8141:[[8127,768]],8142:[[8127,769]],8143:[[8127,834]],8144:[[953,774]],8145:[[953,772]],8146:[[970,768]],8147:[[912]],8150:[[953,834]],8151:[[970,834]],8152:[[921,774]],8153:[[921,772]],8154:[[921,768]],8155:[[906]],8157:[[8190,768]],8158:[[8190,769]],8159:[[8190,834]],8160:[[965,774]],8161:[[965,772]],8162:[[971,768]],8163:[[944]],8164:[[961,787]],8165:[[961,788]],8166:[[965,834]],8167:[[971,834]],8168:[[933,774]],8169:[[933,772]],8170:[[933,768]],8171:[[910]],8172:[[929,788]],8173:[[168,768]],8174:[[901]],8175:[[96]],8178:[[8060,837]],8179:[[969,837]],8180:[[974,837]],8182:[[969,834],,{837:8183}],8183:[[8182,837]],8184:[[927,768]],8185:[[908]],8186:[[937,768]],8187:[[911]],8188:[[937,837]],8189:[[180]],8190:[[32,788],256,{768:8157,769:8158,834:8159}]},
68138192:{8192:[[8194]],8193:[[8195]],8194:[[32],256],8195:[[32],256],8196:[[32],256],8197:[[32],256],8198:[[32],256],8199:[[32],256],8200:[[32],256],8201:[[32],256],8202:[[32],256],8209:[[8208],256],8215:[[32,819],256],8228:[[46],256],8229:[[46,46],256],8230:[[46,46,46],256],8239:[[32],256],8243:[[8242,8242],256],8244:[[8242,8242,8242],256],8246:[[8245,8245],256],8247:[[8245,8245,8245],256],8252:[[33,33],256],8254:[[32,773],256],8263:[[63,63],256],8264:[[63,33],256],8265:[[33,63],256],8279:[[8242,8242,8242,8242],256],8287:[[32],256],8304:[[48],256],8305:[[105],256],8308:[[52],256],8309:[[53],256],8310:[[54],256],8311:[[55],256],8312:[[56],256],8313:[[57],256],8314:[[43],256],8315:[[8722],256],8316:[[61],256],8317:[[40],256],8318:[[41],256],8319:[[110],256],8320:[[48],256],8321:[[49],256],8322:[[50],256],8323:[[51],256],8324:[[52],256],8325:[[53],256],8326:[[54],256],8327:[[55],256],8328:[[56],256],8329:[[57],256],8330:[[43],256],8331:[[8722],256],8332:[[61],256],8333:[[40],256],8334:[[41],256],8336:[[97],256],8337:[[101],256],8338:[[111],256],8339:[[120],256],8340:[[601],256],8341:[[104],256],8342:[[107],256],8343:[[108],256],8344:[[109],256],8345:[[110],256],8346:[[112],256],8347:[[115],256],8348:[[116],256],8360:[[82,115],256],8400:[,230],8401:[,230],8402:[,1],8403:[,1],8404:[,230],8405:[,230],8406:[,230],8407:[,230],8408:[,1],8409:[,1],8410:[,1],8411:[,230],8412:[,230],8417:[,230],8421:[,1],8422:[,1],8423:[,230],8424:[,220],8425:[,230],8426:[,1],8427:[,1],8428:[,220],8429:[,220],8430:[,220],8431:[,220],8432:[,230]},
68148448:{8448:[[97,47,99],256],8449:[[97,47,115],256],8450:[[67],256],8451:[[176,67],256],8453:[[99,47,111],256],8454:[[99,47,117],256],8455:[[400],256],8457:[[176,70],256],8458:[[103],256],8459:[[72],256],8460:[[72],256],8461:[[72],256],8462:[[104],256],8463:[[295],256],8464:[[73],256],8465:[[73],256],8466:[[76],256],8467:[[108],256],8469:[[78],256],8470:[[78,111],256],8473:[[80],256],8474:[[81],256],8475:[[82],256],8476:[[82],256],8477:[[82],256],8480:[[83,77],256],8481:[[84,69,76],256],8482:[[84,77],256],8484:[[90],256],8486:[[937]],8488:[[90],256],8490:[[75]],8491:[[197]],8492:[[66],256],8493:[[67],256],8495:[[101],256],8496:[[69],256],8497:[[70],256],8499:[[77],256],8500:[[111],256],8501:[[1488],256],8502:[[1489],256],8503:[[1490],256],8504:[[1491],256],8505:[[105],256],8507:[[70,65,88],256],8508:[[960],256],8509:[[947],256],8510:[[915],256],8511:[[928],256],8512:[[8721],256],8517:[[68],256],8518:[[100],256],8519:[[101],256],8520:[[105],256],8521:[[106],256],8528:[[49,8260,55],256],8529:[[49,8260,57],256],8530:[[49,8260,49,48],256],8531:[[49,8260,51],256],8532:[[50,8260,51],256],8533:[[49,8260,53],256],8534:[[50,8260,53],256],8535:[[51,8260,53],256],8536:[[52,8260,53],256],8537:[[49,8260,54],256],8538:[[53,8260,54],256],8539:[[49,8260,56],256],8540:[[51,8260,56],256],8541:[[53,8260,56],256],8542:[[55,8260,56],256],8543:[[49,8260],256],8544:[[73],256],8545:[[73,73],256],8546:[[73,73,73],256],8547:[[73,86],256],8548:[[86],256],8549:[[86,73],256],8550:[[86,73,73],256],8551:[[86,73,73,73],256],8552:[[73,88],256],8553:[[88],256],8554:[[88,73],256],8555:[[88,73,73],256],8556:[[76],256],8557:[[67],256],8558:[[68],256],8559:[[77],256],8560:[[105],256],8561:[[105,105],256],8562:[[105,105,105],256],8563:[[105,118],256],8564:[[118],256],8565:[[118,105],256],8566:[[118,105,105],256],8567:[[118,105,105,105],256],8568:[[105,120],256],8569:[[120],256],8570:[[120,105],256],8571:[[120,105,105],256],8572:[[108],256],8573:[[99],256],8574:[[100],256],8575:[[109],256],8585:[[48,8260,51],256],8592:[,,{824:8602}],8594:[,,{824:8603}],8596:[,,{824:8622}],8602:[[8592,824]],8603:[[8594,824]],8622:[[8596,824]],8653:[[8656,824]],8654:[[8660,824]],8655:[[8658,824]],8656:[,,{824:8653}],8658:[,,{824:8655}],8660:[,,{824:8654}]},
68158704:{8707:[,,{824:8708}],8708:[[8707,824]],8712:[,,{824:8713}],8713:[[8712,824]],8715:[,,{824:8716}],8716:[[8715,824]],8739:[,,{824:8740}],8740:[[8739,824]],8741:[,,{824:8742}],8742:[[8741,824]],8748:[[8747,8747],256],8749:[[8747,8747,8747],256],8751:[[8750,8750],256],8752:[[8750,8750,8750],256],8764:[,,{824:8769}],8769:[[8764,824]],8771:[,,{824:8772}],8772:[[8771,824]],8773:[,,{824:8775}],8775:[[8773,824]],8776:[,,{824:8777}],8777:[[8776,824]],8781:[,,{824:8813}],8800:[[61,824]],8801:[,,{824:8802}],8802:[[8801,824]],8804:[,,{824:8816}],8805:[,,{824:8817}],8813:[[8781,824]],8814:[[60,824]],8815:[[62,824]],8816:[[8804,824]],8817:[[8805,824]],8818:[,,{824:8820}],8819:[,,{824:8821}],8820:[[8818,824]],8821:[[8819,824]],8822:[,,{824:8824}],8823:[,,{824:8825}],8824:[[8822,824]],8825:[[8823,824]],8826:[,,{824:8832}],8827:[,,{824:8833}],8828:[,,{824:8928}],8829:[,,{824:8929}],8832:[[8826,824]],8833:[[8827,824]],8834:[,,{824:8836}],8835:[,,{824:8837}],8836:[[8834,824]],8837:[[8835,824]],8838:[,,{824:8840}],8839:[,,{824:8841}],8840:[[8838,824]],8841:[[8839,824]],8849:[,,{824:8930}],8850:[,,{824:8931}],8866:[,,{824:8876}],8872:[,,{824:8877}],8873:[,,{824:8878}],8875:[,,{824:8879}],8876:[[8866,824]],8877:[[8872,824]],8878:[[8873,824]],8879:[[8875,824]],8882:[,,{824:8938}],8883:[,,{824:8939}],8884:[,,{824:8940}],8885:[,,{824:8941}],8928:[[8828,824]],8929:[[8829,824]],8930:[[8849,824]],8931:[[8850,824]],8938:[[8882,824]],8939:[[8883,824]],8940:[[8884,824]],8941:[[8885,824]]},
68168960:{9001:[[12296]],9002:[[12297]]},
68179216:{9312:[[49],256],9313:[[50],256],9314:[[51],256],9315:[[52],256],9316:[[53],256],9317:[[54],256],9318:[[55],256],9319:[[56],256],9320:[[57],256],9321:[[49,48],256],9322:[[49,49],256],9323:[[49,50],256],9324:[[49,51],256],9325:[[49,52],256],9326:[[49,53],256],9327:[[49,54],256],9328:[[49,55],256],9329:[[49,56],256],9330:[[49,57],256],9331:[[50,48],256],9332:[[40,49,41],256],9333:[[40,50,41],256],9334:[[40,51,41],256],9335:[[40,52,41],256],9336:[[40,53,41],256],9337:[[40,54,41],256],9338:[[40,55,41],256],9339:[[40,56,41],256],9340:[[40,57,41],256],9341:[[40,49,48,41],256],9342:[[40,49,49,41],256],9343:[[40,49,50,41],256],9344:[[40,49,51,41],256],9345:[[40,49,52,41],256],9346:[[40,49,53,41],256],9347:[[40,49,54,41],256],9348:[[40,49,55,41],256],9349:[[40,49,56,41],256],9350:[[40,49,57,41],256],9351:[[40,50,48,41],256],9352:[[49,46],256],9353:[[50,46],256],9354:[[51,46],256],9355:[[52,46],256],9356:[[53,46],256],9357:[[54,46],256],9358:[[55,46],256],9359:[[56,46],256],9360:[[57,46],256],9361:[[49,48,46],256],9362:[[49,49,46],256],9363:[[49,50,46],256],9364:[[49,51,46],256],9365:[[49,52,46],256],9366:[[49,53,46],256],9367:[[49,54,46],256],9368:[[49,55,46],256],9369:[[49,56,46],256],9370:[[49,57,46],256],9371:[[50,48,46],256],9372:[[40,97,41],256],9373:[[40,98,41],256],9374:[[40,99,41],256],9375:[[40,100,41],256],9376:[[40,101,41],256],9377:[[40,102,41],256],9378:[[40,103,41],256],9379:[[40,104,41],256],9380:[[40,105,41],256],9381:[[40,106,41],256],9382:[[40,107,41],256],9383:[[40,108,41],256],9384:[[40,109,41],256],9385:[[40,110,41],256],9386:[[40,111,41],256],9387:[[40,112,41],256],9388:[[40,113,41],256],9389:[[40,114,41],256],9390:[[40,115,41],256],9391:[[40,116,41],256],9392:[[40,117,41],256],9393:[[40,118,41],256],9394:[[40,119,41],256],9395:[[40,120,41],256],9396:[[40,121,41],256],9397:[[40,122,41],256],9398:[[65],256],9399:[[66],256],9400:[[67],256],9401:[[68],256],9402:[[69],256],9403:[[70],256],9404:[[71],256],9405:[[72],256],9406:[[73],256],9407:[[74],256],9408:[[75],256],9409:[[76],256],9410:[[77],256],9411:[[78],256],9412:[[79],256],9413:[[80],256],9414:[[81],256],9415:[[82],256],9416:[[83],256],9417:[[84],256],9418:[[85],256],9419:[[86],256],9420:[[87],256],9421:[[88],256],9422:[[89],256],9423:[[90],256],9424:[[97],256],9425:[[98],256],9426:[[99],256],9427:[[100],256],9428:[[101],256],9429:[[102],256],9430:[[103],256],9431:[[104],256],9432:[[105],256],9433:[[106],256],9434:[[107],256],9435:[[108],256],9436:[[109],256],9437:[[110],256],9438:[[111],256],9439:[[112],256],9440:[[113],256],9441:[[114],256],9442:[[115],256],9443:[[116],256],9444:[[117],256],9445:[[118],256],9446:[[119],256],9447:[[120],256],9448:[[121],256],9449:[[122],256],9450:[[48],256]},
681810752:{10764:[[8747,8747,8747,8747],256],10868:[[58,58,61],256],10869:[[61,61],256],10870:[[61,61,61],256],10972:[[10973,824],512]},
681911264:{11388:[[106],256],11389:[[86],256],11503:[,230],11504:[,230],11505:[,230]},
682011520:{11631:[[11617],256],11647:[,9],11744:[,230],11745:[,230],11746:[,230],11747:[,230],11748:[,230],11749:[,230],11750:[,230],11751:[,230],11752:[,230],11753:[,230],11754:[,230],11755:[,230],11756:[,230],11757:[,230],11758:[,230],11759:[,230],11760:[,230],11761:[,230],11762:[,230],11763:[,230],11764:[,230],11765:[,230],11766:[,230],11767:[,230],11768:[,230],11769:[,230],11770:[,230],11771:[,230],11772:[,230],11773:[,230],11774:[,230],11775:[,230]},
682111776:{11935:[[27597],256],12019:[[40863],256]},
682212032:{12032:[[19968],256],12033:[[20008],256],12034:[[20022],256],12035:[[20031],256],12036:[[20057],256],12037:[[20101],256],12038:[[20108],256],12039:[[20128],256],12040:[[20154],256],12041:[[20799],256],12042:[[20837],256],12043:[[20843],256],12044:[[20866],256],12045:[[20886],256],12046:[[20907],256],12047:[[20960],256],12048:[[20981],256],12049:[[20992],256],12050:[[21147],256],12051:[[21241],256],12052:[[21269],256],12053:[[21274],256],12054:[[21304],256],12055:[[21313],256],12056:[[21340],256],12057:[[21353],256],12058:[[21378],256],12059:[[21430],256],12060:[[21448],256],12061:[[21475],256],12062:[[22231],256],12063:[[22303],256],12064:[[22763],256],12065:[[22786],256],12066:[[22794],256],12067:[[22805],256],12068:[[22823],256],12069:[[22899],256],12070:[[23376],256],12071:[[23424],256],12072:[[23544],256],12073:[[23567],256],12074:[[23586],256],12075:[[23608],256],12076:[[23662],256],12077:[[23665],256],12078:[[24027],256],12079:[[24037],256],12080:[[24049],256],12081:[[24062],256],12082:[[24178],256],12083:[[24186],256],12084:[[24191],256],12085:[[24308],256],12086:[[24318],256],12087:[[24331],256],12088:[[24339],256],12089:[[24400],256],12090:[[24417],256],12091:[[24435],256],12092:[[24515],256],12093:[[25096],256],12094:[[25142],256],12095:[[25163],256],12096:[[25903],256],12097:[[25908],256],12098:[[25991],256],12099:[[26007],256],12100:[[26020],256],12101:[[26041],256],12102:[[26080],256],12103:[[26085],256],12104:[[26352],256],12105:[[26376],256],12106:[[26408],256],12107:[[27424],256],12108:[[27490],256],12109:[[27513],256],12110:[[27571],256],12111:[[27595],256],12112:[[27604],256],12113:[[27611],256],12114:[[27663],256],12115:[[27668],256],12116:[[27700],256],12117:[[28779],256],12118:[[29226],256],12119:[[29238],256],12120:[[29243],256],12121:[[29247],256],12122:[[29255],256],12123:[[29273],256],12124:[[29275],256],12125:[[29356],256],12126:[[29572],256],12127:[[29577],256],12128:[[29916],256],12129:[[29926],256],12130:[[29976],256],12131:[[29983],256],12132:[[29992],256],12133:[[30000],256],12134:[[30091],256],12135:[[30098],256],12136:[[30326],256],12137:[[30333],256],12138:[[30382],256],12139:[[30399],256],12140:[[30446],256],12141:[[30683],256],12142:[[30690],256],12143:[[30707],256],12144:[[31034],256],12145:[[31160],256],12146:[[31166],256],12147:[[31348],256],12148:[[31435],256],12149:[[31481],256],12150:[[31859],256],12151:[[31992],256],12152:[[32566],256],12153:[[32593],256],12154:[[32650],256],12155:[[32701],256],12156:[[32769],256],12157:[[32780],256],12158:[[32786],256],12159:[[32819],256],12160:[[32895],256],12161:[[32905],256],12162:[[33251],256],12163:[[33258],256],12164:[[33267],256],12165:[[33276],256],12166:[[33292],256],12167:[[33307],256],12168:[[33311],256],12169:[[33390],256],12170:[[33394],256],12171:[[33400],256],12172:[[34381],256],12173:[[34411],256],12174:[[34880],256],12175:[[34892],256],12176:[[34915],256],12177:[[35198],256],12178:[[35211],256],12179:[[35282],256],12180:[[35328],256],12181:[[35895],256],12182:[[35910],256],12183:[[35925],256],12184:[[35960],256],12185:[[35997],256],12186:[[36196],256],12187:[[36208],256],12188:[[36275],256],12189:[[36523],256],12190:[[36554],256],12191:[[36763],256],12192:[[36784],256],12193:[[36789],256],12194:[[37009],256],12195:[[37193],256],12196:[[37318],256],12197:[[37324],256],12198:[[37329],256],12199:[[38263],256],12200:[[38272],256],12201:[[38428],256],12202:[[38582],256],12203:[[38585],256],12204:[[38632],256],12205:[[38737],256],12206:[[38750],256],12207:[[38754],256],12208:[[38761],256],12209:[[38859],256],12210:[[38893],256],12211:[[38899],256],12212:[[38913],256],12213:[[39080],256],12214:[[39131],256],12215:[[39135],256],12216:[[39318],256],12217:[[39321],256],12218:[[39340],256],12219:[[39592],256],12220:[[39640],256],12221:[[39647],256],12222:[[39717],256],12223:[[39727],256],12224:[[39730],256],12225:[[39740],256],12226:[[39770],256],12227:[[40165],256],12228:[[40565],256],12229:[[40575],256],12230:[[40613],256],12231:[[40635],256],12232:[[40643],256],12233:[[40653],256],12234:[[40657],256],12235:[[40697],256],12236:[[40701],256],12237:[[40718],256],12238:[[40723],256],12239:[[40736],256],12240:[[40763],256],12241:[[40778],256],12242:[[40786],256],12243:[[40845],256],12244:[[40860],256],12245:[[40864],256]},
682312288:{12288:[[32],256],12330:[,218],12331:[,228],12332:[,232],12333:[,222],12334:[,224],12335:[,224],12342:[[12306],256],12344:[[21313],256],12345:[[21316],256],12346:[[21317],256],12358:[,,{12441:12436}],12363:[,,{12441:12364}],12364:[[12363,12441]],12365:[,,{12441:12366}],12366:[[12365,12441]],12367:[,,{12441:12368}],12368:[[12367,12441]],12369:[,,{12441:12370}],12370:[[12369,12441]],12371:[,,{12441:12372}],12372:[[12371,12441]],12373:[,,{12441:12374}],12374:[[12373,12441]],12375:[,,{12441:12376}],12376:[[12375,12441]],12377:[,,{12441:12378}],12378:[[12377,12441]],12379:[,,{12441:12380}],12380:[[12379,12441]],12381:[,,{12441:12382}],12382:[[12381,12441]],12383:[,,{12441:12384}],12384:[[12383,12441]],12385:[,,{12441:12386}],12386:[[12385,12441]],12388:[,,{12441:12389}],12389:[[12388,12441]],12390:[,,{12441:12391}],12391:[[12390,12441]],12392:[,,{12441:12393}],12393:[[12392,12441]],12399:[,,{12441:12400,12442:12401}],12400:[[12399,12441]],12401:[[12399,12442]],12402:[,,{12441:12403,12442:12404}],12403:[[12402,12441]],12404:[[12402,12442]],12405:[,,{12441:12406,12442:12407}],12406:[[12405,12441]],12407:[[12405,12442]],12408:[,,{12441:12409,12442:12410}],12409:[[12408,12441]],12410:[[12408,12442]],12411:[,,{12441:12412,12442:12413}],12412:[[12411,12441]],12413:[[12411,12442]],12436:[[12358,12441]],12441:[,8],12442:[,8],12443:[[32,12441],256],12444:[[32,12442],256],12445:[,,{12441:12446}],12446:[[12445,12441]],12447:[[12424,12426],256],12454:[,,{12441:12532}],12459:[,,{12441:12460}],12460:[[12459,12441]],12461:[,,{12441:12462}],12462:[[12461,12441]],12463:[,,{12441:12464}],12464:[[12463,12441]],12465:[,,{12441:12466}],12466:[[12465,12441]],12467:[,,{12441:12468}],12468:[[12467,12441]],12469:[,,{12441:12470}],12470:[[12469,12441]],12471:[,,{12441:12472}],12472:[[12471,12441]],12473:[,,{12441:12474}],12474:[[12473,12441]],12475:[,,{12441:12476}],12476:[[12475,12441]],12477:[,,{12441:12478}],12478:[[12477,12441]],12479:[,,{12441:12480}],12480:[[12479,12441]],12481:[,,{12441:12482}],12482:[[12481,12441]],12484:[,,{12441:12485}],12485:[[12484,12441]],12486:[,,{12441:12487}],12487:[[12486,12441]],12488:[,,{12441:12489}],12489:[[12488,12441]],12495:[,,{12441:12496,12442:12497}],12496:[[12495,12441]],12497:[[12495,12442]],12498:[,,{12441:12499,12442:12500}],12499:[[12498,12441]],12500:[[12498,12442]],12501:[,,{12441:12502,12442:12503}],12502:[[12501,12441]],12503:[[12501,12442]],12504:[,,{12441:12505,12442:12506}],12505:[[12504,12441]],12506:[[12504,12442]],12507:[,,{12441:12508,12442:12509}],12508:[[12507,12441]],12509:[[12507,12442]],12527:[,,{12441:12535}],12528:[,,{12441:12536}],12529:[,,{12441:12537}],12530:[,,{12441:12538}],12532:[[12454,12441]],12535:[[12527,12441]],12536:[[12528,12441]],12537:[[12529,12441]],12538:[[12530,12441]],12541:[,,{12441:12542}],12542:[[12541,12441]],12543:[[12467,12488],256]},
682412544:{12593:[[4352],256],12594:[[4353],256],12595:[[4522],256],12596:[[4354],256],12597:[[4524],256],12598:[[4525],256],12599:[[4355],256],12600:[[4356],256],12601:[[4357],256],12602:[[4528],256],12603:[[4529],256],12604:[[4530],256],12605:[[4531],256],12606:[[4532],256],12607:[[4533],256],12608:[[4378],256],12609:[[4358],256],12610:[[4359],256],12611:[[4360],256],12612:[[4385],256],12613:[[4361],256],12614:[[4362],256],12615:[[4363],256],12616:[[4364],256],12617:[[4365],256],12618:[[4366],256],12619:[[4367],256],12620:[[4368],256],12621:[[4369],256],12622:[[4370],256],12623:[[4449],256],12624:[[4450],256],12625:[[4451],256],12626:[[4452],256],12627:[[4453],256],12628:[[4454],256],12629:[[4455],256],12630:[[4456],256],12631:[[4457],256],12632:[[4458],256],12633:[[4459],256],12634:[[4460],256],12635:[[4461],256],12636:[[4462],256],12637:[[4463],256],12638:[[4464],256],12639:[[4465],256],12640:[[4466],256],12641:[[4467],256],12642:[[4468],256],12643:[[4469],256],12644:[[4448],256],12645:[[4372],256],12646:[[4373],256],12647:[[4551],256],12648:[[4552],256],12649:[[4556],256],12650:[[4558],256],12651:[[4563],256],12652:[[4567],256],12653:[[4569],256],12654:[[4380],256],12655:[[4573],256],12656:[[4575],256],12657:[[4381],256],12658:[[4382],256],12659:[[4384],256],12660:[[4386],256],12661:[[4387],256],12662:[[4391],256],12663:[[4393],256],12664:[[4395],256],12665:[[4396],256],12666:[[4397],256],12667:[[4398],256],12668:[[4399],256],12669:[[4402],256],12670:[[4406],256],12671:[[4416],256],12672:[[4423],256],12673:[[4428],256],12674:[[4593],256],12675:[[4594],256],12676:[[4439],256],12677:[[4440],256],12678:[[4441],256],12679:[[4484],256],12680:[[4485],256],12681:[[4488],256],12682:[[4497],256],12683:[[4498],256],12684:[[4500],256],12685:[[4510],256],12686:[[4513],256],12690:[[19968],256],12691:[[20108],256],12692:[[19977],256],12693:[[22235],256],12694:[[19978],256],12695:[[20013],256],12696:[[19979],256],12697:[[30002],256],12698:[[20057],256],12699:[[19993],256],12700:[[19969],256],12701:[[22825],256],12702:[[22320],256],12703:[[20154],256]},
682512800:{12800:[[40,4352,41],256],12801:[[40,4354,41],256],12802:[[40,4355,41],256],12803:[[40,4357,41],256],12804:[[40,4358,41],256],12805:[[40,4359,41],256],12806:[[40,4361,41],256],12807:[[40,4363,41],256],12808:[[40,4364,41],256],12809:[[40,4366,41],256],12810:[[40,4367,41],256],12811:[[40,4368,41],256],12812:[[40,4369,41],256],12813:[[40,4370,41],256],12814:[[40,4352,4449,41],256],12815:[[40,4354,4449,41],256],12816:[[40,4355,4449,41],256],12817:[[40,4357,4449,41],256],12818:[[40,4358,4449,41],256],12819:[[40,4359,4449,41],256],12820:[[40,4361,4449,41],256],12821:[[40,4363,4449,41],256],12822:[[40,4364,4449,41],256],12823:[[40,4366,4449,41],256],12824:[[40,4367,4449,41],256],12825:[[40,4368,4449,41],256],12826:[[40,4369,4449,41],256],12827:[[40,4370,4449,41],256],12828:[[40,4364,4462,41],256],12829:[[40,4363,4457,4364,4453,4523,41],256],12830:[[40,4363,4457,4370,4462,41],256],12832:[[40,19968,41],256],12833:[[40,20108,41],256],12834:[[40,19977,41],256],12835:[[40,22235,41],256],12836:[[40,20116,41],256],12837:[[40,20845,41],256],12838:[[40,19971,41],256],12839:[[40,20843,41],256],12840:[[40,20061,41],256],12841:[[40,21313,41],256],12842:[[40,26376,41],256],12843:[[40,28779,41],256],12844:[[40,27700,41],256],12845:[[40,26408,41],256],12846:[[40,37329,41],256],12847:[[40,22303,41],256],12848:[[40,26085,41],256],12849:[[40,26666,41],256],12850:[[40,26377,41],256],12851:[[40,31038,41],256],12852:[[40,21517,41],256],12853:[[40,29305,41],256],12854:[[40,36001,41],256],12855:[[40,31069,41],256],12856:[[40,21172,41],256],12857:[[40,20195,41],256],12858:[[40,21628,41],256],12859:[[40,23398,41],256],12860:[[40,30435,41],256],12861:[[40,20225,41],256],12862:[[40,36039,41],256],12863:[[40,21332,41],256],12864:[[40,31085,41],256],12865:[[40,20241,41],256],12866:[[40,33258,41],256],12867:[[40,33267,41],256],12868:[[21839],256],12869:[[24188],256],12870:[[25991],256],12871:[[31631],256],12880:[[80,84,69],256],12881:[[50,49],256],12882:[[50,50],256],12883:[[50,51],256],12884:[[50,52],256],12885:[[50,53],256],12886:[[50,54],256],12887:[[50,55],256],12888:[[50,56],256],12889:[[50,57],256],12890:[[51,48],256],12891:[[51,49],256],12892:[[51,50],256],12893:[[51,51],256],12894:[[51,52],256],12895:[[51,53],256],12896:[[4352],256],12897:[[4354],256],12898:[[4355],256],12899:[[4357],256],12900:[[4358],256],12901:[[4359],256],12902:[[4361],256],12903:[[4363],256],12904:[[4364],256],12905:[[4366],256],12906:[[4367],256],12907:[[4368],256],12908:[[4369],256],12909:[[4370],256],12910:[[4352,4449],256],12911:[[4354,4449],256],12912:[[4355,4449],256],12913:[[4357,4449],256],12914:[[4358,4449],256],12915:[[4359,4449],256],12916:[[4361,4449],256],12917:[[4363,4449],256],12918:[[4364,4449],256],12919:[[4366,4449],256],12920:[[4367,4449],256],12921:[[4368,4449],256],12922:[[4369,4449],256],12923:[[4370,4449],256],12924:[[4366,4449,4535,4352,4457],256],12925:[[4364,4462,4363,4468],256],12926:[[4363,4462],256],12928:[[19968],256],12929:[[20108],256],12930:[[19977],256],12931:[[22235],256],12932:[[20116],256],12933:[[20845],256],12934:[[19971],256],12935:[[20843],256],12936:[[20061],256],12937:[[21313],256],12938:[[26376],256],12939:[[28779],256],12940:[[27700],256],12941:[[26408],256],12942:[[37329],256],12943:[[22303],256],12944:[[26085],256],12945:[[26666],256],12946:[[26377],256],12947:[[31038],256],12948:[[21517],256],12949:[[29305],256],12950:[[36001],256],12951:[[31069],256],12952:[[21172],256],12953:[[31192],256],12954:[[30007],256],12955:[[22899],256],12956:[[36969],256],12957:[[20778],256],12958:[[21360],256],12959:[[27880],256],12960:[[38917],256],12961:[[20241],256],12962:[[20889],256],12963:[[27491],256],12964:[[19978],256],12965:[[20013],256],12966:[[19979],256],12967:[[24038],256],12968:[[21491],256],12969:[[21307],256],12970:[[23447],256],12971:[[23398],256],12972:[[30435],256],12973:[[20225],256],12974:[[36039],256],12975:[[21332],256],12976:[[22812],256],12977:[[51,54],256],12978:[[51,55],256],12979:[[51,56],256],12980:[[51,57],256],12981:[[52,48],256],12982:[[52,49],256],12983:[[52,50],256],12984:[[52,51],256],12985:[[52,52],256],12986:[[52,53],256],12987:[[52,54],256],12988:[[52,55],256],12989:[[52,56],256],12990:[[52,57],256],12991:[[53,48],256],12992:[[49,26376],256],12993:[[50,26376],256],12994:[[51,26376],256],12995:[[52,26376],256],12996:[[53,26376],256],12997:[[54,26376],256],12998:[[55,26376],256],12999:[[56,26376],256],13000:[[57,26376],256],13001:[[49,48,26376],256],13002:[[49,49,26376],256],13003:[[49,50,26376],256],13004:[[72,103],256],13005:[[101,114,103],256],13006:[[101,86],256],13007:[[76,84,68],256],13008:[[12450],256],13009:[[12452],256],13010:[[12454],256],13011:[[12456],256],13012:[[12458],256],13013:[[12459],256],13014:[[12461],256],13015:[[12463],256],13016:[[12465],256],13017:[[12467],256],13018:[[12469],256],13019:[[12471],256],13020:[[12473],256],13021:[[12475],256],13022:[[12477],256],13023:[[12479],256],13024:[[12481],256],13025:[[12484],256],13026:[[12486],256],13027:[[12488],256],13028:[[12490],256],13029:[[12491],256],13030:[[12492],256],13031:[[12493],256],13032:[[12494],256],13033:[[12495],256],13034:[[12498],256],13035:[[12501],256],13036:[[12504],256],13037:[[12507],256],13038:[[12510],256],13039:[[12511],256],13040:[[12512],256],13041:[[12513],256],13042:[[12514],256],13043:[[12516],256],13044:[[12518],256],13045:[[12520],256],13046:[[12521],256],13047:[[12522],256],13048:[[12523],256],13049:[[12524],256],13050:[[12525],256],13051:[[12527],256],13052:[[12528],256],13053:[[12529],256],13054:[[12530],256]},
682613056:{13056:[[12450,12497,12540,12488],256],13057:[[12450,12523,12501,12449],256],13058:[[12450,12531,12506,12450],256],13059:[[12450,12540,12523],256],13060:[[12452,12491,12531,12464],256],13061:[[12452,12531,12481],256],13062:[[12454,12457,12531],256],13063:[[12456,12473,12463,12540,12489],256],13064:[[12456,12540,12459,12540],256],13065:[[12458,12531,12473],256],13066:[[12458,12540,12512],256],13067:[[12459,12452,12522],256],13068:[[12459,12521,12483,12488],256],13069:[[12459,12525,12522,12540],256],13070:[[12460,12525,12531],256],13071:[[12460,12531,12510],256],13072:[[12462,12460],256],13073:[[12462,12491,12540],256],13074:[[12461,12517,12522,12540],256],13075:[[12462,12523,12480,12540],256],13076:[[12461,12525],256],13077:[[12461,12525,12464,12521,12512],256],13078:[[12461,12525,12513,12540,12488,12523],256],13079:[[12461,12525,12527,12483,12488],256],13080:[[12464,12521,12512],256],13081:[[12464,12521,12512,12488,12531],256],13082:[[12463,12523,12476,12452,12525],256],13083:[[12463,12525,12540,12493],256],13084:[[12465,12540,12473],256],13085:[[12467,12523,12490],256],13086:[[12467,12540,12509],256],13087:[[12469,12452,12463,12523],256],13088:[[12469,12531,12481,12540,12512],256],13089:[[12471,12522,12531,12464],256],13090:[[12475,12531,12481],256],13091:[[12475,12531,12488],256],13092:[[12480,12540,12473],256],13093:[[12487,12471],256],13094:[[12489,12523],256],13095:[[12488,12531],256],13096:[[12490,12494],256],13097:[[12494,12483,12488],256],13098:[[12495,12452,12484],256],13099:[[12497,12540,12475,12531,12488],256],13100:[[12497,12540,12484],256],13101:[[12496,12540,12524,12523],256],13102:[[12500,12450,12473,12488,12523],256],13103:[[12500,12463,12523],256],13104:[[12500,12467],256],13105:[[12499,12523],256],13106:[[12501,12449,12521,12483,12489],256],13107:[[12501,12451,12540,12488],256],13108:[[12502,12483,12471,12455,12523],256],13109:[[12501,12521,12531],256],13110:[[12504,12463,12479,12540,12523],256],13111:[[12506,12477],256],13112:[[12506,12491,12498],256],13113:[[12504,12523,12484],256],13114:[[12506,12531,12473],256],13115:[[12506,12540,12472],256],13116:[[12505,12540,12479],256],13117:[[12509,12452,12531,12488],256],13118:[[12508,12523,12488],256],13119:[[12507,12531],256],13120:[[12509,12531,12489],256],13121:[[12507,12540,12523],256],13122:[[12507,12540,12531],256],13123:[[12510,12452,12463,12525],256],13124:[[12510,12452,12523],256],13125:[[12510,12483,12495],256],13126:[[12510,12523,12463],256],13127:[[12510,12531,12471,12519,12531],256],13128:[[12511,12463,12525,12531],256],13129:[[12511,12522],256],13130:[[12511,12522,12496,12540,12523],256],13131:[[12513,12460],256],13132:[[12513,12460,12488,12531],256],13133:[[12513,12540,12488,12523],256],13134:[[12516,12540,12489],256],13135:[[12516,12540,12523],256],13136:[[12518,12450,12531],256],13137:[[12522,12483,12488,12523],256],13138:[[12522,12521],256],13139:[[12523,12500,12540],256],13140:[[12523,12540,12502,12523],256],13141:[[12524,12512],256],13142:[[12524,12531,12488,12466,12531],256],13143:[[12527,12483,12488],256],13144:[[48,28857],256],13145:[[49,28857],256],13146:[[50,28857],256],13147:[[51,28857],256],13148:[[52,28857],256],13149:[[53,28857],256],13150:[[54,28857],256],13151:[[55,28857],256],13152:[[56,28857],256],13153:[[57,28857],256],13154:[[49,48,28857],256],13155:[[49,49,28857],256],13156:[[49,50,28857],256],13157:[[49,51,28857],256],13158:[[49,52,28857],256],13159:[[49,53,28857],256],13160:[[49,54,28857],256],13161:[[49,55,28857],256],13162:[[49,56,28857],256],13163:[[49,57,28857],256],13164:[[50,48,28857],256],13165:[[50,49,28857],256],13166:[[50,50,28857],256],13167:[[50,51,28857],256],13168:[[50,52,28857],256],13169:[[104,80,97],256],13170:[[100,97],256],13171:[[65,85],256],13172:[[98,97,114],256],13173:[[111,86],256],13174:[[112,99],256],13175:[[100,109],256],13176:[[100,109,178],256],13177:[[100,109,179],256],13178:[[73,85],256],13179:[[24179,25104],256],13180:[[26157,21644],256],13181:[[22823,27491],256],13182:[[26126,27835],256],13183:[[26666,24335,20250,31038],256],13184:[[112,65],256],13185:[[110,65],256],13186:[[956,65],256],13187:[[109,65],256],13188:[[107,65],256],13189:[[75,66],256],13190:[[77,66],256],13191:[[71,66],256],13192:[[99,97,108],256],13193:[[107,99,97,108],256],13194:[[112,70],256],13195:[[110,70],256],13196:[[956,70],256],13197:[[956,103],256],13198:[[109,103],256],13199:[[107,103],256],13200:[[72,122],256],13201:[[107,72,122],256],13202:[[77,72,122],256],13203:[[71,72,122],256],13204:[[84,72,122],256],13205:[[956,8467],256],13206:[[109,8467],256],13207:[[100,8467],256],13208:[[107,8467],256],13209:[[102,109],256],13210:[[110,109],256],13211:[[956,109],256],13212:[[109,109],256],13213:[[99,109],256],13214:[[107,109],256],13215:[[109,109,178],256],13216:[[99,109,178],256],13217:[[109,178],256],13218:[[107,109,178],256],13219:[[109,109,179],256],13220:[[99,109,179],256],13221:[[109,179],256],13222:[[107,109,179],256],13223:[[109,8725,115],256],13224:[[109,8725,115,178],256],13225:[[80,97],256],13226:[[107,80,97],256],13227:[[77,80,97],256],13228:[[71,80,97],256],13229:[[114,97,100],256],13230:[[114,97,100,8725,115],256],13231:[[114,97,100,8725,115,178],256],13232:[[112,115],256],13233:[[110,115],256],13234:[[956,115],256],13235:[[109,115],256],13236:[[112,86],256],13237:[[110,86],256],13238:[[956,86],256],13239:[[109,86],256],13240:[[107,86],256],13241:[[77,86],256],13242:[[112,87],256],13243:[[110,87],256],13244:[[956,87],256],13245:[[109,87],256],13246:[[107,87],256],13247:[[77,87],256],13248:[[107,937],256],13249:[[77,937],256],13250:[[97,46,109,46],256],13251:[[66,113],256],13252:[[99,99],256],13253:[[99,100],256],13254:[[67,8725,107,103],256],13255:[[67,111,46],256],13256:[[100,66],256],13257:[[71,121],256],13258:[[104,97],256],13259:[[72,80],256],13260:[[105,110],256],13261:[[75,75],256],13262:[[75,77],256],13263:[[107,116],256],13264:[[108,109],256],13265:[[108,110],256],13266:[[108,111,103],256],13267:[[108,120],256],13268:[[109,98],256],13269:[[109,105,108],256],13270:[[109,111,108],256],13271:[[80,72],256],13272:[[112,46,109,46],256],13273:[[80,80,77],256],13274:[[80,82],256],13275:[[115,114],256],13276:[[83,118],256],13277:[[87,98],256],13278:[[86,8725,109],256],13279:[[65,8725,109],256],13280:[[49,26085],256],13281:[[50,26085],256],13282:[[51,26085],256],13283:[[52,26085],256],13284:[[53,26085],256],13285:[[54,26085],256],13286:[[55,26085],256],13287:[[56,26085],256],13288:[[57,26085],256],13289:[[49,48,26085],256],13290:[[49,49,26085],256],13291:[[49,50,26085],256],13292:[[49,51,26085],256],13293:[[49,52,26085],256],13294:[[49,53,26085],256],13295:[[49,54,26085],256],13296:[[49,55,26085],256],13297:[[49,56,26085],256],13298:[[49,57,26085],256],13299:[[50,48,26085],256],13300:[[50,49,26085],256],13301:[[50,50,26085],256],13302:[[50,51,26085],256],13303:[[50,52,26085],256],13304:[[50,53,26085],256],13305:[[50,54,26085],256],13306:[[50,55,26085],256],13307:[[50,56,26085],256],13308:[[50,57,26085],256],13309:[[51,48,26085],256],13310:[[51,49,26085],256],13311:[[103,97,108],256]},
682727136:{92912:[,1],92913:[,1],92914:[,1],92915:[,1],92916:[,1]},
682827392:{92976:[,230],92977:[,230],92978:[,230],92979:[,230],92980:[,230],92981:[,230],92982:[,230]},
682942496:{42607:[,230],42612:[,230],42613:[,230],42614:[,230],42615:[,230],42616:[,230],42617:[,230],42618:[,230],42619:[,230],42620:[,230],42621:[,230],42652:[[1098],256],42653:[[1100],256],42655:[,230],42736:[,230],42737:[,230]},
683042752:{42864:[[42863],256],43000:[[294],256],43001:[[339],256]},
683143008:{43014:[,9],43204:[,9],43232:[,230],43233:[,230],43234:[,230],43235:[,230],43236:[,230],43237:[,230],43238:[,230],43239:[,230],43240:[,230],43241:[,230],43242:[,230],43243:[,230],43244:[,230],43245:[,230],43246:[,230],43247:[,230],43248:[,230],43249:[,230]},
683243264:{43307:[,220],43308:[,220],43309:[,220],43347:[,9],43443:[,7],43456:[,9]},
683343520:{43696:[,230],43698:[,230],43699:[,230],43700:[,220],43703:[,230],43704:[,230],43710:[,230],43711:[,230],43713:[,230],43766:[,9]},
683443776:{43868:[[42791],256],43869:[[43831],256],43870:[[619],256],43871:[[43858],256],44013:[,9]},
683548128:{113822:[,1]},
683653504:{119134:[[119127,119141],512],119135:[[119128,119141],512],119136:[[119135,119150],512],119137:[[119135,119151],512],119138:[[119135,119152],512],119139:[[119135,119153],512],119140:[[119135,119154],512],119141:[,216],119142:[,216],119143:[,1],119144:[,1],119145:[,1],119149:[,226],119150:[,216],119151:[,216],119152:[,216],119153:[,216],119154:[,216],119163:[,220],119164:[,220],119165:[,220],119166:[,220],119167:[,220],119168:[,220],119169:[,220],119170:[,220],119173:[,230],119174:[,230],119175:[,230],119176:[,230],119177:[,230],119178:[,220],119179:[,220],119210:[,230],119211:[,230],119212:[,230],119213:[,230],119227:[[119225,119141],512],119228:[[119226,119141],512],119229:[[119227,119150],512],119230:[[119228,119150],512],119231:[[119227,119151],512],119232:[[119228,119151],512]},
683753760:{119362:[,230],119363:[,230],119364:[,230]},
683854272:{119808:[[65],256],119809:[[66],256],119810:[[67],256],119811:[[68],256],119812:[[69],256],119813:[[70],256],119814:[[71],256],119815:[[72],256],119816:[[73],256],119817:[[74],256],119818:[[75],256],119819:[[76],256],119820:[[77],256],119821:[[78],256],119822:[[79],256],119823:[[80],256],119824:[[81],256],119825:[[82],256],119826:[[83],256],119827:[[84],256],119828:[[85],256],119829:[[86],256],119830:[[87],256],119831:[[88],256],119832:[[89],256],119833:[[90],256],119834:[[97],256],119835:[[98],256],119836:[[99],256],119837:[[100],256],119838:[[101],256],119839:[[102],256],119840:[[103],256],119841:[[104],256],119842:[[105],256],119843:[[106],256],119844:[[107],256],119845:[[108],256],119846:[[109],256],119847:[[110],256],119848:[[111],256],119849:[[112],256],119850:[[113],256],119851:[[114],256],119852:[[115],256],119853:[[116],256],119854:[[117],256],119855:[[118],256],119856:[[119],256],119857:[[120],256],119858:[[121],256],119859:[[122],256],119860:[[65],256],119861:[[66],256],119862:[[67],256],119863:[[68],256],119864:[[69],256],119865:[[70],256],119866:[[71],256],119867:[[72],256],119868:[[73],256],119869:[[74],256],119870:[[75],256],119871:[[76],256],119872:[[77],256],119873:[[78],256],119874:[[79],256],119875:[[80],256],119876:[[81],256],119877:[[82],256],119878:[[83],256],119879:[[84],256],119880:[[85],256],119881:[[86],256],119882:[[87],256],119883:[[88],256],119884:[[89],256],119885:[[90],256],119886:[[97],256],119887:[[98],256],119888:[[99],256],119889:[[100],256],119890:[[101],256],119891:[[102],256],119892:[[103],256],119894:[[105],256],119895:[[106],256],119896:[[107],256],119897:[[108],256],119898:[[109],256],119899:[[110],256],119900:[[111],256],119901:[[112],256],119902:[[113],256],119903:[[114],256],119904:[[115],256],119905:[[116],256],119906:[[117],256],119907:[[118],256],119908:[[119],256],119909:[[120],256],119910:[[121],256],119911:[[122],256],119912:[[65],256],119913:[[66],256],119914:[[67],256],119915:[[68],256],119916:[[69],256],119917:[[70],256],119918:[[71],256],119919:[[72],256],119920:[[73],256],119921:[[74],256],119922:[[75],256],119923:[[76],256],119924:[[77],256],119925:[[78],256],119926:[[79],256],119927:[[80],256],119928:[[81],256],119929:[[82],256],119930:[[83],256],119931:[[84],256],119932:[[85],256],119933:[[86],256],119934:[[87],256],119935:[[88],256],119936:[[89],256],119937:[[90],256],119938:[[97],256],119939:[[98],256],119940:[[99],256],119941:[[100],256],119942:[[101],256],119943:[[102],256],119944:[[103],256],119945:[[104],256],119946:[[105],256],119947:[[106],256],119948:[[107],256],119949:[[108],256],119950:[[109],256],119951:[[110],256],119952:[[111],256],119953:[[112],256],119954:[[113],256],119955:[[114],256],119956:[[115],256],119957:[[116],256],119958:[[117],256],119959:[[118],256],119960:[[119],256],119961:[[120],256],119962:[[121],256],119963:[[122],256],119964:[[65],256],119966:[[67],256],119967:[[68],256],119970:[[71],256],119973:[[74],256],119974:[[75],256],119977:[[78],256],119978:[[79],256],119979:[[80],256],119980:[[81],256],119982:[[83],256],119983:[[84],256],119984:[[85],256],119985:[[86],256],119986:[[87],256],119987:[[88],256],119988:[[89],256],119989:[[90],256],119990:[[97],256],119991:[[98],256],119992:[[99],256],119993:[[100],256],119995:[[102],256],119997:[[104],256],119998:[[105],256],119999:[[106],256],120000:[[107],256],120001:[[108],256],120002:[[109],256],120003:[[110],256],120005:[[112],256],120006:[[113],256],120007:[[114],256],120008:[[115],256],120009:[[116],256],120010:[[117],256],120011:[[118],256],120012:[[119],256],120013:[[120],256],120014:[[121],256],120015:[[122],256],120016:[[65],256],120017:[[66],256],120018:[[67],256],120019:[[68],256],120020:[[69],256],120021:[[70],256],120022:[[71],256],120023:[[72],256],120024:[[73],256],120025:[[74],256],120026:[[75],256],120027:[[76],256],120028:[[77],256],120029:[[78],256],120030:[[79],256],120031:[[80],256],120032:[[81],256],120033:[[82],256],120034:[[83],256],120035:[[84],256],120036:[[85],256],120037:[[86],256],120038:[[87],256],120039:[[88],256],120040:[[89],256],120041:[[90],256],120042:[[97],256],120043:[[98],256],120044:[[99],256],120045:[[100],256],120046:[[101],256],120047:[[102],256],120048:[[103],256],120049:[[104],256],120050:[[105],256],120051:[[106],256],120052:[[107],256],120053:[[108],256],120054:[[109],256],120055:[[110],256],120056:[[111],256],120057:[[112],256],120058:[[113],256],120059:[[114],256],120060:[[115],256],120061:[[116],256],120062:[[117],256],120063:[[118],256]},
683954528:{120064:[[119],256],120065:[[120],256],120066:[[121],256],120067:[[122],256],120068:[[65],256],120069:[[66],256],120071:[[68],256],120072:[[69],256],120073:[[70],256],120074:[[71],256],120077:[[74],256],120078:[[75],256],120079:[[76],256],120080:[[77],256],120081:[[78],256],120082:[[79],256],120083:[[80],256],120084:[[81],256],120086:[[83],256],120087:[[84],256],120088:[[85],256],120089:[[86],256],120090:[[87],256],120091:[[88],256],120092:[[89],256],120094:[[97],256],120095:[[98],256],120096:[[99],256],120097:[[100],256],120098:[[101],256],120099:[[102],256],120100:[[103],256],120101:[[104],256],120102:[[105],256],120103:[[106],256],120104:[[107],256],120105:[[108],256],120106:[[109],256],120107:[[110],256],120108:[[111],256],120109:[[112],256],120110:[[113],256],120111:[[114],256],120112:[[115],256],120113:[[116],256],120114:[[117],256],120115:[[118],256],120116:[[119],256],120117:[[120],256],120118:[[121],256],120119:[[122],256],120120:[[65],256],120121:[[66],256],120123:[[68],256],120124:[[69],256],120125:[[70],256],120126:[[71],256],120128:[[73],256],120129:[[74],256],120130:[[75],256],120131:[[76],256],120132:[[77],256],120134:[[79],256],120138:[[83],256],120139:[[84],256],120140:[[85],256],120141:[[86],256],120142:[[87],256],120143:[[88],256],120144:[[89],256],120146:[[97],256],120147:[[98],256],120148:[[99],256],120149:[[100],256],120150:[[101],256],120151:[[102],256],120152:[[103],256],120153:[[104],256],120154:[[105],256],120155:[[106],256],120156:[[107],256],120157:[[108],256],120158:[[109],256],120159:[[110],256],120160:[[111],256],120161:[[112],256],120162:[[113],256],120163:[[114],256],120164:[[115],256],120165:[[116],256],120166:[[117],256],120167:[[118],256],120168:[[119],256],120169:[[120],256],120170:[[121],256],120171:[[122],256],120172:[[65],256],120173:[[66],256],120174:[[67],256],120175:[[68],256],120176:[[69],256],120177:[[70],256],120178:[[71],256],120179:[[72],256],120180:[[73],256],120181:[[74],256],120182:[[75],256],120183:[[76],256],120184:[[77],256],120185:[[78],256],120186:[[79],256],120187:[[80],256],120188:[[81],256],120189:[[82],256],120190:[[83],256],120191:[[84],256],120192:[[85],256],120193:[[86],256],120194:[[87],256],120195:[[88],256],120196:[[89],256],120197:[[90],256],120198:[[97],256],120199:[[98],256],120200:[[99],256],120201:[[100],256],120202:[[101],256],120203:[[102],256],120204:[[103],256],120205:[[104],256],120206:[[105],256],120207:[[106],256],120208:[[107],256],120209:[[108],256],120210:[[109],256],120211:[[110],256],120212:[[111],256],120213:[[112],256],120214:[[113],256],120215:[[114],256],120216:[[115],256],120217:[[116],256],120218:[[117],256],120219:[[118],256],120220:[[119],256],120221:[[120],256],120222:[[121],256],120223:[[122],256],120224:[[65],256],120225:[[66],256],120226:[[67],256],120227:[[68],256],120228:[[69],256],120229:[[70],256],120230:[[71],256],120231:[[72],256],120232:[[73],256],120233:[[74],256],120234:[[75],256],120235:[[76],256],120236:[[77],256],120237:[[78],256],120238:[[79],256],120239:[[80],256],120240:[[81],256],120241:[[82],256],120242:[[83],256],120243:[[84],256],120244:[[85],256],120245:[[86],256],120246:[[87],256],120247:[[88],256],120248:[[89],256],120249:[[90],256],120250:[[97],256],120251:[[98],256],120252:[[99],256],120253:[[100],256],120254:[[101],256],120255:[[102],256],120256:[[103],256],120257:[[104],256],120258:[[105],256],120259:[[106],256],120260:[[107],256],120261:[[108],256],120262:[[109],256],120263:[[110],256],120264:[[111],256],120265:[[112],256],120266:[[113],256],120267:[[114],256],120268:[[115],256],120269:[[116],256],120270:[[117],256],120271:[[118],256],120272:[[119],256],120273:[[120],256],120274:[[121],256],120275:[[122],256],120276:[[65],256],120277:[[66],256],120278:[[67],256],120279:[[68],256],120280:[[69],256],120281:[[70],256],120282:[[71],256],120283:[[72],256],120284:[[73],256],120285:[[74],256],120286:[[75],256],120287:[[76],256],120288:[[77],256],120289:[[78],256],120290:[[79],256],120291:[[80],256],120292:[[81],256],120293:[[82],256],120294:[[83],256],120295:[[84],256],120296:[[85],256],120297:[[86],256],120298:[[87],256],120299:[[88],256],120300:[[89],256],120301:[[90],256],120302:[[97],256],120303:[[98],256],120304:[[99],256],120305:[[100],256],120306:[[101],256],120307:[[102],256],120308:[[103],256],120309:[[104],256],120310:[[105],256],120311:[[106],256],120312:[[107],256],120313:[[108],256],120314:[[109],256],120315:[[110],256],120316:[[111],256],120317:[[112],256],120318:[[113],256],120319:[[114],256]},
684054784:{120320:[[115],256],120321:[[116],256],120322:[[117],256],120323:[[118],256],120324:[[119],256],120325:[[120],256],120326:[[121],256],120327:[[122],256],120328:[[65],256],120329:[[66],256],120330:[[67],256],120331:[[68],256],120332:[[69],256],120333:[[70],256],120334:[[71],256],120335:[[72],256],120336:[[73],256],120337:[[74],256],120338:[[75],256],120339:[[76],256],120340:[[77],256],120341:[[78],256],120342:[[79],256],120343:[[80],256],120344:[[81],256],120345:[[82],256],120346:[[83],256],120347:[[84],256],120348:[[85],256],120349:[[86],256],120350:[[87],256],120351:[[88],256],120352:[[89],256],120353:[[90],256],120354:[[97],256],120355:[[98],256],120356:[[99],256],120357:[[100],256],120358:[[101],256],120359:[[102],256],120360:[[103],256],120361:[[104],256],120362:[[105],256],120363:[[106],256],120364:[[107],256],120365:[[108],256],120366:[[109],256],120367:[[110],256],120368:[[111],256],120369:[[112],256],120370:[[113],256],120371:[[114],256],120372:[[115],256],120373:[[116],256],120374:[[117],256],120375:[[118],256],120376:[[119],256],120377:[[120],256],120378:[[121],256],120379:[[122],256],120380:[[65],256],120381:[[66],256],120382:[[67],256],120383:[[68],256],120384:[[69],256],120385:[[70],256],120386:[[71],256],120387:[[72],256],120388:[[73],256],120389:[[74],256],120390:[[75],256],120391:[[76],256],120392:[[77],256],120393:[[78],256],120394:[[79],256],120395:[[80],256],120396:[[81],256],120397:[[82],256],120398:[[83],256],120399:[[84],256],120400:[[85],256],120401:[[86],256],120402:[[87],256],120403:[[88],256],120404:[[89],256],120405:[[90],256],120406:[[97],256],120407:[[98],256],120408:[[99],256],120409:[[100],256],120410:[[101],256],120411:[[102],256],120412:[[103],256],120413:[[104],256],120414:[[105],256],120415:[[106],256],120416:[[107],256],120417:[[108],256],120418:[[109],256],120419:[[110],256],120420:[[111],256],120421:[[112],256],120422:[[113],256],120423:[[114],256],120424:[[115],256],120425:[[116],256],120426:[[117],256],120427:[[118],256],120428:[[119],256],120429:[[120],256],120430:[[121],256],120431:[[122],256],120432:[[65],256],120433:[[66],256],120434:[[67],256],120435:[[68],256],120436:[[69],256],120437:[[70],256],120438:[[71],256],120439:[[72],256],120440:[[73],256],120441:[[74],256],120442:[[75],256],120443:[[76],256],120444:[[77],256],120445:[[78],256],120446:[[79],256],120447:[[80],256],120448:[[81],256],120449:[[82],256],120450:[[83],256],120451:[[84],256],120452:[[85],256],120453:[[86],256],120454:[[87],256],120455:[[88],256],120456:[[89],256],120457:[[90],256],120458:[[97],256],120459:[[98],256],120460:[[99],256],120461:[[100],256],120462:[[101],256],120463:[[102],256],120464:[[103],256],120465:[[104],256],120466:[[105],256],120467:[[106],256],120468:[[107],256],120469:[[108],256],120470:[[109],256],120471:[[110],256],120472:[[111],256],120473:[[112],256],120474:[[113],256],120475:[[114],256],120476:[[115],256],120477:[[116],256],120478:[[117],256],120479:[[118],256],120480:[[119],256],120481:[[120],256],120482:[[121],256],120483:[[122],256],120484:[[305],256],120485:[[567],256],120488:[[913],256],120489:[[914],256],120490:[[915],256],120491:[[916],256],120492:[[917],256],120493:[[918],256],120494:[[919],256],120495:[[920],256],120496:[[921],256],120497:[[922],256],120498:[[923],256],120499:[[924],256],120500:[[925],256],120501:[[926],256],120502:[[927],256],120503:[[928],256],120504:[[929],256],120505:[[1012],256],120506:[[931],256],120507:[[932],256],120508:[[933],256],120509:[[934],256],120510:[[935],256],120511:[[936],256],120512:[[937],256],120513:[[8711],256],120514:[[945],256],120515:[[946],256],120516:[[947],256],120517:[[948],256],120518:[[949],256],120519:[[950],256],120520:[[951],256],120521:[[952],256],120522:[[953],256],120523:[[954],256],120524:[[955],256],120525:[[956],256],120526:[[957],256],120527:[[958],256],120528:[[959],256],120529:[[960],256],120530:[[961],256],120531:[[962],256],120532:[[963],256],120533:[[964],256],120534:[[965],256],120535:[[966],256],120536:[[967],256],120537:[[968],256],120538:[[969],256],120539:[[8706],256],120540:[[1013],256],120541:[[977],256],120542:[[1008],256],120543:[[981],256],120544:[[1009],256],120545:[[982],256],120546:[[913],256],120547:[[914],256],120548:[[915],256],120549:[[916],256],120550:[[917],256],120551:[[918],256],120552:[[919],256],120553:[[920],256],120554:[[921],256],120555:[[922],256],120556:[[923],256],120557:[[924],256],120558:[[925],256],120559:[[926],256],120560:[[927],256],120561:[[928],256],120562:[[929],256],120563:[[1012],256],120564:[[931],256],120565:[[932],256],120566:[[933],256],120567:[[934],256],120568:[[935],256],120569:[[936],256],120570:[[937],256],120571:[[8711],256],120572:[[945],256],120573:[[946],256],120574:[[947],256],120575:[[948],256]},
684155040:{120576:[[949],256],120577:[[950],256],120578:[[951],256],120579:[[952],256],120580:[[953],256],120581:[[954],256],120582:[[955],256],120583:[[956],256],120584:[[957],256],120585:[[958],256],120586:[[959],256],120587:[[960],256],120588:[[961],256],120589:[[962],256],120590:[[963],256],120591:[[964],256],120592:[[965],256],120593:[[966],256],120594:[[967],256],120595:[[968],256],120596:[[969],256],120597:[[8706],256],120598:[[1013],256],120599:[[977],256],120600:[[1008],256],120601:[[981],256],120602:[[1009],256],120603:[[982],256],120604:[[913],256],120605:[[914],256],120606:[[915],256],120607:[[916],256],120608:[[917],256],120609:[[918],256],120610:[[919],256],120611:[[920],256],120612:[[921],256],120613:[[922],256],120614:[[923],256],120615:[[924],256],120616:[[925],256],120617:[[926],256],120618:[[927],256],120619:[[928],256],120620:[[929],256],120621:[[1012],256],120622:[[931],256],120623:[[932],256],120624:[[933],256],120625:[[934],256],120626:[[935],256],120627:[[936],256],120628:[[937],256],120629:[[8711],256],120630:[[945],256],120631:[[946],256],120632:[[947],256],120633:[[948],256],120634:[[949],256],120635:[[950],256],120636:[[951],256],120637:[[952],256],120638:[[953],256],120639:[[954],256],120640:[[955],256],120641:[[956],256],120642:[[957],256],120643:[[958],256],120644:[[959],256],120645:[[960],256],120646:[[961],256],120647:[[962],256],120648:[[963],256],120649:[[964],256],120650:[[965],256],120651:[[966],256],120652:[[967],256],120653:[[968],256],120654:[[969],256],120655:[[8706],256],120656:[[1013],256],120657:[[977],256],120658:[[1008],256],120659:[[981],256],120660:[[1009],256],120661:[[982],256],120662:[[913],256],120663:[[914],256],120664:[[915],256],120665:[[916],256],120666:[[917],256],120667:[[918],256],120668:[[919],256],120669:[[920],256],120670:[[921],256],120671:[[922],256],120672:[[923],256],120673:[[924],256],120674:[[925],256],120675:[[926],256],120676:[[927],256],120677:[[928],256],120678:[[929],256],120679:[[1012],256],120680:[[931],256],120681:[[932],256],120682:[[933],256],120683:[[934],256],120684:[[935],256],120685:[[936],256],120686:[[937],256],120687:[[8711],256],120688:[[945],256],120689:[[946],256],120690:[[947],256],120691:[[948],256],120692:[[949],256],120693:[[950],256],120694:[[951],256],120695:[[952],256],120696:[[953],256],120697:[[954],256],120698:[[955],256],120699:[[956],256],120700:[[957],256],120701:[[958],256],120702:[[959],256],120703:[[960],256],120704:[[961],256],120705:[[962],256],120706:[[963],256],120707:[[964],256],120708:[[965],256],120709:[[966],256],120710:[[967],256],120711:[[968],256],120712:[[969],256],120713:[[8706],256],120714:[[1013],256],120715:[[977],256],120716:[[1008],256],120717:[[981],256],120718:[[1009],256],120719:[[982],256],120720:[[913],256],120721:[[914],256],120722:[[915],256],120723:[[916],256],120724:[[917],256],120725:[[918],256],120726:[[919],256],120727:[[920],256],120728:[[921],256],120729:[[922],256],120730:[[923],256],120731:[[924],256],120732:[[925],256],120733:[[926],256],120734:[[927],256],120735:[[928],256],120736:[[929],256],120737:[[1012],256],120738:[[931],256],120739:[[932],256],120740:[[933],256],120741:[[934],256],120742:[[935],256],120743:[[936],256],120744:[[937],256],120745:[[8711],256],120746:[[945],256],120747:[[946],256],120748:[[947],256],120749:[[948],256],120750:[[949],256],120751:[[950],256],120752:[[951],256],120753:[[952],256],120754:[[953],256],120755:[[954],256],120756:[[955],256],120757:[[956],256],120758:[[957],256],120759:[[958],256],120760:[[959],256],120761:[[960],256],120762:[[961],256],120763:[[962],256],120764:[[963],256],120765:[[964],256],120766:[[965],256],120767:[[966],256],120768:[[967],256],120769:[[968],256],120770:[[969],256],120771:[[8706],256],120772:[[1013],256],120773:[[977],256],120774:[[1008],256],120775:[[981],256],120776:[[1009],256],120777:[[982],256],120778:[[988],256],120779:[[989],256],120782:[[48],256],120783:[[49],256],120784:[[50],256],120785:[[51],256],120786:[[52],256],120787:[[53],256],120788:[[54],256],120789:[[55],256],120790:[[56],256],120791:[[57],256],120792:[[48],256],120793:[[49],256],120794:[[50],256],120795:[[51],256],120796:[[52],256],120797:[[53],256],120798:[[54],256],120799:[[55],256],120800:[[56],256],120801:[[57],256],120802:[[48],256],120803:[[49],256],120804:[[50],256],120805:[[51],256],120806:[[52],256],120807:[[53],256],120808:[[54],256],120809:[[55],256],120810:[[56],256],120811:[[57],256],120812:[[48],256],120813:[[49],256],120814:[[50],256],120815:[[51],256],120816:[[52],256],120817:[[53],256],120818:[[54],256],120819:[[55],256],120820:[[56],256],120821:[[57],256],120822:[[48],256],120823:[[49],256],120824:[[50],256],120825:[[51],256],120826:[[52],256],120827:[[53],256],120828:[[54],256],120829:[[55],256],120830:[[56],256],120831:[[57],256]},
684259392:{125136:[,220],125137:[,220],125138:[,220],125139:[,220],125140:[,220],125141:[,220],125142:[,220]},
684360928:{126464:[[1575],256],126465:[[1576],256],126466:[[1580],256],126467:[[1583],256],126469:[[1608],256],126470:[[1586],256],126471:[[1581],256],126472:[[1591],256],126473:[[1610],256],126474:[[1603],256],126475:[[1604],256],126476:[[1605],256],126477:[[1606],256],126478:[[1587],256],126479:[[1593],256],126480:[[1601],256],126481:[[1589],256],126482:[[1602],256],126483:[[1585],256],126484:[[1588],256],126485:[[1578],256],126486:[[1579],256],126487:[[1582],256],126488:[[1584],256],126489:[[1590],256],126490:[[1592],256],126491:[[1594],256],126492:[[1646],256],126493:[[1722],256],126494:[[1697],256],126495:[[1647],256],126497:[[1576],256],126498:[[1580],256],126500:[[1607],256],126503:[[1581],256],126505:[[1610],256],126506:[[1603],256],126507:[[1604],256],126508:[[1605],256],126509:[[1606],256],126510:[[1587],256],126511:[[1593],256],126512:[[1601],256],126513:[[1589],256],126514:[[1602],256],126516:[[1588],256],126517:[[1578],256],126518:[[1579],256],126519:[[1582],256],126521:[[1590],256],126523:[[1594],256],126530:[[1580],256],126535:[[1581],256],126537:[[1610],256],126539:[[1604],256],126541:[[1606],256],126542:[[1587],256],126543:[[1593],256],126545:[[1589],256],126546:[[1602],256],126548:[[1588],256],126551:[[1582],256],126553:[[1590],256],126555:[[1594],256],126557:[[1722],256],126559:[[1647],256],126561:[[1576],256],126562:[[1580],256],126564:[[1607],256],126567:[[1581],256],126568:[[1591],256],126569:[[1610],256],126570:[[1603],256],126572:[[1605],256],126573:[[1606],256],126574:[[1587],256],126575:[[1593],256],126576:[[1601],256],126577:[[1589],256],126578:[[1602],256],126580:[[1588],256],126581:[[1578],256],126582:[[1579],256],126583:[[1582],256],126585:[[1590],256],126586:[[1592],256],126587:[[1594],256],126588:[[1646],256],126590:[[1697],256],126592:[[1575],256],126593:[[1576],256],126594:[[1580],256],126595:[[1583],256],126596:[[1607],256],126597:[[1608],256],126598:[[1586],256],126599:[[1581],256],126600:[[1591],256],126601:[[1610],256],126603:[[1604],256],126604:[[1605],256],126605:[[1606],256],126606:[[1587],256],126607:[[1593],256],126608:[[1601],256],126609:[[1589],256],126610:[[1602],256],126611:[[1585],256],126612:[[1588],256],126613:[[1578],256],126614:[[1579],256],126615:[[1582],256],126616:[[1584],256],126617:[[1590],256],126618:[[1592],256],126619:[[1594],256],126625:[[1576],256],126626:[[1580],256],126627:[[1583],256],126629:[[1608],256],126630:[[1586],256],126631:[[1581],256],126632:[[1591],256],126633:[[1610],256],126635:[[1604],256],126636:[[1605],256],126637:[[1606],256],126638:[[1587],256],126639:[[1593],256],126640:[[1601],256],126641:[[1589],256],126642:[[1602],256],126643:[[1585],256],126644:[[1588],256],126645:[[1578],256],126646:[[1579],256],126647:[[1582],256],126648:[[1584],256],126649:[[1590],256],126650:[[1592],256],126651:[[1594],256]},
684461696:{127232:[[48,46],256],127233:[[48,44],256],127234:[[49,44],256],127235:[[50,44],256],127236:[[51,44],256],127237:[[52,44],256],127238:[[53,44],256],127239:[[54,44],256],127240:[[55,44],256],127241:[[56,44],256],127242:[[57,44],256],127248:[[40,65,41],256],127249:[[40,66,41],256],127250:[[40,67,41],256],127251:[[40,68,41],256],127252:[[40,69,41],256],127253:[[40,70,41],256],127254:[[40,71,41],256],127255:[[40,72,41],256],127256:[[40,73,41],256],127257:[[40,74,41],256],127258:[[40,75,41],256],127259:[[40,76,41],256],127260:[[40,77,41],256],127261:[[40,78,41],256],127262:[[40,79,41],256],127263:[[40,80,41],256],127264:[[40,81,41],256],127265:[[40,82,41],256],127266:[[40,83,41],256],127267:[[40,84,41],256],127268:[[40,85,41],256],127269:[[40,86,41],256],127270:[[40,87,41],256],127271:[[40,88,41],256],127272:[[40,89,41],256],127273:[[40,90,41],256],127274:[[12308,83,12309],256],127275:[[67],256],127276:[[82],256],127277:[[67,68],256],127278:[[87,90],256],127280:[[65],256],127281:[[66],256],127282:[[67],256],127283:[[68],256],127284:[[69],256],127285:[[70],256],127286:[[71],256],127287:[[72],256],127288:[[73],256],127289:[[74],256],127290:[[75],256],127291:[[76],256],127292:[[77],256],127293:[[78],256],127294:[[79],256],127295:[[80],256],127296:[[81],256],127297:[[82],256],127298:[[83],256],127299:[[84],256],127300:[[85],256],127301:[[86],256],127302:[[87],256],127303:[[88],256],127304:[[89],256],127305:[[90],256],127306:[[72,86],256],127307:[[77,86],256],127308:[[83,68],256],127309:[[83,83],256],127310:[[80,80,86],256],127311:[[87,67],256],127338:[[77,67],256],127339:[[77,68],256],127376:[[68,74],256]},
684561952:{127488:[[12411,12363],256],127489:[[12467,12467],256],127490:[[12469],256],127504:[[25163],256],127505:[[23383],256],127506:[[21452],256],127507:[[12487],256],127508:[[20108],256],127509:[[22810],256],127510:[[35299],256],127511:[[22825],256],127512:[[20132],256],127513:[[26144],256],127514:[[28961],256],127515:[[26009],256],127516:[[21069],256],127517:[[24460],256],127518:[[20877],256],127519:[[26032],256],127520:[[21021],256],127521:[[32066],256],127522:[[29983],256],127523:[[36009],256],127524:[[22768],256],127525:[[21561],256],127526:[[28436],256],127527:[[25237],256],127528:[[25429],256],127529:[[19968],256],127530:[[19977],256],127531:[[36938],256],127532:[[24038],256],127533:[[20013],256],127534:[[21491],256],127535:[[25351],256],127536:[[36208],256],127537:[[25171],256],127538:[[31105],256],127539:[[31354],256],127540:[[21512],256],127541:[[28288],256],127542:[[26377],256],127543:[[26376],256],127544:[[30003],256],127545:[[21106],256],127546:[[21942],256],127552:[[12308,26412,12309],256],127553:[[12308,19977,12309],256],127554:[[12308,20108,12309],256],127555:[[12308,23433,12309],256],127556:[[12308,28857,12309],256],127557:[[12308,25171,12309],256],127558:[[12308,30423,12309],256],127559:[[12308,21213,12309],256],127560:[[12308,25943,12309],256],127568:[[24471],256],127569:[[21487],256]},
684663488:{194560:[[20029]],194561:[[20024]],194562:[[20033]],194563:[[131362]],194564:[[20320]],194565:[[20398]],194566:[[20411]],194567:[[20482]],194568:[[20602]],194569:[[20633]],194570:[[20711]],194571:[[20687]],194572:[[13470]],194573:[[132666]],194574:[[20813]],194575:[[20820]],194576:[[20836]],194577:[[20855]],194578:[[132380]],194579:[[13497]],194580:[[20839]],194581:[[20877]],194582:[[132427]],194583:[[20887]],194584:[[20900]],194585:[[20172]],194586:[[20908]],194587:[[20917]],194588:[[168415]],194589:[[20981]],194590:[[20995]],194591:[[13535]],194592:[[21051]],194593:[[21062]],194594:[[21106]],194595:[[21111]],194596:[[13589]],194597:[[21191]],194598:[[21193]],194599:[[21220]],194600:[[21242]],194601:[[21253]],194602:[[21254]],194603:[[21271]],194604:[[21321]],194605:[[21329]],194606:[[21338]],194607:[[21363]],194608:[[21373]],194609:[[21375]],194610:[[21375]],194611:[[21375]],194612:[[133676]],194613:[[28784]],194614:[[21450]],194615:[[21471]],194616:[[133987]],194617:[[21483]],194618:[[21489]],194619:[[21510]],194620:[[21662]],194621:[[21560]],194622:[[21576]],194623:[[21608]],194624:[[21666]],194625:[[21750]],194626:[[21776]],194627:[[21843]],194628:[[21859]],194629:[[21892]],194630:[[21892]],194631:[[21913]],194632:[[21931]],194633:[[21939]],194634:[[21954]],194635:[[22294]],194636:[[22022]],194637:[[22295]],194638:[[22097]],194639:[[22132]],194640:[[20999]],194641:[[22766]],194642:[[22478]],194643:[[22516]],194644:[[22541]],194645:[[22411]],194646:[[22578]],194647:[[22577]],194648:[[22700]],194649:[[136420]],194650:[[22770]],194651:[[22775]],194652:[[22790]],194653:[[22810]],194654:[[22818]],194655:[[22882]],194656:[[136872]],194657:[[136938]],194658:[[23020]],194659:[[23067]],194660:[[23079]],194661:[[23000]],194662:[[23142]],194663:[[14062]],194664:[[14076]],194665:[[23304]],194666:[[23358]],194667:[[23358]],194668:[[137672]],194669:[[23491]],194670:[[23512]],194671:[[23527]],194672:[[23539]],194673:[[138008]],194674:[[23551]],194675:[[23558]],194676:[[24403]],194677:[[23586]],194678:[[14209]],194679:[[23648]],194680:[[23662]],194681:[[23744]],194682:[[23693]],194683:[[138724]],194684:[[23875]],194685:[[138726]],194686:[[23918]],194687:[[23915]],194688:[[23932]],194689:[[24033]],194690:[[24034]],194691:[[14383]],194692:[[24061]],194693:[[24104]],194694:[[24125]],194695:[[24169]],194696:[[14434]],194697:[[139651]],194698:[[14460]],194699:[[24240]],194700:[[24243]],194701:[[24246]],194702:[[24266]],194703:[[172946]],194704:[[24318]],194705:[[140081]],194706:[[140081]],194707:[[33281]],194708:[[24354]],194709:[[24354]],194710:[[14535]],194711:[[144056]],194712:[[156122]],194713:[[24418]],194714:[[24427]],194715:[[14563]],194716:[[24474]],194717:[[24525]],194718:[[24535]],194719:[[24569]],194720:[[24705]],194721:[[14650]],194722:[[14620]],194723:[[24724]],194724:[[141012]],194725:[[24775]],194726:[[24904]],194727:[[24908]],194728:[[24910]],194729:[[24908]],194730:[[24954]],194731:[[24974]],194732:[[25010]],194733:[[24996]],194734:[[25007]],194735:[[25054]],194736:[[25074]],194737:[[25078]],194738:[[25104]],194739:[[25115]],194740:[[25181]],194741:[[25265]],194742:[[25300]],194743:[[25424]],194744:[[142092]],194745:[[25405]],194746:[[25340]],194747:[[25448]],194748:[[25475]],194749:[[25572]],194750:[[142321]],194751:[[25634]],194752:[[25541]],194753:[[25513]],194754:[[14894]],194755:[[25705]],194756:[[25726]],194757:[[25757]],194758:[[25719]],194759:[[14956]],194760:[[25935]],194761:[[25964]],194762:[[143370]],194763:[[26083]],194764:[[26360]],194765:[[26185]],194766:[[15129]],194767:[[26257]],194768:[[15112]],194769:[[15076]],194770:[[20882]],194771:[[20885]],194772:[[26368]],194773:[[26268]],194774:[[32941]],194775:[[17369]],194776:[[26391]],194777:[[26395]],194778:[[26401]],194779:[[26462]],194780:[[26451]],194781:[[144323]],194782:[[15177]],194783:[[26618]],194784:[[26501]],194785:[[26706]],194786:[[26757]],194787:[[144493]],194788:[[26766]],194789:[[26655]],194790:[[26900]],194791:[[15261]],194792:[[26946]],194793:[[27043]],194794:[[27114]],194795:[[27304]],194796:[[145059]],194797:[[27355]],194798:[[15384]],194799:[[27425]],194800:[[145575]],194801:[[27476]],194802:[[15438]],194803:[[27506]],194804:[[27551]],194805:[[27578]],194806:[[27579]],194807:[[146061]],194808:[[138507]],194809:[[146170]],194810:[[27726]],194811:[[146620]],194812:[[27839]],194813:[[27853]],194814:[[27751]],194815:[[27926]]},
684763744:{63744:[[35912]],63745:[[26356]],63746:[[36554]],63747:[[36040]],63748:[[28369]],63749:[[20018]],63750:[[21477]],63751:[[40860]],63752:[[40860]],63753:[[22865]],63754:[[37329]],63755:[[21895]],63756:[[22856]],63757:[[25078]],63758:[[30313]],63759:[[32645]],63760:[[34367]],63761:[[34746]],63762:[[35064]],63763:[[37007]],63764:[[27138]],63765:[[27931]],63766:[[28889]],63767:[[29662]],63768:[[33853]],63769:[[37226]],63770:[[39409]],63771:[[20098]],63772:[[21365]],63773:[[27396]],63774:[[29211]],63775:[[34349]],63776:[[40478]],63777:[[23888]],63778:[[28651]],63779:[[34253]],63780:[[35172]],63781:[[25289]],63782:[[33240]],63783:[[34847]],63784:[[24266]],63785:[[26391]],63786:[[28010]],63787:[[29436]],63788:[[37070]],63789:[[20358]],63790:[[20919]],63791:[[21214]],63792:[[25796]],63793:[[27347]],63794:[[29200]],63795:[[30439]],63796:[[32769]],63797:[[34310]],63798:[[34396]],63799:[[36335]],63800:[[38706]],63801:[[39791]],63802:[[40442]],63803:[[30860]],63804:[[31103]],63805:[[32160]],63806:[[33737]],63807:[[37636]],63808:[[40575]],63809:[[35542]],63810:[[22751]],63811:[[24324]],63812:[[31840]],63813:[[32894]],63814:[[29282]],63815:[[30922]],63816:[[36034]],63817:[[38647]],63818:[[22744]],63819:[[23650]],63820:[[27155]],63821:[[28122]],63822:[[28431]],63823:[[32047]],63824:[[32311]],63825:[[38475]],63826:[[21202]],63827:[[32907]],63828:[[20956]],63829:[[20940]],63830:[[31260]],63831:[[32190]],63832:[[33777]],63833:[[38517]],63834:[[35712]],63835:[[25295]],63836:[[27138]],63837:[[35582]],63838:[[20025]],63839:[[23527]],63840:[[24594]],63841:[[29575]],63842:[[30064]],63843:[[21271]],63844:[[30971]],63845:[[20415]],63846:[[24489]],63847:[[19981]],63848:[[27852]],63849:[[25976]],63850:[[32034]],63851:[[21443]],63852:[[22622]],63853:[[30465]],63854:[[33865]],63855:[[35498]],63856:[[27578]],63857:[[36784]],63858:[[27784]],63859:[[25342]],63860:[[33509]],63861:[[25504]],63862:[[30053]],63863:[[20142]],63864:[[20841]],63865:[[20937]],63866:[[26753]],63867:[[31975]],63868:[[33391]],63869:[[35538]],63870:[[37327]],63871:[[21237]],63872:[[21570]],63873:[[22899]],63874:[[24300]],63875:[[26053]],63876:[[28670]],63877:[[31018]],63878:[[38317]],63879:[[39530]],63880:[[40599]],63881:[[40654]],63882:[[21147]],63883:[[26310]],63884:[[27511]],63885:[[36706]],63886:[[24180]],63887:[[24976]],63888:[[25088]],63889:[[25754]],63890:[[28451]],63891:[[29001]],63892:[[29833]],63893:[[31178]],63894:[[32244]],63895:[[32879]],63896:[[36646]],63897:[[34030]],63898:[[36899]],63899:[[37706]],63900:[[21015]],63901:[[21155]],63902:[[21693]],63903:[[28872]],63904:[[35010]],63905:[[35498]],63906:[[24265]],63907:[[24565]],63908:[[25467]],63909:[[27566]],63910:[[31806]],63911:[[29557]],63912:[[20196]],63913:[[22265]],63914:[[23527]],63915:[[23994]],63916:[[24604]],63917:[[29618]],63918:[[29801]],63919:[[32666]],63920:[[32838]],63921:[[37428]],63922:[[38646]],63923:[[38728]],63924:[[38936]],63925:[[20363]],63926:[[31150]],63927:[[37300]],63928:[[38584]],63929:[[24801]],63930:[[20102]],63931:[[20698]],63932:[[23534]],63933:[[23615]],63934:[[26009]],63935:[[27138]],63936:[[29134]],63937:[[30274]],63938:[[34044]],63939:[[36988]],63940:[[40845]],63941:[[26248]],63942:[[38446]],63943:[[21129]],63944:[[26491]],63945:[[26611]],63946:[[27969]],63947:[[28316]],63948:[[29705]],63949:[[30041]],63950:[[30827]],63951:[[32016]],63952:[[39006]],63953:[[20845]],63954:[[25134]],63955:[[38520]],63956:[[20523]],63957:[[23833]],63958:[[28138]],63959:[[36650]],63960:[[24459]],63961:[[24900]],63962:[[26647]],63963:[[29575]],63964:[[38534]],63965:[[21033]],63966:[[21519]],63967:[[23653]],63968:[[26131]],63969:[[26446]],63970:[[26792]],63971:[[27877]],63972:[[29702]],63973:[[30178]],63974:[[32633]],63975:[[35023]],63976:[[35041]],63977:[[37324]],63978:[[38626]],63979:[[21311]],63980:[[28346]],63981:[[21533]],63982:[[29136]],63983:[[29848]],63984:[[34298]],63985:[[38563]],63986:[[40023]],63987:[[40607]],63988:[[26519]],63989:[[28107]],63990:[[33256]],63991:[[31435]],63992:[[31520]],63993:[[31890]],63994:[[29376]],63995:[[28825]],63996:[[35672]],63997:[[20160]],63998:[[33590]],63999:[[21050]],194816:[[27966]],194817:[[28023]],194818:[[27969]],194819:[[28009]],194820:[[28024]],194821:[[28037]],194822:[[146718]],194823:[[27956]],194824:[[28207]],194825:[[28270]],194826:[[15667]],194827:[[28363]],194828:[[28359]],194829:[[147153]],194830:[[28153]],194831:[[28526]],194832:[[147294]],194833:[[147342]],194834:[[28614]],194835:[[28729]],194836:[[28702]],194837:[[28699]],194838:[[15766]],194839:[[28746]],194840:[[28797]],194841:[[28791]],194842:[[28845]],194843:[[132389]],194844:[[28997]],194845:[[148067]],194846:[[29084]],194847:[[148395]],194848:[[29224]],194849:[[29237]],194850:[[29264]],194851:[[149000]],194852:[[29312]],194853:[[29333]],194854:[[149301]],194855:[[149524]],194856:[[29562]],194857:[[29579]],194858:[[16044]],194859:[[29605]],194860:[[16056]],194861:[[16056]],194862:[[29767]],194863:[[29788]],194864:[[29809]],194865:[[29829]],194866:[[29898]],194867:[[16155]],194868:[[29988]],194869:[[150582]],194870:[[30014]],194871:[[150674]],194872:[[30064]],194873:[[139679]],194874:[[30224]],194875:[[151457]],194876:[[151480]],194877:[[151620]],194878:[[16380]],194879:[[16392]],194880:[[30452]],194881:[[151795]],194882:[[151794]],194883:[[151833]],194884:[[151859]],194885:[[30494]],194886:[[30495]],194887:[[30495]],194888:[[30538]],194889:[[16441]],194890:[[30603]],194891:[[16454]],194892:[[16534]],194893:[[152605]],194894:[[30798]],194895:[[30860]],194896:[[30924]],194897:[[16611]],194898:[[153126]],194899:[[31062]],194900:[[153242]],194901:[[153285]],194902:[[31119]],194903:[[31211]],194904:[[16687]],194905:[[31296]],194906:[[31306]],194907:[[31311]],194908:[[153980]],194909:[[154279]],194910:[[154279]],194911:[[31470]],194912:[[16898]],194913:[[154539]],194914:[[31686]],194915:[[31689]],194916:[[16935]],194917:[[154752]],194918:[[31954]],194919:[[17056]],194920:[[31976]],194921:[[31971]],194922:[[32000]],194923:[[155526]],194924:[[32099]],194925:[[17153]],194926:[[32199]],194927:[[32258]],194928:[[32325]],194929:[[17204]],194930:[[156200]],194931:[[156231]],194932:[[17241]],194933:[[156377]],194934:[[32634]],194935:[[156478]],194936:[[32661]],194937:[[32762]],194938:[[32773]],194939:[[156890]],194940:[[156963]],194941:[[32864]],194942:[[157096]],194943:[[32880]],194944:[[144223]],194945:[[17365]],194946:[[32946]],194947:[[33027]],194948:[[17419]],194949:[[33086]],194950:[[23221]],194951:[[157607]],194952:[[157621]],194953:[[144275]],194954:[[144284]],194955:[[33281]],194956:[[33284]],194957:[[36766]],194958:[[17515]],194959:[[33425]],194960:[[33419]],194961:[[33437]],194962:[[21171]],194963:[[33457]],194964:[[33459]],194965:[[33469]],194966:[[33510]],194967:[[158524]],194968:[[33509]],194969:[[33565]],194970:[[33635]],194971:[[33709]],194972:[[33571]],194973:[[33725]],194974:[[33767]],194975:[[33879]],194976:[[33619]],194977:[[33738]],194978:[[33740]],194979:[[33756]],194980:[[158774]],194981:[[159083]],194982:[[158933]],194983:[[17707]],194984:[[34033]],194985:[[34035]],194986:[[34070]],194987:[[160714]],194988:[[34148]],194989:[[159532]],194990:[[17757]],194991:[[17761]],194992:[[159665]],194993:[[159954]],194994:[[17771]],194995:[[34384]],194996:[[34396]],194997:[[34407]],194998:[[34409]],194999:[[34473]],195000:[[34440]],195001:[[34574]],195002:[[34530]],195003:[[34681]],195004:[[34600]],195005:[[34667]],195006:[[34694]],195007:[[17879]],195008:[[34785]],195009:[[34817]],195010:[[17913]],195011:[[34912]],195012:[[34915]],195013:[[161383]],195014:[[35031]],195015:[[35038]],195016:[[17973]],195017:[[35066]],195018:[[13499]],195019:[[161966]],195020:[[162150]],195021:[[18110]],195022:[[18119]],195023:[[35488]],195024:[[35565]],195025:[[35722]],195026:[[35925]],195027:[[162984]],195028:[[36011]],195029:[[36033]],195030:[[36123]],195031:[[36215]],195032:[[163631]],195033:[[133124]],195034:[[36299]],195035:[[36284]],195036:[[36336]],195037:[[133342]],195038:[[36564]],195039:[[36664]],195040:[[165330]],195041:[[165357]],195042:[[37012]],195043:[[37105]],195044:[[37137]],195045:[[165678]],195046:[[37147]],195047:[[37432]],195048:[[37591]],195049:[[37592]],195050:[[37500]],195051:[[37881]],195052:[[37909]],195053:[[166906]],195054:[[38283]],195055:[[18837]],195056:[[38327]],195057:[[167287]],195058:[[18918]],195059:[[38595]],195060:[[23986]],195061:[[38691]],195062:[[168261]],195063:[[168474]],195064:[[19054]],195065:[[19062]],195066:[[38880]],195067:[[168970]],195068:[[19122]],195069:[[169110]],195070:[[38923]],195071:[[38923]]},
684864000:{64000:[[20999]],64001:[[24230]],64002:[[25299]],64003:[[31958]],64004:[[23429]],64005:[[27934]],64006:[[26292]],64007:[[36667]],64008:[[34892]],64009:[[38477]],64010:[[35211]],64011:[[24275]],64012:[[20800]],64013:[[21952]],64016:[[22618]],64018:[[26228]],64021:[[20958]],64022:[[29482]],64023:[[30410]],64024:[[31036]],64025:[[31070]],64026:[[31077]],64027:[[31119]],64028:[[38742]],64029:[[31934]],64030:[[32701]],64032:[[34322]],64034:[[35576]],64037:[[36920]],64038:[[37117]],64042:[[39151]],64043:[[39164]],64044:[[39208]],64045:[[40372]],64046:[[37086]],64047:[[38583]],64048:[[20398]],64049:[[20711]],64050:[[20813]],64051:[[21193]],64052:[[21220]],64053:[[21329]],64054:[[21917]],64055:[[22022]],64056:[[22120]],64057:[[22592]],64058:[[22696]],64059:[[23652]],64060:[[23662]],64061:[[24724]],64062:[[24936]],64063:[[24974]],64064:[[25074]],64065:[[25935]],64066:[[26082]],64067:[[26257]],64068:[[26757]],64069:[[28023]],64070:[[28186]],64071:[[28450]],64072:[[29038]],64073:[[29227]],64074:[[29730]],64075:[[30865]],64076:[[31038]],64077:[[31049]],64078:[[31048]],64079:[[31056]],64080:[[31062]],64081:[[31069]],64082:[[31117]],64083:[[31118]],64084:[[31296]],64085:[[31361]],64086:[[31680]],64087:[[32244]],64088:[[32265]],64089:[[32321]],64090:[[32626]],64091:[[32773]],64092:[[33261]],64093:[[33401]],64094:[[33401]],64095:[[33879]],64096:[[35088]],64097:[[35222]],64098:[[35585]],64099:[[35641]],64100:[[36051]],64101:[[36104]],64102:[[36790]],64103:[[36920]],64104:[[38627]],64105:[[38911]],64106:[[38971]],64107:[[24693]],64108:[[148206]],64109:[[33304]],64112:[[20006]],64113:[[20917]],64114:[[20840]],64115:[[20352]],64116:[[20805]],64117:[[20864]],64118:[[21191]],64119:[[21242]],64120:[[21917]],64121:[[21845]],64122:[[21913]],64123:[[21986]],64124:[[22618]],64125:[[22707]],64126:[[22852]],64127:[[22868]],64128:[[23138]],64129:[[23336]],64130:[[24274]],64131:[[24281]],64132:[[24425]],64133:[[24493]],64134:[[24792]],64135:[[24910]],64136:[[24840]],64137:[[24974]],64138:[[24928]],64139:[[25074]],64140:[[25140]],64141:[[25540]],64142:[[25628]],64143:[[25682]],64144:[[25942]],64145:[[26228]],64146:[[26391]],64147:[[26395]],64148:[[26454]],64149:[[27513]],64150:[[27578]],64151:[[27969]],64152:[[28379]],64153:[[28363]],64154:[[28450]],64155:[[28702]],64156:[[29038]],64157:[[30631]],64158:[[29237]],64159:[[29359]],64160:[[29482]],64161:[[29809]],64162:[[29958]],64163:[[30011]],64164:[[30237]],64165:[[30239]],64166:[[30410]],64167:[[30427]],64168:[[30452]],64169:[[30538]],64170:[[30528]],64171:[[30924]],64172:[[31409]],64173:[[31680]],64174:[[31867]],64175:[[32091]],64176:[[32244]],64177:[[32574]],64178:[[32773]],64179:[[33618]],64180:[[33775]],64181:[[34681]],64182:[[35137]],64183:[[35206]],64184:[[35222]],64185:[[35519]],64186:[[35576]],64187:[[35531]],64188:[[35585]],64189:[[35582]],64190:[[35565]],64191:[[35641]],64192:[[35722]],64193:[[36104]],64194:[[36664]],64195:[[36978]],64196:[[37273]],64197:[[37494]],64198:[[38524]],64199:[[38627]],64200:[[38742]],64201:[[38875]],64202:[[38911]],64203:[[38923]],64204:[[38971]],64205:[[39698]],64206:[[40860]],64207:[[141386]],64208:[[141380]],64209:[[144341]],64210:[[15261]],64211:[[16408]],64212:[[16441]],64213:[[152137]],64214:[[154832]],64215:[[163539]],64216:[[40771]],64217:[[40846]],195072:[[38953]],195073:[[169398]],195074:[[39138]],195075:[[19251]],195076:[[39209]],195077:[[39335]],195078:[[39362]],195079:[[39422]],195080:[[19406]],195081:[[170800]],195082:[[39698]],195083:[[40000]],195084:[[40189]],195085:[[19662]],195086:[[19693]],195087:[[40295]],195088:[[172238]],195089:[[19704]],195090:[[172293]],195091:[[172558]],195092:[[172689]],195093:[[40635]],195094:[[19798]],195095:[[40697]],195096:[[40702]],195097:[[40709]],195098:[[40719]],195099:[[40726]],195100:[[40763]],195101:[[173568]]},
684964256:{64256:[[102,102],256],64257:[[102,105],256],64258:[[102,108],256],64259:[[102,102,105],256],64260:[[102,102,108],256],64261:[[383,116],256],64262:[[115,116],256],64275:[[1396,1398],256],64276:[[1396,1381],256],64277:[[1396,1387],256],64278:[[1406,1398],256],64279:[[1396,1389],256],64285:[[1497,1460],512],64286:[,26],64287:[[1522,1463],512],64288:[[1506],256],64289:[[1488],256],64290:[[1491],256],64291:[[1492],256],64292:[[1499],256],64293:[[1500],256],64294:[[1501],256],64295:[[1512],256],64296:[[1514],256],64297:[[43],256],64298:[[1513,1473],512],64299:[[1513,1474],512],64300:[[64329,1473],512],64301:[[64329,1474],512],64302:[[1488,1463],512],64303:[[1488,1464],512],64304:[[1488,1468],512],64305:[[1489,1468],512],64306:[[1490,1468],512],64307:[[1491,1468],512],64308:[[1492,1468],512],64309:[[1493,1468],512],64310:[[1494,1468],512],64312:[[1496,1468],512],64313:[[1497,1468],512],64314:[[1498,1468],512],64315:[[1499,1468],512],64316:[[1500,1468],512],64318:[[1502,1468],512],64320:[[1504,1468],512],64321:[[1505,1468],512],64323:[[1507,1468],512],64324:[[1508,1468],512],64326:[[1510,1468],512],64327:[[1511,1468],512],64328:[[1512,1468],512],64329:[[1513,1468],512],64330:[[1514,1468],512],64331:[[1493,1465],512],64332:[[1489,1471],512],64333:[[1499,1471],512],64334:[[1508,1471],512],64335:[[1488,1500],256],64336:[[1649],256],64337:[[1649],256],64338:[[1659],256],64339:[[1659],256],64340:[[1659],256],64341:[[1659],256],64342:[[1662],256],64343:[[1662],256],64344:[[1662],256],64345:[[1662],256],64346:[[1664],256],64347:[[1664],256],64348:[[1664],256],64349:[[1664],256],64350:[[1658],256],64351:[[1658],256],64352:[[1658],256],64353:[[1658],256],64354:[[1663],256],64355:[[1663],256],64356:[[1663],256],64357:[[1663],256],64358:[[1657],256],64359:[[1657],256],64360:[[1657],256],64361:[[1657],256],64362:[[1700],256],64363:[[1700],256],64364:[[1700],256],64365:[[1700],256],64366:[[1702],256],64367:[[1702],256],64368:[[1702],256],64369:[[1702],256],64370:[[1668],256],64371:[[1668],256],64372:[[1668],256],64373:[[1668],256],64374:[[1667],256],64375:[[1667],256],64376:[[1667],256],64377:[[1667],256],64378:[[1670],256],64379:[[1670],256],64380:[[1670],256],64381:[[1670],256],64382:[[1671],256],64383:[[1671],256],64384:[[1671],256],64385:[[1671],256],64386:[[1677],256],64387:[[1677],256],64388:[[1676],256],64389:[[1676],256],64390:[[1678],256],64391:[[1678],256],64392:[[1672],256],64393:[[1672],256],64394:[[1688],256],64395:[[1688],256],64396:[[1681],256],64397:[[1681],256],64398:[[1705],256],64399:[[1705],256],64400:[[1705],256],64401:[[1705],256],64402:[[1711],256],64403:[[1711],256],64404:[[1711],256],64405:[[1711],256],64406:[[1715],256],64407:[[1715],256],64408:[[1715],256],64409:[[1715],256],64410:[[1713],256],64411:[[1713],256],64412:[[1713],256],64413:[[1713],256],64414:[[1722],256],64415:[[1722],256],64416:[[1723],256],64417:[[1723],256],64418:[[1723],256],64419:[[1723],256],64420:[[1728],256],64421:[[1728],256],64422:[[1729],256],64423:[[1729],256],64424:[[1729],256],64425:[[1729],256],64426:[[1726],256],64427:[[1726],256],64428:[[1726],256],64429:[[1726],256],64430:[[1746],256],64431:[[1746],256],64432:[[1747],256],64433:[[1747],256],64467:[[1709],256],64468:[[1709],256],64469:[[1709],256],64470:[[1709],256],64471:[[1735],256],64472:[[1735],256],64473:[[1734],256],64474:[[1734],256],64475:[[1736],256],64476:[[1736],256],64477:[[1655],256],64478:[[1739],256],64479:[[1739],256],64480:[[1733],256],64481:[[1733],256],64482:[[1737],256],64483:[[1737],256],64484:[[1744],256],64485:[[1744],256],64486:[[1744],256],64487:[[1744],256],64488:[[1609],256],64489:[[1609],256],64490:[[1574,1575],256],64491:[[1574,1575],256],64492:[[1574,1749],256],64493:[[1574,1749],256],64494:[[1574,1608],256],64495:[[1574,1608],256],64496:[[1574,1735],256],64497:[[1574,1735],256],64498:[[1574,1734],256],64499:[[1574,1734],256],64500:[[1574,1736],256],64501:[[1574,1736],256],64502:[[1574,1744],256],64503:[[1574,1744],256],64504:[[1574,1744],256],64505:[[1574,1609],256],64506:[[1574,1609],256],64507:[[1574,1609],256],64508:[[1740],256],64509:[[1740],256],64510:[[1740],256],64511:[[1740],256]},
685064512:{64512:[[1574,1580],256],64513:[[1574,1581],256],64514:[[1574,1605],256],64515:[[1574,1609],256],64516:[[1574,1610],256],64517:[[1576,1580],256],64518:[[1576,1581],256],64519:[[1576,1582],256],64520:[[1576,1605],256],64521:[[1576,1609],256],64522:[[1576,1610],256],64523:[[1578,1580],256],64524:[[1578,1581],256],64525:[[1578,1582],256],64526:[[1578,1605],256],64527:[[1578,1609],256],64528:[[1578,1610],256],64529:[[1579,1580],256],64530:[[1579,1605],256],64531:[[1579,1609],256],64532:[[1579,1610],256],64533:[[1580,1581],256],64534:[[1580,1605],256],64535:[[1581,1580],256],64536:[[1581,1605],256],64537:[[1582,1580],256],64538:[[1582,1581],256],64539:[[1582,1605],256],64540:[[1587,1580],256],64541:[[1587,1581],256],64542:[[1587,1582],256],64543:[[1587,1605],256],64544:[[1589,1581],256],64545:[[1589,1605],256],64546:[[1590,1580],256],64547:[[1590,1581],256],64548:[[1590,1582],256],64549:[[1590,1605],256],64550:[[1591,1581],256],64551:[[1591,1605],256],64552:[[1592,1605],256],64553:[[1593,1580],256],64554:[[1593,1605],256],64555:[[1594,1580],256],64556:[[1594,1605],256],64557:[[1601,1580],256],64558:[[1601,1581],256],64559:[[1601,1582],256],64560:[[1601,1605],256],64561:[[1601,1609],256],64562:[[1601,1610],256],64563:[[1602,1581],256],64564:[[1602,1605],256],64565:[[1602,1609],256],64566:[[1602,1610],256],64567:[[1603,1575],256],64568:[[1603,1580],256],64569:[[1603,1581],256],64570:[[1603,1582],256],64571:[[1603,1604],256],64572:[[1603,1605],256],64573:[[1603,1609],256],64574:[[1603,1610],256],64575:[[1604,1580],256],64576:[[1604,1581],256],64577:[[1604,1582],256],64578:[[1604,1605],256],64579:[[1604,1609],256],64580:[[1604,1610],256],64581:[[1605,1580],256],64582:[[1605,1581],256],64583:[[1605,1582],256],64584:[[1605,1605],256],64585:[[1605,1609],256],64586:[[1605,1610],256],64587:[[1606,1580],256],64588:[[1606,1581],256],64589:[[1606,1582],256],64590:[[1606,1605],256],64591:[[1606,1609],256],64592:[[1606,1610],256],64593:[[1607,1580],256],64594:[[1607,1605],256],64595:[[1607,1609],256],64596:[[1607,1610],256],64597:[[1610,1580],256],64598:[[1610,1581],256],64599:[[1610,1582],256],64600:[[1610,1605],256],64601:[[1610,1609],256],64602:[[1610,1610],256],64603:[[1584,1648],256],64604:[[1585,1648],256],64605:[[1609,1648],256],64606:[[32,1612,1617],256],64607:[[32,1613,1617],256],64608:[[32,1614,1617],256],64609:[[32,1615,1617],256],64610:[[32,1616,1617],256],64611:[[32,1617,1648],256],64612:[[1574,1585],256],64613:[[1574,1586],256],64614:[[1574,1605],256],64615:[[1574,1606],256],64616:[[1574,1609],256],64617:[[1574,1610],256],64618:[[1576,1585],256],64619:[[1576,1586],256],64620:[[1576,1605],256],64621:[[1576,1606],256],64622:[[1576,1609],256],64623:[[1576,1610],256],64624:[[1578,1585],256],64625:[[1578,1586],256],64626:[[1578,1605],256],64627:[[1578,1606],256],64628:[[1578,1609],256],64629:[[1578,1610],256],64630:[[1579,1585],256],64631:[[1579,1586],256],64632:[[1579,1605],256],64633:[[1579,1606],256],64634:[[1579,1609],256],64635:[[1579,1610],256],64636:[[1601,1609],256],64637:[[1601,1610],256],64638:[[1602,1609],256],64639:[[1602,1610],256],64640:[[1603,1575],256],64641:[[1603,1604],256],64642:[[1603,1605],256],64643:[[1603,1609],256],64644:[[1603,1610],256],64645:[[1604,1605],256],64646:[[1604,1609],256],64647:[[1604,1610],256],64648:[[1605,1575],256],64649:[[1605,1605],256],64650:[[1606,1585],256],64651:[[1606,1586],256],64652:[[1606,1605],256],64653:[[1606,1606],256],64654:[[1606,1609],256],64655:[[1606,1610],256],64656:[[1609,1648],256],64657:[[1610,1585],256],64658:[[1610,1586],256],64659:[[1610,1605],256],64660:[[1610,1606],256],64661:[[1610,1609],256],64662:[[1610,1610],256],64663:[[1574,1580],256],64664:[[1574,1581],256],64665:[[1574,1582],256],64666:[[1574,1605],256],64667:[[1574,1607],256],64668:[[1576,1580],256],64669:[[1576,1581],256],64670:[[1576,1582],256],64671:[[1576,1605],256],64672:[[1576,1607],256],64673:[[1578,1580],256],64674:[[1578,1581],256],64675:[[1578,1582],256],64676:[[1578,1605],256],64677:[[1578,1607],256],64678:[[1579,1605],256],64679:[[1580,1581],256],64680:[[1580,1605],256],64681:[[1581,1580],256],64682:[[1581,1605],256],64683:[[1582,1580],256],64684:[[1582,1605],256],64685:[[1587,1580],256],64686:[[1587,1581],256],64687:[[1587,1582],256],64688:[[1587,1605],256],64689:[[1589,1581],256],64690:[[1589,1582],256],64691:[[1589,1605],256],64692:[[1590,1580],256],64693:[[1590,1581],256],64694:[[1590,1582],256],64695:[[1590,1605],256],64696:[[1591,1581],256],64697:[[1592,1605],256],64698:[[1593,1580],256],64699:[[1593,1605],256],64700:[[1594,1580],256],64701:[[1594,1605],256],64702:[[1601,1580],256],64703:[[1601,1581],256],64704:[[1601,1582],256],64705:[[1601,1605],256],64706:[[1602,1581],256],64707:[[1602,1605],256],64708:[[1603,1580],256],64709:[[1603,1581],256],64710:[[1603,1582],256],64711:[[1603,1604],256],64712:[[1603,1605],256],64713:[[1604,1580],256],64714:[[1604,1581],256],64715:[[1604,1582],256],64716:[[1604,1605],256],64717:[[1604,1607],256],64718:[[1605,1580],256],64719:[[1605,1581],256],64720:[[1605,1582],256],64721:[[1605,1605],256],64722:[[1606,1580],256],64723:[[1606,1581],256],64724:[[1606,1582],256],64725:[[1606,1605],256],64726:[[1606,1607],256],64727:[[1607,1580],256],64728:[[1607,1605],256],64729:[[1607,1648],256],64730:[[1610,1580],256],64731:[[1610,1581],256],64732:[[1610,1582],256],64733:[[1610,1605],256],64734:[[1610,1607],256],64735:[[1574,1605],256],64736:[[1574,1607],256],64737:[[1576,1605],256],64738:[[1576,1607],256],64739:[[1578,1605],256],64740:[[1578,1607],256],64741:[[1579,1605],256],64742:[[1579,1607],256],64743:[[1587,1605],256],64744:[[1587,1607],256],64745:[[1588,1605],256],64746:[[1588,1607],256],64747:[[1603,1604],256],64748:[[1603,1605],256],64749:[[1604,1605],256],64750:[[1606,1605],256],64751:[[1606,1607],256],64752:[[1610,1605],256],64753:[[1610,1607],256],64754:[[1600,1614,1617],256],64755:[[1600,1615,1617],256],64756:[[1600,1616,1617],256],64757:[[1591,1609],256],64758:[[1591,1610],256],64759:[[1593,1609],256],64760:[[1593,1610],256],64761:[[1594,1609],256],64762:[[1594,1610],256],64763:[[1587,1609],256],64764:[[1587,1610],256],64765:[[1588,1609],256],64766:[[1588,1610],256],64767:[[1581,1609],256]},
685164768:{64768:[[1581,1610],256],64769:[[1580,1609],256],64770:[[1580,1610],256],64771:[[1582,1609],256],64772:[[1582,1610],256],64773:[[1589,1609],256],64774:[[1589,1610],256],64775:[[1590,1609],256],64776:[[1590,1610],256],64777:[[1588,1580],256],64778:[[1588,1581],256],64779:[[1588,1582],256],64780:[[1588,1605],256],64781:[[1588,1585],256],64782:[[1587,1585],256],64783:[[1589,1585],256],64784:[[1590,1585],256],64785:[[1591,1609],256],64786:[[1591,1610],256],64787:[[1593,1609],256],64788:[[1593,1610],256],64789:[[1594,1609],256],64790:[[1594,1610],256],64791:[[1587,1609],256],64792:[[1587,1610],256],64793:[[1588,1609],256],64794:[[1588,1610],256],64795:[[1581,1609],256],64796:[[1581,1610],256],64797:[[1580,1609],256],64798:[[1580,1610],256],64799:[[1582,1609],256],64800:[[1582,1610],256],64801:[[1589,1609],256],64802:[[1589,1610],256],64803:[[1590,1609],256],64804:[[1590,1610],256],64805:[[1588,1580],256],64806:[[1588,1581],256],64807:[[1588,1582],256],64808:[[1588,1605],256],64809:[[1588,1585],256],64810:[[1587,1585],256],64811:[[1589,1585],256],64812:[[1590,1585],256],64813:[[1588,1580],256],64814:[[1588,1581],256],64815:[[1588,1582],256],64816:[[1588,1605],256],64817:[[1587,1607],256],64818:[[1588,1607],256],64819:[[1591,1605],256],64820:[[1587,1580],256],64821:[[1587,1581],256],64822:[[1587,1582],256],64823:[[1588,1580],256],64824:[[1588,1581],256],64825:[[1588,1582],256],64826:[[1591,1605],256],64827:[[1592,1605],256],64828:[[1575,1611],256],64829:[[1575,1611],256],64848:[[1578,1580,1605],256],64849:[[1578,1581,1580],256],64850:[[1578,1581,1580],256],64851:[[1578,1581,1605],256],64852:[[1578,1582,1605],256],64853:[[1578,1605,1580],256],64854:[[1578,1605,1581],256],64855:[[1578,1605,1582],256],64856:[[1580,1605,1581],256],64857:[[1580,1605,1581],256],64858:[[1581,1605,1610],256],64859:[[1581,1605,1609],256],64860:[[1587,1581,1580],256],64861:[[1587,1580,1581],256],64862:[[1587,1580,1609],256],64863:[[1587,1605,1581],256],64864:[[1587,1605,1581],256],64865:[[1587,1605,1580],256],64866:[[1587,1605,1605],256],64867:[[1587,1605,1605],256],64868:[[1589,1581,1581],256],64869:[[1589,1581,1581],256],64870:[[1589,1605,1605],256],64871:[[1588,1581,1605],256],64872:[[1588,1581,1605],256],64873:[[1588,1580,1610],256],64874:[[1588,1605,1582],256],64875:[[1588,1605,1582],256],64876:[[1588,1605,1605],256],64877:[[1588,1605,1605],256],64878:[[1590,1581,1609],256],64879:[[1590,1582,1605],256],64880:[[1590,1582,1605],256],64881:[[1591,1605,1581],256],64882:[[1591,1605,1581],256],64883:[[1591,1605,1605],256],64884:[[1591,1605,1610],256],64885:[[1593,1580,1605],256],64886:[[1593,1605,1605],256],64887:[[1593,1605,1605],256],64888:[[1593,1605,1609],256],64889:[[1594,1605,1605],256],64890:[[1594,1605,1610],256],64891:[[1594,1605,1609],256],64892:[[1601,1582,1605],256],64893:[[1601,1582,1605],256],64894:[[1602,1605,1581],256],64895:[[1602,1605,1605],256],64896:[[1604,1581,1605],256],64897:[[1604,1581,1610],256],64898:[[1604,1581,1609],256],64899:[[1604,1580,1580],256],64900:[[1604,1580,1580],256],64901:[[1604,1582,1605],256],64902:[[1604,1582,1605],256],64903:[[1604,1605,1581],256],64904:[[1604,1605,1581],256],64905:[[1605,1581,1580],256],64906:[[1605,1581,1605],256],64907:[[1605,1581,1610],256],64908:[[1605,1580,1581],256],64909:[[1605,1580,1605],256],64910:[[1605,1582,1580],256],64911:[[1605,1582,1605],256],64914:[[1605,1580,1582],256],64915:[[1607,1605,1580],256],64916:[[1607,1605,1605],256],64917:[[1606,1581,1605],256],64918:[[1606,1581,1609],256],64919:[[1606,1580,1605],256],64920:[[1606,1580,1605],256],64921:[[1606,1580,1609],256],64922:[[1606,1605,1610],256],64923:[[1606,1605,1609],256],64924:[[1610,1605,1605],256],64925:[[1610,1605,1605],256],64926:[[1576,1582,1610],256],64927:[[1578,1580,1610],256],64928:[[1578,1580,1609],256],64929:[[1578,1582,1610],256],64930:[[1578,1582,1609],256],64931:[[1578,1605,1610],256],64932:[[1578,1605,1609],256],64933:[[1580,1605,1610],256],64934:[[1580,1581,1609],256],64935:[[1580,1605,1609],256],64936:[[1587,1582,1609],256],64937:[[1589,1581,1610],256],64938:[[1588,1581,1610],256],64939:[[1590,1581,1610],256],64940:[[1604,1580,1610],256],64941:[[1604,1605,1610],256],64942:[[1610,1581,1610],256],64943:[[1610,1580,1610],256],64944:[[1610,1605,1610],256],64945:[[1605,1605,1610],256],64946:[[1602,1605,1610],256],64947:[[1606,1581,1610],256],64948:[[1602,1605,1581],256],64949:[[1604,1581,1605],256],64950:[[1593,1605,1610],256],64951:[[1603,1605,1610],256],64952:[[1606,1580,1581],256],64953:[[1605,1582,1610],256],64954:[[1604,1580,1605],256],64955:[[1603,1605,1605],256],64956:[[1604,1580,1605],256],64957:[[1606,1580,1581],256],64958:[[1580,1581,1610],256],64959:[[1581,1580,1610],256],64960:[[1605,1580,1610],256],64961:[[1601,1605,1610],256],64962:[[1576,1581,1610],256],64963:[[1603,1605,1605],256],64964:[[1593,1580,1605],256],64965:[[1589,1605,1605],256],64966:[[1587,1582,1610],256],64967:[[1606,1580,1610],256],65008:[[1589,1604,1746],256],65009:[[1602,1604,1746],256],65010:[[1575,1604,1604,1607],256],65011:[[1575,1603,1576,1585],256],65012:[[1605,1581,1605,1583],256],65013:[[1589,1604,1593,1605],256],65014:[[1585,1587,1608,1604],256],65015:[[1593,1604,1610,1607],256],65016:[[1608,1587,1604,1605],256],65017:[[1589,1604,1609],256],65018:[[1589,1604,1609,32,1575,1604,1604,1607,32,1593,1604,1610,1607,32,1608,1587,1604,1605],256],65019:[[1580,1604,32,1580,1604,1575,1604,1607],256],65020:[[1585,1740,1575,1604],256]},
685265024:{65040:[[44],256],65041:[[12289],256],65042:[[12290],256],65043:[[58],256],65044:[[59],256],65045:[[33],256],65046:[[63],256],65047:[[12310],256],65048:[[12311],256],65049:[[8230],256],65056:[,230],65057:[,230],65058:[,230],65059:[,230],65060:[,230],65061:[,230],65062:[,230],65063:[,220],65064:[,220],65065:[,220],65066:[,220],65067:[,220],65068:[,220],65069:[,220],65072:[[8229],256],65073:[[8212],256],65074:[[8211],256],65075:[[95],256],65076:[[95],256],65077:[[40],256],65078:[[41],256],65079:[[123],256],65080:[[125],256],65081:[[12308],256],65082:[[12309],256],65083:[[12304],256],65084:[[12305],256],65085:[[12298],256],65086:[[12299],256],65087:[[12296],256],65088:[[12297],256],65089:[[12300],256],65090:[[12301],256],65091:[[12302],256],65092:[[12303],256],65095:[[91],256],65096:[[93],256],65097:[[8254],256],65098:[[8254],256],65099:[[8254],256],65100:[[8254],256],65101:[[95],256],65102:[[95],256],65103:[[95],256],65104:[[44],256],65105:[[12289],256],65106:[[46],256],65108:[[59],256],65109:[[58],256],65110:[[63],256],65111:[[33],256],65112:[[8212],256],65113:[[40],256],65114:[[41],256],65115:[[123],256],65116:[[125],256],65117:[[12308],256],65118:[[12309],256],65119:[[35],256],65120:[[38],256],65121:[[42],256],65122:[[43],256],65123:[[45],256],65124:[[60],256],65125:[[62],256],65126:[[61],256],65128:[[92],256],65129:[[36],256],65130:[[37],256],65131:[[64],256],65136:[[32,1611],256],65137:[[1600,1611],256],65138:[[32,1612],256],65140:[[32,1613],256],65142:[[32,1614],256],65143:[[1600,1614],256],65144:[[32,1615],256],65145:[[1600,1615],256],65146:[[32,1616],256],65147:[[1600,1616],256],65148:[[32,1617],256],65149:[[1600,1617],256],65150:[[32,1618],256],65151:[[1600,1618],256],65152:[[1569],256],65153:[[1570],256],65154:[[1570],256],65155:[[1571],256],65156:[[1571],256],65157:[[1572],256],65158:[[1572],256],65159:[[1573],256],65160:[[1573],256],65161:[[1574],256],65162:[[1574],256],65163:[[1574],256],65164:[[1574],256],65165:[[1575],256],65166:[[1575],256],65167:[[1576],256],65168:[[1576],256],65169:[[1576],256],65170:[[1576],256],65171:[[1577],256],65172:[[1577],256],65173:[[1578],256],65174:[[1578],256],65175:[[1578],256],65176:[[1578],256],65177:[[1579],256],65178:[[1579],256],65179:[[1579],256],65180:[[1579],256],65181:[[1580],256],65182:[[1580],256],65183:[[1580],256],65184:[[1580],256],65185:[[1581],256],65186:[[1581],256],65187:[[1581],256],65188:[[1581],256],65189:[[1582],256],65190:[[1582],256],65191:[[1582],256],65192:[[1582],256],65193:[[1583],256],65194:[[1583],256],65195:[[1584],256],65196:[[1584],256],65197:[[1585],256],65198:[[1585],256],65199:[[1586],256],65200:[[1586],256],65201:[[1587],256],65202:[[1587],256],65203:[[1587],256],65204:[[1587],256],65205:[[1588],256],65206:[[1588],256],65207:[[1588],256],65208:[[1588],256],65209:[[1589],256],65210:[[1589],256],65211:[[1589],256],65212:[[1589],256],65213:[[1590],256],65214:[[1590],256],65215:[[1590],256],65216:[[1590],256],65217:[[1591],256],65218:[[1591],256],65219:[[1591],256],65220:[[1591],256],65221:[[1592],256],65222:[[1592],256],65223:[[1592],256],65224:[[1592],256],65225:[[1593],256],65226:[[1593],256],65227:[[1593],256],65228:[[1593],256],65229:[[1594],256],65230:[[1594],256],65231:[[1594],256],65232:[[1594],256],65233:[[1601],256],65234:[[1601],256],65235:[[1601],256],65236:[[1601],256],65237:[[1602],256],65238:[[1602],256],65239:[[1602],256],65240:[[1602],256],65241:[[1603],256],65242:[[1603],256],65243:[[1603],256],65244:[[1603],256],65245:[[1604],256],65246:[[1604],256],65247:[[1604],256],65248:[[1604],256],65249:[[1605],256],65250:[[1605],256],65251:[[1605],256],65252:[[1605],256],65253:[[1606],256],65254:[[1606],256],65255:[[1606],256],65256:[[1606],256],65257:[[1607],256],65258:[[1607],256],65259:[[1607],256],65260:[[1607],256],65261:[[1608],256],65262:[[1608],256],65263:[[1609],256],65264:[[1609],256],65265:[[1610],256],65266:[[1610],256],65267:[[1610],256],65268:[[1610],256],65269:[[1604,1570],256],65270:[[1604,1570],256],65271:[[1604,1571],256],65272:[[1604,1571],256],65273:[[1604,1573],256],65274:[[1604,1573],256],65275:[[1604,1575],256],65276:[[1604,1575],256]},
685365280:{65281:[[33],256],65282:[[34],256],65283:[[35],256],65284:[[36],256],65285:[[37],256],65286:[[38],256],65287:[[39],256],65288:[[40],256],65289:[[41],256],65290:[[42],256],65291:[[43],256],65292:[[44],256],65293:[[45],256],65294:[[46],256],65295:[[47],256],65296:[[48],256],65297:[[49],256],65298:[[50],256],65299:[[51],256],65300:[[52],256],65301:[[53],256],65302:[[54],256],65303:[[55],256],65304:[[56],256],65305:[[57],256],65306:[[58],256],65307:[[59],256],65308:[[60],256],65309:[[61],256],65310:[[62],256],65311:[[63],256],65312:[[64],256],65313:[[65],256],65314:[[66],256],65315:[[67],256],65316:[[68],256],65317:[[69],256],65318:[[70],256],65319:[[71],256],65320:[[72],256],65321:[[73],256],65322:[[74],256],65323:[[75],256],65324:[[76],256],65325:[[77],256],65326:[[78],256],65327:[[79],256],65328:[[80],256],65329:[[81],256],65330:[[82],256],65331:[[83],256],65332:[[84],256],65333:[[85],256],65334:[[86],256],65335:[[87],256],65336:[[88],256],65337:[[89],256],65338:[[90],256],65339:[[91],256],65340:[[92],256],65341:[[93],256],65342:[[94],256],65343:[[95],256],65344:[[96],256],65345:[[97],256],65346:[[98],256],65347:[[99],256],65348:[[100],256],65349:[[101],256],65350:[[102],256],65351:[[103],256],65352:[[104],256],65353:[[105],256],65354:[[106],256],65355:[[107],256],65356:[[108],256],65357:[[109],256],65358:[[110],256],65359:[[111],256],65360:[[112],256],65361:[[113],256],65362:[[114],256],65363:[[115],256],65364:[[116],256],65365:[[117],256],65366:[[118],256],65367:[[119],256],65368:[[120],256],65369:[[121],256],65370:[[122],256],65371:[[123],256],65372:[[124],256],65373:[[125],256],65374:[[126],256],65375:[[10629],256],65376:[[10630],256],65377:[[12290],256],65378:[[12300],256],65379:[[12301],256],65380:[[12289],256],65381:[[12539],256],65382:[[12530],256],65383:[[12449],256],65384:[[12451],256],65385:[[12453],256],65386:[[12455],256],65387:[[12457],256],65388:[[12515],256],65389:[[12517],256],65390:[[12519],256],65391:[[12483],256],65392:[[12540],256],65393:[[12450],256],65394:[[12452],256],65395:[[12454],256],65396:[[12456],256],65397:[[12458],256],65398:[[12459],256],65399:[[12461],256],65400:[[12463],256],65401:[[12465],256],65402:[[12467],256],65403:[[12469],256],65404:[[12471],256],65405:[[12473],256],65406:[[12475],256],65407:[[12477],256],65408:[[12479],256],65409:[[12481],256],65410:[[12484],256],65411:[[12486],256],65412:[[12488],256],65413:[[12490],256],65414:[[12491],256],65415:[[12492],256],65416:[[12493],256],65417:[[12494],256],65418:[[12495],256],65419:[[12498],256],65420:[[12501],256],65421:[[12504],256],65422:[[12507],256],65423:[[12510],256],65424:[[12511],256],65425:[[12512],256],65426:[[12513],256],65427:[[12514],256],65428:[[12516],256],65429:[[12518],256],65430:[[12520],256],65431:[[12521],256],65432:[[12522],256],65433:[[12523],256],65434:[[12524],256],65435:[[12525],256],65436:[[12527],256],65437:[[12531],256],65438:[[12441],256],65439:[[12442],256],65440:[[12644],256],65441:[[12593],256],65442:[[12594],256],65443:[[12595],256],65444:[[12596],256],65445:[[12597],256],65446:[[12598],256],65447:[[12599],256],65448:[[12600],256],65449:[[12601],256],65450:[[12602],256],65451:[[12603],256],65452:[[12604],256],65453:[[12605],256],65454:[[12606],256],65455:[[12607],256],65456:[[12608],256],65457:[[12609],256],65458:[[12610],256],65459:[[12611],256],65460:[[12612],256],65461:[[12613],256],65462:[[12614],256],65463:[[12615],256],65464:[[12616],256],65465:[[12617],256],65466:[[12618],256],65467:[[12619],256],65468:[[12620],256],65469:[[12621],256],65470:[[12622],256],65474:[[12623],256],65475:[[12624],256],65476:[[12625],256],65477:[[12626],256],65478:[[12627],256],65479:[[12628],256],65482:[[12629],256],65483:[[12630],256],65484:[[12631],256],65485:[[12632],256],65486:[[12633],256],65487:[[12634],256],65490:[[12635],256],65491:[[12636],256],65492:[[12637],256],65493:[[12638],256],65494:[[12639],256],65495:[[12640],256],65498:[[12641],256],65499:[[12642],256],65500:[[12643],256],65504:[[162],256],65505:[[163],256],65506:[[172],256],65507:[[175],256],65508:[[166],256],65509:[[165],256],65510:[[8361],256],65512:[[9474],256],65513:[[8592],256],65514:[[8593],256],65515:[[8594],256],65516:[[8595],256],65517:[[9632],256],65518:[[9675],256]}
6854
6855};
6856
6857 /***** Module to export */
6858 var unorm = {
6859 nfc: nfc,
6860 nfd: nfd,
6861 nfkc: nfkc,
6862 nfkd: nfkd
6863 };
6864
6865 /*globals module:true,define:true*/
6866
6867 // CommonJS
6868 if (typeof module === "object") {
6869 module.exports = unorm;
6870
6871 // AMD
6872 } else if (typeof define === "function" && define.amd) {
6873 define("unorm", function () {
6874 return unorm;
6875 });
6876
6877 // Global
6878 } else {
6879 root.unorm = unorm;
6880 }
6881
6882 /***** Export as shim for String::normalize method *****/
6883 /*
6884 http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts#november_8_2013_draft_rev_21
6885
6886 21.1.3.12 String.prototype.normalize(form="NFC")
6887 When the normalize method is called with one argument form, the following steps are taken:
6888
6889 1. Let O be CheckObjectCoercible(this value).
6890 2. Let S be ToString(O).
6891 3. ReturnIfAbrupt(S).
6892 4. If form is not provided or undefined let form be "NFC".
6893 5. Let f be ToString(form).
6894 6. ReturnIfAbrupt(f).
6895 7. If f is not one of "NFC", "NFD", "NFKC", or "NFKD", then throw a RangeError Exception.
6896 8. Let ns be the String value is the result of normalizing S into the normalization form named by f as specified in Unicode Standard Annex #15, UnicodeNormalizatoin Forms.
6897 9. Return ns.
6898
6899 The length property of the normalize method is 0.
6900
6901 *NOTE* The normalize function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method.
6902 */
6903 unorm.shimApplied = false;
6904
6905 if (!String.prototype.normalize) {
6906 String.prototype.normalize = function(form) {
6907 var str = "" + this;
6908 form = form === undefined ? "NFC" : form;
6909
6910 if (form === "NFC") {
6911 return unorm.nfc(str);
6912 } else if (form === "NFD") {
6913 return unorm.nfd(str);
6914 } else if (form === "NFKC") {
6915 return unorm.nfkc(str);
6916 } else if (form === "NFKD") {
6917 return unorm.nfkd(str);
6918 } else {
6919 throw new RangeError("Invalid normalization form: " + form);
6920 }
6921 };
6922
6923 unorm.shimApplied = true;
6924 }
6925}(this));
6926</script>
658 <script>/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */ 6927 <script>/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
659!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) 6928!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)
660},_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)) 6929},_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))
@@ -13637,6 +19906,16 @@ bitcoin.networks.dash = {
13637 wif: 0xcc, 19906 wif: 0xcc,
13638}; 19907};
13639 19908
19909bitcoin.networks.game = {
19910 bip32: {
19911 public: 0x0488b21e,
19912 private: 0x0488ade4
19913 },
19914 pubKeyHash: 0x26,
19915 scriptHash: 0x05,
19916 wif: 0xa6,
19917};
19918
13640bitcoin.networks.namecoin = { 19919bitcoin.networks.namecoin = {
13641 bip32: { 19920 bip32: {
13642 public: 0x0488b21e, 19921 public: 0x0488b21e,
@@ -13658,6 +19937,18779 @@ bitcoin.networks.peercoin = {
13658}; 19937};
13659 19938
13660</script> 19939</script>
19940 <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.ethUtil = 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){
19941(function (global){
19942'use strict';
19943
19944// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
19945// original notice:
19946
19947/*!
19948 * The buffer module from node.js, for the browser.
19949 *
19950 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
19951 * @license MIT
19952 */
19953function compare(a, b) {
19954 if (a === b) {
19955 return 0;
19956 }
19957
19958 var x = a.length;
19959 var y = b.length;
19960
19961 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
19962 if (a[i] !== b[i]) {
19963 x = a[i];
19964 y = b[i];
19965 break;
19966 }
19967 }
19968
19969 if (x < y) {
19970 return -1;
19971 }
19972 if (y < x) {
19973 return 1;
19974 }
19975 return 0;
19976}
19977function isBuffer(b) {
19978 if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
19979 return global.Buffer.isBuffer(b);
19980 }
19981 return !!(b != null && b._isBuffer);
19982}
19983
19984// based on node assert, original notice:
19985
19986// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
19987//
19988// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
19989//
19990// Originally from narwhal.js (http://narwhaljs.org)
19991// Copyright (c) 2009 Thomas Robinson <280north.com>
19992//
19993// Permission is hereby granted, free of charge, to any person obtaining a copy
19994// of this software and associated documentation files (the 'Software'), to
19995// deal in the Software without restriction, including without limitation the
19996// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
19997// sell copies of the Software, and to permit persons to whom the Software is
19998// furnished to do so, subject to the following conditions:
19999//
20000// The above copyright notice and this permission notice shall be included in
20001// all copies or substantial portions of the Software.
20002//
20003// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20004// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20005// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20006// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20007// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20008// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20009
20010var util = require('util/');
20011var hasOwn = Object.prototype.hasOwnProperty;
20012var pSlice = Array.prototype.slice;
20013var functionsHaveNames = (function () {
20014 return function foo() {}.name === 'foo';
20015}());
20016function pToString (obj) {
20017 return Object.prototype.toString.call(obj);
20018}
20019function isView(arrbuf) {
20020 if (isBuffer(arrbuf)) {
20021 return false;
20022 }
20023 if (typeof global.ArrayBuffer !== 'function') {
20024 return false;
20025 }
20026 if (typeof ArrayBuffer.isView === 'function') {
20027 return ArrayBuffer.isView(arrbuf);
20028 }
20029 if (!arrbuf) {
20030 return false;
20031 }
20032 if (arrbuf instanceof DataView) {
20033 return true;
20034 }
20035 if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
20036 return true;
20037 }
20038 return false;
20039}
20040// 1. The assert module provides functions that throw
20041// AssertionError's when particular conditions are not met. The
20042// assert module must conform to the following interface.
20043
20044var assert = module.exports = ok;
20045
20046// 2. The AssertionError is defined in assert.
20047// new assert.AssertionError({ message: message,
20048// actual: actual,
20049// expected: expected })
20050
20051var regex = /\s*function\s+([^\(\s]*)\s*/;
20052// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
20053function getName(func) {
20054 if (!util.isFunction(func)) {
20055 return;
20056 }
20057 if (functionsHaveNames) {
20058 return func.name;
20059 }
20060 var str = func.toString();
20061 var match = str.match(regex);
20062 return match && match[1];
20063}
20064assert.AssertionError = function AssertionError(options) {
20065 this.name = 'AssertionError';
20066 this.actual = options.actual;
20067 this.expected = options.expected;
20068 this.operator = options.operator;
20069 if (options.message) {
20070 this.message = options.message;
20071 this.generatedMessage = false;
20072 } else {
20073 this.message = getMessage(this);
20074 this.generatedMessage = true;
20075 }
20076 var stackStartFunction = options.stackStartFunction || fail;
20077 if (Error.captureStackTrace) {
20078 Error.captureStackTrace(this, stackStartFunction);
20079 } else {
20080 // non v8 browsers so we can have a stacktrace
20081 var err = new Error();
20082 if (err.stack) {
20083 var out = err.stack;
20084
20085 // try to strip useless frames
20086 var fn_name = getName(stackStartFunction);
20087 var idx = out.indexOf('\n' + fn_name);
20088 if (idx >= 0) {
20089 // once we have located the function frame
20090 // we need to strip out everything before it (and its line)
20091 var next_line = out.indexOf('\n', idx + 1);
20092 out = out.substring(next_line + 1);
20093 }
20094
20095 this.stack = out;
20096 }
20097 }
20098};
20099
20100// assert.AssertionError instanceof Error
20101util.inherits(assert.AssertionError, Error);
20102
20103function truncate(s, n) {
20104 if (typeof s === 'string') {
20105 return s.length < n ? s : s.slice(0, n);
20106 } else {
20107 return s;
20108 }
20109}
20110function inspect(something) {
20111 if (functionsHaveNames || !util.isFunction(something)) {
20112 return util.inspect(something);
20113 }
20114 var rawname = getName(something);
20115 var name = rawname ? ': ' + rawname : '';
20116 return '[Function' + name + ']';
20117}
20118function getMessage(self) {
20119 return truncate(inspect(self.actual), 128) + ' ' +
20120 self.operator + ' ' +
20121 truncate(inspect(self.expected), 128);
20122}
20123
20124// At present only the three keys mentioned above are used and
20125// understood by the spec. Implementations or sub modules can pass
20126// other keys to the AssertionError's constructor - they will be
20127// ignored.
20128
20129// 3. All of the following functions must throw an AssertionError
20130// when a corresponding condition is not met, with a message that
20131// may be undefined if not provided. All assertion methods provide
20132// both the actual and expected values to the assertion error for
20133// display purposes.
20134
20135function fail(actual, expected, message, operator, stackStartFunction) {
20136 throw new assert.AssertionError({
20137 message: message,
20138 actual: actual,
20139 expected: expected,
20140 operator: operator,
20141 stackStartFunction: stackStartFunction
20142 });
20143}
20144
20145// EXTENSION! allows for well behaved errors defined elsewhere.
20146assert.fail = fail;
20147
20148// 4. Pure assertion tests whether a value is truthy, as determined
20149// by !!guard.
20150// assert.ok(guard, message_opt);
20151// This statement is equivalent to assert.equal(true, !!guard,
20152// message_opt);. To test strictly for the value true, use
20153// assert.strictEqual(true, guard, message_opt);.
20154
20155function ok(value, message) {
20156 if (!value) fail(value, true, message, '==', assert.ok);
20157}
20158assert.ok = ok;
20159
20160// 5. The equality assertion tests shallow, coercive equality with
20161// ==.
20162// assert.equal(actual, expected, message_opt);
20163
20164assert.equal = function equal(actual, expected, message) {
20165 if (actual != expected) fail(actual, expected, message, '==', assert.equal);
20166};
20167
20168// 6. The non-equality assertion tests for whether two objects are not equal
20169// with != assert.notEqual(actual, expected, message_opt);
20170
20171assert.notEqual = function notEqual(actual, expected, message) {
20172 if (actual == expected) {
20173 fail(actual, expected, message, '!=', assert.notEqual);
20174 }
20175};
20176
20177// 7. The equivalence assertion tests a deep equality relation.
20178// assert.deepEqual(actual, expected, message_opt);
20179
20180assert.deepEqual = function deepEqual(actual, expected, message) {
20181 if (!_deepEqual(actual, expected, false)) {
20182 fail(actual, expected, message, 'deepEqual', assert.deepEqual);
20183 }
20184};
20185
20186assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
20187 if (!_deepEqual(actual, expected, true)) {
20188 fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
20189 }
20190};
20191
20192function _deepEqual(actual, expected, strict, memos) {
20193 // 7.1. All identical values are equivalent, as determined by ===.
20194 if (actual === expected) {
20195 return true;
20196 } else if (isBuffer(actual) && isBuffer(expected)) {
20197 return compare(actual, expected) === 0;
20198
20199 // 7.2. If the expected value is a Date object, the actual value is
20200 // equivalent if it is also a Date object that refers to the same time.
20201 } else if (util.isDate(actual) && util.isDate(expected)) {
20202 return actual.getTime() === expected.getTime();
20203
20204 // 7.3 If the expected value is a RegExp object, the actual value is
20205 // equivalent if it is also a RegExp object with the same source and
20206 // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
20207 } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
20208 return actual.source === expected.source &&
20209 actual.global === expected.global &&
20210 actual.multiline === expected.multiline &&
20211 actual.lastIndex === expected.lastIndex &&
20212 actual.ignoreCase === expected.ignoreCase;
20213
20214 // 7.4. Other pairs that do not both pass typeof value == 'object',
20215 // equivalence is determined by ==.
20216 } else if ((actual === null || typeof actual !== 'object') &&
20217 (expected === null || typeof expected !== 'object')) {
20218 return strict ? actual === expected : actual == expected;
20219
20220 // If both values are instances of typed arrays, wrap their underlying
20221 // ArrayBuffers in a Buffer each to increase performance
20222 // This optimization requires the arrays to have the same type as checked by
20223 // Object.prototype.toString (aka pToString). Never perform binary
20224 // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
20225 // bit patterns are not identical.
20226 } else if (isView(actual) && isView(expected) &&
20227 pToString(actual) === pToString(expected) &&
20228 !(actual instanceof Float32Array ||
20229 actual instanceof Float64Array)) {
20230 return compare(new Uint8Array(actual.buffer),
20231 new Uint8Array(expected.buffer)) === 0;
20232
20233 // 7.5 For all other Object pairs, including Array objects, equivalence is
20234 // determined by having the same number of owned properties (as verified
20235 // with Object.prototype.hasOwnProperty.call), the same set of keys
20236 // (although not necessarily the same order), equivalent values for every
20237 // corresponding key, and an identical 'prototype' property. Note: this
20238 // accounts for both named and indexed properties on Arrays.
20239 } else if (isBuffer(actual) !== isBuffer(expected)) {
20240 return false;
20241 } else {
20242 memos = memos || {actual: [], expected: []};
20243
20244 var actualIndex = memos.actual.indexOf(actual);
20245 if (actualIndex !== -1) {
20246 if (actualIndex === memos.expected.indexOf(expected)) {
20247 return true;
20248 }
20249 }
20250
20251 memos.actual.push(actual);
20252 memos.expected.push(expected);
20253
20254 return objEquiv(actual, expected, strict, memos);
20255 }
20256}
20257
20258function isArguments(object) {
20259 return Object.prototype.toString.call(object) == '[object Arguments]';
20260}
20261
20262function objEquiv(a, b, strict, actualVisitedObjects) {
20263 if (a === null || a === undefined || b === null || b === undefined)
20264 return false;
20265 // if one is a primitive, the other must be same
20266 if (util.isPrimitive(a) || util.isPrimitive(b))
20267 return a === b;
20268 if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
20269 return false;
20270 var aIsArgs = isArguments(a);
20271 var bIsArgs = isArguments(b);
20272 if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
20273 return false;
20274 if (aIsArgs) {
20275 a = pSlice.call(a);
20276 b = pSlice.call(b);
20277 return _deepEqual(a, b, strict);
20278 }
20279 var ka = objectKeys(a);
20280 var kb = objectKeys(b);
20281 var key, i;
20282 // having the same number of owned properties (keys incorporates
20283 // hasOwnProperty)
20284 if (ka.length !== kb.length)
20285 return false;
20286 //the same set of keys (although not necessarily the same order),
20287 ka.sort();
20288 kb.sort();
20289 //~~~cheap key test
20290 for (i = ka.length - 1; i >= 0; i--) {
20291 if (ka[i] !== kb[i])
20292 return false;
20293 }
20294 //equivalent values for every corresponding key, and
20295 //~~~possibly expensive deep test
20296 for (i = ka.length - 1; i >= 0; i--) {
20297 key = ka[i];
20298 if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
20299 return false;
20300 }
20301 return true;
20302}
20303
20304// 8. The non-equivalence assertion tests for any deep inequality.
20305// assert.notDeepEqual(actual, expected, message_opt);
20306
20307assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
20308 if (_deepEqual(actual, expected, false)) {
20309 fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
20310 }
20311};
20312
20313assert.notDeepStrictEqual = notDeepStrictEqual;
20314function notDeepStrictEqual(actual, expected, message) {
20315 if (_deepEqual(actual, expected, true)) {
20316 fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
20317 }
20318}
20319
20320
20321// 9. The strict equality assertion tests strict equality, as determined by ===.
20322// assert.strictEqual(actual, expected, message_opt);
20323
20324assert.strictEqual = function strictEqual(actual, expected, message) {
20325 if (actual !== expected) {
20326 fail(actual, expected, message, '===', assert.strictEqual);
20327 }
20328};
20329
20330// 10. The strict non-equality assertion tests for strict inequality, as
20331// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
20332
20333assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
20334 if (actual === expected) {
20335 fail(actual, expected, message, '!==', assert.notStrictEqual);
20336 }
20337};
20338
20339function expectedException(actual, expected) {
20340 if (!actual || !expected) {
20341 return false;
20342 }
20343
20344 if (Object.prototype.toString.call(expected) == '[object RegExp]') {
20345 return expected.test(actual);
20346 }
20347
20348 try {
20349 if (actual instanceof expected) {
20350 return true;
20351 }
20352 } catch (e) {
20353 // Ignore. The instanceof check doesn't work for arrow functions.
20354 }
20355
20356 if (Error.isPrototypeOf(expected)) {
20357 return false;
20358 }
20359
20360 return expected.call({}, actual) === true;
20361}
20362
20363function _tryBlock(block) {
20364 var error;
20365 try {
20366 block();
20367 } catch (e) {
20368 error = e;
20369 }
20370 return error;
20371}
20372
20373function _throws(shouldThrow, block, expected, message) {
20374 var actual;
20375
20376 if (typeof block !== 'function') {
20377 throw new TypeError('"block" argument must be a function');
20378 }
20379
20380 if (typeof expected === 'string') {
20381 message = expected;
20382 expected = null;
20383 }
20384
20385 actual = _tryBlock(block);
20386
20387 message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
20388 (message ? ' ' + message : '.');
20389
20390 if (shouldThrow && !actual) {
20391 fail(actual, expected, 'Missing expected exception' + message);
20392 }
20393
20394 var userProvidedMessage = typeof message === 'string';
20395 var isUnwantedException = !shouldThrow && util.isError(actual);
20396 var isUnexpectedException = !shouldThrow && actual && !expected;
20397
20398 if ((isUnwantedException &&
20399 userProvidedMessage &&
20400 expectedException(actual, expected)) ||
20401 isUnexpectedException) {
20402 fail(actual, expected, 'Got unwanted exception' + message);
20403 }
20404
20405 if ((shouldThrow && actual && expected &&
20406 !expectedException(actual, expected)) || (!shouldThrow && actual)) {
20407 throw actual;
20408 }
20409}
20410
20411// 11. Expected to throw an error:
20412// assert.throws(block, Error_opt, message_opt);
20413
20414assert.throws = function(block, /*optional*/error, /*optional*/message) {
20415 _throws(true, block, error, message);
20416};
20417
20418// EXTENSION! This is annoying to write outside this module.
20419assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
20420 _throws(false, block, error, message);
20421};
20422
20423assert.ifError = function(err) { if (err) throw err; };
20424
20425var objectKeys = Object.keys || function (obj) {
20426 var keys = [];
20427 for (var key in obj) {
20428 if (hasOwn.call(obj, key)) keys.push(key);
20429 }
20430 return keys;
20431};
20432
20433}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
20434},{"util/":30}],2:[function(require,module,exports){
20435'use strict'
20436
20437exports.byteLength = byteLength
20438exports.toByteArray = toByteArray
20439exports.fromByteArray = fromByteArray
20440
20441var lookup = []
20442var revLookup = []
20443var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
20444
20445var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
20446for (var i = 0, len = code.length; i < len; ++i) {
20447 lookup[i] = code[i]
20448 revLookup[code.charCodeAt(i)] = i
20449}
20450
20451revLookup['-'.charCodeAt(0)] = 62
20452revLookup['_'.charCodeAt(0)] = 63
20453
20454function placeHoldersCount (b64) {
20455 var len = b64.length
20456 if (len % 4 > 0) {
20457 throw new Error('Invalid string. Length must be a multiple of 4')
20458 }
20459
20460 // the number of equal signs (place holders)
20461 // if there are two placeholders, than the two characters before it
20462 // represent one byte
20463 // if there is only one, then the three characters before it represent 2 bytes
20464 // this is just a cheap hack to not do indexOf twice
20465 return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
20466}
20467
20468function byteLength (b64) {
20469 // base64 is 4/3 + up to two characters of the original data
20470 return b64.length * 3 / 4 - placeHoldersCount(b64)
20471}
20472
20473function toByteArray (b64) {
20474 var i, j, l, tmp, placeHolders, arr
20475 var len = b64.length
20476 placeHolders = placeHoldersCount(b64)
20477
20478 arr = new Arr(len * 3 / 4 - placeHolders)
20479
20480 // if there are placeholders, only get up to the last complete 4 chars
20481 l = placeHolders > 0 ? len - 4 : len
20482
20483 var L = 0
20484
20485 for (i = 0, j = 0; i < l; i += 4, j += 3) {
20486 tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
20487 arr[L++] = (tmp >> 16) & 0xFF
20488 arr[L++] = (tmp >> 8) & 0xFF
20489 arr[L++] = tmp & 0xFF
20490 }
20491
20492 if (placeHolders === 2) {
20493 tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
20494 arr[L++] = tmp & 0xFF
20495 } else if (placeHolders === 1) {
20496 tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
20497 arr[L++] = (tmp >> 8) & 0xFF
20498 arr[L++] = tmp & 0xFF
20499 }
20500
20501 return arr
20502}
20503
20504function tripletToBase64 (num) {
20505 return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
20506}
20507
20508function encodeChunk (uint8, start, end) {
20509 var tmp
20510 var output = []
20511 for (var i = start; i < end; i += 3) {
20512 tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
20513 output.push(tripletToBase64(tmp))
20514 }
20515 return output.join('')
20516}
20517
20518function fromByteArray (uint8) {
20519 var tmp
20520 var len = uint8.length
20521 var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
20522 var output = ''
20523 var parts = []
20524 var maxChunkLength = 16383 // must be multiple of 3
20525
20526 // go through the array every three bytes, we'll deal with trailing stuff later
20527 for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
20528 parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
20529 }
20530
20531 // pad the end with zeros, but make sure to not forget the extra bytes
20532 if (extraBytes === 1) {
20533 tmp = uint8[len - 1]
20534 output += lookup[tmp >> 2]
20535 output += lookup[(tmp << 4) & 0x3F]
20536 output += '=='
20537 } else if (extraBytes === 2) {
20538 tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
20539 output += lookup[tmp >> 10]
20540 output += lookup[(tmp >> 4) & 0x3F]
20541 output += lookup[(tmp << 2) & 0x3F]
20542 output += '='
20543 }
20544
20545 parts.push(output)
20546
20547 return parts.join('')
20548}
20549
20550},{}],3:[function(require,module,exports){
20551
20552},{}],4:[function(require,module,exports){
20553(function (global){
20554'use strict';
20555
20556var buffer = require('buffer');
20557var Buffer = buffer.Buffer;
20558var SlowBuffer = buffer.SlowBuffer;
20559var MAX_LEN = buffer.kMaxLength || 2147483647;
20560exports.alloc = function alloc(size, fill, encoding) {
20561 if (typeof Buffer.alloc === 'function') {
20562 return Buffer.alloc(size, fill, encoding);
20563 }
20564 if (typeof encoding === 'number') {
20565 throw new TypeError('encoding must not be number');
20566 }
20567 if (typeof size !== 'number') {
20568 throw new TypeError('size must be a number');
20569 }
20570 if (size > MAX_LEN) {
20571 throw new RangeError('size is too large');
20572 }
20573 var enc = encoding;
20574 var _fill = fill;
20575 if (_fill === undefined) {
20576 enc = undefined;
20577 _fill = 0;
20578 }
20579 var buf = new Buffer(size);
20580 if (typeof _fill === 'string') {
20581 var fillBuf = new Buffer(_fill, enc);
20582 var flen = fillBuf.length;
20583 var i = -1;
20584 while (++i < size) {
20585 buf[i] = fillBuf[i % flen];
20586 }
20587 } else {
20588 buf.fill(_fill);
20589 }
20590 return buf;
20591}
20592exports.allocUnsafe = function allocUnsafe(size) {
20593 if (typeof Buffer.allocUnsafe === 'function') {
20594 return Buffer.allocUnsafe(size);
20595 }
20596 if (typeof size !== 'number') {
20597 throw new TypeError('size must be a number');
20598 }
20599 if (size > MAX_LEN) {
20600 throw new RangeError('size is too large');
20601 }
20602 return new Buffer(size);
20603}
20604exports.from = function from(value, encodingOrOffset, length) {
20605 if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
20606 return Buffer.from(value, encodingOrOffset, length);
20607 }
20608 if (typeof value === 'number') {
20609 throw new TypeError('"value" argument must not be a number');
20610 }
20611 if (typeof value === 'string') {
20612 return new Buffer(value, encodingOrOffset);
20613 }
20614 if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
20615 var offset = encodingOrOffset;
20616 if (arguments.length === 1) {
20617 return new Buffer(value);
20618 }
20619 if (typeof offset === 'undefined') {
20620 offset = 0;
20621 }
20622 var len = length;
20623 if (typeof len === 'undefined') {
20624 len = value.byteLength - offset;
20625 }
20626 if (offset >= value.byteLength) {
20627 throw new RangeError('\'offset\' is out of bounds');
20628 }
20629 if (len > value.byteLength - offset) {
20630 throw new RangeError('\'length\' is out of bounds');
20631 }
20632 return new Buffer(value.slice(offset, offset + len));
20633 }
20634 if (Buffer.isBuffer(value)) {
20635 var out = new Buffer(value.length);
20636 value.copy(out, 0, 0, value.length);
20637 return out;
20638 }
20639 if (value) {
20640 if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
20641 return new Buffer(value);
20642 }
20643 if (value.type === 'Buffer' && Array.isArray(value.data)) {
20644 return new Buffer(value.data);
20645 }
20646 }
20647
20648 throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
20649}
20650exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
20651 if (typeof Buffer.allocUnsafeSlow === 'function') {
20652 return Buffer.allocUnsafeSlow(size);
20653 }
20654 if (typeof size !== 'number') {
20655 throw new TypeError('size must be a number');
20656 }
20657 if (size >= MAX_LEN) {
20658 throw new RangeError('size is too large');
20659 }
20660 return new SlowBuffer(size);
20661}
20662
20663}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
20664},{"buffer":5}],5:[function(require,module,exports){
20665/*!
20666 * The buffer module from node.js, for the browser.
20667 *
20668 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
20669 * @license MIT
20670 */
20671/* eslint-disable no-proto */
20672
20673'use strict'
20674
20675var base64 = require('base64-js')
20676var ieee754 = require('ieee754')
20677
20678exports.Buffer = Buffer
20679exports.SlowBuffer = SlowBuffer
20680exports.INSPECT_MAX_BYTES = 50
20681
20682var K_MAX_LENGTH = 0x7fffffff
20683exports.kMaxLength = K_MAX_LENGTH
20684
20685/**
20686 * If `Buffer.TYPED_ARRAY_SUPPORT`:
20687 * === true Use Uint8Array implementation (fastest)
20688 * === false Print warning and recommend using `buffer` v4.x which has an Object
20689 * implementation (most compatible, even IE6)
20690 *
20691 * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
20692 * Opera 11.6+, iOS 4.2+.
20693 *
20694 * We report that the browser does not support typed arrays if the are not subclassable
20695 * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
20696 * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
20697 * for __proto__ and has a buggy typed array implementation.
20698 */
20699Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
20700
20701if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
20702 typeof console.error === 'function') {
20703 console.error(
20704 'This browser lacks typed array (Uint8Array) support which is required by ' +
20705 '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
20706 )
20707}
20708
20709function typedArraySupport () {
20710 // Can typed array instances can be augmented?
20711 try {
20712 var arr = new Uint8Array(1)
20713 arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
20714 return arr.foo() === 42
20715 } catch (e) {
20716 return false
20717 }
20718}
20719
20720function createBuffer (length) {
20721 if (length > K_MAX_LENGTH) {
20722 throw new RangeError('Invalid typed array length')
20723 }
20724 // Return an augmented `Uint8Array` instance
20725 var buf = new Uint8Array(length)
20726 buf.__proto__ = Buffer.prototype
20727 return buf
20728}
20729
20730/**
20731 * The Buffer constructor returns instances of `Uint8Array` that have their
20732 * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
20733 * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
20734 * and the `Uint8Array` methods. Square bracket notation works as expected -- it
20735 * returns a single octet.
20736 *
20737 * The `Uint8Array` prototype remains unmodified.
20738 */
20739
20740function Buffer (arg, encodingOrOffset, length) {
20741 // Common case.
20742 if (typeof arg === 'number') {
20743 if (typeof encodingOrOffset === 'string') {
20744 throw new Error(
20745 'If encoding is specified then the first argument must be a string'
20746 )
20747 }
20748 return allocUnsafe(arg)
20749 }
20750 return from(arg, encodingOrOffset, length)
20751}
20752
20753// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
20754if (typeof Symbol !== 'undefined' && Symbol.species &&
20755 Buffer[Symbol.species] === Buffer) {
20756 Object.defineProperty(Buffer, Symbol.species, {
20757 value: null,
20758 configurable: true,
20759 enumerable: false,
20760 writable: false
20761 })
20762}
20763
20764Buffer.poolSize = 8192 // not used by this implementation
20765
20766function from (value, encodingOrOffset, length) {
20767 if (typeof value === 'number') {
20768 throw new TypeError('"value" argument must not be a number')
20769 }
20770
20771 if (value instanceof ArrayBuffer) {
20772 return fromArrayBuffer(value, encodingOrOffset, length)
20773 }
20774
20775 if (typeof value === 'string') {
20776 return fromString(value, encodingOrOffset)
20777 }
20778
20779 return fromObject(value)
20780}
20781
20782/**
20783 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
20784 * if value is a number.
20785 * Buffer.from(str[, encoding])
20786 * Buffer.from(array)
20787 * Buffer.from(buffer)
20788 * Buffer.from(arrayBuffer[, byteOffset[, length]])
20789 **/
20790Buffer.from = function (value, encodingOrOffset, length) {
20791 return from(value, encodingOrOffset, length)
20792}
20793
20794// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
20795// https://github.com/feross/buffer/pull/148
20796Buffer.prototype.__proto__ = Uint8Array.prototype
20797Buffer.__proto__ = Uint8Array
20798
20799function assertSize (size) {
20800 if (typeof size !== 'number') {
20801 throw new TypeError('"size" argument must be a number')
20802 } else if (size < 0) {
20803 throw new RangeError('"size" argument must not be negative')
20804 }
20805}
20806
20807function alloc (size, fill, encoding) {
20808 assertSize(size)
20809 if (size <= 0) {
20810 return createBuffer(size)
20811 }
20812 if (fill !== undefined) {
20813 // Only pay attention to encoding if it's a string. This
20814 // prevents accidentally sending in a number that would
20815 // be interpretted as a start offset.
20816 return typeof encoding === 'string'
20817 ? createBuffer(size).fill(fill, encoding)
20818 : createBuffer(size).fill(fill)
20819 }
20820 return createBuffer(size)
20821}
20822
20823/**
20824 * Creates a new filled Buffer instance.
20825 * alloc(size[, fill[, encoding]])
20826 **/
20827Buffer.alloc = function (size, fill, encoding) {
20828 return alloc(size, fill, encoding)
20829}
20830
20831function allocUnsafe (size) {
20832 assertSize(size)
20833 return createBuffer(size < 0 ? 0 : checked(size) | 0)
20834}
20835
20836/**
20837 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
20838 * */
20839Buffer.allocUnsafe = function (size) {
20840 return allocUnsafe(size)
20841}
20842/**
20843 * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
20844 */
20845Buffer.allocUnsafeSlow = function (size) {
20846 return allocUnsafe(size)
20847}
20848
20849function fromString (string, encoding) {
20850 if (typeof encoding !== 'string' || encoding === '') {
20851 encoding = 'utf8'
20852 }
20853
20854 if (!Buffer.isEncoding(encoding)) {
20855 throw new TypeError('"encoding" must be a valid string encoding')
20856 }
20857
20858 var length = byteLength(string, encoding) | 0
20859 var buf = createBuffer(length)
20860
20861 var actual = buf.write(string, encoding)
20862
20863 if (actual !== length) {
20864 // Writing a hex string, for example, that contains invalid characters will
20865 // cause everything after the first invalid character to be ignored. (e.g.
20866 // 'abxxcd' will be treated as 'ab')
20867 buf = buf.slice(0, actual)
20868 }
20869
20870 return buf
20871}
20872
20873function fromArrayLike (array) {
20874 var length = array.length < 0 ? 0 : checked(array.length) | 0
20875 var buf = createBuffer(length)
20876 for (var i = 0; i < length; i += 1) {
20877 buf[i] = array[i] & 255
20878 }
20879 return buf
20880}
20881
20882function fromArrayBuffer (array, byteOffset, length) {
20883 if (byteOffset < 0 || array.byteLength < byteOffset) {
20884 throw new RangeError('\'offset\' is out of bounds')
20885 }
20886
20887 if (array.byteLength < byteOffset + (length || 0)) {
20888 throw new RangeError('\'length\' is out of bounds')
20889 }
20890
20891 var buf
20892 if (byteOffset === undefined && length === undefined) {
20893 buf = new Uint8Array(array)
20894 } else if (length === undefined) {
20895 buf = new Uint8Array(array, byteOffset)
20896 } else {
20897 buf = new Uint8Array(array, byteOffset, length)
20898 }
20899
20900 // Return an augmented `Uint8Array` instance
20901 buf.__proto__ = Buffer.prototype
20902 return buf
20903}
20904
20905function fromObject (obj) {
20906 if (Buffer.isBuffer(obj)) {
20907 var len = checked(obj.length) | 0
20908 var buf = createBuffer(len)
20909
20910 if (buf.length === 0) {
20911 return buf
20912 }
20913
20914 obj.copy(buf, 0, 0, len)
20915 return buf
20916 }
20917
20918 if (obj) {
20919 if (ArrayBuffer.isView(obj) || 'length' in obj) {
20920 if (typeof obj.length !== 'number' || isnan(obj.length)) {
20921 return createBuffer(0)
20922 }
20923 return fromArrayLike(obj)
20924 }
20925
20926 if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
20927 return fromArrayLike(obj.data)
20928 }
20929 }
20930
20931 throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
20932}
20933
20934function checked (length) {
20935 // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
20936 // length is NaN (which is otherwise coerced to zero.)
20937 if (length >= K_MAX_LENGTH) {
20938 throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
20939 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
20940 }
20941 return length | 0
20942}
20943
20944function SlowBuffer (length) {
20945 if (+length != length) { // eslint-disable-line eqeqeq
20946 length = 0
20947 }
20948 return Buffer.alloc(+length)
20949}
20950
20951Buffer.isBuffer = function isBuffer (b) {
20952 return b != null && b._isBuffer === true
20953}
20954
20955Buffer.compare = function compare (a, b) {
20956 if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
20957 throw new TypeError('Arguments must be Buffers')
20958 }
20959
20960 if (a === b) return 0
20961
20962 var x = a.length
20963 var y = b.length
20964
20965 for (var i = 0, len = Math.min(x, y); i < len; ++i) {
20966 if (a[i] !== b[i]) {
20967 x = a[i]
20968 y = b[i]
20969 break
20970 }
20971 }
20972
20973 if (x < y) return -1
20974 if (y < x) return 1
20975 return 0
20976}
20977
20978Buffer.isEncoding = function isEncoding (encoding) {
20979 switch (String(encoding).toLowerCase()) {
20980 case 'hex':
20981 case 'utf8':
20982 case 'utf-8':
20983 case 'ascii':
20984 case 'latin1':
20985 case 'binary':
20986 case 'base64':
20987 case 'ucs2':
20988 case 'ucs-2':
20989 case 'utf16le':
20990 case 'utf-16le':
20991 return true
20992 default:
20993 return false
20994 }
20995}
20996
20997Buffer.concat = function concat (list, length) {
20998 if (!Array.isArray(list)) {
20999 throw new TypeError('"list" argument must be an Array of Buffers')
21000 }
21001
21002 if (list.length === 0) {
21003 return Buffer.alloc(0)
21004 }
21005
21006 var i
21007 if (length === undefined) {
21008 length = 0
21009 for (i = 0; i < list.length; ++i) {
21010 length += list[i].length
21011 }
21012 }
21013
21014 var buffer = Buffer.allocUnsafe(length)
21015 var pos = 0
21016 for (i = 0; i < list.length; ++i) {
21017 var buf = list[i]
21018 if (!Buffer.isBuffer(buf)) {
21019 throw new TypeError('"list" argument must be an Array of Buffers')
21020 }
21021 buf.copy(buffer, pos)
21022 pos += buf.length
21023 }
21024 return buffer
21025}
21026
21027function byteLength (string, encoding) {
21028 if (Buffer.isBuffer(string)) {
21029 return string.length
21030 }
21031 if (ArrayBuffer.isView(string) || string instanceof ArrayBuffer) {
21032 return string.byteLength
21033 }
21034 if (typeof string !== 'string') {
21035 string = '' + string
21036 }
21037
21038 var len = string.length
21039 if (len === 0) return 0
21040
21041 // Use a for loop to avoid recursion
21042 var loweredCase = false
21043 for (;;) {
21044 switch (encoding) {
21045 case 'ascii':
21046 case 'latin1':
21047 case 'binary':
21048 return len
21049 case 'utf8':
21050 case 'utf-8':
21051 case undefined:
21052 return utf8ToBytes(string).length
21053 case 'ucs2':
21054 case 'ucs-2':
21055 case 'utf16le':
21056 case 'utf-16le':
21057 return len * 2
21058 case 'hex':
21059 return len >>> 1
21060 case 'base64':
21061 return base64ToBytes(string).length
21062 default:
21063 if (loweredCase) return utf8ToBytes(string).length // assume utf8
21064 encoding = ('' + encoding).toLowerCase()
21065 loweredCase = true
21066 }
21067 }
21068}
21069Buffer.byteLength = byteLength
21070
21071function slowToString (encoding, start, end) {
21072 var loweredCase = false
21073
21074 // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
21075 // property of a typed array.
21076
21077 // This behaves neither like String nor Uint8Array in that we set start/end
21078 // to their upper/lower bounds if the value passed is out of range.
21079 // undefined is handled specially as per ECMA-262 6th Edition,
21080 // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
21081 if (start === undefined || start < 0) {
21082 start = 0
21083 }
21084 // Return early if start > this.length. Done here to prevent potential uint32
21085 // coercion fail below.
21086 if (start > this.length) {
21087 return ''
21088 }
21089
21090 if (end === undefined || end > this.length) {
21091 end = this.length
21092 }
21093
21094 if (end <= 0) {
21095 return ''
21096 }
21097
21098 // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
21099 end >>>= 0
21100 start >>>= 0
21101
21102 if (end <= start) {
21103 return ''
21104 }
21105
21106 if (!encoding) encoding = 'utf8'
21107
21108 while (true) {
21109 switch (encoding) {
21110 case 'hex':
21111 return hexSlice(this, start, end)
21112
21113 case 'utf8':
21114 case 'utf-8':
21115 return utf8Slice(this, start, end)
21116
21117 case 'ascii':
21118 return asciiSlice(this, start, end)
21119
21120 case 'latin1':
21121 case 'binary':
21122 return latin1Slice(this, start, end)
21123
21124 case 'base64':
21125 return base64Slice(this, start, end)
21126
21127 case 'ucs2':
21128 case 'ucs-2':
21129 case 'utf16le':
21130 case 'utf-16le':
21131 return utf16leSlice(this, start, end)
21132
21133 default:
21134 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
21135 encoding = (encoding + '').toLowerCase()
21136 loweredCase = true
21137 }
21138 }
21139}
21140
21141// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
21142// to detect a Buffer instance. It's not possible to use `instanceof Buffer`
21143// reliably in a browserify context because there could be multiple different
21144// copies of the 'buffer' package in use. This method works even for Buffer
21145// instances that were created from another copy of the `buffer` package.
21146// See: https://github.com/feross/buffer/issues/154
21147Buffer.prototype._isBuffer = true
21148
21149function swap (b, n, m) {
21150 var i = b[n]
21151 b[n] = b[m]
21152 b[m] = i
21153}
21154
21155Buffer.prototype.swap16 = function swap16 () {
21156 var len = this.length
21157 if (len % 2 !== 0) {
21158 throw new RangeError('Buffer size must be a multiple of 16-bits')
21159 }
21160 for (var i = 0; i < len; i += 2) {
21161 swap(this, i, i + 1)
21162 }
21163 return this
21164}
21165
21166Buffer.prototype.swap32 = function swap32 () {
21167 var len = this.length
21168 if (len % 4 !== 0) {
21169 throw new RangeError('Buffer size must be a multiple of 32-bits')
21170 }
21171 for (var i = 0; i < len; i += 4) {
21172 swap(this, i, i + 3)
21173 swap(this, i + 1, i + 2)
21174 }
21175 return this
21176}
21177
21178Buffer.prototype.swap64 = function swap64 () {
21179 var len = this.length
21180 if (len % 8 !== 0) {
21181 throw new RangeError('Buffer size must be a multiple of 64-bits')
21182 }
21183 for (var i = 0; i < len; i += 8) {
21184 swap(this, i, i + 7)
21185 swap(this, i + 1, i + 6)
21186 swap(this, i + 2, i + 5)
21187 swap(this, i + 3, i + 4)
21188 }
21189 return this
21190}
21191
21192Buffer.prototype.toString = function toString () {
21193 var length = this.length
21194 if (length === 0) return ''
21195 if (arguments.length === 0) return utf8Slice(this, 0, length)
21196 return slowToString.apply(this, arguments)
21197}
21198
21199Buffer.prototype.equals = function equals (b) {
21200 if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
21201 if (this === b) return true
21202 return Buffer.compare(this, b) === 0
21203}
21204
21205Buffer.prototype.inspect = function inspect () {
21206 var str = ''
21207 var max = exports.INSPECT_MAX_BYTES
21208 if (this.length > 0) {
21209 str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
21210 if (this.length > max) str += ' ... '
21211 }
21212 return '<Buffer ' + str + '>'
21213}
21214
21215Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
21216 if (!Buffer.isBuffer(target)) {
21217 throw new TypeError('Argument must be a Buffer')
21218 }
21219
21220 if (start === undefined) {
21221 start = 0
21222 }
21223 if (end === undefined) {
21224 end = target ? target.length : 0
21225 }
21226 if (thisStart === undefined) {
21227 thisStart = 0
21228 }
21229 if (thisEnd === undefined) {
21230 thisEnd = this.length
21231 }
21232
21233 if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
21234 throw new RangeError('out of range index')
21235 }
21236
21237 if (thisStart >= thisEnd && start >= end) {
21238 return 0
21239 }
21240 if (thisStart >= thisEnd) {
21241 return -1
21242 }
21243 if (start >= end) {
21244 return 1
21245 }
21246
21247 start >>>= 0
21248 end >>>= 0
21249 thisStart >>>= 0
21250 thisEnd >>>= 0
21251
21252 if (this === target) return 0
21253
21254 var x = thisEnd - thisStart
21255 var y = end - start
21256 var len = Math.min(x, y)
21257
21258 var thisCopy = this.slice(thisStart, thisEnd)
21259 var targetCopy = target.slice(start, end)
21260
21261 for (var i = 0; i < len; ++i) {
21262 if (thisCopy[i] !== targetCopy[i]) {
21263 x = thisCopy[i]
21264 y = targetCopy[i]
21265 break
21266 }
21267 }
21268
21269 if (x < y) return -1
21270 if (y < x) return 1
21271 return 0
21272}
21273
21274// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
21275// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
21276//
21277// Arguments:
21278// - buffer - a Buffer to search
21279// - val - a string, Buffer, or number
21280// - byteOffset - an index into `buffer`; will be clamped to an int32
21281// - encoding - an optional encoding, relevant is val is a string
21282// - dir - true for indexOf, false for lastIndexOf
21283function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
21284 // Empty buffer means no match
21285 if (buffer.length === 0) return -1
21286
21287 // Normalize byteOffset
21288 if (typeof byteOffset === 'string') {
21289 encoding = byteOffset
21290 byteOffset = 0
21291 } else if (byteOffset > 0x7fffffff) {
21292 byteOffset = 0x7fffffff
21293 } else if (byteOffset < -0x80000000) {
21294 byteOffset = -0x80000000
21295 }
21296 byteOffset = +byteOffset // Coerce to Number.
21297 if (isNaN(byteOffset)) {
21298 // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
21299 byteOffset = dir ? 0 : (buffer.length - 1)
21300 }
21301
21302 // Normalize byteOffset: negative offsets start from the end of the buffer
21303 if (byteOffset < 0) byteOffset = buffer.length + byteOffset
21304 if (byteOffset >= buffer.length) {
21305 if (dir) return -1
21306 else byteOffset = buffer.length - 1
21307 } else if (byteOffset < 0) {
21308 if (dir) byteOffset = 0
21309 else return -1
21310 }
21311
21312 // Normalize val
21313 if (typeof val === 'string') {
21314 val = Buffer.from(val, encoding)
21315 }
21316
21317 // Finally, search either indexOf (if dir is true) or lastIndexOf
21318 if (Buffer.isBuffer(val)) {
21319 // Special case: looking for empty string/buffer always fails
21320 if (val.length === 0) {
21321 return -1
21322 }
21323 return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
21324 } else if (typeof val === 'number') {
21325 val = val & 0xFF // Search for a byte value [0-255]
21326 if (typeof Uint8Array.prototype.indexOf === 'function') {
21327 if (dir) {
21328 return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
21329 } else {
21330 return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
21331 }
21332 }
21333 return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
21334 }
21335
21336 throw new TypeError('val must be string, number or Buffer')
21337}
21338
21339function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
21340 var indexSize = 1
21341 var arrLength = arr.length
21342 var valLength = val.length
21343
21344 if (encoding !== undefined) {
21345 encoding = String(encoding).toLowerCase()
21346 if (encoding === 'ucs2' || encoding === 'ucs-2' ||
21347 encoding === 'utf16le' || encoding === 'utf-16le') {
21348 if (arr.length < 2 || val.length < 2) {
21349 return -1
21350 }
21351 indexSize = 2
21352 arrLength /= 2
21353 valLength /= 2
21354 byteOffset /= 2
21355 }
21356 }
21357
21358 function read (buf, i) {
21359 if (indexSize === 1) {
21360 return buf[i]
21361 } else {
21362 return buf.readUInt16BE(i * indexSize)
21363 }
21364 }
21365
21366 var i
21367 if (dir) {
21368 var foundIndex = -1
21369 for (i = byteOffset; i < arrLength; i++) {
21370 if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
21371 if (foundIndex === -1) foundIndex = i
21372 if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
21373 } else {
21374 if (foundIndex !== -1) i -= i - foundIndex
21375 foundIndex = -1
21376 }
21377 }
21378 } else {
21379 if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
21380 for (i = byteOffset; i >= 0; i--) {
21381 var found = true
21382 for (var j = 0; j < valLength; j++) {
21383 if (read(arr, i + j) !== read(val, j)) {
21384 found = false
21385 break
21386 }
21387 }
21388 if (found) return i
21389 }
21390 }
21391
21392 return -1
21393}
21394
21395Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
21396 return this.indexOf(val, byteOffset, encoding) !== -1
21397}
21398
21399Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
21400 return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
21401}
21402
21403Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
21404 return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
21405}
21406
21407function hexWrite (buf, string, offset, length) {
21408 offset = Number(offset) || 0
21409 var remaining = buf.length - offset
21410 if (!length) {
21411 length = remaining
21412 } else {
21413 length = Number(length)
21414 if (length > remaining) {
21415 length = remaining
21416 }
21417 }
21418
21419 // must be an even number of digits
21420 var strLen = string.length
21421 if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
21422
21423 if (length > strLen / 2) {
21424 length = strLen / 2
21425 }
21426 for (var i = 0; i < length; ++i) {
21427 var parsed = parseInt(string.substr(i * 2, 2), 16)
21428 if (isNaN(parsed)) return i
21429 buf[offset + i] = parsed
21430 }
21431 return i
21432}
21433
21434function utf8Write (buf, string, offset, length) {
21435 return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
21436}
21437
21438function asciiWrite (buf, string, offset, length) {
21439 return blitBuffer(asciiToBytes(string), buf, offset, length)
21440}
21441
21442function latin1Write (buf, string, offset, length) {
21443 return asciiWrite(buf, string, offset, length)
21444}
21445
21446function base64Write (buf, string, offset, length) {
21447 return blitBuffer(base64ToBytes(string), buf, offset, length)
21448}
21449
21450function ucs2Write (buf, string, offset, length) {
21451 return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
21452}
21453
21454Buffer.prototype.write = function write (string, offset, length, encoding) {
21455 // Buffer#write(string)
21456 if (offset === undefined) {
21457 encoding = 'utf8'
21458 length = this.length
21459 offset = 0
21460 // Buffer#write(string, encoding)
21461 } else if (length === undefined && typeof offset === 'string') {
21462 encoding = offset
21463 length = this.length
21464 offset = 0
21465 // Buffer#write(string, offset[, length][, encoding])
21466 } else if (isFinite(offset)) {
21467 offset = offset >>> 0
21468 if (isFinite(length)) {
21469 length = length >>> 0
21470 if (encoding === undefined) encoding = 'utf8'
21471 } else {
21472 encoding = length
21473 length = undefined
21474 }
21475 } else {
21476 throw new Error(
21477 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
21478 )
21479 }
21480
21481 var remaining = this.length - offset
21482 if (length === undefined || length > remaining) length = remaining
21483
21484 if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
21485 throw new RangeError('Attempt to write outside buffer bounds')
21486 }
21487
21488 if (!encoding) encoding = 'utf8'
21489
21490 var loweredCase = false
21491 for (;;) {
21492 switch (encoding) {
21493 case 'hex':
21494 return hexWrite(this, string, offset, length)
21495
21496 case 'utf8':
21497 case 'utf-8':
21498 return utf8Write(this, string, offset, length)
21499
21500 case 'ascii':
21501 return asciiWrite(this, string, offset, length)
21502
21503 case 'latin1':
21504 case 'binary':
21505 return latin1Write(this, string, offset, length)
21506
21507 case 'base64':
21508 // Warning: maxLength not taken into account in base64Write
21509 return base64Write(this, string, offset, length)
21510
21511 case 'ucs2':
21512 case 'ucs-2':
21513 case 'utf16le':
21514 case 'utf-16le':
21515 return ucs2Write(this, string, offset, length)
21516
21517 default:
21518 if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
21519 encoding = ('' + encoding).toLowerCase()
21520 loweredCase = true
21521 }
21522 }
21523}
21524
21525Buffer.prototype.toJSON = function toJSON () {
21526 return {
21527 type: 'Buffer',
21528 data: Array.prototype.slice.call(this._arr || this, 0)
21529 }
21530}
21531
21532function base64Slice (buf, start, end) {
21533 if (start === 0 && end === buf.length) {
21534 return base64.fromByteArray(buf)
21535 } else {
21536 return base64.fromByteArray(buf.slice(start, end))
21537 }
21538}
21539
21540function utf8Slice (buf, start, end) {
21541 end = Math.min(buf.length, end)
21542 var res = []
21543
21544 var i = start
21545 while (i < end) {
21546 var firstByte = buf[i]
21547 var codePoint = null
21548 var bytesPerSequence = (firstByte > 0xEF) ? 4
21549 : (firstByte > 0xDF) ? 3
21550 : (firstByte > 0xBF) ? 2
21551 : 1
21552
21553 if (i + bytesPerSequence <= end) {
21554 var secondByte, thirdByte, fourthByte, tempCodePoint
21555
21556 switch (bytesPerSequence) {
21557 case 1:
21558 if (firstByte < 0x80) {
21559 codePoint = firstByte
21560 }
21561 break
21562 case 2:
21563 secondByte = buf[i + 1]
21564 if ((secondByte & 0xC0) === 0x80) {
21565 tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
21566 if (tempCodePoint > 0x7F) {
21567 codePoint = tempCodePoint
21568 }
21569 }
21570 break
21571 case 3:
21572 secondByte = buf[i + 1]
21573 thirdByte = buf[i + 2]
21574 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
21575 tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
21576 if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
21577 codePoint = tempCodePoint
21578 }
21579 }
21580 break
21581 case 4:
21582 secondByte = buf[i + 1]
21583 thirdByte = buf[i + 2]
21584 fourthByte = buf[i + 3]
21585 if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
21586 tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
21587 if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
21588 codePoint = tempCodePoint
21589 }
21590 }
21591 }
21592 }
21593
21594 if (codePoint === null) {
21595 // we did not generate a valid codePoint so insert a
21596 // replacement char (U+FFFD) and advance only 1 byte
21597 codePoint = 0xFFFD
21598 bytesPerSequence = 1
21599 } else if (codePoint > 0xFFFF) {
21600 // encode to utf16 (surrogate pair dance)
21601 codePoint -= 0x10000
21602 res.push(codePoint >>> 10 & 0x3FF | 0xD800)
21603 codePoint = 0xDC00 | codePoint & 0x3FF
21604 }
21605
21606 res.push(codePoint)
21607 i += bytesPerSequence
21608 }
21609
21610 return decodeCodePointsArray(res)
21611}
21612
21613// Based on http://stackoverflow.com/a/22747272/680742, the browser with
21614// the lowest limit is Chrome, with 0x10000 args.
21615// We go 1 magnitude less, for safety
21616var MAX_ARGUMENTS_LENGTH = 0x1000
21617
21618function decodeCodePointsArray (codePoints) {
21619 var len = codePoints.length
21620 if (len <= MAX_ARGUMENTS_LENGTH) {
21621 return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
21622 }
21623
21624 // Decode in chunks to avoid "call stack size exceeded".
21625 var res = ''
21626 var i = 0
21627 while (i < len) {
21628 res += String.fromCharCode.apply(
21629 String,
21630 codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
21631 )
21632 }
21633 return res
21634}
21635
21636function asciiSlice (buf, start, end) {
21637 var ret = ''
21638 end = Math.min(buf.length, end)
21639
21640 for (var i = start; i < end; ++i) {
21641 ret += String.fromCharCode(buf[i] & 0x7F)
21642 }
21643 return ret
21644}
21645
21646function latin1Slice (buf, start, end) {
21647 var ret = ''
21648 end = Math.min(buf.length, end)
21649
21650 for (var i = start; i < end; ++i) {
21651 ret += String.fromCharCode(buf[i])
21652 }
21653 return ret
21654}
21655
21656function hexSlice (buf, start, end) {
21657 var len = buf.length
21658
21659 if (!start || start < 0) start = 0
21660 if (!end || end < 0 || end > len) end = len
21661
21662 var out = ''
21663 for (var i = start; i < end; ++i) {
21664 out += toHex(buf[i])
21665 }
21666 return out
21667}
21668
21669function utf16leSlice (buf, start, end) {
21670 var bytes = buf.slice(start, end)
21671 var res = ''
21672 for (var i = 0; i < bytes.length; i += 2) {
21673 res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
21674 }
21675 return res
21676}
21677
21678Buffer.prototype.slice = function slice (start, end) {
21679 var len = this.length
21680 start = ~~start
21681 end = end === undefined ? len : ~~end
21682
21683 if (start < 0) {
21684 start += len
21685 if (start < 0) start = 0
21686 } else if (start > len) {
21687 start = len
21688 }
21689
21690 if (end < 0) {
21691 end += len
21692 if (end < 0) end = 0
21693 } else if (end > len) {
21694 end = len
21695 }
21696
21697 if (end < start) end = start
21698
21699 var newBuf = this.subarray(start, end)
21700 // Return an augmented `Uint8Array` instance
21701 newBuf.__proto__ = Buffer.prototype
21702 return newBuf
21703}
21704
21705/*
21706 * Need to make sure that buffer isn't trying to write out of bounds.
21707 */
21708function checkOffset (offset, ext, length) {
21709 if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
21710 if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
21711}
21712
21713Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
21714 offset = offset >>> 0
21715 byteLength = byteLength >>> 0
21716 if (!noAssert) checkOffset(offset, byteLength, this.length)
21717
21718 var val = this[offset]
21719 var mul = 1
21720 var i = 0
21721 while (++i < byteLength && (mul *= 0x100)) {
21722 val += this[offset + i] * mul
21723 }
21724
21725 return val
21726}
21727
21728Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
21729 offset = offset >>> 0
21730 byteLength = byteLength >>> 0
21731 if (!noAssert) {
21732 checkOffset(offset, byteLength, this.length)
21733 }
21734
21735 var val = this[offset + --byteLength]
21736 var mul = 1
21737 while (byteLength > 0 && (mul *= 0x100)) {
21738 val += this[offset + --byteLength] * mul
21739 }
21740
21741 return val
21742}
21743
21744Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
21745 offset = offset >>> 0
21746 if (!noAssert) checkOffset(offset, 1, this.length)
21747 return this[offset]
21748}
21749
21750Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
21751 offset = offset >>> 0
21752 if (!noAssert) checkOffset(offset, 2, this.length)
21753 return this[offset] | (this[offset + 1] << 8)
21754}
21755
21756Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
21757 offset = offset >>> 0
21758 if (!noAssert) checkOffset(offset, 2, this.length)
21759 return (this[offset] << 8) | this[offset + 1]
21760}
21761
21762Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
21763 offset = offset >>> 0
21764 if (!noAssert) checkOffset(offset, 4, this.length)
21765
21766 return ((this[offset]) |
21767 (this[offset + 1] << 8) |
21768 (this[offset + 2] << 16)) +
21769 (this[offset + 3] * 0x1000000)
21770}
21771
21772Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
21773 offset = offset >>> 0
21774 if (!noAssert) checkOffset(offset, 4, this.length)
21775
21776 return (this[offset] * 0x1000000) +
21777 ((this[offset + 1] << 16) |
21778 (this[offset + 2] << 8) |
21779 this[offset + 3])
21780}
21781
21782Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
21783 offset = offset >>> 0
21784 byteLength = byteLength >>> 0
21785 if (!noAssert) checkOffset(offset, byteLength, this.length)
21786
21787 var val = this[offset]
21788 var mul = 1
21789 var i = 0
21790 while (++i < byteLength && (mul *= 0x100)) {
21791 val += this[offset + i] * mul
21792 }
21793 mul *= 0x80
21794
21795 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
21796
21797 return val
21798}
21799
21800Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
21801 offset = offset >>> 0
21802 byteLength = byteLength >>> 0
21803 if (!noAssert) checkOffset(offset, byteLength, this.length)
21804
21805 var i = byteLength
21806 var mul = 1
21807 var val = this[offset + --i]
21808 while (i > 0 && (mul *= 0x100)) {
21809 val += this[offset + --i] * mul
21810 }
21811 mul *= 0x80
21812
21813 if (val >= mul) val -= Math.pow(2, 8 * byteLength)
21814
21815 return val
21816}
21817
21818Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
21819 offset = offset >>> 0
21820 if (!noAssert) checkOffset(offset, 1, this.length)
21821 if (!(this[offset] & 0x80)) return (this[offset])
21822 return ((0xff - this[offset] + 1) * -1)
21823}
21824
21825Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
21826 offset = offset >>> 0
21827 if (!noAssert) checkOffset(offset, 2, this.length)
21828 var val = this[offset] | (this[offset + 1] << 8)
21829 return (val & 0x8000) ? val | 0xFFFF0000 : val
21830}
21831
21832Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
21833 offset = offset >>> 0
21834 if (!noAssert) checkOffset(offset, 2, this.length)
21835 var val = this[offset + 1] | (this[offset] << 8)
21836 return (val & 0x8000) ? val | 0xFFFF0000 : val
21837}
21838
21839Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
21840 offset = offset >>> 0
21841 if (!noAssert) checkOffset(offset, 4, this.length)
21842
21843 return (this[offset]) |
21844 (this[offset + 1] << 8) |
21845 (this[offset + 2] << 16) |
21846 (this[offset + 3] << 24)
21847}
21848
21849Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
21850 offset = offset >>> 0
21851 if (!noAssert) checkOffset(offset, 4, this.length)
21852
21853 return (this[offset] << 24) |
21854 (this[offset + 1] << 16) |
21855 (this[offset + 2] << 8) |
21856 (this[offset + 3])
21857}
21858
21859Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
21860 offset = offset >>> 0
21861 if (!noAssert) checkOffset(offset, 4, this.length)
21862 return ieee754.read(this, offset, true, 23, 4)
21863}
21864
21865Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
21866 offset = offset >>> 0
21867 if (!noAssert) checkOffset(offset, 4, this.length)
21868 return ieee754.read(this, offset, false, 23, 4)
21869}
21870
21871Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
21872 offset = offset >>> 0
21873 if (!noAssert) checkOffset(offset, 8, this.length)
21874 return ieee754.read(this, offset, true, 52, 8)
21875}
21876
21877Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
21878 offset = offset >>> 0
21879 if (!noAssert) checkOffset(offset, 8, this.length)
21880 return ieee754.read(this, offset, false, 52, 8)
21881}
21882
21883function checkInt (buf, value, offset, ext, max, min) {
21884 if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
21885 if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
21886 if (offset + ext > buf.length) throw new RangeError('Index out of range')
21887}
21888
21889Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
21890 value = +value
21891 offset = offset >>> 0
21892 byteLength = byteLength >>> 0
21893 if (!noAssert) {
21894 var maxBytes = Math.pow(2, 8 * byteLength) - 1
21895 checkInt(this, value, offset, byteLength, maxBytes, 0)
21896 }
21897
21898 var mul = 1
21899 var i = 0
21900 this[offset] = value & 0xFF
21901 while (++i < byteLength && (mul *= 0x100)) {
21902 this[offset + i] = (value / mul) & 0xFF
21903 }
21904
21905 return offset + byteLength
21906}
21907
21908Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
21909 value = +value
21910 offset = offset >>> 0
21911 byteLength = byteLength >>> 0
21912 if (!noAssert) {
21913 var maxBytes = Math.pow(2, 8 * byteLength) - 1
21914 checkInt(this, value, offset, byteLength, maxBytes, 0)
21915 }
21916
21917 var i = byteLength - 1
21918 var mul = 1
21919 this[offset + i] = value & 0xFF
21920 while (--i >= 0 && (mul *= 0x100)) {
21921 this[offset + i] = (value / mul) & 0xFF
21922 }
21923
21924 return offset + byteLength
21925}
21926
21927Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
21928 value = +value
21929 offset = offset >>> 0
21930 if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
21931 this[offset] = (value & 0xff)
21932 return offset + 1
21933}
21934
21935Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
21936 value = +value
21937 offset = offset >>> 0
21938 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
21939 this[offset] = (value & 0xff)
21940 this[offset + 1] = (value >>> 8)
21941 return offset + 2
21942}
21943
21944Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
21945 value = +value
21946 offset = offset >>> 0
21947 if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
21948 this[offset] = (value >>> 8)
21949 this[offset + 1] = (value & 0xff)
21950 return offset + 2
21951}
21952
21953Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
21954 value = +value
21955 offset = offset >>> 0
21956 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
21957 this[offset + 3] = (value >>> 24)
21958 this[offset + 2] = (value >>> 16)
21959 this[offset + 1] = (value >>> 8)
21960 this[offset] = (value & 0xff)
21961 return offset + 4
21962}
21963
21964Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
21965 value = +value
21966 offset = offset >>> 0
21967 if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
21968 this[offset] = (value >>> 24)
21969 this[offset + 1] = (value >>> 16)
21970 this[offset + 2] = (value >>> 8)
21971 this[offset + 3] = (value & 0xff)
21972 return offset + 4
21973}
21974
21975Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
21976 value = +value
21977 offset = offset >>> 0
21978 if (!noAssert) {
21979 var limit = Math.pow(2, (8 * byteLength) - 1)
21980
21981 checkInt(this, value, offset, byteLength, limit - 1, -limit)
21982 }
21983
21984 var i = 0
21985 var mul = 1
21986 var sub = 0
21987 this[offset] = value & 0xFF
21988 while (++i < byteLength && (mul *= 0x100)) {
21989 if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
21990 sub = 1
21991 }
21992 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
21993 }
21994
21995 return offset + byteLength
21996}
21997
21998Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
21999 value = +value
22000 offset = offset >>> 0
22001 if (!noAssert) {
22002 var limit = Math.pow(2, (8 * byteLength) - 1)
22003
22004 checkInt(this, value, offset, byteLength, limit - 1, -limit)
22005 }
22006
22007 var i = byteLength - 1
22008 var mul = 1
22009 var sub = 0
22010 this[offset + i] = value & 0xFF
22011 while (--i >= 0 && (mul *= 0x100)) {
22012 if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
22013 sub = 1
22014 }
22015 this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
22016 }
22017
22018 return offset + byteLength
22019}
22020
22021Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
22022 value = +value
22023 offset = offset >>> 0
22024 if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
22025 if (value < 0) value = 0xff + value + 1
22026 this[offset] = (value & 0xff)
22027 return offset + 1
22028}
22029
22030Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
22031 value = +value
22032 offset = offset >>> 0
22033 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
22034 this[offset] = (value & 0xff)
22035 this[offset + 1] = (value >>> 8)
22036 return offset + 2
22037}
22038
22039Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
22040 value = +value
22041 offset = offset >>> 0
22042 if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
22043 this[offset] = (value >>> 8)
22044 this[offset + 1] = (value & 0xff)
22045 return offset + 2
22046}
22047
22048Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
22049 value = +value
22050 offset = offset >>> 0
22051 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
22052 this[offset] = (value & 0xff)
22053 this[offset + 1] = (value >>> 8)
22054 this[offset + 2] = (value >>> 16)
22055 this[offset + 3] = (value >>> 24)
22056 return offset + 4
22057}
22058
22059Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
22060 value = +value
22061 offset = offset >>> 0
22062 if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
22063 if (value < 0) value = 0xffffffff + value + 1
22064 this[offset] = (value >>> 24)
22065 this[offset + 1] = (value >>> 16)
22066 this[offset + 2] = (value >>> 8)
22067 this[offset + 3] = (value & 0xff)
22068 return offset + 4
22069}
22070
22071function checkIEEE754 (buf, value, offset, ext, max, min) {
22072 if (offset + ext > buf.length) throw new RangeError('Index out of range')
22073 if (offset < 0) throw new RangeError('Index out of range')
22074}
22075
22076function writeFloat (buf, value, offset, littleEndian, noAssert) {
22077 value = +value
22078 offset = offset >>> 0
22079 if (!noAssert) {
22080 checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
22081 }
22082 ieee754.write(buf, value, offset, littleEndian, 23, 4)
22083 return offset + 4
22084}
22085
22086Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
22087 return writeFloat(this, value, offset, true, noAssert)
22088}
22089
22090Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
22091 return writeFloat(this, value, offset, false, noAssert)
22092}
22093
22094function writeDouble (buf, value, offset, littleEndian, noAssert) {
22095 value = +value
22096 offset = offset >>> 0
22097 if (!noAssert) {
22098 checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
22099 }
22100 ieee754.write(buf, value, offset, littleEndian, 52, 8)
22101 return offset + 8
22102}
22103
22104Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
22105 return writeDouble(this, value, offset, true, noAssert)
22106}
22107
22108Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
22109 return writeDouble(this, value, offset, false, noAssert)
22110}
22111
22112// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
22113Buffer.prototype.copy = function copy (target, targetStart, start, end) {
22114 if (!start) start = 0
22115 if (!end && end !== 0) end = this.length
22116 if (targetStart >= target.length) targetStart = target.length
22117 if (!targetStart) targetStart = 0
22118 if (end > 0 && end < start) end = start
22119
22120 // Copy 0 bytes; we're done
22121 if (end === start) return 0
22122 if (target.length === 0 || this.length === 0) return 0
22123
22124 // Fatal error conditions
22125 if (targetStart < 0) {
22126 throw new RangeError('targetStart out of bounds')
22127 }
22128 if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
22129 if (end < 0) throw new RangeError('sourceEnd out of bounds')
22130
22131 // Are we oob?
22132 if (end > this.length) end = this.length
22133 if (target.length - targetStart < end - start) {
22134 end = target.length - targetStart + start
22135 }
22136
22137 var len = end - start
22138 var i
22139
22140 if (this === target && start < targetStart && targetStart < end) {
22141 // descending copy from end
22142 for (i = len - 1; i >= 0; --i) {
22143 target[i + targetStart] = this[i + start]
22144 }
22145 } else if (len < 1000) {
22146 // ascending copy from start
22147 for (i = 0; i < len; ++i) {
22148 target[i + targetStart] = this[i + start]
22149 }
22150 } else {
22151 Uint8Array.prototype.set.call(
22152 target,
22153 this.subarray(start, start + len),
22154 targetStart
22155 )
22156 }
22157
22158 return len
22159}
22160
22161// Usage:
22162// buffer.fill(number[, offset[, end]])
22163// buffer.fill(buffer[, offset[, end]])
22164// buffer.fill(string[, offset[, end]][, encoding])
22165Buffer.prototype.fill = function fill (val, start, end, encoding) {
22166 // Handle string cases:
22167 if (typeof val === 'string') {
22168 if (typeof start === 'string') {
22169 encoding = start
22170 start = 0
22171 end = this.length
22172 } else if (typeof end === 'string') {
22173 encoding = end
22174 end = this.length
22175 }
22176 if (val.length === 1) {
22177 var code = val.charCodeAt(0)
22178 if (code < 256) {
22179 val = code
22180 }
22181 }
22182 if (encoding !== undefined && typeof encoding !== 'string') {
22183 throw new TypeError('encoding must be a string')
22184 }
22185 if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
22186 throw new TypeError('Unknown encoding: ' + encoding)
22187 }
22188 } else if (typeof val === 'number') {
22189 val = val & 255
22190 }
22191
22192 // Invalid ranges are not set to a default, so can range check early.
22193 if (start < 0 || this.length < start || this.length < end) {
22194 throw new RangeError('Out of range index')
22195 }
22196
22197 if (end <= start) {
22198 return this
22199 }
22200
22201 start = start >>> 0
22202 end = end === undefined ? this.length : end >>> 0
22203
22204 if (!val) val = 0
22205
22206 var i
22207 if (typeof val === 'number') {
22208 for (i = start; i < end; ++i) {
22209 this[i] = val
22210 }
22211 } else {
22212 var bytes = Buffer.isBuffer(val)
22213 ? val
22214 : new Buffer(val, encoding)
22215 var len = bytes.length
22216 for (i = 0; i < end - start; ++i) {
22217 this[i + start] = bytes[i % len]
22218 }
22219 }
22220
22221 return this
22222}
22223
22224// HELPER FUNCTIONS
22225// ================
22226
22227var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
22228
22229function base64clean (str) {
22230 // Node strips out invalid characters like \n and \t from the string, base64-js does not
22231 str = stringtrim(str).replace(INVALID_BASE64_RE, '')
22232 // Node converts strings with length < 2 to ''
22233 if (str.length < 2) return ''
22234 // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
22235 while (str.length % 4 !== 0) {
22236 str = str + '='
22237 }
22238 return str
22239}
22240
22241function stringtrim (str) {
22242 if (str.trim) return str.trim()
22243 return str.replace(/^\s+|\s+$/g, '')
22244}
22245
22246function toHex (n) {
22247 if (n < 16) return '0' + n.toString(16)
22248 return n.toString(16)
22249}
22250
22251function utf8ToBytes (string, units) {
22252 units = units || Infinity
22253 var codePoint
22254 var length = string.length
22255 var leadSurrogate = null
22256 var bytes = []
22257
22258 for (var i = 0; i < length; ++i) {
22259 codePoint = string.charCodeAt(i)
22260
22261 // is surrogate component
22262 if (codePoint > 0xD7FF && codePoint < 0xE000) {
22263 // last char was a lead
22264 if (!leadSurrogate) {
22265 // no lead yet
22266 if (codePoint > 0xDBFF) {
22267 // unexpected trail
22268 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
22269 continue
22270 } else if (i + 1 === length) {
22271 // unpaired lead
22272 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
22273 continue
22274 }
22275
22276 // valid lead
22277 leadSurrogate = codePoint
22278
22279 continue
22280 }
22281
22282 // 2 leads in a row
22283 if (codePoint < 0xDC00) {
22284 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
22285 leadSurrogate = codePoint
22286 continue
22287 }
22288
22289 // valid surrogate pair
22290 codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
22291 } else if (leadSurrogate) {
22292 // valid bmp char, but last char was a lead
22293 if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
22294 }
22295
22296 leadSurrogate = null
22297
22298 // encode utf8
22299 if (codePoint < 0x80) {
22300 if ((units -= 1) < 0) break
22301 bytes.push(codePoint)
22302 } else if (codePoint < 0x800) {
22303 if ((units -= 2) < 0) break
22304 bytes.push(
22305 codePoint >> 0x6 | 0xC0,
22306 codePoint & 0x3F | 0x80
22307 )
22308 } else if (codePoint < 0x10000) {
22309 if ((units -= 3) < 0) break
22310 bytes.push(
22311 codePoint >> 0xC | 0xE0,
22312 codePoint >> 0x6 & 0x3F | 0x80,
22313 codePoint & 0x3F | 0x80
22314 )
22315 } else if (codePoint < 0x110000) {
22316 if ((units -= 4) < 0) break
22317 bytes.push(
22318 codePoint >> 0x12 | 0xF0,
22319 codePoint >> 0xC & 0x3F | 0x80,
22320 codePoint >> 0x6 & 0x3F | 0x80,
22321 codePoint & 0x3F | 0x80
22322 )
22323 } else {
22324 throw new Error('Invalid code point')
22325 }
22326 }
22327
22328 return bytes
22329}
22330
22331function asciiToBytes (str) {
22332 var byteArray = []
22333 for (var i = 0; i < str.length; ++i) {
22334 // Node's code seems to be doing this and not & 0x7F..
22335 byteArray.push(str.charCodeAt(i) & 0xFF)
22336 }
22337 return byteArray
22338}
22339
22340function utf16leToBytes (str, units) {
22341 var c, hi, lo
22342 var byteArray = []
22343 for (var i = 0; i < str.length; ++i) {
22344 if ((units -= 2) < 0) break
22345
22346 c = str.charCodeAt(i)
22347 hi = c >> 8
22348 lo = c % 256
22349 byteArray.push(lo)
22350 byteArray.push(hi)
22351 }
22352
22353 return byteArray
22354}
22355
22356function base64ToBytes (str) {
22357 return base64.toByteArray(base64clean(str))
22358}
22359
22360function blitBuffer (src, dst, offset, length) {
22361 for (var i = 0; i < length; ++i) {
22362 if ((i + offset >= dst.length) || (i >= src.length)) break
22363 dst[i + offset] = src[i]
22364 }
22365 return i
22366}
22367
22368function isnan (val) {
22369 return val !== val // eslint-disable-line no-self-compare
22370}
22371
22372},{"base64-js":2,"ieee754":8}],6:[function(require,module,exports){
22373(function (Buffer){
22374// Copyright Joyent, Inc. and other Node contributors.
22375//
22376// Permission is hereby granted, free of charge, to any person obtaining a
22377// copy of this software and associated documentation files (the
22378// "Software"), to deal in the Software without restriction, including
22379// without limitation the rights to use, copy, modify, merge, publish,
22380// distribute, sublicense, and/or sell copies of the Software, and to permit
22381// persons to whom the Software is furnished to do so, subject to the
22382// following conditions:
22383//
22384// The above copyright notice and this permission notice shall be included
22385// in all copies or substantial portions of the Software.
22386//
22387// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22388// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22389// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
22390// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22391// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22392// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22393// USE OR OTHER DEALINGS IN THE SOFTWARE.
22394
22395// NOTE: These type checking functions intentionally don't use `instanceof`
22396// because it is fragile and can be easily faked with `Object.create()`.
22397
22398function isArray(arg) {
22399 if (Array.isArray) {
22400 return Array.isArray(arg);
22401 }
22402 return objectToString(arg) === '[object Array]';
22403}
22404exports.isArray = isArray;
22405
22406function isBoolean(arg) {
22407 return typeof arg === 'boolean';
22408}
22409exports.isBoolean = isBoolean;
22410
22411function isNull(arg) {
22412 return arg === null;
22413}
22414exports.isNull = isNull;
22415
22416function isNullOrUndefined(arg) {
22417 return arg == null;
22418}
22419exports.isNullOrUndefined = isNullOrUndefined;
22420
22421function isNumber(arg) {
22422 return typeof arg === 'number';
22423}
22424exports.isNumber = isNumber;
22425
22426function isString(arg) {
22427 return typeof arg === 'string';
22428}
22429exports.isString = isString;
22430
22431function isSymbol(arg) {
22432 return typeof arg === 'symbol';
22433}
22434exports.isSymbol = isSymbol;
22435
22436function isUndefined(arg) {
22437 return arg === void 0;
22438}
22439exports.isUndefined = isUndefined;
22440
22441function isRegExp(re) {
22442 return objectToString(re) === '[object RegExp]';
22443}
22444exports.isRegExp = isRegExp;
22445
22446function isObject(arg) {
22447 return typeof arg === 'object' && arg !== null;
22448}
22449exports.isObject = isObject;
22450
22451function isDate(d) {
22452 return objectToString(d) === '[object Date]';
22453}
22454exports.isDate = isDate;
22455
22456function isError(e) {
22457 return (objectToString(e) === '[object Error]' || e instanceof Error);
22458}
22459exports.isError = isError;
22460
22461function isFunction(arg) {
22462 return typeof arg === 'function';
22463}
22464exports.isFunction = isFunction;
22465
22466function isPrimitive(arg) {
22467 return arg === null ||
22468 typeof arg === 'boolean' ||
22469 typeof arg === 'number' ||
22470 typeof arg === 'string' ||
22471 typeof arg === 'symbol' || // ES6 symbol
22472 typeof arg === 'undefined';
22473}
22474exports.isPrimitive = isPrimitive;
22475
22476exports.isBuffer = Buffer.isBuffer;
22477
22478function objectToString(o) {
22479 return Object.prototype.toString.call(o);
22480}
22481
22482}).call(this,{"isBuffer":require("../../is-buffer/index.js")})
22483},{"../../is-buffer/index.js":10}],7:[function(require,module,exports){
22484// Copyright Joyent, Inc. and other Node contributors.
22485//
22486// Permission is hereby granted, free of charge, to any person obtaining a
22487// copy of this software and associated documentation files (the
22488// "Software"), to deal in the Software without restriction, including
22489// without limitation the rights to use, copy, modify, merge, publish,
22490// distribute, sublicense, and/or sell copies of the Software, and to permit
22491// persons to whom the Software is furnished to do so, subject to the
22492// following conditions:
22493//
22494// The above copyright notice and this permission notice shall be included
22495// in all copies or substantial portions of the Software.
22496//
22497// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22498// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22499// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
22500// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
22501// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22502// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22503// USE OR OTHER DEALINGS IN THE SOFTWARE.
22504
22505function EventEmitter() {
22506 this._events = this._events || {};
22507 this._maxListeners = this._maxListeners || undefined;
22508}
22509module.exports = EventEmitter;
22510
22511// Backwards-compat with node 0.10.x
22512EventEmitter.EventEmitter = EventEmitter;
22513
22514EventEmitter.prototype._events = undefined;
22515EventEmitter.prototype._maxListeners = undefined;
22516
22517// By default EventEmitters will print a warning if more than 10 listeners are
22518// added to it. This is a useful default which helps finding memory leaks.
22519EventEmitter.defaultMaxListeners = 10;
22520
22521// Obviously not all Emitters should be limited to 10. This function allows
22522// that to be increased. Set to zero for unlimited.
22523EventEmitter.prototype.setMaxListeners = function(n) {
22524 if (!isNumber(n) || n < 0 || isNaN(n))
22525 throw TypeError('n must be a positive number');
22526 this._maxListeners = n;
22527 return this;
22528};
22529
22530EventEmitter.prototype.emit = function(type) {
22531 var er, handler, len, args, i, listeners;
22532
22533 if (!this._events)
22534 this._events = {};
22535
22536 // If there is no 'error' event listener then throw.
22537 if (type === 'error') {
22538 if (!this._events.error ||
22539 (isObject(this._events.error) && !this._events.error.length)) {
22540 er = arguments[1];
22541 if (er instanceof Error) {
22542 throw er; // Unhandled 'error' event
22543 } else {
22544 // At least give some kind of context to the user
22545 var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
22546 err.context = er;
22547 throw err;
22548 }
22549 }
22550 }
22551
22552 handler = this._events[type];
22553
22554 if (isUndefined(handler))
22555 return false;
22556
22557 if (isFunction(handler)) {
22558 switch (arguments.length) {
22559 // fast cases
22560 case 1:
22561 handler.call(this);
22562 break;
22563 case 2:
22564 handler.call(this, arguments[1]);
22565 break;
22566 case 3:
22567 handler.call(this, arguments[1], arguments[2]);
22568 break;
22569 // slower
22570 default:
22571 args = Array.prototype.slice.call(arguments, 1);
22572 handler.apply(this, args);
22573 }
22574 } else if (isObject(handler)) {
22575 args = Array.prototype.slice.call(arguments, 1);
22576 listeners = handler.slice();
22577 len = listeners.length;
22578 for (i = 0; i < len; i++)
22579 listeners[i].apply(this, args);
22580 }
22581
22582 return true;
22583};
22584
22585EventEmitter.prototype.addListener = function(type, listener) {
22586 var m;
22587
22588 if (!isFunction(listener))
22589 throw TypeError('listener must be a function');
22590
22591 if (!this._events)
22592 this._events = {};
22593
22594 // To avoid recursion in the case that type === "newListener"! Before
22595 // adding it to the listeners, first emit "newListener".
22596 if (this._events.newListener)
22597 this.emit('newListener', type,
22598 isFunction(listener.listener) ?
22599 listener.listener : listener);
22600
22601 if (!this._events[type])
22602 // Optimize the case of one listener. Don't need the extra array object.
22603 this._events[type] = listener;
22604 else if (isObject(this._events[type]))
22605 // If we've already got an array, just append.
22606 this._events[type].push(listener);
22607 else
22608 // Adding the second element, need to change to array.
22609 this._events[type] = [this._events[type], listener];
22610
22611 // Check for listener leak
22612 if (isObject(this._events[type]) && !this._events[type].warned) {
22613 if (!isUndefined(this._maxListeners)) {
22614 m = this._maxListeners;
22615 } else {
22616 m = EventEmitter.defaultMaxListeners;
22617 }
22618
22619 if (m && m > 0 && this._events[type].length > m) {
22620 this._events[type].warned = true;
22621 console.error('(node) warning: possible EventEmitter memory ' +
22622 'leak detected. %d listeners added. ' +
22623 'Use emitter.setMaxListeners() to increase limit.',
22624 this._events[type].length);
22625 if (typeof console.trace === 'function') {
22626 // not supported in IE 10
22627 console.trace();
22628 }
22629 }
22630 }
22631
22632 return this;
22633};
22634
22635EventEmitter.prototype.on = EventEmitter.prototype.addListener;
22636
22637EventEmitter.prototype.once = function(type, listener) {
22638 if (!isFunction(listener))
22639 throw TypeError('listener must be a function');
22640
22641 var fired = false;
22642
22643 function g() {
22644 this.removeListener(type, g);
22645
22646 if (!fired) {
22647 fired = true;
22648 listener.apply(this, arguments);
22649 }
22650 }
22651
22652 g.listener = listener;
22653 this.on(type, g);
22654
22655 return this;
22656};
22657
22658// emits a 'removeListener' event iff the listener was removed
22659EventEmitter.prototype.removeListener = function(type, listener) {
22660 var list, position, length, i;
22661
22662 if (!isFunction(listener))
22663 throw TypeError('listener must be a function');
22664
22665 if (!this._events || !this._events[type])
22666 return this;
22667
22668 list = this._events[type];
22669 length = list.length;
22670 position = -1;
22671
22672 if (list === listener ||
22673 (isFunction(list.listener) && list.listener === listener)) {
22674 delete this._events[type];
22675 if (this._events.removeListener)
22676 this.emit('removeListener', type, listener);
22677
22678 } else if (isObject(list)) {
22679 for (i = length; i-- > 0;) {
22680 if (list[i] === listener ||
22681 (list[i].listener && list[i].listener === listener)) {
22682 position = i;
22683 break;
22684 }
22685 }
22686
22687 if (position < 0)
22688 return this;
22689
22690 if (list.length === 1) {
22691 list.length = 0;
22692 delete this._events[type];
22693 } else {
22694 list.splice(position, 1);
22695 }
22696
22697 if (this._events.removeListener)
22698 this.emit('removeListener', type, listener);
22699 }
22700
22701 return this;
22702};
22703
22704EventEmitter.prototype.removeAllListeners = function(type) {
22705 var key, listeners;
22706
22707 if (!this._events)
22708 return this;
22709
22710 // not listening for removeListener, no need to emit
22711 if (!this._events.removeListener) {
22712 if (arguments.length === 0)
22713 this._events = {};
22714 else if (this._events[type])
22715 delete this._events[type];
22716 return this;
22717 }
22718
22719 // emit removeListener for all listeners on all events
22720 if (arguments.length === 0) {
22721 for (key in this._events) {
22722 if (key === 'removeListener') continue;
22723 this.removeAllListeners(key);
22724 }
22725 this.removeAllListeners('removeListener');
22726 this._events = {};
22727 return this;
22728 }
22729
22730 listeners = this._events[type];
22731
22732 if (isFunction(listeners)) {
22733 this.removeListener(type, listeners);
22734 } else if (listeners) {
22735 // LIFO order
22736 while (listeners.length)
22737 this.removeListener(type, listeners[listeners.length - 1]);
22738 }
22739 delete this._events[type];
22740
22741 return this;
22742};
22743
22744EventEmitter.prototype.listeners = function(type) {
22745 var ret;
22746 if (!this._events || !this._events[type])
22747 ret = [];
22748 else if (isFunction(this._events[type]))
22749 ret = [this._events[type]];
22750 else
22751 ret = this._events[type].slice();
22752 return ret;
22753};
22754
22755EventEmitter.prototype.listenerCount = function(type) {
22756 if (this._events) {
22757 var evlistener = this._events[type];
22758
22759 if (isFunction(evlistener))
22760 return 1;
22761 else if (evlistener)
22762 return evlistener.length;
22763 }
22764 return 0;
22765};
22766
22767EventEmitter.listenerCount = function(emitter, type) {
22768 return emitter.listenerCount(type);
22769};
22770
22771function isFunction(arg) {
22772 return typeof arg === 'function';
22773}
22774
22775function isNumber(arg) {
22776 return typeof arg === 'number';
22777}
22778
22779function isObject(arg) {
22780 return typeof arg === 'object' && arg !== null;
22781}
22782
22783function isUndefined(arg) {
22784 return arg === void 0;
22785}
22786
22787},{}],8:[function(require,module,exports){
22788exports.read = function (buffer, offset, isLE, mLen, nBytes) {
22789 var e, m
22790 var eLen = nBytes * 8 - mLen - 1
22791 var eMax = (1 << eLen) - 1
22792 var eBias = eMax >> 1
22793 var nBits = -7
22794 var i = isLE ? (nBytes - 1) : 0
22795 var d = isLE ? -1 : 1
22796 var s = buffer[offset + i]
22797
22798 i += d
22799
22800 e = s & ((1 << (-nBits)) - 1)
22801 s >>= (-nBits)
22802 nBits += eLen
22803 for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
22804
22805 m = e & ((1 << (-nBits)) - 1)
22806 e >>= (-nBits)
22807 nBits += mLen
22808 for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
22809
22810 if (e === 0) {
22811 e = 1 - eBias
22812 } else if (e === eMax) {
22813 return m ? NaN : ((s ? -1 : 1) * Infinity)
22814 } else {
22815 m = m + Math.pow(2, mLen)
22816 e = e - eBias
22817 }
22818 return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
22819}
22820
22821exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
22822 var e, m, c
22823 var eLen = nBytes * 8 - mLen - 1
22824 var eMax = (1 << eLen) - 1
22825 var eBias = eMax >> 1
22826 var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
22827 var i = isLE ? 0 : (nBytes - 1)
22828 var d = isLE ? 1 : -1
22829 var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
22830
22831 value = Math.abs(value)
22832
22833 if (isNaN(value) || value === Infinity) {
22834 m = isNaN(value) ? 1 : 0
22835 e = eMax
22836 } else {
22837 e = Math.floor(Math.log(value) / Math.LN2)
22838 if (value * (c = Math.pow(2, -e)) < 1) {
22839 e--
22840 c *= 2
22841 }
22842 if (e + eBias >= 1) {
22843 value += rt / c
22844 } else {
22845 value += rt * Math.pow(2, 1 - eBias)
22846 }
22847 if (value * c >= 2) {
22848 e++
22849 c /= 2
22850 }
22851
22852 if (e + eBias >= eMax) {
22853 m = 0
22854 e = eMax
22855 } else if (e + eBias >= 1) {
22856 m = (value * c - 1) * Math.pow(2, mLen)
22857 e = e + eBias
22858 } else {
22859 m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
22860 e = 0
22861 }
22862 }
22863
22864 for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
22865
22866 e = (e << mLen) | m
22867 eLen += mLen
22868 for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
22869
22870 buffer[offset + i - d] |= s * 128
22871}
22872
22873},{}],9:[function(require,module,exports){
22874if (typeof Object.create === 'function') {
22875 // implementation from standard node.js 'util' module
22876 module.exports = function inherits(ctor, superCtor) {
22877 ctor.super_ = superCtor
22878 ctor.prototype = Object.create(superCtor.prototype, {
22879 constructor: {
22880 value: ctor,
22881 enumerable: false,
22882 writable: true,
22883 configurable: true
22884 }
22885 });
22886 };
22887} else {
22888 // old school shim for old browsers
22889 module.exports = function inherits(ctor, superCtor) {
22890 ctor.super_ = superCtor
22891 var TempCtor = function () {}
22892 TempCtor.prototype = superCtor.prototype
22893 ctor.prototype = new TempCtor()
22894 ctor.prototype.constructor = ctor
22895 }
22896}
22897
22898},{}],10:[function(require,module,exports){
22899/*!
22900 * Determine if an object is a Buffer
22901 *
22902 * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
22903 * @license MIT
22904 */
22905
22906// The _isBuffer check is for Safari 5-7 support, because it's missing
22907// Object.prototype.constructor. Remove this eventually
22908module.exports = function (obj) {
22909 return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
22910}
22911
22912function isBuffer (obj) {
22913 return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
22914}
22915
22916// For Node v0.10 support. Remove this eventually.
22917function isSlowBuffer (obj) {
22918 return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
22919}
22920
22921},{}],11:[function(require,module,exports){
22922var toString = {}.toString;
22923
22924module.exports = Array.isArray || function (arr) {
22925 return toString.call(arr) == '[object Array]';
22926};
22927
22928},{}],12:[function(require,module,exports){
22929(function (process){
22930'use strict';
22931
22932if (!process.version ||
22933 process.version.indexOf('v0.') === 0 ||
22934 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
22935 module.exports = nextTick;
22936} else {
22937 module.exports = process.nextTick;
22938}
22939
22940function nextTick(fn, arg1, arg2, arg3) {
22941 if (typeof fn !== 'function') {
22942 throw new TypeError('"callback" argument must be a function');
22943 }
22944 var len = arguments.length;
22945 var args, i;
22946 switch (len) {
22947 case 0:
22948 case 1:
22949 return process.nextTick(fn);
22950 case 2:
22951 return process.nextTick(function afterTickOne() {
22952 fn.call(null, arg1);
22953 });
22954 case 3:
22955 return process.nextTick(function afterTickTwo() {
22956 fn.call(null, arg1, arg2);
22957 });
22958 case 4:
22959 return process.nextTick(function afterTickThree() {
22960 fn.call(null, arg1, arg2, arg3);
22961 });
22962 default:
22963 args = new Array(len - 1);
22964 i = 0;
22965 while (i < args.length) {
22966 args[i++] = arguments[i];
22967 }
22968 return process.nextTick(function afterTick() {
22969 fn.apply(null, args);
22970 });
22971 }
22972}
22973
22974}).call(this,require('_process'))
22975},{"_process":13}],13:[function(require,module,exports){
22976// shim for using process in browser
22977var process = module.exports = {};
22978
22979// cached from whatever global is present so that test runners that stub it
22980// don't break things. But we need to wrap it in a try catch in case it is
22981// wrapped in strict mode code which doesn't define any globals. It's inside a
22982// function because try/catches deoptimize in certain engines.
22983
22984var cachedSetTimeout;
22985var cachedClearTimeout;
22986
22987function defaultSetTimout() {
22988 throw new Error('setTimeout has not been defined');
22989}
22990function defaultClearTimeout () {
22991 throw new Error('clearTimeout has not been defined');
22992}
22993(function () {
22994 try {
22995 if (typeof setTimeout === 'function') {
22996 cachedSetTimeout = setTimeout;
22997 } else {
22998 cachedSetTimeout = defaultSetTimout;
22999 }
23000 } catch (e) {
23001 cachedSetTimeout = defaultSetTimout;
23002 }
23003 try {
23004 if (typeof clearTimeout === 'function') {
23005 cachedClearTimeout = clearTimeout;
23006 } else {
23007 cachedClearTimeout = defaultClearTimeout;
23008 }
23009 } catch (e) {
23010 cachedClearTimeout = defaultClearTimeout;
23011 }
23012} ())
23013function runTimeout(fun) {
23014 if (cachedSetTimeout === setTimeout) {
23015 //normal enviroments in sane situations
23016 return setTimeout(fun, 0);
23017 }
23018 // if setTimeout wasn't available but was latter defined
23019 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
23020 cachedSetTimeout = setTimeout;
23021 return setTimeout(fun, 0);
23022 }
23023 try {
23024 // when when somebody has screwed with setTimeout but no I.E. maddness
23025 return cachedSetTimeout(fun, 0);
23026 } catch(e){
23027 try {
23028 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
23029 return cachedSetTimeout.call(null, fun, 0);
23030 } catch(e){
23031 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
23032 return cachedSetTimeout.call(this, fun, 0);
23033 }
23034 }
23035
23036
23037}
23038function runClearTimeout(marker) {
23039 if (cachedClearTimeout === clearTimeout) {
23040 //normal enviroments in sane situations
23041 return clearTimeout(marker);
23042 }
23043 // if clearTimeout wasn't available but was latter defined
23044 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
23045 cachedClearTimeout = clearTimeout;
23046 return clearTimeout(marker);
23047 }
23048 try {
23049 // when when somebody has screwed with setTimeout but no I.E. maddness
23050 return cachedClearTimeout(marker);
23051 } catch (e){
23052 try {
23053 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
23054 return cachedClearTimeout.call(null, marker);
23055 } catch (e){
23056 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
23057 // Some versions of I.E. have different rules for clearTimeout vs setTimeout
23058 return cachedClearTimeout.call(this, marker);
23059 }
23060 }
23061
23062
23063
23064}
23065var queue = [];
23066var draining = false;
23067var currentQueue;
23068var queueIndex = -1;
23069
23070function cleanUpNextTick() {
23071 if (!draining || !currentQueue) {
23072 return;
23073 }
23074 draining = false;
23075 if (currentQueue.length) {
23076 queue = currentQueue.concat(queue);
23077 } else {
23078 queueIndex = -1;
23079 }
23080 if (queue.length) {
23081 drainQueue();
23082 }
23083}
23084
23085function drainQueue() {
23086 if (draining) {
23087 return;
23088 }
23089 var timeout = runTimeout(cleanUpNextTick);
23090 draining = true;
23091
23092 var len = queue.length;
23093 while(len) {
23094 currentQueue = queue;
23095 queue = [];
23096 while (++queueIndex < len) {
23097 if (currentQueue) {
23098 currentQueue[queueIndex].run();
23099 }
23100 }
23101 queueIndex = -1;
23102 len = queue.length;
23103 }
23104 currentQueue = null;
23105 draining = false;
23106 runClearTimeout(timeout);
23107}
23108
23109process.nextTick = function (fun) {
23110 var args = new Array(arguments.length - 1);
23111 if (arguments.length > 1) {
23112 for (var i = 1; i < arguments.length; i++) {
23113 args[i - 1] = arguments[i];
23114 }
23115 }
23116 queue.push(new Item(fun, args));
23117 if (queue.length === 1 && !draining) {
23118 runTimeout(drainQueue);
23119 }
23120};
23121
23122// v8 likes predictible objects
23123function Item(fun, array) {
23124 this.fun = fun;
23125 this.array = array;
23126}
23127Item.prototype.run = function () {
23128 this.fun.apply(null, this.array);
23129};
23130process.title = 'browser';
23131process.browser = true;
23132process.env = {};
23133process.argv = [];
23134process.version = ''; // empty string to avoid regexp issues
23135process.versions = {};
23136
23137function noop() {}
23138
23139process.on = noop;
23140process.addListener = noop;
23141process.once = noop;
23142process.off = noop;
23143process.removeListener = noop;
23144process.removeAllListeners = noop;
23145process.emit = noop;
23146
23147process.binding = function (name) {
23148 throw new Error('process.binding is not supported');
23149};
23150
23151process.cwd = function () { return '/' };
23152process.chdir = function (dir) {
23153 throw new Error('process.chdir is not supported');
23154};
23155process.umask = function() { return 0; };
23156
23157},{}],14:[function(require,module,exports){
23158module.exports = require("./lib/_stream_duplex.js")
23159
23160},{"./lib/_stream_duplex.js":15}],15:[function(require,module,exports){
23161// a duplex stream is just a stream that is both readable and writable.
23162// Since JS doesn't have multiple prototypal inheritance, this class
23163// prototypally inherits from Readable, and then parasitically from
23164// Writable.
23165
23166'use strict';
23167
23168/*<replacement>*/
23169
23170var objectKeys = Object.keys || function (obj) {
23171 var keys = [];
23172 for (var key in obj) {
23173 keys.push(key);
23174 }return keys;
23175};
23176/*</replacement>*/
23177
23178module.exports = Duplex;
23179
23180/*<replacement>*/
23181var processNextTick = require('process-nextick-args');
23182/*</replacement>*/
23183
23184/*<replacement>*/
23185var util = require('core-util-is');
23186util.inherits = require('inherits');
23187/*</replacement>*/
23188
23189var Readable = require('./_stream_readable');
23190var Writable = require('./_stream_writable');
23191
23192util.inherits(Duplex, Readable);
23193
23194var keys = objectKeys(Writable.prototype);
23195for (var v = 0; v < keys.length; v++) {
23196 var method = keys[v];
23197 if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
23198}
23199
23200function Duplex(options) {
23201 if (!(this instanceof Duplex)) return new Duplex(options);
23202
23203 Readable.call(this, options);
23204 Writable.call(this, options);
23205
23206 if (options && options.readable === false) this.readable = false;
23207
23208 if (options && options.writable === false) this.writable = false;
23209
23210 this.allowHalfOpen = true;
23211 if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
23212
23213 this.once('end', onend);
23214}
23215
23216// the no-half-open enforcer
23217function onend() {
23218 // if we allow half-open state, or if the writable side ended,
23219 // then we're ok.
23220 if (this.allowHalfOpen || this._writableState.ended) return;
23221
23222 // no more data can be written.
23223 // But allow more writes to happen in this tick.
23224 processNextTick(onEndNT, this);
23225}
23226
23227function onEndNT(self) {
23228 self.end();
23229}
23230
23231function forEach(xs, f) {
23232 for (var i = 0, l = xs.length; i < l; i++) {
23233 f(xs[i], i);
23234 }
23235}
23236},{"./_stream_readable":17,"./_stream_writable":19,"core-util-is":6,"inherits":9,"process-nextick-args":12}],16:[function(require,module,exports){
23237// a passthrough stream.
23238// basically just the most minimal sort of Transform stream.
23239// Every written chunk gets output as-is.
23240
23241'use strict';
23242
23243module.exports = PassThrough;
23244
23245var Transform = require('./_stream_transform');
23246
23247/*<replacement>*/
23248var util = require('core-util-is');
23249util.inherits = require('inherits');
23250/*</replacement>*/
23251
23252util.inherits(PassThrough, Transform);
23253
23254function PassThrough(options) {
23255 if (!(this instanceof PassThrough)) return new PassThrough(options);
23256
23257 Transform.call(this, options);
23258}
23259
23260PassThrough.prototype._transform = function (chunk, encoding, cb) {
23261 cb(null, chunk);
23262};
23263},{"./_stream_transform":18,"core-util-is":6,"inherits":9}],17:[function(require,module,exports){
23264(function (process){
23265'use strict';
23266
23267module.exports = Readable;
23268
23269/*<replacement>*/
23270var processNextTick = require('process-nextick-args');
23271/*</replacement>*/
23272
23273/*<replacement>*/
23274var isArray = require('isarray');
23275/*</replacement>*/
23276
23277/*<replacement>*/
23278var Duplex;
23279/*</replacement>*/
23280
23281Readable.ReadableState = ReadableState;
23282
23283/*<replacement>*/
23284var EE = require('events').EventEmitter;
23285
23286var EElistenerCount = function (emitter, type) {
23287 return emitter.listeners(type).length;
23288};
23289/*</replacement>*/
23290
23291/*<replacement>*/
23292var Stream;
23293(function () {
23294 try {
23295 Stream = require('st' + 'ream');
23296 } catch (_) {} finally {
23297 if (!Stream) Stream = require('events').EventEmitter;
23298 }
23299})();
23300/*</replacement>*/
23301
23302var Buffer = require('buffer').Buffer;
23303/*<replacement>*/
23304var bufferShim = require('buffer-shims');
23305/*</replacement>*/
23306
23307/*<replacement>*/
23308var util = require('core-util-is');
23309util.inherits = require('inherits');
23310/*</replacement>*/
23311
23312/*<replacement>*/
23313var debugUtil = require('util');
23314var debug = void 0;
23315if (debugUtil && debugUtil.debuglog) {
23316 debug = debugUtil.debuglog('stream');
23317} else {
23318 debug = function () {};
23319}
23320/*</replacement>*/
23321
23322var BufferList = require('./internal/streams/BufferList');
23323var StringDecoder;
23324
23325util.inherits(Readable, Stream);
23326
23327function prependListener(emitter, event, fn) {
23328 // Sadly this is not cacheable as some libraries bundle their own
23329 // event emitter implementation with them.
23330 if (typeof emitter.prependListener === 'function') {
23331 return emitter.prependListener(event, fn);
23332 } else {
23333 // This is a hack to make sure that our error handler is attached before any
23334 // userland ones. NEVER DO THIS. This is here only because this code needs
23335 // to continue to work with older versions of Node.js that do not include
23336 // the prependListener() method. The goal is to eventually remove this hack.
23337 if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
23338 }
23339}
23340
23341function ReadableState(options, stream) {
23342 Duplex = Duplex || require('./_stream_duplex');
23343
23344 options = options || {};
23345
23346 // object stream flag. Used to make read(n) ignore n and to
23347 // make all the buffer merging and length checks go away
23348 this.objectMode = !!options.objectMode;
23349
23350 if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
23351
23352 // the point at which it stops calling _read() to fill the buffer
23353 // Note: 0 is a valid value, means "don't call _read preemptively ever"
23354 var hwm = options.highWaterMark;
23355 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
23356 this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
23357
23358 // cast to ints.
23359 this.highWaterMark = ~ ~this.highWaterMark;
23360
23361 // A linked list is used to store data chunks instead of an array because the
23362 // linked list can remove elements from the beginning faster than
23363 // array.shift()
23364 this.buffer = new BufferList();
23365 this.length = 0;
23366 this.pipes = null;
23367 this.pipesCount = 0;
23368 this.flowing = null;
23369 this.ended = false;
23370 this.endEmitted = false;
23371 this.reading = false;
23372
23373 // a flag to be able to tell if the onwrite cb is called immediately,
23374 // or on a later tick. We set this to true at first, because any
23375 // actions that shouldn't happen until "later" should generally also
23376 // not happen before the first write call.
23377 this.sync = true;
23378
23379 // whenever we return null, then we set a flag to say
23380 // that we're awaiting a 'readable' event emission.
23381 this.needReadable = false;
23382 this.emittedReadable = false;
23383 this.readableListening = false;
23384 this.resumeScheduled = false;
23385
23386 // Crypto is kind of old and crusty. Historically, its default string
23387 // encoding is 'binary' so we have to make this configurable.
23388 // Everything else in the universe uses 'utf8', though.
23389 this.defaultEncoding = options.defaultEncoding || 'utf8';
23390
23391 // when piping, we only care about 'readable' events that happen
23392 // after read()ing all the bytes and not getting any pushback.
23393 this.ranOut = false;
23394
23395 // the number of writers that are awaiting a drain event in .pipe()s
23396 this.awaitDrain = 0;
23397
23398 // if true, a maybeReadMore has been scheduled
23399 this.readingMore = false;
23400
23401 this.decoder = null;
23402 this.encoding = null;
23403 if (options.encoding) {
23404 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
23405 this.decoder = new StringDecoder(options.encoding);
23406 this.encoding = options.encoding;
23407 }
23408}
23409
23410function Readable(options) {
23411 Duplex = Duplex || require('./_stream_duplex');
23412
23413 if (!(this instanceof Readable)) return new Readable(options);
23414
23415 this._readableState = new ReadableState(options, this);
23416
23417 // legacy
23418 this.readable = true;
23419
23420 if (options && typeof options.read === 'function') this._read = options.read;
23421
23422 Stream.call(this);
23423}
23424
23425// Manually shove something into the read() buffer.
23426// This returns true if the highWaterMark has not been hit yet,
23427// similar to how Writable.write() returns true if you should
23428// write() some more.
23429Readable.prototype.push = function (chunk, encoding) {
23430 var state = this._readableState;
23431
23432 if (!state.objectMode && typeof chunk === 'string') {
23433 encoding = encoding || state.defaultEncoding;
23434 if (encoding !== state.encoding) {
23435 chunk = bufferShim.from(chunk, encoding);
23436 encoding = '';
23437 }
23438 }
23439
23440 return readableAddChunk(this, state, chunk, encoding, false);
23441};
23442
23443// Unshift should *always* be something directly out of read()
23444Readable.prototype.unshift = function (chunk) {
23445 var state = this._readableState;
23446 return readableAddChunk(this, state, chunk, '', true);
23447};
23448
23449Readable.prototype.isPaused = function () {
23450 return this._readableState.flowing === false;
23451};
23452
23453function readableAddChunk(stream, state, chunk, encoding, addToFront) {
23454 var er = chunkInvalid(state, chunk);
23455 if (er) {
23456 stream.emit('error', er);
23457 } else if (chunk === null) {
23458 state.reading = false;
23459 onEofChunk(stream, state);
23460 } else if (state.objectMode || chunk && chunk.length > 0) {
23461 if (state.ended && !addToFront) {
23462 var e = new Error('stream.push() after EOF');
23463 stream.emit('error', e);
23464 } else if (state.endEmitted && addToFront) {
23465 var _e = new Error('stream.unshift() after end event');
23466 stream.emit('error', _e);
23467 } else {
23468 var skipAdd;
23469 if (state.decoder && !addToFront && !encoding) {
23470 chunk = state.decoder.write(chunk);
23471 skipAdd = !state.objectMode && chunk.length === 0;
23472 }
23473
23474 if (!addToFront) state.reading = false;
23475
23476 // Don't add to the buffer if we've decoded to an empty string chunk and
23477 // we're not in object mode
23478 if (!skipAdd) {
23479 // if we want the data now, just emit it.
23480 if (state.flowing && state.length === 0 && !state.sync) {
23481 stream.emit('data', chunk);
23482 stream.read(0);
23483 } else {
23484 // update the buffer info.
23485 state.length += state.objectMode ? 1 : chunk.length;
23486 if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
23487
23488 if (state.needReadable) emitReadable(stream);
23489 }
23490 }
23491
23492 maybeReadMore(stream, state);
23493 }
23494 } else if (!addToFront) {
23495 state.reading = false;
23496 }
23497
23498 return needMoreData(state);
23499}
23500
23501// if it's past the high water mark, we can push in some more.
23502// Also, if we have no data yet, we can stand some
23503// more bytes. This is to work around cases where hwm=0,
23504// such as the repl. Also, if the push() triggered a
23505// readable event, and the user called read(largeNumber) such that
23506// needReadable was set, then we ought to push more, so that another
23507// 'readable' event will be triggered.
23508function needMoreData(state) {
23509 return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
23510}
23511
23512// backwards compatibility.
23513Readable.prototype.setEncoding = function (enc) {
23514 if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
23515 this._readableState.decoder = new StringDecoder(enc);
23516 this._readableState.encoding = enc;
23517 return this;
23518};
23519
23520// Don't raise the hwm > 8MB
23521var MAX_HWM = 0x800000;
23522function computeNewHighWaterMark(n) {
23523 if (n >= MAX_HWM) {
23524 n = MAX_HWM;
23525 } else {
23526 // Get the next highest power of 2 to prevent increasing hwm excessively in
23527 // tiny amounts
23528 n--;
23529 n |= n >>> 1;
23530 n |= n >>> 2;
23531 n |= n >>> 4;
23532 n |= n >>> 8;
23533 n |= n >>> 16;
23534 n++;
23535 }
23536 return n;
23537}
23538
23539// This function is designed to be inlinable, so please take care when making
23540// changes to the function body.
23541function howMuchToRead(n, state) {
23542 if (n <= 0 || state.length === 0 && state.ended) return 0;
23543 if (state.objectMode) return 1;
23544 if (n !== n) {
23545 // Only flow one buffer at a time
23546 if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
23547 }
23548 // If we're asking for more than the current hwm, then raise the hwm.
23549 if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
23550 if (n <= state.length) return n;
23551 // Don't have enough
23552 if (!state.ended) {
23553 state.needReadable = true;
23554 return 0;
23555 }
23556 return state.length;
23557}
23558
23559// you can override either this method, or the async _read(n) below.
23560Readable.prototype.read = function (n) {
23561 debug('read', n);
23562 n = parseInt(n, 10);
23563 var state = this._readableState;
23564 var nOrig = n;
23565
23566 if (n !== 0) state.emittedReadable = false;
23567
23568 // if we're doing read(0) to trigger a readable event, but we
23569 // already have a bunch of data in the buffer, then just trigger
23570 // the 'readable' event and move on.
23571 if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
23572 debug('read: emitReadable', state.length, state.ended);
23573 if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
23574 return null;
23575 }
23576
23577 n = howMuchToRead(n, state);
23578
23579 // if we've ended, and we're now clear, then finish it up.
23580 if (n === 0 && state.ended) {
23581 if (state.length === 0) endReadable(this);
23582 return null;
23583 }
23584
23585 // All the actual chunk generation logic needs to be
23586 // *below* the call to _read. The reason is that in certain
23587 // synthetic stream cases, such as passthrough streams, _read
23588 // may be a completely synchronous operation which may change
23589 // the state of the read buffer, providing enough data when
23590 // before there was *not* enough.
23591 //
23592 // So, the steps are:
23593 // 1. Figure out what the state of things will be after we do
23594 // a read from the buffer.
23595 //
23596 // 2. If that resulting state will trigger a _read, then call _read.
23597 // Note that this may be asynchronous, or synchronous. Yes, it is
23598 // deeply ugly to write APIs this way, but that still doesn't mean
23599 // that the Readable class should behave improperly, as streams are
23600 // designed to be sync/async agnostic.
23601 // Take note if the _read call is sync or async (ie, if the read call
23602 // has returned yet), so that we know whether or not it's safe to emit
23603 // 'readable' etc.
23604 //
23605 // 3. Actually pull the requested chunks out of the buffer and return.
23606
23607 // if we need a readable event, then we need to do some reading.
23608 var doRead = state.needReadable;
23609 debug('need readable', doRead);
23610
23611 // if we currently have less than the highWaterMark, then also read some
23612 if (state.length === 0 || state.length - n < state.highWaterMark) {
23613 doRead = true;
23614 debug('length less than watermark', doRead);
23615 }
23616
23617 // however, if we've ended, then there's no point, and if we're already
23618 // reading, then it's unnecessary.
23619 if (state.ended || state.reading) {
23620 doRead = false;
23621 debug('reading or ended', doRead);
23622 } else if (doRead) {
23623 debug('do read');
23624 state.reading = true;
23625 state.sync = true;
23626 // if the length is currently zero, then we *need* a readable event.
23627 if (state.length === 0) state.needReadable = true;
23628 // call internal read method
23629 this._read(state.highWaterMark);
23630 state.sync = false;
23631 // If _read pushed data synchronously, then `reading` will be false,
23632 // and we need to re-evaluate how much data we can return to the user.
23633 if (!state.reading) n = howMuchToRead(nOrig, state);
23634 }
23635
23636 var ret;
23637 if (n > 0) ret = fromList(n, state);else ret = null;
23638
23639 if (ret === null) {
23640 state.needReadable = true;
23641 n = 0;
23642 } else {
23643 state.length -= n;
23644 }
23645
23646 if (state.length === 0) {
23647 // If we have nothing in the buffer, then we want to know
23648 // as soon as we *do* get something into the buffer.
23649 if (!state.ended) state.needReadable = true;
23650
23651 // If we tried to read() past the EOF, then emit end on the next tick.
23652 if (nOrig !== n && state.ended) endReadable(this);
23653 }
23654
23655 if (ret !== null) this.emit('data', ret);
23656
23657 return ret;
23658};
23659
23660function chunkInvalid(state, chunk) {
23661 var er = null;
23662 if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
23663 er = new TypeError('Invalid non-string/buffer chunk');
23664 }
23665 return er;
23666}
23667
23668function onEofChunk(stream, state) {
23669 if (state.ended) return;
23670 if (state.decoder) {
23671 var chunk = state.decoder.end();
23672 if (chunk && chunk.length) {
23673 state.buffer.push(chunk);
23674 state.length += state.objectMode ? 1 : chunk.length;
23675 }
23676 }
23677 state.ended = true;
23678
23679 // emit 'readable' now to make sure it gets picked up.
23680 emitReadable(stream);
23681}
23682
23683// Don't emit readable right away in sync mode, because this can trigger
23684// another read() call => stack overflow. This way, it might trigger
23685// a nextTick recursion warning, but that's not so bad.
23686function emitReadable(stream) {
23687 var state = stream._readableState;
23688 state.needReadable = false;
23689 if (!state.emittedReadable) {
23690 debug('emitReadable', state.flowing);
23691 state.emittedReadable = true;
23692 if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
23693 }
23694}
23695
23696function emitReadable_(stream) {
23697 debug('emit readable');
23698 stream.emit('readable');
23699 flow(stream);
23700}
23701
23702// at this point, the user has presumably seen the 'readable' event,
23703// and called read() to consume some data. that may have triggered
23704// in turn another _read(n) call, in which case reading = true if
23705// it's in progress.
23706// However, if we're not ended, or reading, and the length < hwm,
23707// then go ahead and try to read some more preemptively.
23708function maybeReadMore(stream, state) {
23709 if (!state.readingMore) {
23710 state.readingMore = true;
23711 processNextTick(maybeReadMore_, stream, state);
23712 }
23713}
23714
23715function maybeReadMore_(stream, state) {
23716 var len = state.length;
23717 while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
23718 debug('maybeReadMore read 0');
23719 stream.read(0);
23720 if (len === state.length)
23721 // didn't get any data, stop spinning.
23722 break;else len = state.length;
23723 }
23724 state.readingMore = false;
23725}
23726
23727// abstract method. to be overridden in specific implementation classes.
23728// call cb(er, data) where data is <= n in length.
23729// for virtual (non-string, non-buffer) streams, "length" is somewhat
23730// arbitrary, and perhaps not very meaningful.
23731Readable.prototype._read = function (n) {
23732 this.emit('error', new Error('_read() is not implemented'));
23733};
23734
23735Readable.prototype.pipe = function (dest, pipeOpts) {
23736 var src = this;
23737 var state = this._readableState;
23738
23739 switch (state.pipesCount) {
23740 case 0:
23741 state.pipes = dest;
23742 break;
23743 case 1:
23744 state.pipes = [state.pipes, dest];
23745 break;
23746 default:
23747 state.pipes.push(dest);
23748 break;
23749 }
23750 state.pipesCount += 1;
23751 debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
23752
23753 var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
23754
23755 var endFn = doEnd ? onend : cleanup;
23756 if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
23757
23758 dest.on('unpipe', onunpipe);
23759 function onunpipe(readable) {
23760 debug('onunpipe');
23761 if (readable === src) {
23762 cleanup();
23763 }
23764 }
23765
23766 function onend() {
23767 debug('onend');
23768 dest.end();
23769 }
23770
23771 // when the dest drains, it reduces the awaitDrain counter
23772 // on the source. This would be more elegant with a .once()
23773 // handler in flow(), but adding and removing repeatedly is
23774 // too slow.
23775 var ondrain = pipeOnDrain(src);
23776 dest.on('drain', ondrain);
23777
23778 var cleanedUp = false;
23779 function cleanup() {
23780 debug('cleanup');
23781 // cleanup event handlers once the pipe is broken
23782 dest.removeListener('close', onclose);
23783 dest.removeListener('finish', onfinish);
23784 dest.removeListener('drain', ondrain);
23785 dest.removeListener('error', onerror);
23786 dest.removeListener('unpipe', onunpipe);
23787 src.removeListener('end', onend);
23788 src.removeListener('end', cleanup);
23789 src.removeListener('data', ondata);
23790
23791 cleanedUp = true;
23792
23793 // if the reader is waiting for a drain event from this
23794 // specific writer, then it would cause it to never start
23795 // flowing again.
23796 // So, if this is awaiting a drain, then we just call it now.
23797 // If we don't know, then assume that we are waiting for one.
23798 if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
23799 }
23800
23801 // If the user pushes more data while we're writing to dest then we'll end up
23802 // in ondata again. However, we only want to increase awaitDrain once because
23803 // dest will only emit one 'drain' event for the multiple writes.
23804 // => Introduce a guard on increasing awaitDrain.
23805 var increasedAwaitDrain = false;
23806 src.on('data', ondata);
23807 function ondata(chunk) {
23808 debug('ondata');
23809 increasedAwaitDrain = false;
23810 var ret = dest.write(chunk);
23811 if (false === ret && !increasedAwaitDrain) {
23812 // If the user unpiped during `dest.write()`, it is possible
23813 // to get stuck in a permanently paused state if that write
23814 // also returned false.
23815 // => Check whether `dest` is still a piping destination.
23816 if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
23817 debug('false write response, pause', src._readableState.awaitDrain);
23818 src._readableState.awaitDrain++;
23819 increasedAwaitDrain = true;
23820 }
23821 src.pause();
23822 }
23823 }
23824
23825 // if the dest has an error, then stop piping into it.
23826 // however, don't suppress the throwing behavior for this.
23827 function onerror(er) {
23828 debug('onerror', er);
23829 unpipe();
23830 dest.removeListener('error', onerror);
23831 if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
23832 }
23833
23834 // Make sure our error handler is attached before userland ones.
23835 prependListener(dest, 'error', onerror);
23836
23837 // Both close and finish should trigger unpipe, but only once.
23838 function onclose() {
23839 dest.removeListener('finish', onfinish);
23840 unpipe();
23841 }
23842 dest.once('close', onclose);
23843 function onfinish() {
23844 debug('onfinish');
23845 dest.removeListener('close', onclose);
23846 unpipe();
23847 }
23848 dest.once('finish', onfinish);
23849
23850 function unpipe() {
23851 debug('unpipe');
23852 src.unpipe(dest);
23853 }
23854
23855 // tell the dest that it's being piped to
23856 dest.emit('pipe', src);
23857
23858 // start the flow if it hasn't been started already.
23859 if (!state.flowing) {
23860 debug('pipe resume');
23861 src.resume();
23862 }
23863
23864 return dest;
23865};
23866
23867function pipeOnDrain(src) {
23868 return function () {
23869 var state = src._readableState;
23870 debug('pipeOnDrain', state.awaitDrain);
23871 if (state.awaitDrain) state.awaitDrain--;
23872 if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
23873 state.flowing = true;
23874 flow(src);
23875 }
23876 };
23877}
23878
23879Readable.prototype.unpipe = function (dest) {
23880 var state = this._readableState;
23881
23882 // if we're not piping anywhere, then do nothing.
23883 if (state.pipesCount === 0) return this;
23884
23885 // just one destination. most common case.
23886 if (state.pipesCount === 1) {
23887 // passed in one, but it's not the right one.
23888 if (dest && dest !== state.pipes) return this;
23889
23890 if (!dest) dest = state.pipes;
23891
23892 // got a match.
23893 state.pipes = null;
23894 state.pipesCount = 0;
23895 state.flowing = false;
23896 if (dest) dest.emit('unpipe', this);
23897 return this;
23898 }
23899
23900 // slow case. multiple pipe destinations.
23901
23902 if (!dest) {
23903 // remove all.
23904 var dests = state.pipes;
23905 var len = state.pipesCount;
23906 state.pipes = null;
23907 state.pipesCount = 0;
23908 state.flowing = false;
23909
23910 for (var i = 0; i < len; i++) {
23911 dests[i].emit('unpipe', this);
23912 }return this;
23913 }
23914
23915 // try to find the right one.
23916 var index = indexOf(state.pipes, dest);
23917 if (index === -1) return this;
23918
23919 state.pipes.splice(index, 1);
23920 state.pipesCount -= 1;
23921 if (state.pipesCount === 1) state.pipes = state.pipes[0];
23922
23923 dest.emit('unpipe', this);
23924
23925 return this;
23926};
23927
23928// set up data events if they are asked for
23929// Ensure readable listeners eventually get something
23930Readable.prototype.on = function (ev, fn) {
23931 var res = Stream.prototype.on.call(this, ev, fn);
23932
23933 if (ev === 'data') {
23934 // Start flowing on next tick if stream isn't explicitly paused
23935 if (this._readableState.flowing !== false) this.resume();
23936 } else if (ev === 'readable') {
23937 var state = this._readableState;
23938 if (!state.endEmitted && !state.readableListening) {
23939 state.readableListening = state.needReadable = true;
23940 state.emittedReadable = false;
23941 if (!state.reading) {
23942 processNextTick(nReadingNextTick, this);
23943 } else if (state.length) {
23944 emitReadable(this, state);
23945 }
23946 }
23947 }
23948
23949 return res;
23950};
23951Readable.prototype.addListener = Readable.prototype.on;
23952
23953function nReadingNextTick(self) {
23954 debug('readable nexttick read 0');
23955 self.read(0);
23956}
23957
23958// pause() and resume() are remnants of the legacy readable stream API
23959// If the user uses them, then switch into old mode.
23960Readable.prototype.resume = function () {
23961 var state = this._readableState;
23962 if (!state.flowing) {
23963 debug('resume');
23964 state.flowing = true;
23965 resume(this, state);
23966 }
23967 return this;
23968};
23969
23970function resume(stream, state) {
23971 if (!state.resumeScheduled) {
23972 state.resumeScheduled = true;
23973 processNextTick(resume_, stream, state);
23974 }
23975}
23976
23977function resume_(stream, state) {
23978 if (!state.reading) {
23979 debug('resume read 0');
23980 stream.read(0);
23981 }
23982
23983 state.resumeScheduled = false;
23984 state.awaitDrain = 0;
23985 stream.emit('resume');
23986 flow(stream);
23987 if (state.flowing && !state.reading) stream.read(0);
23988}
23989
23990Readable.prototype.pause = function () {
23991 debug('call pause flowing=%j', this._readableState.flowing);
23992 if (false !== this._readableState.flowing) {
23993 debug('pause');
23994 this._readableState.flowing = false;
23995 this.emit('pause');
23996 }
23997 return this;
23998};
23999
24000function flow(stream) {
24001 var state = stream._readableState;
24002 debug('flow', state.flowing);
24003 while (state.flowing && stream.read() !== null) {}
24004}
24005
24006// wrap an old-style stream as the async data source.
24007// This is *not* part of the readable stream interface.
24008// It is an ugly unfortunate mess of history.
24009Readable.prototype.wrap = function (stream) {
24010 var state = this._readableState;
24011 var paused = false;
24012
24013 var self = this;
24014 stream.on('end', function () {
24015 debug('wrapped end');
24016 if (state.decoder && !state.ended) {
24017 var chunk = state.decoder.end();
24018 if (chunk && chunk.length) self.push(chunk);
24019 }
24020
24021 self.push(null);
24022 });
24023
24024 stream.on('data', function (chunk) {
24025 debug('wrapped data');
24026 if (state.decoder) chunk = state.decoder.write(chunk);
24027
24028 // don't skip over falsy values in objectMode
24029 if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
24030
24031 var ret = self.push(chunk);
24032 if (!ret) {
24033 paused = true;
24034 stream.pause();
24035 }
24036 });
24037
24038 // proxy all the other methods.
24039 // important when wrapping filters and duplexes.
24040 for (var i in stream) {
24041 if (this[i] === undefined && typeof stream[i] === 'function') {
24042 this[i] = function (method) {
24043 return function () {
24044 return stream[method].apply(stream, arguments);
24045 };
24046 }(i);
24047 }
24048 }
24049
24050 // proxy certain important events.
24051 var events = ['error', 'close', 'destroy', 'pause', 'resume'];
24052 forEach(events, function (ev) {
24053 stream.on(ev, self.emit.bind(self, ev));
24054 });
24055
24056 // when we try to consume some more bytes, simply unpause the
24057 // underlying stream.
24058 self._read = function (n) {
24059 debug('wrapped _read', n);
24060 if (paused) {
24061 paused = false;
24062 stream.resume();
24063 }
24064 };
24065
24066 return self;
24067};
24068
24069// exposed for testing purposes only.
24070Readable._fromList = fromList;
24071
24072// Pluck off n bytes from an array of buffers.
24073// Length is the combined lengths of all the buffers in the list.
24074// This function is designed to be inlinable, so please take care when making
24075// changes to the function body.
24076function fromList(n, state) {
24077 // nothing buffered
24078 if (state.length === 0) return null;
24079
24080 var ret;
24081 if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
24082 // read it all, truncate the list
24083 if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
24084 state.buffer.clear();
24085 } else {
24086 // read part of list
24087 ret = fromListPartial(n, state.buffer, state.decoder);
24088 }
24089
24090 return ret;
24091}
24092
24093// Extracts only enough buffered data to satisfy the amount requested.
24094// This function is designed to be inlinable, so please take care when making
24095// changes to the function body.
24096function fromListPartial(n, list, hasStrings) {
24097 var ret;
24098 if (n < list.head.data.length) {
24099 // slice is the same for buffers and strings
24100 ret = list.head.data.slice(0, n);
24101 list.head.data = list.head.data.slice(n);
24102 } else if (n === list.head.data.length) {
24103 // first chunk is a perfect match
24104 ret = list.shift();
24105 } else {
24106 // result spans more than one buffer
24107 ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
24108 }
24109 return ret;
24110}
24111
24112// Copies a specified amount of characters from the list of buffered data
24113// chunks.
24114// This function is designed to be inlinable, so please take care when making
24115// changes to the function body.
24116function copyFromBufferString(n, list) {
24117 var p = list.head;
24118 var c = 1;
24119 var ret = p.data;
24120 n -= ret.length;
24121 while (p = p.next) {
24122 var str = p.data;
24123 var nb = n > str.length ? str.length : n;
24124 if (nb === str.length) ret += str;else ret += str.slice(0, n);
24125 n -= nb;
24126 if (n === 0) {
24127 if (nb === str.length) {
24128 ++c;
24129 if (p.next) list.head = p.next;else list.head = list.tail = null;
24130 } else {
24131 list.head = p;
24132 p.data = str.slice(nb);
24133 }
24134 break;
24135 }
24136 ++c;
24137 }
24138 list.length -= c;
24139 return ret;
24140}
24141
24142// Copies a specified amount of bytes from the list of buffered data chunks.
24143// This function is designed to be inlinable, so please take care when making
24144// changes to the function body.
24145function copyFromBuffer(n, list) {
24146 var ret = bufferShim.allocUnsafe(n);
24147 var p = list.head;
24148 var c = 1;
24149 p.data.copy(ret);
24150 n -= p.data.length;
24151 while (p = p.next) {
24152 var buf = p.data;
24153 var nb = n > buf.length ? buf.length : n;
24154 buf.copy(ret, ret.length - n, 0, nb);
24155 n -= nb;
24156 if (n === 0) {
24157 if (nb === buf.length) {
24158 ++c;
24159 if (p.next) list.head = p.next;else list.head = list.tail = null;
24160 } else {
24161 list.head = p;
24162 p.data = buf.slice(nb);
24163 }
24164 break;
24165 }
24166 ++c;
24167 }
24168 list.length -= c;
24169 return ret;
24170}
24171
24172function endReadable(stream) {
24173 var state = stream._readableState;
24174
24175 // If we get here before consuming all the bytes, then that is a
24176 // bug in node. Should never happen.
24177 if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
24178
24179 if (!state.endEmitted) {
24180 state.ended = true;
24181 processNextTick(endReadableNT, state, stream);
24182 }
24183}
24184
24185function endReadableNT(state, stream) {
24186 // Check that we didn't get one last unshift.
24187 if (!state.endEmitted && state.length === 0) {
24188 state.endEmitted = true;
24189 stream.readable = false;
24190 stream.emit('end');
24191 }
24192}
24193
24194function forEach(xs, f) {
24195 for (var i = 0, l = xs.length; i < l; i++) {
24196 f(xs[i], i);
24197 }
24198}
24199
24200function indexOf(xs, x) {
24201 for (var i = 0, l = xs.length; i < l; i++) {
24202 if (xs[i] === x) return i;
24203 }
24204 return -1;
24205}
24206}).call(this,require('_process'))
24207},{"./_stream_duplex":15,"./internal/streams/BufferList":20,"_process":13,"buffer":5,"buffer-shims":4,"core-util-is":6,"events":7,"inherits":9,"isarray":11,"process-nextick-args":12,"string_decoder/":26,"util":3}],18:[function(require,module,exports){
24208// a transform stream is a readable/writable stream where you do
24209// something with the data. Sometimes it's called a "filter",
24210// but that's not a great name for it, since that implies a thing where
24211// some bits pass through, and others are simply ignored. (That would
24212// be a valid example of a transform, of course.)
24213//
24214// While the output is causally related to the input, it's not a
24215// necessarily symmetric or synchronous transformation. For example,
24216// a zlib stream might take multiple plain-text writes(), and then
24217// emit a single compressed chunk some time in the future.
24218//
24219// Here's how this works:
24220//
24221// The Transform stream has all the aspects of the readable and writable
24222// stream classes. When you write(chunk), that calls _write(chunk,cb)
24223// internally, and returns false if there's a lot of pending writes
24224// buffered up. When you call read(), that calls _read(n) until
24225// there's enough pending readable data buffered up.
24226//
24227// In a transform stream, the written data is placed in a buffer. When
24228// _read(n) is called, it transforms the queued up data, calling the
24229// buffered _write cb's as it consumes chunks. If consuming a single
24230// written chunk would result in multiple output chunks, then the first
24231// outputted bit calls the readcb, and subsequent chunks just go into
24232// the read buffer, and will cause it to emit 'readable' if necessary.
24233//
24234// This way, back-pressure is actually determined by the reading side,
24235// since _read has to be called to start processing a new chunk. However,
24236// a pathological inflate type of transform can cause excessive buffering
24237// here. For example, imagine a stream where every byte of input is
24238// interpreted as an integer from 0-255, and then results in that many
24239// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
24240// 1kb of data being output. In this case, you could write a very small
24241// amount of input, and end up with a very large amount of output. In
24242// such a pathological inflating mechanism, there'd be no way to tell
24243// the system to stop doing the transform. A single 4MB write could
24244// cause the system to run out of memory.
24245//
24246// However, even in such a pathological case, only a single written chunk
24247// would be consumed, and then the rest would wait (un-transformed) until
24248// the results of the previous transformed chunk were consumed.
24249
24250'use strict';
24251
24252module.exports = Transform;
24253
24254var Duplex = require('./_stream_duplex');
24255
24256/*<replacement>*/
24257var util = require('core-util-is');
24258util.inherits = require('inherits');
24259/*</replacement>*/
24260
24261util.inherits(Transform, Duplex);
24262
24263function TransformState(stream) {
24264 this.afterTransform = function (er, data) {
24265 return afterTransform(stream, er, data);
24266 };
24267
24268 this.needTransform = false;
24269 this.transforming = false;
24270 this.writecb = null;
24271 this.writechunk = null;
24272 this.writeencoding = null;
24273}
24274
24275function afterTransform(stream, er, data) {
24276 var ts = stream._transformState;
24277 ts.transforming = false;
24278
24279 var cb = ts.writecb;
24280
24281 if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
24282
24283 ts.writechunk = null;
24284 ts.writecb = null;
24285
24286 if (data !== null && data !== undefined) stream.push(data);
24287
24288 cb(er);
24289
24290 var rs = stream._readableState;
24291 rs.reading = false;
24292 if (rs.needReadable || rs.length < rs.highWaterMark) {
24293 stream._read(rs.highWaterMark);
24294 }
24295}
24296
24297function Transform(options) {
24298 if (!(this instanceof Transform)) return new Transform(options);
24299
24300 Duplex.call(this, options);
24301
24302 this._transformState = new TransformState(this);
24303
24304 var stream = this;
24305
24306 // start out asking for a readable event once data is transformed.
24307 this._readableState.needReadable = true;
24308
24309 // we have implemented the _read method, and done the other things
24310 // that Readable wants before the first _read call, so unset the
24311 // sync guard flag.
24312 this._readableState.sync = false;
24313
24314 if (options) {
24315 if (typeof options.transform === 'function') this._transform = options.transform;
24316
24317 if (typeof options.flush === 'function') this._flush = options.flush;
24318 }
24319
24320 // When the writable side finishes, then flush out anything remaining.
24321 this.once('prefinish', function () {
24322 if (typeof this._flush === 'function') this._flush(function (er, data) {
24323 done(stream, er, data);
24324 });else done(stream);
24325 });
24326}
24327
24328Transform.prototype.push = function (chunk, encoding) {
24329 this._transformState.needTransform = false;
24330 return Duplex.prototype.push.call(this, chunk, encoding);
24331};
24332
24333// This is the part where you do stuff!
24334// override this function in implementation classes.
24335// 'chunk' is an input chunk.
24336//
24337// Call `push(newChunk)` to pass along transformed output
24338// to the readable side. You may call 'push' zero or more times.
24339//
24340// Call `cb(err)` when you are done with this chunk. If you pass
24341// an error, then that'll put the hurt on the whole operation. If you
24342// never call cb(), then you'll never get another chunk.
24343Transform.prototype._transform = function (chunk, encoding, cb) {
24344 throw new Error('_transform() is not implemented');
24345};
24346
24347Transform.prototype._write = function (chunk, encoding, cb) {
24348 var ts = this._transformState;
24349 ts.writecb = cb;
24350 ts.writechunk = chunk;
24351 ts.writeencoding = encoding;
24352 if (!ts.transforming) {
24353 var rs = this._readableState;
24354 if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
24355 }
24356};
24357
24358// Doesn't matter what the args are here.
24359// _transform does all the work.
24360// That we got here means that the readable side wants more data.
24361Transform.prototype._read = function (n) {
24362 var ts = this._transformState;
24363
24364 if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
24365 ts.transforming = true;
24366 this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
24367 } else {
24368 // mark that we need a transform, so that any data that comes in
24369 // will get processed, now that we've asked for it.
24370 ts.needTransform = true;
24371 }
24372};
24373
24374function done(stream, er, data) {
24375 if (er) return stream.emit('error', er);
24376
24377 if (data !== null && data !== undefined) stream.push(data);
24378
24379 // if there's nothing in the write buffer, then that means
24380 // that nothing more will ever be provided
24381 var ws = stream._writableState;
24382 var ts = stream._transformState;
24383
24384 if (ws.length) throw new Error('Calling transform done when ws.length != 0');
24385
24386 if (ts.transforming) throw new Error('Calling transform done when still transforming');
24387
24388 return stream.push(null);
24389}
24390},{"./_stream_duplex":15,"core-util-is":6,"inherits":9}],19:[function(require,module,exports){
24391(function (process){
24392// A bit simpler than readable streams.
24393// Implement an async ._write(chunk, encoding, cb), and it'll handle all
24394// the drain event emission and buffering.
24395
24396'use strict';
24397
24398module.exports = Writable;
24399
24400/*<replacement>*/
24401var processNextTick = require('process-nextick-args');
24402/*</replacement>*/
24403
24404/*<replacement>*/
24405var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
24406/*</replacement>*/
24407
24408/*<replacement>*/
24409var Duplex;
24410/*</replacement>*/
24411
24412Writable.WritableState = WritableState;
24413
24414/*<replacement>*/
24415var util = require('core-util-is');
24416util.inherits = require('inherits');
24417/*</replacement>*/
24418
24419/*<replacement>*/
24420var internalUtil = {
24421 deprecate: require('util-deprecate')
24422};
24423/*</replacement>*/
24424
24425/*<replacement>*/
24426var Stream;
24427(function () {
24428 try {
24429 Stream = require('st' + 'ream');
24430 } catch (_) {} finally {
24431 if (!Stream) Stream = require('events').EventEmitter;
24432 }
24433})();
24434/*</replacement>*/
24435
24436var Buffer = require('buffer').Buffer;
24437/*<replacement>*/
24438var bufferShim = require('buffer-shims');
24439/*</replacement>*/
24440
24441util.inherits(Writable, Stream);
24442
24443function nop() {}
24444
24445function WriteReq(chunk, encoding, cb) {
24446 this.chunk = chunk;
24447 this.encoding = encoding;
24448 this.callback = cb;
24449 this.next = null;
24450}
24451
24452function WritableState(options, stream) {
24453 Duplex = Duplex || require('./_stream_duplex');
24454
24455 options = options || {};
24456
24457 // object stream flag to indicate whether or not this stream
24458 // contains buffers or objects.
24459 this.objectMode = !!options.objectMode;
24460
24461 if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
24462
24463 // the point at which write() starts returning false
24464 // Note: 0 is a valid value, means that we always return false if
24465 // the entire buffer is not flushed immediately on write()
24466 var hwm = options.highWaterMark;
24467 var defaultHwm = this.objectMode ? 16 : 16 * 1024;
24468 this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
24469
24470 // cast to ints.
24471 this.highWaterMark = ~ ~this.highWaterMark;
24472
24473 // drain event flag.
24474 this.needDrain = false;
24475 // at the start of calling end()
24476 this.ending = false;
24477 // when end() has been called, and returned
24478 this.ended = false;
24479 // when 'finish' is emitted
24480 this.finished = false;
24481
24482 // should we decode strings into buffers before passing to _write?
24483 // this is here so that some node-core streams can optimize string
24484 // handling at a lower level.
24485 var noDecode = options.decodeStrings === false;
24486 this.decodeStrings = !noDecode;
24487
24488 // Crypto is kind of old and crusty. Historically, its default string
24489 // encoding is 'binary' so we have to make this configurable.
24490 // Everything else in the universe uses 'utf8', though.
24491 this.defaultEncoding = options.defaultEncoding || 'utf8';
24492
24493 // not an actual buffer we keep track of, but a measurement
24494 // of how much we're waiting to get pushed to some underlying
24495 // socket or file.
24496 this.length = 0;
24497
24498 // a flag to see when we're in the middle of a write.
24499 this.writing = false;
24500
24501 // when true all writes will be buffered until .uncork() call
24502 this.corked = 0;
24503
24504 // a flag to be able to tell if the onwrite cb is called immediately,
24505 // or on a later tick. We set this to true at first, because any
24506 // actions that shouldn't happen until "later" should generally also
24507 // not happen before the first write call.
24508 this.sync = true;
24509
24510 // a flag to know if we're processing previously buffered items, which
24511 // may call the _write() callback in the same tick, so that we don't
24512 // end up in an overlapped onwrite situation.
24513 this.bufferProcessing = false;
24514
24515 // the callback that's passed to _write(chunk,cb)
24516 this.onwrite = function (er) {
24517 onwrite(stream, er);
24518 };
24519
24520 // the callback that the user supplies to write(chunk,encoding,cb)
24521 this.writecb = null;
24522
24523 // the amount that is being written when _write is called.
24524 this.writelen = 0;
24525
24526 this.bufferedRequest = null;
24527 this.lastBufferedRequest = null;
24528
24529 // number of pending user-supplied write callbacks
24530 // this must be 0 before 'finish' can be emitted
24531 this.pendingcb = 0;
24532
24533 // emit prefinish if the only thing we're waiting for is _write cbs
24534 // This is relevant for synchronous Transform streams
24535 this.prefinished = false;
24536
24537 // True if the error was already emitted and should not be thrown again
24538 this.errorEmitted = false;
24539
24540 // count buffered requests
24541 this.bufferedRequestCount = 0;
24542
24543 // allocate the first CorkedRequest, there is always
24544 // one allocated and free to use, and we maintain at most two
24545 this.corkedRequestsFree = new CorkedRequest(this);
24546}
24547
24548WritableState.prototype.getBuffer = function getBuffer() {
24549 var current = this.bufferedRequest;
24550 var out = [];
24551 while (current) {
24552 out.push(current);
24553 current = current.next;
24554 }
24555 return out;
24556};
24557
24558(function () {
24559 try {
24560 Object.defineProperty(WritableState.prototype, 'buffer', {
24561 get: internalUtil.deprecate(function () {
24562 return this.getBuffer();
24563 }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
24564 });
24565 } catch (_) {}
24566})();
24567
24568// Test _writableState for inheritance to account for Duplex streams,
24569// whose prototype chain only points to Readable.
24570var realHasInstance;
24571if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
24572 realHasInstance = Function.prototype[Symbol.hasInstance];
24573 Object.defineProperty(Writable, Symbol.hasInstance, {
24574 value: function (object) {
24575 if (realHasInstance.call(this, object)) return true;
24576
24577 return object && object._writableState instanceof WritableState;
24578 }
24579 });
24580} else {
24581 realHasInstance = function (object) {
24582 return object instanceof this;
24583 };
24584}
24585
24586function Writable(options) {
24587 Duplex = Duplex || require('./_stream_duplex');
24588
24589 // Writable ctor is applied to Duplexes, too.
24590 // `realHasInstance` is necessary because using plain `instanceof`
24591 // would return false, as no `_writableState` property is attached.
24592
24593 // Trying to use the custom `instanceof` for Writable here will also break the
24594 // Node.js LazyTransform implementation, which has a non-trivial getter for
24595 // `_writableState` that would lead to infinite recursion.
24596 if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
24597 return new Writable(options);
24598 }
24599
24600 this._writableState = new WritableState(options, this);
24601
24602 // legacy.
24603 this.writable = true;
24604
24605 if (options) {
24606 if (typeof options.write === 'function') this._write = options.write;
24607
24608 if (typeof options.writev === 'function') this._writev = options.writev;
24609 }
24610
24611 Stream.call(this);
24612}
24613
24614// Otherwise people can pipe Writable streams, which is just wrong.
24615Writable.prototype.pipe = function () {
24616 this.emit('error', new Error('Cannot pipe, not readable'));
24617};
24618
24619function writeAfterEnd(stream, cb) {
24620 var er = new Error('write after end');
24621 // TODO: defer error events consistently everywhere, not just the cb
24622 stream.emit('error', er);
24623 processNextTick(cb, er);
24624}
24625
24626// If we get something that is not a buffer, string, null, or undefined,
24627// and we're not in objectMode, then that's an error.
24628// Otherwise stream chunks are all considered to be of length=1, and the
24629// watermarks determine how many objects to keep in the buffer, rather than
24630// how many bytes or characters.
24631function validChunk(stream, state, chunk, cb) {
24632 var valid = true;
24633 var er = false;
24634 // Always throw error if a null is written
24635 // if we are not in object mode then throw
24636 // if it is not a buffer, string, or undefined.
24637 if (chunk === null) {
24638 er = new TypeError('May not write null values to stream');
24639 } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
24640 er = new TypeError('Invalid non-string/buffer chunk');
24641 }
24642 if (er) {
24643 stream.emit('error', er);
24644 processNextTick(cb, er);
24645 valid = false;
24646 }
24647 return valid;
24648}
24649
24650Writable.prototype.write = function (chunk, encoding, cb) {
24651 var state = this._writableState;
24652 var ret = false;
24653
24654 if (typeof encoding === 'function') {
24655 cb = encoding;
24656 encoding = null;
24657 }
24658
24659 if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
24660
24661 if (typeof cb !== 'function') cb = nop;
24662
24663 if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
24664 state.pendingcb++;
24665 ret = writeOrBuffer(this, state, chunk, encoding, cb);
24666 }
24667
24668 return ret;
24669};
24670
24671Writable.prototype.cork = function () {
24672 var state = this._writableState;
24673
24674 state.corked++;
24675};
24676
24677Writable.prototype.uncork = function () {
24678 var state = this._writableState;
24679
24680 if (state.corked) {
24681 state.corked--;
24682
24683 if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
24684 }
24685};
24686
24687Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
24688 // node::ParseEncoding() requires lower case.
24689 if (typeof encoding === 'string') encoding = encoding.toLowerCase();
24690 if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
24691 this._writableState.defaultEncoding = encoding;
24692 return this;
24693};
24694
24695function decodeChunk(state, chunk, encoding) {
24696 if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
24697 chunk = bufferShim.from(chunk, encoding);
24698 }
24699 return chunk;
24700}
24701
24702// if we're already writing something, then just put this
24703// in the queue, and wait our turn. Otherwise, call _write
24704// If we return false, then we need a drain event, so set that flag.
24705function writeOrBuffer(stream, state, chunk, encoding, cb) {
24706 chunk = decodeChunk(state, chunk, encoding);
24707
24708 if (Buffer.isBuffer(chunk)) encoding = 'buffer';
24709 var len = state.objectMode ? 1 : chunk.length;
24710
24711 state.length += len;
24712
24713 var ret = state.length < state.highWaterMark;
24714 // we must ensure that previous needDrain will not be reset to false.
24715 if (!ret) state.needDrain = true;
24716
24717 if (state.writing || state.corked) {
24718 var last = state.lastBufferedRequest;
24719 state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
24720 if (last) {
24721 last.next = state.lastBufferedRequest;
24722 } else {
24723 state.bufferedRequest = state.lastBufferedRequest;
24724 }
24725 state.bufferedRequestCount += 1;
24726 } else {
24727 doWrite(stream, state, false, len, chunk, encoding, cb);
24728 }
24729
24730 return ret;
24731}
24732
24733function doWrite(stream, state, writev, len, chunk, encoding, cb) {
24734 state.writelen = len;
24735 state.writecb = cb;
24736 state.writing = true;
24737 state.sync = true;
24738 if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
24739 state.sync = false;
24740}
24741
24742function onwriteError(stream, state, sync, er, cb) {
24743 --state.pendingcb;
24744 if (sync) processNextTick(cb, er);else cb(er);
24745
24746 stream._writableState.errorEmitted = true;
24747 stream.emit('error', er);
24748}
24749
24750function onwriteStateUpdate(state) {
24751 state.writing = false;
24752 state.writecb = null;
24753 state.length -= state.writelen;
24754 state.writelen = 0;
24755}
24756
24757function onwrite(stream, er) {
24758 var state = stream._writableState;
24759 var sync = state.sync;
24760 var cb = state.writecb;
24761
24762 onwriteStateUpdate(state);
24763
24764 if (er) onwriteError(stream, state, sync, er, cb);else {
24765 // Check if we're actually ready to finish, but don't emit yet
24766 var finished = needFinish(state);
24767
24768 if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
24769 clearBuffer(stream, state);
24770 }
24771
24772 if (sync) {
24773 /*<replacement>*/
24774 asyncWrite(afterWrite, stream, state, finished, cb);
24775 /*</replacement>*/
24776 } else {
24777 afterWrite(stream, state, finished, cb);
24778 }
24779 }
24780}
24781
24782function afterWrite(stream, state, finished, cb) {
24783 if (!finished) onwriteDrain(stream, state);
24784 state.pendingcb--;
24785 cb();
24786 finishMaybe(stream, state);
24787}
24788
24789// Must force callback to be called on nextTick, so that we don't
24790// emit 'drain' before the write() consumer gets the 'false' return
24791// value, and has a chance to attach a 'drain' listener.
24792function onwriteDrain(stream, state) {
24793 if (state.length === 0 && state.needDrain) {
24794 state.needDrain = false;
24795 stream.emit('drain');
24796 }
24797}
24798
24799// if there's something in the buffer waiting, then process it
24800function clearBuffer(stream, state) {
24801 state.bufferProcessing = true;
24802 var entry = state.bufferedRequest;
24803
24804 if (stream._writev && entry && entry.next) {
24805 // Fast case, write everything using _writev()
24806 var l = state.bufferedRequestCount;
24807 var buffer = new Array(l);
24808 var holder = state.corkedRequestsFree;
24809 holder.entry = entry;
24810
24811 var count = 0;
24812 while (entry) {
24813 buffer[count] = entry;
24814 entry = entry.next;
24815 count += 1;
24816 }
24817
24818 doWrite(stream, state, true, state.length, buffer, '', holder.finish);
24819
24820 // doWrite is almost always async, defer these to save a bit of time
24821 // as the hot path ends with doWrite
24822 state.pendingcb++;
24823 state.lastBufferedRequest = null;
24824 if (holder.next) {
24825 state.corkedRequestsFree = holder.next;
24826 holder.next = null;
24827 } else {
24828 state.corkedRequestsFree = new CorkedRequest(state);
24829 }
24830 } else {
24831 // Slow case, write chunks one-by-one
24832 while (entry) {
24833 var chunk = entry.chunk;
24834 var encoding = entry.encoding;
24835 var cb = entry.callback;
24836 var len = state.objectMode ? 1 : chunk.length;
24837
24838 doWrite(stream, state, false, len, chunk, encoding, cb);
24839 entry = entry.next;
24840 // if we didn't call the onwrite immediately, then
24841 // it means that we need to wait until it does.
24842 // also, that means that the chunk and cb are currently
24843 // being processed, so move the buffer counter past them.
24844 if (state.writing) {
24845 break;
24846 }
24847 }
24848
24849 if (entry === null) state.lastBufferedRequest = null;
24850 }
24851
24852 state.bufferedRequestCount = 0;
24853 state.bufferedRequest = entry;
24854 state.bufferProcessing = false;
24855}
24856
24857Writable.prototype._write = function (chunk, encoding, cb) {
24858 cb(new Error('_write() is not implemented'));
24859};
24860
24861Writable.prototype._writev = null;
24862
24863Writable.prototype.end = function (chunk, encoding, cb) {
24864 var state = this._writableState;
24865
24866 if (typeof chunk === 'function') {
24867 cb = chunk;
24868 chunk = null;
24869 encoding = null;
24870 } else if (typeof encoding === 'function') {
24871 cb = encoding;
24872 encoding = null;
24873 }
24874
24875 if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
24876
24877 // .end() fully uncorks
24878 if (state.corked) {
24879 state.corked = 1;
24880 this.uncork();
24881 }
24882
24883 // ignore unnecessary end() calls.
24884 if (!state.ending && !state.finished) endWritable(this, state, cb);
24885};
24886
24887function needFinish(state) {
24888 return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
24889}
24890
24891function prefinish(stream, state) {
24892 if (!state.prefinished) {
24893 state.prefinished = true;
24894 stream.emit('prefinish');
24895 }
24896}
24897
24898function finishMaybe(stream, state) {
24899 var need = needFinish(state);
24900 if (need) {
24901 if (state.pendingcb === 0) {
24902 prefinish(stream, state);
24903 state.finished = true;
24904 stream.emit('finish');
24905 } else {
24906 prefinish(stream, state);
24907 }
24908 }
24909 return need;
24910}
24911
24912function endWritable(stream, state, cb) {
24913 state.ending = true;
24914 finishMaybe(stream, state);
24915 if (cb) {
24916 if (state.finished) processNextTick(cb);else stream.once('finish', cb);
24917 }
24918 state.ended = true;
24919 stream.writable = false;
24920}
24921
24922// It seems a linked list but it is not
24923// there will be only 2 of these for each stream
24924function CorkedRequest(state) {
24925 var _this = this;
24926
24927 this.next = null;
24928 this.entry = null;
24929
24930 this.finish = function (err) {
24931 var entry = _this.entry;
24932 _this.entry = null;
24933 while (entry) {
24934 var cb = entry.callback;
24935 state.pendingcb--;
24936 cb(err);
24937 entry = entry.next;
24938 }
24939 if (state.corkedRequestsFree) {
24940 state.corkedRequestsFree.next = _this;
24941 } else {
24942 state.corkedRequestsFree = _this;
24943 }
24944 };
24945}
24946}).call(this,require('_process'))
24947},{"./_stream_duplex":15,"_process":13,"buffer":5,"buffer-shims":4,"core-util-is":6,"events":7,"inherits":9,"process-nextick-args":12,"util-deprecate":27}],20:[function(require,module,exports){
24948'use strict';
24949
24950var Buffer = require('buffer').Buffer;
24951/*<replacement>*/
24952var bufferShim = require('buffer-shims');
24953/*</replacement>*/
24954
24955module.exports = BufferList;
24956
24957function BufferList() {
24958 this.head = null;
24959 this.tail = null;
24960 this.length = 0;
24961}
24962
24963BufferList.prototype.push = function (v) {
24964 var entry = { data: v, next: null };
24965 if (this.length > 0) this.tail.next = entry;else this.head = entry;
24966 this.tail = entry;
24967 ++this.length;
24968};
24969
24970BufferList.prototype.unshift = function (v) {
24971 var entry = { data: v, next: this.head };
24972 if (this.length === 0) this.tail = entry;
24973 this.head = entry;
24974 ++this.length;
24975};
24976
24977BufferList.prototype.shift = function () {
24978 if (this.length === 0) return;
24979 var ret = this.head.data;
24980 if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
24981 --this.length;
24982 return ret;
24983};
24984
24985BufferList.prototype.clear = function () {
24986 this.head = this.tail = null;
24987 this.length = 0;
24988};
24989
24990BufferList.prototype.join = function (s) {
24991 if (this.length === 0) return '';
24992 var p = this.head;
24993 var ret = '' + p.data;
24994 while (p = p.next) {
24995 ret += s + p.data;
24996 }return ret;
24997};
24998
24999BufferList.prototype.concat = function (n) {
25000 if (this.length === 0) return bufferShim.alloc(0);
25001 if (this.length === 1) return this.head.data;
25002 var ret = bufferShim.allocUnsafe(n >>> 0);
25003 var p = this.head;
25004 var i = 0;
25005 while (p) {
25006 p.data.copy(ret, i);
25007 i += p.data.length;
25008 p = p.next;
25009 }
25010 return ret;
25011};
25012},{"buffer":5,"buffer-shims":4}],21:[function(require,module,exports){
25013module.exports = require("./lib/_stream_passthrough.js")
25014
25015},{"./lib/_stream_passthrough.js":16}],22:[function(require,module,exports){
25016(function (process){
25017var Stream = (function (){
25018 try {
25019 return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
25020 } catch(_){}
25021}());
25022exports = module.exports = require('./lib/_stream_readable.js');
25023exports.Stream = Stream || exports;
25024exports.Readable = exports;
25025exports.Writable = require('./lib/_stream_writable.js');
25026exports.Duplex = require('./lib/_stream_duplex.js');
25027exports.Transform = require('./lib/_stream_transform.js');
25028exports.PassThrough = require('./lib/_stream_passthrough.js');
25029
25030if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
25031 module.exports = Stream;
25032}
25033
25034}).call(this,require('_process'))
25035},{"./lib/_stream_duplex.js":15,"./lib/_stream_passthrough.js":16,"./lib/_stream_readable.js":17,"./lib/_stream_transform.js":18,"./lib/_stream_writable.js":19,"_process":13}],23:[function(require,module,exports){
25036module.exports = require("./lib/_stream_transform.js")
25037
25038},{"./lib/_stream_transform.js":18}],24:[function(require,module,exports){
25039module.exports = require("./lib/_stream_writable.js")
25040
25041},{"./lib/_stream_writable.js":19}],25:[function(require,module,exports){
25042// Copyright Joyent, Inc. and other Node contributors.
25043//
25044// Permission is hereby granted, free of charge, to any person obtaining a
25045// copy of this software and associated documentation files (the
25046// "Software"), to deal in the Software without restriction, including
25047// without limitation the rights to use, copy, modify, merge, publish,
25048// distribute, sublicense, and/or sell copies of the Software, and to permit
25049// persons to whom the Software is furnished to do so, subject to the
25050// following conditions:
25051//
25052// The above copyright notice and this permission notice shall be included
25053// in all copies or substantial portions of the Software.
25054//
25055// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25056// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25057// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
25058// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25059// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25060// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25061// USE OR OTHER DEALINGS IN THE SOFTWARE.
25062
25063module.exports = Stream;
25064
25065var EE = require('events').EventEmitter;
25066var inherits = require('inherits');
25067
25068inherits(Stream, EE);
25069Stream.Readable = require('readable-stream/readable.js');
25070Stream.Writable = require('readable-stream/writable.js');
25071Stream.Duplex = require('readable-stream/duplex.js');
25072Stream.Transform = require('readable-stream/transform.js');
25073Stream.PassThrough = require('readable-stream/passthrough.js');
25074
25075// Backwards-compat with node 0.4.x
25076Stream.Stream = Stream;
25077
25078
25079
25080// old-style streams. Note that the pipe method (the only relevant
25081// part of this class) is overridden in the Readable class.
25082
25083function Stream() {
25084 EE.call(this);
25085}
25086
25087Stream.prototype.pipe = function(dest, options) {
25088 var source = this;
25089
25090 function ondata(chunk) {
25091 if (dest.writable) {
25092 if (false === dest.write(chunk) && source.pause) {
25093 source.pause();
25094 }
25095 }
25096 }
25097
25098 source.on('data', ondata);
25099
25100 function ondrain() {
25101 if (source.readable && source.resume) {
25102 source.resume();
25103 }
25104 }
25105
25106 dest.on('drain', ondrain);
25107
25108 // If the 'end' option is not supplied, dest.end() will be called when
25109 // source gets the 'end' or 'close' events. Only dest.end() once.
25110 if (!dest._isStdio && (!options || options.end !== false)) {
25111 source.on('end', onend);
25112 source.on('close', onclose);
25113 }
25114
25115 var didOnEnd = false;
25116 function onend() {
25117 if (didOnEnd) return;
25118 didOnEnd = true;
25119
25120 dest.end();
25121 }
25122
25123
25124 function onclose() {
25125 if (didOnEnd) return;
25126 didOnEnd = true;
25127
25128 if (typeof dest.destroy === 'function') dest.destroy();
25129 }
25130
25131 // don't leave dangling pipes when there are errors.
25132 function onerror(er) {
25133 cleanup();
25134 if (EE.listenerCount(this, 'error') === 0) {
25135 throw er; // Unhandled stream error in pipe.
25136 }
25137 }
25138
25139 source.on('error', onerror);
25140 dest.on('error', onerror);
25141
25142 // remove all the event listeners that were added.
25143 function cleanup() {
25144 source.removeListener('data', ondata);
25145 dest.removeListener('drain', ondrain);
25146
25147 source.removeListener('end', onend);
25148 source.removeListener('close', onclose);
25149
25150 source.removeListener('error', onerror);
25151 dest.removeListener('error', onerror);
25152
25153 source.removeListener('end', cleanup);
25154 source.removeListener('close', cleanup);
25155
25156 dest.removeListener('close', cleanup);
25157 }
25158
25159 source.on('end', cleanup);
25160 source.on('close', cleanup);
25161
25162 dest.on('close', cleanup);
25163
25164 dest.emit('pipe', source);
25165
25166 // Allow for unix-like usage: A.pipe(B).pipe(C)
25167 return dest;
25168};
25169
25170},{"events":7,"inherits":9,"readable-stream/duplex.js":14,"readable-stream/passthrough.js":21,"readable-stream/readable.js":22,"readable-stream/transform.js":23,"readable-stream/writable.js":24}],26:[function(require,module,exports){
25171// Copyright Joyent, Inc. and other Node contributors.
25172//
25173// Permission is hereby granted, free of charge, to any person obtaining a
25174// copy of this software and associated documentation files (the
25175// "Software"), to deal in the Software without restriction, including
25176// without limitation the rights to use, copy, modify, merge, publish,
25177// distribute, sublicense, and/or sell copies of the Software, and to permit
25178// persons to whom the Software is furnished to do so, subject to the
25179// following conditions:
25180//
25181// The above copyright notice and this permission notice shall be included
25182// in all copies or substantial portions of the Software.
25183//
25184// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25185// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25186// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
25187// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25188// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25189// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25190// USE OR OTHER DEALINGS IN THE SOFTWARE.
25191
25192var Buffer = require('buffer').Buffer;
25193
25194var isBufferEncoding = Buffer.isEncoding
25195 || function(encoding) {
25196 switch (encoding && encoding.toLowerCase()) {
25197 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;
25198 default: return false;
25199 }
25200 }
25201
25202
25203function assertEncoding(encoding) {
25204 if (encoding && !isBufferEncoding(encoding)) {
25205 throw new Error('Unknown encoding: ' + encoding);
25206 }
25207}
25208
25209// StringDecoder provides an interface for efficiently splitting a series of
25210// buffers into a series of JS strings without breaking apart multi-byte
25211// characters. CESU-8 is handled as part of the UTF-8 encoding.
25212//
25213// @TODO Handling all encodings inside a single object makes it very difficult
25214// to reason about this code, so it should be split up in the future.
25215// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
25216// points as used by CESU-8.
25217var StringDecoder = exports.StringDecoder = function(encoding) {
25218 this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
25219 assertEncoding(encoding);
25220 switch (this.encoding) {
25221 case 'utf8':
25222 // CESU-8 represents each of Surrogate Pair by 3-bytes
25223 this.surrogateSize = 3;
25224 break;
25225 case 'ucs2':
25226 case 'utf16le':
25227 // UTF-16 represents each of Surrogate Pair by 2-bytes
25228 this.surrogateSize = 2;
25229 this.detectIncompleteChar = utf16DetectIncompleteChar;
25230 break;
25231 case 'base64':
25232 // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
25233 this.surrogateSize = 3;
25234 this.detectIncompleteChar = base64DetectIncompleteChar;
25235 break;
25236 default:
25237 this.write = passThroughWrite;
25238 return;
25239 }
25240
25241 // Enough space to store all bytes of a single character. UTF-8 needs 4
25242 // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
25243 this.charBuffer = new Buffer(6);
25244 // Number of bytes received for the current incomplete multi-byte character.
25245 this.charReceived = 0;
25246 // Number of bytes expected for the current incomplete multi-byte character.
25247 this.charLength = 0;
25248};
25249
25250
25251// write decodes the given buffer and returns it as JS string that is
25252// guaranteed to not contain any partial multi-byte characters. Any partial
25253// character found at the end of the buffer is buffered up, and will be
25254// returned when calling write again with the remaining bytes.
25255//
25256// Note: Converting a Buffer containing an orphan surrogate to a String
25257// currently works, but converting a String to a Buffer (via `new Buffer`, or
25258// Buffer#write) will replace incomplete surrogates with the unicode
25259// replacement character. See https://codereview.chromium.org/121173009/ .
25260StringDecoder.prototype.write = function(buffer) {
25261 var charStr = '';
25262 // if our last write ended with an incomplete multibyte character
25263 while (this.charLength) {
25264 // determine how many remaining bytes this buffer has to offer for this char
25265 var available = (buffer.length >= this.charLength - this.charReceived) ?
25266 this.charLength - this.charReceived :
25267 buffer.length;
25268
25269 // add the new bytes to the char buffer
25270 buffer.copy(this.charBuffer, this.charReceived, 0, available);
25271 this.charReceived += available;
25272
25273 if (this.charReceived < this.charLength) {
25274 // still not enough chars in this buffer? wait for more ...
25275 return '';
25276 }
25277
25278 // remove bytes belonging to the current character from the buffer
25279 buffer = buffer.slice(available, buffer.length);
25280
25281 // get the character that was split
25282 charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
25283
25284 // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
25285 var charCode = charStr.charCodeAt(charStr.length - 1);
25286 if (charCode >= 0xD800 && charCode <= 0xDBFF) {
25287 this.charLength += this.surrogateSize;
25288 charStr = '';
25289 continue;
25290 }
25291 this.charReceived = this.charLength = 0;
25292
25293 // if there are no more bytes in this buffer, just emit our char
25294 if (buffer.length === 0) {
25295 return charStr;
25296 }
25297 break;
25298 }
25299
25300 // determine and set charLength / charReceived
25301 this.detectIncompleteChar(buffer);
25302
25303 var end = buffer.length;
25304 if (this.charLength) {
25305 // buffer the incomplete character bytes we got
25306 buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
25307 end -= this.charReceived;
25308 }
25309
25310 charStr += buffer.toString(this.encoding, 0, end);
25311
25312 var end = charStr.length - 1;
25313 var charCode = charStr.charCodeAt(end);
25314 // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
25315 if (charCode >= 0xD800 && charCode <= 0xDBFF) {
25316 var size = this.surrogateSize;
25317 this.charLength += size;
25318 this.charReceived += size;
25319 this.charBuffer.copy(this.charBuffer, size, 0, size);
25320 buffer.copy(this.charBuffer, 0, 0, size);
25321 return charStr.substring(0, end);
25322 }
25323
25324 // or just emit the charStr
25325 return charStr;
25326};
25327
25328// detectIncompleteChar determines if there is an incomplete UTF-8 character at
25329// the end of the given buffer. If so, it sets this.charLength to the byte
25330// length that character, and sets this.charReceived to the number of bytes
25331// that are available for this character.
25332StringDecoder.prototype.detectIncompleteChar = function(buffer) {
25333 // determine how many bytes we have to check at the end of this buffer
25334 var i = (buffer.length >= 3) ? 3 : buffer.length;
25335
25336 // Figure out if one of the last i bytes of our buffer announces an
25337 // incomplete char.
25338 for (; i > 0; i--) {
25339 var c = buffer[buffer.length - i];
25340
25341 // See http://en.wikipedia.org/wiki/UTF-8#Description
25342
25343 // 110XXXXX
25344 if (i == 1 && c >> 5 == 0x06) {
25345 this.charLength = 2;
25346 break;
25347 }
25348
25349 // 1110XXXX
25350 if (i <= 2 && c >> 4 == 0x0E) {
25351 this.charLength = 3;
25352 break;
25353 }
25354
25355 // 11110XXX
25356 if (i <= 3 && c >> 3 == 0x1E) {
25357 this.charLength = 4;
25358 break;
25359 }
25360 }
25361 this.charReceived = i;
25362};
25363
25364StringDecoder.prototype.end = function(buffer) {
25365 var res = '';
25366 if (buffer && buffer.length)
25367 res = this.write(buffer);
25368
25369 if (this.charReceived) {
25370 var cr = this.charReceived;
25371 var buf = this.charBuffer;
25372 var enc = this.encoding;
25373 res += buf.slice(0, cr).toString(enc);
25374 }
25375
25376 return res;
25377};
25378
25379function passThroughWrite(buffer) {
25380 return buffer.toString(this.encoding);
25381}
25382
25383function utf16DetectIncompleteChar(buffer) {
25384 this.charReceived = buffer.length % 2;
25385 this.charLength = this.charReceived ? 2 : 0;
25386}
25387
25388function base64DetectIncompleteChar(buffer) {
25389 this.charReceived = buffer.length % 3;
25390 this.charLength = this.charReceived ? 3 : 0;
25391}
25392
25393},{"buffer":5}],27:[function(require,module,exports){
25394(function (global){
25395
25396/**
25397 * Module exports.
25398 */
25399
25400module.exports = deprecate;
25401
25402/**
25403 * Mark that a method should not be used.
25404 * Returns a modified function which warns once by default.
25405 *
25406 * If `localStorage.noDeprecation = true` is set, then it is a no-op.
25407 *
25408 * If `localStorage.throwDeprecation = true` is set, then deprecated functions
25409 * will throw an Error when invoked.
25410 *
25411 * If `localStorage.traceDeprecation = true` is set, then deprecated functions
25412 * will invoke `console.trace()` instead of `console.error()`.
25413 *
25414 * @param {Function} fn - the function to deprecate
25415 * @param {String} msg - the string to print to the console when `fn` is invoked
25416 * @returns {Function} a new "deprecated" version of `fn`
25417 * @api public
25418 */
25419
25420function deprecate (fn, msg) {
25421 if (config('noDeprecation')) {
25422 return fn;
25423 }
25424
25425 var warned = false;
25426 function deprecated() {
25427 if (!warned) {
25428 if (config('throwDeprecation')) {
25429 throw new Error(msg);
25430 } else if (config('traceDeprecation')) {
25431 console.trace(msg);
25432 } else {
25433 console.warn(msg);
25434 }
25435 warned = true;
25436 }
25437 return fn.apply(this, arguments);
25438 }
25439
25440 return deprecated;
25441}
25442
25443/**
25444 * Checks `localStorage` for boolean values for the given `name`.
25445 *
25446 * @param {String} name
25447 * @returns {Boolean}
25448 * @api private
25449 */
25450
25451function config (name) {
25452 // accessing global.localStorage can trigger a DOMException in sandboxed iframes
25453 try {
25454 if (!global.localStorage) return false;
25455 } catch (_) {
25456 return false;
25457 }
25458 var val = global.localStorage[name];
25459 if (null == val) return false;
25460 return String(val).toLowerCase() === 'true';
25461}
25462
25463}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
25464},{}],28:[function(require,module,exports){
25465arguments[4][9][0].apply(exports,arguments)
25466},{"dup":9}],29:[function(require,module,exports){
25467module.exports = function isBuffer(arg) {
25468 return arg && typeof arg === 'object'
25469 && typeof arg.copy === 'function'
25470 && typeof arg.fill === 'function'
25471 && typeof arg.readUInt8 === 'function';
25472}
25473},{}],30:[function(require,module,exports){
25474(function (process,global){
25475// Copyright Joyent, Inc. and other Node contributors.
25476//
25477// Permission is hereby granted, free of charge, to any person obtaining a
25478// copy of this software and associated documentation files (the
25479// "Software"), to deal in the Software without restriction, including
25480// without limitation the rights to use, copy, modify, merge, publish,
25481// distribute, sublicense, and/or sell copies of the Software, and to permit
25482// persons to whom the Software is furnished to do so, subject to the
25483// following conditions:
25484//
25485// The above copyright notice and this permission notice shall be included
25486// in all copies or substantial portions of the Software.
25487//
25488// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25489// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25490// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
25491// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25492// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25493// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25494// USE OR OTHER DEALINGS IN THE SOFTWARE.
25495
25496var formatRegExp = /%[sdj%]/g;
25497exports.format = function(f) {
25498 if (!isString(f)) {
25499 var objects = [];
25500 for (var i = 0; i < arguments.length; i++) {
25501 objects.push(inspect(arguments[i]));
25502 }
25503 return objects.join(' ');
25504 }
25505
25506 var i = 1;
25507 var args = arguments;
25508 var len = args.length;
25509 var str = String(f).replace(formatRegExp, function(x) {
25510 if (x === '%%') return '%';
25511 if (i >= len) return x;
25512 switch (x) {
25513 case '%s': return String(args[i++]);
25514 case '%d': return Number(args[i++]);
25515 case '%j':
25516 try {
25517 return JSON.stringify(args[i++]);
25518 } catch (_) {
25519 return '[Circular]';
25520 }
25521 default:
25522 return x;
25523 }
25524 });
25525 for (var x = args[i]; i < len; x = args[++i]) {
25526 if (isNull(x) || !isObject(x)) {
25527 str += ' ' + x;
25528 } else {
25529 str += ' ' + inspect(x);
25530 }
25531 }
25532 return str;
25533};
25534
25535
25536// Mark that a method should not be used.
25537// Returns a modified function which warns once by default.
25538// If --no-deprecation is set, then it is a no-op.
25539exports.deprecate = function(fn, msg) {
25540 // Allow for deprecating things in the process of starting up.
25541 if (isUndefined(global.process)) {
25542 return function() {
25543 return exports.deprecate(fn, msg).apply(this, arguments);
25544 };
25545 }
25546
25547 if (process.noDeprecation === true) {
25548 return fn;
25549 }
25550
25551 var warned = false;
25552 function deprecated() {
25553 if (!warned) {
25554 if (process.throwDeprecation) {
25555 throw new Error(msg);
25556 } else if (process.traceDeprecation) {
25557 console.trace(msg);
25558 } else {
25559 console.error(msg);
25560 }
25561 warned = true;
25562 }
25563 return fn.apply(this, arguments);
25564 }
25565
25566 return deprecated;
25567};
25568
25569
25570var debugs = {};
25571var debugEnviron;
25572exports.debuglog = function(set) {
25573 if (isUndefined(debugEnviron))
25574 debugEnviron = process.env.NODE_DEBUG || '';
25575 set = set.toUpperCase();
25576 if (!debugs[set]) {
25577 if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
25578 var pid = process.pid;
25579 debugs[set] = function() {
25580 var msg = exports.format.apply(exports, arguments);
25581 console.error('%s %d: %s', set, pid, msg);
25582 };
25583 } else {
25584 debugs[set] = function() {};
25585 }
25586 }
25587 return debugs[set];
25588};
25589
25590
25591/**
25592 * Echos the value of a value. Trys to print the value out
25593 * in the best way possible given the different types.
25594 *
25595 * @param {Object} obj The object to print out.
25596 * @param {Object} opts Optional options object that alters the output.
25597 */
25598/* legacy: obj, showHidden, depth, colors*/
25599function inspect(obj, opts) {
25600 // default options
25601 var ctx = {
25602 seen: [],
25603 stylize: stylizeNoColor
25604 };
25605 // legacy...
25606 if (arguments.length >= 3) ctx.depth = arguments[2];
25607 if (arguments.length >= 4) ctx.colors = arguments[3];
25608 if (isBoolean(opts)) {
25609 // legacy...
25610 ctx.showHidden = opts;
25611 } else if (opts) {
25612 // got an "options" object
25613 exports._extend(ctx, opts);
25614 }
25615 // set default options
25616 if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
25617 if (isUndefined(ctx.depth)) ctx.depth = 2;
25618 if (isUndefined(ctx.colors)) ctx.colors = false;
25619 if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
25620 if (ctx.colors) ctx.stylize = stylizeWithColor;
25621 return formatValue(ctx, obj, ctx.depth);
25622}
25623exports.inspect = inspect;
25624
25625
25626// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
25627inspect.colors = {
25628 'bold' : [1, 22],
25629 'italic' : [3, 23],
25630 'underline' : [4, 24],
25631 'inverse' : [7, 27],
25632 'white' : [37, 39],
25633 'grey' : [90, 39],
25634 'black' : [30, 39],
25635 'blue' : [34, 39],
25636 'cyan' : [36, 39],
25637 'green' : [32, 39],
25638 'magenta' : [35, 39],
25639 'red' : [31, 39],
25640 'yellow' : [33, 39]
25641};
25642
25643// Don't use 'blue' not visible on cmd.exe
25644inspect.styles = {
25645 'special': 'cyan',
25646 'number': 'yellow',
25647 'boolean': 'yellow',
25648 'undefined': 'grey',
25649 'null': 'bold',
25650 'string': 'green',
25651 'date': 'magenta',
25652 // "name": intentionally not styling
25653 'regexp': 'red'
25654};
25655
25656
25657function stylizeWithColor(str, styleType) {
25658 var style = inspect.styles[styleType];
25659
25660 if (style) {
25661 return '\u001b[' + inspect.colors[style][0] + 'm' + str +
25662 '\u001b[' + inspect.colors[style][1] + 'm';
25663 } else {
25664 return str;
25665 }
25666}
25667
25668
25669function stylizeNoColor(str, styleType) {
25670 return str;
25671}
25672
25673
25674function arrayToHash(array) {
25675 var hash = {};
25676
25677 array.forEach(function(val, idx) {
25678 hash[val] = true;
25679 });
25680
25681 return hash;
25682}
25683
25684
25685function formatValue(ctx, value, recurseTimes) {
25686 // Provide a hook for user-specified inspect functions.
25687 // Check that value is an object with an inspect function on it
25688 if (ctx.customInspect &&
25689 value &&
25690 isFunction(value.inspect) &&
25691 // Filter out the util module, it's inspect function is special
25692 value.inspect !== exports.inspect &&
25693 // Also filter out any prototype objects using the circular check.
25694 !(value.constructor && value.constructor.prototype === value)) {
25695 var ret = value.inspect(recurseTimes, ctx);
25696 if (!isString(ret)) {
25697 ret = formatValue(ctx, ret, recurseTimes);
25698 }
25699 return ret;
25700 }
25701
25702 // Primitive types cannot have properties
25703 var primitive = formatPrimitive(ctx, value);
25704 if (primitive) {
25705 return primitive;
25706 }
25707
25708 // Look up the keys of the object.
25709 var keys = Object.keys(value);
25710 var visibleKeys = arrayToHash(keys);
25711
25712 if (ctx.showHidden) {
25713 keys = Object.getOwnPropertyNames(value);
25714 }
25715
25716 // IE doesn't make error fields non-enumerable
25717 // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
25718 if (isError(value)
25719 && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
25720 return formatError(value);
25721 }
25722
25723 // Some type of object without properties can be shortcutted.
25724 if (keys.length === 0) {
25725 if (isFunction(value)) {
25726 var name = value.name ? ': ' + value.name : '';
25727 return ctx.stylize('[Function' + name + ']', 'special');
25728 }
25729 if (isRegExp(value)) {
25730 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
25731 }
25732 if (isDate(value)) {
25733 return ctx.stylize(Date.prototype.toString.call(value), 'date');
25734 }
25735 if (isError(value)) {
25736 return formatError(value);
25737 }
25738 }
25739
25740 var base = '', array = false, braces = ['{', '}'];
25741
25742 // Make Array say that they are Array
25743 if (isArray(value)) {
25744 array = true;
25745 braces = ['[', ']'];
25746 }
25747
25748 // Make functions say that they are functions
25749 if (isFunction(value)) {
25750 var n = value.name ? ': ' + value.name : '';
25751 base = ' [Function' + n + ']';
25752 }
25753
25754 // Make RegExps say that they are RegExps
25755 if (isRegExp(value)) {
25756 base = ' ' + RegExp.prototype.toString.call(value);
25757 }
25758
25759 // Make dates with properties first say the date
25760 if (isDate(value)) {
25761 base = ' ' + Date.prototype.toUTCString.call(value);
25762 }
25763
25764 // Make error with message first say the error
25765 if (isError(value)) {
25766 base = ' ' + formatError(value);
25767 }
25768
25769 if (keys.length === 0 && (!array || value.length == 0)) {
25770 return braces[0] + base + braces[1];
25771 }
25772
25773 if (recurseTimes < 0) {
25774 if (isRegExp(value)) {
25775 return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
25776 } else {
25777 return ctx.stylize('[Object]', 'special');
25778 }
25779 }
25780
25781 ctx.seen.push(value);
25782
25783 var output;
25784 if (array) {
25785 output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
25786 } else {
25787 output = keys.map(function(key) {
25788 return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
25789 });
25790 }
25791
25792 ctx.seen.pop();
25793
25794 return reduceToSingleString(output, base, braces);
25795}
25796
25797
25798function formatPrimitive(ctx, value) {
25799 if (isUndefined(value))
25800 return ctx.stylize('undefined', 'undefined');
25801 if (isString(value)) {
25802 var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
25803 .replace(/'/g, "\\'")
25804 .replace(/\\"/g, '"') + '\'';
25805 return ctx.stylize(simple, 'string');
25806 }
25807 if (isNumber(value))
25808 return ctx.stylize('' + value, 'number');
25809 if (isBoolean(value))
25810 return ctx.stylize('' + value, 'boolean');
25811 // For some reason typeof null is "object", so special case here.
25812 if (isNull(value))
25813 return ctx.stylize('null', 'null');
25814}
25815
25816
25817function formatError(value) {
25818 return '[' + Error.prototype.toString.call(value) + ']';
25819}
25820
25821
25822function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
25823 var output = [];
25824 for (var i = 0, l = value.length; i < l; ++i) {
25825 if (hasOwnProperty(value, String(i))) {
25826 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
25827 String(i), true));
25828 } else {
25829 output.push('');
25830 }
25831 }
25832 keys.forEach(function(key) {
25833 if (!key.match(/^\d+$/)) {
25834 output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
25835 key, true));
25836 }
25837 });
25838 return output;
25839}
25840
25841
25842function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
25843 var name, str, desc;
25844 desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
25845 if (desc.get) {
25846 if (desc.set) {
25847 str = ctx.stylize('[Getter/Setter]', 'special');
25848 } else {
25849 str = ctx.stylize('[Getter]', 'special');
25850 }
25851 } else {
25852 if (desc.set) {
25853 str = ctx.stylize('[Setter]', 'special');
25854 }
25855 }
25856 if (!hasOwnProperty(visibleKeys, key)) {
25857 name = '[' + key + ']';
25858 }
25859 if (!str) {
25860 if (ctx.seen.indexOf(desc.value) < 0) {
25861 if (isNull(recurseTimes)) {
25862 str = formatValue(ctx, desc.value, null);
25863 } else {
25864 str = formatValue(ctx, desc.value, recurseTimes - 1);
25865 }
25866 if (str.indexOf('\n') > -1) {
25867 if (array) {
25868 str = str.split('\n').map(function(line) {
25869 return ' ' + line;
25870 }).join('\n').substr(2);
25871 } else {
25872 str = '\n' + str.split('\n').map(function(line) {
25873 return ' ' + line;
25874 }).join('\n');
25875 }
25876 }
25877 } else {
25878 str = ctx.stylize('[Circular]', 'special');
25879 }
25880 }
25881 if (isUndefined(name)) {
25882 if (array && key.match(/^\d+$/)) {
25883 return str;
25884 }
25885 name = JSON.stringify('' + key);
25886 if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
25887 name = name.substr(1, name.length - 2);
25888 name = ctx.stylize(name, 'name');
25889 } else {
25890 name = name.replace(/'/g, "\\'")
25891 .replace(/\\"/g, '"')
25892 .replace(/(^"|"$)/g, "'");
25893 name = ctx.stylize(name, 'string');
25894 }
25895 }
25896
25897 return name + ': ' + str;
25898}
25899
25900
25901function reduceToSingleString(output, base, braces) {
25902 var numLinesEst = 0;
25903 var length = output.reduce(function(prev, cur) {
25904 numLinesEst++;
25905 if (cur.indexOf('\n') >= 0) numLinesEst++;
25906 return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
25907 }, 0);
25908
25909 if (length > 60) {
25910 return braces[0] +
25911 (base === '' ? '' : base + '\n ') +
25912 ' ' +
25913 output.join(',\n ') +
25914 ' ' +
25915 braces[1];
25916 }
25917
25918 return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
25919}
25920
25921
25922// NOTE: These type checking functions intentionally don't use `instanceof`
25923// because it is fragile and can be easily faked with `Object.create()`.
25924function isArray(ar) {
25925 return Array.isArray(ar);
25926}
25927exports.isArray = isArray;
25928
25929function isBoolean(arg) {
25930 return typeof arg === 'boolean';
25931}
25932exports.isBoolean = isBoolean;
25933
25934function isNull(arg) {
25935 return arg === null;
25936}
25937exports.isNull = isNull;
25938
25939function isNullOrUndefined(arg) {
25940 return arg == null;
25941}
25942exports.isNullOrUndefined = isNullOrUndefined;
25943
25944function isNumber(arg) {
25945 return typeof arg === 'number';
25946}
25947exports.isNumber = isNumber;
25948
25949function isString(arg) {
25950 return typeof arg === 'string';
25951}
25952exports.isString = isString;
25953
25954function isSymbol(arg) {
25955 return typeof arg === 'symbol';
25956}
25957exports.isSymbol = isSymbol;
25958
25959function isUndefined(arg) {
25960 return arg === void 0;
25961}
25962exports.isUndefined = isUndefined;
25963
25964function isRegExp(re) {
25965 return isObject(re) && objectToString(re) === '[object RegExp]';
25966}
25967exports.isRegExp = isRegExp;
25968
25969function isObject(arg) {
25970 return typeof arg === 'object' && arg !== null;
25971}
25972exports.isObject = isObject;
25973
25974function isDate(d) {
25975 return isObject(d) && objectToString(d) === '[object Date]';
25976}
25977exports.isDate = isDate;
25978
25979function isError(e) {
25980 return isObject(e) &&
25981 (objectToString(e) === '[object Error]' || e instanceof Error);
25982}
25983exports.isError = isError;
25984
25985function isFunction(arg) {
25986 return typeof arg === 'function';
25987}
25988exports.isFunction = isFunction;
25989
25990function isPrimitive(arg) {
25991 return arg === null ||
25992 typeof arg === 'boolean' ||
25993 typeof arg === 'number' ||
25994 typeof arg === 'string' ||
25995 typeof arg === 'symbol' || // ES6 symbol
25996 typeof arg === 'undefined';
25997}
25998exports.isPrimitive = isPrimitive;
25999
26000exports.isBuffer = require('./support/isBuffer');
26001
26002function objectToString(o) {
26003 return Object.prototype.toString.call(o);
26004}
26005
26006
26007function pad(n) {
26008 return n < 10 ? '0' + n.toString(10) : n.toString(10);
26009}
26010
26011
26012var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
26013 'Oct', 'Nov', 'Dec'];
26014
26015// 26 Feb 16:19:34
26016function timestamp() {
26017 var d = new Date();
26018 var time = [pad(d.getHours()),
26019 pad(d.getMinutes()),
26020 pad(d.getSeconds())].join(':');
26021 return [d.getDate(), months[d.getMonth()], time].join(' ');
26022}
26023
26024
26025// log is just a thin wrapper to console.log that prepends a timestamp
26026exports.log = function() {
26027 console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
26028};
26029
26030
26031/**
26032 * Inherit the prototype methods from one constructor into another.
26033 *
26034 * The Function.prototype.inherits from lang.js rewritten as a standalone
26035 * function (not on Function.prototype). NOTE: If this file is to be loaded
26036 * during bootstrapping this function needs to be rewritten using some native
26037 * functions as prototype setup using normal JavaScript does not work as
26038 * expected during bootstrapping (see mirror.js in r114903).
26039 *
26040 * @param {function} ctor Constructor function which needs to inherit the
26041 * prototype.
26042 * @param {function} superCtor Constructor function to inherit prototype from.
26043 */
26044exports.inherits = require('inherits');
26045
26046exports._extend = function(origin, add) {
26047 // Don't do anything if add isn't an object
26048 if (!add || !isObject(add)) return origin;
26049
26050 var keys = Object.keys(add);
26051 var i = keys.length;
26052 while (i--) {
26053 origin[keys[i]] = add[keys[i]];
26054 }
26055 return origin;
26056};
26057
26058function hasOwnProperty(obj, prop) {
26059 return Object.prototype.hasOwnProperty.call(obj, prop);
26060}
26061
26062}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
26063},{"./support/isBuffer":29,"_process":13,"inherits":28}],31:[function(require,module,exports){
26064(function (Buffer){
26065const createKeccakHash = require('keccak')
26066const secp256k1 = require('secp256k1')
26067const assert = require('assert')
26068const rlp = require('rlp')
26069const BN = require('bn.js')
26070const createHash = require('create-hash')
26071Object.assign(exports, require('ethjs-util'))
26072
26073/**
26074 * the max integer that this VM can handle (a ```BN```)
26075 * @var {BN} MAX_INTEGER
26076 */
26077exports.MAX_INTEGER = new BN('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)
26078
26079/**
26080 * 2^256 (a ```BN```)
26081 * @var {BN} TWO_POW256
26082 */
26083exports.TWO_POW256 = new BN('10000000000000000000000000000000000000000000000000000000000000000', 16)
26084
26085/**
26086 * SHA3-256 hash of null (a ```String```)
26087 * @var {String} SHA3_NULL_S
26088 */
26089exports.SHA3_NULL_S = 'c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'
26090
26091/**
26092 * SHA3-256 hash of null (a ```Buffer```)
26093 * @var {Buffer} SHA3_NULL
26094 */
26095exports.SHA3_NULL = Buffer.from(exports.SHA3_NULL_S, 'hex')
26096
26097/**
26098 * SHA3-256 of an RLP of an empty array (a ```String```)
26099 * @var {String} SHA3_RLP_ARRAY_S
26100 */
26101exports.SHA3_RLP_ARRAY_S = '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
26102
26103/**
26104 * SHA3-256 of an RLP of an empty array (a ```Buffer```)
26105 * @var {Buffer} SHA3_RLP_ARRAY
26106 */
26107exports.SHA3_RLP_ARRAY = Buffer.from(exports.SHA3_RLP_ARRAY_S, 'hex')
26108
26109/**
26110 * SHA3-256 hash of the RLP of null (a ```String```)
26111 * @var {String} SHA3_RLP_S
26112 */
26113exports.SHA3_RLP_S = '56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421'
26114
26115/**
26116 * SHA3-256 hash of the RLP of null (a ```Buffer```)
26117 * @var {Buffer} SHA3_RLP
26118 */
26119exports.SHA3_RLP = Buffer.from(exports.SHA3_RLP_S, 'hex')
26120
26121/**
26122 * [`BN`](https://github.com/indutny/bn.js)
26123 * @var {Function}
26124 */
26125exports.BN = BN
26126
26127/**
26128 * [`rlp`](https://github.com/ethereumjs/rlp)
26129 * @var {Function}
26130 */
26131exports.rlp = rlp
26132
26133/**
26134 * [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
26135 * @var {Object}
26136 */
26137exports.secp256k1 = secp256k1
26138
26139/**
26140 * Returns a buffer filled with 0s
26141 * @method zeros
26142 * @param {Number} bytes the number of bytes the buffer should be
26143 * @return {Buffer}
26144 */
26145exports.zeros = function (bytes) {
26146 return Buffer.allocUnsafe(bytes).fill(0)
26147}
26148
26149/**
26150 * Left Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
26151 * Or it truncates the beginning if it exceeds.
26152 * @method lsetLength
26153 * @param {Buffer|Array} msg the value to pad
26154 * @param {Number} length the number of bytes the output should be
26155 * @param {Boolean} [right=false] whether to start padding form the left or right
26156 * @return {Buffer|Array}
26157 */
26158exports.setLengthLeft = exports.setLength = function (msg, length, right) {
26159 var buf = exports.zeros(length)
26160 msg = exports.toBuffer(msg)
26161 if (right) {
26162 if (msg.length < length) {
26163 msg.copy(buf)
26164 return buf
26165 }
26166 return msg.slice(0, length)
26167 } else {
26168 if (msg.length < length) {
26169 msg.copy(buf, length - msg.length)
26170 return buf
26171 }
26172 return msg.slice(-length)
26173 }
26174}
26175
26176/**
26177 * Right Pads an `Array` or `Buffer` with leading zeros till it has `length` bytes.
26178 * Or it truncates the beginning if it exceeds.
26179 * @param {Buffer|Array} msg the value to pad
26180 * @param {Number} length the number of bytes the output should be
26181 * @return {Buffer|Array}
26182 */
26183exports.setLengthRight = function (msg, length) {
26184 return exports.setLength(msg, length, true)
26185}
26186
26187/**
26188 * Trims leading zeros from a `Buffer` or an `Array`
26189 * @param {Buffer|Array|String} a
26190 * @return {Buffer|Array|String}
26191 */
26192exports.unpad = exports.stripZeros = function (a) {
26193 a = exports.stripHexPrefix(a)
26194 var first = a[0]
26195 while (a.length > 0 && first.toString() === '0') {
26196 a = a.slice(1)
26197 first = a[0]
26198 }
26199 return a
26200}
26201/**
26202 * Attempts to turn a value into a `Buffer`. As input it supports `Buffer`, `String`, `Number`, null/undefined, `BN` and other objects with a `toArray()` method.
26203 * @param {*} v the value
26204 */
26205exports.toBuffer = function (v) {
26206 if (!Buffer.isBuffer(v)) {
26207 if (Array.isArray(v)) {
26208 v = Buffer.from(v)
26209 } else if (typeof v === 'string') {
26210 if (exports.isHexPrefixed(v)) {
26211 v = Buffer.from(exports.padToEven(exports.stripHexPrefix(v)), 'hex')
26212 } else {
26213 v = Buffer.from(v)
26214 }
26215 } else if (typeof v === 'number') {
26216 v = exports.intToBuffer(v)
26217 } else if (v === null || v === undefined) {
26218 v = Buffer.allocUnsafe(0)
26219 } else if (v.toArray) {
26220 // converts a BN to a Buffer
26221 v = Buffer.from(v.toArray())
26222 } else {
26223 throw new Error('invalid type')
26224 }
26225 }
26226 return v
26227}
26228
26229/**
26230 * Converts a `Buffer` to a `Number`
26231 * @param {Buffer} buf
26232 * @return {Number}
26233 * @throws If the input number exceeds 53 bits.
26234 */
26235exports.bufferToInt = function (buf) {
26236 return new BN(exports.toBuffer(buf)).toNumber()
26237}
26238
26239/**
26240 * Converts a `Buffer` into a hex `String`
26241 * @param {Buffer} buf
26242 * @return {String}
26243 */
26244exports.bufferToHex = function (buf) {
26245 buf = exports.toBuffer(buf)
26246 return '0x' + buf.toString('hex')
26247}
26248
26249/**
26250 * Interprets a `Buffer` as a signed integer and returns a `BN`. Assumes 256-bit numbers.
26251 * @param {Buffer} num
26252 * @return {BN}
26253 */
26254exports.fromSigned = function (num) {
26255 return new BN(num).fromTwos(256)
26256}
26257
26258/**
26259 * Converts a `BN` to an unsigned integer and returns it as a `Buffer`. Assumes 256-bit numbers.
26260 * @param {BN} num
26261 * @return {Buffer}
26262 */
26263exports.toUnsigned = function (num) {
26264 return Buffer.from(num.toTwos(256).toArray())
26265}
26266
26267/**
26268 * Creates SHA-3 hash of the input
26269 * @param {Buffer|Array|String|Number} a the input data
26270 * @param {Number} [bits=256] the SHA width
26271 * @return {Buffer}
26272 */
26273exports.sha3 = function (a, bits) {
26274 a = exports.toBuffer(a)
26275 if (!bits) bits = 256
26276
26277 return createKeccakHash('keccak' + bits).update(a).digest()
26278}
26279
26280/**
26281 * Creates SHA256 hash of the input
26282 * @param {Buffer|Array|String|Number} a the input data
26283 * @return {Buffer}
26284 */
26285exports.sha256 = function (a) {
26286 a = exports.toBuffer(a)
26287 return createHash('sha256').update(a).digest()
26288}
26289
26290/**
26291 * Creates RIPEMD160 hash of the input
26292 * @param {Buffer|Array|String|Number} a the input data
26293 * @param {Boolean} padded whether it should be padded to 256 bits or not
26294 * @return {Buffer}
26295 */
26296exports.ripemd160 = function (a, padded) {
26297 a = exports.toBuffer(a)
26298 var hash = createHash('rmd160').update(a).digest()
26299 if (padded === true) {
26300 return exports.setLength(hash, 32)
26301 } else {
26302 return hash
26303 }
26304}
26305
26306/**
26307 * Creates SHA-3 hash of the RLP encoded version of the input
26308 * @param {Buffer|Array|String|Number} a the input data
26309 * @return {Buffer}
26310 */
26311exports.rlphash = function (a) {
26312 return exports.sha3(rlp.encode(a))
26313}
26314
26315/**
26316 * Checks if the private key satisfies the rules of the curve secp256k1.
26317 * @param {Buffer} privateKey
26318 * @return {Boolean}
26319 */
26320exports.isValidPrivate = function (privateKey) {
26321 return secp256k1.privateKeyVerify(privateKey)
26322}
26323
26324/**
26325 * Checks if the public key satisfies the rules of the curve secp256k1
26326 * and the requirements of Ethereum.
26327 * @param {Buffer} publicKey The two points of an uncompressed key, unless sanitize is enabled
26328 * @param {Boolean} [sanitize=false] Accept public keys in other formats
26329 * @return {Boolean}
26330 */
26331exports.isValidPublic = function (publicKey, sanitize) {
26332 if (publicKey.length === 64) {
26333 // Convert to SEC1 for secp256k1
26334 return secp256k1.publicKeyVerify(Buffer.concat([ Buffer.from([4]), publicKey ]))
26335 }
26336
26337 if (!sanitize) {
26338 return false
26339 }
26340
26341 return secp256k1.publicKeyVerify(publicKey)
26342}
26343
26344/**
26345 * Returns the ethereum address of a given public key.
26346 * Accepts "Ethereum public keys" and SEC1 encoded keys.
26347 * @param {Buffer} pubKey The two points of an uncompressed key, unless sanitize is enabled
26348 * @param {Boolean} [sanitize=false] Accept public keys in other formats
26349 * @return {Buffer}
26350 */
26351exports.pubToAddress = exports.publicToAddress = function (pubKey, sanitize) {
26352 pubKey = exports.toBuffer(pubKey)
26353 if (sanitize && (pubKey.length !== 64)) {
26354 pubKey = secp256k1.publicKeyConvert(pubKey, false).slice(1)
26355 }
26356 assert(pubKey.length === 64)
26357 // Only take the lower 160bits of the hash
26358 return exports.sha3(pubKey).slice(-20)
26359}
26360
26361/**
26362 * Returns the ethereum public key of a given private key
26363 * @param {Buffer} privateKey A private key must be 256 bits wide
26364 * @return {Buffer}
26365 */
26366var privateToPublic = exports.privateToPublic = function (privateKey) {
26367 privateKey = exports.toBuffer(privateKey)
26368 // skip the type flag and use the X, Y points
26369 return secp256k1.publicKeyCreate(privateKey, false).slice(1)
26370}
26371
26372/**
26373 * Converts a public key to the Ethereum format.
26374 * @param {Buffer} publicKey
26375 * @return {Buffer}
26376 */
26377exports.importPublic = function (publicKey) {
26378 publicKey = exports.toBuffer(publicKey)
26379 if (publicKey.length !== 64) {
26380 publicKey = secp256k1.publicKeyConvert(publicKey, false).slice(1)
26381 }
26382 return publicKey
26383}
26384
26385/**
26386 * ECDSA sign
26387 * @param {Buffer} msgHash
26388 * @param {Buffer} privateKey
26389 * @return {Object}
26390 */
26391exports.ecsign = function (msgHash, privateKey) {
26392 var sig = secp256k1.sign(msgHash, privateKey)
26393
26394 var ret = {}
26395 ret.r = sig.signature.slice(0, 32)
26396 ret.s = sig.signature.slice(32, 64)
26397 ret.v = sig.recovery + 27
26398 return ret
26399}
26400
26401/**
26402 * Returns the keccak-256 hash of `message`, prefixed with the header used by the `eth_sign` RPC call.
26403 * The output of this function can be fed into `ecsign` to produce the same signature as the `eth_sign`
26404 * call for a given `message`, or fed to `ecrecover` along with a signature to recover the public key
26405 * used to produce the signature.
26406 * @param message
26407 * @returns {Buffer} hash
26408 */
26409exports.hashPersonalMessage = function (message) {
26410 var prefix = exports.toBuffer('\u0019Ethereum Signed Message:\n' + message.length.toString())
26411 return exports.sha3(Buffer.concat([prefix, message]))
26412}
26413
26414/**
26415 * ECDSA public key recovery from signature
26416 * @param {Buffer} msgHash
26417 * @param {Number} v
26418 * @param {Buffer} r
26419 * @param {Buffer} s
26420 * @return {Buffer} publicKey
26421 */
26422exports.ecrecover = function (msgHash, v, r, s) {
26423 var signature = Buffer.concat([exports.setLength(r, 32), exports.setLength(s, 32)], 64)
26424 var recovery = v - 27
26425 if (recovery !== 0 && recovery !== 1) {
26426 throw new Error('Invalid signature v value')
26427 }
26428 var senderPubKey = secp256k1.recover(msgHash, signature, recovery)
26429 return secp256k1.publicKeyConvert(senderPubKey, false).slice(1)
26430}
26431
26432/**
26433 * Convert signature parameters into the format of `eth_sign` RPC method
26434 * @param {Number} v
26435 * @param {Buffer} r
26436 * @param {Buffer} s
26437 * @return {String} sig
26438 */
26439exports.toRpcSig = function (v, r, s) {
26440 // NOTE: with potential introduction of chainId this might need to be updated
26441 if (v !== 27 && v !== 28) {
26442 throw new Error('Invalid recovery id')
26443 }
26444
26445 // geth (and the RPC eth_sign method) uses the 65 byte format used by Bitcoin
26446 // FIXME: this might change in the future - https://github.com/ethereum/go-ethereum/issues/2053
26447 return exports.bufferToHex(Buffer.concat([
26448 exports.setLengthLeft(r, 32),
26449 exports.setLengthLeft(s, 32),
26450 exports.toBuffer(v - 27)
26451 ]))
26452}
26453
26454/**
26455 * Convert signature format of the `eth_sign` RPC method to signature parameters
26456 * NOTE: all because of a bug in geth: https://github.com/ethereum/go-ethereum/issues/2053
26457 * @param {String} sig
26458 * @return {Object}
26459 */
26460exports.fromRpcSig = function (sig) {
26461 sig = exports.toBuffer(sig)
26462
26463 // NOTE: with potential introduction of chainId this might need to be updated
26464 if (sig.length !== 65) {
26465 throw new Error('Invalid signature length')
26466 }
26467
26468 var v = sig[64]
26469 // support both versions of `eth_sign` responses
26470 if (v < 27) {
26471 v += 27
26472 }
26473
26474 return {
26475 v: v,
26476 r: sig.slice(0, 32),
26477 s: sig.slice(32, 64)
26478 }
26479}
26480
26481/**
26482 * Returns the ethereum address of a given private key
26483 * @param {Buffer} privateKey A private key must be 256 bits wide
26484 * @return {Buffer}
26485 */
26486exports.privateToAddress = function (privateKey) {
26487 return exports.publicToAddress(privateToPublic(privateKey))
26488}
26489
26490/**
26491 * Checks if the address is a valid. Accepts checksummed addresses too
26492 * @param {String} address
26493 * @return {Boolean}
26494 */
26495exports.isValidAddress = function (address) {
26496 return /^0x[0-9a-fA-F]{40}$/i.test(address)
26497}
26498
26499/**
26500 * Returns a checksummed address
26501 * @param {String} address
26502 * @return {String}
26503 */
26504exports.toChecksumAddress = function (address) {
26505 address = exports.stripHexPrefix(address).toLowerCase()
26506 var hash = exports.sha3(address).toString('hex')
26507 var ret = '0x'
26508
26509 for (var i = 0; i < address.length; i++) {
26510 if (parseInt(hash[i], 16) >= 8) {
26511 ret += address[i].toUpperCase()
26512 } else {
26513 ret += address[i]
26514 }
26515 }
26516
26517 return ret
26518}
26519
26520/**
26521 * Checks if the address is a valid checksummed address
26522 * @param {Buffer} address
26523 * @return {Boolean}
26524 */
26525exports.isValidChecksumAddress = function (address) {
26526 return exports.isValidAddress(address) && (exports.toChecksumAddress(address) === address)
26527}
26528
26529/**
26530 * Generates an address of a newly created contract
26531 * @param {Buffer} from the address which is creating this new address
26532 * @param {Buffer} nonce the nonce of the from account
26533 * @return {Buffer}
26534 */
26535exports.generateAddress = function (from, nonce) {
26536 from = exports.toBuffer(from)
26537 nonce = new BN(nonce)
26538
26539 if (nonce.isZero()) {
26540 // in RLP we want to encode null in the case of zero nonce
26541 // read the RLP documentation for an answer if you dare
26542 nonce = null
26543 } else {
26544 nonce = Buffer.from(nonce.toArray())
26545 }
26546
26547 // Only take the lower 160bits of the hash
26548 return exports.rlphash([from, nonce]).slice(-20)
26549}
26550
26551/**
26552 * Returns true if the supplied address belongs to a precompiled account
26553 * @param {Buffer|String} address
26554 * @return {Boolean}
26555 */
26556exports.isPrecompiled = function (address) {
26557 var a = exports.unpad(address)
26558 return a.length === 1 && a[0] > 0 && a[0] < 5
26559}
26560
26561/**
26562 * Adds "0x" to a given `String` if it does not already start with "0x"
26563 * @param {String} str
26564 * @return {String}
26565 */
26566exports.addHexPrefix = function (str) {
26567 if (typeof str !== 'string') {
26568 return str
26569 }
26570
26571 return exports.isHexPrefixed(str) ? str : '0x' + str
26572}
26573
26574/**
26575 * Validate ECDSA signature
26576 * @method isValidSignature
26577 * @param {Buffer} v
26578 * @param {Buffer} r
26579 * @param {Buffer} s
26580 * @param {Boolean} [homestead=true]
26581 * @return {Boolean}
26582 */
26583
26584exports.isValidSignature = function (v, r, s, homestead) {
26585 const SECP256K1_N_DIV_2 = new BN('7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0', 16)
26586 const SECP256K1_N = new BN('fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141', 16)
26587
26588 if (r.length !== 32 || s.length !== 32) {
26589 return false
26590 }
26591
26592 if (v !== 27 && v !== 28) {
26593 return false
26594 }
26595
26596 r = new BN(r)
26597 s = new BN(s)
26598
26599 if (r.isZero() || r.gt(SECP256K1_N) || s.isZero() || s.gt(SECP256K1_N)) {
26600 return false
26601 }
26602
26603 if ((homestead === false) && (new BN(s).cmp(SECP256K1_N_DIV_2) === 1)) {
26604 return false
26605 }
26606
26607 return true
26608}
26609
26610/**
26611 * Converts a `Buffer` or `Array` to JSON
26612 * @param {Buffer|Array} ba
26613 * @return {Array|String|null}
26614 */
26615exports.baToJSON = function (ba) {
26616 if (Buffer.isBuffer(ba)) {
26617 return '0x' + ba.toString('hex')
26618 } else if (ba instanceof Array) {
26619 var array = []
26620 for (var i = 0; i < ba.length; i++) {
26621 array.push(exports.baToJSON(ba[i]))
26622 }
26623 return array
26624 }
26625}
26626
26627/**
26628 * Defines properties on a `Object`. It make the assumption that underlying data is binary.
26629 * @param {Object} self the `Object` to define properties on
26630 * @param {Array} fields an array fields to define. Fields can contain:
26631 * * `name` - the name of the properties
26632 * * `length` - the number of bytes the field can have
26633 * * `allowLess` - if the field can be less than the length
26634 * * `allowEmpty`
26635 * @param {*} data data to be validated against the definitions
26636 */
26637exports.defineProperties = function (self, fields, data) {
26638 self.raw = []
26639 self._fields = []
26640
26641 // attach the `toJSON`
26642 self.toJSON = function (label) {
26643 if (label) {
26644 var obj = {}
26645 self._fields.forEach(function (field) {
26646 obj[field] = '0x' + self[field].toString('hex')
26647 })
26648 return obj
26649 }
26650 return exports.baToJSON(this.raw)
26651 }
26652
26653 self.serialize = function serialize () {
26654 return rlp.encode(self.raw)
26655 }
26656
26657 fields.forEach(function (field, i) {
26658 self._fields.push(field.name)
26659 function getter () {
26660 return self.raw[i]
26661 }
26662 function setter (v) {
26663 v = exports.toBuffer(v)
26664
26665 if (v.toString('hex') === '00' && !field.allowZero) {
26666 v = Buffer.allocUnsafe(0)
26667 }
26668
26669 if (field.allowLess && field.length) {
26670 v = exports.stripZeros(v)
26671 assert(field.length >= v.length, 'The field ' + field.name + ' must not have more ' + field.length + ' bytes')
26672 } else if (!(field.allowZero && v.length === 0) && field.length) {
26673 assert(field.length === v.length, 'The field ' + field.name + ' must have byte length of ' + field.length)
26674 }
26675
26676 self.raw[i] = v
26677 }
26678
26679 Object.defineProperty(self, field.name, {
26680 enumerable: true,
26681 configurable: true,
26682 get: getter,
26683 set: setter
26684 })
26685
26686 if (field.default) {
26687 self[field.name] = field.default
26688 }
26689
26690 // attach alias
26691 if (field.alias) {
26692 Object.defineProperty(self, field.alias, {
26693 enumerable: false,
26694 configurable: true,
26695 set: setter,
26696 get: getter
26697 })
26698 }
26699 })
26700
26701 // if the constuctor is passed data
26702 if (data) {
26703 if (typeof data === 'string') {
26704 data = Buffer.from(exports.stripHexPrefix(data), 'hex')
26705 }
26706
26707 if (Buffer.isBuffer(data)) {
26708 data = rlp.decode(data)
26709 }
26710
26711 if (Array.isArray(data)) {
26712 if (data.length > self._fields.length) {
26713 throw (new Error('wrong number of fields in data'))
26714 }
26715
26716 // make sure all the items are buffers
26717 data.forEach(function (d, i) {
26718 self[self._fields[i]] = exports.toBuffer(d)
26719 })
26720 } else if (typeof data === 'object') {
26721 const keys = Object.keys(data)
26722 fields.forEach(function (field) {
26723 if (keys.indexOf(field.name) !== -1) self[field.name] = data[field.name]
26724 if (keys.indexOf(field.alias) !== -1) self[field.alias] = data[field.alias]
26725 })
26726 } else {
26727 throw new Error('invalid data')
26728 }
26729 }
26730}
26731
26732}).call(this,require("buffer").Buffer)
26733},{"assert":1,"bn.js":33,"buffer":5,"create-hash":36,"ethjs-util":56,"keccak":65,"rlp":72,"secp256k1":73}],32:[function(require,module,exports){
26734(function (Buffer){
26735// Reference https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki
26736// Format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
26737// NOTE: SIGHASH byte ignored AND restricted, truncate before use
26738
26739function check (buffer) {
26740 if (buffer.length < 8) return false
26741 if (buffer.length > 72) return false
26742 if (buffer[0] !== 0x30) return false
26743 if (buffer[1] !== buffer.length - 2) return false
26744 if (buffer[2] !== 0x02) return false
26745
26746 var lenR = buffer[3]
26747 if (lenR === 0) return false
26748 if (5 + lenR >= buffer.length) return false
26749 if (buffer[4 + lenR] !== 0x02) return false
26750
26751 var lenS = buffer[5 + lenR]
26752 if (lenS === 0) return false
26753 if ((6 + lenR + lenS) !== buffer.length) return false
26754
26755 if (buffer[4] & 0x80) return false
26756 if (lenR > 1 && (buffer[4] === 0x00) && !(buffer[5] & 0x80)) return false
26757
26758 if (buffer[lenR + 6] & 0x80) return false
26759 if (lenS > 1 && (buffer[lenR + 6] === 0x00) && !(buffer[lenR + 7] & 0x80)) return false
26760 return true
26761}
26762
26763function decode (buffer) {
26764 if (buffer.length < 8) throw new Error('DER sequence length is too short')
26765 if (buffer.length > 72) throw new Error('DER sequence length is too long')
26766 if (buffer[0] !== 0x30) throw new Error('Expected DER sequence')
26767 if (buffer[1] !== buffer.length - 2) throw new Error('DER sequence length is invalid')
26768 if (buffer[2] !== 0x02) throw new Error('Expected DER integer')
26769
26770 var lenR = buffer[3]
26771 if (lenR === 0) throw new Error('R length is zero')
26772 if (5 + lenR >= buffer.length) throw new Error('R length is too long')
26773 if (buffer[4 + lenR] !== 0x02) throw new Error('Expected DER integer (2)')
26774
26775 var lenS = buffer[5 + lenR]
26776 if (lenS === 0) throw new Error('S length is zero')
26777 if ((6 + lenR + lenS) !== buffer.length) throw new Error('S length is invalid')
26778
26779 if (buffer[4] & 0x80) throw new Error('R value is negative')
26780 if (lenR > 1 && (buffer[4] === 0x00) && !(buffer[5] & 0x80)) throw new Error('R value excessively padded')
26781
26782 if (buffer[lenR + 6] & 0x80) throw new Error('S value is negative')
26783 if (lenS > 1 && (buffer[lenR + 6] === 0x00) && !(buffer[lenR + 7] & 0x80)) throw new Error('S value excessively padded')
26784
26785 // non-BIP66 - extract R, S values
26786 return {
26787 r: buffer.slice(4, 4 + lenR),
26788 s: buffer.slice(6 + lenR)
26789 }
26790}
26791
26792/*
26793 * Expects r and s to be positive DER integers.
26794 *
26795 * The DER format uses the most significant bit as a sign bit (& 0x80).
26796 * If the significant bit is set AND the integer is positive, a 0x00 is prepended.
26797 *
26798 * Examples:
26799 *
26800 * 0 => 0x00
26801 * 1 => 0x01
26802 * -1 => 0xff
26803 * 127 => 0x7f
26804 * -127 => 0x81
26805 * 128 => 0x0080
26806 * -128 => 0x80
26807 * 255 => 0x00ff
26808 * -255 => 0xff01
26809 * 16300 => 0x3fac
26810 * -16300 => 0xc054
26811 * 62300 => 0x00f35c
26812 * -62300 => 0xff0ca4
26813*/
26814function encode (r, s) {
26815 var lenR = r.length
26816 var lenS = s.length
26817 if (lenR === 0) throw new Error('R length is zero')
26818 if (lenS === 0) throw new Error('S length is zero')
26819 if (lenR > 33) throw new Error('R length is too long')
26820 if (lenS > 33) throw new Error('S length is too long')
26821 if (r[0] & 0x80) throw new Error('R value is negative')
26822 if (s[0] & 0x80) throw new Error('S value is negative')
26823 if (lenR > 1 && (r[0] === 0x00) && !(r[1] & 0x80)) throw new Error('R value excessively padded')
26824 if (lenS > 1 && (s[0] === 0x00) && !(s[1] & 0x80)) throw new Error('S value excessively padded')
26825
26826 var signature = new Buffer(6 + lenR + lenS)
26827
26828 // 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]
26829 signature[0] = 0x30
26830 signature[1] = signature.length - 2
26831 signature[2] = 0x02
26832 signature[3] = r.length
26833 r.copy(signature, 4)
26834 signature[4 + lenR] = 0x02
26835 signature[5 + lenR] = s.length
26836 s.copy(signature, 6 + lenR)
26837
26838 return signature
26839}
26840
26841module.exports = {
26842 check: check,
26843 decode: decode,
26844 encode: encode
26845}
26846
26847}).call(this,require("buffer").Buffer)
26848},{"buffer":5}],33:[function(require,module,exports){
26849(function (module, exports) {
26850 'use strict';
26851
26852 // Utils
26853 function assert (val, msg) {
26854 if (!val) throw new Error(msg || 'Assertion failed');
26855 }
26856
26857 // Could use `inherits` module, but don't want to move from single file
26858 // architecture yet.
26859 function inherits (ctor, superCtor) {
26860 ctor.super_ = superCtor;
26861 var TempCtor = function () {};
26862 TempCtor.prototype = superCtor.prototype;
26863 ctor.prototype = new TempCtor();
26864 ctor.prototype.constructor = ctor;
26865 }
26866
26867 // BN
26868
26869 function BN (number, base, endian) {
26870 if (BN.isBN(number)) {
26871 return number;
26872 }
26873
26874 this.negative = 0;
26875 this.words = null;
26876 this.length = 0;
26877
26878 // Reduction context
26879 this.red = null;
26880
26881 if (number !== null) {
26882 if (base === 'le' || base === 'be') {
26883 endian = base;
26884 base = 10;
26885 }
26886
26887 this._init(number || 0, base || 10, endian || 'be');
26888 }
26889 }
26890 if (typeof module === 'object') {
26891 module.exports = BN;
26892 } else {
26893 exports.BN = BN;
26894 }
26895
26896 BN.BN = BN;
26897 BN.wordSize = 26;
26898
26899 var Buffer;
26900 try {
26901 Buffer = require('buf' + 'fer').Buffer;
26902 } catch (e) {
26903 }
26904
26905 BN.isBN = function isBN (num) {
26906 if (num instanceof BN) {
26907 return true;
26908 }
26909
26910 return num !== null && typeof num === 'object' &&
26911 num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
26912 };
26913
26914 BN.max = function max (left, right) {
26915 if (left.cmp(right) > 0) return left;
26916 return right;
26917 };
26918
26919 BN.min = function min (left, right) {
26920 if (left.cmp(right) < 0) return left;
26921 return right;
26922 };
26923
26924 BN.prototype._init = function init (number, base, endian) {
26925 if (typeof number === 'number') {
26926 return this._initNumber(number, base, endian);
26927 }
26928
26929 if (typeof number === 'object') {
26930 return this._initArray(number, base, endian);
26931 }
26932
26933 if (base === 'hex') {
26934 base = 16;
26935 }
26936 assert(base === (base | 0) && base >= 2 && base <= 36);
26937
26938 number = number.toString().replace(/\s+/g, '');
26939 var start = 0;
26940 if (number[0] === '-') {
26941 start++;
26942 }
26943
26944 if (base === 16) {
26945 this._parseHex(number, start);
26946 } else {
26947 this._parseBase(number, base, start);
26948 }
26949
26950 if (number[0] === '-') {
26951 this.negative = 1;
26952 }
26953
26954 this.strip();
26955
26956 if (endian !== 'le') return;
26957
26958 this._initArray(this.toArray(), base, endian);
26959 };
26960
26961 BN.prototype._initNumber = function _initNumber (number, base, endian) {
26962 if (number < 0) {
26963 this.negative = 1;
26964 number = -number;
26965 }
26966 if (number < 0x4000000) {
26967 this.words = [ number & 0x3ffffff ];
26968 this.length = 1;
26969 } else if (number < 0x10000000000000) {
26970 this.words = [
26971 number & 0x3ffffff,
26972 (number / 0x4000000) & 0x3ffffff
26973 ];
26974 this.length = 2;
26975 } else {
26976 assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
26977 this.words = [
26978 number & 0x3ffffff,
26979 (number / 0x4000000) & 0x3ffffff,
26980 1
26981 ];
26982 this.length = 3;
26983 }
26984
26985 if (endian !== 'le') return;
26986
26987 // Reverse the bytes
26988 this._initArray(this.toArray(), base, endian);
26989 };
26990
26991 BN.prototype._initArray = function _initArray (number, base, endian) {
26992 // Perhaps a Uint8Array
26993 assert(typeof number.length === 'number');
26994 if (number.length <= 0) {
26995 this.words = [ 0 ];
26996 this.length = 1;
26997 return this;
26998 }
26999
27000 this.length = Math.ceil(number.length / 3);
27001 this.words = new Array(this.length);
27002 for (var i = 0; i < this.length; i++) {
27003 this.words[i] = 0;
27004 }
27005
27006 var j, w;
27007 var off = 0;
27008 if (endian === 'be') {
27009 for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
27010 w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
27011 this.words[j] |= (w << off) & 0x3ffffff;
27012 this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
27013 off += 24;
27014 if (off >= 26) {
27015 off -= 26;
27016 j++;
27017 }
27018 }
27019 } else if (endian === 'le') {
27020 for (i = 0, j = 0; i < number.length; i += 3) {
27021 w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
27022 this.words[j] |= (w << off) & 0x3ffffff;
27023 this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
27024 off += 24;
27025 if (off >= 26) {
27026 off -= 26;
27027 j++;
27028 }
27029 }
27030 }
27031 return this.strip();
27032 };
27033
27034 function parseHex (str, start, end) {
27035 var r = 0;
27036 var len = Math.min(str.length, end);
27037 for (var i = start; i < len; i++) {
27038 var c = str.charCodeAt(i) - 48;
27039
27040 r <<= 4;
27041
27042 // 'a' - 'f'
27043 if (c >= 49 && c <= 54) {
27044 r |= c - 49 + 0xa;
27045
27046 // 'A' - 'F'
27047 } else if (c >= 17 && c <= 22) {
27048 r |= c - 17 + 0xa;
27049
27050 // '0' - '9'
27051 } else {
27052 r |= c & 0xf;
27053 }
27054 }
27055 return r;
27056 }
27057
27058 BN.prototype._parseHex = function _parseHex (number, start) {
27059 // Create possibly bigger array to ensure that it fits the number
27060 this.length = Math.ceil((number.length - start) / 6);
27061 this.words = new Array(this.length);
27062 for (var i = 0; i < this.length; i++) {
27063 this.words[i] = 0;
27064 }
27065
27066 var j, w;
27067 // Scan 24-bit chunks and add them to the number
27068 var off = 0;
27069 for (i = number.length - 6, j = 0; i >= start; i -= 6) {
27070 w = parseHex(number, i, i + 6);
27071 this.words[j] |= (w << off) & 0x3ffffff;
27072 // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
27073 this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
27074 off += 24;
27075 if (off >= 26) {
27076 off -= 26;
27077 j++;
27078 }
27079 }
27080 if (i + 6 !== start) {
27081 w = parseHex(number, start, i + 6);
27082 this.words[j] |= (w << off) & 0x3ffffff;
27083 this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
27084 }
27085 this.strip();
27086 };
27087
27088 function parseBase (str, start, end, mul) {
27089 var r = 0;
27090 var len = Math.min(str.length, end);
27091 for (var i = start; i < len; i++) {
27092 var c = str.charCodeAt(i) - 48;
27093
27094 r *= mul;
27095
27096 // 'a'
27097 if (c >= 49) {
27098 r += c - 49 + 0xa;
27099
27100 // 'A'
27101 } else if (c >= 17) {
27102 r += c - 17 + 0xa;
27103
27104 // '0' - '9'
27105 } else {
27106 r += c;
27107 }
27108 }
27109 return r;
27110 }
27111
27112 BN.prototype._parseBase = function _parseBase (number, base, start) {
27113 // Initialize as zero
27114 this.words = [ 0 ];
27115 this.length = 1;
27116
27117 // Find length of limb in base
27118 for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
27119 limbLen++;
27120 }
27121 limbLen--;
27122 limbPow = (limbPow / base) | 0;
27123
27124 var total = number.length - start;
27125 var mod = total % limbLen;
27126 var end = Math.min(total, total - mod) + start;
27127
27128 var word = 0;
27129 for (var i = start; i < end; i += limbLen) {
27130 word = parseBase(number, i, i + limbLen, base);
27131
27132 this.imuln(limbPow);
27133 if (this.words[0] + word < 0x4000000) {
27134 this.words[0] += word;
27135 } else {
27136 this._iaddn(word);
27137 }
27138 }
27139
27140 if (mod !== 0) {
27141 var pow = 1;
27142 word = parseBase(number, i, number.length, base);
27143
27144 for (i = 0; i < mod; i++) {
27145 pow *= base;
27146 }
27147
27148 this.imuln(pow);
27149 if (this.words[0] + word < 0x4000000) {
27150 this.words[0] += word;
27151 } else {
27152 this._iaddn(word);
27153 }
27154 }
27155 };
27156
27157 BN.prototype.copy = function copy (dest) {
27158 dest.words = new Array(this.length);
27159 for (var i = 0; i < this.length; i++) {
27160 dest.words[i] = this.words[i];
27161 }
27162 dest.length = this.length;
27163 dest.negative = this.negative;
27164 dest.red = this.red;
27165 };
27166
27167 BN.prototype.clone = function clone () {
27168 var r = new BN(null);
27169 this.copy(r);
27170 return r;
27171 };
27172
27173 BN.prototype._expand = function _expand (size) {
27174 while (this.length < size) {
27175 this.words[this.length++] = 0;
27176 }
27177 return this;
27178 };
27179
27180 // Remove leading `0` from `this`
27181 BN.prototype.strip = function strip () {
27182 while (this.length > 1 && this.words[this.length - 1] === 0) {
27183 this.length--;
27184 }
27185 return this._normSign();
27186 };
27187
27188 BN.prototype._normSign = function _normSign () {
27189 // -0 = 0
27190 if (this.length === 1 && this.words[0] === 0) {
27191 this.negative = 0;
27192 }
27193 return this;
27194 };
27195
27196 BN.prototype.inspect = function inspect () {
27197 return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
27198 };
27199
27200 /*
27201
27202 var zeros = [];
27203 var groupSizes = [];
27204 var groupBases = [];
27205
27206 var s = '';
27207 var i = -1;
27208 while (++i < BN.wordSize) {
27209 zeros[i] = s;
27210 s += '0';
27211 }
27212 groupSizes[0] = 0;
27213 groupSizes[1] = 0;
27214 groupBases[0] = 0;
27215 groupBases[1] = 0;
27216 var base = 2 - 1;
27217 while (++base < 36 + 1) {
27218 var groupSize = 0;
27219 var groupBase = 1;
27220 while (groupBase < (1 << BN.wordSize) / base) {
27221 groupBase *= base;
27222 groupSize += 1;
27223 }
27224 groupSizes[base] = groupSize;
27225 groupBases[base] = groupBase;
27226 }
27227
27228 */
27229
27230 var zeros = [
27231 '',
27232 '0',
27233 '00',
27234 '000',
27235 '0000',
27236 '00000',
27237 '000000',
27238 '0000000',
27239 '00000000',
27240 '000000000',
27241 '0000000000',
27242 '00000000000',
27243 '000000000000',
27244 '0000000000000',
27245 '00000000000000',
27246 '000000000000000',
27247 '0000000000000000',
27248 '00000000000000000',
27249 '000000000000000000',
27250 '0000000000000000000',
27251 '00000000000000000000',
27252 '000000000000000000000',
27253 '0000000000000000000000',
27254 '00000000000000000000000',
27255 '000000000000000000000000',
27256 '0000000000000000000000000'
27257 ];
27258
27259 var groupSizes = [
27260 0, 0,
27261 25, 16, 12, 11, 10, 9, 8,
27262 8, 7, 7, 7, 7, 6, 6,
27263 6, 6, 6, 6, 6, 5, 5,
27264 5, 5, 5, 5, 5, 5, 5,
27265 5, 5, 5, 5, 5, 5, 5
27266 ];
27267
27268 var groupBases = [
27269 0, 0,
27270 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
27271 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
27272 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
27273 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
27274 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
27275 ];
27276
27277 BN.prototype.toString = function toString (base, padding) {
27278 base = base || 10;
27279 padding = padding | 0 || 1;
27280
27281 var out;
27282 if (base === 16 || base === 'hex') {
27283 out = '';
27284 var off = 0;
27285 var carry = 0;
27286 for (var i = 0; i < this.length; i++) {
27287 var w = this.words[i];
27288 var word = (((w << off) | carry) & 0xffffff).toString(16);
27289 carry = (w >>> (24 - off)) & 0xffffff;
27290 if (carry !== 0 || i !== this.length - 1) {
27291 out = zeros[6 - word.length] + word + out;
27292 } else {
27293 out = word + out;
27294 }
27295 off += 2;
27296 if (off >= 26) {
27297 off -= 26;
27298 i--;
27299 }
27300 }
27301 if (carry !== 0) {
27302 out = carry.toString(16) + out;
27303 }
27304 while (out.length % padding !== 0) {
27305 out = '0' + out;
27306 }
27307 if (this.negative !== 0) {
27308 out = '-' + out;
27309 }
27310 return out;
27311 }
27312
27313 if (base === (base | 0) && base >= 2 && base <= 36) {
27314 // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
27315 var groupSize = groupSizes[base];
27316 // var groupBase = Math.pow(base, groupSize);
27317 var groupBase = groupBases[base];
27318 out = '';
27319 var c = this.clone();
27320 c.negative = 0;
27321 while (!c.isZero()) {
27322 var r = c.modn(groupBase).toString(base);
27323 c = c.idivn(groupBase);
27324
27325 if (!c.isZero()) {
27326 out = zeros[groupSize - r.length] + r + out;
27327 } else {
27328 out = r + out;
27329 }
27330 }
27331 if (this.isZero()) {
27332 out = '0' + out;
27333 }
27334 while (out.length % padding !== 0) {
27335 out = '0' + out;
27336 }
27337 if (this.negative !== 0) {
27338 out = '-' + out;
27339 }
27340 return out;
27341 }
27342
27343 assert(false, 'Base should be between 2 and 36');
27344 };
27345
27346 BN.prototype.toNumber = function toNumber () {
27347 var ret = this.words[0];
27348 if (this.length === 2) {
27349 ret += this.words[1] * 0x4000000;
27350 } else if (this.length === 3 && this.words[2] === 0x01) {
27351 // NOTE: at this stage it is known that the top bit is set
27352 ret += 0x10000000000000 + (this.words[1] * 0x4000000);
27353 } else if (this.length > 2) {
27354 assert(false, 'Number can only safely store up to 53 bits');
27355 }
27356 return (this.negative !== 0) ? -ret : ret;
27357 };
27358
27359 BN.prototype.toJSON = function toJSON () {
27360 return this.toString(16);
27361 };
27362
27363 BN.prototype.toBuffer = function toBuffer (endian, length) {
27364 assert(typeof Buffer !== 'undefined');
27365 return this.toArrayLike(Buffer, endian, length);
27366 };
27367
27368 BN.prototype.toArray = function toArray (endian, length) {
27369 return this.toArrayLike(Array, endian, length);
27370 };
27371
27372 BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
27373 var byteLength = this.byteLength();
27374 var reqLength = length || Math.max(1, byteLength);
27375 assert(byteLength <= reqLength, 'byte array longer than desired length');
27376 assert(reqLength > 0, 'Requested array length <= 0');
27377
27378 this.strip();
27379 var littleEndian = endian === 'le';
27380 var res = new ArrayType(reqLength);
27381
27382 var b, i;
27383 var q = this.clone();
27384 if (!littleEndian) {
27385 // Assume big-endian
27386 for (i = 0; i < reqLength - byteLength; i++) {
27387 res[i] = 0;
27388 }
27389
27390 for (i = 0; !q.isZero(); i++) {
27391 b = q.andln(0xff);
27392 q.iushrn(8);
27393
27394 res[reqLength - i - 1] = b;
27395 }
27396 } else {
27397 for (i = 0; !q.isZero(); i++) {
27398 b = q.andln(0xff);
27399 q.iushrn(8);
27400
27401 res[i] = b;
27402 }
27403
27404 for (; i < reqLength; i++) {
27405 res[i] = 0;
27406 }
27407 }
27408
27409 return res;
27410 };
27411
27412 if (Math.clz32) {
27413 BN.prototype._countBits = function _countBits (w) {
27414 return 32 - Math.clz32(w);
27415 };
27416 } else {
27417 BN.prototype._countBits = function _countBits (w) {
27418 var t = w;
27419 var r = 0;
27420 if (t >= 0x1000) {
27421 r += 13;
27422 t >>>= 13;
27423 }
27424 if (t >= 0x40) {
27425 r += 7;
27426 t >>>= 7;
27427 }
27428 if (t >= 0x8) {
27429 r += 4;
27430 t >>>= 4;
27431 }
27432 if (t >= 0x02) {
27433 r += 2;
27434 t >>>= 2;
27435 }
27436 return r + t;
27437 };
27438 }
27439
27440 BN.prototype._zeroBits = function _zeroBits (w) {
27441 // Short-cut
27442 if (w === 0) return 26;
27443
27444 var t = w;
27445 var r = 0;
27446 if ((t & 0x1fff) === 0) {
27447 r += 13;
27448 t >>>= 13;
27449 }
27450 if ((t & 0x7f) === 0) {
27451 r += 7;
27452 t >>>= 7;
27453 }
27454 if ((t & 0xf) === 0) {
27455 r += 4;
27456 t >>>= 4;
27457 }
27458 if ((t & 0x3) === 0) {
27459 r += 2;
27460 t >>>= 2;
27461 }
27462 if ((t & 0x1) === 0) {
27463 r++;
27464 }
27465 return r;
27466 };
27467
27468 // Return number of used bits in a BN
27469 BN.prototype.bitLength = function bitLength () {
27470 var w = this.words[this.length - 1];
27471 var hi = this._countBits(w);
27472 return (this.length - 1) * 26 + hi;
27473 };
27474
27475 function toBitArray (num) {
27476 var w = new Array(num.bitLength());
27477
27478 for (var bit = 0; bit < w.length; bit++) {
27479 var off = (bit / 26) | 0;
27480 var wbit = bit % 26;
27481
27482 w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
27483 }
27484
27485 return w;
27486 }
27487
27488 // Number of trailing zero bits
27489 BN.prototype.zeroBits = function zeroBits () {
27490 if (this.isZero()) return 0;
27491
27492 var r = 0;
27493 for (var i = 0; i < this.length; i++) {
27494 var b = this._zeroBits(this.words[i]);
27495 r += b;
27496 if (b !== 26) break;
27497 }
27498 return r;
27499 };
27500
27501 BN.prototype.byteLength = function byteLength () {
27502 return Math.ceil(this.bitLength() / 8);
27503 };
27504
27505 BN.prototype.toTwos = function toTwos (width) {
27506 if (this.negative !== 0) {
27507 return this.abs().inotn(width).iaddn(1);
27508 }
27509 return this.clone();
27510 };
27511
27512 BN.prototype.fromTwos = function fromTwos (width) {
27513 if (this.testn(width - 1)) {
27514 return this.notn(width).iaddn(1).ineg();
27515 }
27516 return this.clone();
27517 };
27518
27519 BN.prototype.isNeg = function isNeg () {
27520 return this.negative !== 0;
27521 };
27522
27523 // Return negative clone of `this`
27524 BN.prototype.neg = function neg () {
27525 return this.clone().ineg();
27526 };
27527
27528 BN.prototype.ineg = function ineg () {
27529 if (!this.isZero()) {
27530 this.negative ^= 1;
27531 }
27532
27533 return this;
27534 };
27535
27536 // Or `num` with `this` in-place
27537 BN.prototype.iuor = function iuor (num) {
27538 while (this.length < num.length) {
27539 this.words[this.length++] = 0;
27540 }
27541
27542 for (var i = 0; i < num.length; i++) {
27543 this.words[i] = this.words[i] | num.words[i];
27544 }
27545
27546 return this.strip();
27547 };
27548
27549 BN.prototype.ior = function ior (num) {
27550 assert((this.negative | num.negative) === 0);
27551 return this.iuor(num);
27552 };
27553
27554 // Or `num` with `this`
27555 BN.prototype.or = function or (num) {
27556 if (this.length > num.length) return this.clone().ior(num);
27557 return num.clone().ior(this);
27558 };
27559
27560 BN.prototype.uor = function uor (num) {
27561 if (this.length > num.length) return this.clone().iuor(num);
27562 return num.clone().iuor(this);
27563 };
27564
27565 // And `num` with `this` in-place
27566 BN.prototype.iuand = function iuand (num) {
27567 // b = min-length(num, this)
27568 var b;
27569 if (this.length > num.length) {
27570 b = num;
27571 } else {
27572 b = this;
27573 }
27574
27575 for (var i = 0; i < b.length; i++) {
27576 this.words[i] = this.words[i] & num.words[i];
27577 }
27578
27579 this.length = b.length;
27580
27581 return this.strip();
27582 };
27583
27584 BN.prototype.iand = function iand (num) {
27585 assert((this.negative | num.negative) === 0);
27586 return this.iuand(num);
27587 };
27588
27589 // And `num` with `this`
27590 BN.prototype.and = function and (num) {
27591 if (this.length > num.length) return this.clone().iand(num);
27592 return num.clone().iand(this);
27593 };
27594
27595 BN.prototype.uand = function uand (num) {
27596 if (this.length > num.length) return this.clone().iuand(num);
27597 return num.clone().iuand(this);
27598 };
27599
27600 // Xor `num` with `this` in-place
27601 BN.prototype.iuxor = function iuxor (num) {
27602 // a.length > b.length
27603 var a;
27604 var b;
27605 if (this.length > num.length) {
27606 a = this;
27607 b = num;
27608 } else {
27609 a = num;
27610 b = this;
27611 }
27612
27613 for (var i = 0; i < b.length; i++) {
27614 this.words[i] = a.words[i] ^ b.words[i];
27615 }
27616
27617 if (this !== a) {
27618 for (; i < a.length; i++) {
27619 this.words[i] = a.words[i];
27620 }
27621 }
27622
27623 this.length = a.length;
27624
27625 return this.strip();
27626 };
27627
27628 BN.prototype.ixor = function ixor (num) {
27629 assert((this.negative | num.negative) === 0);
27630 return this.iuxor(num);
27631 };
27632
27633 // Xor `num` with `this`
27634 BN.prototype.xor = function xor (num) {
27635 if (this.length > num.length) return this.clone().ixor(num);
27636 return num.clone().ixor(this);
27637 };
27638
27639 BN.prototype.uxor = function uxor (num) {
27640 if (this.length > num.length) return this.clone().iuxor(num);
27641 return num.clone().iuxor(this);
27642 };
27643
27644 // Not ``this`` with ``width`` bitwidth
27645 BN.prototype.inotn = function inotn (width) {
27646 assert(typeof width === 'number' && width >= 0);
27647
27648 var bytesNeeded = Math.ceil(width / 26) | 0;
27649 var bitsLeft = width % 26;
27650
27651 // Extend the buffer with leading zeroes
27652 this._expand(bytesNeeded);
27653
27654 if (bitsLeft > 0) {
27655 bytesNeeded--;
27656 }
27657
27658 // Handle complete words
27659 for (var i = 0; i < bytesNeeded; i++) {
27660 this.words[i] = ~this.words[i] & 0x3ffffff;
27661 }
27662
27663 // Handle the residue
27664 if (bitsLeft > 0) {
27665 this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
27666 }
27667
27668 // And remove leading zeroes
27669 return this.strip();
27670 };
27671
27672 BN.prototype.notn = function notn (width) {
27673 return this.clone().inotn(width);
27674 };
27675
27676 // Set `bit` of `this`
27677 BN.prototype.setn = function setn (bit, val) {
27678 assert(typeof bit === 'number' && bit >= 0);
27679
27680 var off = (bit / 26) | 0;
27681 var wbit = bit % 26;
27682
27683 this._expand(off + 1);
27684
27685 if (val) {
27686 this.words[off] = this.words[off] | (1 << wbit);
27687 } else {
27688 this.words[off] = this.words[off] & ~(1 << wbit);
27689 }
27690
27691 return this.strip();
27692 };
27693
27694 // Add `num` to `this` in-place
27695 BN.prototype.iadd = function iadd (num) {
27696 var r;
27697
27698 // negative + positive
27699 if (this.negative !== 0 && num.negative === 0) {
27700 this.negative = 0;
27701 r = this.isub(num);
27702 this.negative ^= 1;
27703 return this._normSign();
27704
27705 // positive + negative
27706 } else if (this.negative === 0 && num.negative !== 0) {
27707 num.negative = 0;
27708 r = this.isub(num);
27709 num.negative = 1;
27710 return r._normSign();
27711 }
27712
27713 // a.length > b.length
27714 var a, b;
27715 if (this.length > num.length) {
27716 a = this;
27717 b = num;
27718 } else {
27719 a = num;
27720 b = this;
27721 }
27722
27723 var carry = 0;
27724 for (var i = 0; i < b.length; i++) {
27725 r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
27726 this.words[i] = r & 0x3ffffff;
27727 carry = r >>> 26;
27728 }
27729 for (; carry !== 0 && i < a.length; i++) {
27730 r = (a.words[i] | 0) + carry;
27731 this.words[i] = r & 0x3ffffff;
27732 carry = r >>> 26;
27733 }
27734
27735 this.length = a.length;
27736 if (carry !== 0) {
27737 this.words[this.length] = carry;
27738 this.length++;
27739 // Copy the rest of the words
27740 } else if (a !== this) {
27741 for (; i < a.length; i++) {
27742 this.words[i] = a.words[i];
27743 }
27744 }
27745
27746 return this;
27747 };
27748
27749 // Add `num` to `this`
27750 BN.prototype.add = function add (num) {
27751 var res;
27752 if (num.negative !== 0 && this.negative === 0) {
27753 num.negative = 0;
27754 res = this.sub(num);
27755 num.negative ^= 1;
27756 return res;
27757 } else if (num.negative === 0 && this.negative !== 0) {
27758 this.negative = 0;
27759 res = num.sub(this);
27760 this.negative = 1;
27761 return res;
27762 }
27763
27764 if (this.length > num.length) return this.clone().iadd(num);
27765
27766 return num.clone().iadd(this);
27767 };
27768
27769 // Subtract `num` from `this` in-place
27770 BN.prototype.isub = function isub (num) {
27771 // this - (-num) = this + num
27772 if (num.negative !== 0) {
27773 num.negative = 0;
27774 var r = this.iadd(num);
27775 num.negative = 1;
27776 return r._normSign();
27777
27778 // -this - num = -(this + num)
27779 } else if (this.negative !== 0) {
27780 this.negative = 0;
27781 this.iadd(num);
27782 this.negative = 1;
27783 return this._normSign();
27784 }
27785
27786 // At this point both numbers are positive
27787 var cmp = this.cmp(num);
27788
27789 // Optimization - zeroify
27790 if (cmp === 0) {
27791 this.negative = 0;
27792 this.length = 1;
27793 this.words[0] = 0;
27794 return this;
27795 }
27796
27797 // a > b
27798 var a, b;
27799 if (cmp > 0) {
27800 a = this;
27801 b = num;
27802 } else {
27803 a = num;
27804 b = this;
27805 }
27806
27807 var carry = 0;
27808 for (var i = 0; i < b.length; i++) {
27809 r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
27810 carry = r >> 26;
27811 this.words[i] = r & 0x3ffffff;
27812 }
27813 for (; carry !== 0 && i < a.length; i++) {
27814 r = (a.words[i] | 0) + carry;
27815 carry = r >> 26;
27816 this.words[i] = r & 0x3ffffff;
27817 }
27818
27819 // Copy rest of the words
27820 if (carry === 0 && i < a.length && a !== this) {
27821 for (; i < a.length; i++) {
27822 this.words[i] = a.words[i];
27823 }
27824 }
27825
27826 this.length = Math.max(this.length, i);
27827
27828 if (a !== this) {
27829 this.negative = 1;
27830 }
27831
27832 return this.strip();
27833 };
27834
27835 // Subtract `num` from `this`
27836 BN.prototype.sub = function sub (num) {
27837 return this.clone().isub(num);
27838 };
27839
27840 function smallMulTo (self, num, out) {
27841 out.negative = num.negative ^ self.negative;
27842 var len = (self.length + num.length) | 0;
27843 out.length = len;
27844 len = (len - 1) | 0;
27845
27846 // Peel one iteration (compiler can't do it, because of code complexity)
27847 var a = self.words[0] | 0;
27848 var b = num.words[0] | 0;
27849 var r = a * b;
27850
27851 var lo = r & 0x3ffffff;
27852 var carry = (r / 0x4000000) | 0;
27853 out.words[0] = lo;
27854
27855 for (var k = 1; k < len; k++) {
27856 // Sum all words with the same `i + j = k` and accumulate `ncarry`,
27857 // note that ncarry could be >= 0x3ffffff
27858 var ncarry = carry >>> 26;
27859 var rword = carry & 0x3ffffff;
27860 var maxJ = Math.min(k, num.length - 1);
27861 for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
27862 var i = (k - j) | 0;
27863 a = self.words[i] | 0;
27864 b = num.words[j] | 0;
27865 r = a * b + rword;
27866 ncarry += (r / 0x4000000) | 0;
27867 rword = r & 0x3ffffff;
27868 }
27869 out.words[k] = rword | 0;
27870 carry = ncarry | 0;
27871 }
27872 if (carry !== 0) {
27873 out.words[k] = carry | 0;
27874 } else {
27875 out.length--;
27876 }
27877
27878 return out.strip();
27879 }
27880
27881 // TODO(indutny): it may be reasonable to omit it for users who don't need
27882 // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
27883 // multiplication (like elliptic secp256k1).
27884 var comb10MulTo = function comb10MulTo (self, num, out) {
27885 var a = self.words;
27886 var b = num.words;
27887 var o = out.words;
27888 var c = 0;
27889 var lo;
27890 var mid;
27891 var hi;
27892 var a0 = a[0] | 0;
27893 var al0 = a0 & 0x1fff;
27894 var ah0 = a0 >>> 13;
27895 var a1 = a[1] | 0;
27896 var al1 = a1 & 0x1fff;
27897 var ah1 = a1 >>> 13;
27898 var a2 = a[2] | 0;
27899 var al2 = a2 & 0x1fff;
27900 var ah2 = a2 >>> 13;
27901 var a3 = a[3] | 0;
27902 var al3 = a3 & 0x1fff;
27903 var ah3 = a3 >>> 13;
27904 var a4 = a[4] | 0;
27905 var al4 = a4 & 0x1fff;
27906 var ah4 = a4 >>> 13;
27907 var a5 = a[5] | 0;
27908 var al5 = a5 & 0x1fff;
27909 var ah5 = a5 >>> 13;
27910 var a6 = a[6] | 0;
27911 var al6 = a6 & 0x1fff;
27912 var ah6 = a6 >>> 13;
27913 var a7 = a[7] | 0;
27914 var al7 = a7 & 0x1fff;
27915 var ah7 = a7 >>> 13;
27916 var a8 = a[8] | 0;
27917 var al8 = a8 & 0x1fff;
27918 var ah8 = a8 >>> 13;
27919 var a9 = a[9] | 0;
27920 var al9 = a9 & 0x1fff;
27921 var ah9 = a9 >>> 13;
27922 var b0 = b[0] | 0;
27923 var bl0 = b0 & 0x1fff;
27924 var bh0 = b0 >>> 13;
27925 var b1 = b[1] | 0;
27926 var bl1 = b1 & 0x1fff;
27927 var bh1 = b1 >>> 13;
27928 var b2 = b[2] | 0;
27929 var bl2 = b2 & 0x1fff;
27930 var bh2 = b2 >>> 13;
27931 var b3 = b[3] | 0;
27932 var bl3 = b3 & 0x1fff;
27933 var bh3 = b3 >>> 13;
27934 var b4 = b[4] | 0;
27935 var bl4 = b4 & 0x1fff;
27936 var bh4 = b4 >>> 13;
27937 var b5 = b[5] | 0;
27938 var bl5 = b5 & 0x1fff;
27939 var bh5 = b5 >>> 13;
27940 var b6 = b[6] | 0;
27941 var bl6 = b6 & 0x1fff;
27942 var bh6 = b6 >>> 13;
27943 var b7 = b[7] | 0;
27944 var bl7 = b7 & 0x1fff;
27945 var bh7 = b7 >>> 13;
27946 var b8 = b[8] | 0;
27947 var bl8 = b8 & 0x1fff;
27948 var bh8 = b8 >>> 13;
27949 var b9 = b[9] | 0;
27950 var bl9 = b9 & 0x1fff;
27951 var bh9 = b9 >>> 13;
27952
27953 out.negative = self.negative ^ num.negative;
27954 out.length = 19;
27955 /* k = 0 */
27956 lo = Math.imul(al0, bl0);
27957 mid = Math.imul(al0, bh0);
27958 mid = (mid + Math.imul(ah0, bl0)) | 0;
27959 hi = Math.imul(ah0, bh0);
27960 var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
27961 c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
27962 w0 &= 0x3ffffff;
27963 /* k = 1 */
27964 lo = Math.imul(al1, bl0);
27965 mid = Math.imul(al1, bh0);
27966 mid = (mid + Math.imul(ah1, bl0)) | 0;
27967 hi = Math.imul(ah1, bh0);
27968 lo = (lo + Math.imul(al0, bl1)) | 0;
27969 mid = (mid + Math.imul(al0, bh1)) | 0;
27970 mid = (mid + Math.imul(ah0, bl1)) | 0;
27971 hi = (hi + Math.imul(ah0, bh1)) | 0;
27972 var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
27973 c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
27974 w1 &= 0x3ffffff;
27975 /* k = 2 */
27976 lo = Math.imul(al2, bl0);
27977 mid = Math.imul(al2, bh0);
27978 mid = (mid + Math.imul(ah2, bl0)) | 0;
27979 hi = Math.imul(ah2, bh0);
27980 lo = (lo + Math.imul(al1, bl1)) | 0;
27981 mid = (mid + Math.imul(al1, bh1)) | 0;
27982 mid = (mid + Math.imul(ah1, bl1)) | 0;
27983 hi = (hi + Math.imul(ah1, bh1)) | 0;
27984 lo = (lo + Math.imul(al0, bl2)) | 0;
27985 mid = (mid + Math.imul(al0, bh2)) | 0;
27986 mid = (mid + Math.imul(ah0, bl2)) | 0;
27987 hi = (hi + Math.imul(ah0, bh2)) | 0;
27988 var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
27989 c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
27990 w2 &= 0x3ffffff;
27991 /* k = 3 */
27992 lo = Math.imul(al3, bl0);
27993 mid = Math.imul(al3, bh0);
27994 mid = (mid + Math.imul(ah3, bl0)) | 0;
27995 hi = Math.imul(ah3, bh0);
27996 lo = (lo + Math.imul(al2, bl1)) | 0;
27997 mid = (mid + Math.imul(al2, bh1)) | 0;
27998 mid = (mid + Math.imul(ah2, bl1)) | 0;
27999 hi = (hi + Math.imul(ah2, bh1)) | 0;
28000 lo = (lo + Math.imul(al1, bl2)) | 0;
28001 mid = (mid + Math.imul(al1, bh2)) | 0;
28002 mid = (mid + Math.imul(ah1, bl2)) | 0;
28003 hi = (hi + Math.imul(ah1, bh2)) | 0;
28004 lo = (lo + Math.imul(al0, bl3)) | 0;
28005 mid = (mid + Math.imul(al0, bh3)) | 0;
28006 mid = (mid + Math.imul(ah0, bl3)) | 0;
28007 hi = (hi + Math.imul(ah0, bh3)) | 0;
28008 var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28009 c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
28010 w3 &= 0x3ffffff;
28011 /* k = 4 */
28012 lo = Math.imul(al4, bl0);
28013 mid = Math.imul(al4, bh0);
28014 mid = (mid + Math.imul(ah4, bl0)) | 0;
28015 hi = Math.imul(ah4, bh0);
28016 lo = (lo + Math.imul(al3, bl1)) | 0;
28017 mid = (mid + Math.imul(al3, bh1)) | 0;
28018 mid = (mid + Math.imul(ah3, bl1)) | 0;
28019 hi = (hi + Math.imul(ah3, bh1)) | 0;
28020 lo = (lo + Math.imul(al2, bl2)) | 0;
28021 mid = (mid + Math.imul(al2, bh2)) | 0;
28022 mid = (mid + Math.imul(ah2, bl2)) | 0;
28023 hi = (hi + Math.imul(ah2, bh2)) | 0;
28024 lo = (lo + Math.imul(al1, bl3)) | 0;
28025 mid = (mid + Math.imul(al1, bh3)) | 0;
28026 mid = (mid + Math.imul(ah1, bl3)) | 0;
28027 hi = (hi + Math.imul(ah1, bh3)) | 0;
28028 lo = (lo + Math.imul(al0, bl4)) | 0;
28029 mid = (mid + Math.imul(al0, bh4)) | 0;
28030 mid = (mid + Math.imul(ah0, bl4)) | 0;
28031 hi = (hi + Math.imul(ah0, bh4)) | 0;
28032 var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28033 c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
28034 w4 &= 0x3ffffff;
28035 /* k = 5 */
28036 lo = Math.imul(al5, bl0);
28037 mid = Math.imul(al5, bh0);
28038 mid = (mid + Math.imul(ah5, bl0)) | 0;
28039 hi = Math.imul(ah5, bh0);
28040 lo = (lo + Math.imul(al4, bl1)) | 0;
28041 mid = (mid + Math.imul(al4, bh1)) | 0;
28042 mid = (mid + Math.imul(ah4, bl1)) | 0;
28043 hi = (hi + Math.imul(ah4, bh1)) | 0;
28044 lo = (lo + Math.imul(al3, bl2)) | 0;
28045 mid = (mid + Math.imul(al3, bh2)) | 0;
28046 mid = (mid + Math.imul(ah3, bl2)) | 0;
28047 hi = (hi + Math.imul(ah3, bh2)) | 0;
28048 lo = (lo + Math.imul(al2, bl3)) | 0;
28049 mid = (mid + Math.imul(al2, bh3)) | 0;
28050 mid = (mid + Math.imul(ah2, bl3)) | 0;
28051 hi = (hi + Math.imul(ah2, bh3)) | 0;
28052 lo = (lo + Math.imul(al1, bl4)) | 0;
28053 mid = (mid + Math.imul(al1, bh4)) | 0;
28054 mid = (mid + Math.imul(ah1, bl4)) | 0;
28055 hi = (hi + Math.imul(ah1, bh4)) | 0;
28056 lo = (lo + Math.imul(al0, bl5)) | 0;
28057 mid = (mid + Math.imul(al0, bh5)) | 0;
28058 mid = (mid + Math.imul(ah0, bl5)) | 0;
28059 hi = (hi + Math.imul(ah0, bh5)) | 0;
28060 var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28061 c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
28062 w5 &= 0x3ffffff;
28063 /* k = 6 */
28064 lo = Math.imul(al6, bl0);
28065 mid = Math.imul(al6, bh0);
28066 mid = (mid + Math.imul(ah6, bl0)) | 0;
28067 hi = Math.imul(ah6, bh0);
28068 lo = (lo + Math.imul(al5, bl1)) | 0;
28069 mid = (mid + Math.imul(al5, bh1)) | 0;
28070 mid = (mid + Math.imul(ah5, bl1)) | 0;
28071 hi = (hi + Math.imul(ah5, bh1)) | 0;
28072 lo = (lo + Math.imul(al4, bl2)) | 0;
28073 mid = (mid + Math.imul(al4, bh2)) | 0;
28074 mid = (mid + Math.imul(ah4, bl2)) | 0;
28075 hi = (hi + Math.imul(ah4, bh2)) | 0;
28076 lo = (lo + Math.imul(al3, bl3)) | 0;
28077 mid = (mid + Math.imul(al3, bh3)) | 0;
28078 mid = (mid + Math.imul(ah3, bl3)) | 0;
28079 hi = (hi + Math.imul(ah3, bh3)) | 0;
28080 lo = (lo + Math.imul(al2, bl4)) | 0;
28081 mid = (mid + Math.imul(al2, bh4)) | 0;
28082 mid = (mid + Math.imul(ah2, bl4)) | 0;
28083 hi = (hi + Math.imul(ah2, bh4)) | 0;
28084 lo = (lo + Math.imul(al1, bl5)) | 0;
28085 mid = (mid + Math.imul(al1, bh5)) | 0;
28086 mid = (mid + Math.imul(ah1, bl5)) | 0;
28087 hi = (hi + Math.imul(ah1, bh5)) | 0;
28088 lo = (lo + Math.imul(al0, bl6)) | 0;
28089 mid = (mid + Math.imul(al0, bh6)) | 0;
28090 mid = (mid + Math.imul(ah0, bl6)) | 0;
28091 hi = (hi + Math.imul(ah0, bh6)) | 0;
28092 var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28093 c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
28094 w6 &= 0x3ffffff;
28095 /* k = 7 */
28096 lo = Math.imul(al7, bl0);
28097 mid = Math.imul(al7, bh0);
28098 mid = (mid + Math.imul(ah7, bl0)) | 0;
28099 hi = Math.imul(ah7, bh0);
28100 lo = (lo + Math.imul(al6, bl1)) | 0;
28101 mid = (mid + Math.imul(al6, bh1)) | 0;
28102 mid = (mid + Math.imul(ah6, bl1)) | 0;
28103 hi = (hi + Math.imul(ah6, bh1)) | 0;
28104 lo = (lo + Math.imul(al5, bl2)) | 0;
28105 mid = (mid + Math.imul(al5, bh2)) | 0;
28106 mid = (mid + Math.imul(ah5, bl2)) | 0;
28107 hi = (hi + Math.imul(ah5, bh2)) | 0;
28108 lo = (lo + Math.imul(al4, bl3)) | 0;
28109 mid = (mid + Math.imul(al4, bh3)) | 0;
28110 mid = (mid + Math.imul(ah4, bl3)) | 0;
28111 hi = (hi + Math.imul(ah4, bh3)) | 0;
28112 lo = (lo + Math.imul(al3, bl4)) | 0;
28113 mid = (mid + Math.imul(al3, bh4)) | 0;
28114 mid = (mid + Math.imul(ah3, bl4)) | 0;
28115 hi = (hi + Math.imul(ah3, bh4)) | 0;
28116 lo = (lo + Math.imul(al2, bl5)) | 0;
28117 mid = (mid + Math.imul(al2, bh5)) | 0;
28118 mid = (mid + Math.imul(ah2, bl5)) | 0;
28119 hi = (hi + Math.imul(ah2, bh5)) | 0;
28120 lo = (lo + Math.imul(al1, bl6)) | 0;
28121 mid = (mid + Math.imul(al1, bh6)) | 0;
28122 mid = (mid + Math.imul(ah1, bl6)) | 0;
28123 hi = (hi + Math.imul(ah1, bh6)) | 0;
28124 lo = (lo + Math.imul(al0, bl7)) | 0;
28125 mid = (mid + Math.imul(al0, bh7)) | 0;
28126 mid = (mid + Math.imul(ah0, bl7)) | 0;
28127 hi = (hi + Math.imul(ah0, bh7)) | 0;
28128 var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28129 c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
28130 w7 &= 0x3ffffff;
28131 /* k = 8 */
28132 lo = Math.imul(al8, bl0);
28133 mid = Math.imul(al8, bh0);
28134 mid = (mid + Math.imul(ah8, bl0)) | 0;
28135 hi = Math.imul(ah8, bh0);
28136 lo = (lo + Math.imul(al7, bl1)) | 0;
28137 mid = (mid + Math.imul(al7, bh1)) | 0;
28138 mid = (mid + Math.imul(ah7, bl1)) | 0;
28139 hi = (hi + Math.imul(ah7, bh1)) | 0;
28140 lo = (lo + Math.imul(al6, bl2)) | 0;
28141 mid = (mid + Math.imul(al6, bh2)) | 0;
28142 mid = (mid + Math.imul(ah6, bl2)) | 0;
28143 hi = (hi + Math.imul(ah6, bh2)) | 0;
28144 lo = (lo + Math.imul(al5, bl3)) | 0;
28145 mid = (mid + Math.imul(al5, bh3)) | 0;
28146 mid = (mid + Math.imul(ah5, bl3)) | 0;
28147 hi = (hi + Math.imul(ah5, bh3)) | 0;
28148 lo = (lo + Math.imul(al4, bl4)) | 0;
28149 mid = (mid + Math.imul(al4, bh4)) | 0;
28150 mid = (mid + Math.imul(ah4, bl4)) | 0;
28151 hi = (hi + Math.imul(ah4, bh4)) | 0;
28152 lo = (lo + Math.imul(al3, bl5)) | 0;
28153 mid = (mid + Math.imul(al3, bh5)) | 0;
28154 mid = (mid + Math.imul(ah3, bl5)) | 0;
28155 hi = (hi + Math.imul(ah3, bh5)) | 0;
28156 lo = (lo + Math.imul(al2, bl6)) | 0;
28157 mid = (mid + Math.imul(al2, bh6)) | 0;
28158 mid = (mid + Math.imul(ah2, bl6)) | 0;
28159 hi = (hi + Math.imul(ah2, bh6)) | 0;
28160 lo = (lo + Math.imul(al1, bl7)) | 0;
28161 mid = (mid + Math.imul(al1, bh7)) | 0;
28162 mid = (mid + Math.imul(ah1, bl7)) | 0;
28163 hi = (hi + Math.imul(ah1, bh7)) | 0;
28164 lo = (lo + Math.imul(al0, bl8)) | 0;
28165 mid = (mid + Math.imul(al0, bh8)) | 0;
28166 mid = (mid + Math.imul(ah0, bl8)) | 0;
28167 hi = (hi + Math.imul(ah0, bh8)) | 0;
28168 var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28169 c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
28170 w8 &= 0x3ffffff;
28171 /* k = 9 */
28172 lo = Math.imul(al9, bl0);
28173 mid = Math.imul(al9, bh0);
28174 mid = (mid + Math.imul(ah9, bl0)) | 0;
28175 hi = Math.imul(ah9, bh0);
28176 lo = (lo + Math.imul(al8, bl1)) | 0;
28177 mid = (mid + Math.imul(al8, bh1)) | 0;
28178 mid = (mid + Math.imul(ah8, bl1)) | 0;
28179 hi = (hi + Math.imul(ah8, bh1)) | 0;
28180 lo = (lo + Math.imul(al7, bl2)) | 0;
28181 mid = (mid + Math.imul(al7, bh2)) | 0;
28182 mid = (mid + Math.imul(ah7, bl2)) | 0;
28183 hi = (hi + Math.imul(ah7, bh2)) | 0;
28184 lo = (lo + Math.imul(al6, bl3)) | 0;
28185 mid = (mid + Math.imul(al6, bh3)) | 0;
28186 mid = (mid + Math.imul(ah6, bl3)) | 0;
28187 hi = (hi + Math.imul(ah6, bh3)) | 0;
28188 lo = (lo + Math.imul(al5, bl4)) | 0;
28189 mid = (mid + Math.imul(al5, bh4)) | 0;
28190 mid = (mid + Math.imul(ah5, bl4)) | 0;
28191 hi = (hi + Math.imul(ah5, bh4)) | 0;
28192 lo = (lo + Math.imul(al4, bl5)) | 0;
28193 mid = (mid + Math.imul(al4, bh5)) | 0;
28194 mid = (mid + Math.imul(ah4, bl5)) | 0;
28195 hi = (hi + Math.imul(ah4, bh5)) | 0;
28196 lo = (lo + Math.imul(al3, bl6)) | 0;
28197 mid = (mid + Math.imul(al3, bh6)) | 0;
28198 mid = (mid + Math.imul(ah3, bl6)) | 0;
28199 hi = (hi + Math.imul(ah3, bh6)) | 0;
28200 lo = (lo + Math.imul(al2, bl7)) | 0;
28201 mid = (mid + Math.imul(al2, bh7)) | 0;
28202 mid = (mid + Math.imul(ah2, bl7)) | 0;
28203 hi = (hi + Math.imul(ah2, bh7)) | 0;
28204 lo = (lo + Math.imul(al1, bl8)) | 0;
28205 mid = (mid + Math.imul(al1, bh8)) | 0;
28206 mid = (mid + Math.imul(ah1, bl8)) | 0;
28207 hi = (hi + Math.imul(ah1, bh8)) | 0;
28208 lo = (lo + Math.imul(al0, bl9)) | 0;
28209 mid = (mid + Math.imul(al0, bh9)) | 0;
28210 mid = (mid + Math.imul(ah0, bl9)) | 0;
28211 hi = (hi + Math.imul(ah0, bh9)) | 0;
28212 var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28213 c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
28214 w9 &= 0x3ffffff;
28215 /* k = 10 */
28216 lo = Math.imul(al9, bl1);
28217 mid = Math.imul(al9, bh1);
28218 mid = (mid + Math.imul(ah9, bl1)) | 0;
28219 hi = Math.imul(ah9, bh1);
28220 lo = (lo + Math.imul(al8, bl2)) | 0;
28221 mid = (mid + Math.imul(al8, bh2)) | 0;
28222 mid = (mid + Math.imul(ah8, bl2)) | 0;
28223 hi = (hi + Math.imul(ah8, bh2)) | 0;
28224 lo = (lo + Math.imul(al7, bl3)) | 0;
28225 mid = (mid + Math.imul(al7, bh3)) | 0;
28226 mid = (mid + Math.imul(ah7, bl3)) | 0;
28227 hi = (hi + Math.imul(ah7, bh3)) | 0;
28228 lo = (lo + Math.imul(al6, bl4)) | 0;
28229 mid = (mid + Math.imul(al6, bh4)) | 0;
28230 mid = (mid + Math.imul(ah6, bl4)) | 0;
28231 hi = (hi + Math.imul(ah6, bh4)) | 0;
28232 lo = (lo + Math.imul(al5, bl5)) | 0;
28233 mid = (mid + Math.imul(al5, bh5)) | 0;
28234 mid = (mid + Math.imul(ah5, bl5)) | 0;
28235 hi = (hi + Math.imul(ah5, bh5)) | 0;
28236 lo = (lo + Math.imul(al4, bl6)) | 0;
28237 mid = (mid + Math.imul(al4, bh6)) | 0;
28238 mid = (mid + Math.imul(ah4, bl6)) | 0;
28239 hi = (hi + Math.imul(ah4, bh6)) | 0;
28240 lo = (lo + Math.imul(al3, bl7)) | 0;
28241 mid = (mid + Math.imul(al3, bh7)) | 0;
28242 mid = (mid + Math.imul(ah3, bl7)) | 0;
28243 hi = (hi + Math.imul(ah3, bh7)) | 0;
28244 lo = (lo + Math.imul(al2, bl8)) | 0;
28245 mid = (mid + Math.imul(al2, bh8)) | 0;
28246 mid = (mid + Math.imul(ah2, bl8)) | 0;
28247 hi = (hi + Math.imul(ah2, bh8)) | 0;
28248 lo = (lo + Math.imul(al1, bl9)) | 0;
28249 mid = (mid + Math.imul(al1, bh9)) | 0;
28250 mid = (mid + Math.imul(ah1, bl9)) | 0;
28251 hi = (hi + Math.imul(ah1, bh9)) | 0;
28252 var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28253 c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
28254 w10 &= 0x3ffffff;
28255 /* k = 11 */
28256 lo = Math.imul(al9, bl2);
28257 mid = Math.imul(al9, bh2);
28258 mid = (mid + Math.imul(ah9, bl2)) | 0;
28259 hi = Math.imul(ah9, bh2);
28260 lo = (lo + Math.imul(al8, bl3)) | 0;
28261 mid = (mid + Math.imul(al8, bh3)) | 0;
28262 mid = (mid + Math.imul(ah8, bl3)) | 0;
28263 hi = (hi + Math.imul(ah8, bh3)) | 0;
28264 lo = (lo + Math.imul(al7, bl4)) | 0;
28265 mid = (mid + Math.imul(al7, bh4)) | 0;
28266 mid = (mid + Math.imul(ah7, bl4)) | 0;
28267 hi = (hi + Math.imul(ah7, bh4)) | 0;
28268 lo = (lo + Math.imul(al6, bl5)) | 0;
28269 mid = (mid + Math.imul(al6, bh5)) | 0;
28270 mid = (mid + Math.imul(ah6, bl5)) | 0;
28271 hi = (hi + Math.imul(ah6, bh5)) | 0;
28272 lo = (lo + Math.imul(al5, bl6)) | 0;
28273 mid = (mid + Math.imul(al5, bh6)) | 0;
28274 mid = (mid + Math.imul(ah5, bl6)) | 0;
28275 hi = (hi + Math.imul(ah5, bh6)) | 0;
28276 lo = (lo + Math.imul(al4, bl7)) | 0;
28277 mid = (mid + Math.imul(al4, bh7)) | 0;
28278 mid = (mid + Math.imul(ah4, bl7)) | 0;
28279 hi = (hi + Math.imul(ah4, bh7)) | 0;
28280 lo = (lo + Math.imul(al3, bl8)) | 0;
28281 mid = (mid + Math.imul(al3, bh8)) | 0;
28282 mid = (mid + Math.imul(ah3, bl8)) | 0;
28283 hi = (hi + Math.imul(ah3, bh8)) | 0;
28284 lo = (lo + Math.imul(al2, bl9)) | 0;
28285 mid = (mid + Math.imul(al2, bh9)) | 0;
28286 mid = (mid + Math.imul(ah2, bl9)) | 0;
28287 hi = (hi + Math.imul(ah2, bh9)) | 0;
28288 var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28289 c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
28290 w11 &= 0x3ffffff;
28291 /* k = 12 */
28292 lo = Math.imul(al9, bl3);
28293 mid = Math.imul(al9, bh3);
28294 mid = (mid + Math.imul(ah9, bl3)) | 0;
28295 hi = Math.imul(ah9, bh3);
28296 lo = (lo + Math.imul(al8, bl4)) | 0;
28297 mid = (mid + Math.imul(al8, bh4)) | 0;
28298 mid = (mid + Math.imul(ah8, bl4)) | 0;
28299 hi = (hi + Math.imul(ah8, bh4)) | 0;
28300 lo = (lo + Math.imul(al7, bl5)) | 0;
28301 mid = (mid + Math.imul(al7, bh5)) | 0;
28302 mid = (mid + Math.imul(ah7, bl5)) | 0;
28303 hi = (hi + Math.imul(ah7, bh5)) | 0;
28304 lo = (lo + Math.imul(al6, bl6)) | 0;
28305 mid = (mid + Math.imul(al6, bh6)) | 0;
28306 mid = (mid + Math.imul(ah6, bl6)) | 0;
28307 hi = (hi + Math.imul(ah6, bh6)) | 0;
28308 lo = (lo + Math.imul(al5, bl7)) | 0;
28309 mid = (mid + Math.imul(al5, bh7)) | 0;
28310 mid = (mid + Math.imul(ah5, bl7)) | 0;
28311 hi = (hi + Math.imul(ah5, bh7)) | 0;
28312 lo = (lo + Math.imul(al4, bl8)) | 0;
28313 mid = (mid + Math.imul(al4, bh8)) | 0;
28314 mid = (mid + Math.imul(ah4, bl8)) | 0;
28315 hi = (hi + Math.imul(ah4, bh8)) | 0;
28316 lo = (lo + Math.imul(al3, bl9)) | 0;
28317 mid = (mid + Math.imul(al3, bh9)) | 0;
28318 mid = (mid + Math.imul(ah3, bl9)) | 0;
28319 hi = (hi + Math.imul(ah3, bh9)) | 0;
28320 var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28321 c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
28322 w12 &= 0x3ffffff;
28323 /* k = 13 */
28324 lo = Math.imul(al9, bl4);
28325 mid = Math.imul(al9, bh4);
28326 mid = (mid + Math.imul(ah9, bl4)) | 0;
28327 hi = Math.imul(ah9, bh4);
28328 lo = (lo + Math.imul(al8, bl5)) | 0;
28329 mid = (mid + Math.imul(al8, bh5)) | 0;
28330 mid = (mid + Math.imul(ah8, bl5)) | 0;
28331 hi = (hi + Math.imul(ah8, bh5)) | 0;
28332 lo = (lo + Math.imul(al7, bl6)) | 0;
28333 mid = (mid + Math.imul(al7, bh6)) | 0;
28334 mid = (mid + Math.imul(ah7, bl6)) | 0;
28335 hi = (hi + Math.imul(ah7, bh6)) | 0;
28336 lo = (lo + Math.imul(al6, bl7)) | 0;
28337 mid = (mid + Math.imul(al6, bh7)) | 0;
28338 mid = (mid + Math.imul(ah6, bl7)) | 0;
28339 hi = (hi + Math.imul(ah6, bh7)) | 0;
28340 lo = (lo + Math.imul(al5, bl8)) | 0;
28341 mid = (mid + Math.imul(al5, bh8)) | 0;
28342 mid = (mid + Math.imul(ah5, bl8)) | 0;
28343 hi = (hi + Math.imul(ah5, bh8)) | 0;
28344 lo = (lo + Math.imul(al4, bl9)) | 0;
28345 mid = (mid + Math.imul(al4, bh9)) | 0;
28346 mid = (mid + Math.imul(ah4, bl9)) | 0;
28347 hi = (hi + Math.imul(ah4, bh9)) | 0;
28348 var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28349 c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
28350 w13 &= 0x3ffffff;
28351 /* k = 14 */
28352 lo = Math.imul(al9, bl5);
28353 mid = Math.imul(al9, bh5);
28354 mid = (mid + Math.imul(ah9, bl5)) | 0;
28355 hi = Math.imul(ah9, bh5);
28356 lo = (lo + Math.imul(al8, bl6)) | 0;
28357 mid = (mid + Math.imul(al8, bh6)) | 0;
28358 mid = (mid + Math.imul(ah8, bl6)) | 0;
28359 hi = (hi + Math.imul(ah8, bh6)) | 0;
28360 lo = (lo + Math.imul(al7, bl7)) | 0;
28361 mid = (mid + Math.imul(al7, bh7)) | 0;
28362 mid = (mid + Math.imul(ah7, bl7)) | 0;
28363 hi = (hi + Math.imul(ah7, bh7)) | 0;
28364 lo = (lo + Math.imul(al6, bl8)) | 0;
28365 mid = (mid + Math.imul(al6, bh8)) | 0;
28366 mid = (mid + Math.imul(ah6, bl8)) | 0;
28367 hi = (hi + Math.imul(ah6, bh8)) | 0;
28368 lo = (lo + Math.imul(al5, bl9)) | 0;
28369 mid = (mid + Math.imul(al5, bh9)) | 0;
28370 mid = (mid + Math.imul(ah5, bl9)) | 0;
28371 hi = (hi + Math.imul(ah5, bh9)) | 0;
28372 var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28373 c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
28374 w14 &= 0x3ffffff;
28375 /* k = 15 */
28376 lo = Math.imul(al9, bl6);
28377 mid = Math.imul(al9, bh6);
28378 mid = (mid + Math.imul(ah9, bl6)) | 0;
28379 hi = Math.imul(ah9, bh6);
28380 lo = (lo + Math.imul(al8, bl7)) | 0;
28381 mid = (mid + Math.imul(al8, bh7)) | 0;
28382 mid = (mid + Math.imul(ah8, bl7)) | 0;
28383 hi = (hi + Math.imul(ah8, bh7)) | 0;
28384 lo = (lo + Math.imul(al7, bl8)) | 0;
28385 mid = (mid + Math.imul(al7, bh8)) | 0;
28386 mid = (mid + Math.imul(ah7, bl8)) | 0;
28387 hi = (hi + Math.imul(ah7, bh8)) | 0;
28388 lo = (lo + Math.imul(al6, bl9)) | 0;
28389 mid = (mid + Math.imul(al6, bh9)) | 0;
28390 mid = (mid + Math.imul(ah6, bl9)) | 0;
28391 hi = (hi + Math.imul(ah6, bh9)) | 0;
28392 var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28393 c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
28394 w15 &= 0x3ffffff;
28395 /* k = 16 */
28396 lo = Math.imul(al9, bl7);
28397 mid = Math.imul(al9, bh7);
28398 mid = (mid + Math.imul(ah9, bl7)) | 0;
28399 hi = Math.imul(ah9, bh7);
28400 lo = (lo + Math.imul(al8, bl8)) | 0;
28401 mid = (mid + Math.imul(al8, bh8)) | 0;
28402 mid = (mid + Math.imul(ah8, bl8)) | 0;
28403 hi = (hi + Math.imul(ah8, bh8)) | 0;
28404 lo = (lo + Math.imul(al7, bl9)) | 0;
28405 mid = (mid + Math.imul(al7, bh9)) | 0;
28406 mid = (mid + Math.imul(ah7, bl9)) | 0;
28407 hi = (hi + Math.imul(ah7, bh9)) | 0;
28408 var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28409 c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
28410 w16 &= 0x3ffffff;
28411 /* k = 17 */
28412 lo = Math.imul(al9, bl8);
28413 mid = Math.imul(al9, bh8);
28414 mid = (mid + Math.imul(ah9, bl8)) | 0;
28415 hi = Math.imul(ah9, bh8);
28416 lo = (lo + Math.imul(al8, bl9)) | 0;
28417 mid = (mid + Math.imul(al8, bh9)) | 0;
28418 mid = (mid + Math.imul(ah8, bl9)) | 0;
28419 hi = (hi + Math.imul(ah8, bh9)) | 0;
28420 var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28421 c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
28422 w17 &= 0x3ffffff;
28423 /* k = 18 */
28424 lo = Math.imul(al9, bl9);
28425 mid = Math.imul(al9, bh9);
28426 mid = (mid + Math.imul(ah9, bl9)) | 0;
28427 hi = Math.imul(ah9, bh9);
28428 var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
28429 c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
28430 w18 &= 0x3ffffff;
28431 o[0] = w0;
28432 o[1] = w1;
28433 o[2] = w2;
28434 o[3] = w3;
28435 o[4] = w4;
28436 o[5] = w5;
28437 o[6] = w6;
28438 o[7] = w7;
28439 o[8] = w8;
28440 o[9] = w9;
28441 o[10] = w10;
28442 o[11] = w11;
28443 o[12] = w12;
28444 o[13] = w13;
28445 o[14] = w14;
28446 o[15] = w15;
28447 o[16] = w16;
28448 o[17] = w17;
28449 o[18] = w18;
28450 if (c !== 0) {
28451 o[19] = c;
28452 out.length++;
28453 }
28454 return out;
28455 };
28456
28457 // Polyfill comb
28458 if (!Math.imul) {
28459 comb10MulTo = smallMulTo;
28460 }
28461
28462 function bigMulTo (self, num, out) {
28463 out.negative = num.negative ^ self.negative;
28464 out.length = self.length + num.length;
28465
28466 var carry = 0;
28467 var hncarry = 0;
28468 for (var k = 0; k < out.length - 1; k++) {
28469 // Sum all words with the same `i + j = k` and accumulate `ncarry`,
28470 // note that ncarry could be >= 0x3ffffff
28471 var ncarry = hncarry;
28472 hncarry = 0;
28473 var rword = carry & 0x3ffffff;
28474 var maxJ = Math.min(k, num.length - 1);
28475 for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
28476 var i = k - j;
28477 var a = self.words[i] | 0;
28478 var b = num.words[j] | 0;
28479 var r = a * b;
28480
28481 var lo = r & 0x3ffffff;
28482 ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
28483 lo = (lo + rword) | 0;
28484 rword = lo & 0x3ffffff;
28485 ncarry = (ncarry + (lo >>> 26)) | 0;
28486
28487 hncarry += ncarry >>> 26;
28488 ncarry &= 0x3ffffff;
28489 }
28490 out.words[k] = rword;
28491 carry = ncarry;
28492 ncarry = hncarry;
28493 }
28494 if (carry !== 0) {
28495 out.words[k] = carry;
28496 } else {
28497 out.length--;
28498 }
28499
28500 return out.strip();
28501 }
28502
28503 function jumboMulTo (self, num, out) {
28504 var fftm = new FFTM();
28505 return fftm.mulp(self, num, out);
28506 }
28507
28508 BN.prototype.mulTo = function mulTo (num, out) {
28509 var res;
28510 var len = this.length + num.length;
28511 if (this.length === 10 && num.length === 10) {
28512 res = comb10MulTo(this, num, out);
28513 } else if (len < 63) {
28514 res = smallMulTo(this, num, out);
28515 } else if (len < 1024) {
28516 res = bigMulTo(this, num, out);
28517 } else {
28518 res = jumboMulTo(this, num, out);
28519 }
28520
28521 return res;
28522 };
28523
28524 // Cooley-Tukey algorithm for FFT
28525 // slightly revisited to rely on looping instead of recursion
28526
28527 function FFTM (x, y) {
28528 this.x = x;
28529 this.y = y;
28530 }
28531
28532 FFTM.prototype.makeRBT = function makeRBT (N) {
28533 var t = new Array(N);
28534 var l = BN.prototype._countBits(N) - 1;
28535 for (var i = 0; i < N; i++) {
28536 t[i] = this.revBin(i, l, N);
28537 }
28538
28539 return t;
28540 };
28541
28542 // Returns binary-reversed representation of `x`
28543 FFTM.prototype.revBin = function revBin (x, l, N) {
28544 if (x === 0 || x === N - 1) return x;
28545
28546 var rb = 0;
28547 for (var i = 0; i < l; i++) {
28548 rb |= (x & 1) << (l - i - 1);
28549 x >>= 1;
28550 }
28551
28552 return rb;
28553 };
28554
28555 // Performs "tweedling" phase, therefore 'emulating'
28556 // behaviour of the recursive algorithm
28557 FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
28558 for (var i = 0; i < N; i++) {
28559 rtws[i] = rws[rbt[i]];
28560 itws[i] = iws[rbt[i]];
28561 }
28562 };
28563
28564 FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
28565 this.permute(rbt, rws, iws, rtws, itws, N);
28566
28567 for (var s = 1; s < N; s <<= 1) {
28568 var l = s << 1;
28569
28570 var rtwdf = Math.cos(2 * Math.PI / l);
28571 var itwdf = Math.sin(2 * Math.PI / l);
28572
28573 for (var p = 0; p < N; p += l) {
28574 var rtwdf_ = rtwdf;
28575 var itwdf_ = itwdf;
28576
28577 for (var j = 0; j < s; j++) {
28578 var re = rtws[p + j];
28579 var ie = itws[p + j];
28580
28581 var ro = rtws[p + j + s];
28582 var io = itws[p + j + s];
28583
28584 var rx = rtwdf_ * ro - itwdf_ * io;
28585
28586 io = rtwdf_ * io + itwdf_ * ro;
28587 ro = rx;
28588
28589 rtws[p + j] = re + ro;
28590 itws[p + j] = ie + io;
28591
28592 rtws[p + j + s] = re - ro;
28593 itws[p + j + s] = ie - io;
28594
28595 /* jshint maxdepth : false */
28596 if (j !== l) {
28597 rx = rtwdf * rtwdf_ - itwdf * itwdf_;
28598
28599 itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
28600 rtwdf_ = rx;
28601 }
28602 }
28603 }
28604 }
28605 };
28606
28607 FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
28608 var N = Math.max(m, n) | 1;
28609 var odd = N & 1;
28610 var i = 0;
28611 for (N = N / 2 | 0; N; N = N >>> 1) {
28612 i++;
28613 }
28614
28615 return 1 << i + 1 + odd;
28616 };
28617
28618 FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
28619 if (N <= 1) return;
28620
28621 for (var i = 0; i < N / 2; i++) {
28622 var t = rws[i];
28623
28624 rws[i] = rws[N - i - 1];
28625 rws[N - i - 1] = t;
28626
28627 t = iws[i];
28628
28629 iws[i] = -iws[N - i - 1];
28630 iws[N - i - 1] = -t;
28631 }
28632 };
28633
28634 FFTM.prototype.normalize13b = function normalize13b (ws, N) {
28635 var carry = 0;
28636 for (var i = 0; i < N / 2; i++) {
28637 var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
28638 Math.round(ws[2 * i] / N) +
28639 carry;
28640
28641 ws[i] = w & 0x3ffffff;
28642
28643 if (w < 0x4000000) {
28644 carry = 0;
28645 } else {
28646 carry = w / 0x4000000 | 0;
28647 }
28648 }
28649
28650 return ws;
28651 };
28652
28653 FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
28654 var carry = 0;
28655 for (var i = 0; i < len; i++) {
28656 carry = carry + (ws[i] | 0);
28657
28658 rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
28659 rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
28660 }
28661
28662 // Pad with zeroes
28663 for (i = 2 * len; i < N; ++i) {
28664 rws[i] = 0;
28665 }
28666
28667 assert(carry === 0);
28668 assert((carry & ~0x1fff) === 0);
28669 };
28670
28671 FFTM.prototype.stub = function stub (N) {
28672 var ph = new Array(N);
28673 for (var i = 0; i < N; i++) {
28674 ph[i] = 0;
28675 }
28676
28677 return ph;
28678 };
28679
28680 FFTM.prototype.mulp = function mulp (x, y, out) {
28681 var N = 2 * this.guessLen13b(x.length, y.length);
28682
28683 var rbt = this.makeRBT(N);
28684
28685 var _ = this.stub(N);
28686
28687 var rws = new Array(N);
28688 var rwst = new Array(N);
28689 var iwst = new Array(N);
28690
28691 var nrws = new Array(N);
28692 var nrwst = new Array(N);
28693 var niwst = new Array(N);
28694
28695 var rmws = out.words;
28696 rmws.length = N;
28697
28698 this.convert13b(x.words, x.length, rws, N);
28699 this.convert13b(y.words, y.length, nrws, N);
28700
28701 this.transform(rws, _, rwst, iwst, N, rbt);
28702 this.transform(nrws, _, nrwst, niwst, N, rbt);
28703
28704 for (var i = 0; i < N; i++) {
28705 var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
28706 iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
28707 rwst[i] = rx;
28708 }
28709
28710 this.conjugate(rwst, iwst, N);
28711 this.transform(rwst, iwst, rmws, _, N, rbt);
28712 this.conjugate(rmws, _, N);
28713 this.normalize13b(rmws, N);
28714
28715 out.negative = x.negative ^ y.negative;
28716 out.length = x.length + y.length;
28717 return out.strip();
28718 };
28719
28720 // Multiply `this` by `num`
28721 BN.prototype.mul = function mul (num) {
28722 var out = new BN(null);
28723 out.words = new Array(this.length + num.length);
28724 return this.mulTo(num, out);
28725 };
28726
28727 // Multiply employing FFT
28728 BN.prototype.mulf = function mulf (num) {
28729 var out = new BN(null);
28730 out.words = new Array(this.length + num.length);
28731 return jumboMulTo(this, num, out);
28732 };
28733
28734 // In-place Multiplication
28735 BN.prototype.imul = function imul (num) {
28736 return this.clone().mulTo(num, this);
28737 };
28738
28739 BN.prototype.imuln = function imuln (num) {
28740 assert(typeof num === 'number');
28741 assert(num < 0x4000000);
28742
28743 // Carry
28744 var carry = 0;
28745 for (var i = 0; i < this.length; i++) {
28746 var w = (this.words[i] | 0) * num;
28747 var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
28748 carry >>= 26;
28749 carry += (w / 0x4000000) | 0;
28750 // NOTE: lo is 27bit maximum
28751 carry += lo >>> 26;
28752 this.words[i] = lo & 0x3ffffff;
28753 }
28754
28755 if (carry !== 0) {
28756 this.words[i] = carry;
28757 this.length++;
28758 }
28759
28760 return this;
28761 };
28762
28763 BN.prototype.muln = function muln (num) {
28764 return this.clone().imuln(num);
28765 };
28766
28767 // `this` * `this`
28768 BN.prototype.sqr = function sqr () {
28769 return this.mul(this);
28770 };
28771
28772 // `this` * `this` in-place
28773 BN.prototype.isqr = function isqr () {
28774 return this.imul(this.clone());
28775 };
28776
28777 // Math.pow(`this`, `num`)
28778 BN.prototype.pow = function pow (num) {
28779 var w = toBitArray(num);
28780 if (w.length === 0) return new BN(1);
28781
28782 // Skip leading zeroes
28783 var res = this;
28784 for (var i = 0; i < w.length; i++, res = res.sqr()) {
28785 if (w[i] !== 0) break;
28786 }
28787
28788 if (++i < w.length) {
28789 for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
28790 if (w[i] === 0) continue;
28791
28792 res = res.mul(q);
28793 }
28794 }
28795
28796 return res;
28797 };
28798
28799 // Shift-left in-place
28800 BN.prototype.iushln = function iushln (bits) {
28801 assert(typeof bits === 'number' && bits >= 0);
28802 var r = bits % 26;
28803 var s = (bits - r) / 26;
28804 var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
28805 var i;
28806
28807 if (r !== 0) {
28808 var carry = 0;
28809
28810 for (i = 0; i < this.length; i++) {
28811 var newCarry = this.words[i] & carryMask;
28812 var c = ((this.words[i] | 0) - newCarry) << r;
28813 this.words[i] = c | carry;
28814 carry = newCarry >>> (26 - r);
28815 }
28816
28817 if (carry) {
28818 this.words[i] = carry;
28819 this.length++;
28820 }
28821 }
28822
28823 if (s !== 0) {
28824 for (i = this.length - 1; i >= 0; i--) {
28825 this.words[i + s] = this.words[i];
28826 }
28827
28828 for (i = 0; i < s; i++) {
28829 this.words[i] = 0;
28830 }
28831
28832 this.length += s;
28833 }
28834
28835 return this.strip();
28836 };
28837
28838 BN.prototype.ishln = function ishln (bits) {
28839 // TODO(indutny): implement me
28840 assert(this.negative === 0);
28841 return this.iushln(bits);
28842 };
28843
28844 // Shift-right in-place
28845 // NOTE: `hint` is a lowest bit before trailing zeroes
28846 // NOTE: if `extended` is present - it will be filled with destroyed bits
28847 BN.prototype.iushrn = function iushrn (bits, hint, extended) {
28848 assert(typeof bits === 'number' && bits >= 0);
28849 var h;
28850 if (hint) {
28851 h = (hint - (hint % 26)) / 26;
28852 } else {
28853 h = 0;
28854 }
28855
28856 var r = bits % 26;
28857 var s = Math.min((bits - r) / 26, this.length);
28858 var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
28859 var maskedWords = extended;
28860
28861 h -= s;
28862 h = Math.max(0, h);
28863
28864 // Extended mode, copy masked part
28865 if (maskedWords) {
28866 for (var i = 0; i < s; i++) {
28867 maskedWords.words[i] = this.words[i];
28868 }
28869 maskedWords.length = s;
28870 }
28871
28872 if (s === 0) {
28873 // No-op, we should not move anything at all
28874 } else if (this.length > s) {
28875 this.length -= s;
28876 for (i = 0; i < this.length; i++) {
28877 this.words[i] = this.words[i + s];
28878 }
28879 } else {
28880 this.words[0] = 0;
28881 this.length = 1;
28882 }
28883
28884 var carry = 0;
28885 for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
28886 var word = this.words[i] | 0;
28887 this.words[i] = (carry << (26 - r)) | (word >>> r);
28888 carry = word & mask;
28889 }
28890
28891 // Push carried bits as a mask
28892 if (maskedWords && carry !== 0) {
28893 maskedWords.words[maskedWords.length++] = carry;
28894 }
28895
28896 if (this.length === 0) {
28897 this.words[0] = 0;
28898 this.length = 1;
28899 }
28900
28901 return this.strip();
28902 };
28903
28904 BN.prototype.ishrn = function ishrn (bits, hint, extended) {
28905 // TODO(indutny): implement me
28906 assert(this.negative === 0);
28907 return this.iushrn(bits, hint, extended);
28908 };
28909
28910 // Shift-left
28911 BN.prototype.shln = function shln (bits) {
28912 return this.clone().ishln(bits);
28913 };
28914
28915 BN.prototype.ushln = function ushln (bits) {
28916 return this.clone().iushln(bits);
28917 };
28918
28919 // Shift-right
28920 BN.prototype.shrn = function shrn (bits) {
28921 return this.clone().ishrn(bits);
28922 };
28923
28924 BN.prototype.ushrn = function ushrn (bits) {
28925 return this.clone().iushrn(bits);
28926 };
28927
28928 // Test if n bit is set
28929 BN.prototype.testn = function testn (bit) {
28930 assert(typeof bit === 'number' && bit >= 0);
28931 var r = bit % 26;
28932 var s = (bit - r) / 26;
28933 var q = 1 << r;
28934
28935 // Fast case: bit is much higher than all existing words
28936 if (this.length <= s) return false;
28937
28938 // Check bit and return
28939 var w = this.words[s];
28940
28941 return !!(w & q);
28942 };
28943
28944 // Return only lowers bits of number (in-place)
28945 BN.prototype.imaskn = function imaskn (bits) {
28946 assert(typeof bits === 'number' && bits >= 0);
28947 var r = bits % 26;
28948 var s = (bits - r) / 26;
28949
28950 assert(this.negative === 0, 'imaskn works only with positive numbers');
28951
28952 if (this.length <= s) {
28953 return this;
28954 }
28955
28956 if (r !== 0) {
28957 s++;
28958 }
28959 this.length = Math.min(s, this.length);
28960
28961 if (r !== 0) {
28962 var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
28963 this.words[this.length - 1] &= mask;
28964 }
28965
28966 return this.strip();
28967 };
28968
28969 // Return only lowers bits of number
28970 BN.prototype.maskn = function maskn (bits) {
28971 return this.clone().imaskn(bits);
28972 };
28973
28974 // Add plain number `num` to `this`
28975 BN.prototype.iaddn = function iaddn (num) {
28976 assert(typeof num === 'number');
28977 assert(num < 0x4000000);
28978 if (num < 0) return this.isubn(-num);
28979
28980 // Possible sign change
28981 if (this.negative !== 0) {
28982 if (this.length === 1 && (this.words[0] | 0) < num) {
28983 this.words[0] = num - (this.words[0] | 0);
28984 this.negative = 0;
28985 return this;
28986 }
28987
28988 this.negative = 0;
28989 this.isubn(num);
28990 this.negative = 1;
28991 return this;
28992 }
28993
28994 // Add without checks
28995 return this._iaddn(num);
28996 };
28997
28998 BN.prototype._iaddn = function _iaddn (num) {
28999 this.words[0] += num;
29000
29001 // Carry
29002 for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
29003 this.words[i] -= 0x4000000;
29004 if (i === this.length - 1) {
29005 this.words[i + 1] = 1;
29006 } else {
29007 this.words[i + 1]++;
29008 }
29009 }
29010 this.length = Math.max(this.length, i + 1);
29011
29012 return this;
29013 };
29014
29015 // Subtract plain number `num` from `this`
29016 BN.prototype.isubn = function isubn (num) {
29017 assert(typeof num === 'number');
29018 assert(num < 0x4000000);
29019 if (num < 0) return this.iaddn(-num);
29020
29021 if (this.negative !== 0) {
29022 this.negative = 0;
29023 this.iaddn(num);
29024 this.negative = 1;
29025 return this;
29026 }
29027
29028 this.words[0] -= num;
29029
29030 if (this.length === 1 && this.words[0] < 0) {
29031 this.words[0] = -this.words[0];
29032 this.negative = 1;
29033 } else {
29034 // Carry
29035 for (var i = 0; i < this.length && this.words[i] < 0; i++) {
29036 this.words[i] += 0x4000000;
29037 this.words[i + 1] -= 1;
29038 }
29039 }
29040
29041 return this.strip();
29042 };
29043
29044 BN.prototype.addn = function addn (num) {
29045 return this.clone().iaddn(num);
29046 };
29047
29048 BN.prototype.subn = function subn (num) {
29049 return this.clone().isubn(num);
29050 };
29051
29052 BN.prototype.iabs = function iabs () {
29053 this.negative = 0;
29054
29055 return this;
29056 };
29057
29058 BN.prototype.abs = function abs () {
29059 return this.clone().iabs();
29060 };
29061
29062 BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
29063 var len = num.length + shift;
29064 var i;
29065
29066 this._expand(len);
29067
29068 var w;
29069 var carry = 0;
29070 for (i = 0; i < num.length; i++) {
29071 w = (this.words[i + shift] | 0) + carry;
29072 var right = (num.words[i] | 0) * mul;
29073 w -= right & 0x3ffffff;
29074 carry = (w >> 26) - ((right / 0x4000000) | 0);
29075 this.words[i + shift] = w & 0x3ffffff;
29076 }
29077 for (; i < this.length - shift; i++) {
29078 w = (this.words[i + shift] | 0) + carry;
29079 carry = w >> 26;
29080 this.words[i + shift] = w & 0x3ffffff;
29081 }
29082
29083 if (carry === 0) return this.strip();
29084
29085 // Subtraction overflow
29086 assert(carry === -1);
29087 carry = 0;
29088 for (i = 0; i < this.length; i++) {
29089 w = -(this.words[i] | 0) + carry;
29090 carry = w >> 26;
29091 this.words[i] = w & 0x3ffffff;
29092 }
29093 this.negative = 1;
29094
29095 return this.strip();
29096 };
29097
29098 BN.prototype._wordDiv = function _wordDiv (num, mode) {
29099 var shift = this.length - num.length;
29100
29101 var a = this.clone();
29102 var b = num;
29103
29104 // Normalize
29105 var bhi = b.words[b.length - 1] | 0;
29106 var bhiBits = this._countBits(bhi);
29107 shift = 26 - bhiBits;
29108 if (shift !== 0) {
29109 b = b.ushln(shift);
29110 a.iushln(shift);
29111 bhi = b.words[b.length - 1] | 0;
29112 }
29113
29114 // Initialize quotient
29115 var m = a.length - b.length;
29116 var q;
29117
29118 if (mode !== 'mod') {
29119 q = new BN(null);
29120 q.length = m + 1;
29121 q.words = new Array(q.length);
29122 for (var i = 0; i < q.length; i++) {
29123 q.words[i] = 0;
29124 }
29125 }
29126
29127 var diff = a.clone()._ishlnsubmul(b, 1, m);
29128 if (diff.negative === 0) {
29129 a = diff;
29130 if (q) {
29131 q.words[m] = 1;
29132 }
29133 }
29134
29135 for (var j = m - 1; j >= 0; j--) {
29136 var qj = (a.words[b.length + j] | 0) * 0x4000000 +
29137 (a.words[b.length + j - 1] | 0);
29138
29139 // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
29140 // (0x7ffffff)
29141 qj = Math.min((qj / bhi) | 0, 0x3ffffff);
29142
29143 a._ishlnsubmul(b, qj, j);
29144 while (a.negative !== 0) {
29145 qj--;
29146 a.negative = 0;
29147 a._ishlnsubmul(b, 1, j);
29148 if (!a.isZero()) {
29149 a.negative ^= 1;
29150 }
29151 }
29152 if (q) {
29153 q.words[j] = qj;
29154 }
29155 }
29156 if (q) {
29157 q.strip();
29158 }
29159 a.strip();
29160
29161 // Denormalize
29162 if (mode !== 'div' && shift !== 0) {
29163 a.iushrn(shift);
29164 }
29165
29166 return {
29167 div: q || null,
29168 mod: a
29169 };
29170 };
29171
29172 // NOTE: 1) `mode` can be set to `mod` to request mod only,
29173 // to `div` to request div only, or be absent to
29174 // request both div & mod
29175 // 2) `positive` is true if unsigned mod is requested
29176 BN.prototype.divmod = function divmod (num, mode, positive) {
29177 assert(!num.isZero());
29178
29179 if (this.isZero()) {
29180 return {
29181 div: new BN(0),
29182 mod: new BN(0)
29183 };
29184 }
29185
29186 var div, mod, res;
29187 if (this.negative !== 0 && num.negative === 0) {
29188 res = this.neg().divmod(num, mode);
29189
29190 if (mode !== 'mod') {
29191 div = res.div.neg();
29192 }
29193
29194 if (mode !== 'div') {
29195 mod = res.mod.neg();
29196 if (positive && mod.negative !== 0) {
29197 mod.iadd(num);
29198 }
29199 }
29200
29201 return {
29202 div: div,
29203 mod: mod
29204 };
29205 }
29206
29207 if (this.negative === 0 && num.negative !== 0) {
29208 res = this.divmod(num.neg(), mode);
29209
29210 if (mode !== 'mod') {
29211 div = res.div.neg();
29212 }
29213
29214 return {
29215 div: div,
29216 mod: res.mod
29217 };
29218 }
29219
29220 if ((this.negative & num.negative) !== 0) {
29221 res = this.neg().divmod(num.neg(), mode);
29222
29223 if (mode !== 'div') {
29224 mod = res.mod.neg();
29225 if (positive && mod.negative !== 0) {
29226 mod.isub(num);
29227 }
29228 }
29229
29230 return {
29231 div: res.div,
29232 mod: mod
29233 };
29234 }
29235
29236 // Both numbers are positive at this point
29237
29238 // Strip both numbers to approximate shift value
29239 if (num.length > this.length || this.cmp(num) < 0) {
29240 return {
29241 div: new BN(0),
29242 mod: this
29243 };
29244 }
29245
29246 // Very short reduction
29247 if (num.length === 1) {
29248 if (mode === 'div') {
29249 return {
29250 div: this.divn(num.words[0]),
29251 mod: null
29252 };
29253 }
29254
29255 if (mode === 'mod') {
29256 return {
29257 div: null,
29258 mod: new BN(this.modn(num.words[0]))
29259 };
29260 }
29261
29262 return {
29263 div: this.divn(num.words[0]),
29264 mod: new BN(this.modn(num.words[0]))
29265 };
29266 }
29267
29268 return this._wordDiv(num, mode);
29269 };
29270
29271 // Find `this` / `num`
29272 BN.prototype.div = function div (num) {
29273 return this.divmod(num, 'div', false).div;
29274 };
29275
29276 // Find `this` % `num`
29277 BN.prototype.mod = function mod (num) {
29278 return this.divmod(num, 'mod', false).mod;
29279 };
29280
29281 BN.prototype.umod = function umod (num) {
29282 return this.divmod(num, 'mod', true).mod;
29283 };
29284
29285 // Find Round(`this` / `num`)
29286 BN.prototype.divRound = function divRound (num) {
29287 var dm = this.divmod(num);
29288
29289 // Fast case - exact division
29290 if (dm.mod.isZero()) return dm.div;
29291
29292 var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
29293
29294 var half = num.ushrn(1);
29295 var r2 = num.andln(1);
29296 var cmp = mod.cmp(half);
29297
29298 // Round down
29299 if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
29300
29301 // Round up
29302 return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
29303 };
29304
29305 BN.prototype.modn = function modn (num) {
29306 assert(num <= 0x3ffffff);
29307 var p = (1 << 26) % num;
29308
29309 var acc = 0;
29310 for (var i = this.length - 1; i >= 0; i--) {
29311 acc = (p * acc + (this.words[i] | 0)) % num;
29312 }
29313
29314 return acc;
29315 };
29316
29317 // In-place division by number
29318 BN.prototype.idivn = function idivn (num) {
29319 assert(num <= 0x3ffffff);
29320
29321 var carry = 0;
29322 for (var i = this.length - 1; i >= 0; i--) {
29323 var w = (this.words[i] | 0) + carry * 0x4000000;
29324 this.words[i] = (w / num) | 0;
29325 carry = w % num;
29326 }
29327
29328 return this.strip();
29329 };
29330
29331 BN.prototype.divn = function divn (num) {
29332 return this.clone().idivn(num);
29333 };
29334
29335 BN.prototype.egcd = function egcd (p) {
29336 assert(p.negative === 0);
29337 assert(!p.isZero());
29338
29339 var x = this;
29340 var y = p.clone();
29341
29342 if (x.negative !== 0) {
29343 x = x.umod(p);
29344 } else {
29345 x = x.clone();
29346 }
29347
29348 // A * x + B * y = x
29349 var A = new BN(1);
29350 var B = new BN(0);
29351
29352 // C * x + D * y = y
29353 var C = new BN(0);
29354 var D = new BN(1);
29355
29356 var g = 0;
29357
29358 while (x.isEven() && y.isEven()) {
29359 x.iushrn(1);
29360 y.iushrn(1);
29361 ++g;
29362 }
29363
29364 var yp = y.clone();
29365 var xp = x.clone();
29366
29367 while (!x.isZero()) {
29368 for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
29369 if (i > 0) {
29370 x.iushrn(i);
29371 while (i-- > 0) {
29372 if (A.isOdd() || B.isOdd()) {
29373 A.iadd(yp);
29374 B.isub(xp);
29375 }
29376
29377 A.iushrn(1);
29378 B.iushrn(1);
29379 }
29380 }
29381
29382 for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
29383 if (j > 0) {
29384 y.iushrn(j);
29385 while (j-- > 0) {
29386 if (C.isOdd() || D.isOdd()) {
29387 C.iadd(yp);
29388 D.isub(xp);
29389 }
29390
29391 C.iushrn(1);
29392 D.iushrn(1);
29393 }
29394 }
29395
29396 if (x.cmp(y) >= 0) {
29397 x.isub(y);
29398 A.isub(C);
29399 B.isub(D);
29400 } else {
29401 y.isub(x);
29402 C.isub(A);
29403 D.isub(B);
29404 }
29405 }
29406
29407 return {
29408 a: C,
29409 b: D,
29410 gcd: y.iushln(g)
29411 };
29412 };
29413
29414 // This is reduced incarnation of the binary EEA
29415 // above, designated to invert members of the
29416 // _prime_ fields F(p) at a maximal speed
29417 BN.prototype._invmp = function _invmp (p) {
29418 assert(p.negative === 0);
29419 assert(!p.isZero());
29420
29421 var a = this;
29422 var b = p.clone();
29423
29424 if (a.negative !== 0) {
29425 a = a.umod(p);
29426 } else {
29427 a = a.clone();
29428 }
29429
29430 var x1 = new BN(1);
29431 var x2 = new BN(0);
29432
29433 var delta = b.clone();
29434
29435 while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
29436 for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
29437 if (i > 0) {
29438 a.iushrn(i);
29439 while (i-- > 0) {
29440 if (x1.isOdd()) {
29441 x1.iadd(delta);
29442 }
29443
29444 x1.iushrn(1);
29445 }
29446 }
29447
29448 for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
29449 if (j > 0) {
29450 b.iushrn(j);
29451 while (j-- > 0) {
29452 if (x2.isOdd()) {
29453 x2.iadd(delta);
29454 }
29455
29456 x2.iushrn(1);
29457 }
29458 }
29459
29460 if (a.cmp(b) >= 0) {
29461 a.isub(b);
29462 x1.isub(x2);
29463 } else {
29464 b.isub(a);
29465 x2.isub(x1);
29466 }
29467 }
29468
29469 var res;
29470 if (a.cmpn(1) === 0) {
29471 res = x1;
29472 } else {
29473 res = x2;
29474 }
29475
29476 if (res.cmpn(0) < 0) {
29477 res.iadd(p);
29478 }
29479
29480 return res;
29481 };
29482
29483 BN.prototype.gcd = function gcd (num) {
29484 if (this.isZero()) return num.abs();
29485 if (num.isZero()) return this.abs();
29486
29487 var a = this.clone();
29488 var b = num.clone();
29489 a.negative = 0;
29490 b.negative = 0;
29491
29492 // Remove common factor of two
29493 for (var shift = 0; a.isEven() && b.isEven(); shift++) {
29494 a.iushrn(1);
29495 b.iushrn(1);
29496 }
29497
29498 do {
29499 while (a.isEven()) {
29500 a.iushrn(1);
29501 }
29502 while (b.isEven()) {
29503 b.iushrn(1);
29504 }
29505
29506 var r = a.cmp(b);
29507 if (r < 0) {
29508 // Swap `a` and `b` to make `a` always bigger than `b`
29509 var t = a;
29510 a = b;
29511 b = t;
29512 } else if (r === 0 || b.cmpn(1) === 0) {
29513 break;
29514 }
29515
29516 a.isub(b);
29517 } while (true);
29518
29519 return b.iushln(shift);
29520 };
29521
29522 // Invert number in the field F(num)
29523 BN.prototype.invm = function invm (num) {
29524 return this.egcd(num).a.umod(num);
29525 };
29526
29527 BN.prototype.isEven = function isEven () {
29528 return (this.words[0] & 1) === 0;
29529 };
29530
29531 BN.prototype.isOdd = function isOdd () {
29532 return (this.words[0] & 1) === 1;
29533 };
29534
29535 // And first word and num
29536 BN.prototype.andln = function andln (num) {
29537 return this.words[0] & num;
29538 };
29539
29540 // Increment at the bit position in-line
29541 BN.prototype.bincn = function bincn (bit) {
29542 assert(typeof bit === 'number');
29543 var r = bit % 26;
29544 var s = (bit - r) / 26;
29545 var q = 1 << r;
29546
29547 // Fast case: bit is much higher than all existing words
29548 if (this.length <= s) {
29549 this._expand(s + 1);
29550 this.words[s] |= q;
29551 return this;
29552 }
29553
29554 // Add bit and propagate, if needed
29555 var carry = q;
29556 for (var i = s; carry !== 0 && i < this.length; i++) {
29557 var w = this.words[i] | 0;
29558 w += carry;
29559 carry = w >>> 26;
29560 w &= 0x3ffffff;
29561 this.words[i] = w;
29562 }
29563 if (carry !== 0) {
29564 this.words[i] = carry;
29565 this.length++;
29566 }
29567 return this;
29568 };
29569
29570 BN.prototype.isZero = function isZero () {
29571 return this.length === 1 && this.words[0] === 0;
29572 };
29573
29574 BN.prototype.cmpn = function cmpn (num) {
29575 var negative = num < 0;
29576
29577 if (this.negative !== 0 && !negative) return -1;
29578 if (this.negative === 0 && negative) return 1;
29579
29580 this.strip();
29581
29582 var res;
29583 if (this.length > 1) {
29584 res = 1;
29585 } else {
29586 if (negative) {
29587 num = -num;
29588 }
29589
29590 assert(num <= 0x3ffffff, 'Number is too big');
29591
29592 var w = this.words[0] | 0;
29593 res = w === num ? 0 : w < num ? -1 : 1;
29594 }
29595 if (this.negative !== 0) return -res | 0;
29596 return res;
29597 };
29598
29599 // Compare two numbers and return:
29600 // 1 - if `this` > `num`
29601 // 0 - if `this` == `num`
29602 // -1 - if `this` < `num`
29603 BN.prototype.cmp = function cmp (num) {
29604 if (this.negative !== 0 && num.negative === 0) return -1;
29605 if (this.negative === 0 && num.negative !== 0) return 1;
29606
29607 var res = this.ucmp(num);
29608 if (this.negative !== 0) return -res | 0;
29609 return res;
29610 };
29611
29612 // Unsigned comparison
29613 BN.prototype.ucmp = function ucmp (num) {
29614 // At this point both numbers have the same sign
29615 if (this.length > num.length) return 1;
29616 if (this.length < num.length) return -1;
29617
29618 var res = 0;
29619 for (var i = this.length - 1; i >= 0; i--) {
29620 var a = this.words[i] | 0;
29621 var b = num.words[i] | 0;
29622
29623 if (a === b) continue;
29624 if (a < b) {
29625 res = -1;
29626 } else if (a > b) {
29627 res = 1;
29628 }
29629 break;
29630 }
29631 return res;
29632 };
29633
29634 BN.prototype.gtn = function gtn (num) {
29635 return this.cmpn(num) === 1;
29636 };
29637
29638 BN.prototype.gt = function gt (num) {
29639 return this.cmp(num) === 1;
29640 };
29641
29642 BN.prototype.gten = function gten (num) {
29643 return this.cmpn(num) >= 0;
29644 };
29645
29646 BN.prototype.gte = function gte (num) {
29647 return this.cmp(num) >= 0;
29648 };
29649
29650 BN.prototype.ltn = function ltn (num) {
29651 return this.cmpn(num) === -1;
29652 };
29653
29654 BN.prototype.lt = function lt (num) {
29655 return this.cmp(num) === -1;
29656 };
29657
29658 BN.prototype.lten = function lten (num) {
29659 return this.cmpn(num) <= 0;
29660 };
29661
29662 BN.prototype.lte = function lte (num) {
29663 return this.cmp(num) <= 0;
29664 };
29665
29666 BN.prototype.eqn = function eqn (num) {
29667 return this.cmpn(num) === 0;
29668 };
29669
29670 BN.prototype.eq = function eq (num) {
29671 return this.cmp(num) === 0;
29672 };
29673
29674 //
29675 // A reduce context, could be using montgomery or something better, depending
29676 // on the `m` itself.
29677 //
29678 BN.red = function red (num) {
29679 return new Red(num);
29680 };
29681
29682 BN.prototype.toRed = function toRed (ctx) {
29683 assert(!this.red, 'Already a number in reduction context');
29684 assert(this.negative === 0, 'red works only with positives');
29685 return ctx.convertTo(this)._forceRed(ctx);
29686 };
29687
29688 BN.prototype.fromRed = function fromRed () {
29689 assert(this.red, 'fromRed works only with numbers in reduction context');
29690 return this.red.convertFrom(this);
29691 };
29692
29693 BN.prototype._forceRed = function _forceRed (ctx) {
29694 this.red = ctx;
29695 return this;
29696 };
29697
29698 BN.prototype.forceRed = function forceRed (ctx) {
29699 assert(!this.red, 'Already a number in reduction context');
29700 return this._forceRed(ctx);
29701 };
29702
29703 BN.prototype.redAdd = function redAdd (num) {
29704 assert(this.red, 'redAdd works only with red numbers');
29705 return this.red.add(this, num);
29706 };
29707
29708 BN.prototype.redIAdd = function redIAdd (num) {
29709 assert(this.red, 'redIAdd works only with red numbers');
29710 return this.red.iadd(this, num);
29711 };
29712
29713 BN.prototype.redSub = function redSub (num) {
29714 assert(this.red, 'redSub works only with red numbers');
29715 return this.red.sub(this, num);
29716 };
29717
29718 BN.prototype.redISub = function redISub (num) {
29719 assert(this.red, 'redISub works only with red numbers');
29720 return this.red.isub(this, num);
29721 };
29722
29723 BN.prototype.redShl = function redShl (num) {
29724 assert(this.red, 'redShl works only with red numbers');
29725 return this.red.shl(this, num);
29726 };
29727
29728 BN.prototype.redMul = function redMul (num) {
29729 assert(this.red, 'redMul works only with red numbers');
29730 this.red._verify2(this, num);
29731 return this.red.mul(this, num);
29732 };
29733
29734 BN.prototype.redIMul = function redIMul (num) {
29735 assert(this.red, 'redMul works only with red numbers');
29736 this.red._verify2(this, num);
29737 return this.red.imul(this, num);
29738 };
29739
29740 BN.prototype.redSqr = function redSqr () {
29741 assert(this.red, 'redSqr works only with red numbers');
29742 this.red._verify1(this);
29743 return this.red.sqr(this);
29744 };
29745
29746 BN.prototype.redISqr = function redISqr () {
29747 assert(this.red, 'redISqr works only with red numbers');
29748 this.red._verify1(this);
29749 return this.red.isqr(this);
29750 };
29751
29752 // Square root over p
29753 BN.prototype.redSqrt = function redSqrt () {
29754 assert(this.red, 'redSqrt works only with red numbers');
29755 this.red._verify1(this);
29756 return this.red.sqrt(this);
29757 };
29758
29759 BN.prototype.redInvm = function redInvm () {
29760 assert(this.red, 'redInvm works only with red numbers');
29761 this.red._verify1(this);
29762 return this.red.invm(this);
29763 };
29764
29765 // Return negative clone of `this` % `red modulo`
29766 BN.prototype.redNeg = function redNeg () {
29767 assert(this.red, 'redNeg works only with red numbers');
29768 this.red._verify1(this);
29769 return this.red.neg(this);
29770 };
29771
29772 BN.prototype.redPow = function redPow (num) {
29773 assert(this.red && !num.red, 'redPow(normalNum)');
29774 this.red._verify1(this);
29775 return this.red.pow(this, num);
29776 };
29777
29778 // Prime numbers with efficient reduction
29779 var primes = {
29780 k256: null,
29781 p224: null,
29782 p192: null,
29783 p25519: null
29784 };
29785
29786 // Pseudo-Mersenne prime
29787 function MPrime (name, p) {
29788 // P = 2 ^ N - K
29789 this.name = name;
29790 this.p = new BN(p, 16);
29791 this.n = this.p.bitLength();
29792 this.k = new BN(1).iushln(this.n).isub(this.p);
29793
29794 this.tmp = this._tmp();
29795 }
29796
29797 MPrime.prototype._tmp = function _tmp () {
29798 var tmp = new BN(null);
29799 tmp.words = new Array(Math.ceil(this.n / 13));
29800 return tmp;
29801 };
29802
29803 MPrime.prototype.ireduce = function ireduce (num) {
29804 // Assumes that `num` is less than `P^2`
29805 // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
29806 var r = num;
29807 var rlen;
29808
29809 do {
29810 this.split(r, this.tmp);
29811 r = this.imulK(r);
29812 r = r.iadd(this.tmp);
29813 rlen = r.bitLength();
29814 } while (rlen > this.n);
29815
29816 var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
29817 if (cmp === 0) {
29818 r.words[0] = 0;
29819 r.length = 1;
29820 } else if (cmp > 0) {
29821 r.isub(this.p);
29822 } else {
29823 r.strip();
29824 }
29825
29826 return r;
29827 };
29828
29829 MPrime.prototype.split = function split (input, out) {
29830 input.iushrn(this.n, 0, out);
29831 };
29832
29833 MPrime.prototype.imulK = function imulK (num) {
29834 return num.imul(this.k);
29835 };
29836
29837 function K256 () {
29838 MPrime.call(
29839 this,
29840 'k256',
29841 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
29842 }
29843 inherits(K256, MPrime);
29844
29845 K256.prototype.split = function split (input, output) {
29846 // 256 = 9 * 26 + 22
29847 var mask = 0x3fffff;
29848
29849 var outLen = Math.min(input.length, 9);
29850 for (var i = 0; i < outLen; i++) {
29851 output.words[i] = input.words[i];
29852 }
29853 output.length = outLen;
29854
29855 if (input.length <= 9) {
29856 input.words[0] = 0;
29857 input.length = 1;
29858 return;
29859 }
29860
29861 // Shift by 9 limbs
29862 var prev = input.words[9];
29863 output.words[output.length++] = prev & mask;
29864
29865 for (i = 10; i < input.length; i++) {
29866 var next = input.words[i] | 0;
29867 input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
29868 prev = next;
29869 }
29870 prev >>>= 22;
29871 input.words[i - 10] = prev;
29872 if (prev === 0 && input.length > 10) {
29873 input.length -= 10;
29874 } else {
29875 input.length -= 9;
29876 }
29877 };
29878
29879 K256.prototype.imulK = function imulK (num) {
29880 // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
29881 num.words[num.length] = 0;
29882 num.words[num.length + 1] = 0;
29883 num.length += 2;
29884
29885 // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
29886 var lo = 0;
29887 for (var i = 0; i < num.length; i++) {
29888 var w = num.words[i] | 0;
29889 lo += w * 0x3d1;
29890 num.words[i] = lo & 0x3ffffff;
29891 lo = w * 0x40 + ((lo / 0x4000000) | 0);
29892 }
29893
29894 // Fast length reduction
29895 if (num.words[num.length - 1] === 0) {
29896 num.length--;
29897 if (num.words[num.length - 1] === 0) {
29898 num.length--;
29899 }
29900 }
29901 return num;
29902 };
29903
29904 function P224 () {
29905 MPrime.call(
29906 this,
29907 'p224',
29908 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
29909 }
29910 inherits(P224, MPrime);
29911
29912 function P192 () {
29913 MPrime.call(
29914 this,
29915 'p192',
29916 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
29917 }
29918 inherits(P192, MPrime);
29919
29920 function P25519 () {
29921 // 2 ^ 255 - 19
29922 MPrime.call(
29923 this,
29924 '25519',
29925 '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
29926 }
29927 inherits(P25519, MPrime);
29928
29929 P25519.prototype.imulK = function imulK (num) {
29930 // K = 0x13
29931 var carry = 0;
29932 for (var i = 0; i < num.length; i++) {
29933 var hi = (num.words[i] | 0) * 0x13 + carry;
29934 var lo = hi & 0x3ffffff;
29935 hi >>>= 26;
29936
29937 num.words[i] = lo;
29938 carry = hi;
29939 }
29940 if (carry !== 0) {
29941 num.words[num.length++] = carry;
29942 }
29943 return num;
29944 };
29945
29946 // Exported mostly for testing purposes, use plain name instead
29947 BN._prime = function prime (name) {
29948 // Cached version of prime
29949 if (primes[name]) return primes[name];
29950
29951 var prime;
29952 if (name === 'k256') {
29953 prime = new K256();
29954 } else if (name === 'p224') {
29955 prime = new P224();
29956 } else if (name === 'p192') {
29957 prime = new P192();
29958 } else if (name === 'p25519') {
29959 prime = new P25519();
29960 } else {
29961 throw new Error('Unknown prime ' + name);
29962 }
29963 primes[name] = prime;
29964
29965 return prime;
29966 };
29967
29968 //
29969 // Base reduction engine
29970 //
29971 function Red (m) {
29972 if (typeof m === 'string') {
29973 var prime = BN._prime(m);
29974 this.m = prime.p;
29975 this.prime = prime;
29976 } else {
29977 assert(m.gtn(1), 'modulus must be greater than 1');
29978 this.m = m;
29979 this.prime = null;
29980 }
29981 }
29982
29983 Red.prototype._verify1 = function _verify1 (a) {
29984 assert(a.negative === 0, 'red works only with positives');
29985 assert(a.red, 'red works only with red numbers');
29986 };
29987
29988 Red.prototype._verify2 = function _verify2 (a, b) {
29989 assert((a.negative | b.negative) === 0, 'red works only with positives');
29990 assert(a.red && a.red === b.red,
29991 'red works only with red numbers');
29992 };
29993
29994 Red.prototype.imod = function imod (a) {
29995 if (this.prime) return this.prime.ireduce(a)._forceRed(this);
29996 return a.umod(this.m)._forceRed(this);
29997 };
29998
29999 Red.prototype.neg = function neg (a) {
30000 if (a.isZero()) {
30001 return a.clone();
30002 }
30003
30004 return this.m.sub(a)._forceRed(this);
30005 };
30006
30007 Red.prototype.add = function add (a, b) {
30008 this._verify2(a, b);
30009
30010 var res = a.add(b);
30011 if (res.cmp(this.m) >= 0) {
30012 res.isub(this.m);
30013 }
30014 return res._forceRed(this);
30015 };
30016
30017 Red.prototype.iadd = function iadd (a, b) {
30018 this._verify2(a, b);
30019
30020 var res = a.iadd(b);
30021 if (res.cmp(this.m) >= 0) {
30022 res.isub(this.m);
30023 }
30024 return res;
30025 };
30026
30027 Red.prototype.sub = function sub (a, b) {
30028 this._verify2(a, b);
30029
30030 var res = a.sub(b);
30031 if (res.cmpn(0) < 0) {
30032 res.iadd(this.m);
30033 }
30034 return res._forceRed(this);
30035 };
30036
30037 Red.prototype.isub = function isub (a, b) {
30038 this._verify2(a, b);
30039
30040 var res = a.isub(b);
30041 if (res.cmpn(0) < 0) {
30042 res.iadd(this.m);
30043 }
30044 return res;
30045 };
30046
30047 Red.prototype.shl = function shl (a, num) {
30048 this._verify1(a);
30049 return this.imod(a.ushln(num));
30050 };
30051
30052 Red.prototype.imul = function imul (a, b) {
30053 this._verify2(a, b);
30054 return this.imod(a.imul(b));
30055 };
30056
30057 Red.prototype.mul = function mul (a, b) {
30058 this._verify2(a, b);
30059 return this.imod(a.mul(b));
30060 };
30061
30062 Red.prototype.isqr = function isqr (a) {
30063 return this.imul(a, a.clone());
30064 };
30065
30066 Red.prototype.sqr = function sqr (a) {
30067 return this.mul(a, a);
30068 };
30069
30070 Red.prototype.sqrt = function sqrt (a) {
30071 if (a.isZero()) return a.clone();
30072
30073 var mod3 = this.m.andln(3);
30074 assert(mod3 % 2 === 1);
30075
30076 // Fast case
30077 if (mod3 === 3) {
30078 var pow = this.m.add(new BN(1)).iushrn(2);
30079 return this.pow(a, pow);
30080 }
30081
30082 // Tonelli-Shanks algorithm (Totally unoptimized and slow)
30083 //
30084 // Find Q and S, that Q * 2 ^ S = (P - 1)
30085 var q = this.m.subn(1);
30086 var s = 0;
30087 while (!q.isZero() && q.andln(1) === 0) {
30088 s++;
30089 q.iushrn(1);
30090 }
30091 assert(!q.isZero());
30092
30093 var one = new BN(1).toRed(this);
30094 var nOne = one.redNeg();
30095
30096 // Find quadratic non-residue
30097 // NOTE: Max is such because of generalized Riemann hypothesis.
30098 var lpow = this.m.subn(1).iushrn(1);
30099 var z = this.m.bitLength();
30100 z = new BN(2 * z * z).toRed(this);
30101
30102 while (this.pow(z, lpow).cmp(nOne) !== 0) {
30103 z.redIAdd(nOne);
30104 }
30105
30106 var c = this.pow(z, q);
30107 var r = this.pow(a, q.addn(1).iushrn(1));
30108 var t = this.pow(a, q);
30109 var m = s;
30110 while (t.cmp(one) !== 0) {
30111 var tmp = t;
30112 for (var i = 0; tmp.cmp(one) !== 0; i++) {
30113 tmp = tmp.redSqr();
30114 }
30115 assert(i < m);
30116 var b = this.pow(c, new BN(1).iushln(m - i - 1));
30117
30118 r = r.redMul(b);
30119 c = b.redSqr();
30120 t = t.redMul(c);
30121 m = i;
30122 }
30123
30124 return r;
30125 };
30126
30127 Red.prototype.invm = function invm (a) {
30128 var inv = a._invmp(this.m);
30129 if (inv.negative !== 0) {
30130 inv.negative = 0;
30131 return this.imod(inv).redNeg();
30132 } else {
30133 return this.imod(inv);
30134 }
30135 };
30136
30137 Red.prototype.pow = function pow (a, num) {
30138 if (num.isZero()) return new BN(1);
30139 if (num.cmpn(1) === 0) return a.clone();
30140
30141 var windowSize = 4;
30142 var wnd = new Array(1 << windowSize);
30143 wnd[0] = new BN(1).toRed(this);
30144 wnd[1] = a;
30145 for (var i = 2; i < wnd.length; i++) {
30146 wnd[i] = this.mul(wnd[i - 1], a);
30147 }
30148
30149 var res = wnd[0];
30150 var current = 0;
30151 var currentLen = 0;
30152 var start = num.bitLength() % 26;
30153 if (start === 0) {
30154 start = 26;
30155 }
30156
30157 for (i = num.length - 1; i >= 0; i--) {
30158 var word = num.words[i];
30159 for (var j = start - 1; j >= 0; j--) {
30160 var bit = (word >> j) & 1;
30161 if (res !== wnd[0]) {
30162 res = this.sqr(res);
30163 }
30164
30165 if (bit === 0 && current === 0) {
30166 currentLen = 0;
30167 continue;
30168 }
30169
30170 current <<= 1;
30171 current |= bit;
30172 currentLen++;
30173 if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
30174
30175 res = this.mul(res, wnd[current]);
30176 currentLen = 0;
30177 current = 0;
30178 }
30179 start = 26;
30180 }
30181
30182 return res;
30183 };
30184
30185 Red.prototype.convertTo = function convertTo (num) {
30186 var r = num.umod(this.m);
30187
30188 return r === num ? r.clone() : r;
30189 };
30190
30191 Red.prototype.convertFrom = function convertFrom (num) {
30192 var res = num.clone();
30193 res.red = null;
30194 return res;
30195 };
30196
30197 //
30198 // Montgomery method engine
30199 //
30200
30201 BN.mont = function mont (num) {
30202 return new Mont(num);
30203 };
30204
30205 function Mont (m) {
30206 Red.call(this, m);
30207
30208 this.shift = this.m.bitLength();
30209 if (this.shift % 26 !== 0) {
30210 this.shift += 26 - (this.shift % 26);
30211 }
30212
30213 this.r = new BN(1).iushln(this.shift);
30214 this.r2 = this.imod(this.r.sqr());
30215 this.rinv = this.r._invmp(this.m);
30216
30217 this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
30218 this.minv = this.minv.umod(this.r);
30219 this.minv = this.r.sub(this.minv);
30220 }
30221 inherits(Mont, Red);
30222
30223 Mont.prototype.convertTo = function convertTo (num) {
30224 return this.imod(num.ushln(this.shift));
30225 };
30226
30227 Mont.prototype.convertFrom = function convertFrom (num) {
30228 var r = this.imod(num.mul(this.rinv));
30229 r.red = null;
30230 return r;
30231 };
30232
30233 Mont.prototype.imul = function imul (a, b) {
30234 if (a.isZero() || b.isZero()) {
30235 a.words[0] = 0;
30236 a.length = 1;
30237 return a;
30238 }
30239
30240 var t = a.imul(b);
30241 var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
30242 var u = t.isub(c).iushrn(this.shift);
30243 var res = u;
30244
30245 if (u.cmp(this.m) >= 0) {
30246 res = u.isub(this.m);
30247 } else if (u.cmpn(0) < 0) {
30248 res = u.iadd(this.m);
30249 }
30250
30251 return res._forceRed(this);
30252 };
30253
30254 Mont.prototype.mul = function mul (a, b) {
30255 if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
30256
30257 var t = a.mul(b);
30258 var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
30259 var u = t.isub(c).iushrn(this.shift);
30260 var res = u;
30261 if (u.cmp(this.m) >= 0) {
30262 res = u.isub(this.m);
30263 } else if (u.cmpn(0) < 0) {
30264 res = u.iadd(this.m);
30265 }
30266
30267 return res._forceRed(this);
30268 };
30269
30270 Mont.prototype.invm = function invm (a) {
30271 // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
30272 var res = this.imod(a._invmp(this.m).mul(this.r2));
30273 return res._forceRed(this);
30274 };
30275})(typeof module === 'undefined' || module, this);
30276
30277},{}],34:[function(require,module,exports){
30278var r;
30279
30280module.exports = function rand(len) {
30281 if (!r)
30282 r = new Rand(null);
30283
30284 return r.generate(len);
30285};
30286
30287function Rand(rand) {
30288 this.rand = rand;
30289}
30290module.exports.Rand = Rand;
30291
30292Rand.prototype.generate = function generate(len) {
30293 return this._rand(len);
30294};
30295
30296if (typeof self === 'object') {
30297 if (self.crypto && self.crypto.getRandomValues) {
30298 // Modern browsers
30299 Rand.prototype._rand = function _rand(n) {
30300 var arr = new Uint8Array(n);
30301 self.crypto.getRandomValues(arr);
30302 return arr;
30303 };
30304 } else if (self.msCrypto && self.msCrypto.getRandomValues) {
30305 // IE
30306 Rand.prototype._rand = function _rand(n) {
30307 var arr = new Uint8Array(n);
30308 self.msCrypto.getRandomValues(arr);
30309 return arr;
30310 };
30311 } else {
30312 // Old junk
30313 Rand.prototype._rand = function() {
30314 throw new Error('Not implemented yet');
30315 };
30316 }
30317} else {
30318 // Node.js or Web worker with no crypto support
30319 try {
30320 var crypto = require('crypto');
30321
30322 Rand.prototype._rand = function _rand(n) {
30323 return crypto.randomBytes(n);
30324 };
30325 } catch (e) {
30326 // Emulate crypto API using randy
30327 Rand.prototype._rand = function _rand(n) {
30328 var res = new Uint8Array(n);
30329 for (var i = 0; i < res.length; i++)
30330 res[i] = this.rand.getByte();
30331 return res;
30332 };
30333 }
30334}
30335
30336},{"crypto":3}],35:[function(require,module,exports){
30337(function (Buffer){
30338var Transform = require('stream').Transform
30339var inherits = require('inherits')
30340var StringDecoder = require('string_decoder').StringDecoder
30341module.exports = CipherBase
30342inherits(CipherBase, Transform)
30343function CipherBase (hashMode) {
30344 Transform.call(this)
30345 this.hashMode = typeof hashMode === 'string'
30346 if (this.hashMode) {
30347 this[hashMode] = this._finalOrDigest
30348 } else {
30349 this.final = this._finalOrDigest
30350 }
30351 this._decoder = null
30352 this._encoding = null
30353}
30354CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
30355 if (typeof data === 'string') {
30356 data = new Buffer(data, inputEnc)
30357 }
30358 var outData = this._update(data)
30359 if (this.hashMode) {
30360 return this
30361 }
30362 if (outputEnc) {
30363 outData = this._toString(outData, outputEnc)
30364 }
30365 return outData
30366}
30367
30368CipherBase.prototype.setAutoPadding = function () {}
30369
30370CipherBase.prototype.getAuthTag = function () {
30371 throw new Error('trying to get auth tag in unsupported state')
30372}
30373
30374CipherBase.prototype.setAuthTag = function () {
30375 throw new Error('trying to set auth tag in unsupported state')
30376}
30377
30378CipherBase.prototype.setAAD = function () {
30379 throw new Error('trying to set aad in unsupported state')
30380}
30381
30382CipherBase.prototype._transform = function (data, _, next) {
30383 var err
30384 try {
30385 if (this.hashMode) {
30386 this._update(data)
30387 } else {
30388 this.push(this._update(data))
30389 }
30390 } catch (e) {
30391 err = e
30392 } finally {
30393 next(err)
30394 }
30395}
30396CipherBase.prototype._flush = function (done) {
30397 var err
30398 try {
30399 this.push(this._final())
30400 } catch (e) {
30401 err = e
30402 } finally {
30403 done(err)
30404 }
30405}
30406CipherBase.prototype._finalOrDigest = function (outputEnc) {
30407 var outData = this._final() || new Buffer('')
30408 if (outputEnc) {
30409 outData = this._toString(outData, outputEnc, true)
30410 }
30411 return outData
30412}
30413
30414CipherBase.prototype._toString = function (value, enc, fin) {
30415 if (!this._decoder) {
30416 this._decoder = new StringDecoder(enc)
30417 this._encoding = enc
30418 }
30419 if (this._encoding !== enc) {
30420 throw new Error('can\'t switch encodings')
30421 }
30422 var out = this._decoder.write(value)
30423 if (fin) {
30424 out += this._decoder.end()
30425 }
30426 return out
30427}
30428
30429}).call(this,require("buffer").Buffer)
30430},{"buffer":5,"inherits":63,"stream":25,"string_decoder":26}],36:[function(require,module,exports){
30431(function (Buffer){
30432'use strict';
30433var inherits = require('inherits')
30434var md5 = require('./md5')
30435var rmd160 = require('ripemd160')
30436var sha = require('sha.js')
30437
30438var Base = require('cipher-base')
30439
30440function HashNoConstructor(hash) {
30441 Base.call(this, 'digest')
30442
30443 this._hash = hash
30444 this.buffers = []
30445}
30446
30447inherits(HashNoConstructor, Base)
30448
30449HashNoConstructor.prototype._update = function (data) {
30450 this.buffers.push(data)
30451}
30452
30453HashNoConstructor.prototype._final = function () {
30454 var buf = Buffer.concat(this.buffers)
30455 var r = this._hash(buf)
30456 this.buffers = null
30457
30458 return r
30459}
30460
30461function Hash(hash) {
30462 Base.call(this, 'digest')
30463
30464 this._hash = hash
30465}
30466
30467inherits(Hash, Base)
30468
30469Hash.prototype._update = function (data) {
30470 this._hash.update(data)
30471}
30472
30473Hash.prototype._final = function () {
30474 return this._hash.digest()
30475}
30476
30477module.exports = function createHash (alg) {
30478 alg = alg.toLowerCase()
30479 if ('md5' === alg) return new HashNoConstructor(md5)
30480 if ('rmd160' === alg || 'ripemd160' === alg) return new HashNoConstructor(rmd160)
30481
30482 return new Hash(sha(alg))
30483}
30484
30485}).call(this,require("buffer").Buffer)
30486},{"./md5":38,"buffer":5,"cipher-base":35,"inherits":63,"ripemd160":71,"sha.js":80}],37:[function(require,module,exports){
30487(function (Buffer){
30488'use strict';
30489var intSize = 4;
30490var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
30491var chrsz = 8;
30492
30493function toArray(buf, bigEndian) {
30494 if ((buf.length % intSize) !== 0) {
30495 var len = buf.length + (intSize - (buf.length % intSize));
30496 buf = Buffer.concat([buf, zeroBuffer], len);
30497 }
30498
30499 var arr = [];
30500 var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
30501 for (var i = 0; i < buf.length; i += intSize) {
30502 arr.push(fn.call(buf, i));
30503 }
30504 return arr;
30505}
30506
30507function toBuffer(arr, size, bigEndian) {
30508 var buf = new Buffer(size);
30509 var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
30510 for (var i = 0; i < arr.length; i++) {
30511 fn.call(buf, arr[i], i * 4, true);
30512 }
30513 return buf;
30514}
30515
30516function hash(buf, fn, hashSize, bigEndian) {
30517 if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);
30518 var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
30519 return toBuffer(arr, hashSize, bigEndian);
30520}
30521exports.hash = hash;
30522}).call(this,require("buffer").Buffer)
30523},{"buffer":5}],38:[function(require,module,exports){
30524'use strict';
30525/*
30526 * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
30527 * Digest Algorithm, as defined in RFC 1321.
30528 * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
30529 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
30530 * Distributed under the BSD License
30531 * See http://pajhome.org.uk/crypt/md5 for more info.
30532 */
30533
30534var helpers = require('./helpers');
30535
30536/*
30537 * Calculate the MD5 of an array of little-endian words, and a bit length
30538 */
30539function core_md5(x, len)
30540{
30541 /* append padding */
30542 x[len >> 5] |= 0x80 << ((len) % 32);
30543 x[(((len + 64) >>> 9) << 4) + 14] = len;
30544
30545 var a = 1732584193;
30546 var b = -271733879;
30547 var c = -1732584194;
30548 var d = 271733878;
30549
30550 for(var i = 0; i < x.length; i += 16)
30551 {
30552 var olda = a;
30553 var oldb = b;
30554 var oldc = c;
30555 var oldd = d;
30556
30557 a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
30558 d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
30559 c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
30560 b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
30561 a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
30562 d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
30563 c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
30564 b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
30565 a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
30566 d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
30567 c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
30568 b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
30569 a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
30570 d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
30571 c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
30572 b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
30573
30574 a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
30575 d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
30576 c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
30577 b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
30578 a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
30579 d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
30580 c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
30581 b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
30582 a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
30583 d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
30584 c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
30585 b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
30586 a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
30587 d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
30588 c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
30589 b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
30590
30591 a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
30592 d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
30593 c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
30594 b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
30595 a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
30596 d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
30597 c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
30598 b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
30599 a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
30600 d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
30601 c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
30602 b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
30603 a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
30604 d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
30605 c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
30606 b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
30607
30608 a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
30609 d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
30610 c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
30611 b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
30612 a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
30613 d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
30614 c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
30615 b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
30616 a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
30617 d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
30618 c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
30619 b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
30620 a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
30621 d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
30622 c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
30623 b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
30624
30625 a = safe_add(a, olda);
30626 b = safe_add(b, oldb);
30627 c = safe_add(c, oldc);
30628 d = safe_add(d, oldd);
30629 }
30630 return Array(a, b, c, d);
30631
30632}
30633
30634/*
30635 * These functions implement the four basic operations the algorithm uses.
30636 */
30637function md5_cmn(q, a, b, x, s, t)
30638{
30639 return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
30640}
30641function md5_ff(a, b, c, d, x, s, t)
30642{
30643 return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
30644}
30645function md5_gg(a, b, c, d, x, s, t)
30646{
30647 return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
30648}
30649function md5_hh(a, b, c, d, x, s, t)
30650{
30651 return md5_cmn(b ^ c ^ d, a, b, x, s, t);
30652}
30653function md5_ii(a, b, c, d, x, s, t)
30654{
30655 return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
30656}
30657
30658/*
30659 * Add integers, wrapping at 2^32. This uses 16-bit operations internally
30660 * to work around bugs in some JS interpreters.
30661 */
30662function safe_add(x, y)
30663{
30664 var lsw = (x & 0xFFFF) + (y & 0xFFFF);
30665 var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
30666 return (msw << 16) | (lsw & 0xFFFF);
30667}
30668
30669/*
30670 * Bitwise rotate a 32-bit number to the left.
30671 */
30672function bit_rol(num, cnt)
30673{
30674 return (num << cnt) | (num >>> (32 - cnt));
30675}
30676
30677module.exports = function md5(buf) {
30678 return helpers.hash(buf, core_md5, 16);
30679};
30680},{"./helpers":37}],39:[function(require,module,exports){
30681'use strict';
30682
30683var elliptic = exports;
30684
30685elliptic.version = require('../package.json').version;
30686elliptic.utils = require('./elliptic/utils');
30687elliptic.rand = require('brorand');
30688elliptic.hmacDRBG = require('./elliptic/hmac-drbg');
30689elliptic.curve = require('./elliptic/curve');
30690elliptic.curves = require('./elliptic/curves');
30691
30692// Protocols
30693elliptic.ec = require('./elliptic/ec');
30694elliptic.eddsa = require('./elliptic/eddsa');
30695
30696},{"../package.json":55,"./elliptic/curve":42,"./elliptic/curves":45,"./elliptic/ec":46,"./elliptic/eddsa":49,"./elliptic/hmac-drbg":52,"./elliptic/utils":54,"brorand":34}],40:[function(require,module,exports){
30697'use strict';
30698
30699var BN = require('bn.js');
30700var elliptic = require('../../elliptic');
30701var utils = elliptic.utils;
30702var getNAF = utils.getNAF;
30703var getJSF = utils.getJSF;
30704var assert = utils.assert;
30705
30706function BaseCurve(type, conf) {
30707 this.type = type;
30708 this.p = new BN(conf.p, 16);
30709
30710 // Use Montgomery, when there is no fast reduction for the prime
30711 this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
30712
30713 // Useful for many curves
30714 this.zero = new BN(0).toRed(this.red);
30715 this.one = new BN(1).toRed(this.red);
30716 this.two = new BN(2).toRed(this.red);
30717
30718 // Curve configuration, optional
30719 this.n = conf.n && new BN(conf.n, 16);
30720 this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
30721
30722 // Temporary arrays
30723 this._wnafT1 = new Array(4);
30724 this._wnafT2 = new Array(4);
30725 this._wnafT3 = new Array(4);
30726 this._wnafT4 = new Array(4);
30727
30728 // Generalized Greg Maxwell's trick
30729 var adjustCount = this.n && this.p.div(this.n);
30730 if (!adjustCount || adjustCount.cmpn(100) > 0) {
30731 this.redN = null;
30732 } else {
30733 this._maxwellTrick = true;
30734 this.redN = this.n.toRed(this.red);
30735 }
30736}
30737module.exports = BaseCurve;
30738
30739BaseCurve.prototype.point = function point() {
30740 throw new Error('Not implemented');
30741};
30742
30743BaseCurve.prototype.validate = function validate() {
30744 throw new Error('Not implemented');
30745};
30746
30747BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
30748 assert(p.precomputed);
30749 var doubles = p._getDoubles();
30750
30751 var naf = getNAF(k, 1);
30752 var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
30753 I /= 3;
30754
30755 // Translate into more windowed form
30756 var repr = [];
30757 for (var j = 0; j < naf.length; j += doubles.step) {
30758 var nafW = 0;
30759 for (var k = j + doubles.step - 1; k >= j; k--)
30760 nafW = (nafW << 1) + naf[k];
30761 repr.push(nafW);
30762 }
30763
30764 var a = this.jpoint(null, null, null);
30765 var b = this.jpoint(null, null, null);
30766 for (var i = I; i > 0; i--) {
30767 for (var j = 0; j < repr.length; j++) {
30768 var nafW = repr[j];
30769 if (nafW === i)
30770 b = b.mixedAdd(doubles.points[j]);
30771 else if (nafW === -i)
30772 b = b.mixedAdd(doubles.points[j].neg());
30773 }
30774 a = a.add(b);
30775 }
30776 return a.toP();
30777};
30778
30779BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
30780 var w = 4;
30781
30782 // Precompute window
30783 var nafPoints = p._getNAFPoints(w);
30784 w = nafPoints.wnd;
30785 var wnd = nafPoints.points;
30786
30787 // Get NAF form
30788 var naf = getNAF(k, w);
30789
30790 // Add `this`*(N+1) for every w-NAF index
30791 var acc = this.jpoint(null, null, null);
30792 for (var i = naf.length - 1; i >= 0; i--) {
30793 // Count zeroes
30794 for (var k = 0; i >= 0 && naf[i] === 0; i--)
30795 k++;
30796 if (i >= 0)
30797 k++;
30798 acc = acc.dblp(k);
30799
30800 if (i < 0)
30801 break;
30802 var z = naf[i];
30803 assert(z !== 0);
30804 if (p.type === 'affine') {
30805 // J +- P
30806 if (z > 0)
30807 acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
30808 else
30809 acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
30810 } else {
30811 // J +- J
30812 if (z > 0)
30813 acc = acc.add(wnd[(z - 1) >> 1]);
30814 else
30815 acc = acc.add(wnd[(-z - 1) >> 1].neg());
30816 }
30817 }
30818 return p.type === 'affine' ? acc.toP() : acc;
30819};
30820
30821BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
30822 points,
30823 coeffs,
30824 len,
30825 jacobianResult) {
30826 var wndWidth = this._wnafT1;
30827 var wnd = this._wnafT2;
30828 var naf = this._wnafT3;
30829
30830 // Fill all arrays
30831 var max = 0;
30832 for (var i = 0; i < len; i++) {
30833 var p = points[i];
30834 var nafPoints = p._getNAFPoints(defW);
30835 wndWidth[i] = nafPoints.wnd;
30836 wnd[i] = nafPoints.points;
30837 }
30838
30839 // Comb small window NAFs
30840 for (var i = len - 1; i >= 1; i -= 2) {
30841 var a = i - 1;
30842 var b = i;
30843 if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
30844 naf[a] = getNAF(coeffs[a], wndWidth[a]);
30845 naf[b] = getNAF(coeffs[b], wndWidth[b]);
30846 max = Math.max(naf[a].length, max);
30847 max = Math.max(naf[b].length, max);
30848 continue;
30849 }
30850
30851 var comb = [
30852 points[a], /* 1 */
30853 null, /* 3 */
30854 null, /* 5 */
30855 points[b] /* 7 */
30856 ];
30857
30858 // Try to avoid Projective points, if possible
30859 if (points[a].y.cmp(points[b].y) === 0) {
30860 comb[1] = points[a].add(points[b]);
30861 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
30862 } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
30863 comb[1] = points[a].toJ().mixedAdd(points[b]);
30864 comb[2] = points[a].add(points[b].neg());
30865 } else {
30866 comb[1] = points[a].toJ().mixedAdd(points[b]);
30867 comb[2] = points[a].toJ().mixedAdd(points[b].neg());
30868 }
30869
30870 var index = [
30871 -3, /* -1 -1 */
30872 -1, /* -1 0 */
30873 -5, /* -1 1 */
30874 -7, /* 0 -1 */
30875 0, /* 0 0 */
30876 7, /* 0 1 */
30877 5, /* 1 -1 */
30878 1, /* 1 0 */
30879 3 /* 1 1 */
30880 ];
30881
30882 var jsf = getJSF(coeffs[a], coeffs[b]);
30883 max = Math.max(jsf[0].length, max);
30884 naf[a] = new Array(max);
30885 naf[b] = new Array(max);
30886 for (var j = 0; j < max; j++) {
30887 var ja = jsf[0][j] | 0;
30888 var jb = jsf[1][j] | 0;
30889
30890 naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
30891 naf[b][j] = 0;
30892 wnd[a] = comb;
30893 }
30894 }
30895
30896 var acc = this.jpoint(null, null, null);
30897 var tmp = this._wnafT4;
30898 for (var i = max; i >= 0; i--) {
30899 var k = 0;
30900
30901 while (i >= 0) {
30902 var zero = true;
30903 for (var j = 0; j < len; j++) {
30904 tmp[j] = naf[j][i] | 0;
30905 if (tmp[j] !== 0)
30906 zero = false;
30907 }
30908 if (!zero)
30909 break;
30910 k++;
30911 i--;
30912 }
30913 if (i >= 0)
30914 k++;
30915 acc = acc.dblp(k);
30916 if (i < 0)
30917 break;
30918
30919 for (var j = 0; j < len; j++) {
30920 var z = tmp[j];
30921 var p;
30922 if (z === 0)
30923 continue;
30924 else if (z > 0)
30925 p = wnd[j][(z - 1) >> 1];
30926 else if (z < 0)
30927 p = wnd[j][(-z - 1) >> 1].neg();
30928
30929 if (p.type === 'affine')
30930 acc = acc.mixedAdd(p);
30931 else
30932 acc = acc.add(p);
30933 }
30934 }
30935 // Zeroify references
30936 for (var i = 0; i < len; i++)
30937 wnd[i] = null;
30938
30939 if (jacobianResult)
30940 return acc;
30941 else
30942 return acc.toP();
30943};
30944
30945function BasePoint(curve, type) {
30946 this.curve = curve;
30947 this.type = type;
30948 this.precomputed = null;
30949}
30950BaseCurve.BasePoint = BasePoint;
30951
30952BasePoint.prototype.eq = function eq(/*other*/) {
30953 throw new Error('Not implemented');
30954};
30955
30956BasePoint.prototype.validate = function validate() {
30957 return this.curve.validate(this);
30958};
30959
30960BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
30961 bytes = utils.toArray(bytes, enc);
30962
30963 var len = this.p.byteLength();
30964
30965 // uncompressed, hybrid-odd, hybrid-even
30966 if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
30967 bytes.length - 1 === 2 * len) {
30968 if (bytes[0] === 0x06)
30969 assert(bytes[bytes.length - 1] % 2 === 0);
30970 else if (bytes[0] === 0x07)
30971 assert(bytes[bytes.length - 1] % 2 === 1);
30972
30973 var res = this.point(bytes.slice(1, 1 + len),
30974 bytes.slice(1 + len, 1 + 2 * len));
30975
30976 return res;
30977 } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
30978 bytes.length - 1 === len) {
30979 return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
30980 }
30981 throw new Error('Unknown point format');
30982};
30983
30984BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
30985 return this.encode(enc, true);
30986};
30987
30988BasePoint.prototype._encode = function _encode(compact) {
30989 var len = this.curve.p.byteLength();
30990 var x = this.getX().toArray('be', len);
30991
30992 if (compact)
30993 return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
30994
30995 return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
30996};
30997
30998BasePoint.prototype.encode = function encode(enc, compact) {
30999 return utils.encode(this._encode(compact), enc);
31000};
31001
31002BasePoint.prototype.precompute = function precompute(power) {
31003 if (this.precomputed)
31004 return this;
31005
31006 var precomputed = {
31007 doubles: null,
31008 naf: null,
31009 beta: null
31010 };
31011 precomputed.naf = this._getNAFPoints(8);
31012 precomputed.doubles = this._getDoubles(4, power);
31013 precomputed.beta = this._getBeta();
31014 this.precomputed = precomputed;
31015
31016 return this;
31017};
31018
31019BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
31020 if (!this.precomputed)
31021 return false;
31022
31023 var doubles = this.precomputed.doubles;
31024 if (!doubles)
31025 return false;
31026
31027 return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
31028};
31029
31030BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
31031 if (this.precomputed && this.precomputed.doubles)
31032 return this.precomputed.doubles;
31033
31034 var doubles = [ this ];
31035 var acc = this;
31036 for (var i = 0; i < power; i += step) {
31037 for (var j = 0; j < step; j++)
31038 acc = acc.dbl();
31039 doubles.push(acc);
31040 }
31041 return {
31042 step: step,
31043 points: doubles
31044 };
31045};
31046
31047BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
31048 if (this.precomputed && this.precomputed.naf)
31049 return this.precomputed.naf;
31050
31051 var res = [ this ];
31052 var max = (1 << wnd) - 1;
31053 var dbl = max === 1 ? null : this.dbl();
31054 for (var i = 1; i < max; i++)
31055 res[i] = res[i - 1].add(dbl);
31056 return {
31057 wnd: wnd,
31058 points: res
31059 };
31060};
31061
31062BasePoint.prototype._getBeta = function _getBeta() {
31063 return null;
31064};
31065
31066BasePoint.prototype.dblp = function dblp(k) {
31067 var r = this;
31068 for (var i = 0; i < k; i++)
31069 r = r.dbl();
31070 return r;
31071};
31072
31073},{"../../elliptic":39,"bn.js":33}],41:[function(require,module,exports){
31074'use strict';
31075
31076var curve = require('../curve');
31077var elliptic = require('../../elliptic');
31078var BN = require('bn.js');
31079var inherits = require('inherits');
31080var Base = curve.base;
31081
31082var assert = elliptic.utils.assert;
31083
31084function EdwardsCurve(conf) {
31085 // NOTE: Important as we are creating point in Base.call()
31086 this.twisted = (conf.a | 0) !== 1;
31087 this.mOneA = this.twisted && (conf.a | 0) === -1;
31088 this.extended = this.mOneA;
31089
31090 Base.call(this, 'edwards', conf);
31091
31092 this.a = new BN(conf.a, 16).umod(this.red.m);
31093 this.a = this.a.toRed(this.red);
31094 this.c = new BN(conf.c, 16).toRed(this.red);
31095 this.c2 = this.c.redSqr();
31096 this.d = new BN(conf.d, 16).toRed(this.red);
31097 this.dd = this.d.redAdd(this.d);
31098
31099 assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
31100 this.oneC = (conf.c | 0) === 1;
31101}
31102inherits(EdwardsCurve, Base);
31103module.exports = EdwardsCurve;
31104
31105EdwardsCurve.prototype._mulA = function _mulA(num) {
31106 if (this.mOneA)
31107 return num.redNeg();
31108 else
31109 return this.a.redMul(num);
31110};
31111
31112EdwardsCurve.prototype._mulC = function _mulC(num) {
31113 if (this.oneC)
31114 return num;
31115 else
31116 return this.c.redMul(num);
31117};
31118
31119// Just for compatibility with Short curve
31120EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
31121 return this.point(x, y, z, t);
31122};
31123
31124EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
31125 x = new BN(x, 16);
31126 if (!x.red)
31127 x = x.toRed(this.red);
31128
31129 var x2 = x.redSqr();
31130 var rhs = this.c2.redSub(this.a.redMul(x2));
31131 var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
31132
31133 var y2 = rhs.redMul(lhs.redInvm());
31134 var y = y2.redSqrt();
31135 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
31136 throw new Error('invalid point');
31137
31138 var isOdd = y.fromRed().isOdd();
31139 if (odd && !isOdd || !odd && isOdd)
31140 y = y.redNeg();
31141
31142 return this.point(x, y);
31143};
31144
31145EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
31146 y = new BN(y, 16);
31147 if (!y.red)
31148 y = y.toRed(this.red);
31149
31150 // x^2 = (y^2 - 1) / (d y^2 + 1)
31151 var y2 = y.redSqr();
31152 var lhs = y2.redSub(this.one);
31153 var rhs = y2.redMul(this.d).redAdd(this.one);
31154 var x2 = lhs.redMul(rhs.redInvm());
31155
31156 if (x2.cmp(this.zero) === 0) {
31157 if (odd)
31158 throw new Error('invalid point');
31159 else
31160 return this.point(this.zero, y);
31161 }
31162
31163 var x = x2.redSqrt();
31164 if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
31165 throw new Error('invalid point');
31166
31167 if (x.isOdd() !== odd)
31168 x = x.redNeg();
31169
31170 return this.point(x, y);
31171};
31172
31173EdwardsCurve.prototype.validate = function validate(point) {
31174 if (point.isInfinity())
31175 return true;
31176
31177 // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
31178 point.normalize();
31179
31180 var x2 = point.x.redSqr();
31181 var y2 = point.y.redSqr();
31182 var lhs = x2.redMul(this.a).redAdd(y2);
31183 var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
31184
31185 return lhs.cmp(rhs) === 0;
31186};
31187
31188function Point(curve, x, y, z, t) {
31189 Base.BasePoint.call(this, curve, 'projective');
31190 if (x === null && y === null && z === null) {
31191 this.x = this.curve.zero;
31192 this.y = this.curve.one;
31193 this.z = this.curve.one;
31194 this.t = this.curve.zero;
31195 this.zOne = true;
31196 } else {
31197 this.x = new BN(x, 16);
31198 this.y = new BN(y, 16);
31199 this.z = z ? new BN(z, 16) : this.curve.one;
31200 this.t = t && new BN(t, 16);
31201 if (!this.x.red)
31202 this.x = this.x.toRed(this.curve.red);
31203 if (!this.y.red)
31204 this.y = this.y.toRed(this.curve.red);
31205 if (!this.z.red)
31206 this.z = this.z.toRed(this.curve.red);
31207 if (this.t && !this.t.red)
31208 this.t = this.t.toRed(this.curve.red);
31209 this.zOne = this.z === this.curve.one;
31210
31211 // Use extended coordinates
31212 if (this.curve.extended && !this.t) {
31213 this.t = this.x.redMul(this.y);
31214 if (!this.zOne)
31215 this.t = this.t.redMul(this.z.redInvm());
31216 }
31217 }
31218}
31219inherits(Point, Base.BasePoint);
31220
31221EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
31222 return Point.fromJSON(this, obj);
31223};
31224
31225EdwardsCurve.prototype.point = function point(x, y, z, t) {
31226 return new Point(this, x, y, z, t);
31227};
31228
31229Point.fromJSON = function fromJSON(curve, obj) {
31230 return new Point(curve, obj[0], obj[1], obj[2]);
31231};
31232
31233Point.prototype.inspect = function inspect() {
31234 if (this.isInfinity())
31235 return '<EC Point Infinity>';
31236 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
31237 ' y: ' + this.y.fromRed().toString(16, 2) +
31238 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
31239};
31240
31241Point.prototype.isInfinity = function isInfinity() {
31242 // XXX This code assumes that zero is always zero in red
31243 return this.x.cmpn(0) === 0 &&
31244 this.y.cmp(this.z) === 0;
31245};
31246
31247Point.prototype._extDbl = function _extDbl() {
31248 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
31249 // #doubling-dbl-2008-hwcd
31250 // 4M + 4S
31251
31252 // A = X1^2
31253 var a = this.x.redSqr();
31254 // B = Y1^2
31255 var b = this.y.redSqr();
31256 // C = 2 * Z1^2
31257 var c = this.z.redSqr();
31258 c = c.redIAdd(c);
31259 // D = a * A
31260 var d = this.curve._mulA(a);
31261 // E = (X1 + Y1)^2 - A - B
31262 var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
31263 // G = D + B
31264 var g = d.redAdd(b);
31265 // F = G - C
31266 var f = g.redSub(c);
31267 // H = D - B
31268 var h = d.redSub(b);
31269 // X3 = E * F
31270 var nx = e.redMul(f);
31271 // Y3 = G * H
31272 var ny = g.redMul(h);
31273 // T3 = E * H
31274 var nt = e.redMul(h);
31275 // Z3 = F * G
31276 var nz = f.redMul(g);
31277 return this.curve.point(nx, ny, nz, nt);
31278};
31279
31280Point.prototype._projDbl = function _projDbl() {
31281 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
31282 // #doubling-dbl-2008-bbjlp
31283 // #doubling-dbl-2007-bl
31284 // and others
31285 // Generally 3M + 4S or 2M + 4S
31286
31287 // B = (X1 + Y1)^2
31288 var b = this.x.redAdd(this.y).redSqr();
31289 // C = X1^2
31290 var c = this.x.redSqr();
31291 // D = Y1^2
31292 var d = this.y.redSqr();
31293
31294 var nx;
31295 var ny;
31296 var nz;
31297 if (this.curve.twisted) {
31298 // E = a * C
31299 var e = this.curve._mulA(c);
31300 // F = E + D
31301 var f = e.redAdd(d);
31302 if (this.zOne) {
31303 // X3 = (B - C - D) * (F - 2)
31304 nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
31305 // Y3 = F * (E - D)
31306 ny = f.redMul(e.redSub(d));
31307 // Z3 = F^2 - 2 * F
31308 nz = f.redSqr().redSub(f).redSub(f);
31309 } else {
31310 // H = Z1^2
31311 var h = this.z.redSqr();
31312 // J = F - 2 * H
31313 var j = f.redSub(h).redISub(h);
31314 // X3 = (B-C-D)*J
31315 nx = b.redSub(c).redISub(d).redMul(j);
31316 // Y3 = F * (E - D)
31317 ny = f.redMul(e.redSub(d));
31318 // Z3 = F * J
31319 nz = f.redMul(j);
31320 }
31321 } else {
31322 // E = C + D
31323 var e = c.redAdd(d);
31324 // H = (c * Z1)^2
31325 var h = this.curve._mulC(this.c.redMul(this.z)).redSqr();
31326 // J = E - 2 * H
31327 var j = e.redSub(h).redSub(h);
31328 // X3 = c * (B - E) * J
31329 nx = this.curve._mulC(b.redISub(e)).redMul(j);
31330 // Y3 = c * E * (C - D)
31331 ny = this.curve._mulC(e).redMul(c.redISub(d));
31332 // Z3 = E * J
31333 nz = e.redMul(j);
31334 }
31335 return this.curve.point(nx, ny, nz);
31336};
31337
31338Point.prototype.dbl = function dbl() {
31339 if (this.isInfinity())
31340 return this;
31341
31342 // Double in extended coordinates
31343 if (this.curve.extended)
31344 return this._extDbl();
31345 else
31346 return this._projDbl();
31347};
31348
31349Point.prototype._extAdd = function _extAdd(p) {
31350 // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
31351 // #addition-add-2008-hwcd-3
31352 // 8M
31353
31354 // A = (Y1 - X1) * (Y2 - X2)
31355 var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
31356 // B = (Y1 + X1) * (Y2 + X2)
31357 var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
31358 // C = T1 * k * T2
31359 var c = this.t.redMul(this.curve.dd).redMul(p.t);
31360 // D = Z1 * 2 * Z2
31361 var d = this.z.redMul(p.z.redAdd(p.z));
31362 // E = B - A
31363 var e = b.redSub(a);
31364 // F = D - C
31365 var f = d.redSub(c);
31366 // G = D + C
31367 var g = d.redAdd(c);
31368 // H = B + A
31369 var h = b.redAdd(a);
31370 // X3 = E * F
31371 var nx = e.redMul(f);
31372 // Y3 = G * H
31373 var ny = g.redMul(h);
31374 // T3 = E * H
31375 var nt = e.redMul(h);
31376 // Z3 = F * G
31377 var nz = f.redMul(g);
31378 return this.curve.point(nx, ny, nz, nt);
31379};
31380
31381Point.prototype._projAdd = function _projAdd(p) {
31382 // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
31383 // #addition-add-2008-bbjlp
31384 // #addition-add-2007-bl
31385 // 10M + 1S
31386
31387 // A = Z1 * Z2
31388 var a = this.z.redMul(p.z);
31389 // B = A^2
31390 var b = a.redSqr();
31391 // C = X1 * X2
31392 var c = this.x.redMul(p.x);
31393 // D = Y1 * Y2
31394 var d = this.y.redMul(p.y);
31395 // E = d * C * D
31396 var e = this.curve.d.redMul(c).redMul(d);
31397 // F = B - E
31398 var f = b.redSub(e);
31399 // G = B + E
31400 var g = b.redAdd(e);
31401 // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
31402 var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
31403 var nx = a.redMul(f).redMul(tmp);
31404 var ny;
31405 var nz;
31406 if (this.curve.twisted) {
31407 // Y3 = A * G * (D - a * C)
31408 ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
31409 // Z3 = F * G
31410 nz = f.redMul(g);
31411 } else {
31412 // Y3 = A * G * (D - C)
31413 ny = a.redMul(g).redMul(d.redSub(c));
31414 // Z3 = c * F * G
31415 nz = this.curve._mulC(f).redMul(g);
31416 }
31417 return this.curve.point(nx, ny, nz);
31418};
31419
31420Point.prototype.add = function add(p) {
31421 if (this.isInfinity())
31422 return p;
31423 if (p.isInfinity())
31424 return this;
31425
31426 if (this.curve.extended)
31427 return this._extAdd(p);
31428 else
31429 return this._projAdd(p);
31430};
31431
31432Point.prototype.mul = function mul(k) {
31433 if (this._hasDoubles(k))
31434 return this.curve._fixedNafMul(this, k);
31435 else
31436 return this.curve._wnafMul(this, k);
31437};
31438
31439Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
31440 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
31441};
31442
31443Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
31444 return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
31445};
31446
31447Point.prototype.normalize = function normalize() {
31448 if (this.zOne)
31449 return this;
31450
31451 // Normalize coordinates
31452 var zi = this.z.redInvm();
31453 this.x = this.x.redMul(zi);
31454 this.y = this.y.redMul(zi);
31455 if (this.t)
31456 this.t = this.t.redMul(zi);
31457 this.z = this.curve.one;
31458 this.zOne = true;
31459 return this;
31460};
31461
31462Point.prototype.neg = function neg() {
31463 return this.curve.point(this.x.redNeg(),
31464 this.y,
31465 this.z,
31466 this.t && this.t.redNeg());
31467};
31468
31469Point.prototype.getX = function getX() {
31470 this.normalize();
31471 return this.x.fromRed();
31472};
31473
31474Point.prototype.getY = function getY() {
31475 this.normalize();
31476 return this.y.fromRed();
31477};
31478
31479Point.prototype.eq = function eq(other) {
31480 return this === other ||
31481 this.getX().cmp(other.getX()) === 0 &&
31482 this.getY().cmp(other.getY()) === 0;
31483};
31484
31485Point.prototype.eqXToP = function eqXToP(x) {
31486 var rx = x.toRed(this.curve.red).redMul(this.z);
31487 if (this.x.cmp(rx) === 0)
31488 return true;
31489
31490 var xc = x.clone();
31491 var t = this.curve.redN.redMul(this.z);
31492 for (;;) {
31493 xc.iadd(this.curve.n);
31494 if (xc.cmp(this.curve.p) >= 0)
31495 return false;
31496
31497 rx.redIAdd(t);
31498 if (this.x.cmp(rx) === 0)
31499 return true;
31500 }
31501 return false;
31502};
31503
31504// Compatibility with BaseCurve
31505Point.prototype.toP = Point.prototype.normalize;
31506Point.prototype.mixedAdd = Point.prototype.add;
31507
31508},{"../../elliptic":39,"../curve":42,"bn.js":33,"inherits":63}],42:[function(require,module,exports){
31509'use strict';
31510
31511var curve = exports;
31512
31513curve.base = require('./base');
31514curve.short = require('./short');
31515curve.mont = require('./mont');
31516curve.edwards = require('./edwards');
31517
31518},{"./base":40,"./edwards":41,"./mont":43,"./short":44}],43:[function(require,module,exports){
31519'use strict';
31520
31521var curve = require('../curve');
31522var BN = require('bn.js');
31523var inherits = require('inherits');
31524var Base = curve.base;
31525
31526var elliptic = require('../../elliptic');
31527var utils = elliptic.utils;
31528
31529function MontCurve(conf) {
31530 Base.call(this, 'mont', conf);
31531
31532 this.a = new BN(conf.a, 16).toRed(this.red);
31533 this.b = new BN(conf.b, 16).toRed(this.red);
31534 this.i4 = new BN(4).toRed(this.red).redInvm();
31535 this.two = new BN(2).toRed(this.red);
31536 this.a24 = this.i4.redMul(this.a.redAdd(this.two));
31537}
31538inherits(MontCurve, Base);
31539module.exports = MontCurve;
31540
31541MontCurve.prototype.validate = function validate(point) {
31542 var x = point.normalize().x;
31543 var x2 = x.redSqr();
31544 var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
31545 var y = rhs.redSqrt();
31546
31547 return y.redSqr().cmp(rhs) === 0;
31548};
31549
31550function Point(curve, x, z) {
31551 Base.BasePoint.call(this, curve, 'projective');
31552 if (x === null && z === null) {
31553 this.x = this.curve.one;
31554 this.z = this.curve.zero;
31555 } else {
31556 this.x = new BN(x, 16);
31557 this.z = new BN(z, 16);
31558 if (!this.x.red)
31559 this.x = this.x.toRed(this.curve.red);
31560 if (!this.z.red)
31561 this.z = this.z.toRed(this.curve.red);
31562 }
31563}
31564inherits(Point, Base.BasePoint);
31565
31566MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
31567 return this.point(utils.toArray(bytes, enc), 1);
31568};
31569
31570MontCurve.prototype.point = function point(x, z) {
31571 return new Point(this, x, z);
31572};
31573
31574MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
31575 return Point.fromJSON(this, obj);
31576};
31577
31578Point.prototype.precompute = function precompute() {
31579 // No-op
31580};
31581
31582Point.prototype._encode = function _encode() {
31583 return this.getX().toArray('be', this.curve.p.byteLength());
31584};
31585
31586Point.fromJSON = function fromJSON(curve, obj) {
31587 return new Point(curve, obj[0], obj[1] || curve.one);
31588};
31589
31590Point.prototype.inspect = function inspect() {
31591 if (this.isInfinity())
31592 return '<EC Point Infinity>';
31593 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
31594 ' z: ' + this.z.fromRed().toString(16, 2) + '>';
31595};
31596
31597Point.prototype.isInfinity = function isInfinity() {
31598 // XXX This code assumes that zero is always zero in red
31599 return this.z.cmpn(0) === 0;
31600};
31601
31602Point.prototype.dbl = function dbl() {
31603 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
31604 // 2M + 2S + 4A
31605
31606 // A = X1 + Z1
31607 var a = this.x.redAdd(this.z);
31608 // AA = A^2
31609 var aa = a.redSqr();
31610 // B = X1 - Z1
31611 var b = this.x.redSub(this.z);
31612 // BB = B^2
31613 var bb = b.redSqr();
31614 // C = AA - BB
31615 var c = aa.redSub(bb);
31616 // X3 = AA * BB
31617 var nx = aa.redMul(bb);
31618 // Z3 = C * (BB + A24 * C)
31619 var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
31620 return this.curve.point(nx, nz);
31621};
31622
31623Point.prototype.add = function add() {
31624 throw new Error('Not supported on Montgomery curve');
31625};
31626
31627Point.prototype.diffAdd = function diffAdd(p, diff) {
31628 // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
31629 // 4M + 2S + 6A
31630
31631 // A = X2 + Z2
31632 var a = this.x.redAdd(this.z);
31633 // B = X2 - Z2
31634 var b = this.x.redSub(this.z);
31635 // C = X3 + Z3
31636 var c = p.x.redAdd(p.z);
31637 // D = X3 - Z3
31638 var d = p.x.redSub(p.z);
31639 // DA = D * A
31640 var da = d.redMul(a);
31641 // CB = C * B
31642 var cb = c.redMul(b);
31643 // X5 = Z1 * (DA + CB)^2
31644 var nx = diff.z.redMul(da.redAdd(cb).redSqr());
31645 // Z5 = X1 * (DA - CB)^2
31646 var nz = diff.x.redMul(da.redISub(cb).redSqr());
31647 return this.curve.point(nx, nz);
31648};
31649
31650Point.prototype.mul = function mul(k) {
31651 var t = k.clone();
31652 var a = this; // (N / 2) * Q + Q
31653 var b = this.curve.point(null, null); // (N / 2) * Q
31654 var c = this; // Q
31655
31656 for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
31657 bits.push(t.andln(1));
31658
31659 for (var i = bits.length - 1; i >= 0; i--) {
31660 if (bits[i] === 0) {
31661 // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
31662 a = a.diffAdd(b, c);
31663 // N * Q = 2 * ((N / 2) * Q + Q))
31664 b = b.dbl();
31665 } else {
31666 // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
31667 b = a.diffAdd(b, c);
31668 // N * Q + Q = 2 * ((N / 2) * Q + Q)
31669 a = a.dbl();
31670 }
31671 }
31672 return b;
31673};
31674
31675Point.prototype.mulAdd = function mulAdd() {
31676 throw new Error('Not supported on Montgomery curve');
31677};
31678
31679Point.prototype.jumlAdd = function jumlAdd() {
31680 throw new Error('Not supported on Montgomery curve');
31681};
31682
31683Point.prototype.eq = function eq(other) {
31684 return this.getX().cmp(other.getX()) === 0;
31685};
31686
31687Point.prototype.normalize = function normalize() {
31688 this.x = this.x.redMul(this.z.redInvm());
31689 this.z = this.curve.one;
31690 return this;
31691};
31692
31693Point.prototype.getX = function getX() {
31694 // Normalize coordinates
31695 this.normalize();
31696
31697 return this.x.fromRed();
31698};
31699
31700},{"../../elliptic":39,"../curve":42,"bn.js":33,"inherits":63}],44:[function(require,module,exports){
31701'use strict';
31702
31703var curve = require('../curve');
31704var elliptic = require('../../elliptic');
31705var BN = require('bn.js');
31706var inherits = require('inherits');
31707var Base = curve.base;
31708
31709var assert = elliptic.utils.assert;
31710
31711function ShortCurve(conf) {
31712 Base.call(this, 'short', conf);
31713
31714 this.a = new BN(conf.a, 16).toRed(this.red);
31715 this.b = new BN(conf.b, 16).toRed(this.red);
31716 this.tinv = this.two.redInvm();
31717
31718 this.zeroA = this.a.fromRed().cmpn(0) === 0;
31719 this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
31720
31721 // If the curve is endomorphic, precalculate beta and lambda
31722 this.endo = this._getEndomorphism(conf);
31723 this._endoWnafT1 = new Array(4);
31724 this._endoWnafT2 = new Array(4);
31725}
31726inherits(ShortCurve, Base);
31727module.exports = ShortCurve;
31728
31729ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
31730 // No efficient endomorphism
31731 if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
31732 return;
31733
31734 // Compute beta and lambda, that lambda * P = (beta * Px; Py)
31735 var beta;
31736 var lambda;
31737 if (conf.beta) {
31738 beta = new BN(conf.beta, 16).toRed(this.red);
31739 } else {
31740 var betas = this._getEndoRoots(this.p);
31741 // Choose the smallest beta
31742 beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
31743 beta = beta.toRed(this.red);
31744 }
31745 if (conf.lambda) {
31746 lambda = new BN(conf.lambda, 16);
31747 } else {
31748 // Choose the lambda that is matching selected beta
31749 var lambdas = this._getEndoRoots(this.n);
31750 if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
31751 lambda = lambdas[0];
31752 } else {
31753 lambda = lambdas[1];
31754 assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
31755 }
31756 }
31757
31758 // Get basis vectors, used for balanced length-two representation
31759 var basis;
31760 if (conf.basis) {
31761 basis = conf.basis.map(function(vec) {
31762 return {
31763 a: new BN(vec.a, 16),
31764 b: new BN(vec.b, 16)
31765 };
31766 });
31767 } else {
31768 basis = this._getEndoBasis(lambda);
31769 }
31770
31771 return {
31772 beta: beta,
31773 lambda: lambda,
31774 basis: basis
31775 };
31776};
31777
31778ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
31779 // Find roots of for x^2 + x + 1 in F
31780 // Root = (-1 +- Sqrt(-3)) / 2
31781 //
31782 var red = num === this.p ? this.red : BN.mont(num);
31783 var tinv = new BN(2).toRed(red).redInvm();
31784 var ntinv = tinv.redNeg();
31785
31786 var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
31787
31788 var l1 = ntinv.redAdd(s).fromRed();
31789 var l2 = ntinv.redSub(s).fromRed();
31790 return [ l1, l2 ];
31791};
31792
31793ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
31794 // aprxSqrt >= sqrt(this.n)
31795 var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
31796
31797 // 3.74
31798 // Run EGCD, until r(L + 1) < aprxSqrt
31799 var u = lambda;
31800 var v = this.n.clone();
31801 var x1 = new BN(1);
31802 var y1 = new BN(0);
31803 var x2 = new BN(0);
31804 var y2 = new BN(1);
31805
31806 // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
31807 var a0;
31808 var b0;
31809 // First vector
31810 var a1;
31811 var b1;
31812 // Second vector
31813 var a2;
31814 var b2;
31815
31816 var prevR;
31817 var i = 0;
31818 var r;
31819 var x;
31820 while (u.cmpn(0) !== 0) {
31821 var q = v.div(u);
31822 r = v.sub(q.mul(u));
31823 x = x2.sub(q.mul(x1));
31824 var y = y2.sub(q.mul(y1));
31825
31826 if (!a1 && r.cmp(aprxSqrt) < 0) {
31827 a0 = prevR.neg();
31828 b0 = x1;
31829 a1 = r.neg();
31830 b1 = x;
31831 } else if (a1 && ++i === 2) {
31832 break;
31833 }
31834 prevR = r;
31835
31836 v = u;
31837 u = r;
31838 x2 = x1;
31839 x1 = x;
31840 y2 = y1;
31841 y1 = y;
31842 }
31843 a2 = r.neg();
31844 b2 = x;
31845
31846 var len1 = a1.sqr().add(b1.sqr());
31847 var len2 = a2.sqr().add(b2.sqr());
31848 if (len2.cmp(len1) >= 0) {
31849 a2 = a0;
31850 b2 = b0;
31851 }
31852
31853 // Normalize signs
31854 if (a1.negative) {
31855 a1 = a1.neg();
31856 b1 = b1.neg();
31857 }
31858 if (a2.negative) {
31859 a2 = a2.neg();
31860 b2 = b2.neg();
31861 }
31862
31863 return [
31864 { a: a1, b: b1 },
31865 { a: a2, b: b2 }
31866 ];
31867};
31868
31869ShortCurve.prototype._endoSplit = function _endoSplit(k) {
31870 var basis = this.endo.basis;
31871 var v1 = basis[0];
31872 var v2 = basis[1];
31873
31874 var c1 = v2.b.mul(k).divRound(this.n);
31875 var c2 = v1.b.neg().mul(k).divRound(this.n);
31876
31877 var p1 = c1.mul(v1.a);
31878 var p2 = c2.mul(v2.a);
31879 var q1 = c1.mul(v1.b);
31880 var q2 = c2.mul(v2.b);
31881
31882 // Calculate answer
31883 var k1 = k.sub(p1).sub(p2);
31884 var k2 = q1.add(q2).neg();
31885 return { k1: k1, k2: k2 };
31886};
31887
31888ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
31889 x = new BN(x, 16);
31890 if (!x.red)
31891 x = x.toRed(this.red);
31892
31893 var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
31894 var y = y2.redSqrt();
31895 if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
31896 throw new Error('invalid point');
31897
31898 // XXX Is there any way to tell if the number is odd without converting it
31899 // to non-red form?
31900 var isOdd = y.fromRed().isOdd();
31901 if (odd && !isOdd || !odd && isOdd)
31902 y = y.redNeg();
31903
31904 return this.point(x, y);
31905};
31906
31907ShortCurve.prototype.validate = function validate(point) {
31908 if (point.inf)
31909 return true;
31910
31911 var x = point.x;
31912 var y = point.y;
31913
31914 var ax = this.a.redMul(x);
31915 var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
31916 return y.redSqr().redISub(rhs).cmpn(0) === 0;
31917};
31918
31919ShortCurve.prototype._endoWnafMulAdd =
31920 function _endoWnafMulAdd(points, coeffs, jacobianResult) {
31921 var npoints = this._endoWnafT1;
31922 var ncoeffs = this._endoWnafT2;
31923 for (var i = 0; i < points.length; i++) {
31924 var split = this._endoSplit(coeffs[i]);
31925 var p = points[i];
31926 var beta = p._getBeta();
31927
31928 if (split.k1.negative) {
31929 split.k1.ineg();
31930 p = p.neg(true);
31931 }
31932 if (split.k2.negative) {
31933 split.k2.ineg();
31934 beta = beta.neg(true);
31935 }
31936
31937 npoints[i * 2] = p;
31938 npoints[i * 2 + 1] = beta;
31939 ncoeffs[i * 2] = split.k1;
31940 ncoeffs[i * 2 + 1] = split.k2;
31941 }
31942 var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
31943
31944 // Clean-up references to points and coefficients
31945 for (var j = 0; j < i * 2; j++) {
31946 npoints[j] = null;
31947 ncoeffs[j] = null;
31948 }
31949 return res;
31950};
31951
31952function Point(curve, x, y, isRed) {
31953 Base.BasePoint.call(this, curve, 'affine');
31954 if (x === null && y === null) {
31955 this.x = null;
31956 this.y = null;
31957 this.inf = true;
31958 } else {
31959 this.x = new BN(x, 16);
31960 this.y = new BN(y, 16);
31961 // Force redgomery representation when loading from JSON
31962 if (isRed) {
31963 this.x.forceRed(this.curve.red);
31964 this.y.forceRed(this.curve.red);
31965 }
31966 if (!this.x.red)
31967 this.x = this.x.toRed(this.curve.red);
31968 if (!this.y.red)
31969 this.y = this.y.toRed(this.curve.red);
31970 this.inf = false;
31971 }
31972}
31973inherits(Point, Base.BasePoint);
31974
31975ShortCurve.prototype.point = function point(x, y, isRed) {
31976 return new Point(this, x, y, isRed);
31977};
31978
31979ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
31980 return Point.fromJSON(this, obj, red);
31981};
31982
31983Point.prototype._getBeta = function _getBeta() {
31984 if (!this.curve.endo)
31985 return;
31986
31987 var pre = this.precomputed;
31988 if (pre && pre.beta)
31989 return pre.beta;
31990
31991 var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
31992 if (pre) {
31993 var curve = this.curve;
31994 var endoMul = function(p) {
31995 return curve.point(p.x.redMul(curve.endo.beta), p.y);
31996 };
31997 pre.beta = beta;
31998 beta.precomputed = {
31999 beta: null,
32000 naf: pre.naf && {
32001 wnd: pre.naf.wnd,
32002 points: pre.naf.points.map(endoMul)
32003 },
32004 doubles: pre.doubles && {
32005 step: pre.doubles.step,
32006 points: pre.doubles.points.map(endoMul)
32007 }
32008 };
32009 }
32010 return beta;
32011};
32012
32013Point.prototype.toJSON = function toJSON() {
32014 if (!this.precomputed)
32015 return [ this.x, this.y ];
32016
32017 return [ this.x, this.y, this.precomputed && {
32018 doubles: this.precomputed.doubles && {
32019 step: this.precomputed.doubles.step,
32020 points: this.precomputed.doubles.points.slice(1)
32021 },
32022 naf: this.precomputed.naf && {
32023 wnd: this.precomputed.naf.wnd,
32024 points: this.precomputed.naf.points.slice(1)
32025 }
32026 } ];
32027};
32028
32029Point.fromJSON = function fromJSON(curve, obj, red) {
32030 if (typeof obj === 'string')
32031 obj = JSON.parse(obj);
32032 var res = curve.point(obj[0], obj[1], red);
32033 if (!obj[2])
32034 return res;
32035
32036 function obj2point(obj) {
32037 return curve.point(obj[0], obj[1], red);
32038 }
32039
32040 var pre = obj[2];
32041 res.precomputed = {
32042 beta: null,
32043 doubles: pre.doubles && {
32044 step: pre.doubles.step,
32045 points: [ res ].concat(pre.doubles.points.map(obj2point))
32046 },
32047 naf: pre.naf && {
32048 wnd: pre.naf.wnd,
32049 points: [ res ].concat(pre.naf.points.map(obj2point))
32050 }
32051 };
32052 return res;
32053};
32054
32055Point.prototype.inspect = function inspect() {
32056 if (this.isInfinity())
32057 return '<EC Point Infinity>';
32058 return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
32059 ' y: ' + this.y.fromRed().toString(16, 2) + '>';
32060};
32061
32062Point.prototype.isInfinity = function isInfinity() {
32063 return this.inf;
32064};
32065
32066Point.prototype.add = function add(p) {
32067 // O + P = P
32068 if (this.inf)
32069 return p;
32070
32071 // P + O = P
32072 if (p.inf)
32073 return this;
32074
32075 // P + P = 2P
32076 if (this.eq(p))
32077 return this.dbl();
32078
32079 // P + (-P) = O
32080 if (this.neg().eq(p))
32081 return this.curve.point(null, null);
32082
32083 // P + Q = O
32084 if (this.x.cmp(p.x) === 0)
32085 return this.curve.point(null, null);
32086
32087 var c = this.y.redSub(p.y);
32088 if (c.cmpn(0) !== 0)
32089 c = c.redMul(this.x.redSub(p.x).redInvm());
32090 var nx = c.redSqr().redISub(this.x).redISub(p.x);
32091 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
32092 return this.curve.point(nx, ny);
32093};
32094
32095Point.prototype.dbl = function dbl() {
32096 if (this.inf)
32097 return this;
32098
32099 // 2P = O
32100 var ys1 = this.y.redAdd(this.y);
32101 if (ys1.cmpn(0) === 0)
32102 return this.curve.point(null, null);
32103
32104 var a = this.curve.a;
32105
32106 var x2 = this.x.redSqr();
32107 var dyinv = ys1.redInvm();
32108 var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
32109
32110 var nx = c.redSqr().redISub(this.x.redAdd(this.x));
32111 var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
32112 return this.curve.point(nx, ny);
32113};
32114
32115Point.prototype.getX = function getX() {
32116 return this.x.fromRed();
32117};
32118
32119Point.prototype.getY = function getY() {
32120 return this.y.fromRed();
32121};
32122
32123Point.prototype.mul = function mul(k) {
32124 k = new BN(k, 16);
32125
32126 if (this._hasDoubles(k))
32127 return this.curve._fixedNafMul(this, k);
32128 else if (this.curve.endo)
32129 return this.curve._endoWnafMulAdd([ this ], [ k ]);
32130 else
32131 return this.curve._wnafMul(this, k);
32132};
32133
32134Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
32135 var points = [ this, p2 ];
32136 var coeffs = [ k1, k2 ];
32137 if (this.curve.endo)
32138 return this.curve._endoWnafMulAdd(points, coeffs);
32139 else
32140 return this.curve._wnafMulAdd(1, points, coeffs, 2);
32141};
32142
32143Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
32144 var points = [ this, p2 ];
32145 var coeffs = [ k1, k2 ];
32146 if (this.curve.endo)
32147 return this.curve._endoWnafMulAdd(points, coeffs, true);
32148 else
32149 return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
32150};
32151
32152Point.prototype.eq = function eq(p) {
32153 return this === p ||
32154 this.inf === p.inf &&
32155 (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
32156};
32157
32158Point.prototype.neg = function neg(_precompute) {
32159 if (this.inf)
32160 return this;
32161
32162 var res = this.curve.point(this.x, this.y.redNeg());
32163 if (_precompute && this.precomputed) {
32164 var pre = this.precomputed;
32165 var negate = function(p) {
32166 return p.neg();
32167 };
32168 res.precomputed = {
32169 naf: pre.naf && {
32170 wnd: pre.naf.wnd,
32171 points: pre.naf.points.map(negate)
32172 },
32173 doubles: pre.doubles && {
32174 step: pre.doubles.step,
32175 points: pre.doubles.points.map(negate)
32176 }
32177 };
32178 }
32179 return res;
32180};
32181
32182Point.prototype.toJ = function toJ() {
32183 if (this.inf)
32184 return this.curve.jpoint(null, null, null);
32185
32186 var res = this.curve.jpoint(this.x, this.y, this.curve.one);
32187 return res;
32188};
32189
32190function JPoint(curve, x, y, z) {
32191 Base.BasePoint.call(this, curve, 'jacobian');
32192 if (x === null && y === null && z === null) {
32193 this.x = this.curve.one;
32194 this.y = this.curve.one;
32195 this.z = new BN(0);
32196 } else {
32197 this.x = new BN(x, 16);
32198 this.y = new BN(y, 16);
32199 this.z = new BN(z, 16);
32200 }
32201 if (!this.x.red)
32202 this.x = this.x.toRed(this.curve.red);
32203 if (!this.y.red)
32204 this.y = this.y.toRed(this.curve.red);
32205 if (!this.z.red)
32206 this.z = this.z.toRed(this.curve.red);
32207
32208 this.zOne = this.z === this.curve.one;
32209}
32210inherits(JPoint, Base.BasePoint);
32211
32212ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
32213 return new JPoint(this, x, y, z);
32214};
32215
32216JPoint.prototype.toP = function toP() {
32217 if (this.isInfinity())
32218 return this.curve.point(null, null);
32219
32220 var zinv = this.z.redInvm();
32221 var zinv2 = zinv.redSqr();
32222 var ax = this.x.redMul(zinv2);
32223 var ay = this.y.redMul(zinv2).redMul(zinv);
32224
32225 return this.curve.point(ax, ay);
32226};
32227
32228JPoint.prototype.neg = function neg() {
32229 return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
32230};
32231
32232JPoint.prototype.add = function add(p) {
32233 // O + P = P
32234 if (this.isInfinity())
32235 return p;
32236
32237 // P + O = P
32238 if (p.isInfinity())
32239 return this;
32240
32241 // 12M + 4S + 7A
32242 var pz2 = p.z.redSqr();
32243 var z2 = this.z.redSqr();
32244 var u1 = this.x.redMul(pz2);
32245 var u2 = p.x.redMul(z2);
32246 var s1 = this.y.redMul(pz2.redMul(p.z));
32247 var s2 = p.y.redMul(z2.redMul(this.z));
32248
32249 var h = u1.redSub(u2);
32250 var r = s1.redSub(s2);
32251 if (h.cmpn(0) === 0) {
32252 if (r.cmpn(0) !== 0)
32253 return this.curve.jpoint(null, null, null);
32254 else
32255 return this.dbl();
32256 }
32257
32258 var h2 = h.redSqr();
32259 var h3 = h2.redMul(h);
32260 var v = u1.redMul(h2);
32261
32262 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
32263 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
32264 var nz = this.z.redMul(p.z).redMul(h);
32265
32266 return this.curve.jpoint(nx, ny, nz);
32267};
32268
32269JPoint.prototype.mixedAdd = function mixedAdd(p) {
32270 // O + P = P
32271 if (this.isInfinity())
32272 return p.toJ();
32273
32274 // P + O = P
32275 if (p.isInfinity())
32276 return this;
32277
32278 // 8M + 3S + 7A
32279 var z2 = this.z.redSqr();
32280 var u1 = this.x;
32281 var u2 = p.x.redMul(z2);
32282 var s1 = this.y;
32283 var s2 = p.y.redMul(z2).redMul(this.z);
32284
32285 var h = u1.redSub(u2);
32286 var r = s1.redSub(s2);
32287 if (h.cmpn(0) === 0) {
32288 if (r.cmpn(0) !== 0)
32289 return this.curve.jpoint(null, null, null);
32290 else
32291 return this.dbl();
32292 }
32293
32294 var h2 = h.redSqr();
32295 var h3 = h2.redMul(h);
32296 var v = u1.redMul(h2);
32297
32298 var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
32299 var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
32300 var nz = this.z.redMul(h);
32301
32302 return this.curve.jpoint(nx, ny, nz);
32303};
32304
32305JPoint.prototype.dblp = function dblp(pow) {
32306 if (pow === 0)
32307 return this;
32308 if (this.isInfinity())
32309 return this;
32310 if (!pow)
32311 return this.dbl();
32312
32313 if (this.curve.zeroA || this.curve.threeA) {
32314 var r = this;
32315 for (var i = 0; i < pow; i++)
32316 r = r.dbl();
32317 return r;
32318 }
32319
32320 // 1M + 2S + 1A + N * (4S + 5M + 8A)
32321 // N = 1 => 6M + 6S + 9A
32322 var a = this.curve.a;
32323 var tinv = this.curve.tinv;
32324
32325 var jx = this.x;
32326 var jy = this.y;
32327 var jz = this.z;
32328 var jz4 = jz.redSqr().redSqr();
32329
32330 // Reuse results
32331 var jyd = jy.redAdd(jy);
32332 for (var i = 0; i < pow; i++) {
32333 var jx2 = jx.redSqr();
32334 var jyd2 = jyd.redSqr();
32335 var jyd4 = jyd2.redSqr();
32336 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
32337
32338 var t1 = jx.redMul(jyd2);
32339 var nx = c.redSqr().redISub(t1.redAdd(t1));
32340 var t2 = t1.redISub(nx);
32341 var dny = c.redMul(t2);
32342 dny = dny.redIAdd(dny).redISub(jyd4);
32343 var nz = jyd.redMul(jz);
32344 if (i + 1 < pow)
32345 jz4 = jz4.redMul(jyd4);
32346
32347 jx = nx;
32348 jz = nz;
32349 jyd = dny;
32350 }
32351
32352 return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
32353};
32354
32355JPoint.prototype.dbl = function dbl() {
32356 if (this.isInfinity())
32357 return this;
32358
32359 if (this.curve.zeroA)
32360 return this._zeroDbl();
32361 else if (this.curve.threeA)
32362 return this._threeDbl();
32363 else
32364 return this._dbl();
32365};
32366
32367JPoint.prototype._zeroDbl = function _zeroDbl() {
32368 var nx;
32369 var ny;
32370 var nz;
32371 // Z = 1
32372 if (this.zOne) {
32373 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
32374 // #doubling-mdbl-2007-bl
32375 // 1M + 5S + 14A
32376
32377 // XX = X1^2
32378 var xx = this.x.redSqr();
32379 // YY = Y1^2
32380 var yy = this.y.redSqr();
32381 // YYYY = YY^2
32382 var yyyy = yy.redSqr();
32383 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
32384 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
32385 s = s.redIAdd(s);
32386 // M = 3 * XX + a; a = 0
32387 var m = xx.redAdd(xx).redIAdd(xx);
32388 // T = M ^ 2 - 2*S
32389 var t = m.redSqr().redISub(s).redISub(s);
32390
32391 // 8 * YYYY
32392 var yyyy8 = yyyy.redIAdd(yyyy);
32393 yyyy8 = yyyy8.redIAdd(yyyy8);
32394 yyyy8 = yyyy8.redIAdd(yyyy8);
32395
32396 // X3 = T
32397 nx = t;
32398 // Y3 = M * (S - T) - 8 * YYYY
32399 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
32400 // Z3 = 2*Y1
32401 nz = this.y.redAdd(this.y);
32402 } else {
32403 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
32404 // #doubling-dbl-2009-l
32405 // 2M + 5S + 13A
32406
32407 // A = X1^2
32408 var a = this.x.redSqr();
32409 // B = Y1^2
32410 var b = this.y.redSqr();
32411 // C = B^2
32412 var c = b.redSqr();
32413 // D = 2 * ((X1 + B)^2 - A - C)
32414 var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
32415 d = d.redIAdd(d);
32416 // E = 3 * A
32417 var e = a.redAdd(a).redIAdd(a);
32418 // F = E^2
32419 var f = e.redSqr();
32420
32421 // 8 * C
32422 var c8 = c.redIAdd(c);
32423 c8 = c8.redIAdd(c8);
32424 c8 = c8.redIAdd(c8);
32425
32426 // X3 = F - 2 * D
32427 nx = f.redISub(d).redISub(d);
32428 // Y3 = E * (D - X3) - 8 * C
32429 ny = e.redMul(d.redISub(nx)).redISub(c8);
32430 // Z3 = 2 * Y1 * Z1
32431 nz = this.y.redMul(this.z);
32432 nz = nz.redIAdd(nz);
32433 }
32434
32435 return this.curve.jpoint(nx, ny, nz);
32436};
32437
32438JPoint.prototype._threeDbl = function _threeDbl() {
32439 var nx;
32440 var ny;
32441 var nz;
32442 // Z = 1
32443 if (this.zOne) {
32444 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
32445 // #doubling-mdbl-2007-bl
32446 // 1M + 5S + 15A
32447
32448 // XX = X1^2
32449 var xx = this.x.redSqr();
32450 // YY = Y1^2
32451 var yy = this.y.redSqr();
32452 // YYYY = YY^2
32453 var yyyy = yy.redSqr();
32454 // S = 2 * ((X1 + YY)^2 - XX - YYYY)
32455 var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
32456 s = s.redIAdd(s);
32457 // M = 3 * XX + a
32458 var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
32459 // T = M^2 - 2 * S
32460 var t = m.redSqr().redISub(s).redISub(s);
32461 // X3 = T
32462 nx = t;
32463 // Y3 = M * (S - T) - 8 * YYYY
32464 var yyyy8 = yyyy.redIAdd(yyyy);
32465 yyyy8 = yyyy8.redIAdd(yyyy8);
32466 yyyy8 = yyyy8.redIAdd(yyyy8);
32467 ny = m.redMul(s.redISub(t)).redISub(yyyy8);
32468 // Z3 = 2 * Y1
32469 nz = this.y.redAdd(this.y);
32470 } else {
32471 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
32472 // 3M + 5S
32473
32474 // delta = Z1^2
32475 var delta = this.z.redSqr();
32476 // gamma = Y1^2
32477 var gamma = this.y.redSqr();
32478 // beta = X1 * gamma
32479 var beta = this.x.redMul(gamma);
32480 // alpha = 3 * (X1 - delta) * (X1 + delta)
32481 var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
32482 alpha = alpha.redAdd(alpha).redIAdd(alpha);
32483 // X3 = alpha^2 - 8 * beta
32484 var beta4 = beta.redIAdd(beta);
32485 beta4 = beta4.redIAdd(beta4);
32486 var beta8 = beta4.redAdd(beta4);
32487 nx = alpha.redSqr().redISub(beta8);
32488 // Z3 = (Y1 + Z1)^2 - gamma - delta
32489 nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
32490 // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
32491 var ggamma8 = gamma.redSqr();
32492 ggamma8 = ggamma8.redIAdd(ggamma8);
32493 ggamma8 = ggamma8.redIAdd(ggamma8);
32494 ggamma8 = ggamma8.redIAdd(ggamma8);
32495 ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
32496 }
32497
32498 return this.curve.jpoint(nx, ny, nz);
32499};
32500
32501JPoint.prototype._dbl = function _dbl() {
32502 var a = this.curve.a;
32503
32504 // 4M + 6S + 10A
32505 var jx = this.x;
32506 var jy = this.y;
32507 var jz = this.z;
32508 var jz4 = jz.redSqr().redSqr();
32509
32510 var jx2 = jx.redSqr();
32511 var jy2 = jy.redSqr();
32512
32513 var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
32514
32515 var jxd4 = jx.redAdd(jx);
32516 jxd4 = jxd4.redIAdd(jxd4);
32517 var t1 = jxd4.redMul(jy2);
32518 var nx = c.redSqr().redISub(t1.redAdd(t1));
32519 var t2 = t1.redISub(nx);
32520
32521 var jyd8 = jy2.redSqr();
32522 jyd8 = jyd8.redIAdd(jyd8);
32523 jyd8 = jyd8.redIAdd(jyd8);
32524 jyd8 = jyd8.redIAdd(jyd8);
32525 var ny = c.redMul(t2).redISub(jyd8);
32526 var nz = jy.redAdd(jy).redMul(jz);
32527
32528 return this.curve.jpoint(nx, ny, nz);
32529};
32530
32531JPoint.prototype.trpl = function trpl() {
32532 if (!this.curve.zeroA)
32533 return this.dbl().add(this);
32534
32535 // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
32536 // 5M + 10S + ...
32537
32538 // XX = X1^2
32539 var xx = this.x.redSqr();
32540 // YY = Y1^2
32541 var yy = this.y.redSqr();
32542 // ZZ = Z1^2
32543 var zz = this.z.redSqr();
32544 // YYYY = YY^2
32545 var yyyy = yy.redSqr();
32546 // M = 3 * XX + a * ZZ2; a = 0
32547 var m = xx.redAdd(xx).redIAdd(xx);
32548 // MM = M^2
32549 var mm = m.redSqr();
32550 // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
32551 var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
32552 e = e.redIAdd(e);
32553 e = e.redAdd(e).redIAdd(e);
32554 e = e.redISub(mm);
32555 // EE = E^2
32556 var ee = e.redSqr();
32557 // T = 16*YYYY
32558 var t = yyyy.redIAdd(yyyy);
32559 t = t.redIAdd(t);
32560 t = t.redIAdd(t);
32561 t = t.redIAdd(t);
32562 // U = (M + E)^2 - MM - EE - T
32563 var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
32564 // X3 = 4 * (X1 * EE - 4 * YY * U)
32565 var yyu4 = yy.redMul(u);
32566 yyu4 = yyu4.redIAdd(yyu4);
32567 yyu4 = yyu4.redIAdd(yyu4);
32568 var nx = this.x.redMul(ee).redISub(yyu4);
32569 nx = nx.redIAdd(nx);
32570 nx = nx.redIAdd(nx);
32571 // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
32572 var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
32573 ny = ny.redIAdd(ny);
32574 ny = ny.redIAdd(ny);
32575 ny = ny.redIAdd(ny);
32576 // Z3 = (Z1 + E)^2 - ZZ - EE
32577 var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
32578
32579 return this.curve.jpoint(nx, ny, nz);
32580};
32581
32582JPoint.prototype.mul = function mul(k, kbase) {
32583 k = new BN(k, kbase);
32584
32585 return this.curve._wnafMul(this, k);
32586};
32587
32588JPoint.prototype.eq = function eq(p) {
32589 if (p.type === 'affine')
32590 return this.eq(p.toJ());
32591
32592 if (this === p)
32593 return true;
32594
32595 // x1 * z2^2 == x2 * z1^2
32596 var z2 = this.z.redSqr();
32597 var pz2 = p.z.redSqr();
32598 if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
32599 return false;
32600
32601 // y1 * z2^3 == y2 * z1^3
32602 var z3 = z2.redMul(this.z);
32603 var pz3 = pz2.redMul(p.z);
32604 return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
32605};
32606
32607JPoint.prototype.eqXToP = function eqXToP(x) {
32608 var zs = this.z.redSqr();
32609 var rx = x.toRed(this.curve.red).redMul(zs);
32610 if (this.x.cmp(rx) === 0)
32611 return true;
32612
32613 var xc = x.clone();
32614 var t = this.curve.redN.redMul(zs);
32615 for (;;) {
32616 xc.iadd(this.curve.n);
32617 if (xc.cmp(this.curve.p) >= 0)
32618 return false;
32619
32620 rx.redIAdd(t);
32621 if (this.x.cmp(rx) === 0)
32622 return true;
32623 }
32624 return false;
32625};
32626
32627JPoint.prototype.inspect = function inspect() {
32628 if (this.isInfinity())
32629 return '<EC JPoint Infinity>';
32630 return '<EC JPoint x: ' + this.x.toString(16, 2) +
32631 ' y: ' + this.y.toString(16, 2) +
32632 ' z: ' + this.z.toString(16, 2) + '>';
32633};
32634
32635JPoint.prototype.isInfinity = function isInfinity() {
32636 // XXX This code assumes that zero is always zero in red
32637 return this.z.cmpn(0) === 0;
32638};
32639
32640},{"../../elliptic":39,"../curve":42,"bn.js":33,"inherits":63}],45:[function(require,module,exports){
32641'use strict';
32642
32643var curves = exports;
32644
32645var hash = require('hash.js');
32646var elliptic = require('../elliptic');
32647
32648var assert = elliptic.utils.assert;
32649
32650function PresetCurve(options) {
32651 if (options.type === 'short')
32652 this.curve = new elliptic.curve.short(options);
32653 else if (options.type === 'edwards')
32654 this.curve = new elliptic.curve.edwards(options);
32655 else
32656 this.curve = new elliptic.curve.mont(options);
32657 this.g = this.curve.g;
32658 this.n = this.curve.n;
32659 this.hash = options.hash;
32660
32661 assert(this.g.validate(), 'Invalid curve');
32662 assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
32663}
32664curves.PresetCurve = PresetCurve;
32665
32666function defineCurve(name, options) {
32667 Object.defineProperty(curves, name, {
32668 configurable: true,
32669 enumerable: true,
32670 get: function() {
32671 var curve = new PresetCurve(options);
32672 Object.defineProperty(curves, name, {
32673 configurable: true,
32674 enumerable: true,
32675 value: curve
32676 });
32677 return curve;
32678 }
32679 });
32680}
32681
32682defineCurve('p192', {
32683 type: 'short',
32684 prime: 'p192',
32685 p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
32686 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
32687 b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
32688 n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
32689 hash: hash.sha256,
32690 gRed: false,
32691 g: [
32692 '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
32693 '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
32694 ]
32695});
32696
32697defineCurve('p224', {
32698 type: 'short',
32699 prime: 'p224',
32700 p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
32701 a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
32702 b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
32703 n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
32704 hash: hash.sha256,
32705 gRed: false,
32706 g: [
32707 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
32708 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
32709 ]
32710});
32711
32712defineCurve('p256', {
32713 type: 'short',
32714 prime: null,
32715 p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
32716 a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
32717 b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
32718 n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
32719 hash: hash.sha256,
32720 gRed: false,
32721 g: [
32722 '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
32723 '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
32724 ]
32725});
32726
32727defineCurve('p384', {
32728 type: 'short',
32729 prime: null,
32730 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
32731 'fffffffe ffffffff 00000000 00000000 ffffffff',
32732 a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
32733 'fffffffe ffffffff 00000000 00000000 fffffffc',
32734 b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
32735 '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
32736 n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
32737 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
32738 hash: hash.sha384,
32739 gRed: false,
32740 g: [
32741 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
32742 '5502f25d bf55296c 3a545e38 72760ab7',
32743 '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
32744 '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
32745 ]
32746});
32747
32748defineCurve('p521', {
32749 type: 'short',
32750 prime: null,
32751 p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
32752 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
32753 'ffffffff ffffffff ffffffff ffffffff ffffffff',
32754 a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
32755 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
32756 'ffffffff ffffffff ffffffff ffffffff fffffffc',
32757 b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
32758 '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
32759 '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
32760 n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
32761 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
32762 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
32763 hash: hash.sha512,
32764 gRed: false,
32765 g: [
32766 '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
32767 '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
32768 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
32769 '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
32770 '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
32771 '3fad0761 353c7086 a272c240 88be9476 9fd16650'
32772 ]
32773});
32774
32775defineCurve('curve25519', {
32776 type: 'mont',
32777 prime: 'p25519',
32778 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
32779 a: '76d06',
32780 b: '1',
32781 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
32782 hash: hash.sha256,
32783 gRed: false,
32784 g: [
32785 '9'
32786 ]
32787});
32788
32789defineCurve('ed25519', {
32790 type: 'edwards',
32791 prime: 'p25519',
32792 p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
32793 a: '-1',
32794 c: '1',
32795 // -121665 * (121666^(-1)) (mod P)
32796 d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
32797 n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
32798 hash: hash.sha256,
32799 gRed: false,
32800 g: [
32801 '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
32802
32803 // 4/5
32804 '6666666666666666666666666666666666666666666666666666666666666658'
32805 ]
32806});
32807
32808var pre;
32809try {
32810 pre = require('./precomputed/secp256k1');
32811} catch (e) {
32812 pre = undefined;
32813}
32814
32815defineCurve('secp256k1', {
32816 type: 'short',
32817 prime: 'k256',
32818 p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
32819 a: '0',
32820 b: '7',
32821 n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
32822 h: '1',
32823 hash: hash.sha256,
32824
32825 // Precomputed endomorphism
32826 beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
32827 lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
32828 basis: [
32829 {
32830 a: '3086d221a7d46bcde86c90e49284eb15',
32831 b: '-e4437ed6010e88286f547fa90abfe4c3'
32832 },
32833 {
32834 a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
32835 b: '3086d221a7d46bcde86c90e49284eb15'
32836 }
32837 ],
32838
32839 gRed: false,
32840 g: [
32841 '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
32842 '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
32843 pre
32844 ]
32845});
32846
32847},{"../elliptic":39,"./precomputed/secp256k1":53,"hash.js":57}],46:[function(require,module,exports){
32848'use strict';
32849
32850var BN = require('bn.js');
32851var elliptic = require('../../elliptic');
32852var utils = elliptic.utils;
32853var assert = utils.assert;
32854
32855var KeyPair = require('./key');
32856var Signature = require('./signature');
32857
32858function EC(options) {
32859 if (!(this instanceof EC))
32860 return new EC(options);
32861
32862 // Shortcut `elliptic.ec(curve-name)`
32863 if (typeof options === 'string') {
32864 assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);
32865
32866 options = elliptic.curves[options];
32867 }
32868
32869 // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
32870 if (options instanceof elliptic.curves.PresetCurve)
32871 options = { curve: options };
32872
32873 this.curve = options.curve.curve;
32874 this.n = this.curve.n;
32875 this.nh = this.n.ushrn(1);
32876 this.g = this.curve.g;
32877
32878 // Point on curve
32879 this.g = options.curve.g;
32880 this.g.precompute(options.curve.n.bitLength() + 1);
32881
32882 // Hash for function for DRBG
32883 this.hash = options.hash || options.curve.hash;
32884}
32885module.exports = EC;
32886
32887EC.prototype.keyPair = function keyPair(options) {
32888 return new KeyPair(this, options);
32889};
32890
32891EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
32892 return KeyPair.fromPrivate(this, priv, enc);
32893};
32894
32895EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
32896 return KeyPair.fromPublic(this, pub, enc);
32897};
32898
32899EC.prototype.genKeyPair = function genKeyPair(options) {
32900 if (!options)
32901 options = {};
32902
32903 // Instantiate Hmac_DRBG
32904 var drbg = new elliptic.hmacDRBG({
32905 hash: this.hash,
32906 pers: options.pers,
32907 entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
32908 nonce: this.n.toArray()
32909 });
32910
32911 var bytes = this.n.byteLength();
32912 var ns2 = this.n.sub(new BN(2));
32913 do {
32914 var priv = new BN(drbg.generate(bytes));
32915 if (priv.cmp(ns2) > 0)
32916 continue;
32917
32918 priv.iaddn(1);
32919 return this.keyFromPrivate(priv);
32920 } while (true);
32921};
32922
32923EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
32924 var delta = msg.byteLength() * 8 - this.n.bitLength();
32925 if (delta > 0)
32926 msg = msg.ushrn(delta);
32927 if (!truncOnly && msg.cmp(this.n) >= 0)
32928 return msg.sub(this.n);
32929 else
32930 return msg;
32931};
32932
32933EC.prototype.sign = function sign(msg, key, enc, options) {
32934 if (typeof enc === 'object') {
32935 options = enc;
32936 enc = null;
32937 }
32938 if (!options)
32939 options = {};
32940
32941 key = this.keyFromPrivate(key, enc);
32942 msg = this._truncateToN(new BN(msg, 16));
32943
32944 // Zero-extend key to provide enough entropy
32945 var bytes = this.n.byteLength();
32946 var bkey = key.getPrivate().toArray('be', bytes);
32947
32948 // Zero-extend nonce to have the same byte size as N
32949 var nonce = msg.toArray('be', bytes);
32950
32951 // Instantiate Hmac_DRBG
32952 var drbg = new elliptic.hmacDRBG({
32953 hash: this.hash,
32954 entropy: bkey,
32955 nonce: nonce,
32956 pers: options.pers,
32957 persEnc: options.persEnc
32958 });
32959
32960 // Number of bytes to generate
32961 var ns1 = this.n.sub(new BN(1));
32962
32963 for (var iter = 0; true; iter++) {
32964 var k = options.k ?
32965 options.k(iter) :
32966 new BN(drbg.generate(this.n.byteLength()));
32967 k = this._truncateToN(k, true);
32968 if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
32969 continue;
32970
32971 var kp = this.g.mul(k);
32972 if (kp.isInfinity())
32973 continue;
32974
32975 var kpX = kp.getX();
32976 var r = kpX.umod(this.n);
32977 if (r.cmpn(0) === 0)
32978 continue;
32979
32980 var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
32981 s = s.umod(this.n);
32982 if (s.cmpn(0) === 0)
32983 continue;
32984
32985 var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
32986 (kpX.cmp(r) !== 0 ? 2 : 0);
32987
32988 // Use complement of `s`, if it is > `n / 2`
32989 if (options.canonical && s.cmp(this.nh) > 0) {
32990 s = this.n.sub(s);
32991 recoveryParam ^= 1;
32992 }
32993
32994 return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
32995 }
32996};
32997
32998EC.prototype.verify = function verify(msg, signature, key, enc) {
32999 msg = this._truncateToN(new BN(msg, 16));
33000 key = this.keyFromPublic(key, enc);
33001 signature = new Signature(signature, 'hex');
33002
33003 // Perform primitive values validation
33004 var r = signature.r;
33005 var s = signature.s;
33006 if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
33007 return false;
33008 if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
33009 return false;
33010
33011 // Validate signature
33012 var sinv = s.invm(this.n);
33013 var u1 = sinv.mul(msg).umod(this.n);
33014 var u2 = sinv.mul(r).umod(this.n);
33015
33016 if (!this.curve._maxwellTrick) {
33017 var p = this.g.mulAdd(u1, key.getPublic(), u2);
33018 if (p.isInfinity())
33019 return false;
33020
33021 return p.getX().umod(this.n).cmp(r) === 0;
33022 }
33023
33024 // NOTE: Greg Maxwell's trick, inspired by:
33025 // https://git.io/vad3K
33026
33027 var p = this.g.jmulAdd(u1, key.getPublic(), u2);
33028 if (p.isInfinity())
33029 return false;
33030
33031 // Compare `p.x` of Jacobian point with `r`,
33032 // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
33033 // inverse of `p.z^2`
33034 return p.eqXToP(r);
33035};
33036
33037EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
33038 assert((3 & j) === j, 'The recovery param is more than two bits');
33039 signature = new Signature(signature, enc);
33040
33041 var n = this.n;
33042 var e = new BN(msg);
33043 var r = signature.r;
33044 var s = signature.s;
33045
33046 // A set LSB signifies that the y-coordinate is odd
33047 var isYOdd = j & 1;
33048 var isSecondKey = j >> 1;
33049 if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
33050 throw new Error('Unable to find sencond key candinate');
33051
33052 // 1.1. Let x = r + jn.
33053 if (isSecondKey)
33054 r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
33055 else
33056 r = this.curve.pointFromX(r, isYOdd);
33057
33058 var rInv = signature.r.invm(n);
33059 var s1 = n.sub(e).mul(rInv).umod(n);
33060 var s2 = s.mul(rInv).umod(n);
33061
33062 // 1.6.1 Compute Q = r^-1 (sR - eG)
33063 // Q = r^-1 (sR + -eG)
33064 return this.g.mulAdd(s1, r, s2);
33065};
33066
33067EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
33068 signature = new Signature(signature, enc);
33069 if (signature.recoveryParam !== null)
33070 return signature.recoveryParam;
33071
33072 for (var i = 0; i < 4; i++) {
33073 var Qprime;
33074 try {
33075 Qprime = this.recoverPubKey(e, signature, i);
33076 } catch (e) {
33077 continue;
33078 }
33079
33080 if (Qprime.eq(Q))
33081 return i;
33082 }
33083 throw new Error('Unable to find valid recovery factor');
33084};
33085
33086},{"../../elliptic":39,"./key":47,"./signature":48,"bn.js":33}],47:[function(require,module,exports){
33087'use strict';
33088
33089var BN = require('bn.js');
33090var elliptic = require('../../elliptic');
33091var utils = elliptic.utils;
33092var assert = utils.assert;
33093
33094function KeyPair(ec, options) {
33095 this.ec = ec;
33096 this.priv = null;
33097 this.pub = null;
33098
33099 // KeyPair(ec, { priv: ..., pub: ... })
33100 if (options.priv)
33101 this._importPrivate(options.priv, options.privEnc);
33102 if (options.pub)
33103 this._importPublic(options.pub, options.pubEnc);
33104}
33105module.exports = KeyPair;
33106
33107KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
33108 if (pub instanceof KeyPair)
33109 return pub;
33110
33111 return new KeyPair(ec, {
33112 pub: pub,
33113 pubEnc: enc
33114 });
33115};
33116
33117KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
33118 if (priv instanceof KeyPair)
33119 return priv;
33120
33121 return new KeyPair(ec, {
33122 priv: priv,
33123 privEnc: enc
33124 });
33125};
33126
33127KeyPair.prototype.validate = function validate() {
33128 var pub = this.getPublic();
33129
33130 if (pub.isInfinity())
33131 return { result: false, reason: 'Invalid public key' };
33132 if (!pub.validate())
33133 return { result: false, reason: 'Public key is not a point' };
33134 if (!pub.mul(this.ec.curve.n).isInfinity())
33135 return { result: false, reason: 'Public key * N != O' };
33136
33137 return { result: true, reason: null };
33138};
33139
33140KeyPair.prototype.getPublic = function getPublic(compact, enc) {
33141 // compact is optional argument
33142 if (typeof compact === 'string') {
33143 enc = compact;
33144 compact = null;
33145 }
33146
33147 if (!this.pub)
33148 this.pub = this.ec.g.mul(this.priv);
33149
33150 if (!enc)
33151 return this.pub;
33152
33153 return this.pub.encode(enc, compact);
33154};
33155
33156KeyPair.prototype.getPrivate = function getPrivate(enc) {
33157 if (enc === 'hex')
33158 return this.priv.toString(16, 2);
33159 else
33160 return this.priv;
33161};
33162
33163KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
33164 this.priv = new BN(key, enc || 16);
33165
33166 // Ensure that the priv won't be bigger than n, otherwise we may fail
33167 // in fixed multiplication method
33168 this.priv = this.priv.umod(this.ec.curve.n);
33169};
33170
33171KeyPair.prototype._importPublic = function _importPublic(key, enc) {
33172 if (key.x || key.y) {
33173 // Montgomery points only have an `x` coordinate.
33174 // Weierstrass/Edwards points on the other hand have both `x` and
33175 // `y` coordinates.
33176 if (this.ec.curve.type === 'mont') {
33177 assert(key.x, 'Need x coordinate');
33178 } else if (this.ec.curve.type === 'short' ||
33179 this.ec.curve.type === 'edwards') {
33180 assert(key.x && key.y, 'Need both x and y coordinate');
33181 }
33182 this.pub = this.ec.curve.point(key.x, key.y);
33183 return;
33184 }
33185 this.pub = this.ec.curve.decodePoint(key, enc);
33186};
33187
33188// ECDH
33189KeyPair.prototype.derive = function derive(pub) {
33190 return pub.mul(this.priv).getX();
33191};
33192
33193// ECDSA
33194KeyPair.prototype.sign = function sign(msg, enc, options) {
33195 return this.ec.sign(msg, this, enc, options);
33196};
33197
33198KeyPair.prototype.verify = function verify(msg, signature) {
33199 return this.ec.verify(msg, signature, this);
33200};
33201
33202KeyPair.prototype.inspect = function inspect() {
33203 return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
33204 ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
33205};
33206
33207},{"../../elliptic":39,"bn.js":33}],48:[function(require,module,exports){
33208'use strict';
33209
33210var BN = require('bn.js');
33211
33212var elliptic = require('../../elliptic');
33213var utils = elliptic.utils;
33214var assert = utils.assert;
33215
33216function Signature(options, enc) {
33217 if (options instanceof Signature)
33218 return options;
33219
33220 if (this._importDER(options, enc))
33221 return;
33222
33223 assert(options.r && options.s, 'Signature without r or s');
33224 this.r = new BN(options.r, 16);
33225 this.s = new BN(options.s, 16);
33226 if (options.recoveryParam === undefined)
33227 this.recoveryParam = null;
33228 else
33229 this.recoveryParam = options.recoveryParam;
33230}
33231module.exports = Signature;
33232
33233function Position() {
33234 this.place = 0;
33235}
33236
33237function getLength(buf, p) {
33238 var initial = buf[p.place++];
33239 if (!(initial & 0x80)) {
33240 return initial;
33241 }
33242 var octetLen = initial & 0xf;
33243 var val = 0;
33244 for (var i = 0, off = p.place; i < octetLen; i++, off++) {
33245 val <<= 8;
33246 val |= buf[off];
33247 }
33248 p.place = off;
33249 return val;
33250}
33251
33252function rmPadding(buf) {
33253 var i = 0;
33254 var len = buf.length - 1;
33255 while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
33256 i++;
33257 }
33258 if (i === 0) {
33259 return buf;
33260 }
33261 return buf.slice(i);
33262}
33263
33264Signature.prototype._importDER = function _importDER(data, enc) {
33265 data = utils.toArray(data, enc);
33266 var p = new Position();
33267 if (data[p.place++] !== 0x30) {
33268 return false;
33269 }
33270 var len = getLength(data, p);
33271 if ((len + p.place) !== data.length) {
33272 return false;
33273 }
33274 if (data[p.place++] !== 0x02) {
33275 return false;
33276 }
33277 var rlen = getLength(data, p);
33278 var r = data.slice(p.place, rlen + p.place);
33279 p.place += rlen;
33280 if (data[p.place++] !== 0x02) {
33281 return false;
33282 }
33283 var slen = getLength(data, p);
33284 if (data.length !== slen + p.place) {
33285 return false;
33286 }
33287 var s = data.slice(p.place, slen + p.place);
33288 if (r[0] === 0 && (r[1] & 0x80)) {
33289 r = r.slice(1);
33290 }
33291 if (s[0] === 0 && (s[1] & 0x80)) {
33292 s = s.slice(1);
33293 }
33294
33295 this.r = new BN(r);
33296 this.s = new BN(s);
33297 this.recoveryParam = null;
33298
33299 return true;
33300};
33301
33302function constructLength(arr, len) {
33303 if (len < 0x80) {
33304 arr.push(len);
33305 return;
33306 }
33307 var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
33308 arr.push(octets | 0x80);
33309 while (--octets) {
33310 arr.push((len >>> (octets << 3)) & 0xff);
33311 }
33312 arr.push(len);
33313}
33314
33315Signature.prototype.toDER = function toDER(enc) {
33316 var r = this.r.toArray();
33317 var s = this.s.toArray();
33318
33319 // Pad values
33320 if (r[0] & 0x80)
33321 r = [ 0 ].concat(r);
33322 // Pad values
33323 if (s[0] & 0x80)
33324 s = [ 0 ].concat(s);
33325
33326 r = rmPadding(r);
33327 s = rmPadding(s);
33328
33329 while (!s[0] && !(s[1] & 0x80)) {
33330 s = s.slice(1);
33331 }
33332 var arr = [ 0x02 ];
33333 constructLength(arr, r.length);
33334 arr = arr.concat(r);
33335 arr.push(0x02);
33336 constructLength(arr, s.length);
33337 var backHalf = arr.concat(s);
33338 var res = [ 0x30 ];
33339 constructLength(res, backHalf.length);
33340 res = res.concat(backHalf);
33341 return utils.encode(res, enc);
33342};
33343
33344},{"../../elliptic":39,"bn.js":33}],49:[function(require,module,exports){
33345'use strict';
33346
33347var hash = require('hash.js');
33348var elliptic = require('../../elliptic');
33349var utils = elliptic.utils;
33350var assert = utils.assert;
33351var parseBytes = utils.parseBytes;
33352var KeyPair = require('./key');
33353var Signature = require('./signature');
33354
33355function EDDSA(curve) {
33356 assert(curve === 'ed25519', 'only tested with ed25519 so far');
33357
33358 if (!(this instanceof EDDSA))
33359 return new EDDSA(curve);
33360
33361 var curve = elliptic.curves[curve].curve;
33362 this.curve = curve;
33363 this.g = curve.g;
33364 this.g.precompute(curve.n.bitLength() + 1);
33365
33366 this.pointClass = curve.point().constructor;
33367 this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
33368 this.hash = hash.sha512;
33369}
33370
33371module.exports = EDDSA;
33372
33373/**
33374* @param {Array|String} message - message bytes
33375* @param {Array|String|KeyPair} secret - secret bytes or a keypair
33376* @returns {Signature} - signature
33377*/
33378EDDSA.prototype.sign = function sign(message, secret) {
33379 message = parseBytes(message);
33380 var key = this.keyFromSecret(secret);
33381 var r = this.hashInt(key.messagePrefix(), message);
33382 var R = this.g.mul(r);
33383 var Rencoded = this.encodePoint(R);
33384 var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
33385 .mul(key.priv());
33386 var S = r.add(s_).umod(this.curve.n);
33387 return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
33388};
33389
33390/**
33391* @param {Array} message - message bytes
33392* @param {Array|String|Signature} sig - sig bytes
33393* @param {Array|String|Point|KeyPair} pub - public key
33394* @returns {Boolean} - true if public key matches sig of message
33395*/
33396EDDSA.prototype.verify = function verify(message, sig, pub) {
33397 message = parseBytes(message);
33398 sig = this.makeSignature(sig);
33399 var key = this.keyFromPublic(pub);
33400 var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
33401 var SG = this.g.mul(sig.S());
33402 var RplusAh = sig.R().add(key.pub().mul(h));
33403 return RplusAh.eq(SG);
33404};
33405
33406EDDSA.prototype.hashInt = function hashInt() {
33407 var hash = this.hash();
33408 for (var i = 0; i < arguments.length; i++)
33409 hash.update(arguments[i]);
33410 return utils.intFromLE(hash.digest()).umod(this.curve.n);
33411};
33412
33413EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
33414 return KeyPair.fromPublic(this, pub);
33415};
33416
33417EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
33418 return KeyPair.fromSecret(this, secret);
33419};
33420
33421EDDSA.prototype.makeSignature = function makeSignature(sig) {
33422 if (sig instanceof Signature)
33423 return sig;
33424 return new Signature(this, sig);
33425};
33426
33427/**
33428* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
33429*
33430* EDDSA defines methods for encoding and decoding points and integers. These are
33431* helper convenience methods, that pass along to utility functions implied
33432* parameters.
33433*
33434*/
33435EDDSA.prototype.encodePoint = function encodePoint(point) {
33436 var enc = point.getY().toArray('le', this.encodingLength);
33437 enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
33438 return enc;
33439};
33440
33441EDDSA.prototype.decodePoint = function decodePoint(bytes) {
33442 bytes = utils.parseBytes(bytes);
33443
33444 var lastIx = bytes.length - 1;
33445 var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
33446 var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
33447
33448 var y = utils.intFromLE(normed);
33449 return this.curve.pointFromY(y, xIsOdd);
33450};
33451
33452EDDSA.prototype.encodeInt = function encodeInt(num) {
33453 return num.toArray('le', this.encodingLength);
33454};
33455
33456EDDSA.prototype.decodeInt = function decodeInt(bytes) {
33457 return utils.intFromLE(bytes);
33458};
33459
33460EDDSA.prototype.isPoint = function isPoint(val) {
33461 return val instanceof this.pointClass;
33462};
33463
33464},{"../../elliptic":39,"./key":50,"./signature":51,"hash.js":57}],50:[function(require,module,exports){
33465'use strict';
33466
33467var elliptic = require('../../elliptic');
33468var utils = elliptic.utils;
33469var assert = utils.assert;
33470var parseBytes = utils.parseBytes;
33471var cachedProperty = utils.cachedProperty;
33472
33473/**
33474* @param {EDDSA} eddsa - instance
33475* @param {Object} params - public/private key parameters
33476*
33477* @param {Array<Byte>} [params.secret] - secret seed bytes
33478* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
33479* @param {Array<Byte>} [params.pub] - public key point encoded as bytes
33480*
33481*/
33482function KeyPair(eddsa, params) {
33483 this.eddsa = eddsa;
33484 this._secret = parseBytes(params.secret);
33485 if (eddsa.isPoint(params.pub))
33486 this._pub = params.pub;
33487 else
33488 this._pubBytes = parseBytes(params.pub);
33489}
33490
33491KeyPair.fromPublic = function fromPublic(eddsa, pub) {
33492 if (pub instanceof KeyPair)
33493 return pub;
33494 return new KeyPair(eddsa, { pub: pub });
33495};
33496
33497KeyPair.fromSecret = function fromSecret(eddsa, secret) {
33498 if (secret instanceof KeyPair)
33499 return secret;
33500 return new KeyPair(eddsa, { secret: secret });
33501};
33502
33503KeyPair.prototype.secret = function secret() {
33504 return this._secret;
33505};
33506
33507cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
33508 return this.eddsa.encodePoint(this.pub());
33509});
33510
33511cachedProperty(KeyPair, 'pub', function pub() {
33512 if (this._pubBytes)
33513 return this.eddsa.decodePoint(this._pubBytes);
33514 return this.eddsa.g.mul(this.priv());
33515});
33516
33517cachedProperty(KeyPair, 'privBytes', function privBytes() {
33518 var eddsa = this.eddsa;
33519 var hash = this.hash();
33520 var lastIx = eddsa.encodingLength - 1;
33521
33522 var a = hash.slice(0, eddsa.encodingLength);
33523 a[0] &= 248;
33524 a[lastIx] &= 127;
33525 a[lastIx] |= 64;
33526
33527 return a;
33528});
33529
33530cachedProperty(KeyPair, 'priv', function priv() {
33531 return this.eddsa.decodeInt(this.privBytes());
33532});
33533
33534cachedProperty(KeyPair, 'hash', function hash() {
33535 return this.eddsa.hash().update(this.secret()).digest();
33536});
33537
33538cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
33539 return this.hash().slice(this.eddsa.encodingLength);
33540});
33541
33542KeyPair.prototype.sign = function sign(message) {
33543 assert(this._secret, 'KeyPair can only verify');
33544 return this.eddsa.sign(message, this);
33545};
33546
33547KeyPair.prototype.verify = function verify(message, sig) {
33548 return this.eddsa.verify(message, sig, this);
33549};
33550
33551KeyPair.prototype.getSecret = function getSecret(enc) {
33552 assert(this._secret, 'KeyPair is public only');
33553 return utils.encode(this.secret(), enc);
33554};
33555
33556KeyPair.prototype.getPublic = function getPublic(enc) {
33557 return utils.encode(this.pubBytes(), enc);
33558};
33559
33560module.exports = KeyPair;
33561
33562},{"../../elliptic":39}],51:[function(require,module,exports){
33563'use strict';
33564
33565var BN = require('bn.js');
33566var elliptic = require('../../elliptic');
33567var utils = elliptic.utils;
33568var assert = utils.assert;
33569var cachedProperty = utils.cachedProperty;
33570var parseBytes = utils.parseBytes;
33571
33572/**
33573* @param {EDDSA} eddsa - eddsa instance
33574* @param {Array<Bytes>|Object} sig -
33575* @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
33576* @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
33577* @param {Array<Bytes>} [sig.Rencoded] - R point encoded
33578* @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
33579*/
33580function Signature(eddsa, sig) {
33581 this.eddsa = eddsa;
33582
33583 if (typeof sig !== 'object')
33584 sig = parseBytes(sig);
33585
33586 if (Array.isArray(sig)) {
33587 sig = {
33588 R: sig.slice(0, eddsa.encodingLength),
33589 S: sig.slice(eddsa.encodingLength)
33590 };
33591 }
33592
33593 assert(sig.R && sig.S, 'Signature without R or S');
33594
33595 if (eddsa.isPoint(sig.R))
33596 this._R = sig.R;
33597 if (sig.S instanceof BN)
33598 this._S = sig.S;
33599
33600 this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
33601 this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
33602}
33603
33604cachedProperty(Signature, 'S', function S() {
33605 return this.eddsa.decodeInt(this.Sencoded());
33606});
33607
33608cachedProperty(Signature, 'R', function R() {
33609 return this.eddsa.decodePoint(this.Rencoded());
33610});
33611
33612cachedProperty(Signature, 'Rencoded', function Rencoded() {
33613 return this.eddsa.encodePoint(this.R());
33614});
33615
33616cachedProperty(Signature, 'Sencoded', function Sencoded() {
33617 return this.eddsa.encodeInt(this.S());
33618});
33619
33620Signature.prototype.toBytes = function toBytes() {
33621 return this.Rencoded().concat(this.Sencoded());
33622};
33623
33624Signature.prototype.toHex = function toHex() {
33625 return utils.encode(this.toBytes(), 'hex').toUpperCase();
33626};
33627
33628module.exports = Signature;
33629
33630},{"../../elliptic":39,"bn.js":33}],52:[function(require,module,exports){
33631'use strict';
33632
33633var hash = require('hash.js');
33634var elliptic = require('../elliptic');
33635var utils = elliptic.utils;
33636var assert = utils.assert;
33637
33638function HmacDRBG(options) {
33639 if (!(this instanceof HmacDRBG))
33640 return new HmacDRBG(options);
33641 this.hash = options.hash;
33642 this.predResist = !!options.predResist;
33643
33644 this.outLen = this.hash.outSize;
33645 this.minEntropy = options.minEntropy || this.hash.hmacStrength;
33646
33647 this.reseed = null;
33648 this.reseedInterval = null;
33649 this.K = null;
33650 this.V = null;
33651
33652 var entropy = utils.toArray(options.entropy, options.entropyEnc);
33653 var nonce = utils.toArray(options.nonce, options.nonceEnc);
33654 var pers = utils.toArray(options.pers, options.persEnc);
33655 assert(entropy.length >= (this.minEntropy / 8),
33656 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
33657 this._init(entropy, nonce, pers);
33658}
33659module.exports = HmacDRBG;
33660
33661HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
33662 var seed = entropy.concat(nonce).concat(pers);
33663
33664 this.K = new Array(this.outLen / 8);
33665 this.V = new Array(this.outLen / 8);
33666 for (var i = 0; i < this.V.length; i++) {
33667 this.K[i] = 0x00;
33668 this.V[i] = 0x01;
33669 }
33670
33671 this._update(seed);
33672 this.reseed = 1;
33673 this.reseedInterval = 0x1000000000000; // 2^48
33674};
33675
33676HmacDRBG.prototype._hmac = function hmac() {
33677 return new hash.hmac(this.hash, this.K);
33678};
33679
33680HmacDRBG.prototype._update = function update(seed) {
33681 var kmac = this._hmac()
33682 .update(this.V)
33683 .update([ 0x00 ]);
33684 if (seed)
33685 kmac = kmac.update(seed);
33686 this.K = kmac.digest();
33687 this.V = this._hmac().update(this.V).digest();
33688 if (!seed)
33689 return;
33690
33691 this.K = this._hmac()
33692 .update(this.V)
33693 .update([ 0x01 ])
33694 .update(seed)
33695 .digest();
33696 this.V = this._hmac().update(this.V).digest();
33697};
33698
33699HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
33700 // Optional entropy enc
33701 if (typeof entropyEnc !== 'string') {
33702 addEnc = add;
33703 add = entropyEnc;
33704 entropyEnc = null;
33705 }
33706
33707 entropy = utils.toBuffer(entropy, entropyEnc);
33708 add = utils.toBuffer(add, addEnc);
33709
33710 assert(entropy.length >= (this.minEntropy / 8),
33711 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
33712
33713 this._update(entropy.concat(add || []));
33714 this.reseed = 1;
33715};
33716
33717HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
33718 if (this.reseed > this.reseedInterval)
33719 throw new Error('Reseed is required');
33720
33721 // Optional encoding
33722 if (typeof enc !== 'string') {
33723 addEnc = add;
33724 add = enc;
33725 enc = null;
33726 }
33727
33728 // Optional additional data
33729 if (add) {
33730 add = utils.toArray(add, addEnc);
33731 this._update(add);
33732 }
33733
33734 var temp = [];
33735 while (temp.length < len) {
33736 this.V = this._hmac().update(this.V).digest();
33737 temp = temp.concat(this.V);
33738 }
33739
33740 var res = temp.slice(0, len);
33741 this._update(add);
33742 this.reseed++;
33743 return utils.encode(res, enc);
33744};
33745
33746},{"../elliptic":39,"hash.js":57}],53:[function(require,module,exports){
33747module.exports = {
33748 doubles: {
33749 step: 4,
33750 points: [
33751 [
33752 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
33753 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
33754 ],
33755 [
33756 '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
33757 '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
33758 ],
33759 [
33760 '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
33761 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
33762 ],
33763 [
33764 '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
33765 '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
33766 ],
33767 [
33768 '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
33769 '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
33770 ],
33771 [
33772 '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
33773 '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
33774 ],
33775 [
33776 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
33777 '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
33778 ],
33779 [
33780 '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
33781 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
33782 ],
33783 [
33784 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
33785 '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
33786 ],
33787 [
33788 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
33789 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
33790 ],
33791 [
33792 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
33793 '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
33794 ],
33795 [
33796 '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
33797 '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
33798 ],
33799 [
33800 '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
33801 '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
33802 ],
33803 [
33804 '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
33805 '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
33806 ],
33807 [
33808 '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
33809 '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
33810 ],
33811 [
33812 '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
33813 '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
33814 ],
33815 [
33816 '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
33817 '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
33818 ],
33819 [
33820 '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
33821 '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
33822 ],
33823 [
33824 '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
33825 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
33826 ],
33827 [
33828 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
33829 '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
33830 ],
33831 [
33832 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
33833 '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
33834 ],
33835 [
33836 '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
33837 '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
33838 ],
33839 [
33840 '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
33841 '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
33842 ],
33843 [
33844 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
33845 '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
33846 ],
33847 [
33848 '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
33849 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
33850 ],
33851 [
33852 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
33853 '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
33854 ],
33855 [
33856 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
33857 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
33858 ],
33859 [
33860 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
33861 '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
33862 ],
33863 [
33864 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
33865 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
33866 ],
33867 [
33868 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
33869 '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
33870 ],
33871 [
33872 '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
33873 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
33874 ],
33875 [
33876 '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
33877 '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
33878 ],
33879 [
33880 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
33881 '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
33882 ],
33883 [
33884 '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
33885 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
33886 ],
33887 [
33888 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
33889 '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
33890 ],
33891 [
33892 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
33893 '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
33894 ],
33895 [
33896 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
33897 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
33898 ],
33899 [
33900 '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
33901 '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
33902 ],
33903 [
33904 '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
33905 '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
33906 ],
33907 [
33908 '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
33909 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
33910 ],
33911 [
33912 '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
33913 '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
33914 ],
33915 [
33916 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
33917 '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
33918 ],
33919 [
33920 '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
33921 '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
33922 ],
33923 [
33924 '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
33925 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
33926 ],
33927 [
33928 '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
33929 '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
33930 ],
33931 [
33932 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
33933 '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
33934 ],
33935 [
33936 '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
33937 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
33938 ],
33939 [
33940 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
33941 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
33942 ],
33943 [
33944 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
33945 '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
33946 ],
33947 [
33948 '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
33949 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
33950 ],
33951 [
33952 '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
33953 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
33954 ],
33955 [
33956 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
33957 '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
33958 ],
33959 [
33960 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
33961 '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
33962 ],
33963 [
33964 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
33965 '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
33966 ],
33967 [
33968 '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
33969 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
33970 ],
33971 [
33972 '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
33973 '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
33974 ],
33975 [
33976 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
33977 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
33978 ],
33979 [
33980 '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
33981 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
33982 ],
33983 [
33984 '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
33985 '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
33986 ],
33987 [
33988 '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
33989 '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
33990 ],
33991 [
33992 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
33993 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
33994 ],
33995 [
33996 '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
33997 '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
33998 ],
33999 [
34000 '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
34001 '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
34002 ],
34003 [
34004 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
34005 '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
34006 ],
34007 [
34008 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
34009 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
34010 ]
34011 ]
34012 },
34013 naf: {
34014 wnd: 7,
34015 points: [
34016 [
34017 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
34018 '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
34019 ],
34020 [
34021 '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
34022 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
34023 ],
34024 [
34025 '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
34026 '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
34027 ],
34028 [
34029 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
34030 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
34031 ],
34032 [
34033 '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
34034 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
34035 ],
34036 [
34037 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
34038 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
34039 ],
34040 [
34041 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
34042 '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
34043 ],
34044 [
34045 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
34046 '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
34047 ],
34048 [
34049 '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
34050 '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
34051 ],
34052 [
34053 '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
34054 '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
34055 ],
34056 [
34057 '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
34058 '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
34059 ],
34060 [
34061 '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
34062 '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
34063 ],
34064 [
34065 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
34066 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
34067 ],
34068 [
34069 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
34070 '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
34071 ],
34072 [
34073 '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
34074 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
34075 ],
34076 [
34077 '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
34078 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
34079 ],
34080 [
34081 '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
34082 '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
34083 ],
34084 [
34085 '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
34086 '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
34087 ],
34088 [
34089 '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
34090 '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
34091 ],
34092 [
34093 '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
34094 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
34095 ],
34096 [
34097 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
34098 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
34099 ],
34100 [
34101 '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
34102 '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
34103 ],
34104 [
34105 '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
34106 '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
34107 ],
34108 [
34109 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
34110 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
34111 ],
34112 [
34113 '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
34114 '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
34115 ],
34116 [
34117 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
34118 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
34119 ],
34120 [
34121 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
34122 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
34123 ],
34124 [
34125 '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
34126 '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
34127 ],
34128 [
34129 '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
34130 '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
34131 ],
34132 [
34133 '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
34134 '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
34135 ],
34136 [
34137 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
34138 '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
34139 ],
34140 [
34141 '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
34142 '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
34143 ],
34144 [
34145 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
34146 '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
34147 ],
34148 [
34149 '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
34150 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
34151 ],
34152 [
34153 '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
34154 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
34155 ],
34156 [
34157 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
34158 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
34159 ],
34160 [
34161 '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
34162 '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
34163 ],
34164 [
34165 '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
34166 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
34167 ],
34168 [
34169 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
34170 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
34171 ],
34172 [
34173 '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
34174 '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
34175 ],
34176 [
34177 '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
34178 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
34179 ],
34180 [
34181 '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
34182 '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
34183 ],
34184 [
34185 '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
34186 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
34187 ],
34188 [
34189 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
34190 '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
34191 ],
34192 [
34193 '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
34194 '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
34195 ],
34196 [
34197 '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
34198 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
34199 ],
34200 [
34201 '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
34202 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
34203 ],
34204 [
34205 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
34206 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
34207 ],
34208 [
34209 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
34210 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
34211 ],
34212 [
34213 '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
34214 '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
34215 ],
34216 [
34217 '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
34218 '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
34219 ],
34220 [
34221 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
34222 '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
34223 ],
34224 [
34225 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
34226 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
34227 ],
34228 [
34229 '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
34230 '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
34231 ],
34232 [
34233 '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
34234 '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
34235 ],
34236 [
34237 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
34238 '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
34239 ],
34240 [
34241 '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
34242 '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
34243 ],
34244 [
34245 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
34246 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
34247 ],
34248 [
34249 '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
34250 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
34251 ],
34252 [
34253 '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
34254 '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
34255 ],
34256 [
34257 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
34258 '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
34259 ],
34260 [
34261 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
34262 '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
34263 ],
34264 [
34265 '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
34266 '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
34267 ],
34268 [
34269 '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
34270 '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
34271 ],
34272 [
34273 '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
34274 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
34275 ],
34276 [
34277 '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
34278 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
34279 ],
34280 [
34281 '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
34282 '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
34283 ],
34284 [
34285 '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
34286 '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
34287 ],
34288 [
34289 '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
34290 '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
34291 ],
34292 [
34293 '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
34294 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
34295 ],
34296 [
34297 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
34298 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
34299 ],
34300 [
34301 '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
34302 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
34303 ],
34304 [
34305 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
34306 '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
34307 ],
34308 [
34309 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
34310 '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
34311 ],
34312 [
34313 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
34314 '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
34315 ],
34316 [
34317 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
34318 '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
34319 ],
34320 [
34321 '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
34322 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
34323 ],
34324 [
34325 '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
34326 '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
34327 ],
34328 [
34329 '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
34330 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
34331 ],
34332 [
34333 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
34334 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
34335 ],
34336 [
34337 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
34338 '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
34339 ],
34340 [
34341 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
34342 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
34343 ],
34344 [
34345 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
34346 '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
34347 ],
34348 [
34349 '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
34350 '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
34351 ],
34352 [
34353 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
34354 '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
34355 ],
34356 [
34357 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
34358 '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
34359 ],
34360 [
34361 '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
34362 '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
34363 ],
34364 [
34365 '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
34366 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
34367 ],
34368 [
34369 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
34370 '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
34371 ],
34372 [
34373 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
34374 '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
34375 ],
34376 [
34377 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
34378 '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
34379 ],
34380 [
34381 '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
34382 '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
34383 ],
34384 [
34385 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
34386 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
34387 ],
34388 [
34389 '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
34390 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
34391 ],
34392 [
34393 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
34394 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
34395 ],
34396 [
34397 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
34398 '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
34399 ],
34400 [
34401 '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
34402 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
34403 ],
34404 [
34405 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
34406 '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
34407 ],
34408 [
34409 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
34410 '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
34411 ],
34412 [
34413 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
34414 '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
34415 ],
34416 [
34417 '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
34418 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
34419 ],
34420 [
34421 '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
34422 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
34423 ],
34424 [
34425 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
34426 '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
34427 ],
34428 [
34429 '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
34430 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
34431 ],
34432 [
34433 '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
34434 '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
34435 ],
34436 [
34437 '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
34438 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
34439 ],
34440 [
34441 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
34442 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
34443 ],
34444 [
34445 '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
34446 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
34447 ],
34448 [
34449 '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
34450 '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
34451 ],
34452 [
34453 '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
34454 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
34455 ],
34456 [
34457 '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
34458 '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
34459 ],
34460 [
34461 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
34462 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
34463 ],
34464 [
34465 '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
34466 '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
34467 ],
34468 [
34469 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
34470 '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
34471 ],
34472 [
34473 '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
34474 '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
34475 ],
34476 [
34477 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
34478 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
34479 ],
34480 [
34481 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
34482 '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
34483 ],
34484 [
34485 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
34486 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
34487 ],
34488 [
34489 '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
34490 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
34491 ],
34492 [
34493 '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
34494 '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
34495 ],
34496 [
34497 '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
34498 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
34499 ],
34500 [
34501 '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
34502 '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
34503 ],
34504 [
34505 '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
34506 '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
34507 ],
34508 [
34509 '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
34510 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
34511 ],
34512 [
34513 '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
34514 '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
34515 ],
34516 [
34517 '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
34518 '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
34519 ],
34520 [
34521 '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
34522 '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
34523 ]
34524 ]
34525 }
34526};
34527
34528},{}],54:[function(require,module,exports){
34529'use strict';
34530
34531var utils = exports;
34532var BN = require('bn.js');
34533
34534utils.assert = function assert(val, msg) {
34535 if (!val)
34536 throw new Error(msg || 'Assertion failed');
34537};
34538
34539function toArray(msg, enc) {
34540 if (Array.isArray(msg))
34541 return msg.slice();
34542 if (!msg)
34543 return [];
34544 var res = [];
34545 if (typeof msg !== 'string') {
34546 for (var i = 0; i < msg.length; i++)
34547 res[i] = msg[i] | 0;
34548 return res;
34549 }
34550 if (!enc) {
34551 for (var i = 0; i < msg.length; i++) {
34552 var c = msg.charCodeAt(i);
34553 var hi = c >> 8;
34554 var lo = c & 0xff;
34555 if (hi)
34556 res.push(hi, lo);
34557 else
34558 res.push(lo);
34559 }
34560 } else if (enc === 'hex') {
34561 msg = msg.replace(/[^a-z0-9]+/ig, '');
34562 if (msg.length % 2 !== 0)
34563 msg = '0' + msg;
34564 for (var i = 0; i < msg.length; i += 2)
34565 res.push(parseInt(msg[i] + msg[i + 1], 16));
34566 }
34567 return res;
34568}
34569utils.toArray = toArray;
34570
34571function zero2(word) {
34572 if (word.length === 1)
34573 return '0' + word;
34574 else
34575 return word;
34576}
34577utils.zero2 = zero2;
34578
34579function toHex(msg) {
34580 var res = '';
34581 for (var i = 0; i < msg.length; i++)
34582 res += zero2(msg[i].toString(16));
34583 return res;
34584}
34585utils.toHex = toHex;
34586
34587utils.encode = function encode(arr, enc) {
34588 if (enc === 'hex')
34589 return toHex(arr);
34590 else
34591 return arr;
34592};
34593
34594// Represent num in a w-NAF form
34595function getNAF(num, w) {
34596 var naf = [];
34597 var ws = 1 << (w + 1);
34598 var k = num.clone();
34599 while (k.cmpn(1) >= 0) {
34600 var z;
34601 if (k.isOdd()) {
34602 var mod = k.andln(ws - 1);
34603 if (mod > (ws >> 1) - 1)
34604 z = (ws >> 1) - mod;
34605 else
34606 z = mod;
34607 k.isubn(z);
34608 } else {
34609 z = 0;
34610 }
34611 naf.push(z);
34612
34613 // Optimization, shift by word if possible
34614 var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;
34615 for (var i = 1; i < shift; i++)
34616 naf.push(0);
34617 k.iushrn(shift);
34618 }
34619
34620 return naf;
34621}
34622utils.getNAF = getNAF;
34623
34624// Represent k1, k2 in a Joint Sparse Form
34625function getJSF(k1, k2) {
34626 var jsf = [
34627 [],
34628 []
34629 ];
34630
34631 k1 = k1.clone();
34632 k2 = k2.clone();
34633 var d1 = 0;
34634 var d2 = 0;
34635 while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
34636
34637 // First phase
34638 var m14 = (k1.andln(3) + d1) & 3;
34639 var m24 = (k2.andln(3) + d2) & 3;
34640 if (m14 === 3)
34641 m14 = -1;
34642 if (m24 === 3)
34643 m24 = -1;
34644 var u1;
34645 if ((m14 & 1) === 0) {
34646 u1 = 0;
34647 } else {
34648 var m8 = (k1.andln(7) + d1) & 7;
34649 if ((m8 === 3 || m8 === 5) && m24 === 2)
34650 u1 = -m14;
34651 else
34652 u1 = m14;
34653 }
34654 jsf[0].push(u1);
34655
34656 var u2;
34657 if ((m24 & 1) === 0) {
34658 u2 = 0;
34659 } else {
34660 var m8 = (k2.andln(7) + d2) & 7;
34661 if ((m8 === 3 || m8 === 5) && m14 === 2)
34662 u2 = -m24;
34663 else
34664 u2 = m24;
34665 }
34666 jsf[1].push(u2);
34667
34668 // Second phase
34669 if (2 * d1 === u1 + 1)
34670 d1 = 1 - d1;
34671 if (2 * d2 === u2 + 1)
34672 d2 = 1 - d2;
34673 k1.iushrn(1);
34674 k2.iushrn(1);
34675 }
34676
34677 return jsf;
34678}
34679utils.getJSF = getJSF;
34680
34681function cachedProperty(obj, name, computer) {
34682 var key = '_' + name;
34683 obj.prototype[name] = function cachedProperty() {
34684 return this[key] !== undefined ? this[key] :
34685 this[key] = computer.call(this);
34686 };
34687}
34688utils.cachedProperty = cachedProperty;
34689
34690function parseBytes(bytes) {
34691 return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
34692 bytes;
34693}
34694utils.parseBytes = parseBytes;
34695
34696function intFromLE(bytes) {
34697 return new BN(bytes, 'hex', 'le');
34698}
34699utils.intFromLE = intFromLE;
34700
34701
34702},{"bn.js":33}],55:[function(require,module,exports){
34703module.exports={
34704 "_args": [
34705 [
34706 {
34707 "raw": "elliptic@^6.2.3",
34708 "scope": null,
34709 "escapedName": "elliptic",
34710 "name": "elliptic",
34711 "rawSpec": "^6.2.3",
34712 "spec": ">=6.2.3 <7.0.0",
34713 "type": "range"
34714 },
34715 "/home/user/ethereum/ethereumjs-util/node_modules/secp256k1"
34716 ]
34717 ],
34718 "_from": "elliptic@>=6.2.3 <7.0.0",
34719 "_id": "elliptic@6.3.3",
34720 "_inCache": true,
34721 "_location": "/elliptic",
34722 "_nodeVersion": "7.0.0",
34723 "_npmOperationalInternal": {
34724 "host": "packages-18-east.internal.npmjs.com",
34725 "tmp": "tmp/elliptic-6.3.3.tgz_1486422837740_0.10658654430881143"
34726 },
34727 "_npmUser": {
34728 "name": "indutny",
34729 "email": "fedor@indutny.com"
34730 },
34731 "_npmVersion": "3.10.8",
34732 "_phantomChildren": {},
34733 "_requested": {
34734 "raw": "elliptic@^6.2.3",
34735 "scope": null,
34736 "escapedName": "elliptic",
34737 "name": "elliptic",
34738 "rawSpec": "^6.2.3",
34739 "spec": ">=6.2.3 <7.0.0",
34740 "type": "range"
34741 },
34742 "_requiredBy": [
34743 "/browserify-sign",
34744 "/create-ecdh",
34745 "/secp256k1"
34746 ],
34747 "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz",
34748 "_shasum": "5482d9646d54bcb89fd7d994fc9e2e9568876e3f",
34749 "_shrinkwrap": null,
34750 "_spec": "elliptic@^6.2.3",
34751 "_where": "/home/user/ethereum/ethereumjs-util/node_modules/secp256k1",
34752 "author": {
34753 "name": "Fedor Indutny",
34754 "email": "fedor@indutny.com"
34755 },
34756 "bugs": {
34757 "url": "https://github.com/indutny/elliptic/issues"
34758 },
34759 "dependencies": {
34760 "bn.js": "^4.4.0",
34761 "brorand": "^1.0.1",
34762 "hash.js": "^1.0.0",
34763 "inherits": "^2.0.1"
34764 },
34765 "description": "EC cryptography",
34766 "devDependencies": {
34767 "brfs": "^1.4.3",
34768 "coveralls": "^2.11.3",
34769 "grunt": "^0.4.5",
34770 "grunt-browserify": "^5.0.0",
34771 "grunt-cli": "^1.2.0",
34772 "grunt-contrib-connect": "^1.0.0",
34773 "grunt-contrib-copy": "^1.0.0",
34774 "grunt-contrib-uglify": "^1.0.1",
34775 "grunt-mocha-istanbul": "^3.0.1",
34776 "grunt-saucelabs": "^8.6.2",
34777 "istanbul": "^0.4.2",
34778 "jscs": "^2.9.0",
34779 "jshint": "^2.6.0",
34780 "mocha": "^2.1.0"
34781 },
34782 "directories": {},
34783 "dist": {
34784 "shasum": "5482d9646d54bcb89fd7d994fc9e2e9568876e3f",
34785 "tarball": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz"
34786 },
34787 "files": [
34788 "lib"
34789 ],
34790 "gitHead": "63aee8d697e9b7fac37ece24222029117a890a7e",
34791 "homepage": "https://github.com/indutny/elliptic",
34792 "keywords": [
34793 "EC",
34794 "Elliptic",
34795 "curve",
34796 "Cryptography"
34797 ],
34798 "license": "MIT",
34799 "main": "lib/elliptic.js",
34800 "maintainers": [
34801 {
34802 "name": "indutny",
34803 "email": "fedor@indutny.com"
34804 }
34805 ],
34806 "name": "elliptic",
34807 "optionalDependencies": {},
34808 "readme": "ERROR: No README data found!",
34809 "repository": {
34810 "type": "git",
34811 "url": "git+ssh://git@github.com/indutny/elliptic.git"
34812 },
34813 "scripts": {
34814 "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
34815 "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
34816 "lint": "npm run jscs && npm run jshint",
34817 "test": "npm run lint && npm run unit",
34818 "unit": "istanbul test _mocha --reporter=spec test/index.js",
34819 "version": "grunt dist && git add dist/"
34820 },
34821 "version": "6.3.3"
34822}
34823
34824},{}],56:[function(require,module,exports){
34825(function (Buffer){
34826'use strict';
34827
34828var isHexPrefixed = require('is-hex-prefixed');
34829var stripHexPrefix = require('strip-hex-prefix');
34830
34831/**
34832 * Pads a `String` to have an even length
34833 * @param {String} value
34834 * @return {String} output
34835 */
34836function padToEven(value) {
34837 var a = value; // eslint-disable-line
34838
34839 if (typeof a !== 'string') {
34840 throw new Error('[ethjs-util] while padding to even, value must be string, is currently ' + typeof a + ', while padToEven.');
34841 }
34842
34843 if (a.length % 2) {
34844 a = '0' + a;
34845 }
34846
34847 return a;
34848}
34849
34850/**
34851 * Converts a `Number` into a hex `String`
34852 * @param {Number} i
34853 * @return {String}
34854 */
34855function intToHex(i) {
34856 var hex = i.toString(16); // eslint-disable-line
34857
34858 return '0x' + padToEven(hex);
34859}
34860
34861/**
34862 * Converts an `Number` to a `Buffer`
34863 * @param {Number} i
34864 * @return {Buffer}
34865 */
34866function intToBuffer(i) {
34867 var hex = intToHex(i);
34868
34869 return new Buffer(hex.slice(2), 'hex');
34870}
34871
34872/**
34873 * Get the binary size of a string
34874 * @param {String} str
34875 * @return {Number}
34876 */
34877function getBinarySize(str) {
34878 if (typeof str !== 'string') {
34879 throw new Error('[ethjs-util] while getting binary size, method getBinarySize requires input \'str\' to be type String, got \'' + typeof str + '\'.');
34880 }
34881
34882 return Buffer.byteLength(str, 'utf8');
34883}
34884
34885/**
34886 * Returns TRUE if the first specified array contains all elements
34887 * from the second one. FALSE otherwise.
34888 *
34889 * @param {array} superset
34890 * @param {array} subset
34891 *
34892 * @returns {boolean}
34893 */
34894function arrayContainsArray(superset, subset, some) {
34895 if (Array.isArray(superset) !== true) {
34896 throw new Error('[ethjs-util] method arrayContainsArray requires input \'superset\' to be an array got type \'' + typeof superset + '\'');
34897 }
34898 if (Array.isArray(subset) !== true) {
34899 throw new Error('[ethjs-util] method arrayContainsArray requires input \'subset\' to be an array got type \'' + typeof subset + '\'');
34900 }
34901
34902 return subset[Boolean(some) && 'some' || 'every'](function (value) {
34903 return superset.indexOf(value) >= 0;
34904 });
34905}
34906
34907/**
34908 * Should be called to get utf8 from it's hex representation
34909 *
34910 * @method toUtf8
34911 * @param {String} string in hex
34912 * @returns {String} ascii string representation of hex value
34913 */
34914function toUtf8(hex) {
34915 var bufferValue = new Buffer(padToEven(stripHexPrefix(hex).replace(/^0+|0+$/g, '')), 'hex');
34916
34917 return bufferValue.toString('utf8');
34918}
34919
34920/**
34921 * Should be called to get ascii from it's hex representation
34922 *
34923 * @method toAscii
34924 * @param {String} string in hex
34925 * @returns {String} ascii string representation of hex value
34926 */
34927function toAscii(hex) {
34928 var str = ''; // eslint-disable-line
34929 var i = 0,
34930 l = hex.length; // eslint-disable-line
34931
34932 if (hex.substring(0, 2) === '0x') {
34933 i = 2;
34934 }
34935
34936 for (; i < l; i += 2) {
34937 var code = parseInt(hex.substr(i, 2), 16);
34938 str += String.fromCharCode(code);
34939 }
34940
34941 return str;
34942}
34943
34944/**
34945 * Should be called to get hex representation (prefixed by 0x) of utf8 string
34946 *
34947 * @method fromUtf8
34948 * @param {String} string
34949 * @param {Number} optional padding
34950 * @returns {String} hex representation of input string
34951 */
34952function fromUtf8(stringValue) {
34953 var str = new Buffer(stringValue, 'utf8');
34954
34955 return '0x' + padToEven(str.toString('hex')).replace(/^0+|0+$/g, '');
34956}
34957
34958/**
34959 * Should be called to get hex representation (prefixed by 0x) of ascii string
34960 *
34961 * @method fromAscii
34962 * @param {String} string
34963 * @param {Number} optional padding
34964 * @returns {String} hex representation of input string
34965 */
34966function fromAscii(stringValue) {
34967 var hex = ''; // eslint-disable-line
34968 for (var i = 0; i < stringValue.length; i++) {
34969 // eslint-disable-line
34970 var code = stringValue.charCodeAt(i);
34971 var n = code.toString(16);
34972 hex += n.length < 2 ? '0' + n : n;
34973 }
34974
34975 return '0x' + hex;
34976}
34977
34978/**
34979 * getKeys([{a: 1, b: 2}, {a: 3, b: 4}], 'a') => [1, 3]
34980 *
34981 * @method getKeys get specific key from inner object array of objects
34982 * @param {String} params
34983 * @param {String} key
34984 * @param {Boolean} allowEmpty
34985 * @returns {Array} output just a simple array of output keys
34986 */
34987function getKeys(params, key, allowEmpty) {
34988 if (!Array.isArray(params)) {
34989 throw new Error('[ethjs-util] method getKeys expecting type Array as \'params\' input, got \'' + typeof params + '\'');
34990 }
34991 if (typeof key !== 'string') {
34992 throw new Error('[ethjs-util] method getKeys expecting type String for input \'key\' got \'' + typeof key + '\'.');
34993 }
34994
34995 var result = []; // eslint-disable-line
34996
34997 for (var i = 0; i < params.length; i++) {
34998 // eslint-disable-line
34999 var value = params[i][key]; // eslint-disable-line
35000 if (allowEmpty && !value) {
35001 value = '';
35002 } else if (typeof value !== 'string') {
35003 throw new Error('invalid abi');
35004 }
35005 result.push(value);
35006 }
35007
35008 return result;
35009}
35010
35011/**
35012 * Is the string a hex string.
35013 *
35014 * @method check if string is hex string of specific length
35015 * @param {String} value
35016 * @param {Number} length
35017 * @returns {Boolean} output the string is a hex string
35018 */
35019function isHexString(value, length) {
35020 if (typeof value !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) {
35021 return false;
35022 }
35023
35024 if (length && value.length !== 2 + 2 * length) {
35025 return false;
35026 }
35027
35028 return true;
35029}
35030
35031module.exports = {
35032 arrayContainsArray: arrayContainsArray,
35033 intToBuffer: intToBuffer,
35034 getBinarySize: getBinarySize,
35035 isHexPrefixed: isHexPrefixed,
35036 stripHexPrefix: stripHexPrefix,
35037 padToEven: padToEven,
35038 intToHex: intToHex,
35039 fromAscii: fromAscii,
35040 fromUtf8: fromUtf8,
35041 toAscii: toAscii,
35042 toUtf8: toUtf8,
35043 getKeys: getKeys,
35044 isHexString: isHexString
35045};
35046}).call(this,require("buffer").Buffer)
35047},{"buffer":5,"is-hex-prefixed":64,"strip-hex-prefix":87}],57:[function(require,module,exports){
35048var hash = exports;
35049
35050hash.utils = require('./hash/utils');
35051hash.common = require('./hash/common');
35052hash.sha = require('./hash/sha');
35053hash.ripemd = require('./hash/ripemd');
35054hash.hmac = require('./hash/hmac');
35055
35056// Proxy hash functions to the main object
35057hash.sha1 = hash.sha.sha1;
35058hash.sha256 = hash.sha.sha256;
35059hash.sha224 = hash.sha.sha224;
35060hash.sha384 = hash.sha.sha384;
35061hash.sha512 = hash.sha.sha512;
35062hash.ripemd160 = hash.ripemd.ripemd160;
35063
35064},{"./hash/common":58,"./hash/hmac":59,"./hash/ripemd":60,"./hash/sha":61,"./hash/utils":62}],58:[function(require,module,exports){
35065var hash = require('../hash');
35066var utils = hash.utils;
35067var assert = utils.assert;
35068
35069function BlockHash() {
35070 this.pending = null;
35071 this.pendingTotal = 0;
35072 this.blockSize = this.constructor.blockSize;
35073 this.outSize = this.constructor.outSize;
35074 this.hmacStrength = this.constructor.hmacStrength;
35075 this.padLength = this.constructor.padLength / 8;
35076 this.endian = 'big';
35077
35078 this._delta8 = this.blockSize / 8;
35079 this._delta32 = this.blockSize / 32;
35080}
35081exports.BlockHash = BlockHash;
35082
35083BlockHash.prototype.update = function update(msg, enc) {
35084 // Convert message to array, pad it, and join into 32bit blocks
35085 msg = utils.toArray(msg, enc);
35086 if (!this.pending)
35087 this.pending = msg;
35088 else
35089 this.pending = this.pending.concat(msg);
35090 this.pendingTotal += msg.length;
35091
35092 // Enough data, try updating
35093 if (this.pending.length >= this._delta8) {
35094 msg = this.pending;
35095
35096 // Process pending data in blocks
35097 var r = msg.length % this._delta8;
35098 this.pending = msg.slice(msg.length - r, msg.length);
35099 if (this.pending.length === 0)
35100 this.pending = null;
35101
35102 msg = utils.join32(msg, 0, msg.length - r, this.endian);
35103 for (var i = 0; i < msg.length; i += this._delta32)
35104 this._update(msg, i, i + this._delta32);
35105 }
35106
35107 return this;
35108};
35109
35110BlockHash.prototype.digest = function digest(enc) {
35111 this.update(this._pad());
35112 assert(this.pending === null);
35113
35114 return this._digest(enc);
35115};
35116
35117BlockHash.prototype._pad = function pad() {
35118 var len = this.pendingTotal;
35119 var bytes = this._delta8;
35120 var k = bytes - ((len + this.padLength) % bytes);
35121 var res = new Array(k + this.padLength);
35122 res[0] = 0x80;
35123 for (var i = 1; i < k; i++)
35124 res[i] = 0;
35125
35126 // Append length
35127 len <<= 3;
35128 if (this.endian === 'big') {
35129 for (var t = 8; t < this.padLength; t++)
35130 res[i++] = 0;
35131
35132 res[i++] = 0;
35133 res[i++] = 0;
35134 res[i++] = 0;
35135 res[i++] = 0;
35136 res[i++] = (len >>> 24) & 0xff;
35137 res[i++] = (len >>> 16) & 0xff;
35138 res[i++] = (len >>> 8) & 0xff;
35139 res[i++] = len & 0xff;
35140 } else {
35141 res[i++] = len & 0xff;
35142 res[i++] = (len >>> 8) & 0xff;
35143 res[i++] = (len >>> 16) & 0xff;
35144 res[i++] = (len >>> 24) & 0xff;
35145 res[i++] = 0;
35146 res[i++] = 0;
35147 res[i++] = 0;
35148 res[i++] = 0;
35149
35150 for (var t = 8; t < this.padLength; t++)
35151 res[i++] = 0;
35152 }
35153
35154 return res;
35155};
35156
35157},{"../hash":57}],59:[function(require,module,exports){
35158var hmac = exports;
35159
35160var hash = require('../hash');
35161var utils = hash.utils;
35162var assert = utils.assert;
35163
35164function Hmac(hash, key, enc) {
35165 if (!(this instanceof Hmac))
35166 return new Hmac(hash, key, enc);
35167 this.Hash = hash;
35168 this.blockSize = hash.blockSize / 8;
35169 this.outSize = hash.outSize / 8;
35170 this.inner = null;
35171 this.outer = null;
35172
35173 this._init(utils.toArray(key, enc));
35174}
35175module.exports = Hmac;
35176
35177Hmac.prototype._init = function init(key) {
35178 // Shorten key, if needed
35179 if (key.length > this.blockSize)
35180 key = new this.Hash().update(key).digest();
35181 assert(key.length <= this.blockSize);
35182
35183 // Add padding to key
35184 for (var i = key.length; i < this.blockSize; i++)
35185 key.push(0);
35186
35187 for (var i = 0; i < key.length; i++)
35188 key[i] ^= 0x36;
35189 this.inner = new this.Hash().update(key);
35190
35191 // 0x36 ^ 0x5c = 0x6a
35192 for (var i = 0; i < key.length; i++)
35193 key[i] ^= 0x6a;
35194 this.outer = new this.Hash().update(key);
35195};
35196
35197Hmac.prototype.update = function update(msg, enc) {
35198 this.inner.update(msg, enc);
35199 return this;
35200};
35201
35202Hmac.prototype.digest = function digest(enc) {
35203 this.outer.update(this.inner.digest());
35204 return this.outer.digest(enc);
35205};
35206
35207},{"../hash":57}],60:[function(require,module,exports){
35208var hash = require('../hash');
35209var utils = hash.utils;
35210
35211var rotl32 = utils.rotl32;
35212var sum32 = utils.sum32;
35213var sum32_3 = utils.sum32_3;
35214var sum32_4 = utils.sum32_4;
35215var BlockHash = hash.common.BlockHash;
35216
35217function RIPEMD160() {
35218 if (!(this instanceof RIPEMD160))
35219 return new RIPEMD160();
35220
35221 BlockHash.call(this);
35222
35223 this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
35224 this.endian = 'little';
35225}
35226utils.inherits(RIPEMD160, BlockHash);
35227exports.ripemd160 = RIPEMD160;
35228
35229RIPEMD160.blockSize = 512;
35230RIPEMD160.outSize = 160;
35231RIPEMD160.hmacStrength = 192;
35232RIPEMD160.padLength = 64;
35233
35234RIPEMD160.prototype._update = function update(msg, start) {
35235 var A = this.h[0];
35236 var B = this.h[1];
35237 var C = this.h[2];
35238 var D = this.h[3];
35239 var E = this.h[4];
35240 var Ah = A;
35241 var Bh = B;
35242 var Ch = C;
35243 var Dh = D;
35244 var Eh = E;
35245 for (var j = 0; j < 80; j++) {
35246 var T = sum32(
35247 rotl32(
35248 sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
35249 s[j]),
35250 E);
35251 A = E;
35252 E = D;
35253 D = rotl32(C, 10);
35254 C = B;
35255 B = T;
35256 T = sum32(
35257 rotl32(
35258 sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
35259 sh[j]),
35260 Eh);
35261 Ah = Eh;
35262 Eh = Dh;
35263 Dh = rotl32(Ch, 10);
35264 Ch = Bh;
35265 Bh = T;
35266 }
35267 T = sum32_3(this.h[1], C, Dh);
35268 this.h[1] = sum32_3(this.h[2], D, Eh);
35269 this.h[2] = sum32_3(this.h[3], E, Ah);
35270 this.h[3] = sum32_3(this.h[4], A, Bh);
35271 this.h[4] = sum32_3(this.h[0], B, Ch);
35272 this.h[0] = T;
35273};
35274
35275RIPEMD160.prototype._digest = function digest(enc) {
35276 if (enc === 'hex')
35277 return utils.toHex32(this.h, 'little');
35278 else
35279 return utils.split32(this.h, 'little');
35280};
35281
35282function f(j, x, y, z) {
35283 if (j <= 15)
35284 return x ^ y ^ z;
35285 else if (j <= 31)
35286 return (x & y) | ((~x) & z);
35287 else if (j <= 47)
35288 return (x | (~y)) ^ z;
35289 else if (j <= 63)
35290 return (x & z) | (y & (~z));
35291 else
35292 return x ^ (y | (~z));
35293}
35294
35295function K(j) {
35296 if (j <= 15)
35297 return 0x00000000;
35298 else if (j <= 31)
35299 return 0x5a827999;
35300 else if (j <= 47)
35301 return 0x6ed9eba1;
35302 else if (j <= 63)
35303 return 0x8f1bbcdc;
35304 else
35305 return 0xa953fd4e;
35306}
35307
35308function Kh(j) {
35309 if (j <= 15)
35310 return 0x50a28be6;
35311 else if (j <= 31)
35312 return 0x5c4dd124;
35313 else if (j <= 47)
35314 return 0x6d703ef3;
35315 else if (j <= 63)
35316 return 0x7a6d76e9;
35317 else
35318 return 0x00000000;
35319}
35320
35321var r = [
35322 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
35323 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
35324 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
35325 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
35326 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
35327];
35328
35329var rh = [
35330 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
35331 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
35332 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
35333 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
35334 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
35335];
35336
35337var s = [
35338 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
35339 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
35340 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
35341 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
35342 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
35343];
35344
35345var sh = [
35346 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
35347 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
35348 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
35349 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
35350 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
35351];
35352
35353},{"../hash":57}],61:[function(require,module,exports){
35354var hash = require('../hash');
35355var utils = hash.utils;
35356var assert = utils.assert;
35357
35358var rotr32 = utils.rotr32;
35359var rotl32 = utils.rotl32;
35360var sum32 = utils.sum32;
35361var sum32_4 = utils.sum32_4;
35362var sum32_5 = utils.sum32_5;
35363var rotr64_hi = utils.rotr64_hi;
35364var rotr64_lo = utils.rotr64_lo;
35365var shr64_hi = utils.shr64_hi;
35366var shr64_lo = utils.shr64_lo;
35367var sum64 = utils.sum64;
35368var sum64_hi = utils.sum64_hi;
35369var sum64_lo = utils.sum64_lo;
35370var sum64_4_hi = utils.sum64_4_hi;
35371var sum64_4_lo = utils.sum64_4_lo;
35372var sum64_5_hi = utils.sum64_5_hi;
35373var sum64_5_lo = utils.sum64_5_lo;
35374var BlockHash = hash.common.BlockHash;
35375
35376var sha256_K = [
35377 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
35378 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
35379 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
35380 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
35381 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
35382 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
35383 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
35384 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
35385 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
35386 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
35387 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
35388 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
35389 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
35390 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
35391 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
35392 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
35393];
35394
35395var sha512_K = [
35396 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
35397 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
35398 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
35399 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
35400 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
35401 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
35402 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
35403 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
35404 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
35405 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
35406 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
35407 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
35408 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
35409 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
35410 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
35411 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
35412 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
35413 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
35414 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
35415 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
35416 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
35417 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
35418 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
35419 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
35420 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
35421 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
35422 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
35423 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
35424 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
35425 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
35426 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
35427 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
35428 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
35429 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
35430 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
35431 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
35432 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
35433 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
35434 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
35435 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
35436];
35437
35438var sha1_K = [
35439 0x5A827999, 0x6ED9EBA1,
35440 0x8F1BBCDC, 0xCA62C1D6
35441];
35442
35443function SHA256() {
35444 if (!(this instanceof SHA256))
35445 return new SHA256();
35446
35447 BlockHash.call(this);
35448 this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
35449 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ];
35450 this.k = sha256_K;
35451 this.W = new Array(64);
35452}
35453utils.inherits(SHA256, BlockHash);
35454exports.sha256 = SHA256;
35455
35456SHA256.blockSize = 512;
35457SHA256.outSize = 256;
35458SHA256.hmacStrength = 192;
35459SHA256.padLength = 64;
35460
35461SHA256.prototype._update = function _update(msg, start) {
35462 var W = this.W;
35463
35464 for (var i = 0; i < 16; i++)
35465 W[i] = msg[start + i];
35466 for (; i < W.length; i++)
35467 W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
35468
35469 var a = this.h[0];
35470 var b = this.h[1];
35471 var c = this.h[2];
35472 var d = this.h[3];
35473 var e = this.h[4];
35474 var f = this.h[5];
35475 var g = this.h[6];
35476 var h = this.h[7];
35477
35478 assert(this.k.length === W.length);
35479 for (var i = 0; i < W.length; i++) {
35480 var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
35481 var T2 = sum32(s0_256(a), maj32(a, b, c));
35482 h = g;
35483 g = f;
35484 f = e;
35485 e = sum32(d, T1);
35486 d = c;
35487 c = b;
35488 b = a;
35489 a = sum32(T1, T2);
35490 }
35491
35492 this.h[0] = sum32(this.h[0], a);
35493 this.h[1] = sum32(this.h[1], b);
35494 this.h[2] = sum32(this.h[2], c);
35495 this.h[3] = sum32(this.h[3], d);
35496 this.h[4] = sum32(this.h[4], e);
35497 this.h[5] = sum32(this.h[5], f);
35498 this.h[6] = sum32(this.h[6], g);
35499 this.h[7] = sum32(this.h[7], h);
35500};
35501
35502SHA256.prototype._digest = function digest(enc) {
35503 if (enc === 'hex')
35504 return utils.toHex32(this.h, 'big');
35505 else
35506 return utils.split32(this.h, 'big');
35507};
35508
35509function SHA224() {
35510 if (!(this instanceof SHA224))
35511 return new SHA224();
35512
35513 SHA256.call(this);
35514 this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
35515 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
35516}
35517utils.inherits(SHA224, SHA256);
35518exports.sha224 = SHA224;
35519
35520SHA224.blockSize = 512;
35521SHA224.outSize = 224;
35522SHA224.hmacStrength = 192;
35523SHA224.padLength = 64;
35524
35525SHA224.prototype._digest = function digest(enc) {
35526 // Just truncate output
35527 if (enc === 'hex')
35528 return utils.toHex32(this.h.slice(0, 7), 'big');
35529 else
35530 return utils.split32(this.h.slice(0, 7), 'big');
35531};
35532
35533function SHA512() {
35534 if (!(this instanceof SHA512))
35535 return new SHA512();
35536
35537 BlockHash.call(this);
35538 this.h = [ 0x6a09e667, 0xf3bcc908,
35539 0xbb67ae85, 0x84caa73b,
35540 0x3c6ef372, 0xfe94f82b,
35541 0xa54ff53a, 0x5f1d36f1,
35542 0x510e527f, 0xade682d1,
35543 0x9b05688c, 0x2b3e6c1f,
35544 0x1f83d9ab, 0xfb41bd6b,
35545 0x5be0cd19, 0x137e2179 ];
35546 this.k = sha512_K;
35547 this.W = new Array(160);
35548}
35549utils.inherits(SHA512, BlockHash);
35550exports.sha512 = SHA512;
35551
35552SHA512.blockSize = 1024;
35553SHA512.outSize = 512;
35554SHA512.hmacStrength = 192;
35555SHA512.padLength = 128;
35556
35557SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
35558 var W = this.W;
35559
35560 // 32 x 32bit words
35561 for (var i = 0; i < 32; i++)
35562 W[i] = msg[start + i];
35563 for (; i < W.length; i += 2) {
35564 var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
35565 var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
35566 var c1_hi = W[i - 14]; // i - 7
35567 var c1_lo = W[i - 13];
35568 var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
35569 var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
35570 var c3_hi = W[i - 32]; // i - 16
35571 var c3_lo = W[i - 31];
35572
35573 W[i] = sum64_4_hi(c0_hi, c0_lo,
35574 c1_hi, c1_lo,
35575 c2_hi, c2_lo,
35576 c3_hi, c3_lo);
35577 W[i + 1] = sum64_4_lo(c0_hi, c0_lo,
35578 c1_hi, c1_lo,
35579 c2_hi, c2_lo,
35580 c3_hi, c3_lo);
35581 }
35582};
35583
35584SHA512.prototype._update = function _update(msg, start) {
35585 this._prepareBlock(msg, start);
35586
35587 var W = this.W;
35588
35589 var ah = this.h[0];
35590 var al = this.h[1];
35591 var bh = this.h[2];
35592 var bl = this.h[3];
35593 var ch = this.h[4];
35594 var cl = this.h[5];
35595 var dh = this.h[6];
35596 var dl = this.h[7];
35597 var eh = this.h[8];
35598 var el = this.h[9];
35599 var fh = this.h[10];
35600 var fl = this.h[11];
35601 var gh = this.h[12];
35602 var gl = this.h[13];
35603 var hh = this.h[14];
35604 var hl = this.h[15];
35605
35606 assert(this.k.length === W.length);
35607 for (var i = 0; i < W.length; i += 2) {
35608 var c0_hi = hh;
35609 var c0_lo = hl;
35610 var c1_hi = s1_512_hi(eh, el);
35611 var c1_lo = s1_512_lo(eh, el);
35612 var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
35613 var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
35614 var c3_hi = this.k[i];
35615 var c3_lo = this.k[i + 1];
35616 var c4_hi = W[i];
35617 var c4_lo = W[i + 1];
35618
35619 var T1_hi = sum64_5_hi(c0_hi, c0_lo,
35620 c1_hi, c1_lo,
35621 c2_hi, c2_lo,
35622 c3_hi, c3_lo,
35623 c4_hi, c4_lo);
35624 var T1_lo = sum64_5_lo(c0_hi, c0_lo,
35625 c1_hi, c1_lo,
35626 c2_hi, c2_lo,
35627 c3_hi, c3_lo,
35628 c4_hi, c4_lo);
35629
35630 var c0_hi = s0_512_hi(ah, al);
35631 var c0_lo = s0_512_lo(ah, al);
35632 var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
35633 var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
35634
35635 var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
35636 var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
35637
35638 hh = gh;
35639 hl = gl;
35640
35641 gh = fh;
35642 gl = fl;
35643
35644 fh = eh;
35645 fl = el;
35646
35647 eh = sum64_hi(dh, dl, T1_hi, T1_lo);
35648 el = sum64_lo(dl, dl, T1_hi, T1_lo);
35649
35650 dh = ch;
35651 dl = cl;
35652
35653 ch = bh;
35654 cl = bl;
35655
35656 bh = ah;
35657 bl = al;
35658
35659 ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
35660 al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
35661 }
35662
35663 sum64(this.h, 0, ah, al);
35664 sum64(this.h, 2, bh, bl);
35665 sum64(this.h, 4, ch, cl);
35666 sum64(this.h, 6, dh, dl);
35667 sum64(this.h, 8, eh, el);
35668 sum64(this.h, 10, fh, fl);
35669 sum64(this.h, 12, gh, gl);
35670 sum64(this.h, 14, hh, hl);
35671};
35672
35673SHA512.prototype._digest = function digest(enc) {
35674 if (enc === 'hex')
35675 return utils.toHex32(this.h, 'big');
35676 else
35677 return utils.split32(this.h, 'big');
35678};
35679
35680function SHA384() {
35681 if (!(this instanceof SHA384))
35682 return new SHA384();
35683
35684 SHA512.call(this);
35685 this.h = [ 0xcbbb9d5d, 0xc1059ed8,
35686 0x629a292a, 0x367cd507,
35687 0x9159015a, 0x3070dd17,
35688 0x152fecd8, 0xf70e5939,
35689 0x67332667, 0xffc00b31,
35690 0x8eb44a87, 0x68581511,
35691 0xdb0c2e0d, 0x64f98fa7,
35692 0x47b5481d, 0xbefa4fa4 ];
35693}
35694utils.inherits(SHA384, SHA512);
35695exports.sha384 = SHA384;
35696
35697SHA384.blockSize = 1024;
35698SHA384.outSize = 384;
35699SHA384.hmacStrength = 192;
35700SHA384.padLength = 128;
35701
35702SHA384.prototype._digest = function digest(enc) {
35703 if (enc === 'hex')
35704 return utils.toHex32(this.h.slice(0, 12), 'big');
35705 else
35706 return utils.split32(this.h.slice(0, 12), 'big');
35707};
35708
35709function SHA1() {
35710 if (!(this instanceof SHA1))
35711 return new SHA1();
35712
35713 BlockHash.call(this);
35714 this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe,
35715 0x10325476, 0xc3d2e1f0 ];
35716 this.W = new Array(80);
35717}
35718
35719utils.inherits(SHA1, BlockHash);
35720exports.sha1 = SHA1;
35721
35722SHA1.blockSize = 512;
35723SHA1.outSize = 160;
35724SHA1.hmacStrength = 80;
35725SHA1.padLength = 64;
35726
35727SHA1.prototype._update = function _update(msg, start) {
35728 var W = this.W;
35729
35730 for (var i = 0; i < 16; i++)
35731 W[i] = msg[start + i];
35732
35733 for(; i < W.length; i++)
35734 W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
35735
35736 var a = this.h[0];
35737 var b = this.h[1];
35738 var c = this.h[2];
35739 var d = this.h[3];
35740 var e = this.h[4];
35741
35742 for (var i = 0; i < W.length; i++) {
35743 var s = ~~(i / 20);
35744 var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
35745 e = d;
35746 d = c;
35747 c = rotl32(b, 30);
35748 b = a;
35749 a = t;
35750 }
35751
35752 this.h[0] = sum32(this.h[0], a);
35753 this.h[1] = sum32(this.h[1], b);
35754 this.h[2] = sum32(this.h[2], c);
35755 this.h[3] = sum32(this.h[3], d);
35756 this.h[4] = sum32(this.h[4], e);
35757};
35758
35759SHA1.prototype._digest = function digest(enc) {
35760 if (enc === 'hex')
35761 return utils.toHex32(this.h, 'big');
35762 else
35763 return utils.split32(this.h, 'big');
35764};
35765
35766function ch32(x, y, z) {
35767 return (x & y) ^ ((~x) & z);
35768}
35769
35770function maj32(x, y, z) {
35771 return (x & y) ^ (x & z) ^ (y & z);
35772}
35773
35774function p32(x, y, z) {
35775 return x ^ y ^ z;
35776}
35777
35778function s0_256(x) {
35779 return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
35780}
35781
35782function s1_256(x) {
35783 return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
35784}
35785
35786function g0_256(x) {
35787 return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
35788}
35789
35790function g1_256(x) {
35791 return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
35792}
35793
35794function ft_1(s, x, y, z) {
35795 if (s === 0)
35796 return ch32(x, y, z);
35797 if (s === 1 || s === 3)
35798 return p32(x, y, z);
35799 if (s === 2)
35800 return maj32(x, y, z);
35801}
35802
35803function ch64_hi(xh, xl, yh, yl, zh, zl) {
35804 var r = (xh & yh) ^ ((~xh) & zh);
35805 if (r < 0)
35806 r += 0x100000000;
35807 return r;
35808}
35809
35810function ch64_lo(xh, xl, yh, yl, zh, zl) {
35811 var r = (xl & yl) ^ ((~xl) & zl);
35812 if (r < 0)
35813 r += 0x100000000;
35814 return r;
35815}
35816
35817function maj64_hi(xh, xl, yh, yl, zh, zl) {
35818 var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
35819 if (r < 0)
35820 r += 0x100000000;
35821 return r;
35822}
35823
35824function maj64_lo(xh, xl, yh, yl, zh, zl) {
35825 var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
35826 if (r < 0)
35827 r += 0x100000000;
35828 return r;
35829}
35830
35831function s0_512_hi(xh, xl) {
35832 var c0_hi = rotr64_hi(xh, xl, 28);
35833 var c1_hi = rotr64_hi(xl, xh, 2); // 34
35834 var c2_hi = rotr64_hi(xl, xh, 7); // 39
35835
35836 var r = c0_hi ^ c1_hi ^ c2_hi;
35837 if (r < 0)
35838 r += 0x100000000;
35839 return r;
35840}
35841
35842function s0_512_lo(xh, xl) {
35843 var c0_lo = rotr64_lo(xh, xl, 28);
35844 var c1_lo = rotr64_lo(xl, xh, 2); // 34
35845 var c2_lo = rotr64_lo(xl, xh, 7); // 39
35846
35847 var r = c0_lo ^ c1_lo ^ c2_lo;
35848 if (r < 0)
35849 r += 0x100000000;
35850 return r;
35851}
35852
35853function s1_512_hi(xh, xl) {
35854 var c0_hi = rotr64_hi(xh, xl, 14);
35855 var c1_hi = rotr64_hi(xh, xl, 18);
35856 var c2_hi = rotr64_hi(xl, xh, 9); // 41
35857
35858 var r = c0_hi ^ c1_hi ^ c2_hi;
35859 if (r < 0)
35860 r += 0x100000000;
35861 return r;
35862}
35863
35864function s1_512_lo(xh, xl) {
35865 var c0_lo = rotr64_lo(xh, xl, 14);
35866 var c1_lo = rotr64_lo(xh, xl, 18);
35867 var c2_lo = rotr64_lo(xl, xh, 9); // 41
35868
35869 var r = c0_lo ^ c1_lo ^ c2_lo;
35870 if (r < 0)
35871 r += 0x100000000;
35872 return r;
35873}
35874
35875function g0_512_hi(xh, xl) {
35876 var c0_hi = rotr64_hi(xh, xl, 1);
35877 var c1_hi = rotr64_hi(xh, xl, 8);
35878 var c2_hi = shr64_hi(xh, xl, 7);
35879
35880 var r = c0_hi ^ c1_hi ^ c2_hi;
35881 if (r < 0)
35882 r += 0x100000000;
35883 return r;
35884}
35885
35886function g0_512_lo(xh, xl) {
35887 var c0_lo = rotr64_lo(xh, xl, 1);
35888 var c1_lo = rotr64_lo(xh, xl, 8);
35889 var c2_lo = shr64_lo(xh, xl, 7);
35890
35891 var r = c0_lo ^ c1_lo ^ c2_lo;
35892 if (r < 0)
35893 r += 0x100000000;
35894 return r;
35895}
35896
35897function g1_512_hi(xh, xl) {
35898 var c0_hi = rotr64_hi(xh, xl, 19);
35899 var c1_hi = rotr64_hi(xl, xh, 29); // 61
35900 var c2_hi = shr64_hi(xh, xl, 6);
35901
35902 var r = c0_hi ^ c1_hi ^ c2_hi;
35903 if (r < 0)
35904 r += 0x100000000;
35905 return r;
35906}
35907
35908function g1_512_lo(xh, xl) {
35909 var c0_lo = rotr64_lo(xh, xl, 19);
35910 var c1_lo = rotr64_lo(xl, xh, 29); // 61
35911 var c2_lo = shr64_lo(xh, xl, 6);
35912
35913 var r = c0_lo ^ c1_lo ^ c2_lo;
35914 if (r < 0)
35915 r += 0x100000000;
35916 return r;
35917}
35918
35919},{"../hash":57}],62:[function(require,module,exports){
35920var utils = exports;
35921var inherits = require('inherits');
35922
35923function toArray(msg, enc) {
35924 if (Array.isArray(msg))
35925 return msg.slice();
35926 if (!msg)
35927 return [];
35928 var res = [];
35929 if (typeof msg === 'string') {
35930 if (!enc) {
35931 for (var i = 0; i < msg.length; i++) {
35932 var c = msg.charCodeAt(i);
35933 var hi = c >> 8;
35934 var lo = c & 0xff;
35935 if (hi)
35936 res.push(hi, lo);
35937 else
35938 res.push(lo);
35939 }
35940 } else if (enc === 'hex') {
35941 msg = msg.replace(/[^a-z0-9]+/ig, '');
35942 if (msg.length % 2 !== 0)
35943 msg = '0' + msg;
35944 for (var i = 0; i < msg.length; i += 2)
35945 res.push(parseInt(msg[i] + msg[i + 1], 16));
35946 }
35947 } else {
35948 for (var i = 0; i < msg.length; i++)
35949 res[i] = msg[i] | 0;
35950 }
35951 return res;
35952}
35953utils.toArray = toArray;
35954
35955function toHex(msg) {
35956 var res = '';
35957 for (var i = 0; i < msg.length; i++)
35958 res += zero2(msg[i].toString(16));
35959 return res;
35960}
35961utils.toHex = toHex;
35962
35963function htonl(w) {
35964 var res = (w >>> 24) |
35965 ((w >>> 8) & 0xff00) |
35966 ((w << 8) & 0xff0000) |
35967 ((w & 0xff) << 24);
35968 return res >>> 0;
35969}
35970utils.htonl = htonl;
35971
35972function toHex32(msg, endian) {
35973 var res = '';
35974 for (var i = 0; i < msg.length; i++) {
35975 var w = msg[i];
35976 if (endian === 'little')
35977 w = htonl(w);
35978 res += zero8(w.toString(16));
35979 }
35980 return res;
35981}
35982utils.toHex32 = toHex32;
35983
35984function zero2(word) {
35985 if (word.length === 1)
35986 return '0' + word;
35987 else
35988 return word;
35989}
35990utils.zero2 = zero2;
35991
35992function zero8(word) {
35993 if (word.length === 7)
35994 return '0' + word;
35995 else if (word.length === 6)
35996 return '00' + word;
35997 else if (word.length === 5)
35998 return '000' + word;
35999 else if (word.length === 4)
36000 return '0000' + word;
36001 else if (word.length === 3)
36002 return '00000' + word;
36003 else if (word.length === 2)
36004 return '000000' + word;
36005 else if (word.length === 1)
36006 return '0000000' + word;
36007 else
36008 return word;
36009}
36010utils.zero8 = zero8;
36011
36012function join32(msg, start, end, endian) {
36013 var len = end - start;
36014 assert(len % 4 === 0);
36015 var res = new Array(len / 4);
36016 for (var i = 0, k = start; i < res.length; i++, k += 4) {
36017 var w;
36018 if (endian === 'big')
36019 w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
36020 else
36021 w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
36022 res[i] = w >>> 0;
36023 }
36024 return res;
36025}
36026utils.join32 = join32;
36027
36028function split32(msg, endian) {
36029 var res = new Array(msg.length * 4);
36030 for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
36031 var m = msg[i];
36032 if (endian === 'big') {
36033 res[k] = m >>> 24;
36034 res[k + 1] = (m >>> 16) & 0xff;
36035 res[k + 2] = (m >>> 8) & 0xff;
36036 res[k + 3] = m & 0xff;
36037 } else {
36038 res[k + 3] = m >>> 24;
36039 res[k + 2] = (m >>> 16) & 0xff;
36040 res[k + 1] = (m >>> 8) & 0xff;
36041 res[k] = m & 0xff;
36042 }
36043 }
36044 return res;
36045}
36046utils.split32 = split32;
36047
36048function rotr32(w, b) {
36049 return (w >>> b) | (w << (32 - b));
36050}
36051utils.rotr32 = rotr32;
36052
36053function rotl32(w, b) {
36054 return (w << b) | (w >>> (32 - b));
36055}
36056utils.rotl32 = rotl32;
36057
36058function sum32(a, b) {
36059 return (a + b) >>> 0;
36060}
36061utils.sum32 = sum32;
36062
36063function sum32_3(a, b, c) {
36064 return (a + b + c) >>> 0;
36065}
36066utils.sum32_3 = sum32_3;
36067
36068function sum32_4(a, b, c, d) {
36069 return (a + b + c + d) >>> 0;
36070}
36071utils.sum32_4 = sum32_4;
36072
36073function sum32_5(a, b, c, d, e) {
36074 return (a + b + c + d + e) >>> 0;
36075}
36076utils.sum32_5 = sum32_5;
36077
36078function assert(cond, msg) {
36079 if (!cond)
36080 throw new Error(msg || 'Assertion failed');
36081}
36082utils.assert = assert;
36083
36084utils.inherits = inherits;
36085
36086function sum64(buf, pos, ah, al) {
36087 var bh = buf[pos];
36088 var bl = buf[pos + 1];
36089
36090 var lo = (al + bl) >>> 0;
36091 var hi = (lo < al ? 1 : 0) + ah + bh;
36092 buf[pos] = hi >>> 0;
36093 buf[pos + 1] = lo;
36094}
36095exports.sum64 = sum64;
36096
36097function sum64_hi(ah, al, bh, bl) {
36098 var lo = (al + bl) >>> 0;
36099 var hi = (lo < al ? 1 : 0) + ah + bh;
36100 return hi >>> 0;
36101};
36102exports.sum64_hi = sum64_hi;
36103
36104function sum64_lo(ah, al, bh, bl) {
36105 var lo = al + bl;
36106 return lo >>> 0;
36107};
36108exports.sum64_lo = sum64_lo;
36109
36110function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
36111 var carry = 0;
36112 var lo = al;
36113 lo = (lo + bl) >>> 0;
36114 carry += lo < al ? 1 : 0;
36115 lo = (lo + cl) >>> 0;
36116 carry += lo < cl ? 1 : 0;
36117 lo = (lo + dl) >>> 0;
36118 carry += lo < dl ? 1 : 0;
36119
36120 var hi = ah + bh + ch + dh + carry;
36121 return hi >>> 0;
36122};
36123exports.sum64_4_hi = sum64_4_hi;
36124
36125function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
36126 var lo = al + bl + cl + dl;
36127 return lo >>> 0;
36128};
36129exports.sum64_4_lo = sum64_4_lo;
36130
36131function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
36132 var carry = 0;
36133 var lo = al;
36134 lo = (lo + bl) >>> 0;
36135 carry += lo < al ? 1 : 0;
36136 lo = (lo + cl) >>> 0;
36137 carry += lo < cl ? 1 : 0;
36138 lo = (lo + dl) >>> 0;
36139 carry += lo < dl ? 1 : 0;
36140 lo = (lo + el) >>> 0;
36141 carry += lo < el ? 1 : 0;
36142
36143 var hi = ah + bh + ch + dh + eh + carry;
36144 return hi >>> 0;
36145};
36146exports.sum64_5_hi = sum64_5_hi;
36147
36148function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
36149 var lo = al + bl + cl + dl + el;
36150
36151 return lo >>> 0;
36152};
36153exports.sum64_5_lo = sum64_5_lo;
36154
36155function rotr64_hi(ah, al, num) {
36156 var r = (al << (32 - num)) | (ah >>> num);
36157 return r >>> 0;
36158};
36159exports.rotr64_hi = rotr64_hi;
36160
36161function rotr64_lo(ah, al, num) {
36162 var r = (ah << (32 - num)) | (al >>> num);
36163 return r >>> 0;
36164};
36165exports.rotr64_lo = rotr64_lo;
36166
36167function shr64_hi(ah, al, num) {
36168 return ah >>> num;
36169};
36170exports.shr64_hi = shr64_hi;
36171
36172function shr64_lo(ah, al, num) {
36173 var r = (ah << (32 - num)) | (al >>> num);
36174 return r >>> 0;
36175};
36176exports.shr64_lo = shr64_lo;
36177
36178},{"inherits":63}],63:[function(require,module,exports){
36179arguments[4][9][0].apply(exports,arguments)
36180},{"dup":9}],64:[function(require,module,exports){
36181/**
36182 * Returns a `Boolean` on whether or not the a `String` starts with '0x'
36183 * @param {String} str the string input value
36184 * @return {Boolean} a boolean if it is or is not hex prefixed
36185 * @throws if the str input is not a string
36186 */
36187module.exports = function isHexPrefixed(str) {
36188 if (typeof str !== 'string') {
36189 throw new Error("[is-hex-prefixed] value must be type 'string', is currently type " + (typeof str) + ", while checking isHexPrefixed.");
36190 }
36191
36192 return str.slice(0, 2) === '0x';
36193}
36194
36195},{}],65:[function(require,module,exports){
36196'use strict'
36197module.exports = require('./lib/api')(require('./lib/keccak'))
36198
36199},{"./lib/api":66,"./lib/keccak":70}],66:[function(require,module,exports){
36200'use strict'
36201var createKeccak = require('./keccak')
36202var createShake = require('./shake')
36203
36204module.exports = function (KeccakState) {
36205 var Keccak = createKeccak(KeccakState)
36206 var Shake = createShake(KeccakState)
36207
36208 return function (algorithm, options) {
36209 var hash = typeof algorithm === 'string' ? algorithm.toLowerCase() : algorithm
36210 switch (hash) {
36211 case 'keccak224': return new Keccak(1152, 448, null, 224, options)
36212 case 'keccak256': return new Keccak(1088, 512, null, 256, options)
36213 case 'keccak384': return new Keccak(832, 768, null, 384, options)
36214 case 'keccak512': return new Keccak(576, 1024, null, 512, options)
36215
36216 case 'sha3-224': return new Keccak(1152, 448, 0x06, 224, options)
36217 case 'sha3-256': return new Keccak(1088, 512, 0x06, 256, options)
36218 case 'sha3-384': return new Keccak(832, 768, 0x06, 384, options)
36219 case 'sha3-512': return new Keccak(576, 1024, 0x06, 512, options)
36220
36221 case 'shake128': return new Shake(1344, 256, 0x1f, options)
36222 case 'shake256': return new Shake(1088, 512, 0x1f, options)
36223
36224 default: throw new Error('Invald algorithm: ' + algorithm)
36225 }
36226 }
36227}
36228
36229},{"./keccak":67,"./shake":68}],67:[function(require,module,exports){
36230(function (Buffer){
36231'use strict'
36232var Transform = require('stream').Transform
36233var inherits = require('inherits')
36234
36235module.exports = function (KeccakState) {
36236 function Keccak (rate, capacity, delimitedSuffix, hashBitLength, options) {
36237 Transform.call(this, options)
36238
36239 this._rate = rate
36240 this._capacity = capacity
36241 this._delimitedSuffix = delimitedSuffix
36242 this._hashBitLength = hashBitLength
36243 this._options = options
36244
36245 this._state = new KeccakState()
36246 this._state.initialize(rate, capacity)
36247 this._finalized = false
36248 }
36249
36250 inherits(Keccak, Transform)
36251
36252 Keccak.prototype._transform = function (chunk, encoding, callback) {
36253 var error = null
36254 try {
36255 this.update(chunk, encoding)
36256 } catch (err) {
36257 error = err
36258 }
36259
36260 callback(error)
36261 }
36262
36263 Keccak.prototype._flush = function (callback) {
36264 var error = null
36265 try {
36266 this.push(this.digest())
36267 } catch (err) {
36268 error = err
36269 }
36270
36271 callback(error)
36272 }
36273
36274 Keccak.prototype.update = function (data, encoding) {
36275 if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer')
36276 if (this._finalized) throw new Error('Digest already called')
36277 if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
36278
36279 this._state.absorb(data)
36280
36281 return this
36282 }
36283
36284 Keccak.prototype.digest = function (encoding) {
36285 if (this._finalized) throw new Error('Digest already called')
36286 this._finalized = true
36287
36288 if (this._delimitedSuffix) this._state.absorbLastFewBits(this._delimitedSuffix)
36289 var digest = this._state.squeeze(this._hashBitLength / 8)
36290 if (encoding !== undefined) digest = digest.toString(encoding)
36291
36292 this._resetState()
36293
36294 return digest
36295 }
36296
36297 // remove result from memory
36298 Keccak.prototype._resetState = function () {
36299 this._state.initialize(this._rate, this._capacity)
36300 return this
36301 }
36302
36303 // because sometimes we need hash right now and little later
36304 Keccak.prototype._clone = function () {
36305 var clone = new Keccak(this._rate, this._capacity, this._delimitedSuffix, this._hashBitLength, this._options)
36306 this._state.copy(clone._state)
36307 clone._finalized = this._finalized
36308
36309 return clone
36310 }
36311
36312 return Keccak
36313}
36314
36315}).call(this,require("buffer").Buffer)
36316},{"buffer":5,"inherits":63,"stream":25}],68:[function(require,module,exports){
36317(function (Buffer){
36318'use strict'
36319var Transform = require('stream').Transform
36320var inherits = require('inherits')
36321
36322module.exports = function (KeccakState) {
36323 function Shake (rate, capacity, delimitedSuffix, options) {
36324 Transform.call(this, options)
36325
36326 this._rate = rate
36327 this._capacity = capacity
36328 this._delimitedSuffix = delimitedSuffix
36329 this._options = options
36330
36331 this._state = new KeccakState()
36332 this._state.initialize(rate, capacity)
36333 this._finalized = false
36334 }
36335
36336 inherits(Shake, Transform)
36337
36338 Shake.prototype._transform = function (chunk, encoding, callback) {
36339 var error = null
36340 try {
36341 this.update(chunk, encoding)
36342 } catch (err) {
36343 error = err
36344 }
36345
36346 callback(error)
36347 }
36348
36349 Shake.prototype._flush = function () {}
36350
36351 Shake.prototype._read = function (size) {
36352 this.push(this.squeeze(size))
36353 }
36354
36355 Shake.prototype.update = function (data, encoding) {
36356 if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer')
36357 if (this._finalized) throw new Error('Squeeze already called')
36358 if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
36359
36360 this._state.absorb(data)
36361
36362 return this
36363 }
36364
36365 Shake.prototype.squeeze = function (dataByteLength, encoding) {
36366 if (!this._finalized) {
36367 this._finalized = true
36368 this._state.absorbLastFewBits(this._delimitedSuffix)
36369 }
36370
36371 var data = this._state.squeeze(dataByteLength)
36372 if (encoding !== undefined) data = data.toString(encoding)
36373
36374 return data
36375 }
36376
36377 Shake.prototype._resetState = function () {
36378 this._state.initialize(this._rate, this._capacity)
36379 return this
36380 }
36381
36382 Shake.prototype._clone = function () {
36383 var clone = new Shake(this._rate, this._capacity, this._delimitedSuffix, this._options)
36384 this._state.copy(clone._state)
36385 clone._finalized = this._finalized
36386
36387 return clone
36388 }
36389
36390 return Shake
36391}
36392
36393}).call(this,require("buffer").Buffer)
36394},{"buffer":5,"inherits":63,"stream":25}],69:[function(require,module,exports){
36395'use strict'
36396var P1600_ROUND_CONSTANTS = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]
36397
36398exports.p1600 = function (s) {
36399 for (var round = 0; round < 24; ++round) {
36400 // theta
36401 var lo0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]
36402 var hi0 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]
36403 var lo1 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]
36404 var hi1 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]
36405 var lo2 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]
36406 var hi2 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]
36407 var lo3 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]
36408 var hi3 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]
36409 var lo4 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]
36410 var hi4 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]
36411
36412 var lo = lo4 ^ (lo1 << 1 | hi1 >>> 31)
36413 var hi = hi4 ^ (hi1 << 1 | lo1 >>> 31)
36414 var t1slo0 = s[0] ^ lo
36415 var t1shi0 = s[1] ^ hi
36416 var t1slo5 = s[10] ^ lo
36417 var t1shi5 = s[11] ^ hi
36418 var t1slo10 = s[20] ^ lo
36419 var t1shi10 = s[21] ^ hi
36420 var t1slo15 = s[30] ^ lo
36421 var t1shi15 = s[31] ^ hi
36422 var t1slo20 = s[40] ^ lo
36423 var t1shi20 = s[41] ^ hi
36424 lo = lo0 ^ (lo2 << 1 | hi2 >>> 31)
36425 hi = hi0 ^ (hi2 << 1 | lo2 >>> 31)
36426 var t1slo1 = s[2] ^ lo
36427 var t1shi1 = s[3] ^ hi
36428 var t1slo6 = s[12] ^ lo
36429 var t1shi6 = s[13] ^ hi
36430 var t1slo11 = s[22] ^ lo
36431 var t1shi11 = s[23] ^ hi
36432 var t1slo16 = s[32] ^ lo
36433 var t1shi16 = s[33] ^ hi
36434 var t1slo21 = s[42] ^ lo
36435 var t1shi21 = s[43] ^ hi
36436 lo = lo1 ^ (lo3 << 1 | hi3 >>> 31)
36437 hi = hi1 ^ (hi3 << 1 | lo3 >>> 31)
36438 var t1slo2 = s[4] ^ lo
36439 var t1shi2 = s[5] ^ hi
36440 var t1slo7 = s[14] ^ lo
36441 var t1shi7 = s[15] ^ hi
36442 var t1slo12 = s[24] ^ lo
36443 var t1shi12 = s[25] ^ hi
36444 var t1slo17 = s[34] ^ lo
36445 var t1shi17 = s[35] ^ hi
36446 var t1slo22 = s[44] ^ lo
36447 var t1shi22 = s[45] ^ hi
36448 lo = lo2 ^ (lo4 << 1 | hi4 >>> 31)
36449 hi = hi2 ^ (hi4 << 1 | lo4 >>> 31)
36450 var t1slo3 = s[6] ^ lo
36451 var t1shi3 = s[7] ^ hi
36452 var t1slo8 = s[16] ^ lo
36453 var t1shi8 = s[17] ^ hi
36454 var t1slo13 = s[26] ^ lo
36455 var t1shi13 = s[27] ^ hi
36456 var t1slo18 = s[36] ^ lo
36457 var t1shi18 = s[37] ^ hi
36458 var t1slo23 = s[46] ^ lo
36459 var t1shi23 = s[47] ^ hi
36460 lo = lo3 ^ (lo0 << 1 | hi0 >>> 31)
36461 hi = hi3 ^ (hi0 << 1 | lo0 >>> 31)
36462 var t1slo4 = s[8] ^ lo
36463 var t1shi4 = s[9] ^ hi
36464 var t1slo9 = s[18] ^ lo
36465 var t1shi9 = s[19] ^ hi
36466 var t1slo14 = s[28] ^ lo
36467 var t1shi14 = s[29] ^ hi
36468 var t1slo19 = s[38] ^ lo
36469 var t1shi19 = s[39] ^ hi
36470 var t1slo24 = s[48] ^ lo
36471 var t1shi24 = s[49] ^ hi
36472
36473 // rho & pi
36474 var t2slo0 = t1slo0
36475 var t2shi0 = t1shi0
36476 var t2slo16 = (t1shi5 << 4 | t1slo5 >>> 28)
36477 var t2shi16 = (t1slo5 << 4 | t1shi5 >>> 28)
36478 var t2slo7 = (t1slo10 << 3 | t1shi10 >>> 29)
36479 var t2shi7 = (t1shi10 << 3 | t1slo10 >>> 29)
36480 var t2slo23 = (t1shi15 << 9 | t1slo15 >>> 23)
36481 var t2shi23 = (t1slo15 << 9 | t1shi15 >>> 23)
36482 var t2slo14 = (t1slo20 << 18 | t1shi20 >>> 14)
36483 var t2shi14 = (t1shi20 << 18 | t1slo20 >>> 14)
36484 var t2slo10 = (t1slo1 << 1 | t1shi1 >>> 31)
36485 var t2shi10 = (t1shi1 << 1 | t1slo1 >>> 31)
36486 var t2slo1 = (t1shi6 << 12 | t1slo6 >>> 20)
36487 var t2shi1 = (t1slo6 << 12 | t1shi6 >>> 20)
36488 var t2slo17 = (t1slo11 << 10 | t1shi11 >>> 22)
36489 var t2shi17 = (t1shi11 << 10 | t1slo11 >>> 22)
36490 var t2slo8 = (t1shi16 << 13 | t1slo16 >>> 19)
36491 var t2shi8 = (t1slo16 << 13 | t1shi16 >>> 19)
36492 var t2slo24 = (t1slo21 << 2 | t1shi21 >>> 30)
36493 var t2shi24 = (t1shi21 << 2 | t1slo21 >>> 30)
36494 var t2slo20 = (t1shi2 << 30 | t1slo2 >>> 2)
36495 var t2shi20 = (t1slo2 << 30 | t1shi2 >>> 2)
36496 var t2slo11 = (t1slo7 << 6 | t1shi7 >>> 26)
36497 var t2shi11 = (t1shi7 << 6 | t1slo7 >>> 26)
36498 var t2slo2 = (t1shi12 << 11 | t1slo12 >>> 21)
36499 var t2shi2 = (t1slo12 << 11 | t1shi12 >>> 21)
36500 var t2slo18 = (t1slo17 << 15 | t1shi17 >>> 17)
36501 var t2shi18 = (t1shi17 << 15 | t1slo17 >>> 17)
36502 var t2slo9 = (t1shi22 << 29 | t1slo22 >>> 3)
36503 var t2shi9 = (t1slo22 << 29 | t1shi22 >>> 3)
36504 var t2slo5 = (t1slo3 << 28 | t1shi3 >>> 4)
36505 var t2shi5 = (t1shi3 << 28 | t1slo3 >>> 4)
36506 var t2slo21 = (t1shi8 << 23 | t1slo8 >>> 9)
36507 var t2shi21 = (t1slo8 << 23 | t1shi8 >>> 9)
36508 var t2slo12 = (t1slo13 << 25 | t1shi13 >>> 7)
36509 var t2shi12 = (t1shi13 << 25 | t1slo13 >>> 7)
36510 var t2slo3 = (t1slo18 << 21 | t1shi18 >>> 11)
36511 var t2shi3 = (t1shi18 << 21 | t1slo18 >>> 11)
36512 var t2slo19 = (t1shi23 << 24 | t1slo23 >>> 8)
36513 var t2shi19 = (t1slo23 << 24 | t1shi23 >>> 8)
36514 var t2slo15 = (t1slo4 << 27 | t1shi4 >>> 5)
36515 var t2shi15 = (t1shi4 << 27 | t1slo4 >>> 5)
36516 var t2slo6 = (t1slo9 << 20 | t1shi9 >>> 12)
36517 var t2shi6 = (t1shi9 << 20 | t1slo9 >>> 12)
36518 var t2slo22 = (t1shi14 << 7 | t1slo14 >>> 25)
36519 var t2shi22 = (t1slo14 << 7 | t1shi14 >>> 25)
36520 var t2slo13 = (t1slo19 << 8 | t1shi19 >>> 24)
36521 var t2shi13 = (t1shi19 << 8 | t1slo19 >>> 24)
36522 var t2slo4 = (t1slo24 << 14 | t1shi24 >>> 18)
36523 var t2shi4 = (t1shi24 << 14 | t1slo24 >>> 18)
36524
36525 // chi
36526 s[0] = t2slo0 ^ (~t2slo1 & t2slo2)
36527 s[1] = t2shi0 ^ (~t2shi1 & t2shi2)
36528 s[10] = t2slo5 ^ (~t2slo6 & t2slo7)
36529 s[11] = t2shi5 ^ (~t2shi6 & t2shi7)
36530 s[20] = t2slo10 ^ (~t2slo11 & t2slo12)
36531 s[21] = t2shi10 ^ (~t2shi11 & t2shi12)
36532 s[30] = t2slo15 ^ (~t2slo16 & t2slo17)
36533 s[31] = t2shi15 ^ (~t2shi16 & t2shi17)
36534 s[40] = t2slo20 ^ (~t2slo21 & t2slo22)
36535 s[41] = t2shi20 ^ (~t2shi21 & t2shi22)
36536 s[2] = t2slo1 ^ (~t2slo2 & t2slo3)
36537 s[3] = t2shi1 ^ (~t2shi2 & t2shi3)
36538 s[12] = t2slo6 ^ (~t2slo7 & t2slo8)
36539 s[13] = t2shi6 ^ (~t2shi7 & t2shi8)
36540 s[22] = t2slo11 ^ (~t2slo12 & t2slo13)
36541 s[23] = t2shi11 ^ (~t2shi12 & t2shi13)
36542 s[32] = t2slo16 ^ (~t2slo17 & t2slo18)
36543 s[33] = t2shi16 ^ (~t2shi17 & t2shi18)
36544 s[42] = t2slo21 ^ (~t2slo22 & t2slo23)
36545 s[43] = t2shi21 ^ (~t2shi22 & t2shi23)
36546 s[4] = t2slo2 ^ (~t2slo3 & t2slo4)
36547 s[5] = t2shi2 ^ (~t2shi3 & t2shi4)
36548 s[14] = t2slo7 ^ (~t2slo8 & t2slo9)
36549 s[15] = t2shi7 ^ (~t2shi8 & t2shi9)
36550 s[24] = t2slo12 ^ (~t2slo13 & t2slo14)
36551 s[25] = t2shi12 ^ (~t2shi13 & t2shi14)
36552 s[34] = t2slo17 ^ (~t2slo18 & t2slo19)
36553 s[35] = t2shi17 ^ (~t2shi18 & t2shi19)
36554 s[44] = t2slo22 ^ (~t2slo23 & t2slo24)
36555 s[45] = t2shi22 ^ (~t2shi23 & t2shi24)
36556 s[6] = t2slo3 ^ (~t2slo4 & t2slo0)
36557 s[7] = t2shi3 ^ (~t2shi4 & t2shi0)
36558 s[16] = t2slo8 ^ (~t2slo9 & t2slo5)
36559 s[17] = t2shi8 ^ (~t2shi9 & t2shi5)
36560 s[26] = t2slo13 ^ (~t2slo14 & t2slo10)
36561 s[27] = t2shi13 ^ (~t2shi14 & t2shi10)
36562 s[36] = t2slo18 ^ (~t2slo19 & t2slo15)
36563 s[37] = t2shi18 ^ (~t2shi19 & t2shi15)
36564 s[46] = t2slo23 ^ (~t2slo24 & t2slo20)
36565 s[47] = t2shi23 ^ (~t2shi24 & t2shi20)
36566 s[8] = t2slo4 ^ (~t2slo0 & t2slo1)
36567 s[9] = t2shi4 ^ (~t2shi0 & t2shi1)
36568 s[18] = t2slo9 ^ (~t2slo5 & t2slo6)
36569 s[19] = t2shi9 ^ (~t2shi5 & t2shi6)
36570 s[28] = t2slo14 ^ (~t2slo10 & t2slo11)
36571 s[29] = t2shi14 ^ (~t2shi10 & t2shi11)
36572 s[38] = t2slo19 ^ (~t2slo15 & t2slo16)
36573 s[39] = t2shi19 ^ (~t2shi15 & t2shi16)
36574 s[48] = t2slo24 ^ (~t2slo20 & t2slo21)
36575 s[49] = t2shi24 ^ (~t2shi20 & t2shi21)
36576
36577 // iota
36578 s[0] ^= P1600_ROUND_CONSTANTS[round * 2]
36579 s[1] ^= P1600_ROUND_CONSTANTS[round * 2 + 1]
36580 }
36581}
36582
36583},{}],70:[function(require,module,exports){
36584(function (Buffer){
36585'use strict'
36586var keccakState = require('./keccak-state-unroll')
36587
36588function Keccak () {
36589 // much faster than `new Array(50)`
36590 this.state = [
36591 0, 0, 0, 0, 0,
36592 0, 0, 0, 0, 0,
36593 0, 0, 0, 0, 0,
36594 0, 0, 0, 0, 0,
36595 0, 0, 0, 0, 0
36596 ]
36597
36598 this.blockSize = null
36599 this.count = 0
36600 this.squeezing = false
36601}
36602
36603Keccak.prototype.initialize = function (rate, capacity) {
36604 for (var i = 0; i < 50; ++i) this.state[i] = 0
36605 this.blockSize = rate / 8
36606 this.count = 0
36607 this.squeezing = false
36608}
36609
36610Keccak.prototype.absorb = function (data) {
36611 for (var i = 0; i < data.length; ++i) {
36612 this.state[~~(this.count / 4)] ^= data[i] << (8 * (this.count % 4))
36613 this.count += 1
36614 if (this.count === this.blockSize) {
36615 keccakState.p1600(this.state)
36616 this.count = 0
36617 }
36618 }
36619}
36620
36621Keccak.prototype.absorbLastFewBits = function (bits) {
36622 this.state[~~(this.count / 4)] ^= bits << (8 * (this.count % 4))
36623 if ((bits & 0x80) !== 0 && this.count === (this.blockSize - 1)) keccakState.p1600(this.state)
36624 this.state[~~((this.blockSize - 1) / 4)] ^= 0x80 << (8 * ((this.blockSize - 1) % 4))
36625 keccakState.p1600(this.state)
36626 this.count = 0
36627 this.squeezing = true
36628}
36629
36630Keccak.prototype.squeeze = function (length) {
36631 if (!this.squeezing) this.absorbLastFewBits(0x01)
36632
36633 var output = Buffer.allocUnsafe(length)
36634 for (var i = 0; i < length; ++i) {
36635 output[i] = (this.state[~~(this.count / 4)] >>> (8 * (this.count % 4))) & 0xff
36636 this.count += 1
36637 if (this.count === this.blockSize) {
36638 keccakState.p1600(this.state)
36639 this.count = 0
36640 }
36641 }
36642
36643 return output
36644}
36645
36646Keccak.prototype.copy = function (dest) {
36647 for (var i = 0; i < 50; ++i) dest.state[i] = this.state[i]
36648 dest.blockSize = this.blockSize
36649 dest.count = this.count
36650 dest.squeezing = this.squeezing
36651}
36652
36653module.exports = Keccak
36654
36655}).call(this,require("buffer").Buffer)
36656},{"./keccak-state-unroll":69,"buffer":5}],71:[function(require,module,exports){
36657(function (Buffer){
36658/*
36659CryptoJS v3.1.2
36660code.google.com/p/crypto-js
36661(c) 2009-2013 by Jeff Mott. All rights reserved.
36662code.google.com/p/crypto-js/wiki/License
36663*/
36664/** @preserve
36665(c) 2012 by Cédric Mesnil. All rights reserved.
36666
36667Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
36668
36669 - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
36670 - 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.
36671
36672THIS 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.
36673*/
36674
36675// constants table
36676var zl = [
36677 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
36678 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
36679 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
36680 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
36681 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
36682]
36683
36684var zr = [
36685 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
36686 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
36687 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
36688 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
36689 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
36690]
36691
36692var sl = [
36693 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
36694 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
36695 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
36696 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
36697 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
36698]
36699
36700var sr = [
36701 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
36702 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
36703 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
36704 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
36705 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
36706]
36707
36708var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]
36709var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]
36710
36711function bytesToWords (bytes) {
36712 var words = []
36713 for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {
36714 words[b >>> 5] |= bytes[i] << (24 - b % 32)
36715 }
36716 return words
36717}
36718
36719function wordsToBytes (words) {
36720 var bytes = []
36721 for (var b = 0; b < words.length * 32; b += 8) {
36722 bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)
36723 }
36724 return bytes
36725}
36726
36727function processBlock (H, M, offset) {
36728 // swap endian
36729 for (var i = 0; i < 16; i++) {
36730 var offset_i = offset + i
36731 var M_offset_i = M[offset_i]
36732
36733 // Swap
36734 M[offset_i] = (
36735 (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
36736 (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
36737 )
36738 }
36739
36740 // Working variables
36741 var al, bl, cl, dl, el
36742 var ar, br, cr, dr, er
36743
36744 ar = al = H[0]
36745 br = bl = H[1]
36746 cr = cl = H[2]
36747 dr = dl = H[3]
36748 er = el = H[4]
36749
36750 // computation
36751 var t
36752 for (i = 0; i < 80; i += 1) {
36753 t = (al + M[offset + zl[i]]) | 0
36754 if (i < 16) {
36755 t += f1(bl, cl, dl) + hl[0]
36756 } else if (i < 32) {
36757 t += f2(bl, cl, dl) + hl[1]
36758 } else if (i < 48) {
36759 t += f3(bl, cl, dl) + hl[2]
36760 } else if (i < 64) {
36761 t += f4(bl, cl, dl) + hl[3]
36762 } else {// if (i<80) {
36763 t += f5(bl, cl, dl) + hl[4]
36764 }
36765 t = t | 0
36766 t = rotl(t, sl[i])
36767 t = (t + el) | 0
36768 al = el
36769 el = dl
36770 dl = rotl(cl, 10)
36771 cl = bl
36772 bl = t
36773
36774 t = (ar + M[offset + zr[i]]) | 0
36775 if (i < 16) {
36776 t += f5(br, cr, dr) + hr[0]
36777 } else if (i < 32) {
36778 t += f4(br, cr, dr) + hr[1]
36779 } else if (i < 48) {
36780 t += f3(br, cr, dr) + hr[2]
36781 } else if (i < 64) {
36782 t += f2(br, cr, dr) + hr[3]
36783 } else {// if (i<80) {
36784 t += f1(br, cr, dr) + hr[4]
36785 }
36786
36787 t = t | 0
36788 t = rotl(t, sr[i])
36789 t = (t + er) | 0
36790 ar = er
36791 er = dr
36792 dr = rotl(cr, 10)
36793 cr = br
36794 br = t
36795 }
36796
36797 // intermediate hash value
36798 t = (H[1] + cl + dr) | 0
36799 H[1] = (H[2] + dl + er) | 0
36800 H[2] = (H[3] + el + ar) | 0
36801 H[3] = (H[4] + al + br) | 0
36802 H[4] = (H[0] + bl + cr) | 0
36803 H[0] = t
36804}
36805
36806function f1 (x, y, z) {
36807 return ((x) ^ (y) ^ (z))
36808}
36809
36810function f2 (x, y, z) {
36811 return (((x) & (y)) | ((~x) & (z)))
36812}
36813
36814function f3 (x, y, z) {
36815 return (((x) | (~(y))) ^ (z))
36816}
36817
36818function f4 (x, y, z) {
36819 return (((x) & (z)) | ((y) & (~(z))))
36820}
36821
36822function f5 (x, y, z) {
36823 return ((x) ^ ((y) | (~(z))))
36824}
36825
36826function rotl (x, n) {
36827 return (x << n) | (x >>> (32 - n))
36828}
36829
36830function ripemd160 (message) {
36831 var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]
36832
36833 if (typeof message === 'string') {
36834 message = new Buffer(message, 'utf8')
36835 }
36836
36837 var m = bytesToWords(message)
36838
36839 var nBitsLeft = message.length * 8
36840 var nBitsTotal = message.length * 8
36841
36842 // Add padding
36843 m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)
36844 m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
36845 (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
36846 (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
36847 )
36848
36849 for (var i = 0; i < m.length; i += 16) {
36850 processBlock(H, m, i)
36851 }
36852
36853 // swap endian
36854 for (i = 0; i < 5; i++) {
36855 // shortcut
36856 var H_i = H[i]
36857
36858 // Swap
36859 H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
36860 (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)
36861 }
36862
36863 var digestbytes = wordsToBytes(H)
36864 return new Buffer(digestbytes)
36865}
36866
36867module.exports = ripemd160
36868
36869}).call(this,require("buffer").Buffer)
36870},{"buffer":5}],72:[function(require,module,exports){
36871(function (Buffer){
36872const assert = require('assert')
36873/**
36874 * RLP Encoding based on: https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-RLP
36875 * This function takes in a data, convert it to buffer if not, and a length for recursion
36876 *
36877 * @param {Buffer,String,Integer,Array} data - will be converted to buffer
36878 * @returns {Buffer} - returns buffer of encoded data
36879 **/
36880exports.encode = function (input) {
36881 if (input instanceof Array) {
36882 var output = []
36883 for (var i = 0; i < input.length; i++) {
36884 output.push(exports.encode(input[i]))
36885 }
36886 var buf = Buffer.concat(output)
36887 return Buffer.concat([encodeLength(buf.length, 192), buf])
36888 } else {
36889 input = toBuffer(input)
36890 if (input.length === 1 && input[0] < 128) {
36891 return input
36892 } else {
36893 return Buffer.concat([encodeLength(input.length, 128), input])
36894 }
36895 }
36896}
36897
36898function safeParseInt (v, base) {
36899 if (v.slice(0, 2) === '00') {
36900 throw (new Error('invalid RLP: extra zeros'))
36901 }
36902
36903 return parseInt(v, base)
36904}
36905
36906function encodeLength (len, offset) {
36907 if (len < 56) {
36908 return new Buffer([len + offset])
36909 } else {
36910 var hexLength = intToHex(len)
36911 var lLength = hexLength.length / 2
36912 var firstByte = intToHex(offset + 55 + lLength)
36913 return new Buffer(firstByte + hexLength, 'hex')
36914 }
36915}
36916
36917/**
36918 * RLP Decoding based on: {@link https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-RLP|RLP}
36919 * @param {Buffer,String,Integer,Array} data - will be converted to buffer
36920 * @returns {Array} - returns decode Array of Buffers containg the original message
36921 **/
36922exports.decode = function (input, stream) {
36923 if (!input || input.length === 0) {
36924 return new Buffer([])
36925 }
36926
36927 input = toBuffer(input)
36928 var decoded = _decode(input)
36929
36930 if (stream) {
36931 return decoded
36932 }
36933
36934 assert.equal(decoded.remainder.length, 0, 'invalid remainder')
36935 return decoded.data
36936}
36937
36938exports.getLength = function (input) {
36939 if (!input || input.length === 0) {
36940 return new Buffer([])
36941 }
36942
36943 input = toBuffer(input)
36944 var firstByte = input[0]
36945 if (firstByte <= 0x7f) {
36946 return input.length
36947 } else if (firstByte <= 0xb7) {
36948 return firstByte - 0x7f
36949 } else if (firstByte <= 0xbf) {
36950 return firstByte - 0xb6
36951 } else if (firstByte <= 0xf7) {
36952 // a list between 0-55 bytes long
36953 return firstByte - 0xbf
36954 } else {
36955 // a list over 55 bytes long
36956 var llength = firstByte - 0xf6
36957 var length = safeParseInt(input.slice(1, llength).toString('hex'), 16)
36958 return llength + length
36959 }
36960}
36961
36962function _decode (input) {
36963 var length, llength, data, innerRemainder, d
36964 var decoded = []
36965 var firstByte = input[0]
36966
36967 if (firstByte <= 0x7f) {
36968 // a single byte whose value is in the [0x00, 0x7f] range, that byte is its own RLP encoding.
36969 return {
36970 data: input.slice(0, 1),
36971 remainder: input.slice(1)
36972 }
36973 } else if (firstByte <= 0xb7) {
36974 // string is 0-55 bytes long. A single byte with value 0x80 plus the length of the string followed by the string
36975 // The range of the first byte is [0x80, 0xb7]
36976 length = firstByte - 0x7f
36977
36978 // set 0x80 null to 0
36979 if (firstByte === 0x80) {
36980 data = new Buffer([])
36981 } else {
36982 data = input.slice(1, length)
36983 }
36984
36985 if (length === 2 && data[0] < 0x80) {
36986 throw new Error('invalid rlp encoding: byte must be less 0x80')
36987 }
36988
36989 return {
36990 data: data,
36991 remainder: input.slice(length)
36992 }
36993 } else if (firstByte <= 0xbf) {
36994 llength = firstByte - 0xb6
36995 length = safeParseInt(input.slice(1, llength).toString('hex'), 16)
36996 data = input.slice(llength, length + llength)
36997 if (data.length < length) {
36998 throw (new Error('invalid RLP'))
36999 }
37000
37001 return {
37002 data: data,
37003 remainder: input.slice(length + llength)
37004 }
37005 } else if (firstByte <= 0xf7) {
37006 // a list between 0-55 bytes long
37007 length = firstByte - 0xbf
37008 innerRemainder = input.slice(1, length)
37009 while (innerRemainder.length) {
37010 d = _decode(innerRemainder)
37011 decoded.push(d.data)
37012 innerRemainder = d.remainder
37013 }
37014
37015 return {
37016 data: decoded,
37017 remainder: input.slice(length)
37018 }
37019 } else {
37020 // a list over 55 bytes long
37021 llength = firstByte - 0xf6
37022 length = safeParseInt(input.slice(1, llength).toString('hex'), 16)
37023 var totalLength = llength + length
37024 if (totalLength > input.length) {
37025 throw new Error('invalid rlp: total length is larger than the data')
37026 }
37027
37028 innerRemainder = input.slice(llength, totalLength)
37029 if (innerRemainder.length === 0) {
37030 throw new Error('invalid rlp, List has a invalid length')
37031 }
37032
37033 while (innerRemainder.length) {
37034 d = _decode(innerRemainder)
37035 decoded.push(d.data)
37036 innerRemainder = d.remainder
37037 }
37038 return {
37039 data: decoded,
37040 remainder: input.slice(totalLength)
37041 }
37042 }
37043}
37044
37045function isHexPrefixed (str) {
37046 return str.slice(0, 2) === '0x'
37047}
37048
37049// Removes 0x from a given String
37050function stripHexPrefix (str) {
37051 if (typeof str !== 'string') {
37052 return str
37053 }
37054 return isHexPrefixed(str) ? str.slice(2) : str
37055}
37056
37057function intToHex (i) {
37058 var hex = i.toString(16)
37059 if (hex.length % 2) {
37060 hex = '0' + hex
37061 }
37062
37063 return hex
37064}
37065
37066function padToEven (a) {
37067 if (a.length % 2) a = '0' + a
37068 return a
37069}
37070
37071function intToBuffer (i) {
37072 var hex = intToHex(i)
37073 return new Buffer(hex, 'hex')
37074}
37075
37076function toBuffer (v) {
37077 if (!Buffer.isBuffer(v)) {
37078 if (typeof v === 'string') {
37079 if (isHexPrefixed(v)) {
37080 v = new Buffer(padToEven(stripHexPrefix(v)), 'hex')
37081 } else {
37082 v = new Buffer(v)
37083 }
37084 } else if (typeof v === 'number') {
37085 if (!v) {
37086 v = new Buffer([])
37087 } else {
37088 v = intToBuffer(v)
37089 }
37090 } else if (v === null || v === undefined) {
37091 v = new Buffer([])
37092 } else if (v.toArray) {
37093 // converts a BN to a Buffer
37094 v = new Buffer(v.toArray())
37095 } else {
37096 throw new Error('invalid type')
37097 }
37098 }
37099 return v
37100}
37101
37102}).call(this,require("buffer").Buffer)
37103},{"assert":1,"buffer":5}],73:[function(require,module,exports){
37104'use strict'
37105module.exports = require('./lib')(require('./lib/elliptic'))
37106
37107},{"./lib":77,"./lib/elliptic":76}],74:[function(require,module,exports){
37108(function (Buffer){
37109'use strict'
37110var toString = Object.prototype.toString
37111
37112// TypeError
37113exports.isArray = function (value, message) {
37114 if (!Array.isArray(value)) throw TypeError(message)
37115}
37116
37117exports.isBoolean = function (value, message) {
37118 if (toString.call(value) !== '[object Boolean]') throw TypeError(message)
37119}
37120
37121exports.isBuffer = function (value, message) {
37122 if (!Buffer.isBuffer(value)) throw TypeError(message)
37123}
37124
37125exports.isFunction = function (value, message) {
37126 if (toString.call(value) !== '[object Function]') throw TypeError(message)
37127}
37128
37129exports.isNumber = function (value, message) {
37130 if (toString.call(value) !== '[object Number]') throw TypeError(message)
37131}
37132
37133exports.isObject = function (value, message) {
37134 if (toString.call(value) !== '[object Object]') throw TypeError(message)
37135}
37136
37137// RangeError
37138exports.isBufferLength = function (buffer, length, message) {
37139 if (buffer.length !== length) throw RangeError(message)
37140}
37141
37142exports.isBufferLength2 = function (buffer, length1, length2, message) {
37143 if (buffer.length !== length1 && buffer.length !== length2) throw RangeError(message)
37144}
37145
37146exports.isLengthGTZero = function (value, message) {
37147 if (value.length === 0) throw RangeError(message)
37148}
37149
37150exports.isNumberInInterval = function (number, x, y, message) {
37151 if (number <= x || number >= y) throw RangeError(message)
37152}
37153
37154}).call(this,{"isBuffer":require("../../../../../.nvm/versions/node/v7.5.0/lib/node_modules/browserify/node_modules/is-buffer/index.js")})
37155},{"../../../../../.nvm/versions/node/v7.5.0/lib/node_modules/browserify/node_modules/is-buffer/index.js":10}],75:[function(require,module,exports){
37156(function (Buffer){
37157'use strict'
37158var bip66 = require('bip66')
37159
37160var EC_PRIVKEY_EXPORT_DER_COMPRESSED = new Buffer([
37161 // begin
37162 0x30, 0x81, 0xd3, 0x02, 0x01, 0x01, 0x04, 0x20,
37163 // private key
37164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37166 // middle
37167 0xa0, 0x81, 0x85, 0x30, 0x81, 0x82, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48,
37168 0xcE, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37169 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37170 0xff, 0xff, 0xfE, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04,
37171 0x21, 0x02, 0x79, 0xbE, 0x66, 0x7E, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xcE, 0x87,
37172 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xcE, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8,
37173 0x17, 0x98, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37174 0xff, 0xff, 0xff, 0xff, 0xfE, 0xba, 0xaE, 0xdc, 0xE6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5E,
37175 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0xa1, 0x24, 0x03, 0x22, 0x00,
37176 // public key
37177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37179 0x00
37180])
37181
37182var EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED = new Buffer([
37183 // begin
37184 0x30, 0x82, 0x01, 0x13, 0x02, 0x01, 0x01, 0x04, 0x20,
37185 // private key
37186 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37187 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37188 // middle
37189 0xa0, 0x81, 0xa5, 0x30, 0x81, 0xa2, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48,
37190 0xcE, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37191 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37192 0xff, 0xff, 0xfE, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04,
37193 0x41, 0x04, 0x79, 0xbE, 0x66, 0x7E, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xcE, 0x87,
37194 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xcE, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8,
37195 0x17, 0x98, 0x48, 0x3a, 0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0E, 0x11,
37196 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10,
37197 0xd4, 0xb8, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37198 0xff, 0xff, 0xff, 0xff, 0xfE, 0xba, 0xaE, 0xdc, 0xE6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5E,
37199 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0xa1, 0x44, 0x03, 0x42, 0x00,
37200 // public key
37201 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37202 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37205 0x00
37206])
37207
37208var ZERO_BUFFER_32 = new Buffer([
37209 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
37211])
37212
37213exports.privateKeyExport = function (privateKey, publicKey, compressed) {
37214 var result = new Buffer(compressed ? EC_PRIVKEY_EXPORT_DER_COMPRESSED : EC_PRIVKEY_EXPORT_DER_UNCOMPRESSED)
37215 privateKey.copy(result, compressed ? 8 : 9)
37216 publicKey.copy(result, compressed ? 181 : 214)
37217 return result
37218}
37219
37220exports.privateKeyImport = function (privateKey) {
37221 var length = privateKey.length
37222
37223 // sequence header
37224 var index = 0
37225 if (length < index + 1 || privateKey[index] !== 0x30) return
37226 index += 1
37227
37228 // sequence length constructor
37229 if (length < index + 1 || !(privateKey[index] & 0x80)) return
37230
37231 var lenb = privateKey[index] & 0x7f
37232 index += 1
37233 if (lenb < 1 || lenb > 2) return
37234 if (length < index + lenb) return
37235
37236 // sequence length
37237 var len = privateKey[index + lenb - 1] | (lenb > 1 ? privateKey[index + lenb - 2] << 8 : 0)
37238 index += lenb
37239 if (length < index + len) return
37240
37241 // sequence element 0: version number (=1)
37242 if (length < index + 3 ||
37243 privateKey[index] !== 0x02 ||
37244 privateKey[index + 1] !== 0x01 ||
37245 privateKey[index + 2] !== 0x01) {
37246 return
37247 }
37248 index += 3
37249
37250 // sequence element 1: octet string, up to 32 bytes
37251 if (length < index + 2 ||
37252 privateKey[index] !== 0x04 ||
37253 privateKey[index + 1] > 0x20 ||
37254 length < index + 2 + privateKey[index + 1]) {
37255 return
37256 }
37257
37258 return privateKey.slice(index + 2, index + 2 + privateKey[index + 1])
37259}
37260
37261exports.signatureExport = function (sigObj) {
37262 var r = Buffer.concat([new Buffer([0]), sigObj.r])
37263 for (var lenR = 33, posR = 0; lenR > 1 && r[posR] === 0x00 && !(r[posR + 1] & 0x80); --lenR, ++posR);
37264
37265 var s = Buffer.concat([new Buffer([0]), sigObj.s])
37266 for (var lenS = 33, posS = 0; lenS > 1 && s[posS] === 0x00 && !(s[posS + 1] & 0x80); --lenS, ++posS);
37267
37268 return bip66.encode(r.slice(posR), s.slice(posS))
37269}
37270
37271exports.signatureImport = function (sig) {
37272 var r = new Buffer(ZERO_BUFFER_32)
37273 var s = new Buffer(ZERO_BUFFER_32)
37274
37275 try {
37276 var sigObj = bip66.decode(sig)
37277 if (sigObj.r.length === 33 && sigObj.r[0] === 0x00) sigObj.r = sigObj.r.slice(1)
37278 if (sigObj.r.length > 32) throw new Error('R length is too long')
37279 if (sigObj.s.length === 33 && sigObj.s[0] === 0x00) sigObj.s = sigObj.s.slice(1)
37280 if (sigObj.s.length > 32) throw new Error('S length is too long')
37281 } catch (err) {
37282 return
37283 }
37284
37285 sigObj.r.copy(r, 32 - sigObj.r.length)
37286 sigObj.s.copy(s, 32 - sigObj.s.length)
37287
37288 return { r: r, s: s }
37289}
37290
37291exports.signatureImportLax = function (sig) {
37292 var r = new Buffer(ZERO_BUFFER_32)
37293 var s = new Buffer(ZERO_BUFFER_32)
37294
37295 var length = sig.length
37296 var index = 0
37297
37298 // sequence tag byte
37299 if (sig[index++] !== 0x30) return
37300
37301 // sequence length byte
37302 var lenbyte = sig[index++]
37303 if (lenbyte & 0x80) {
37304 index += lenbyte - 0x80
37305 if (index > length) return
37306 }
37307
37308 // sequence tag byte for r
37309 if (sig[index++] !== 0x02) return
37310
37311 // length for r
37312 var rlen = sig[index++]
37313 if (rlen & 0x80) {
37314 lenbyte = rlen - 0x80
37315 if (index + lenbyte > length) return
37316 for (; lenbyte > 0 && sig[index] === 0x00; index += 1, lenbyte -= 1);
37317 for (rlen = 0; lenbyte > 0; index += 1, lenbyte -= 1) rlen = (rlen << 8) + sig[index]
37318 }
37319 if (rlen > length - index) return
37320 var rindex = index
37321 index += rlen
37322
37323 // sequence tag byte for s
37324 if (sig[index++] !== 0x02) return
37325
37326 // length for s
37327 var slen = sig[index++]
37328 if (slen & 0x80) {
37329 lenbyte = slen - 0x80
37330 if (index + lenbyte > length) return
37331 for (; lenbyte > 0 && sig[index] === 0x00; index += 1, lenbyte -= 1);
37332 for (slen = 0; lenbyte > 0; index += 1, lenbyte -= 1) slen = (slen << 8) + sig[index]
37333 }
37334 if (slen > length - index) return
37335 var sindex = index
37336 index += slen
37337
37338 // ignore leading zeros in r
37339 for (; rlen > 0 && sig[rindex] === 0x00; rlen -= 1, rindex += 1);
37340 // copy r value
37341 if (rlen > 32) return
37342 var rvalue = sig.slice(rindex, rindex + rlen)
37343 rvalue.copy(r, 32 - rvalue.length)
37344
37345 // ignore leading zeros in s
37346 for (; slen > 0 && sig[sindex] === 0x00; slen -= 1, sindex += 1);
37347 // copy s value
37348 if (slen > 32) return
37349 var svalue = sig.slice(sindex, sindex + slen)
37350 svalue.copy(s, 32 - svalue.length)
37351
37352 return { r: r, s: s }
37353}
37354
37355}).call(this,require("buffer").Buffer)
37356},{"bip66":32,"buffer":5}],76:[function(require,module,exports){
37357(function (Buffer){
37358'use strict'
37359var createHash = require('create-hash')
37360var BN = require('bn.js')
37361var EC = require('elliptic').ec
37362
37363var messages = require('../messages.json')
37364
37365var ec = new EC('secp256k1')
37366var ecparams = ec.curve
37367
37368function loadCompressedPublicKey (first, xBuffer) {
37369 var x = new BN(xBuffer)
37370
37371 // overflow
37372 if (x.cmp(ecparams.p) >= 0) return null
37373 x = x.toRed(ecparams.red)
37374
37375 // compute corresponding Y
37376 var y = x.redSqr().redIMul(x).redIAdd(ecparams.b).redSqrt()
37377 if ((first === 0x03) !== y.isOdd()) y = y.redNeg()
37378
37379 return ec.keyPair({ pub: { x: x, y: y } })
37380}
37381
37382function loadUncompressedPublicKey (first, xBuffer, yBuffer) {
37383 var x = new BN(xBuffer)
37384 var y = new BN(yBuffer)
37385
37386 // overflow
37387 if (x.cmp(ecparams.p) >= 0 || y.cmp(ecparams.p) >= 0) return null
37388
37389 x = x.toRed(ecparams.red)
37390 y = y.toRed(ecparams.red)
37391
37392 // is odd flag
37393 if ((first === 0x06 || first === 0x07) && y.isOdd() !== (first === 0x07)) return null
37394
37395 // x*x*x + b = y*y
37396 var x3 = x.redSqr().redIMul(x)
37397 if (!y.redSqr().redISub(x3.redIAdd(ecparams.b)).isZero()) return null
37398
37399 return ec.keyPair({ pub: { x: x, y: y } })
37400}
37401
37402function loadPublicKey (publicKey) {
37403 var first = publicKey[0]
37404 switch (first) {
37405 case 0x02:
37406 case 0x03:
37407 if (publicKey.length !== 33) return null
37408 return loadCompressedPublicKey(first, publicKey.slice(1, 33))
37409 case 0x04:
37410 case 0x06:
37411 case 0x07:
37412 if (publicKey.length !== 65) return null
37413 return loadUncompressedPublicKey(first, publicKey.slice(1, 33), publicKey.slice(33, 65))
37414 default:
37415 return null
37416 }
37417}
37418
37419exports.privateKeyVerify = function (privateKey) {
37420 var bn = new BN(privateKey)
37421 return bn.cmp(ecparams.n) < 0 && !bn.isZero()
37422}
37423
37424exports.privateKeyExport = function (privateKey, compressed) {
37425 var d = new BN(privateKey)
37426 if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.EC_PRIVATE_KEY_EXPORT_DER_FAIL)
37427
37428 return new Buffer(ec.keyFromPrivate(privateKey).getPublic(compressed, true))
37429}
37430
37431exports.privateKeyTweakAdd = function (privateKey, tweak) {
37432 var bn = new BN(tweak)
37433 if (bn.cmp(ecparams.n) >= 0) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL)
37434
37435 bn.iadd(new BN(privateKey))
37436 if (bn.cmp(ecparams.n) >= 0) bn.isub(ecparams.n)
37437 if (bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_ADD_FAIL)
37438
37439 return bn.toArrayLike(Buffer, 'be', 32)
37440}
37441
37442exports.privateKeyTweakMul = function (privateKey, tweak) {
37443 var bn = new BN(tweak)
37444 if (bn.cmp(ecparams.n) >= 0 || bn.isZero()) throw new Error(messages.EC_PRIVATE_KEY_TWEAK_MUL_FAIL)
37445
37446 bn.imul(new BN(privateKey))
37447 if (bn.cmp(ecparams.n)) bn = bn.umod(ecparams.n)
37448
37449 return bn.toArrayLike(Buffer, 'be', 32)
37450}
37451
37452exports.publicKeyCreate = function (privateKey, compressed) {
37453 var d = new BN(privateKey)
37454 if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.EC_PUBLIC_KEY_CREATE_FAIL)
37455
37456 return new Buffer(ec.keyFromPrivate(privateKey).getPublic(compressed, true))
37457}
37458
37459exports.publicKeyConvert = function (publicKey, compressed) {
37460 var pair = loadPublicKey(publicKey)
37461 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
37462
37463 return new Buffer(pair.getPublic(compressed, true))
37464}
37465
37466exports.publicKeyVerify = function (publicKey) {
37467 return loadPublicKey(publicKey) !== null
37468}
37469
37470exports.publicKeyTweakAdd = function (publicKey, tweak, compressed) {
37471 var pair = loadPublicKey(publicKey)
37472 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
37473
37474 tweak = new BN(tweak)
37475 if (tweak.cmp(ecparams.n) >= 0) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_ADD_FAIL)
37476
37477 return new Buffer(ecparams.g.mul(tweak).add(pair.pub).encode(true, compressed))
37478}
37479
37480exports.publicKeyTweakMul = function (publicKey, tweak, compressed) {
37481 var pair = loadPublicKey(publicKey)
37482 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
37483
37484 tweak = new BN(tweak)
37485 if (tweak.cmp(ecparams.n) >= 0 || tweak.isZero()) throw new Error(messages.EC_PUBLIC_KEY_TWEAK_MUL_FAIL)
37486
37487 return new Buffer(pair.pub.mul(tweak).encode(true, compressed))
37488}
37489
37490exports.publicKeyCombine = function (publicKeys, compressed) {
37491 var pairs = new Array(publicKeys.length)
37492 for (var i = 0; i < publicKeys.length; ++i) {
37493 pairs[i] = loadPublicKey(publicKeys[i])
37494 if (pairs[i] === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
37495 }
37496
37497 var point = pairs[0].pub
37498 for (var j = 1; j < pairs.length; ++j) point = point.add(pairs[j].pub)
37499 if (point.isInfinity()) throw new Error(messages.EC_PUBLIC_KEY_COMBINE_FAIL)
37500
37501 return new Buffer(point.encode(true, compressed))
37502}
37503
37504exports.signatureNormalize = function (signature) {
37505 var r = new BN(signature.slice(0, 32))
37506 var s = new BN(signature.slice(32, 64))
37507 if (r.cmp(ecparams.n) >= 0 || s.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
37508
37509 var result = new Buffer(signature)
37510 if (s.cmp(ec.nh) === 1) ecparams.n.sub(s).toArrayLike(Buffer, 'be', 32).copy(result, 32)
37511
37512 return result
37513}
37514
37515exports.signatureExport = function (signature) {
37516 var r = signature.slice(0, 32)
37517 var s = signature.slice(32, 64)
37518 if (new BN(r).cmp(ecparams.n) >= 0 || new BN(s).cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
37519
37520 return { r: r, s: s }
37521}
37522
37523exports.signatureImport = function (sigObj) {
37524 var r = new BN(sigObj.r)
37525 if (r.cmp(ecparams.n) >= 0) r = new BN(0)
37526
37527 var s = new BN(sigObj.s)
37528 if (s.cmp(ecparams.n) >= 0) s = new BN(0)
37529
37530 return Buffer.concat([
37531 r.toArrayLike(Buffer, 'be', 32),
37532 s.toArrayLike(Buffer, 'be', 32)
37533 ])
37534}
37535
37536exports.sign = function (message, privateKey, noncefn, data) {
37537 if (typeof noncefn === 'function') {
37538 var getNonce = noncefn
37539 noncefn = function (counter) {
37540 var nonce = getNonce(message, privateKey, null, data, counter)
37541 if (!Buffer.isBuffer(nonce) || nonce.length !== 32) throw new Error(messages.ECDSA_SIGN_FAIL)
37542
37543 return new BN(nonce)
37544 }
37545 }
37546
37547 var d = new BN(privateKey)
37548 if (d.cmp(ecparams.n) >= 0 || d.isZero()) throw new Error(messages.ECDSA_SIGN_FAIL)
37549
37550 var result = ec.sign(message, privateKey, { canonical: true, k: noncefn, pers: data })
37551 return {
37552 signature: Buffer.concat([
37553 result.r.toArrayLike(Buffer, 'be', 32),
37554 result.s.toArrayLike(Buffer, 'be', 32)
37555 ]),
37556 recovery: result.recoveryParam
37557 }
37558}
37559
37560exports.verify = function (message, signature, publicKey) {
37561 var sigObj = {r: signature.slice(0, 32), s: signature.slice(32, 64)}
37562
37563 var sigr = new BN(sigObj.r)
37564 var sigs = new BN(sigObj.s)
37565 if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
37566 if (sigs.cmp(ec.nh) === 1 || sigr.isZero() || sigs.isZero()) return false
37567
37568 var pair = loadPublicKey(publicKey)
37569 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
37570
37571 return ec.verify(message, sigObj, {x: pair.pub.x, y: pair.pub.y})
37572}
37573
37574exports.recover = function (message, signature, recovery, compressed) {
37575 var sigObj = {r: signature.slice(0, 32), s: signature.slice(32, 64)}
37576
37577 var sigr = new BN(sigObj.r)
37578 var sigs = new BN(sigObj.s)
37579 if (sigr.cmp(ecparams.n) >= 0 || sigs.cmp(ecparams.n) >= 0) throw new Error(messages.ECDSA_SIGNATURE_PARSE_FAIL)
37580
37581 try {
37582 if (sigr.isZero() || sigs.isZero()) throw new Error()
37583
37584 var point = ec.recoverPubKey(message, sigObj, recovery)
37585 return new Buffer(point.encode(true, compressed))
37586 } catch (err) {
37587 throw new Error(messages.ECDSA_RECOVER_FAIL)
37588 }
37589}
37590
37591exports.ecdh = function (publicKey, privateKey) {
37592 var shared = exports.ecdhUnsafe(publicKey, privateKey, true)
37593 return createHash('sha256').update(shared).digest()
37594}
37595
37596exports.ecdhUnsafe = function (publicKey, privateKey, compressed) {
37597 var pair = loadPublicKey(publicKey)
37598 if (pair === null) throw new Error(messages.EC_PUBLIC_KEY_PARSE_FAIL)
37599
37600 var scalar = new BN(privateKey)
37601 if (scalar.cmp(ecparams.n) >= 0 || scalar.isZero()) throw new Error(messages.ECDH_FAIL)
37602
37603 return new Buffer(pair.pub.mul(scalar).encode(true, compressed))
37604}
37605
37606}).call(this,require("buffer").Buffer)
37607},{"../messages.json":78,"bn.js":33,"buffer":5,"create-hash":36,"elliptic":39}],77:[function(require,module,exports){
37608'use strict'
37609var assert = require('./assert')
37610var der = require('./der')
37611var messages = require('./messages.json')
37612
37613function initCompressedValue (value, defaultValue) {
37614 if (value === undefined) return defaultValue
37615
37616 assert.isBoolean(value, messages.COMPRESSED_TYPE_INVALID)
37617 return value
37618}
37619
37620module.exports = function (secp256k1) {
37621 return {
37622 privateKeyVerify: function (privateKey) {
37623 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37624 return privateKey.length === 32 && secp256k1.privateKeyVerify(privateKey)
37625 },
37626
37627 privateKeyExport: function (privateKey, compressed) {
37628 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37629 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
37630
37631 compressed = initCompressedValue(compressed, true)
37632 var publicKey = secp256k1.privateKeyExport(privateKey, compressed)
37633
37634 return der.privateKeyExport(privateKey, publicKey, compressed)
37635 },
37636
37637 privateKeyImport: function (privateKey) {
37638 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37639
37640 privateKey = der.privateKeyImport(privateKey)
37641 if (privateKey && privateKey.length === 32 && secp256k1.privateKeyVerify(privateKey)) return privateKey
37642
37643 throw new Error(messages.EC_PRIVATE_KEY_IMPORT_DER_FAIL)
37644 },
37645
37646 privateKeyTweakAdd: function (privateKey, tweak) {
37647 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37648 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
37649
37650 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
37651 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
37652
37653 return secp256k1.privateKeyTweakAdd(privateKey, tweak)
37654 },
37655
37656 privateKeyTweakMul: function (privateKey, tweak) {
37657 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37658 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
37659
37660 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
37661 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
37662
37663 return secp256k1.privateKeyTweakMul(privateKey, tweak)
37664 },
37665
37666 publicKeyCreate: function (privateKey, compressed) {
37667 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37668 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
37669
37670 compressed = initCompressedValue(compressed, true)
37671
37672 return secp256k1.publicKeyCreate(privateKey, compressed)
37673 },
37674
37675 publicKeyConvert: function (publicKey, compressed) {
37676 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
37677 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
37678
37679 compressed = initCompressedValue(compressed, true)
37680
37681 return secp256k1.publicKeyConvert(publicKey, compressed)
37682 },
37683
37684 publicKeyVerify: function (publicKey) {
37685 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
37686 return secp256k1.publicKeyVerify(publicKey)
37687 },
37688
37689 publicKeyTweakAdd: function (publicKey, tweak, compressed) {
37690 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
37691 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
37692
37693 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
37694 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
37695
37696 compressed = initCompressedValue(compressed, true)
37697
37698 return secp256k1.publicKeyTweakAdd(publicKey, tweak, compressed)
37699 },
37700
37701 publicKeyTweakMul: function (publicKey, tweak, compressed) {
37702 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
37703 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
37704
37705 assert.isBuffer(tweak, messages.TWEAK_TYPE_INVALID)
37706 assert.isBufferLength(tweak, 32, messages.TWEAK_LENGTH_INVALID)
37707
37708 compressed = initCompressedValue(compressed, true)
37709
37710 return secp256k1.publicKeyTweakMul(publicKey, tweak, compressed)
37711 },
37712
37713 publicKeyCombine: function (publicKeys, compressed) {
37714 assert.isArray(publicKeys, messages.EC_PUBLIC_KEYS_TYPE_INVALID)
37715 assert.isLengthGTZero(publicKeys, messages.EC_PUBLIC_KEYS_LENGTH_INVALID)
37716 for (var i = 0; i < publicKeys.length; ++i) {
37717 assert.isBuffer(publicKeys[i], messages.EC_PUBLIC_KEY_TYPE_INVALID)
37718 assert.isBufferLength2(publicKeys[i], 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
37719 }
37720
37721 compressed = initCompressedValue(compressed, true)
37722
37723 return secp256k1.publicKeyCombine(publicKeys, compressed)
37724 },
37725
37726 signatureNormalize: function (signature) {
37727 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
37728 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
37729
37730 return secp256k1.signatureNormalize(signature)
37731 },
37732
37733 signatureExport: function (signature) {
37734 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
37735 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
37736
37737 var sigObj = secp256k1.signatureExport(signature)
37738 return der.signatureExport(sigObj)
37739 },
37740
37741 signatureImport: function (sig) {
37742 assert.isBuffer(sig, messages.ECDSA_SIGNATURE_TYPE_INVALID)
37743 assert.isLengthGTZero(sig, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
37744
37745 var sigObj = der.signatureImport(sig)
37746 if (sigObj) return secp256k1.signatureImport(sigObj)
37747
37748 throw new Error(messages.ECDSA_SIGNATURE_PARSE_DER_FAIL)
37749 },
37750
37751 signatureImportLax: function (sig) {
37752 assert.isBuffer(sig, messages.ECDSA_SIGNATURE_TYPE_INVALID)
37753 assert.isLengthGTZero(sig, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
37754
37755 var sigObj = der.signatureImportLax(sig)
37756 if (sigObj) return secp256k1.signatureImport(sigObj)
37757
37758 throw new Error(messages.ECDSA_SIGNATURE_PARSE_DER_FAIL)
37759 },
37760
37761 sign: function (message, privateKey, options) {
37762 assert.isBuffer(message, messages.MSG32_TYPE_INVALID)
37763 assert.isBufferLength(message, 32, messages.MSG32_LENGTH_INVALID)
37764
37765 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37766 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
37767
37768 var data = null
37769 var noncefn = null
37770 if (options !== undefined) {
37771 assert.isObject(options, messages.OPTIONS_TYPE_INVALID)
37772
37773 if (options.data !== undefined) {
37774 assert.isBuffer(options.data, messages.OPTIONS_DATA_TYPE_INVALID)
37775 assert.isBufferLength(options.data, 32, messages.OPTIONS_DATA_LENGTH_INVALID)
37776 data = options.data
37777 }
37778
37779 if (options.noncefn !== undefined) {
37780 assert.isFunction(options.noncefn, messages.OPTIONS_NONCEFN_TYPE_INVALID)
37781 noncefn = options.noncefn
37782 }
37783 }
37784
37785 return secp256k1.sign(message, privateKey, noncefn, data)
37786 },
37787
37788 verify: function (message, signature, publicKey) {
37789 assert.isBuffer(message, messages.MSG32_TYPE_INVALID)
37790 assert.isBufferLength(message, 32, messages.MSG32_LENGTH_INVALID)
37791
37792 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
37793 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
37794
37795 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
37796 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
37797
37798 return secp256k1.verify(message, signature, publicKey)
37799 },
37800
37801 recover: function (message, signature, recovery, compressed) {
37802 assert.isBuffer(message, messages.MSG32_TYPE_INVALID)
37803 assert.isBufferLength(message, 32, messages.MSG32_LENGTH_INVALID)
37804
37805 assert.isBuffer(signature, messages.ECDSA_SIGNATURE_TYPE_INVALID)
37806 assert.isBufferLength(signature, 64, messages.ECDSA_SIGNATURE_LENGTH_INVALID)
37807
37808 assert.isNumber(recovery, messages.RECOVERY_ID_TYPE_INVALID)
37809 assert.isNumberInInterval(recovery, -1, 4, messages.RECOVERY_ID_VALUE_INVALID)
37810
37811 compressed = initCompressedValue(compressed, true)
37812
37813 return secp256k1.recover(message, signature, recovery, compressed)
37814 },
37815
37816 ecdh: function (publicKey, privateKey) {
37817 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
37818 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
37819
37820 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37821 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
37822
37823 return secp256k1.ecdh(publicKey, privateKey)
37824 },
37825
37826 ecdhUnsafe: function (publicKey, privateKey, compressed) {
37827 assert.isBuffer(publicKey, messages.EC_PUBLIC_KEY_TYPE_INVALID)
37828 assert.isBufferLength2(publicKey, 33, 65, messages.EC_PUBLIC_KEY_LENGTH_INVALID)
37829
37830 assert.isBuffer(privateKey, messages.EC_PRIVATE_KEY_TYPE_INVALID)
37831 assert.isBufferLength(privateKey, 32, messages.EC_PRIVATE_KEY_LENGTH_INVALID)
37832
37833 compressed = initCompressedValue(compressed, true)
37834
37835 return secp256k1.ecdhUnsafe(publicKey, privateKey, compressed)
37836 }
37837 }
37838}
37839
37840},{"./assert":74,"./der":75,"./messages.json":78}],78:[function(require,module,exports){
37841module.exports={
37842 "COMPRESSED_TYPE_INVALID": "compressed should be a boolean",
37843 "EC_PRIVATE_KEY_TYPE_INVALID": "private key should be a Buffer",
37844 "EC_PRIVATE_KEY_LENGTH_INVALID": "private key length is invalid",
37845 "EC_PRIVATE_KEY_TWEAK_ADD_FAIL": "tweak out of range or resulting private key is invalid",
37846 "EC_PRIVATE_KEY_TWEAK_MUL_FAIL": "tweak out of range",
37847 "EC_PRIVATE_KEY_EXPORT_DER_FAIL": "couldn't export to DER format",
37848 "EC_PRIVATE_KEY_IMPORT_DER_FAIL": "couldn't import from DER format",
37849 "EC_PUBLIC_KEYS_TYPE_INVALID": "public keys should be an Array",
37850 "EC_PUBLIC_KEYS_LENGTH_INVALID": "public keys Array should have at least 1 element",
37851 "EC_PUBLIC_KEY_TYPE_INVALID": "public key should be a Buffer",
37852 "EC_PUBLIC_KEY_LENGTH_INVALID": "public key length is invalid",
37853 "EC_PUBLIC_KEY_PARSE_FAIL": "the public key could not be parsed or is invalid",
37854 "EC_PUBLIC_KEY_CREATE_FAIL": "private was invalid, try again",
37855 "EC_PUBLIC_KEY_TWEAK_ADD_FAIL": "tweak out of range or resulting public key is invalid",
37856 "EC_PUBLIC_KEY_TWEAK_MUL_FAIL": "tweak out of range",
37857 "EC_PUBLIC_KEY_COMBINE_FAIL": "the sum of the public keys is not valid",
37858 "ECDH_FAIL": "scalar was invalid (zero or overflow)",
37859 "ECDSA_SIGNATURE_TYPE_INVALID": "signature should be a Buffer",
37860 "ECDSA_SIGNATURE_LENGTH_INVALID": "signature length is invalid",
37861 "ECDSA_SIGNATURE_PARSE_FAIL": "couldn't parse signature",
37862 "ECDSA_SIGNATURE_PARSE_DER_FAIL": "couldn't parse DER signature",
37863 "ECDSA_SIGNATURE_SERIALIZE_DER_FAIL": "couldn't serialize signature to DER format",
37864 "ECDSA_SIGN_FAIL": "nonce generation function failed or private key is invalid",
37865 "ECDSA_RECOVER_FAIL": "couldn't recover public key from signature",
37866 "MSG32_TYPE_INVALID": "message should be a Buffer",
37867 "MSG32_LENGTH_INVALID": "message length is invalid",
37868 "OPTIONS_TYPE_INVALID": "options should be an Object",
37869 "OPTIONS_DATA_TYPE_INVALID": "options.data should be a Buffer",
37870 "OPTIONS_DATA_LENGTH_INVALID": "options.data length is invalid",
37871 "OPTIONS_NONCEFN_TYPE_INVALID": "options.noncefn should be a Function",
37872 "RECOVERY_ID_TYPE_INVALID": "recovery should be a Number",
37873 "RECOVERY_ID_VALUE_INVALID": "recovery should have value between -1 and 4",
37874 "TWEAK_TYPE_INVALID": "tweak should be a Buffer",
37875 "TWEAK_LENGTH_INVALID": "tweak length is invalid"
37876}
37877
37878},{}],79:[function(require,module,exports){
37879(function (Buffer){
37880// prototype class for hash functions
37881function Hash (blockSize, finalSize) {
37882 this._block = new Buffer(blockSize)
37883 this._finalSize = finalSize
37884 this._blockSize = blockSize
37885 this._len = 0
37886 this._s = 0
37887}
37888
37889Hash.prototype.update = function (data, enc) {
37890 if (typeof data === 'string') {
37891 enc = enc || 'utf8'
37892 data = new Buffer(data, enc)
37893 }
37894
37895 var l = this._len += data.length
37896 var s = this._s || 0
37897 var f = 0
37898 var buffer = this._block
37899
37900 while (s < l) {
37901 var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
37902 var ch = (t - f)
37903
37904 for (var i = 0; i < ch; i++) {
37905 buffer[(s % this._blockSize) + i] = data[i + f]
37906 }
37907
37908 s += ch
37909 f += ch
37910
37911 if ((s % this._blockSize) === 0) {
37912 this._update(buffer)
37913 }
37914 }
37915 this._s = s
37916
37917 return this
37918}
37919
37920Hash.prototype.digest = function (enc) {
37921 // Suppose the length of the message M, in bits, is l
37922 var l = this._len * 8
37923
37924 // Append the bit 1 to the end of the message
37925 this._block[this._len % this._blockSize] = 0x80
37926
37927 // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize
37928 this._block.fill(0, this._len % this._blockSize + 1)
37929
37930 if (l % (this._blockSize * 8) >= this._finalSize * 8) {
37931 this._update(this._block)
37932 this._block.fill(0)
37933 }
37934
37935 // to this append the block which is equal to the number l written in binary
37936 // TODO: handle case where l is > Math.pow(2, 29)
37937 this._block.writeInt32BE(l, this._blockSize - 4)
37938
37939 var hash = this._update(this._block) || this._hash()
37940
37941 return enc ? hash.toString(enc) : hash
37942}
37943
37944Hash.prototype._update = function () {
37945 throw new Error('_update must be implemented by subclass')
37946}
37947
37948module.exports = Hash
37949
37950}).call(this,require("buffer").Buffer)
37951},{"buffer":5}],80:[function(require,module,exports){
37952var exports = module.exports = function SHA (algorithm) {
37953 algorithm = algorithm.toLowerCase()
37954
37955 var Algorithm = exports[algorithm]
37956 if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
37957
37958 return new Algorithm()
37959}
37960
37961exports.sha = require('./sha')
37962exports.sha1 = require('./sha1')
37963exports.sha224 = require('./sha224')
37964exports.sha256 = require('./sha256')
37965exports.sha384 = require('./sha384')
37966exports.sha512 = require('./sha512')
37967
37968},{"./sha":81,"./sha1":82,"./sha224":83,"./sha256":84,"./sha384":85,"./sha512":86}],81:[function(require,module,exports){
37969(function (Buffer){
37970/*
37971 * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
37972 * in FIPS PUB 180-1
37973 * This source code is derived from sha1.js of the same repository.
37974 * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
37975 * operation was added.
37976 */
37977
37978var inherits = require('inherits')
37979var Hash = require('./hash')
37980
37981var K = [
37982 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
37983]
37984
37985var W = new Array(80)
37986
37987function Sha () {
37988 this.init()
37989 this._w = W
37990
37991 Hash.call(this, 64, 56)
37992}
37993
37994inherits(Sha, Hash)
37995
37996Sha.prototype.init = function () {
37997 this._a = 0x67452301
37998 this._b = 0xefcdab89
37999 this._c = 0x98badcfe
38000 this._d = 0x10325476
38001 this._e = 0xc3d2e1f0
38002
38003 return this
38004}
38005
38006function rotl5 (num) {
38007 return (num << 5) | (num >>> 27)
38008}
38009
38010function rotl30 (num) {
38011 return (num << 30) | (num >>> 2)
38012}
38013
38014function ft (s, b, c, d) {
38015 if (s === 0) return (b & c) | ((~b) & d)
38016 if (s === 2) return (b & c) | (b & d) | (c & d)
38017 return b ^ c ^ d
38018}
38019
38020Sha.prototype._update = function (M) {
38021 var W = this._w
38022
38023 var a = this._a | 0
38024 var b = this._b | 0
38025 var c = this._c | 0
38026 var d = this._d | 0
38027 var e = this._e | 0
38028
38029 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
38030 for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
38031
38032 for (var j = 0; j < 80; ++j) {
38033 var s = ~~(j / 20)
38034 var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
38035
38036 e = d
38037 d = c
38038 c = rotl30(b)
38039 b = a
38040 a = t
38041 }
38042
38043 this._a = (a + this._a) | 0
38044 this._b = (b + this._b) | 0
38045 this._c = (c + this._c) | 0
38046 this._d = (d + this._d) | 0
38047 this._e = (e + this._e) | 0
38048}
38049
38050Sha.prototype._hash = function () {
38051 var H = new Buffer(20)
38052
38053 H.writeInt32BE(this._a | 0, 0)
38054 H.writeInt32BE(this._b | 0, 4)
38055 H.writeInt32BE(this._c | 0, 8)
38056 H.writeInt32BE(this._d | 0, 12)
38057 H.writeInt32BE(this._e | 0, 16)
38058
38059 return H
38060}
38061
38062module.exports = Sha
38063
38064}).call(this,require("buffer").Buffer)
38065},{"./hash":79,"buffer":5,"inherits":63}],82:[function(require,module,exports){
38066(function (Buffer){
38067/*
38068 * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
38069 * in FIPS PUB 180-1
38070 * Version 2.1a Copyright Paul Johnston 2000 - 2002.
38071 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
38072 * Distributed under the BSD License
38073 * See http://pajhome.org.uk/crypt/md5 for details.
38074 */
38075
38076var inherits = require('inherits')
38077var Hash = require('./hash')
38078
38079var K = [
38080 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
38081]
38082
38083var W = new Array(80)
38084
38085function Sha1 () {
38086 this.init()
38087 this._w = W
38088
38089 Hash.call(this, 64, 56)
38090}
38091
38092inherits(Sha1, Hash)
38093
38094Sha1.prototype.init = function () {
38095 this._a = 0x67452301
38096 this._b = 0xefcdab89
38097 this._c = 0x98badcfe
38098 this._d = 0x10325476
38099 this._e = 0xc3d2e1f0
38100
38101 return this
38102}
38103
38104function rotl1 (num) {
38105 return (num << 1) | (num >>> 31)
38106}
38107
38108function rotl5 (num) {
38109 return (num << 5) | (num >>> 27)
38110}
38111
38112function rotl30 (num) {
38113 return (num << 30) | (num >>> 2)
38114}
38115
38116function ft (s, b, c, d) {
38117 if (s === 0) return (b & c) | ((~b) & d)
38118 if (s === 2) return (b & c) | (b & d) | (c & d)
38119 return b ^ c ^ d
38120}
38121
38122Sha1.prototype._update = function (M) {
38123 var W = this._w
38124
38125 var a = this._a | 0
38126 var b = this._b | 0
38127 var c = this._c | 0
38128 var d = this._d | 0
38129 var e = this._e | 0
38130
38131 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
38132 for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
38133
38134 for (var j = 0; j < 80; ++j) {
38135 var s = ~~(j / 20)
38136 var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
38137
38138 e = d
38139 d = c
38140 c = rotl30(b)
38141 b = a
38142 a = t
38143 }
38144
38145 this._a = (a + this._a) | 0
38146 this._b = (b + this._b) | 0
38147 this._c = (c + this._c) | 0
38148 this._d = (d + this._d) | 0
38149 this._e = (e + this._e) | 0
38150}
38151
38152Sha1.prototype._hash = function () {
38153 var H = new Buffer(20)
38154
38155 H.writeInt32BE(this._a | 0, 0)
38156 H.writeInt32BE(this._b | 0, 4)
38157 H.writeInt32BE(this._c | 0, 8)
38158 H.writeInt32BE(this._d | 0, 12)
38159 H.writeInt32BE(this._e | 0, 16)
38160
38161 return H
38162}
38163
38164module.exports = Sha1
38165
38166}).call(this,require("buffer").Buffer)
38167},{"./hash":79,"buffer":5,"inherits":63}],83:[function(require,module,exports){
38168(function (Buffer){
38169/**
38170 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
38171 * in FIPS 180-2
38172 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
38173 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
38174 *
38175 */
38176
38177var inherits = require('inherits')
38178var Sha256 = require('./sha256')
38179var Hash = require('./hash')
38180
38181var W = new Array(64)
38182
38183function Sha224 () {
38184 this.init()
38185
38186 this._w = W // new Array(64)
38187
38188 Hash.call(this, 64, 56)
38189}
38190
38191inherits(Sha224, Sha256)
38192
38193Sha224.prototype.init = function () {
38194 this._a = 0xc1059ed8
38195 this._b = 0x367cd507
38196 this._c = 0x3070dd17
38197 this._d = 0xf70e5939
38198 this._e = 0xffc00b31
38199 this._f = 0x68581511
38200 this._g = 0x64f98fa7
38201 this._h = 0xbefa4fa4
38202
38203 return this
38204}
38205
38206Sha224.prototype._hash = function () {
38207 var H = new Buffer(28)
38208
38209 H.writeInt32BE(this._a, 0)
38210 H.writeInt32BE(this._b, 4)
38211 H.writeInt32BE(this._c, 8)
38212 H.writeInt32BE(this._d, 12)
38213 H.writeInt32BE(this._e, 16)
38214 H.writeInt32BE(this._f, 20)
38215 H.writeInt32BE(this._g, 24)
38216
38217 return H
38218}
38219
38220module.exports = Sha224
38221
38222}).call(this,require("buffer").Buffer)
38223},{"./hash":79,"./sha256":84,"buffer":5,"inherits":63}],84:[function(require,module,exports){
38224(function (Buffer){
38225/**
38226 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
38227 * in FIPS 180-2
38228 * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
38229 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
38230 *
38231 */
38232
38233var inherits = require('inherits')
38234var Hash = require('./hash')
38235
38236var K = [
38237 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
38238 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
38239 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
38240 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
38241 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
38242 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
38243 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
38244 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
38245 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
38246 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
38247 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
38248 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
38249 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
38250 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
38251 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
38252 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
38253]
38254
38255var W = new Array(64)
38256
38257function Sha256 () {
38258 this.init()
38259
38260 this._w = W // new Array(64)
38261
38262 Hash.call(this, 64, 56)
38263}
38264
38265inherits(Sha256, Hash)
38266
38267Sha256.prototype.init = function () {
38268 this._a = 0x6a09e667
38269 this._b = 0xbb67ae85
38270 this._c = 0x3c6ef372
38271 this._d = 0xa54ff53a
38272 this._e = 0x510e527f
38273 this._f = 0x9b05688c
38274 this._g = 0x1f83d9ab
38275 this._h = 0x5be0cd19
38276
38277 return this
38278}
38279
38280function ch (x, y, z) {
38281 return z ^ (x & (y ^ z))
38282}
38283
38284function maj (x, y, z) {
38285 return (x & y) | (z & (x | y))
38286}
38287
38288function sigma0 (x) {
38289 return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
38290}
38291
38292function sigma1 (x) {
38293 return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
38294}
38295
38296function gamma0 (x) {
38297 return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
38298}
38299
38300function gamma1 (x) {
38301 return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
38302}
38303
38304Sha256.prototype._update = function (M) {
38305 var W = this._w
38306
38307 var a = this._a | 0
38308 var b = this._b | 0
38309 var c = this._c | 0
38310 var d = this._d | 0
38311 var e = this._e | 0
38312 var f = this._f | 0
38313 var g = this._g | 0
38314 var h = this._h | 0
38315
38316 for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
38317 for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
38318
38319 for (var j = 0; j < 64; ++j) {
38320 var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
38321 var T2 = (sigma0(a) + maj(a, b, c)) | 0
38322
38323 h = g
38324 g = f
38325 f = e
38326 e = (d + T1) | 0
38327 d = c
38328 c = b
38329 b = a
38330 a = (T1 + T2) | 0
38331 }
38332
38333 this._a = (a + this._a) | 0
38334 this._b = (b + this._b) | 0
38335 this._c = (c + this._c) | 0
38336 this._d = (d + this._d) | 0
38337 this._e = (e + this._e) | 0
38338 this._f = (f + this._f) | 0
38339 this._g = (g + this._g) | 0
38340 this._h = (h + this._h) | 0
38341}
38342
38343Sha256.prototype._hash = function () {
38344 var H = new Buffer(32)
38345
38346 H.writeInt32BE(this._a, 0)
38347 H.writeInt32BE(this._b, 4)
38348 H.writeInt32BE(this._c, 8)
38349 H.writeInt32BE(this._d, 12)
38350 H.writeInt32BE(this._e, 16)
38351 H.writeInt32BE(this._f, 20)
38352 H.writeInt32BE(this._g, 24)
38353 H.writeInt32BE(this._h, 28)
38354
38355 return H
38356}
38357
38358module.exports = Sha256
38359
38360}).call(this,require("buffer").Buffer)
38361},{"./hash":79,"buffer":5,"inherits":63}],85:[function(require,module,exports){
38362(function (Buffer){
38363var inherits = require('inherits')
38364var SHA512 = require('./sha512')
38365var Hash = require('./hash')
38366
38367var W = new Array(160)
38368
38369function Sha384 () {
38370 this.init()
38371 this._w = W
38372
38373 Hash.call(this, 128, 112)
38374}
38375
38376inherits(Sha384, SHA512)
38377
38378Sha384.prototype.init = function () {
38379 this._ah = 0xcbbb9d5d
38380 this._bh = 0x629a292a
38381 this._ch = 0x9159015a
38382 this._dh = 0x152fecd8
38383 this._eh = 0x67332667
38384 this._fh = 0x8eb44a87
38385 this._gh = 0xdb0c2e0d
38386 this._hh = 0x47b5481d
38387
38388 this._al = 0xc1059ed8
38389 this._bl = 0x367cd507
38390 this._cl = 0x3070dd17
38391 this._dl = 0xf70e5939
38392 this._el = 0xffc00b31
38393 this._fl = 0x68581511
38394 this._gl = 0x64f98fa7
38395 this._hl = 0xbefa4fa4
38396
38397 return this
38398}
38399
38400Sha384.prototype._hash = function () {
38401 var H = new Buffer(48)
38402
38403 function writeInt64BE (h, l, offset) {
38404 H.writeInt32BE(h, offset)
38405 H.writeInt32BE(l, offset + 4)
38406 }
38407
38408 writeInt64BE(this._ah, this._al, 0)
38409 writeInt64BE(this._bh, this._bl, 8)
38410 writeInt64BE(this._ch, this._cl, 16)
38411 writeInt64BE(this._dh, this._dl, 24)
38412 writeInt64BE(this._eh, this._el, 32)
38413 writeInt64BE(this._fh, this._fl, 40)
38414
38415 return H
38416}
38417
38418module.exports = Sha384
38419
38420}).call(this,require("buffer").Buffer)
38421},{"./hash":79,"./sha512":86,"buffer":5,"inherits":63}],86:[function(require,module,exports){
38422(function (Buffer){
38423var inherits = require('inherits')
38424var Hash = require('./hash')
38425
38426var K = [
38427 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
38428 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
38429 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
38430 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
38431 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
38432 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
38433 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
38434 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
38435 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
38436 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
38437 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
38438 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
38439 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
38440 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
38441 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
38442 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
38443 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
38444 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
38445 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
38446 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
38447 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
38448 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
38449 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
38450 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
38451 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
38452 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
38453 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
38454 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
38455 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
38456 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
38457 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
38458 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
38459 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
38460 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
38461 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
38462 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
38463 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
38464 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
38465 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
38466 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
38467]
38468
38469var W = new Array(160)
38470
38471function Sha512 () {
38472 this.init()
38473 this._w = W
38474
38475 Hash.call(this, 128, 112)
38476}
38477
38478inherits(Sha512, Hash)
38479
38480Sha512.prototype.init = function () {
38481 this._ah = 0x6a09e667
38482 this._bh = 0xbb67ae85
38483 this._ch = 0x3c6ef372
38484 this._dh = 0xa54ff53a
38485 this._eh = 0x510e527f
38486 this._fh = 0x9b05688c
38487 this._gh = 0x1f83d9ab
38488 this._hh = 0x5be0cd19
38489
38490 this._al = 0xf3bcc908
38491 this._bl = 0x84caa73b
38492 this._cl = 0xfe94f82b
38493 this._dl = 0x5f1d36f1
38494 this._el = 0xade682d1
38495 this._fl = 0x2b3e6c1f
38496 this._gl = 0xfb41bd6b
38497 this._hl = 0x137e2179
38498
38499 return this
38500}
38501
38502function Ch (x, y, z) {
38503 return z ^ (x & (y ^ z))
38504}
38505
38506function maj (x, y, z) {
38507 return (x & y) | (z & (x | y))
38508}
38509
38510function sigma0 (x, xl) {
38511 return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
38512}
38513
38514function sigma1 (x, xl) {
38515 return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
38516}
38517
38518function Gamma0 (x, xl) {
38519 return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
38520}
38521
38522function Gamma0l (x, xl) {
38523 return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
38524}
38525
38526function Gamma1 (x, xl) {
38527 return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
38528}
38529
38530function Gamma1l (x, xl) {
38531 return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
38532}
38533
38534function getCarry (a, b) {
38535 return (a >>> 0) < (b >>> 0) ? 1 : 0
38536}
38537
38538Sha512.prototype._update = function (M) {
38539 var W = this._w
38540
38541 var ah = this._ah | 0
38542 var bh = this._bh | 0
38543 var ch = this._ch | 0
38544 var dh = this._dh | 0
38545 var eh = this._eh | 0
38546 var fh = this._fh | 0
38547 var gh = this._gh | 0
38548 var hh = this._hh | 0
38549
38550 var al = this._al | 0
38551 var bl = this._bl | 0
38552 var cl = this._cl | 0
38553 var dl = this._dl | 0
38554 var el = this._el | 0
38555 var fl = this._fl | 0
38556 var gl = this._gl | 0
38557 var hl = this._hl | 0
38558
38559 for (var i = 0; i < 32; i += 2) {
38560 W[i] = M.readInt32BE(i * 4)
38561 W[i + 1] = M.readInt32BE(i * 4 + 4)
38562 }
38563 for (; i < 160; i += 2) {
38564 var xh = W[i - 15 * 2]
38565 var xl = W[i - 15 * 2 + 1]
38566 var gamma0 = Gamma0(xh, xl)
38567 var gamma0l = Gamma0l(xl, xh)
38568
38569 xh = W[i - 2 * 2]
38570 xl = W[i - 2 * 2 + 1]
38571 var gamma1 = Gamma1(xh, xl)
38572 var gamma1l = Gamma1l(xl, xh)
38573
38574 // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
38575 var Wi7h = W[i - 7 * 2]
38576 var Wi7l = W[i - 7 * 2 + 1]
38577
38578 var Wi16h = W[i - 16 * 2]
38579 var Wi16l = W[i - 16 * 2 + 1]
38580
38581 var Wil = (gamma0l + Wi7l) | 0
38582 var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
38583 Wil = (Wil + gamma1l) | 0
38584 Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
38585 Wil = (Wil + Wi16l) | 0
38586 Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
38587
38588 W[i] = Wih
38589 W[i + 1] = Wil
38590 }
38591
38592 for (var j = 0; j < 160; j += 2) {
38593 Wih = W[j]
38594 Wil = W[j + 1]
38595
38596 var majh = maj(ah, bh, ch)
38597 var majl = maj(al, bl, cl)
38598
38599 var sigma0h = sigma0(ah, al)
38600 var sigma0l = sigma0(al, ah)
38601 var sigma1h = sigma1(eh, el)
38602 var sigma1l = sigma1(el, eh)
38603
38604 // t1 = h + sigma1 + ch + K[j] + W[j]
38605 var Kih = K[j]
38606 var Kil = K[j + 1]
38607
38608 var chh = Ch(eh, fh, gh)
38609 var chl = Ch(el, fl, gl)
38610
38611 var t1l = (hl + sigma1l) | 0
38612 var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
38613 t1l = (t1l + chl) | 0
38614 t1h = (t1h + chh + getCarry(t1l, chl)) | 0
38615 t1l = (t1l + Kil) | 0
38616 t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
38617 t1l = (t1l + Wil) | 0
38618 t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
38619
38620 // t2 = sigma0 + maj
38621 var t2l = (sigma0l + majl) | 0
38622 var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
38623
38624 hh = gh
38625 hl = gl
38626 gh = fh
38627 gl = fl
38628 fh = eh
38629 fl = el
38630 el = (dl + t1l) | 0
38631 eh = (dh + t1h + getCarry(el, dl)) | 0
38632 dh = ch
38633 dl = cl
38634 ch = bh
38635 cl = bl
38636 bh = ah
38637 bl = al
38638 al = (t1l + t2l) | 0
38639 ah = (t1h + t2h + getCarry(al, t1l)) | 0
38640 }
38641
38642 this._al = (this._al + al) | 0
38643 this._bl = (this._bl + bl) | 0
38644 this._cl = (this._cl + cl) | 0
38645 this._dl = (this._dl + dl) | 0
38646 this._el = (this._el + el) | 0
38647 this._fl = (this._fl + fl) | 0
38648 this._gl = (this._gl + gl) | 0
38649 this._hl = (this._hl + hl) | 0
38650
38651 this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
38652 this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
38653 this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
38654 this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
38655 this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
38656 this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
38657 this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
38658 this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
38659}
38660
38661Sha512.prototype._hash = function () {
38662 var H = new Buffer(64)
38663
38664 function writeInt64BE (h, l, offset) {
38665 H.writeInt32BE(h, offset)
38666 H.writeInt32BE(l, offset + 4)
38667 }
38668
38669 writeInt64BE(this._ah, this._al, 0)
38670 writeInt64BE(this._bh, this._bl, 8)
38671 writeInt64BE(this._ch, this._cl, 16)
38672 writeInt64BE(this._dh, this._dl, 24)
38673 writeInt64BE(this._eh, this._el, 32)
38674 writeInt64BE(this._fh, this._fl, 40)
38675 writeInt64BE(this._gh, this._gl, 48)
38676 writeInt64BE(this._hh, this._hl, 56)
38677
38678 return H
38679}
38680
38681module.exports = Sha512
38682
38683}).call(this,require("buffer").Buffer)
38684},{"./hash":79,"buffer":5,"inherits":63}],87:[function(require,module,exports){
38685var isHexPrefixed = require('is-hex-prefixed');
38686
38687/**
38688 * Removes '0x' from a given `String` is present
38689 * @param {String} str the string value
38690 * @return {String|Optional} a string by pass if necessary
38691 */
38692module.exports = function stripHexPrefix(str) {
38693 if (typeof str !== 'string') {
38694 return str;
38695 }
38696
38697 return isHexPrefixed(str) ? str.slice(2) : str;
38698}
38699
38700},{"is-hex-prefixed":64}]},{},[31])(31)
38701});</script>
38702 <script>function convertRippleAdrr(address) {
38703 return window.basex('rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz').encode(
38704 window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address)
38705 )
38706 }
38707
38708function convertRipplePriv(priv) {
38709 return window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2)
38710}
38711
38712</script>
13661 <script>// Select components from sjcl to suit the crypto operations bip39 requires. 38713 <script>// Select components from sjcl to suit the crypto operations bip39 requires.
13662 38714
13663//// base.js 38715//// base.js
@@ -16555,10 +41607,11 @@ var Mnemonic = function(language) {
16555 41607
16556 self.toSeed = function(mnemonic, passphrase) { 41608 self.toSeed = function(mnemonic, passphrase) {
16557 passphrase = passphrase || ''; 41609 passphrase = passphrase || '';
16558 mnemonic = self.joinWords(self.splitWords(self.normalizeString(mnemonic))); // removes blanks 41610 mnemonic = self.joinWords(self.splitWords(mnemonic)); // removes duplicate blanks
41611 var mnemonicNormalized = self.normalizeString(mnemonic);
16559 passphrase = self.normalizeString(passphrase) 41612 passphrase = self.normalizeString(passphrase)
16560 passphrase = "mnemonic" + passphrase; 41613 passphrase = "mnemonic" + passphrase;
16561 var mnemonicBits = sjcl.codec.utf8String.toBits(mnemonic); 41614 var mnemonicBits = sjcl.codec.utf8String.toBits(mnemonicNormalized);
16562 var passphraseBits = sjcl.codec.utf8String.toBits(passphrase); 41615 var passphraseBits = sjcl.codec.utf8String.toBits(passphrase);
16563 var result = sjcl.misc.pbkdf2(mnemonicBits, passphraseBits, PBKDF2_ROUNDS, 512, hmacSHA512); 41616 var result = sjcl.misc.pbkdf2(mnemonicBits, passphraseBits, PBKDF2_ROUNDS, 512, hmacSHA512);
16564 var hashHex = sjcl.codec.hex.fromBits(result); 41617 var hashHex = sjcl.codec.hex.fromBits(result);
@@ -18668,6 +43721,7 @@ window.Entropy = new (function() {
18668 43721
18669 var DOM = {}; 43722 var DOM = {};
18670 DOM.network = $(".network"); 43723 DOM.network = $(".network");
43724 DOM.bip32Client = $("#bip32-client");
18671 DOM.phraseNetwork = $("#network-phrase"); 43725 DOM.phraseNetwork = $("#network-phrase");
18672 DOM.useEntropy = $(".use-entropy"); 43726 DOM.useEntropy = $(".use-entropy");
18673 DOM.entropyContainer = $(".entropy-container"); 43727 DOM.entropyContainer = $(".entropy-container");
@@ -18722,6 +43776,7 @@ window.Entropy = new (function() {
18722 function init() { 43776 function init() {
18723 // Events 43777 // Events
18724 DOM.network.on("change", networkChanged); 43778 DOM.network.on("change", networkChanged);
43779 DOM.bip32Client.on("change", bip32ClientChanged);
18725 DOM.useEntropy.on("change", setEntropyVisibility); 43780 DOM.useEntropy.on("change", setEntropyVisibility);
18726 DOM.entropy.on("input", delayedEntropyChanged); 43781 DOM.entropy.on("input", delayedEntropyChanged);
18727 DOM.entropyMnemonicLength.on("change", entropyChanged); 43782 DOM.entropyMnemonicLength.on("change", entropyChanged);
@@ -18747,6 +43802,7 @@ window.Entropy = new (function() {
18747 hidePending(); 43802 hidePending();
18748 hideValidationError(); 43803 hideValidationError();
18749 populateNetworkSelect(); 43804 populateNetworkSelect();
43805 populateClientSelect();
18750 } 43806 }
18751 43807
18752 // Event handlers 43808 // Event handlers
@@ -18762,6 +43818,23 @@ window.Entropy = new (function() {
18762 } 43818 }
18763 } 43819 }
18764 43820
43821 function bip32ClientChanged(e) {
43822 var clientIndex = DOM.bip32Client.val();
43823 if (clientIndex == "custom") {
43824 DOM.bip32path.prop("readonly", false);
43825 }
43826 else {
43827 DOM.bip32path.prop("readonly", true);
43828 clients[clientIndex].onSelect();
43829 if (seed != null) {
43830 phraseChanged();
43831 }
43832 else {
43833 rootKeyChanged();
43834 }
43835 }
43836 }
43837
18765 function setEntropyVisibility() { 43838 function setEntropyVisibility() {
18766 if (isUsingOwnEntropy()) { 43839 if (isUsingOwnEntropy()) {
18767 DOM.entropyContainer.removeClass("hidden"); 43840 DOM.entropyContainer.removeClass("hidden");
@@ -19209,6 +44282,20 @@ window.Entropy = new (function() {
19209 if (useHardenedAddresses) { 44282 if (useHardenedAddresses) {
19210 indexText = indexText + "'"; 44283 indexText = indexText + "'";
19211 } 44284 }
44285 // Ethereum values are different
44286 if (networks[DOM.network.val()].name == "Ethereum") {
44287 var privKeyBuffer = key.privKey.d.toBuffer();
44288 privkey = privKeyBuffer.toString('hex');
44289 var addressBuffer = ethUtil.privateToAddress(privKeyBuffer);
44290 var hexAddress = addressBuffer.toString('hex');
44291 var checksumAddress = ethUtil.toChecksumAddress(hexAddress);
44292 address = ethUtil.addHexPrefix(checksumAddress);
44293 }
44294 // Ripple values are different
44295 if (networks[DOM.network.val()].name == "Ripple") {
44296 privkey = convertRipplePriv(privkey);
44297 address = convertRippleAdrr(address);
44298 }
19212 addAddressToList(indexText, address, pubkey, privkey); 44299 addAddressToList(indexText, address, pubkey, privkey);
19213 }, 50) 44300 }, 50)
19214 } 44301 }
@@ -19347,6 +44434,16 @@ window.Entropy = new (function() {
19347 } 44434 }
19348 } 44435 }
19349 44436
44437 function populateClientSelect() {
44438 for (var i=0; i<clients.length; i++) {
44439 var client = clients[i];
44440 var option = $("<option>");
44441 option.attr("value", i);
44442 option.text(client.name);
44443 DOM.bip32Client.append(option);
44444 }
44445 }
44446
19350 function getLanguage() { 44447 function getLanguage() {
19351 var defaultLanguage = "english"; 44448 var defaultLanguage = "english";
19352 // Try to get from existing phrase 44449 // Try to get from existing phrase
@@ -19692,10 +44789,10 @@ window.Entropy = new (function() {
19692 }, 44789 },
19693 }, 44790 },
19694 { 44791 {
19695 name: "Litecoin", 44792 name: "CLAM",
19696 onSelect: function() { 44793 onSelect: function() {
19697 network = bitcoin.networks.litecoin; 44794 network = bitcoin.networks.clam;
19698 DOM.bip44coin.val(2); 44795 DOM.bip44coin.val(23);
19699 }, 44796 },
19700 }, 44797 },
19701 { 44798 {
@@ -19706,6 +44803,62 @@ window.Entropy = new (function() {
19706 }, 44803 },
19707 }, 44804 },
19708 { 44805 {
44806 name: "DASH",
44807 onSelect: function() {
44808 network = bitcoin.networks.dash;
44809 DOM.bip44coin.val(5);
44810 },
44811 },
44812 {
44813 name: "Ethereum",
44814 onSelect: function() {
44815 network = bitcoin.networks.bitcoin;
44816 DOM.bip44coin.val(60);
44817 },
44818 },
44819 {
44820 name: "GAME",
44821 onSelect: function() {
44822 network = bitcoin.networks.game;
44823 DOM.bip44coin.val(101);
44824 },
44825 },
44826 {
44827 name: "Jumbucks",
44828 onSelect: function() {
44829 network = bitcoin.networks.jumbucks;
44830 DOM.bip44coin.val(26);
44831 },
44832 },
44833 {
44834 name: "Litecoin",
44835 onSelect: function() {
44836 network = bitcoin.networks.litecoin;
44837 DOM.bip44coin.val(2);
44838 },
44839 },
44840 {
44841 name: "Namecoin",
44842 onSelect: function() {
44843 network = bitcoin.networks.namecoin;
44844 DOM.bip44coin.val(7);
44845 },
44846 },
44847 {
44848 name: "Peercoin",
44849 onSelect: function() {
44850 network = bitcoin.networks.peercoin;
44851 DOM.bip44coin.val(6);
44852 },
44853 },
44854 {
44855 name: "Ripple",
44856 onSelect: function() {
44857 network = bitcoin.networks.bitcoin;
44858 DOM.bip44coin.val(144);
44859 },
44860 },
44861 {
19709 name: "ShadowCash", 44862 name: "ShadowCash",
19710 onSelect: function() { 44863 onSelect: function() {
19711 network = bitcoin.networks.shadow; 44864 network = bitcoin.networks.shadow;
@@ -19733,41 +44886,30 @@ window.Entropy = new (function() {
19733 DOM.bip44coin.val(1); 44886 DOM.bip44coin.val(1);
19734 }, 44887 },
19735 }, 44888 },
44889 ]
44890
44891 var clients = [
19736 { 44892 {
19737 name: "Jumbucks", 44893 name: "Bitcoin Core",
19738 onSelect: function() {
19739 network = bitcoin.networks.jumbucks;
19740 DOM.bip44coin.val(26);
19741 },
19742 },
19743 {
19744 name: "CLAM",
19745 onSelect: function() { 44894 onSelect: function() {
19746 network = bitcoin.networks.clam; 44895 DOM.bip32path.val("m/0'/0'");
19747 DOM.bip44coin.val(23); 44896 DOM.hardenedAddresses.prop('checked', true);
19748 }, 44897 },
19749 }, 44898 },
19750 { 44899 {
19751 name: "DASH", 44900 name: "blockchain.info",
19752 onSelect: function() { 44901 onSelect: function() {
19753 network = bitcoin.networks.dash; 44902 DOM.bip32path.val("m/44'/0'/0'");
19754 DOM.bip44coin.val(5); 44903 DOM.hardenedAddresses.prop('checked', false);
19755 }, 44904 },
19756 }, 44905 },
19757 { 44906 {
19758 name: "Namecoin", 44907 name: "MultiBit HD",
19759 onSelect: function() { 44908 onSelect: function() {
19760 network = bitcoin.networks.namecoin; 44909 DOM.bip32path.val("m/0'/0");
19761 DOM.bip44coin.val(7); 44910 DOM.hardenedAddresses.prop('checked', false);
19762 },
19763 },
19764 {
19765 name: "Peercoin",
19766 onSelect: function() {
19767 network = bitcoin.networks.peercoin;
19768 DOM.bip44coin.val(6);
19769 }, 44911 },
19770 }, 44912 }
19771 ] 44913 ]
19772 44914
19773 init(); 44915 init();