[JavaScript] 纯文本查看 复制代码
var window={},arc4={};
Array.isArray=function(obj){
//Array.isArray 是后面添加的方法,系统引擎不支持 添加一个isArray方法
return Object.prototype.toString.call(obj) === '[object Array]';
}
!function(e) {
if ("object" == typeof exports && "undefined" != typeof module)
module.exports = e();
else if ("function" == typeof define && define.amd)
define([], e);
else {
var f;
"undefined" != typeof window ? f = window : "undefined" != typeof global ? f = global : "undefined" != typeof self && (f = self),
f.arc4 = e();
arc4=e();//再定义 arc4() 即可用系统引擎调用
}
}(function() {
return function e(t, n, r) {
function s(o, u) {
if (!n[o]) {
if (!t[o]) {
var a = "function" == typeof require && 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
}
for (var i = "function" == typeof require && require, o = 0; o < r.length; o++)
s(r[o]);
return s
}({
1: [function(require, module) {
(function(Buffer) {
"use strict";
function gKsa(key) {
for (var j = 0, s = box.slice(), len = key.length, i = 0; 256 > i; i++)
j = (j + s + key[i % len]) % 256,
s[j] = [s, s = s[j]][0];
return s
}
function body(inp, gksa, container, length, skip) {
var i = 0
, j = 0
, out = container
, ksa = gksa.slice();
if (void 0 != skip && skip > 0)
for (var y = 0; skip > y; y++)
i = (i + 1) % 256,
j = (j + ksa) % 256,
ksa[j] = [ksa, ksa = ksa[j]][0];
for (var y = 0; length > y; y++)
i = (i + 1) % 256,
j = (j + ksa) % 256,
ksa[j] = [ksa, ksa = ksa[j]][0],
out[y] = inp[y] ^ ksa[(ksa + ksa[j]) % 256];
return out
}
function ARC4(key) {
this.key = null,
this.ksa = null,
this.change(key)
}
var box = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255];
module.exports = function(password) {
return new ARC4(password)
}
,
ARC4.prototype.change = function(key) {
if (Array.isArray(key))
this.key = key;
else {
if ("string" != typeof key && !Buffer.isBuffer(key))
throw new Error("Invalid data");
this.key = new Array(key.length);
for (var keys = new Buffer(key,"binary"), i = 0, ii = keys.length; ii > i; i++)
this.key = keys
}
this.ksa = gKsa(this.key)
}
,
ARC4.prototype.codeString = function(str) {
console.info('arc4 > "codeString" method is deprecated');
for (var i = 0, j = 0, out = "", ksa = this.ksa.slice(), y = 0, l = str.length; l > y; y++)
i = (i + 1) % 256,
j = (j + ksa) % 256,
ksa[j] = [ksa, ksa = ksa[j]][0],
out += String.fromCharCode(str.charCodeAt(y) ^ ksa[(ksa + ksa[j]) % 256]);
return out
}
,
ARC4.prototype.encodeString = function(str, input_encoding, output_encoding, skip) {
var out = new Buffer(str,input_encoding || "utf8")
, l = out.length;
return new Buffer(body(out, this.ksa, new Buffer(l), l, skip)).toString(output_encoding || "hex")
}
,
ARC4.prototype.decodeString = function(str, input_encoding, output_encoding, skip) {
var out = new Buffer(str,input_encoding || "hex")
, l = out.length;
return new Buffer(body(out, this.ksa, new Buffer(l), l, skip)).toString(output_encoding || "utf8")
}
,
ARC4.prototype.codeArray = ARC4.prototype.encodeArray = ARC4.prototype.decodeArray = function(arr, skip) {
var l = arr.length;
return body(arr, this.ksa, new Array(l), l, skip)
}
,
ARC4.prototype.codeBuffer = ARC4.prototype.encodeBuffer = ARC4.prototype.decodeBuffer = function(buff, skip) {
var l = buff.length;
return body(buff, this.ksa, new Buffer(l), l, skip)
}
,
ARC4.prototype.encode = function(boh, input_encoding, output_encoding) {
if ("string" == typeof boh)
return this.encodeString(boh, input_encoding, output_encoding);
if (Array.isArray(boh))
return this.encodeArray(boh);
if (Buffer.isBuffer(boh))
return this.encodeBuffer(boh);
throw new Error("Invalid data")
}
,
ARC4.prototype.decode = function(boh, input_encoding, output_encoding) {
if ("string" == typeof boh)
return this.decodeString(boh, input_encoding, output_encoding);
if (Array.isArray(boh))
return this.decodeArray(boh);
if (Buffer.isBuffer(boh))
return this.decodeBuffer(boh);
throw new Error("Invalid data")
}
,
ARC4.prototype.code = function(boh) {
if ("string" == typeof boh)
return this.codeString(boh);
if (Array.isArray(boh))
return this.codeArray(boh);
if (Buffer.isBuffer(boh))
return this.codeBuffer(boh);
throw new Error("Invalid data")
}
}
).call(this, require("buffer").Buffer)
}
, {
buffer: 2
}],
2: [function(require, module, exports) {
function Buffer(subject, encoding, noZero) {
if (!(this instanceof Buffer))
return new Buffer(subject,encoding,noZero);
var length, type = typeof subject;
if ("number" === type)
length = subject > 0 ? subject >>> 0 : 0;
else if ("string" === type)
length = Buffer.byteLength(subject, encoding);
else {
if ("object" !== type || null === subject)
throw new TypeError("must start with number, buffer, array or string");
"Buffer" === subject.type && isArray(subject.data) && (subject = subject.data),
length = +subject.length > 0 ? Math.floor(+subject.length) : 0
}
if (length > kMaxLength)
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength.toString(16) + " bytes");
var buf;
Buffer.TYPED_ARRAY_SUPPORT ? buf = Buffer._augment(new Uint8Array(length)) : (buf = this,
buf.length = length,
buf._isBuffer = !0);
var i;
if (Buffer.TYPED_ARRAY_SUPPORT && "number" == typeof subject.byteLength)
buf._set(subject);
else if (isArrayish(subject))
if (Buffer.isBuffer(subject))
for (i = 0; length > i; i++)
buf = subject.readUInt8(i);
else
for (i = 0; length > i; i++)
buf = (subject % 256 + 256) % 256;
else if ("string" === type)
buf.write(subject, 0, encoding);
else if ("number" === type && !Buffer.TYPED_ARRAY_SUPPORT && !noZero)
for (i = 0; length > i; i++)
buf = 0;
return length > 0 && length <= Buffer.poolSize && (buf.parent = rootParent),
buf
}
function SlowBuffer(subject, encoding, noZero) {
if (!(this instanceof SlowBuffer))
return new SlowBuffer(subject,encoding,noZero);
var buf = new Buffer(subject,encoding,noZero);
return delete buf.parent,
buf
}
function hexWrite(buf, string, offset, length) {
offset = Number(offset) || 0;
var remaining = buf.length - offset;
length ? (length = Number(length),
length > remaining && (length = remaining)) : length = remaining;
var strLen = string.length;
if (strLen % 2 !== 0)
throw new Error("Invalid hex string");
length > strLen / 2 && (length = strLen / 2);
for (var i = 0; length > i; i++) {
var byte = parseInt(string.substr(2 * i, 2), 16);
if (isNaN(byte))
throw new Error("Invalid hex string");
buf[offset + i] = byte
}
return i
}
function utf8Write(buf, string, offset, length) {
var charsWritten = blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
return charsWritten
}
function asciiWrite(buf, string, offset, length) {
var charsWritten = blitBuffer(asciiToBytes(string), buf, offset, length);
return charsWritten
}
function binaryWrite(buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
function base64Write(buf, string, offset, length) {
var charsWritten = blitBuffer(base64ToBytes(string), buf, offset, length);
return charsWritten
}
function utf16leWrite(buf, string, offset, length) {
var charsWritten = blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length, 2);
return charsWritten
}
function base64Slice(buf, start, end) {
return base64.fromByteArray(0 === start && end === buf.length ? buf : buf.slice(start, end))
}
function utf8Slice(buf, start, end) {
var res = ""
, tmp = "";
end = Math.min(buf.length, end);
for (var i = start; end > i; i++)
buf <= 127 ? (res += decodeUtf8Char(tmp) + String.fromCharCode(buf),
tmp = "") : tmp += "%" + buf.toString(16);
return res + decodeUtf8Char(tmp)
}
function asciiSlice(buf, start, end) {
var ret = "";
end = Math.min(buf.length, end);
for (var i = start; end > i; i++)
ret += String.fromCharCode(127 & buf);
return ret
}
function binarySlice(buf, start, end) {
var ret = "";
end = Math.min(buf.length, end);
for (var i = start; end > i; i++)
ret += String.fromCharCode(buf);
return ret
}
function hexSlice(buf, start, end) {
var len = buf.length;
(!start || 0 > start) && (start = 0),
(!end || 0 > end || end > len) && (end = len);
for (var out = "", i = start; end > i; i++)
out += toHex(buf);
return out
}
function utf16leSlice(buf, start, end) {
for (var bytes = buf.slice(start, end), res = "", i = 0; i < bytes.length; i += 2)
res += String.fromCharCode(bytes + 256 * bytes[i + 1]);
return res
}
function checkOffset(offset, ext, length) {
if (offset % 1 !== 0 || 0 > offset)
throw new RangeError("offset is not uint");
if (offset + ext > length)
throw new RangeError("Trying to access beyond buffer length")
}
function checkInt(buf, value, offset, ext, max, min) {
if (!Buffer.isBuffer(buf))
throw new TypeError("buffer must be a Buffer instance");
if (value > max || min > value)
throw new RangeError("value is out of bounds");
if (offset + ext > buf.length)
throw new RangeError("index out of range")
}
function objectWriteUInt16(buf, value, offset, littleEndian) {
0 > value && (value = 65535 + value + 1);
for (var i = 0, j = Math.min(buf.length - offset, 2); j > i; i++)
buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> 8 * (littleEndian ? i : 1 - i)
}
function objectWriteUInt32(buf, value, offset, littleEndian) {
0 > value && (value = 4294967295 + value + 1);
for (var i = 0, j = Math.min(buf.length - offset, 4); j > i; i++)
buf[offset + i] = value >>> 8 * (littleEndian ? i : 3 - i) & 255
}
function checkIEEE754(buf, value, offset, ext, max, min) {
if (value > max || min > value)
throw new RangeError("value is out of bounds");
if (offset + ext > buf.length)
throw new RangeError("index out of range");
if (0 > offset)
throw new RangeError("index out of range")
}
function writeFloat(buf, value, offset, littleEndian, noAssert) {
return noAssert || checkIEEE754(buf, value, offset, 4, 3.4028234663852886e38, -3.4028234663852886e38),
ieee754.write(buf, value, offset, littleEndian, 23, 4),
offset + 4
}
function writeDouble(buf, value, offset, littleEndian, noAssert) {
return noAssert || checkIEEE754(buf, value, offset, 8, 1.7976931348623157e308, -1.7976931348623157e308),
ieee754.write(buf, value, offset, littleEndian, 52, 8),
offset + 8
}
function base64clean(str) {
if (str = stringtrim(str).replace(INVALID_BASE64_RE, ""),
str.length < 2)
return "";
for (; str.length % 4 !== 0; )
str += "=";
return str
}
function stringtrim(str) {
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "")
}
function isArrayish(subject) {
return isArray(subject) || Buffer.isBuffer(subject) || subject && "object" == typeof subject && "number" == typeof subject.length
}
function toHex(n) {
return 16 > n ? "0" + n.toString(16) : n.toString(16)
}
function utf8ToBytes(string, units) {
var codePoint, length = string.length, leadSurrogate = null;
units = units || 1 / 0;
for (var bytes = [], i = 0; length > i; i++) {
if (codePoint = string.charCodeAt(i),
codePoint > 55295 && 57344 > codePoint) {
if (!leadSurrogate) {
if (codePoint > 56319) {
(units -= 3) > -1 && bytes.push(239, 191, 189);
continue
}
if (i + 1 === length) {
(units -= 3) > -1 && bytes.push(239, 191, 189);
continue
}
leadSurrogate = codePoint;
continue
}
if (56320 > codePoint) {
(units -= 3) > -1 && bytes.push(239, 191, 189),
leadSurrogate = codePoint;
continue
}
codePoint = leadSurrogate - 55296 << 10 | codePoint - 56320 | 65536,
leadSurrogate = null
} else
leadSurrogate && ((units -= 3) > -1 && bytes.push(239, 191, 189),
leadSurrogate = null);
if (128 > codePoint) {
if ((units -= 1) < 0)
break;
bytes.push(codePoint)
} else if (2048 > codePoint) {
if ((units -= 2) < 0)
break;
bytes.push(codePoint >> 6 | 192, 63 & codePoint | 128)
} else if (65536 > codePoint) {
if ((units -= 3) < 0)
break;
bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, 63 & codePoint | 128)
} else {
if (!(2097152 > codePoint))
throw new Error("Invalid code point");
if ((units -= 4) < 0)
break;
bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, 63 & codePoint | 128)
}
}
return bytes
}
function asciiToBytes(str) {
for (var byteArray = [], i = 0; i < str.length; i++)
byteArray.push(255 & str.charCodeAt(i));
return byteArray
}
function utf16leToBytes(str, units) {
for (var c, hi, lo, byteArray = [], i = 0; i < str.length && !((units -= 2) < 0); i++)
c = str.charCodeAt(i),
hi = c >> 8,
lo = c % 256,
byteArray.push(lo),
byteArray.push(hi);
return byteArray
}
function base64ToBytes(str) {
return base64.toByteArray(base64clean(str))
}
function blitBuffer(src, dst, offset, length, unitSize) {
unitSize && (length -= length % unitSize);
for (var i = 0; length > i && !(i + offset >= dst.length || i >= src.length); i++)
dst[i + offset] = src;
return i
}
function decodeUtf8Char(str) {
try {
return decodeURIComponent(str)
} catch (err) {
return String.fromCharCode(65533)
}
}
var base64 = require("base64-js")
, ieee754 = require("ieee754")
, isArray = require("is-array");
exports.Buffer = Buffer,
exports.SlowBuffer = SlowBuffer,
exports.INSPECT_MAX_BYTES = 50,
Buffer.poolSize = 8192;
var kMaxLength = 1073741823
, rootParent = {};
Buffer.TYPED_ARRAY_SUPPORT = function() {
try {
var buf = new ArrayBuffer(0)
, arr = new Uint8Array(buf);
return arr.foo = function() {
return 42
}
,
42 === arr.foo() && "function" == typeof arr.subarray && 0 === new Uint8Array(1).subarray(1, 1).byteLength
} catch (e) {
return !1
}
}(),
Buffer.isBuffer = function(b) {
return !(null == b || !b._isBuffer)
}
,
Buffer.compare = function(a, b) {
if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b))
throw new TypeError("Arguments must be Buffers");
for (var x = a.length, y = b.length, i = 0, len = Math.min(x, y); len > i && a === b; i++)
;
return i !== len && (x = a,
y = b),
y > x ? -1 : x > y ? 1 : 0
}
,
Buffer.isEncoding = function(encoding) {
switch (String(encoding).toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "binary":
case "base64":
case "raw":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return !0;
default:
return !1
}
}
,
Buffer.concat = function(list, totalLength) {
if (!isArray(list))
throw new TypeError("Usage: Buffer.concat(list[, length])");
if (0 === list.length)
return new Buffer(0);
if (1 === list.length)
return list[0];
var i;
if (void 0 === totalLength)
for (totalLength = 0,
i = 0; i < list.length; i++)
totalLength += list.length;
var buf = new Buffer(totalLength)
, pos = 0;
for (i = 0; i < list.length; i++) {
var item = list;
item.copy(buf, pos),
pos += item.length
}
return buf
}
,
Buffer.byteLength = function(str, encoding) {
var ret;
switch (str += "",
encoding || "utf8") {
case "ascii":
case "binary":
case "raw":
ret = str.length;
break;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
ret = 2 * str.length;
break;
case "hex":
ret = str.length >>> 1;
break;
case "utf8":
case "utf-8":
ret = utf8ToBytes(str).length;
break;
case "base64":
ret = base64ToBytes(str).length;
break;
default:
ret = str.length
}
return ret
}
,
Buffer.prototype.length = void 0,
Buffer.prototype.parent = void 0,
Buffer.prototype.toString = function(encoding, start, end) {
var loweredCase = !1;
if (start >>>= 0,
end = void 0 === end || 1 / 0 === end ? this.length : end >>> 0,
encoding || (encoding = "utf8"),
0 > start && (start = 0),
end > this.length && (end = this.length),
start >= end)
return "";
for (; ; )
switch (encoding) {
case "hex":
return hexSlice(this, start, end);
case "utf8":
case "utf-8":
return utf8Slice(this, start, end);
case "ascii":
return asciiSlice(this, start, end);
case "binary":
return binarySlice(this, start, end);
case "base64":
return base64Slice(this, start, end);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return utf16leSlice(this, start, end);
default:
if (loweredCase)
throw new TypeError("Unknown encoding: " + encoding);
encoding = (encoding + "").toLowerCase(),
loweredCase = !0
}
}
,
Buffer.prototype.equals = function(b) {
if (!Buffer.isBuffer(b))
throw new TypeError("Argument must be a Buffer");
return 0 === Buffer.compare(this, b)
}
,
Buffer.prototype.inspect = function() {
var str = ""
, max = exports.INSPECT_MAX_BYTES;
return this.length > 0 && (str = this.toString("hex", 0, max).match(/.{2}/g).join(" "),
this.length > max && (str += " ... ")),
"<Buffer " + str + ">"
}
,
Buffer.prototype.compare = function(b) {
if (!Buffer.isBuffer(b))
throw new TypeError("Argument must be a Buffer");
return Buffer.compare(this, b)
}
,
Buffer.prototype.get = function(offset) {
return console.log(".get() is deprecated. Access using array indexes instead."),
this.readUInt8(offset)
}
,
Buffer.prototype.set = function(v, offset) {
return console.log(".set() is deprecated. Access using array indexes instead."),
this.writeUInt8(v, offset)
}
,
Buffer.prototype.write = function(string, offset, length, encoding) {
if (isFinite(offset))
isFinite(length) || (encoding = length,
length = void 0);
else {
var swap = encoding;
encoding = offset,
offset = length,
length = swap
}
if (offset = Number(offset) || 0,
0 > length || 0 > offset || offset > this.length)
throw new RangeError("attempt to write outside buffer bounds");
var remaining = this.length - offset;
length ? (length = Number(length),
length > remaining && (length = remaining)) : length = remaining,
encoding = String(encoding || "utf8").toLowerCase();
var ret;
switch (encoding) {
case "hex":
ret = hexWrite(this, string, offset, length);
break;
case "utf8":
case "utf-8":
ret = utf8Write(this, string, offset, length);
break;
case "ascii":
ret = asciiWrite(this, string, offset, length);
break;
case "binary":
ret = binaryWrite(this, string, offset, length);
break;
case "base64":
ret = base64Write(this, string, offset, length);
break;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
ret = utf16leWrite(this, string, offset, length);
break;
default:
throw new TypeError("Unknown encoding: " + encoding)
}
return ret
}
,
Buffer.prototype.toJSON = function() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
}
}
,
Buffer.prototype.slice = function(start, end) {
var len = this.length;
start = ~~start,
end = void 0 === end ? len : ~~end,
0 > start ? (start += len,
0 > start && (start = 0)) : start > len && (start = len),
0 > end ? (end += len,
0 > end && (end = 0)) : end > len && (end = len),
start > end && (end = start);
var newBuf;
if (Buffer.TYPED_ARRAY_SUPPORT)
newBuf = Buffer._augment(this.subarray(start, end));
else {
var sliceLen = end - start;
newBuf = new Buffer(sliceLen,void 0,!0);
for (var i = 0; sliceLen > i; i++)
newBuf = this[i + start]
}
return newBuf.length && (newBuf.parent = this.parent || this),
newBuf
}
,
Buffer.prototype.readUIntLE = function(offset, byteLength, noAssert) {
offset >>>= 0,
byteLength >>>= 0,
noAssert || checkOffset(offset, byteLength, this.length);
for (var val = this[offset], mul = 1, i = 0; ++i < byteLength && (mul *= 256); )
val += this[offset + i] * mul;
return val
}
,
Buffer.prototype.readUIntBE = function(offset, byteLength, noAssert) {
offset >>>= 0,
byteLength >>>= 0,
noAssert || checkOffset(offset, byteLength, this.length);
for (var val = this[offset + --byteLength], mul = 1; byteLength > 0 && (mul *= 256); )
val += this[offset + --byteLength] * mul;
return val
}
,
Buffer.prototype.readUInt8 = function(offset, noAssert) {
return noAssert || checkOffset(offset, 1, this.length),
this[offset]
}
,
Buffer.prototype.readUInt16LE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 2, this.length),
this[offset] | this[offset + 1] << 8
}
,
Buffer.prototype.readUInt16BE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 2, this.length),
this[offset] << 8 | this[offset + 1]
}
,
Buffer.prototype.readUInt32LE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 4, this.length),
(this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + 16777216 * this[offset + 3]
}
,
Buffer.prototype.readUInt32BE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 4, this.length),
16777216 * this[offset] + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3])
}
,
Buffer.prototype.readIntLE = function(offset, byteLength, noAssert) {
offset >>>= 0,
byteLength >>>= 0,
noAssert || checkOffset(offset, byteLength, this.length);
for (var val = this[offset], mul = 1, i = 0; ++i < byteLength && (mul *= 256); )
val += this[offset + i] * mul;
return mul *= 128,
val >= mul && (val -= Math.pow(2, 8 * byteLength)),
val
}
,
Buffer.prototype.readIntBE = function(offset, byteLength, noAssert) {
offset >>>= 0,
byteLength >>>= 0,
noAssert || checkOffset(offset, byteLength, this.length);
for (var i = byteLength, mul = 1, val = this[offset + --i]; i > 0 && (mul *= 256); )
val += this[offset + --i] * mul;
return mul *= 128,
val >= mul && (val -= Math.pow(2, 8 * byteLength)),
val
}
,
Buffer.prototype.readInt8 = function(offset, noAssert) {
return noAssert || checkOffset(offset, 1, this.length),
128 & this[offset] ? -1 * (255 - this[offset] + 1) : this[offset]
}
,
Buffer.prototype.readInt16LE = function(offset, noAssert) {
noAssert || checkOffset(offset, 2, this.length);
var val = this[offset] | this[offset + 1] << 8;
return 32768 & val ? 4294901760 | val : val
}
,
Buffer.prototype.readInt16BE = function(offset, noAssert) {
noAssert || checkOffset(offset, 2, this.length);
var val = this[offset + 1] | this[offset] << 8;
return 32768 & val ? 4294901760 | val : val
}
,
Buffer.prototype.readInt32LE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 4, this.length),
this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24
}
,
Buffer.prototype.readInt32BE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 4, this.length),
this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]
}
,
Buffer.prototype.readFloatLE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 4, this.length),
ieee754.read(this, offset, !0, 23, 4)
}
,
Buffer.prototype.readFloatBE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 4, this.length),
ieee754.read(this, offset, !1, 23, 4)
}
,
Buffer.prototype.readDoubleLE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 8, this.length),
ieee754.read(this, offset, !0, 52, 8)
}
,
Buffer.prototype.readDoubleBE = function(offset, noAssert) {
return noAssert || checkOffset(offset, 8, this.length),
ieee754.read(this, offset, !1, 52, 8)
}
,
Buffer.prototype.writeUIntLE = function(value, offset, byteLength, noAssert) {
value = +value,
offset >>>= 0,
byteLength >>>= 0,
noAssert || checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0);
var mul = 1
, i = 0;
for (this[offset] = 255 & value; ++i < byteLength && (mul *= 256); )
this[offset + i] = value / mul >>> 0 & 255;
return offset + byteLength
}
,
Buffer.prototype.writeUIntBE = function(value, offset, byteLength, noAssert) {
value = +value,
offset >>>= 0,
byteLength >>>= 0,
noAssert || checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength), 0);
var i = byteLength - 1
, mul = 1;
for (this[offset + i] = 255 & value; --i >= 0 && (mul *= 256); )
this[offset + i] = value / mul >>> 0 & 255;
return offset + byteLength
}
,
Buffer.prototype.writeUInt8 = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 1, 255, 0),
Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)),
this[offset] = value,
offset + 1
}
,
Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 2, 65535, 0),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value,
this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, !0),
offset + 2
}
,
Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 2, 65535, 0),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8,
this[offset + 1] = value) : objectWriteUInt16(this, value, offset, !1),
offset + 2
}
,
Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 4, 4294967295, 0),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset + 3] = value >>> 24,
this[offset + 2] = value >>> 16,
this[offset + 1] = value >>> 8,
this[offset] = value) : objectWriteUInt32(this, value, offset, !0),
offset + 4
}
,
Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 4, 4294967295, 0),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24,
this[offset + 1] = value >>> 16,
this[offset + 2] = value >>> 8,
this[offset + 3] = value) : objectWriteUInt32(this, value, offset, !1),
offset + 4
}
,
Buffer.prototype.writeIntLE = function(value, offset, byteLength, noAssert) {
value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength - 1) - 1, -Math.pow(2, 8 * byteLength - 1));
var i = 0
, mul = 1
, sub = 0 > value ? 1 : 0;
for (this[offset] = 255 & value; ++i < byteLength && (mul *= 256); )
this[offset + i] = (value / mul >> 0) - sub & 255;
return offset + byteLength
}
,
Buffer.prototype.writeIntBE = function(value, offset, byteLength, noAssert) {
value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength - 1) - 1, -Math.pow(2, 8 * byteLength - 1));
var i = byteLength - 1
, mul = 1
, sub = 0 > value ? 1 : 0;
for (this[offset + i] = 255 & value; --i >= 0 && (mul *= 256); )
this[offset + i] = (value / mul >> 0) - sub & 255;
return offset + byteLength
}
,
Buffer.prototype.writeInt8 = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 1, 127, -128),
Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)),
0 > value && (value = 255 + value + 1),
this[offset] = value,
offset + 1
}
,
Buffer.prototype.writeInt16LE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 2, 32767, -32768),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value,
this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, !0),
offset + 2
}
,
Buffer.prototype.writeInt16BE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 2, 32767, -32768),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8,
this[offset + 1] = value) : objectWriteUInt16(this, value, offset, !1),
offset + 2
}
,
Buffer.prototype.writeInt32LE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value,
this[offset + 1] = value >>> 8,
this[offset + 2] = value >>> 16,
this[offset + 3] = value >>> 24) : objectWriteUInt32(this, value, offset, !0),
offset + 4
}
,
Buffer.prototype.writeInt32BE = function(value, offset, noAssert) {
return value = +value,
offset >>>= 0,
noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648),
0 > value && (value = 4294967295 + value + 1),
Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24,
this[offset + 1] = value >>> 16,
this[offset + 2] = value >>> 8,
this[offset + 3] = value) : objectWriteUInt32(this, value, offset, !1),
offset + 4
}
,
Buffer.prototype.writeFloatLE = function(value, offset, noAssert) {
return writeFloat(this, value, offset, !0, noAssert)
}
,
Buffer.prototype.writeFloatBE = function(value, offset, noAssert) {
return writeFloat(this, value, offset, !1, noAssert)
}
,
Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) {
return writeDouble(this, value, offset, !0, noAssert)
}
,
Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) {
return writeDouble(this, value, offset, !1, noAssert)
}
,
Buffer.prototype.copy = function(target, target_start, start, end) {
var source = this;
if (start || (start = 0),
end || 0 === end || (end = this.length),
target_start >= target.length && (target_start = target.length),
target_start || (target_start = 0),
end > 0 && start > end && (end = start),
end === start)
return 0;
if (0 === target.length || 0 === source.length)
return 0;
if (0 > target_start)
throw new RangeError("targetStart out of bounds");
if (0 > start || start >= source.length)
throw new RangeError("sourceStart out of bounds");
if (0 > end)
throw new RangeError("sourceEnd out of bounds");
end > this.length && (end = this.length),
target.length - target_start < end - start && (end = target.length - target_start + start);
var len = end - start;
if (1e3 > len || !Buffer.TYPED_ARRAY_SUPPORT)
for (var i = 0; len > i; i++)
target[i + target_start] = this[i + start];
else
target._set(this.subarray(start, start + len), target_start);
return len
}
,
Buffer.prototype.fill = function(value, start, end) {
if (value || (value = 0),
start || (start = 0),
end || (end = this.length),
start > end)
throw new RangeError("end < start");
if (end !== start && 0 !== this.length) {
if (0 > start || start >= this.length)
throw new RangeError("start out of bounds");
if (0 > end || end > this.length)
throw new RangeError("end out of bounds");
var i;
if ("number" == typeof value)
for (i = start; end > i; i++)
this = value;
else {
var bytes = utf8ToBytes(value.toString())
, len = bytes.length;
for (i = start; end > i; i++)
this = bytes[i % len]
}
return this
}
}
,
Buffer.prototype.toArrayBuffer = function() {
if ("undefined" != typeof Uint8Array) {
if (Buffer.TYPED_ARRAY_SUPPORT)
return new Buffer(this).buffer;
for (var buf = new Uint8Array(this.length), i = 0, len = buf.length; len > i; i += 1)
buf = this;
return buf.buffer
}
throw new TypeError("Buffer.toArrayBuffer not supported in this browser")
}
;
var BP = Buffer.prototype;
Buffer._augment = function(arr) {
return arr.constructor = Buffer,
arr._isBuffer = !0,
arr._get = arr.get,
arr._set = arr.set,
arr.get = BP.get,
arr.set = BP.set,
arr.write = BP.write,
arr.toString = BP.toString,
arr.toLocaleString = BP.toString,
arr.toJSON = BP.toJSON,
arr.equals = BP.equals,
arr.compare = BP.compare,
arr.copy = BP.copy,
arr.slice = BP.slice,
arr.readUIntLE = BP.readUIntLE,
arr.readUIntBE = BP.readUIntBE,
arr.readUInt8 = BP.readUInt8,
arr.readUInt16LE = BP.readUInt16LE,
arr.readUInt16BE = BP.readUInt16BE,
arr.readUInt32LE = BP.readUInt32LE,
arr.readUInt32BE = BP.readUInt32BE,
arr.readIntLE = BP.readIntLE,
arr.readIntBE = BP.readIntBE,
arr.readInt8 = BP.readInt8,
arr.readInt16LE = BP.readInt16LE,
arr.readInt16BE = BP.readInt16BE,
arr.readInt32LE = BP.readInt32LE,
arr.readInt32BE = BP.readInt32BE,
arr.readFloatLE = BP.readFloatLE,
arr.readFloatBE = BP.readFloatBE,
arr.readDoubleLE = BP.readDoubleLE,
arr.readDoubleBE = BP.readDoubleBE,
arr.writeUInt8 = BP.writeUInt8,
arr.writeUIntLE = BP.writeUIntLE,
arr.writeUIntBE = BP.writeUIntBE,
arr.writeUInt16LE = BP.writeUInt16LE,
arr.writeUInt16BE = BP.writeUInt16BE,
arr.writeUInt32LE = BP.writeUInt32LE,
arr.writeUInt32BE = BP.writeUInt32BE,
arr.writeIntLE = BP.writeIntLE,
arr.writeIntBE = BP.writeIntBE,
arr.writeInt8 = BP.writeInt8,
arr.writeInt16LE = BP.writeInt16LE,
arr.writeInt16BE = BP.writeInt16BE,
arr.writeInt32LE = BP.writeInt32LE,
arr.writeInt32BE = BP.writeInt32BE,
arr.writeFloatLE = BP.writeFloatLE,
arr.writeFloatBE = BP.writeFloatBE,
arr.writeDoubleLE = BP.writeDoubleLE,
arr.writeDoubleBE = BP.writeDoubleBE,
arr.fill = BP.fill,
arr.inspect = BP.inspect,
arr.toArrayBuffer = BP.toArrayBuffer,
arr
}
;
var INVALID_BASE64_RE = /[^+\/0-9A-z\-]/g
}
, {
"base64-js": 3,
ieee754: 4,
"is-array": 5
}],
3: [function(require, module, exports) {
var lookup = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
!function(exports) {
"use strict";
function decode(elt) {
var code = elt.charCodeAt(0);
return code === PLUS || code === PLUS_URL_SAFE ? 62 : code === SLASH || code === SLASH_URL_SAFE ? 63 : NUMBER > code ? -1 : NUMBER + 10 > code ? code - NUMBER + 26 + 26 : UPPER + 26 > code ? code - UPPER : LOWER + 26 > code ? code - LOWER + 26 : void 0
}
function b64ToByteArray(b64) {
function push(v) {
arr[L++] = v
}
var i, j, l, tmp, placeHolders, arr;
if (b64.length % 4 > 0)
throw new Error("Invalid string. Length must be a multiple of 4");
var len = b64.length;
placeHolders = "=" === b64.charAt(len - 2) ? 2 : "=" === b64.charAt(len - 1) ? 1 : 0,
arr = new Arr(3 * b64.length / 4 - placeHolders),
l = placeHolders > 0 ? b64.length - 4 : b64.length;
var L = 0;
for (i = 0,
j = 0; l > i; i += 4,
j += 3)
tmp = decode(b64.charAt(i)) << 18 | decode(b64.charAt(i + 1)) << 12 | decode(b64.charAt(i + 2)) << 6 | decode(b64.charAt(i + 3)),
push((16711680 & tmp) >> 16),
push((65280 & tmp) >> 8),
push(255 & tmp);
return 2 === placeHolders ? (tmp = decode(b64.charAt(i)) << 2 | decode(b64.charAt(i + 1)) >> 4,
push(255 & tmp)) : 1 === placeHolders && (tmp = decode(b64.charAt(i)) << 10 | decode(b64.charAt(i + 1)) << 4 | decode(b64.charAt(i + 2)) >> 2,
push(tmp >> 8 & 255),
push(255 & tmp)),
arr
}
function uint8ToBase64(uint8) {
function encode(num) {
return lookup.charAt(num)
}
function tripletToBase64(num) {
return encode(num >> 18 & 63) + encode(num >> 12 & 63) + encode(num >> 6 & 63) + encode(63 & num)
}
var i, temp, length, extraBytes = uint8.length % 3, output = "";
for (i = 0,
length = uint8.length - extraBytes; length > i; i += 3)
temp = (uint8 << 16) + (uint8[i + 1] << 8) + uint8[i + 2],
output += tripletToBase64(temp);
switch (extraBytes) {
case 1:
temp = uint8[uint8.length - 1],
output += encode(temp >> 2),
output += encode(temp << 4 & 63),
output += "==";
break;
case 2:
temp = (uint8[uint8.length - 2] << 8) + uint8[uint8.length - 1],
output += encode(temp >> 10),
output += encode(temp >> 4 & 63),
output += encode(temp << 2 & 63),
output += "="
}
return output
}
var Arr = "undefined" != typeof Uint8Array ? Uint8Array : Array
, PLUS = "+".charCodeAt(0)
, SLASH = "/".charCodeAt(0)
, NUMBER = "0".charCodeAt(0)
, LOWER = "a".charCodeAt(0)
, UPPER = "A".charCodeAt(0)
, PLUS_URL_SAFE = "-".charCodeAt(0)
, SLASH_URL_SAFE = "_".charCodeAt(0);
exports.toByteArray = b64ToByteArray,
exports.fromByteArray = uint8ToBase64
}("undefined" == typeof exports ? this.base64js = {} : exports)
}
, {}],
4: [function(require, module, exports) {
exports.read = function(buffer, offset, isLE, mLen, nBytes) {
var e, m, eLen = 8 * nBytes - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, nBits = -7, i = isLE ? nBytes - 1 : 0, d = isLE ? -1 : 1, s = buffer[offset + i];
for (i += d,
e = s & (1 << -nBits) - 1,
s >>= -nBits,
nBits += eLen; nBits > 0; e = 256 * e + buffer[offset + i],
i += d,
nBits -= 8)
;
for (m = e & (1 << -nBits) - 1,
e >>= -nBits,
nBits += mLen; nBits > 0; m = 256 * m + buffer[offset + i],
i += d,
nBits -= 8)
;
if (0 === e)
e = 1 - eBias;
else {
if (e === eMax)
return m ? 0 / 0 : 1 / 0 * (s ? -1 : 1);
m += Math.pow(2, mLen),
e -= eBias
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}
,
exports.write = function(buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c, eLen = 8 * nBytes - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, rt = 23 === mLen ? Math.pow(2, -24) - Math.pow(2, -77) : 0, i = isLE ? 0 : nBytes - 1, d = isLE ? 1 : -1, s = 0 > value || 0 === value && 0 > 1 / value ? 1 : 0;
for (value = Math.abs(value),
isNaN(value) || 1 / 0 === value ? (m = isNaN(value) ? 1 : 0,
e = eMax) : (e = Math.floor(Math.log(value) / Math.LN2),
value * (c = Math.pow(2, -e)) < 1 && (e--,
c *= 2),
value += e + eBias >= 1 ? rt / c : rt * Math.pow(2, 1 - eBias),
value * c >= 2 && (e++,
c /= 2),
e + eBias >= eMax ? (m = 0,
e = eMax) : e + eBias >= 1 ? (m = (value * c - 1) * Math.pow(2, mLen),
e += eBias) : (m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen),
e = 0)); mLen >= 8; buffer[offset + i] = 255 & m,
i += d,
m /= 256,
mLen -= 8)
;
for (e = e << mLen | m,
eLen += mLen; eLen > 0; buffer[offset + i] = 255 & e,
i += d,
e /= 256,
eLen -= 8)
;
buffer[offset + i - d] |= 128 * s
}
}
, {}],
5: [function(require, module) {
var isArray = Array.isArray
, str = Object.prototype.toString;
module.exports = isArray || function(val) {
return !!val && "[object Array]" == str.call(val)
}
}
, {}]
}, {}, [1])(1)
});
var DEFAULT_RC4_KEY = "\x52\xf1\x12\xc0\x15\x9e\x88\xa0\x0c\xfb\x35\x76\xe2\x4c\xd1\xcd";
var RC4_SKIP_LENGTH = 1020;
function do_encrypt (input) {
var rc = new arc4 (DEFAULT_RC4_KEY);
return rc.encodeString (input, "utf8", "base64", RC4_SKIP_LENGTH);
}
function do_decrypt (input) {
var rc = new arc4 (DEFAULT_RC4_KEY);
return rc.decodeString (input, "base64", "utf8", RC4_SKIP_LENGTH);
}