Created
July 4, 2015 16:52
-
-
Save elliottsj/4d9ed932a64548cca3c0 to your computer and use it in GitHub Desktop.
firebase-web.js: minified and beautified
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! @license Firebase v2.2.7 | |
License: https://www.firebase.com/terms/terms-of-service.html */ | |
(function() { | |
var h, aa = this; | |
function n(a) { | |
return void 0 !== a | |
} | |
function ba() {} | |
function ca(a) { | |
a.ub = function() { | |
return a.tf ? a.tf : a.tf = new a | |
} | |
} | |
function da(a) { | |
var b = typeof a; | |
if ("object" == b) | |
if (a) { | |
if (a instanceof Array) return "array"; | |
if (a instanceof Object) return b; | |
var c = Object.prototype.toString.call(a); | |
if ("[object Window]" == c) return "object"; | |
if ("[object Array]" == c || "number" == typeof a.length && "undefined" != typeof a.splice && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("splice")) return "array"; | |
if ("[object Function]" == c || "undefined" != typeof a.call && "undefined" != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable("call")) return "function" | |
} else return "null"; | |
else if ("function" == b && "undefined" == typeof a.call) return "object"; | |
return b | |
} | |
function ea(a) { | |
return "array" == da(a) | |
} | |
function fa(a) { | |
var b = da(a); | |
return "array" == b || "object" == b && "number" == typeof a.length | |
} | |
function p(a) { | |
return "string" == typeof a | |
} | |
function ga(a) { | |
return "number" == typeof a | |
} | |
function ha(a) { | |
return "function" == da(a) | |
} | |
function ia(a) { | |
var b = typeof a; | |
return "object" == b && null != a || "function" == b | |
} | |
function ja(a, b, c) { | |
return a.call.apply(a.bind, arguments) | |
} | |
function ka(a, b, c) { | |
if (!a) throw Error(); | |
if (2 < arguments.length) { | |
var d = Array.prototype.slice.call(arguments, 2); | |
return function() { | |
var c = Array.prototype.slice.call(arguments); | |
Array.prototype.unshift.apply(c, d); | |
return a.apply(b, c) | |
} | |
} | |
return function() { | |
return a.apply(b, arguments) | |
} | |
} | |
function q(a, b, c) { | |
q = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? ja : ka; | |
return q.apply(null, arguments) | |
} | |
var la = Date.now || function() { | |
return +new Date | |
}; | |
function ma(a, b) { | |
function c() {} | |
c.prototype = b.prototype; | |
a.Zg = b.prototype; | |
a.prototype = new c; | |
a.prototype.constructor = a; | |
a.Vg = function(a, c, f) { | |
for (var g = Array(arguments.length - 2), k = 2; k < arguments.length; k++) g[k - 2] = arguments[k]; | |
return b.prototype[c].apply(a, g) | |
} | |
}; | |
function r(a, b) { | |
for (var c in a) b.call(void 0, a[c], c, a) | |
} | |
function na(a, b) { | |
var c = {}, | |
d; | |
for (d in a) c[d] = b.call(void 0, a[d], d, a); | |
return c | |
} | |
function oa(a, b) { | |
for (var c in a) | |
if (!b.call(void 0, a[c], c, a)) return !1; | |
return !0 | |
} | |
function pa(a) { | |
var b = 0, | |
c; | |
for (c in a) b++; | |
return b | |
} | |
function qa(a) { | |
for (var b in a) return b | |
} | |
function ra(a) { | |
var b = [], | |
c = 0, | |
d; | |
for (d in a) b[c++] = a[d]; | |
return b | |
} | |
function sa(a) { | |
var b = [], | |
c = 0, | |
d; | |
for (d in a) b[c++] = d; | |
return b | |
} | |
function ta(a, b) { | |
for (var c in a) | |
if (a[c] == b) return !0; | |
return !1 | |
} | |
function ua(a, b, c) { | |
for (var d in a) | |
if (b.call(c, a[d], d, a)) return d | |
} | |
function va(a, b) { | |
var c = ua(a, b, void 0); | |
return c && a[c] | |
} | |
function wa(a) { | |
for (var b in a) return !1; | |
return !0 | |
} | |
function xa(a) { | |
var b = {}, | |
c; | |
for (c in a) b[c] = a[c]; | |
return b | |
} | |
var ya = "constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); | |
function za(a, b) { | |
for (var c, d, e = 1; e < arguments.length; e++) { | |
d = arguments[e]; | |
for (c in d) a[c] = d[c]; | |
for (var f = 0; f < ya.length; f++) c = ya[f], Object.prototype.hasOwnProperty.call(d, c) && (a[c] = d[c]) | |
} | |
}; | |
function Aa(a) { | |
a = String(a); | |
if (/^\s*$/.test(a) ? 0 : /^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g, "@").replace(/"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g, ""))) try { | |
return eval("(" + a + ")") | |
} catch (b) {} | |
throw Error("Invalid JSON string: " + a); | |
} | |
function Ba() { | |
this.Pd = void 0 | |
} | |
function Ca(a, b, c) { | |
switch (typeof b) { | |
case "string": | |
Da(b, c); | |
break; | |
case "number": | |
c.push(isFinite(b) && !isNaN(b) ? b : "null"); | |
break; | |
case "boolean": | |
c.push(b); | |
break; | |
case "undefined": | |
c.push("null"); | |
break; | |
case "object": | |
if (null == b) { | |
c.push("null"); | |
break | |
} | |
if (ea(b)) { | |
var d = b.length; | |
c.push("["); | |
for (var e = "", f = 0; f < d; f++) c.push(e), e = b[f], Ca(a, a.Pd ? a.Pd.call(b, String(f), e) : e, c), e = ","; | |
c.push("]"); | |
break | |
} | |
c.push("{"); | |
d = ""; | |
for (f in b) Object.prototype.hasOwnProperty.call(b, f) && (e = b[f], "function" != typeof e && (c.push(d), Da(f, c), | |
c.push(":"), Ca(a, a.Pd ? a.Pd.call(b, f, e) : e, c), d = ",")); | |
c.push("}"); | |
break; | |
case "function": | |
break; | |
default: | |
throw Error("Unknown type: " + typeof b); | |
} | |
} | |
var Ea = { | |
'"': '\\"', | |
"\\": "\\\\", | |
"/": "\\/", | |
"\b": "\\b", | |
"\f": "\\f", | |
"\n": "\\n", | |
"\r": "\\r", | |
"\t": "\\t", | |
"\x0B": "\\u000b" | |
}, | |
Fa = /\uffff/.test("\uffff") ? /[\\\"\x00-\x1f\x7f-\uffff]/g : /[\\\"\x00-\x1f\x7f-\xff]/g; | |
function Da(a, b) { | |
b.push('"', a.replace(Fa, function(a) { | |
if (a in Ea) return Ea[a]; | |
var b = a.charCodeAt(0), | |
e = "\\u"; | |
16 > b ? e += "000" : 256 > b ? e += "00" : 4096 > b && (e += "0"); | |
return Ea[a] = e + b.toString(16) | |
}), '"') | |
}; | |
function Ga() { | |
return Math.floor(2147483648 * Math.random()).toString(36) + Math.abs(Math.floor(2147483648 * Math.random()) ^ la()).toString(36) | |
}; | |
var Ha; | |
a: { | |
var Ia = aa.navigator; | |
if (Ia) { | |
var Ja = Ia.userAgent; | |
if (Ja) { | |
Ha = Ja; | |
break a | |
} | |
} | |
Ha = "" | |
}; | |
function Ka() { | |
this.Wa = -1 | |
}; | |
function La() { | |
this.Wa = -1; | |
this.Wa = 64; | |
this.R = []; | |
this.le = []; | |
this.Tf = []; | |
this.Id = []; | |
this.Id[0] = 128; | |
for (var a = 1; a < this.Wa; ++a) this.Id[a] = 0; | |
this.be = this.$b = 0; | |
this.reset() | |
} | |
ma(La, Ka); | |
La.prototype.reset = function() { | |
this.R[0] = 1732584193; | |
this.R[1] = 4023233417; | |
this.R[2] = 2562383102; | |
this.R[3] = 271733878; | |
this.R[4] = 3285377520; | |
this.be = this.$b = 0 | |
}; | |
function Ma(a, b, c) { | |
c || (c = 0); | |
var d = a.Tf; | |
if (p(b)) | |
for (var e = 0; 16 > e; e++) d[e] = b.charCodeAt(c) << 24 | b.charCodeAt(c + 1) << 16 | b.charCodeAt(c + 2) << 8 | b.charCodeAt(c + 3), c += 4; | |
else | |
for (e = 0; 16 > e; e++) d[e] = b[c] << 24 | b[c + 1] << 16 | b[c + 2] << 8 | b[c + 3], c += 4; | |
for (e = 16; 80 > e; e++) { | |
var f = d[e - 3] ^ d[e - 8] ^ d[e - 14] ^ d[e - 16]; | |
d[e] = (f << 1 | f >>> 31) & 4294967295 | |
} | |
b = a.R[0]; | |
c = a.R[1]; | |
for (var g = a.R[2], k = a.R[3], l = a.R[4], m, e = 0; 80 > e; e++) 40 > e ? 20 > e ? (f = k ^ c & (g ^ k), m = 1518500249) : (f = c ^ g ^ k, m = 1859775393) : 60 > e ? (f = c & g | k & (c | g), m = 2400959708) : (f = c ^ g ^ k, m = 3395469782), f = (b << | |
5 | b >>> 27) + f + l + m + d[e] & 4294967295, l = k, k = g, g = (c << 30 | c >>> 2) & 4294967295, c = b, b = f; | |
a.R[0] = a.R[0] + b & 4294967295; | |
a.R[1] = a.R[1] + c & 4294967295; | |
a.R[2] = a.R[2] + g & 4294967295; | |
a.R[3] = a.R[3] + k & 4294967295; | |
a.R[4] = a.R[4] + l & 4294967295 | |
} | |
La.prototype.update = function(a, b) { | |
if (null != a) { | |
n(b) || (b = a.length); | |
for (var c = b - this.Wa, d = 0, e = this.le, f = this.$b; d < b;) { | |
if (0 == f) | |
for (; d <= c;) Ma(this, a, d), d += this.Wa; | |
if (p(a)) | |
for (; d < b;) { | |
if (e[f] = a.charCodeAt(d), ++f, ++d, f == this.Wa) { | |
Ma(this, e); | |
f = 0; | |
break | |
} | |
} else | |
for (; d < b;) | |
if (e[f] = a[d], ++f, ++d, f == this.Wa) { | |
Ma(this, e); | |
f = 0; | |
break | |
} | |
} | |
this.$b = f; | |
this.be += b | |
} | |
}; | |
var t = Array.prototype, | |
Na = t.indexOf ? function(a, b, c) { | |
return t.indexOf.call(a, b, c) | |
} : function(a, b, c) { | |
c = null == c ? 0 : 0 > c ? Math.max(0, a.length + c) : c; | |
if (p(a)) return p(b) && 1 == b.length ? a.indexOf(b, c) : -1; | |
for (; c < a.length; c++) | |
if (c in a && a[c] === b) return c; | |
return -1 | |
}, | |
Oa = t.forEach ? function(a, b, c) { | |
t.forEach.call(a, b, c) | |
} : function(a, b, c) { | |
for (var d = a.length, e = p(a) ? a.split("") : a, f = 0; f < d; f++) f in e && b.call(c, e[f], f, a) | |
}, | |
Pa = t.filter ? function(a, b, c) { | |
return t.filter.call(a, b, c) | |
} : function(a, b, c) { | |
for (var d = a.length, e = [], f = 0, g = p(a) ? | |
a.split("") : a, k = 0; k < d; k++) | |
if (k in g) { | |
var l = g[k]; | |
b.call(c, l, k, a) && (e[f++] = l) | |
} | |
return e | |
}, | |
Qa = t.map ? function(a, b, c) { | |
return t.map.call(a, b, c) | |
} : function(a, b, c) { | |
for (var d = a.length, e = Array(d), f = p(a) ? a.split("") : a, g = 0; g < d; g++) g in f && (e[g] = b.call(c, f[g], g, a)); | |
return e | |
}, | |
Ra = t.reduce ? function(a, b, c, d) { | |
for (var e = [], f = 1, g = arguments.length; f < g; f++) e.push(arguments[f]); | |
d && (e[0] = q(b, d)); | |
return t.reduce.apply(a, e) | |
} : function(a, b, c, d) { | |
var e = c; | |
Oa(a, function(c, g) { | |
e = b.call(d, e, c, g, a) | |
}); | |
return e | |
}, | |
Sa = t.every ? function(a, b, | |
c) { | |
return t.every.call(a, b, c) | |
} : function(a, b, c) { | |
for (var d = a.length, e = p(a) ? a.split("") : a, f = 0; f < d; f++) | |
if (f in e && !b.call(c, e[f], f, a)) return !1; | |
return !0 | |
}; | |
function Ta(a, b) { | |
var c = Ua(a, b, void 0); | |
return 0 > c ? null : p(a) ? a.charAt(c) : a[c] | |
} | |
function Ua(a, b, c) { | |
for (var d = a.length, e = p(a) ? a.split("") : a, f = 0; f < d; f++) | |
if (f in e && b.call(c, e[f], f, a)) return f; | |
return -1 | |
} | |
function Va(a, b) { | |
var c = Na(a, b); | |
0 <= c && t.splice.call(a, c, 1) | |
} | |
function Wa(a, b, c) { | |
return 2 >= arguments.length ? t.slice.call(a, b) : t.slice.call(a, b, c) | |
} | |
function Xa(a, b) { | |
a.sort(b || Ya) | |
} | |
function Ya(a, b) { | |
return a > b ? 1 : a < b ? -1 : 0 | |
}; | |
var Za = -1 != Ha.indexOf("Opera") || -1 != Ha.indexOf("OPR"), | |
$a = -1 != Ha.indexOf("Trident") || -1 != Ha.indexOf("MSIE"), | |
ab = -1 != Ha.indexOf("Gecko") && -1 == Ha.toLowerCase().indexOf("webkit") && !(-1 != Ha.indexOf("Trident") || -1 != Ha.indexOf("MSIE")), | |
bb = -1 != Ha.toLowerCase().indexOf("webkit"); | |
(function() { | |
var a = "", | |
b; | |
if (Za && aa.opera) return a = aa.opera.version, ha(a) ? a() : a; | |
ab ? b = /rv\:([^\);]+)(\)|;)/ : $a ? b = /\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/ : bb && (b = /WebKit\/(\S+)/); | |
b && (a = (a = b.exec(Ha)) ? a[1] : ""); | |
return $a && (b = (b = aa.document) ? b.documentMode : void 0, b > parseFloat(a)) ? String(b) : a | |
})(); | |
var cb = null, | |
db = null, | |
eb = null; | |
function fb(a, b) { | |
if (!fa(a)) throw Error("encodeByteArray takes an array as a parameter"); | |
gb(); | |
for (var c = b ? db : cb, d = [], e = 0; e < a.length; e += 3) { | |
var f = a[e], | |
g = e + 1 < a.length, | |
k = g ? a[e + 1] : 0, | |
l = e + 2 < a.length, | |
m = l ? a[e + 2] : 0, | |
v = f >> 2, | |
f = (f & 3) << 4 | k >> 4, | |
k = (k & 15) << 2 | m >> 6, | |
m = m & 63; | |
l || (m = 64, g || (k = 64)); | |
d.push(c[v], c[f], c[k], c[m]) | |
} | |
return d.join("") | |
} | |
function gb() { | |
if (!cb) { | |
cb = {}; | |
db = {}; | |
eb = {}; | |
for (var a = 0; 65 > a; a++) cb[a] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a), db[a] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a), eb[db[a]] = a, 62 <= a && (eb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a)] = a) | |
} | |
}; | |
function u(a, b) { | |
return Object.prototype.hasOwnProperty.call(a, b) | |
} | |
function w(a, b) { | |
if (Object.prototype.hasOwnProperty.call(a, b)) return a[b] | |
} | |
function hb(a, b) { | |
for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && b(c, a[c]) | |
} | |
function ib(a) { | |
var b = {}; | |
hb(a, function(a, d) { | |
b[a] = d | |
}); | |
return b | |
}; | |
function jb(a) { | |
var b = []; | |
hb(a, function(a, d) { | |
ea(d) ? Oa(d, function(d) { | |
b.push(encodeURIComponent(a) + "=" + encodeURIComponent(d)) | |
}) : b.push(encodeURIComponent(a) + "=" + encodeURIComponent(d)) | |
}); | |
return b.length ? "&" + b.join("&") : "" | |
} | |
function kb(a) { | |
var b = {}; | |
a = a.replace(/^\?/, "").split("&"); | |
Oa(a, function(a) { | |
a && (a = a.split("="), b[a[0]] = a[1]) | |
}); | |
return b | |
}; | |
function x(a, b, c, d) { | |
var e; | |
d < b ? e = "at least " + b : d > c && (e = 0 === c ? "none" : "no more than " + c); | |
if (e) throw Error(a + " failed: Was called with " + d + (1 === d ? " argument." : " arguments.") + " Expects " + e + "."); | |
} | |
function z(a, b, c) { | |
var d = ""; | |
switch (b) { | |
case 1: | |
d = c ? "first" : "First"; | |
break; | |
case 2: | |
d = c ? "second" : "Second"; | |
break; | |
case 3: | |
d = c ? "third" : "Third"; | |
break; | |
case 4: | |
d = c ? "fourth" : "Fourth"; | |
break; | |
default: | |
throw Error("errorPrefix called with argumentNumber > 4. Need to update it?"); | |
} | |
return a = a + " failed: " + (d + " argument ") | |
} | |
function A(a, b, c, d) { | |
if ((!d || n(c)) && !ha(c)) throw Error(z(a, b, d) + "must be a valid function."); | |
} | |
function lb(a, b, c) { | |
if (n(c) && (!ia(c) || null === c)) throw Error(z(a, b, !0) + "must be a valid context object."); | |
}; | |
function mb(a) { | |
return "undefined" !== typeof JSON && n(JSON.parse) ? JSON.parse(a) : Aa(a) | |
} | |
function B(a) { | |
if ("undefined" !== typeof JSON && n(JSON.stringify)) a = JSON.stringify(a); | |
else { | |
var b = []; | |
Ca(new Ba, a, b); | |
a = b.join("") | |
} | |
return a | |
}; | |
function nb() { | |
this.Sd = C | |
} | |
nb.prototype.j = function(a) { | |
return this.Sd.oa(a) | |
}; | |
nb.prototype.toString = function() { | |
return this.Sd.toString() | |
}; | |
function ob() {} | |
ob.prototype.pf = function() { | |
return null | |
}; | |
ob.prototype.xe = function() { | |
return null | |
}; | |
var pb = new ob; | |
function qb(a, b, c) { | |
this.Qf = a; | |
this.Ka = b; | |
this.Hd = c | |
} | |
qb.prototype.pf = function(a) { | |
var b = this.Ka.D; | |
if (rb(b, a)) return b.j().M(a); | |
b = null != this.Hd ? new sb(this.Hd, !0, !1) : this.Ka.u(); | |
return this.Qf.Xa(a, b) | |
}; | |
qb.prototype.xe = function(a, b, c) { | |
var d = null != this.Hd ? this.Hd : tb(this.Ka); | |
a = this.Qf.me(d, b, 1, c, a); | |
return 0 === a.length ? null : a[0] | |
}; | |
function ub() { | |
this.tb = [] | |
} | |
function vb(a, b) { | |
for (var c = null, d = 0; d < b.length; d++) { | |
var e = b[d], | |
f = e.Yb(); | |
null === c || f.Z(c.Yb()) || (a.tb.push(c), c = null); | |
null === c && (c = new wb(f)); | |
c.add(e) | |
} | |
c && a.tb.push(c) | |
} | |
function xb(a, b, c) { | |
vb(a, c); | |
yb(a, function(a) { | |
return a.Z(b) | |
}) | |
} | |
function zb(a, b, c) { | |
vb(a, c); | |
yb(a, function(a) { | |
return a.contains(b) || b.contains(a) | |
}) | |
} | |
function yb(a, b) { | |
for (var c = !0, d = 0; d < a.tb.length; d++) { | |
var e = a.tb[d]; | |
if (e) | |
if (e = e.Yb(), b(e)) { | |
for (var e = a.tb[d], f = 0; f < e.sd.length; f++) { | |
var g = e.sd[f]; | |
if (null !== g) { | |
e.sd[f] = null; | |
var k = g.Ub(); | |
Ab && Bb("event: " + g.toString()); | |
Cb(k) | |
} | |
} | |
a.tb[d] = null | |
} else c = !1 | |
} | |
c && (a.tb = []) | |
} | |
function wb(a) { | |
this.qa = a; | |
this.sd = [] | |
} | |
wb.prototype.add = function(a) { | |
this.sd.push(a) | |
}; | |
wb.prototype.Yb = function() { | |
return this.qa | |
}; | |
function D(a, b, c, d) { | |
this.type = a; | |
this.Ja = b; | |
this.Ya = c; | |
this.Je = d; | |
this.Nd = void 0 | |
} | |
function Db(a) { | |
return new D(Eb, a) | |
} | |
var Eb = "value"; | |
function Fb(a, b, c, d) { | |
this.te = b; | |
this.Wd = c; | |
this.Nd = d; | |
this.rd = a | |
} | |
Fb.prototype.Yb = function() { | |
var a = this.Wd.lc(); | |
return "value" === this.rd ? a.path : a.parent().path | |
}; | |
Fb.prototype.ye = function() { | |
return this.rd | |
}; | |
Fb.prototype.Ub = function() { | |
return this.te.Ub(this) | |
}; | |
Fb.prototype.toString = function() { | |
return this.Yb().toString() + ":" + this.rd + ":" + B(this.Wd.lf()) | |
}; | |
function Gb(a, b, c) { | |
this.te = a; | |
this.error = b; | |
this.path = c | |
} | |
Gb.prototype.Yb = function() { | |
return this.path | |
}; | |
Gb.prototype.ye = function() { | |
return "cancel" | |
}; | |
Gb.prototype.Ub = function() { | |
return this.te.Ub(this) | |
}; | |
Gb.prototype.toString = function() { | |
return this.path.toString() + ":cancel" | |
}; | |
function sb(a, b, c) { | |
this.B = a; | |
this.$ = b; | |
this.Tb = c | |
} | |
function Hb(a) { | |
return a.$ | |
} | |
function rb(a, b) { | |
return a.$ && !a.Tb || a.B.Ha(b) | |
} | |
sb.prototype.j = function() { | |
return this.B | |
}; | |
function Ib(a) { | |
this.dg = a; | |
this.Ad = null | |
} | |
Ib.prototype.get = function() { | |
var a = this.dg.get(), | |
b = xa(a); | |
if (this.Ad) | |
for (var c in this.Ad) b[c] -= this.Ad[c]; | |
this.Ad = a; | |
return b | |
}; | |
function Jb(a, b) { | |
this.Mf = {}; | |
this.Yd = new Ib(a); | |
this.ca = b; | |
var c = 1E4 + 2E4 * Math.random(); | |
setTimeout(q(this.Hf, this), Math.floor(c)) | |
} | |
Jb.prototype.Hf = function() { | |
var a = this.Yd.get(), | |
b = {}, | |
c = !1, | |
d; | |
for (d in a) 0 < a[d] && u(this.Mf, d) && (b[d] = a[d], c = !0); | |
c && this.ca.Te(b); | |
setTimeout(q(this.Hf, this), Math.floor(6E5 * Math.random())) | |
}; | |
function Kb() { | |
this.Dc = {} | |
} | |
function Lb(a, b, c) { | |
n(c) || (c = 1); | |
u(a.Dc, b) || (a.Dc[b] = 0); | |
a.Dc[b] += c | |
} | |
Kb.prototype.get = function() { | |
return xa(this.Dc) | |
}; | |
var Mb = {}, | |
Nb = {}; | |
function Ob(a) { | |
a = a.toString(); | |
Mb[a] || (Mb[a] = new Kb); | |
return Mb[a] | |
} | |
function Pb(a, b) { | |
var c = a.toString(); | |
Nb[c] || (Nb[c] = b()); | |
return Nb[c] | |
}; | |
function E(a, b) { | |
this.name = a; | |
this.S = b | |
} | |
function Qb(a, b) { | |
return new E(a, b) | |
}; | |
function Rb(a, b) { | |
return Sb(a.name, b.name) | |
} | |
function Tb(a, b) { | |
return Sb(a, b) | |
}; | |
function Ub(a, b, c) { | |
this.type = Vb; | |
this.source = a; | |
this.path = b; | |
this.Ia = c | |
} | |
Ub.prototype.Wc = function(a) { | |
return this.path.e() ? new Ub(this.source, F, this.Ia.M(a)) : new Ub(this.source, G(this.path), this.Ia) | |
}; | |
Ub.prototype.toString = function() { | |
return "Operation(" + this.path + ": " + this.source.toString() + " overwrite: " + this.Ia.toString() + ")" | |
}; | |
function Wb(a, b) { | |
this.type = Xb; | |
this.source = Yb; | |
this.path = a; | |
this.Ve = b | |
} | |
Wb.prototype.Wc = function() { | |
return this.path.e() ? this : new Wb(G(this.path), this.Ve) | |
}; | |
Wb.prototype.toString = function() { | |
return "Operation(" + this.path + ": " + this.source.toString() + " ack write revert=" + this.Ve + ")" | |
}; | |
function Zb(a, b) { | |
this.type = $b; | |
this.source = a; | |
this.path = b | |
} | |
Zb.prototype.Wc = function() { | |
return this.path.e() ? new Zb(this.source, F) : new Zb(this.source, G(this.path)) | |
}; | |
Zb.prototype.toString = function() { | |
return "Operation(" + this.path + ": " + this.source.toString() + " listen_complete)" | |
}; | |
function ac(a, b) { | |
this.La = a; | |
this.xa = b ? b : bc | |
} | |
h = ac.prototype; | |
h.Na = function(a, b) { | |
return new ac(this.La, this.xa.Na(a, b, this.La).X(null, null, !1, null, null)) | |
}; | |
h.remove = function(a) { | |
return new ac(this.La, this.xa.remove(a, this.La).X(null, null, !1, null, null)) | |
}; | |
h.get = function(a) { | |
for (var b, c = this.xa; !c.e();) { | |
b = this.La(a, c.key); | |
if (0 === b) return c.value; | |
0 > b ? c = c.left : 0 < b && (c = c.right) | |
} | |
return null | |
}; | |
function cc(a, b) { | |
for (var c, d = a.xa, e = null; !d.e();) { | |
c = a.La(b, d.key); | |
if (0 === c) { | |
if (d.left.e()) return e ? e.key : null; | |
for (d = d.left; !d.right.e();) d = d.right; | |
return d.key | |
} | |
0 > c ? d = d.left : 0 < c && (e = d, d = d.right) | |
} | |
throw Error("Attempted to find predecessor key for a nonexistent key. What gives?"); | |
} | |
h.e = function() { | |
return this.xa.e() | |
}; | |
h.count = function() { | |
return this.xa.count() | |
}; | |
h.Rc = function() { | |
return this.xa.Rc() | |
}; | |
h.ec = function() { | |
return this.xa.ec() | |
}; | |
h.ha = function(a) { | |
return this.xa.ha(a) | |
}; | |
h.Wb = function(a) { | |
return new dc(this.xa, null, this.La, !1, a) | |
}; | |
h.Xb = function(a, b) { | |
return new dc(this.xa, a, this.La, !1, b) | |
}; | |
h.Zb = function(a, b) { | |
return new dc(this.xa, a, this.La, !0, b) | |
}; | |
h.rf = function(a) { | |
return new dc(this.xa, null, this.La, !0, a) | |
}; | |
function dc(a, b, c, d, e) { | |
this.Rd = e || null; | |
this.Ee = d; | |
this.Pa = []; | |
for (e = 1; !a.e();) | |
if (e = b ? c(a.key, b) : 1, d && (e *= -1), 0 > e) a = this.Ee ? a.left : a.right; | |
else if (0 === e) { | |
this.Pa.push(a); | |
break | |
} else this.Pa.push(a), a = this.Ee ? a.right : a.left | |
} | |
function H(a) { | |
if (0 === a.Pa.length) return null; | |
var b = a.Pa.pop(), | |
c; | |
c = a.Rd ? a.Rd(b.key, b.value) : { | |
key: b.key, | |
value: b.value | |
}; | |
if (a.Ee) | |
for (b = b.left; !b.e();) a.Pa.push(b), b = b.right; | |
else | |
for (b = b.right; !b.e();) a.Pa.push(b), b = b.left; | |
return c | |
} | |
function ec(a) { | |
if (0 === a.Pa.length) return null; | |
var b; | |
b = a.Pa; | |
b = b[b.length - 1]; | |
return a.Rd ? a.Rd(b.key, b.value) : { | |
key: b.key, | |
value: b.value | |
} | |
} | |
function fc(a, b, c, d, e) { | |
this.key = a; | |
this.value = b; | |
this.color = null != c ? c : !0; | |
this.left = null != d ? d : bc; | |
this.right = null != e ? e : bc | |
} | |
h = fc.prototype; | |
h.X = function(a, b, c, d, e) { | |
return new fc(null != a ? a : this.key, null != b ? b : this.value, null != c ? c : this.color, null != d ? d : this.left, null != e ? e : this.right) | |
}; | |
h.count = function() { | |
return this.left.count() + 1 + this.right.count() | |
}; | |
h.e = function() { | |
return !1 | |
}; | |
h.ha = function(a) { | |
return this.left.ha(a) || a(this.key, this.value) || this.right.ha(a) | |
}; | |
function gc(a) { | |
return a.left.e() ? a : gc(a.left) | |
} | |
h.Rc = function() { | |
return gc(this).key | |
}; | |
h.ec = function() { | |
return this.right.e() ? this.key : this.right.ec() | |
}; | |
h.Na = function(a, b, c) { | |
var d, e; | |
e = this; | |
d = c(a, e.key); | |
e = 0 > d ? e.X(null, null, null, e.left.Na(a, b, c), null) : 0 === d ? e.X(null, b, null, null, null) : e.X(null, null, null, null, e.right.Na(a, b, c)); | |
return hc(e) | |
}; | |
function ic(a) { | |
if (a.left.e()) return bc; | |
a.left.fa() || a.left.left.fa() || (a = jc(a)); | |
a = a.X(null, null, null, ic(a.left), null); | |
return hc(a) | |
} | |
h.remove = function(a, b) { | |
var c, d; | |
c = this; | |
if (0 > b(a, c.key)) c.left.e() || c.left.fa() || c.left.left.fa() || (c = jc(c)), c = c.X(null, null, null, c.left.remove(a, b), null); | |
else { | |
c.left.fa() && (c = kc(c)); | |
c.right.e() || c.right.fa() || c.right.left.fa() || (c = lc(c), c.left.left.fa() && (c = kc(c), c = lc(c))); | |
if (0 === b(a, c.key)) { | |
if (c.right.e()) return bc; | |
d = gc(c.right); | |
c = c.X(d.key, d.value, null, null, ic(c.right)) | |
} | |
c = c.X(null, null, null, null, c.right.remove(a, b)) | |
} | |
return hc(c) | |
}; | |
h.fa = function() { | |
return this.color | |
}; | |
function hc(a) { | |
a.right.fa() && !a.left.fa() && (a = mc(a)); | |
a.left.fa() && a.left.left.fa() && (a = kc(a)); | |
a.left.fa() && a.right.fa() && (a = lc(a)); | |
return a | |
} | |
function jc(a) { | |
a = lc(a); | |
a.right.left.fa() && (a = a.X(null, null, null, null, kc(a.right)), a = mc(a), a = lc(a)); | |
return a | |
} | |
function mc(a) { | |
return a.right.X(null, null, a.color, a.X(null, null, !0, null, a.right.left), null) | |
} | |
function kc(a) { | |
return a.left.X(null, null, a.color, null, a.X(null, null, !0, a.left.right, null)) | |
} | |
function lc(a) { | |
return a.X(null, null, !a.color, a.left.X(null, null, !a.left.color, null, null), a.right.X(null, null, !a.right.color, null, null)) | |
} | |
function nc() {} | |
h = nc.prototype; | |
h.X = function() { | |
return this | |
}; | |
h.Na = function(a, b) { | |
return new fc(a, b, null) | |
}; | |
h.remove = function() { | |
return this | |
}; | |
h.count = function() { | |
return 0 | |
}; | |
h.e = function() { | |
return !0 | |
}; | |
h.ha = function() { | |
return !1 | |
}; | |
h.Rc = function() { | |
return null | |
}; | |
h.ec = function() { | |
return null | |
}; | |
h.fa = function() { | |
return !1 | |
}; | |
var bc = new nc; | |
function oc(a, b) { | |
return a && "object" === typeof a ? (J(".sv" in a, "Unexpected leaf node or priority contents"), b[a[".sv"]]) : a | |
} | |
function pc(a, b) { | |
var c = new qc; | |
rc(a, new K(""), function(a, e) { | |
c.mc(a, sc(e, b)) | |
}); | |
return c | |
} | |
function sc(a, b) { | |
var c = a.A().K(), | |
c = oc(c, b), | |
d; | |
if (a.N()) { | |
var e = oc(a.Ba(), b); | |
return e !== a.Ba() || c !== a.A().K() ? new tc(e, L(c)) : a | |
} | |
d = a; | |
c !== a.A().K() && (d = d.da(new tc(c))); | |
a.U(M, function(a, c) { | |
var e = sc(c, b); | |
e !== c && (d = d.Q(a, e)) | |
}); | |
return d | |
}; | |
function K(a, b) { | |
if (1 == arguments.length) { | |
this.n = a.split("/"); | |
for (var c = 0, d = 0; d < this.n.length; d++) 0 < this.n[d].length && (this.n[c] = this.n[d], c++); | |
this.n.length = c; | |
this.Y = 0 | |
} else this.n = a, this.Y = b | |
} | |
function N(a, b) { | |
var c = O(a); | |
if (null === c) return b; | |
if (c === O(b)) return N(G(a), G(b)); | |
throw Error("INTERNAL ERROR: innerPath (" + b + ") is not within outerPath (" + a + ")"); | |
} | |
function O(a) { | |
return a.Y >= a.n.length ? null : a.n[a.Y] | |
} | |
function uc(a) { | |
return a.n.length - a.Y | |
} | |
function G(a) { | |
var b = a.Y; | |
b < a.n.length && b++; | |
return new K(a.n, b) | |
} | |
function vc(a) { | |
return a.Y < a.n.length ? a.n[a.n.length - 1] : null | |
} | |
h = K.prototype; | |
h.toString = function() { | |
for (var a = "", b = this.Y; b < this.n.length; b++) "" !== this.n[b] && (a += "/" + this.n[b]); | |
return a || "/" | |
}; | |
h.slice = function(a) { | |
return this.n.slice(this.Y + (a || 0)) | |
}; | |
h.parent = function() { | |
if (this.Y >= this.n.length) return null; | |
for (var a = [], b = this.Y; b < this.n.length - 1; b++) a.push(this.n[b]); | |
return new K(a, 0) | |
}; | |
h.w = function(a) { | |
for (var b = [], c = this.Y; c < this.n.length; c++) b.push(this.n[c]); | |
if (a instanceof K) | |
for (c = a.Y; c < a.n.length; c++) b.push(a.n[c]); | |
else | |
for (a = a.split("/"), c = 0; c < a.length; c++) 0 < a[c].length && b.push(a[c]); | |
return new K(b, 0) | |
}; | |
h.e = function() { | |
return this.Y >= this.n.length | |
}; | |
h.Z = function(a) { | |
if (uc(this) !== uc(a)) return !1; | |
for (var b = this.Y, c = a.Y; b <= this.n.length; b++, c++) | |
if (this.n[b] !== a.n[c]) return !1; | |
return !0 | |
}; | |
h.contains = function(a) { | |
var b = this.Y, | |
c = a.Y; | |
if (uc(this) > uc(a)) return !1; | |
for (; b < this.n.length;) { | |
if (this.n[b] !== a.n[c]) return !1; | |
++b; | |
++c | |
} | |
return !0 | |
}; | |
var F = new K(""); | |
function wc(a, b) { | |
this.Qa = a.slice(); | |
this.Ea = Math.max(1, this.Qa.length); | |
this.kf = b; | |
for (var c = 0; c < this.Qa.length; c++) this.Ea += xc(this.Qa[c]); | |
yc(this) | |
} | |
wc.prototype.push = function(a) { | |
0 < this.Qa.length && (this.Ea += 1); | |
this.Qa.push(a); | |
this.Ea += xc(a); | |
yc(this) | |
}; | |
wc.prototype.pop = function() { | |
var a = this.Qa.pop(); | |
this.Ea -= xc(a); | |
0 < this.Qa.length && --this.Ea | |
}; | |
function yc(a) { | |
if (768 < a.Ea) throw Error(a.kf + "has a key path longer than 768 bytes (" + a.Ea + ")."); | |
if (32 < a.Qa.length) throw Error(a.kf + "path specified exceeds the maximum depth that can be written (32) or object contains a cycle " + zc(a)); | |
} | |
function zc(a) { | |
return 0 == a.Qa.length ? "" : "in property '" + a.Qa.join(".") + "'" | |
}; | |
function Ac() { | |
this.wc = {} | |
} | |
Ac.prototype.set = function(a, b) { | |
null == b ? delete this.wc[a] : this.wc[a] = b | |
}; | |
Ac.prototype.get = function(a) { | |
return u(this.wc, a) ? this.wc[a] : null | |
}; | |
Ac.prototype.remove = function(a) { | |
delete this.wc[a] | |
}; | |
Ac.prototype.uf = !0; | |
function Bc(a) { | |
this.Ec = a; | |
this.Md = "firebase:" | |
} | |
h = Bc.prototype; | |
h.set = function(a, b) { | |
null == b ? this.Ec.removeItem(this.Md + a) : this.Ec.setItem(this.Md + a, B(b)) | |
}; | |
h.get = function(a) { | |
a = this.Ec.getItem(this.Md + a); | |
return null == a ? null : mb(a) | |
}; | |
h.remove = function(a) { | |
this.Ec.removeItem(this.Md + a) | |
}; | |
h.uf = !1; | |
h.toString = function() { | |
return this.Ec.toString() | |
}; | |
function Cc(a) { | |
try { | |
if ("undefined" !== typeof window && "undefined" !== typeof window[a]) { | |
var b = window[a]; | |
b.setItem("firebase:sentinel", "cache"); | |
b.removeItem("firebase:sentinel"); | |
return new Bc(b) | |
} | |
} catch (c) {} | |
return new Ac | |
} | |
var Dc = Cc("localStorage"), | |
P = Cc("sessionStorage"); | |
function Ec(a, b, c, d, e) { | |
this.host = a.toLowerCase(); | |
this.domain = this.host.substr(this.host.indexOf(".") + 1); | |
this.lb = b; | |
this.Cb = c; | |
this.Tg = d; | |
this.Ld = e || ""; | |
this.Oa = Dc.get("host:" + a) || this.host | |
} | |
function Fc(a, b) { | |
b !== a.Oa && (a.Oa = b, "s-" === a.Oa.substr(0, 2) && Dc.set("host:" + a.host, a.Oa)) | |
} | |
Ec.prototype.toString = function() { | |
var a = (this.lb ? "https://" : "http://") + this.host; | |
this.Ld && (a += "<" + this.Ld + ">"); | |
return a | |
}; | |
var Gc = function() { | |
var a = 1; | |
return function() { | |
return a++ | |
} | |
}(); | |
function J(a, b) { | |
if (!a) throw Hc(b); | |
} | |
function Hc(a) { | |
return Error("Firebase (2.2.7) INTERNAL ASSERT FAILED: " + a) | |
} | |
function Ic(a) { | |
try { | |
var b; | |
if ("undefined" !== typeof atob) b = atob(a); | |
else { | |
gb(); | |
for (var c = eb, d = [], e = 0; e < a.length;) { | |
var f = c[a.charAt(e++)], | |
g = e < a.length ? c[a.charAt(e)] : 0; | |
++e; | |
var k = e < a.length ? c[a.charAt(e)] : 64; | |
++e; | |
var l = e < a.length ? c[a.charAt(e)] : 64; | |
++e; | |
if (null == f || null == g || null == k || null == l) throw Error(); | |
d.push(f << 2 | g >> 4); | |
64 != k && (d.push(g << 4 & 240 | k >> 2), 64 != l && d.push(k << 6 & 192 | l)) | |
} | |
if (8192 > d.length) b = String.fromCharCode.apply(null, d); | |
else { | |
a = ""; | |
for (c = 0; c < d.length; c += 8192) a += String.fromCharCode.apply(null, Wa(d, c, | |
c + 8192)); | |
b = a | |
} | |
} | |
return b | |
} catch (m) { | |
Bb("base64Decode failed: ", m) | |
} | |
return null | |
} | |
function Jc(a) { | |
var b = Kc(a); | |
a = new La; | |
a.update(b); | |
var b = [], | |
c = 8 * a.be; | |
56 > a.$b ? a.update(a.Id, 56 - a.$b) : a.update(a.Id, a.Wa - (a.$b - 56)); | |
for (var d = a.Wa - 1; 56 <= d; d--) a.le[d] = c & 255, c /= 256; | |
Ma(a, a.le); | |
for (d = c = 0; 5 > d; d++) | |
for (var e = 24; 0 <= e; e -= 8) b[c] = a.R[d] >> e & 255, ++c; | |
return fb(b) | |
} | |
function Lc(a) { | |
for (var b = "", c = 0; c < arguments.length; c++) b = fa(arguments[c]) ? b + Lc.apply(null, arguments[c]) : "object" === typeof arguments[c] ? b + B(arguments[c]) : b + arguments[c], b += " "; | |
return b | |
} | |
var Ab = null, | |
Mc = !0; | |
function Bb(a) { | |
!0 === Mc && (Mc = !1, null === Ab && !0 === P.get("logging_enabled") && Nc(!0)); | |
if (Ab) { | |
var b = Lc.apply(null, arguments); | |
Ab(b) | |
} | |
} | |
function Oc(a) { | |
return function() { | |
Bb(a, arguments) | |
} | |
} | |
function Pc(a) { | |
if ("undefined" !== typeof console) { | |
var b = "FIREBASE INTERNAL ERROR: " + Lc.apply(null, arguments); | |
"undefined" !== typeof console.error ? console.error(b) : console.log(b) | |
} | |
} | |
function Qc(a) { | |
var b = Lc.apply(null, arguments); | |
throw Error("FIREBASE FATAL ERROR: " + b); | |
} | |
function Q(a) { | |
if ("undefined" !== typeof console) { | |
var b = "FIREBASE WARNING: " + Lc.apply(null, arguments); | |
"undefined" !== typeof console.warn ? console.warn(b) : console.log(b) | |
} | |
} | |
function Rc(a) { | |
var b = "", | |
c = "", | |
d = "", | |
e = "", | |
f = !0, | |
g = "https", | |
k = 443; | |
if (p(a)) { | |
var l = a.indexOf("//"); | |
0 <= l && (g = a.substring(0, l - 1), a = a.substring(l + 2)); | |
l = a.indexOf("/"); - 1 === l && (l = a.length); | |
b = a.substring(0, l); | |
e = ""; | |
a = a.substring(l).split("/"); | |
for (l = 0; l < a.length; l++) | |
if (0 < a[l].length) { | |
var m = a[l]; | |
try { | |
m = decodeURIComponent(m.replace(/\+/g, " ")) | |
} catch (v) {} | |
e += "/" + m | |
} | |
a = b.split("."); | |
3 === a.length ? (c = a[1], d = a[0].toLowerCase()) : 2 === a.length && (c = a[0]); | |
l = b.indexOf(":"); | |
0 <= l && (f = "https" === g || "wss" === g, k = b.substring(l + 1), isFinite(k) && | |
(k = String(k)), k = p(k) ? /^\s*-?0x/i.test(k) ? parseInt(k, 16) : parseInt(k, 10) : NaN) | |
} | |
return { | |
host: b, | |
port: k, | |
domain: c, | |
Qg: d, | |
lb: f, | |
scheme: g, | |
Zc: e | |
} | |
} | |
function Sc(a) { | |
return ga(a) && (a != a || a == Number.POSITIVE_INFINITY || a == Number.NEGATIVE_INFINITY) | |
} | |
function Tc(a) { | |
if ("complete" === document.readyState) a(); | |
else { | |
var b = !1, | |
c = function() { | |
document.body ? b || (b = !0, a()) : setTimeout(c, Math.floor(10)) | |
}; | |
document.addEventListener ? (document.addEventListener("DOMContentLoaded", c, !1), window.addEventListener("load", c, !1)) : document.attachEvent && (document.attachEvent("onreadystatechange", function() { | |
"complete" === document.readyState && c() | |
}), window.attachEvent("onload", c)) | |
} | |
} | |
function Sb(a, b) { | |
if (a === b) return 0; | |
if ("[MIN_NAME]" === a || "[MAX_NAME]" === b) return -1; | |
if ("[MIN_NAME]" === b || "[MAX_NAME]" === a) return 1; | |
var c = Uc(a), | |
d = Uc(b); | |
return null !== c ? null !== d ? 0 == c - d ? a.length - b.length : c - d : -1 : null !== d ? 1 : a < b ? -1 : 1 | |
} | |
function Vc(a, b) { | |
if (b && a in b) return b[a]; | |
throw Error("Missing required key (" + a + ") in object: " + B(b)); | |
} | |
function Wc(a) { | |
if ("object" !== typeof a || null === a) return B(a); | |
var b = [], | |
c; | |
for (c in a) b.push(c); | |
b.sort(); | |
c = "{"; | |
for (var d = 0; d < b.length; d++) 0 !== d && (c += ","), c += B(b[d]), c += ":", c += Wc(a[b[d]]); | |
return c + "}" | |
} | |
function Xc(a, b) { | |
if (a.length <= b) return [a]; | |
for (var c = [], d = 0; d < a.length; d += b) d + b > a ? c.push(a.substring(d, a.length)) : c.push(a.substring(d, d + b)); | |
return c | |
} | |
function Yc(a, b) { | |
if (ea(a)) | |
for (var c = 0; c < a.length; ++c) b(c, a[c]); | |
else r(a, b) | |
} | |
function Zc(a) { | |
J(!Sc(a), "Invalid JSON number"); | |
var b, c, d, e; | |
0 === a ? (d = c = 0, b = -Infinity === 1 / a ? 1 : 0) : (b = 0 > a, a = Math.abs(a), a >= Math.pow(2, -1022) ? (d = Math.min(Math.floor(Math.log(a) / Math.LN2), 1023), c = d + 1023, d = Math.round(a * Math.pow(2, 52 - d) - Math.pow(2, 52))) : (c = 0, d = Math.round(a / Math.pow(2, -1074)))); | |
e = []; | |
for (a = 52; a; --a) e.push(d % 2 ? 1 : 0), d = Math.floor(d / 2); | |
for (a = 11; a; --a) e.push(c % 2 ? 1 : 0), c = Math.floor(c / 2); | |
e.push(b ? 1 : 0); | |
e.reverse(); | |
b = e.join(""); | |
c = ""; | |
for (a = 0; 64 > a; a += 8) d = parseInt(b.substr(a, 8), 2).toString(16), 1 === d.length && | |
(d = "0" + d), c += d; | |
return c.toLowerCase() | |
} | |
var $c = /^-?\d{1,10}$/; | |
function Uc(a) { | |
return $c.test(a) && (a = Number(a), -2147483648 <= a && 2147483647 >= a) ? a : null | |
} | |
function Cb(a) { | |
try { | |
a() | |
} catch (b) { | |
setTimeout(function() { | |
Q("Exception was thrown by user callback.", b.stack || ""); | |
throw b; | |
}, Math.floor(0)) | |
} | |
} | |
function R(a, b) { | |
if (ha(a)) { | |
var c = Array.prototype.slice.call(arguments, 1).slice(); | |
Cb(function() { | |
a.apply(null, c) | |
}) | |
} | |
}; | |
function Kc(a) { | |
for (var b = [], c = 0, d = 0; d < a.length; d++) { | |
var e = a.charCodeAt(d); | |
55296 <= e && 56319 >= e && (e -= 55296, d++, J(d < a.length, "Surrogate pair missing trail surrogate."), e = 65536 + (e << 10) + (a.charCodeAt(d) - 56320)); | |
128 > e ? b[c++] = e : (2048 > e ? b[c++] = e >> 6 | 192 : (65536 > e ? b[c++] = e >> 12 | 224 : (b[c++] = e >> 18 | 240, b[c++] = e >> 12 & 63 | 128), b[c++] = e >> 6 & 63 | 128), b[c++] = e & 63 | 128) | |
} | |
return b | |
} | |
function xc(a) { | |
for (var b = 0, c = 0; c < a.length; c++) { | |
var d = a.charCodeAt(c); | |
128 > d ? b++ : 2048 > d ? b += 2 : 55296 <= d && 56319 >= d ? (b += 4, c++) : b += 3 | |
} | |
return b | |
}; | |
function ad(a) { | |
var b = {}, | |
c = {}, | |
d = {}, | |
e = ""; | |
try { | |
var f = a.split("."), | |
b = mb(Ic(f[0]) || ""), | |
c = mb(Ic(f[1]) || ""), | |
e = f[2], | |
d = c.d || {}; | |
delete c.d | |
} catch (g) {} | |
return { | |
Wg: b, | |
Ac: c, | |
data: d, | |
Ng: e | |
} | |
} | |
function bd(a) { | |
a = ad(a).Ac; | |
return "object" === typeof a && a.hasOwnProperty("iat") ? w(a, "iat") : null | |
} | |
function cd(a) { | |
a = ad(a); | |
var b = a.Ac; | |
return !!a.Ng && !!b && "object" === typeof b && b.hasOwnProperty("iat") | |
}; | |
function dd(a) { | |
this.V = a; | |
this.g = a.o.g | |
} | |
function ed(a, b, c, d) { | |
var e = [], | |
f = []; | |
Oa(b, function(b) { | |
"child_changed" === b.type && a.g.xd(b.Je, b.Ja) && f.push(new D("child_moved", b.Ja, b.Ya)) | |
}); | |
fd(a, e, "child_removed", b, d, c); | |
fd(a, e, "child_added", b, d, c); | |
fd(a, e, "child_moved", f, d, c); | |
fd(a, e, "child_changed", b, d, c); | |
fd(a, e, Eb, b, d, c); | |
return e | |
} | |
function fd(a, b, c, d, e, f) { | |
d = Pa(d, function(a) { | |
return a.type === c | |
}); | |
Xa(d, q(a.eg, a)); | |
Oa(d, function(c) { | |
var d = gd(a, c, f); | |
Oa(e, function(e) { | |
e.Jf(c.type) && b.push(e.createEvent(d, a.V)) | |
}) | |
}) | |
} | |
function gd(a, b, c) { | |
"value" !== b.type && "child_removed" !== b.type && (b.Nd = c.qf(b.Ya, b.Ja, a.g)); | |
return b | |
} | |
dd.prototype.eg = function(a, b) { | |
if (null == a.Ya || null == b.Ya) throw Hc("Should only compare child_ events."); | |
return this.g.compare(new E(a.Ya, a.Ja), new E(b.Ya, b.Ja)) | |
}; | |
function hd() { | |
this.eb = {} | |
} | |
function id(a, b) { | |
var c = b.type, | |
d = b.Ya; | |
J("child_added" == c || "child_changed" == c || "child_removed" == c, "Only child changes supported for tracking"); | |
J(".priority" !== d, "Only non-priority child changes can be tracked."); | |
var e = w(a.eb, d); | |
if (e) { | |
var f = e.type; | |
if ("child_added" == c && "child_removed" == f) a.eb[d] = new D("child_changed", b.Ja, d, e.Ja); | |
else if ("child_removed" == c && "child_added" == f) delete a.eb[d]; | |
else if ("child_removed" == c && "child_changed" == f) a.eb[d] = new D("child_removed", e.Je, d); | |
else if ("child_changed" == c && | |
"child_added" == f) a.eb[d] = new D("child_added", b.Ja, d); | |
else if ("child_changed" == c && "child_changed" == f) a.eb[d] = new D("child_changed", b.Ja, d, e.Je); | |
else throw Hc("Illegal combination of changes: " + b + " occurred after " + e); | |
} else a.eb[d] = b | |
}; | |
function jd(a, b, c) { | |
this.Pb = a; | |
this.qb = b; | |
this.sb = c || null | |
} | |
h = jd.prototype; | |
h.Jf = function(a) { | |
return "value" === a | |
}; | |
h.createEvent = function(a, b) { | |
var c = b.o.g; | |
return new Fb("value", this, new S(a.Ja, b.lc(), c)) | |
}; | |
h.Ub = function(a) { | |
var b = this.sb; | |
if ("cancel" === a.ye()) { | |
J(this.qb, "Raising a cancel event on a listener with no cancel callback"); | |
var c = this.qb; | |
return function() { | |
c.call(b, a.error) | |
} | |
} | |
var d = this.Pb; | |
return function() { | |
d.call(b, a.Wd) | |
} | |
}; | |
h.ff = function(a, b) { | |
return this.qb ? new Gb(this, a, b) : null | |
}; | |
h.matches = function(a) { | |
return a instanceof jd ? a.Pb && this.Pb ? a.Pb === this.Pb && a.sb === this.sb : !0 : !1 | |
}; | |
h.sf = function() { | |
return null !== this.Pb | |
}; | |
function kd(a, b, c) { | |
this.ga = a; | |
this.qb = b; | |
this.sb = c | |
} | |
h = kd.prototype; | |
h.Jf = function(a) { | |
a = "children_added" === a ? "child_added" : a; | |
return ("children_removed" === a ? "child_removed" : a) in this.ga | |
}; | |
h.ff = function(a, b) { | |
return this.qb ? new Gb(this, a, b) : null | |
}; | |
h.createEvent = function(a, b) { | |
J(null != a.Ya, "Child events should have a childName."); | |
var c = b.lc().w(a.Ya); | |
return new Fb(a.type, this, new S(a.Ja, c, b.o.g), a.Nd) | |
}; | |
h.Ub = function(a) { | |
var b = this.sb; | |
if ("cancel" === a.ye()) { | |
J(this.qb, "Raising a cancel event on a listener with no cancel callback"); | |
var c = this.qb; | |
return function() { | |
c.call(b, a.error) | |
} | |
} | |
var d = this.ga[a.rd]; | |
return function() { | |
d.call(b, a.Wd, a.Nd) | |
} | |
}; | |
h.matches = function(a) { | |
if (a instanceof kd) { | |
if (!this.ga || !a.ga) return !0; | |
if (this.sb === a.sb) { | |
var b = pa(a.ga); | |
if (b === pa(this.ga)) { | |
if (1 === b) { | |
var b = qa(a.ga), | |
c = qa(this.ga); | |
return c === b && (!a.ga[b] || !this.ga[c] || a.ga[b] === this.ga[c]) | |
} | |
return oa(this.ga, function(b, c) { | |
return a.ga[c] === b | |
}) | |
} | |
} | |
} | |
return !1 | |
}; | |
h.sf = function() { | |
return null !== this.ga | |
}; | |
function ld(a) { | |
this.g = a | |
} | |
h = ld.prototype; | |
h.G = function(a, b, c, d, e) { | |
J(a.Ic(this.g), "A node must be indexed if only a child is updated"); | |
d = a.M(b); | |
if (d.Z(c)) return a; | |
null != e && (c.e() ? a.Ha(b) ? id(e, new D("child_removed", d, b)) : J(a.N(), "A child remove without an old child only makes sense on a leaf node") : d.e() ? id(e, new D("child_added", c, b)) : id(e, new D("child_changed", c, b, d))); | |
return a.N() && c.e() ? a : a.Q(b, c).mb(this.g) | |
}; | |
h.ta = function(a, b, c) { | |
null != c && (a.N() || a.U(M, function(a, e) { | |
b.Ha(a) || id(c, new D("child_removed", e, a)) | |
}), b.N() || b.U(M, function(b, e) { | |
if (a.Ha(b)) { | |
var f = a.M(b); | |
f.Z(e) || id(c, new D("child_changed", e, b, f)) | |
} else id(c, new D("child_added", e, b)) | |
})); | |
return b.mb(this.g) | |
}; | |
h.da = function(a, b) { | |
return a.e() ? C : a.da(b) | |
}; | |
h.Ga = function() { | |
return !1 | |
}; | |
h.Vb = function() { | |
return this | |
}; | |
function md(a) { | |
this.Ae = new ld(a.g); | |
this.g = a.g; | |
var b; | |
a.la ? (b = nd(a), b = a.g.Oc(od(a), b)) : b = a.g.Sc(); | |
this.dd = b; | |
a.na ? (b = pd(a), a = a.g.Oc(qd(a), b)) : a = a.g.Pc(); | |
this.Fc = a | |
} | |
h = md.prototype; | |
h.matches = function(a) { | |
return 0 >= this.g.compare(this.dd, a) && 0 >= this.g.compare(a, this.Fc) | |
}; | |
h.G = function(a, b, c, d, e) { | |
this.matches(new E(b, c)) || (c = C); | |
return this.Ae.G(a, b, c, d, e) | |
}; | |
h.ta = function(a, b, c) { | |
b.N() && (b = C); | |
var d = b.mb(this.g), | |
d = d.da(C), | |
e = this; | |
b.U(M, function(a, b) { | |
e.matches(new E(a, b)) || (d = d.Q(a, C)) | |
}); | |
return this.Ae.ta(a, d, c) | |
}; | |
h.da = function(a) { | |
return a | |
}; | |
h.Ga = function() { | |
return !0 | |
}; | |
h.Vb = function() { | |
return this.Ae | |
}; | |
function rd(a) { | |
this.ra = new md(a); | |
this.g = a.g; | |
J(a.ia, "Only valid if limit has been set"); | |
this.ja = a.ja; | |
this.Jb = !sd(a) | |
} | |
h = rd.prototype; | |
h.G = function(a, b, c, d, e) { | |
this.ra.matches(new E(b, c)) || (c = C); | |
return a.M(b).Z(c) ? a : a.Db() < this.ja ? this.ra.Vb().G(a, b, c, d, e) : td(this, a, b, c, d, e) | |
}; | |
h.ta = function(a, b, c) { | |
var d; | |
if (b.N() || b.e()) d = C.mb(this.g); | |
else if (2 * this.ja < b.Db() && b.Ic(this.g)) { | |
d = C.mb(this.g); | |
b = this.Jb ? b.Zb(this.ra.Fc, this.g) : b.Xb(this.ra.dd, this.g); | |
for (var e = 0; 0 < b.Pa.length && e < this.ja;) { | |
var f = H(b), | |
g; | |
if (g = this.Jb ? 0 >= this.g.compare(this.ra.dd, f) : 0 >= this.g.compare(f, this.ra.Fc)) d = d.Q(f.name, f.S), e++; | |
else break | |
} | |
} else { | |
d = b.mb(this.g); | |
d = d.da(C); | |
var k, l, m; | |
if (this.Jb) { | |
b = d.rf(this.g); | |
k = this.ra.Fc; | |
l = this.ra.dd; | |
var v = ud(this.g); | |
m = function(a, b) { | |
return v(b, a) | |
} | |
} else b = d.Wb(this.g), k = this.ra.dd, | |
l = this.ra.Fc, m = ud(this.g); | |
for (var e = 0, y = !1; 0 < b.Pa.length;) f = H(b), !y && 0 >= m(k, f) && (y = !0), (g = y && e < this.ja && 0 >= m(f, l)) ? e++ : d = d.Q(f.name, C) | |
} | |
return this.ra.Vb().ta(a, d, c) | |
}; | |
h.da = function(a) { | |
return a | |
}; | |
h.Ga = function() { | |
return !0 | |
}; | |
h.Vb = function() { | |
return this.ra.Vb() | |
}; | |
function td(a, b, c, d, e, f) { | |
var g; | |
if (a.Jb) { | |
var k = ud(a.g); | |
g = function(a, b) { | |
return k(b, a) | |
} | |
} else g = ud(a.g); | |
J(b.Db() == a.ja, ""); | |
var l = new E(c, d), | |
m = a.Jb ? wd(b, a.g) : xd(b, a.g), | |
v = a.ra.matches(l); | |
if (b.Ha(c)) { | |
var y = b.M(c), | |
m = e.xe(a.g, m, a.Jb); | |
null != m && m.name == c && (m = e.xe(a.g, m, a.Jb)); | |
e = null == m ? 1 : g(m, l); | |
if (v && !d.e() && 0 <= e) return null != f && id(f, new D("child_changed", d, c, y)), b.Q(c, d); | |
null != f && id(f, new D("child_removed", y, c)); | |
b = b.Q(c, C); | |
return null != m && a.ra.matches(m) ? (null != f && id(f, new D("child_added", m.S, m.name)), b.Q(m.name, | |
m.S)) : b | |
} | |
return d.e() ? b : v && 0 <= g(m, l) ? (null != f && (id(f, new D("child_removed", m.S, m.name)), id(f, new D("child_added", d, c))), b.Q(c, d).Q(m.name, C)) : b | |
}; | |
function yd(a, b) { | |
this.he = a; | |
this.cg = b | |
} | |
function zd(a) { | |
this.I = a | |
} | |
zd.prototype.bb = function(a, b, c, d) { | |
var e = new hd, | |
f; | |
if (b.type === Vb) b.source.ve ? c = Ad(this, a, b.path, b.Ia, c, d, e) : (J(b.source.of, "Unknown source."), f = b.source.af, c = Bd(this, a, b.path, b.Ia, c, d, f, e)); | |
else if (b.type === Cd) b.source.ve ? c = Dd(this, a, b.path, b.children, c, d, e) : (J(b.source.of, "Unknown source."), f = b.source.af, c = Ed(this, a, b.path, b.children, c, d, f, e)); | |
else if (b.type === Xb) | |
if (b.Ve) | |
if (f = b.path, null != c.sc(f)) c = a; | |
else { | |
b = new qb(c, a, d); | |
d = a.D.j(); | |
if (f.e() || ".priority" === O(f)) Hb(a.u()) ? b = c.ua(tb(a)) : (b = a.u().j(), | |
J(b instanceof T, "serverChildren would be complete if leaf node"), b = c.xc(b)), b = this.I.ta(d, b, e); | |
else { | |
f = O(f); | |
var g = c.Xa(f, a.u()); | |
null == g && rb(a.u(), f) && (g = d.M(f)); | |
b = null != g ? this.I.G(d, f, g, b, e) : a.D.j().Ha(f) ? this.I.G(d, f, C, b, e) : d; | |
b.e() && Hb(a.u()) && (d = c.ua(tb(a)), d.N() && (b = this.I.ta(b, d, e))) | |
} | |
d = Hb(a.u()) || null != c.sc(F); | |
c = Fd(a, b, d, this.I.Ga()) | |
} else c = Gd(this, a, b.path, c, d, e); | |
else if (b.type === $b) d = b.path, b = a.u(), f = b.j(), g = b.$ || d.e(), c = Hd(this, new Id(a.D, new sb(f, g, b.Tb)), d, c, pb, e); | |
else throw Hc("Unknown operation type: " + | |
b.type); | |
e = ra(e.eb); | |
d = c; | |
b = d.D; | |
b.$ && (f = b.j().N() || b.j().e(), g = Jd(a), (0 < e.length || !a.D.$ || f && !b.j().Z(g) || !b.j().A().Z(g.A())) && e.push(Db(Jd(d)))); | |
return new yd(c, e) | |
}; | |
function Hd(a, b, c, d, e, f) { | |
var g = b.D; | |
if (null != d.sc(c)) return b; | |
var k; | |
if (c.e()) J(Hb(b.u()), "If change path is empty, we must have complete server data"), b.u().Tb ? (e = tb(b), d = d.xc(e instanceof T ? e : C)) : d = d.ua(tb(b)), f = a.I.ta(b.D.j(), d, f); | |
else { | |
var l = O(c); | |
if (".priority" == l) J(1 == uc(c), "Can't have a priority with additional path components"), f = g.j(), k = b.u().j(), d = d.hd(c, f, k), f = null != d ? a.I.da(f, d) : g.j(); | |
else { | |
var m = G(c); | |
rb(g, l) ? (k = b.u().j(), d = d.hd(c, g.j(), k), d = null != d ? g.j().M(l).G(m, d) : g.j().M(l)) : d = d.Xa(l, b.u()); | |
f = null != d ? a.I.G(g.j(), l, d, e, f) : g.j() | |
} | |
} | |
return Fd(b, f, g.$ || c.e(), a.I.Ga()) | |
} | |
function Bd(a, b, c, d, e, f, g, k) { | |
var l = b.u(); | |
g = g ? a.I : a.I.Vb(); | |
if (c.e()) d = g.ta(l.j(), d, null); | |
else if (g.Ga() && !l.Tb) d = l.j().G(c, d), d = g.ta(l.j(), d, null); | |
else { | |
var m = O(c); | |
if ((c.e() ? !l.$ || l.Tb : !rb(l, O(c))) && 1 < uc(c)) return b; | |
d = l.j().M(m).G(G(c), d); | |
d = ".priority" == m ? g.da(l.j(), d) : g.G(l.j(), m, d, pb, null) | |
} | |
l = l.$ || c.e(); | |
b = new Id(b.D, new sb(d, l, g.Ga())); | |
return Hd(a, b, c, e, new qb(e, b, f), k) | |
} | |
function Ad(a, b, c, d, e, f, g) { | |
var k = b.D; | |
e = new qb(e, b, f); | |
if (c.e()) g = a.I.ta(b.D.j(), d, g), a = Fd(b, g, !0, a.I.Ga()); | |
else if (f = O(c), ".priority" === f) g = a.I.da(b.D.j(), d), a = Fd(b, g, k.$, k.Tb); | |
else { | |
var l = G(c); | |
c = k.j().M(f); | |
if (!l.e()) { | |
var m = e.pf(f); | |
d = null != m ? ".priority" === vc(l) && m.oa(l.parent()).e() ? m : m.G(l, d) : C | |
} | |
c.Z(d) ? a = b : (g = a.I.G(k.j(), f, d, e, g), a = Fd(b, g, k.$, a.I.Ga())) | |
} | |
return a | |
} | |
function Dd(a, b, c, d, e, f, g) { | |
var k = b; | |
Kd(d, function(d, m) { | |
var v = c.w(d); | |
rb(b.D, O(v)) && (k = Ad(a, k, v, m, e, f, g)) | |
}); | |
Kd(d, function(d, m) { | |
var v = c.w(d); | |
rb(b.D, O(v)) || (k = Ad(a, k, v, m, e, f, g)) | |
}); | |
return k | |
} | |
function Ld(a, b) { | |
Kd(b, function(b, d) { | |
a = a.G(b, d) | |
}); | |
return a | |
} | |
function Ed(a, b, c, d, e, f, g, k) { | |
if (b.u().j().e() && !Hb(b.u())) return b; | |
var l = b; | |
c = c.e() ? d : Md(Nd, c, d); | |
var m = b.u().j(); | |
c.children.ha(function(c, d) { | |
if (m.Ha(c)) { | |
var I = b.u().j().M(c), | |
I = Ld(I, d); | |
l = Bd(a, l, new K(c), I, e, f, g, k) | |
} | |
}); | |
c.children.ha(function(c, d) { | |
var I = !Hb(b.u()) && null == d.value; | |
m.Ha(c) || I || (I = b.u().j().M(c), I = Ld(I, d), l = Bd(a, l, new K(c), I, e, f, g, k)) | |
}); | |
return l | |
} | |
function Gd(a, b, c, d, e, f) { | |
if (null != d.sc(c)) return b; | |
var g = new qb(d, b, e), | |
k = e = b.D.j(); | |
if (Hb(b.u())) { | |
if (c.e()) e = d.ua(tb(b)), k = a.I.ta(b.D.j(), e, f); | |
else if (".priority" === O(c)) { | |
var l = d.Xa(O(c), b.u()); | |
null == l || e.e() || e.A().Z(l) || (k = a.I.da(e, l)) | |
} else l = O(c), e = d.Xa(l, b.u()), null != e && (k = a.I.G(b.D.j(), l, e, g, f)); | |
e = !0 | |
} else if (b.D.$ || c.e()) k = e, e = b.D.j(), e.N() || e.U(M, function(c) { | |
var e = d.Xa(c, b.u()); | |
null != e && (k = a.I.G(k, c, e, g, f)) | |
}), e = b.D.$; | |
else { | |
l = O(c); | |
if (1 == uc(c) || rb(b.D, l)) c = d.Xa(l, b.u()), null != c && (k = a.I.G(e, l, c, | |
g, f)); | |
e = !1 | |
} | |
return Fd(b, k, e, a.I.Ga()) | |
}; | |
function Od() {} | |
var Pd = {}; | |
function ud(a) { | |
return q(a.compare, a) | |
} | |
Od.prototype.xd = function(a, b) { | |
return 0 !== this.compare(new E("[MIN_NAME]", a), new E("[MIN_NAME]", b)) | |
}; | |
Od.prototype.Sc = function() { | |
return Qd | |
}; | |
function Rd(a) { | |
this.bc = a | |
} | |
ma(Rd, Od); | |
h = Rd.prototype; | |
h.Hc = function(a) { | |
return !a.M(this.bc).e() | |
}; | |
h.compare = function(a, b) { | |
var c = a.S.M(this.bc), | |
d = b.S.M(this.bc), | |
c = c.Cc(d); | |
return 0 === c ? Sb(a.name, b.name) : c | |
}; | |
h.Oc = function(a, b) { | |
var c = L(a), | |
c = C.Q(this.bc, c); | |
return new E(b, c) | |
}; | |
h.Pc = function() { | |
var a = C.Q(this.bc, Sd); | |
return new E("[MAX_NAME]", a) | |
}; | |
h.toString = function() { | |
return this.bc | |
}; | |
function Td() {} | |
ma(Td, Od); | |
h = Td.prototype; | |
h.compare = function(a, b) { | |
var c = a.S.A(), | |
d = b.S.A(), | |
c = c.Cc(d); | |
return 0 === c ? Sb(a.name, b.name) : c | |
}; | |
h.Hc = function(a) { | |
return !a.A().e() | |
}; | |
h.xd = function(a, b) { | |
return !a.A().Z(b.A()) | |
}; | |
h.Sc = function() { | |
return Qd | |
}; | |
h.Pc = function() { | |
return new E("[MAX_NAME]", new tc("[PRIORITY-POST]", Sd)) | |
}; | |
h.Oc = function(a, b) { | |
var c = L(a); | |
return new E(b, new tc("[PRIORITY-POST]", c)) | |
}; | |
h.toString = function() { | |
return ".priority" | |
}; | |
var M = new Td; | |
function Ud() {} | |
ma(Ud, Od); | |
h = Ud.prototype; | |
h.compare = function(a, b) { | |
return Sb(a.name, b.name) | |
}; | |
h.Hc = function() { | |
throw Hc("KeyIndex.isDefinedOn not expected to be called."); | |
}; | |
h.xd = function() { | |
return !1 | |
}; | |
h.Sc = function() { | |
return Qd | |
}; | |
h.Pc = function() { | |
return new E("[MAX_NAME]", C) | |
}; | |
h.Oc = function(a) { | |
J(p(a), "KeyIndex indexValue must always be a string."); | |
return new E(a, C) | |
}; | |
h.toString = function() { | |
return ".key" | |
}; | |
var Vd = new Ud; | |
function Wd() {} | |
ma(Wd, Od); | |
h = Wd.prototype; | |
h.compare = function(a, b) { | |
var c = a.S.Cc(b.S); | |
return 0 === c ? Sb(a.name, b.name) : c | |
}; | |
h.Hc = function() { | |
return !0 | |
}; | |
h.xd = function(a, b) { | |
return !a.Z(b) | |
}; | |
h.Sc = function() { | |
return Qd | |
}; | |
h.Pc = function() { | |
return Xd | |
}; | |
h.Oc = function(a, b) { | |
var c = L(a); | |
return new E(b, c) | |
}; | |
h.toString = function() { | |
return ".value" | |
}; | |
var Yd = new Wd; | |
function Zd() { | |
this.Rb = this.na = this.Lb = this.la = this.ia = !1; | |
this.ja = 0; | |
this.Nb = ""; | |
this.dc = null; | |
this.xb = ""; | |
this.ac = null; | |
this.vb = ""; | |
this.g = M | |
} | |
var $d = new Zd; | |
function sd(a) { | |
return "" === a.Nb ? a.la : "l" === a.Nb | |
} | |
function od(a) { | |
J(a.la, "Only valid if start has been set"); | |
return a.dc | |
} | |
function nd(a) { | |
J(a.la, "Only valid if start has been set"); | |
return a.Lb ? a.xb : "[MIN_NAME]" | |
} | |
function qd(a) { | |
J(a.na, "Only valid if end has been set"); | |
return a.ac | |
} | |
function pd(a) { | |
J(a.na, "Only valid if end has been set"); | |
return a.Rb ? a.vb : "[MAX_NAME]" | |
} | |
function ae(a) { | |
var b = new Zd; | |
b.ia = a.ia; | |
b.ja = a.ja; | |
b.la = a.la; | |
b.dc = a.dc; | |
b.Lb = a.Lb; | |
b.xb = a.xb; | |
b.na = a.na; | |
b.ac = a.ac; | |
b.Rb = a.Rb; | |
b.vb = a.vb; | |
b.g = a.g; | |
return b | |
} | |
h = Zd.prototype; | |
h.Ge = function(a) { | |
var b = ae(this); | |
b.ia = !0; | |
b.ja = a; | |
b.Nb = ""; | |
return b | |
}; | |
h.He = function(a) { | |
var b = ae(this); | |
b.ia = !0; | |
b.ja = a; | |
b.Nb = "l"; | |
return b | |
}; | |
h.Ie = function(a) { | |
var b = ae(this); | |
b.ia = !0; | |
b.ja = a; | |
b.Nb = "r"; | |
return b | |
}; | |
h.Xd = function(a, b) { | |
var c = ae(this); | |
c.la = !0; | |
n(a) || (a = null); | |
c.dc = a; | |
null != b ? (c.Lb = !0, c.xb = b) : (c.Lb = !1, c.xb = ""); | |
return c | |
}; | |
h.qd = function(a, b) { | |
var c = ae(this); | |
c.na = !0; | |
n(a) || (a = null); | |
c.ac = a; | |
n(b) ? (c.Rb = !0, c.vb = b) : (c.Yg = !1, c.vb = ""); | |
return c | |
}; | |
function be(a, b) { | |
var c = ae(a); | |
c.g = b; | |
return c | |
} | |
function ce(a) { | |
var b = {}; | |
a.la && (b.sp = a.dc, a.Lb && (b.sn = a.xb)); | |
a.na && (b.ep = a.ac, a.Rb && (b.en = a.vb)); | |
if (a.ia) { | |
b.l = a.ja; | |
var c = a.Nb; | |
"" === c && (c = sd(a) ? "l" : "r"); | |
b.vf = c | |
} | |
a.g !== M && (b.i = a.g.toString()); | |
return b | |
} | |
function de(a) { | |
return !(a.la || a.na || a.ia) | |
} | |
function ee(a) { | |
var b = {}; | |
if (de(a) && a.g == M) return b; | |
var c; | |
a.g === M ? c = "$priority" : a.g === Yd ? c = "$value" : a.g === Vd ? c = "$key" : (J(a.g instanceof Rd, "Unrecognized index type!"), c = a.g.toString()); | |
b.orderBy = B(c); | |
a.la && (b.startAt = B(a.dc), a.Lb && (b.startAt += "," + B(a.xb))); | |
a.na && (b.endAt = B(a.ac), a.Rb && (b.endAt += "," + B(a.vb))); | |
a.ia && (sd(a) ? b.limitToFirst = a.ja : b.limitToLast = a.ja); | |
return b | |
} | |
h.toString = function() { | |
return B(ce(this)) | |
}; | |
function fe(a, b) { | |
this.yd = a; | |
this.cc = b | |
} | |
fe.prototype.get = function(a) { | |
var b = w(this.yd, a); | |
if (!b) throw Error("No index defined for " + a); | |
return b === Pd ? null : b | |
}; | |
function ge(a, b, c) { | |
var d = na(a.yd, function(d, f) { | |
var g = w(a.cc, f); | |
J(g, "Missing index implementation for " + f); | |
if (d === Pd) { | |
if (g.Hc(b.S)) { | |
for (var k = [], l = c.Wb(Qb), m = H(l); m;) m.name != b.name && k.push(m), m = H(l); | |
k.push(b); | |
return he(k, ud(g)) | |
} | |
return Pd | |
} | |
g = c.get(b.name); | |
k = d; | |
g && (k = k.remove(new E(b.name, g))); | |
return k.Na(b, b.S) | |
}); | |
return new fe(d, a.cc) | |
} | |
function ie(a, b, c) { | |
var d = na(a.yd, function(a) { | |
if (a === Pd) return a; | |
var d = c.get(b.name); | |
return d ? a.remove(new E(b.name, d)) : a | |
}); | |
return new fe(d, a.cc) | |
} | |
var je = new fe({ | |
".priority": Pd | |
}, { | |
".priority": M | |
}); | |
function tc(a, b) { | |
this.C = a; | |
J(n(this.C) && null !== this.C, "LeafNode shouldn't be created with null/undefined value."); | |
this.ba = b || C; | |
ke(this.ba); | |
this.Bb = null | |
} | |
h = tc.prototype; | |
h.N = function() { | |
return !0 | |
}; | |
h.A = function() { | |
return this.ba | |
}; | |
h.da = function(a) { | |
return new tc(this.C, a) | |
}; | |
h.M = function(a) { | |
return ".priority" === a ? this.ba : C | |
}; | |
h.oa = function(a) { | |
return a.e() ? this : ".priority" === O(a) ? this.ba : C | |
}; | |
h.Ha = function() { | |
return !1 | |
}; | |
h.qf = function() { | |
return null | |
}; | |
h.Q = function(a, b) { | |
return ".priority" === a ? this.da(b) : b.e() && ".priority" !== a ? this : C.Q(a, b).da(this.ba) | |
}; | |
h.G = function(a, b) { | |
var c = O(a); | |
if (null === c) return b; | |
if (b.e() && ".priority" !== c) return this; | |
J(".priority" !== c || 1 === uc(a), ".priority must be the last token in a path"); | |
return this.Q(c, C.G(G(a), b)) | |
}; | |
h.e = function() { | |
return !1 | |
}; | |
h.Db = function() { | |
return 0 | |
}; | |
h.K = function(a) { | |
return a && !this.A().e() ? { | |
".value": this.Ba(), | |
".priority": this.A().K() | |
} : this.Ba() | |
}; | |
h.hash = function() { | |
if (null === this.Bb) { | |
var a = ""; | |
this.ba.e() || (a += "priority:" + le(this.ba.K()) + ":"); | |
var b = typeof this.C, | |
a = a + (b + ":"), | |
a = "number" === b ? a + Zc(this.C) : a + this.C; | |
this.Bb = Jc(a) | |
} | |
return this.Bb | |
}; | |
h.Ba = function() { | |
return this.C | |
}; | |
h.Cc = function(a) { | |
if (a === C) return 1; | |
if (a instanceof T) return -1; | |
J(a.N(), "Unknown node type"); | |
var b = typeof a.C, | |
c = typeof this.C, | |
d = Na(me, b), | |
e = Na(me, c); | |
J(0 <= d, "Unknown leaf type: " + b); | |
J(0 <= e, "Unknown leaf type: " + c); | |
return d === e ? "object" === c ? 0 : this.C < a.C ? -1 : this.C === a.C ? 0 : 1 : e - d | |
}; | |
var me = ["object", "boolean", "number", "string"]; | |
tc.prototype.mb = function() { | |
return this | |
}; | |
tc.prototype.Ic = function() { | |
return !0 | |
}; | |
tc.prototype.Z = function(a) { | |
return a === this ? !0 : a.N() ? this.C === a.C && this.ba.Z(a.ba) : !1 | |
}; | |
tc.prototype.toString = function() { | |
return B(this.K(!0)) | |
}; | |
function T(a, b, c) { | |
this.m = a; | |
(this.ba = b) && ke(this.ba); | |
a.e() && J(!this.ba || this.ba.e(), "An empty node cannot have a priority"); | |
this.wb = c; | |
this.Bb = null | |
} | |
h = T.prototype; | |
h.N = function() { | |
return !1 | |
}; | |
h.A = function() { | |
return this.ba || C | |
}; | |
h.da = function(a) { | |
return this.m.e() ? this : new T(this.m, a, this.wb) | |
}; | |
h.M = function(a) { | |
if (".priority" === a) return this.A(); | |
a = this.m.get(a); | |
return null === a ? C : a | |
}; | |
h.oa = function(a) { | |
var b = O(a); | |
return null === b ? this : this.M(b).oa(G(a)) | |
}; | |
h.Ha = function(a) { | |
return null !== this.m.get(a) | |
}; | |
h.Q = function(a, b) { | |
J(b, "We should always be passing snapshot nodes"); | |
if (".priority" === a) return this.da(b); | |
var c = new E(a, b), | |
d, e; | |
b.e() ? (d = this.m.remove(a), c = ie(this.wb, c, this.m)) : (d = this.m.Na(a, b), c = ge(this.wb, c, this.m)); | |
e = d.e() ? C : this.ba; | |
return new T(d, e, c) | |
}; | |
h.G = function(a, b) { | |
var c = O(a); | |
if (null === c) return b; | |
J(".priority" !== O(a) || 1 === uc(a), ".priority must be the last token in a path"); | |
var d = this.M(c).G(G(a), b); | |
return this.Q(c, d) | |
}; | |
h.e = function() { | |
return this.m.e() | |
}; | |
h.Db = function() { | |
return this.m.count() | |
}; | |
var ne = /^(0|[1-9]\d*)$/; | |
h = T.prototype; | |
h.K = function(a) { | |
if (this.e()) return null; | |
var b = {}, | |
c = 0, | |
d = 0, | |
e = !0; | |
this.U(M, function(f, g) { | |
b[f] = g.K(a); | |
c++; | |
e && ne.test(f) ? d = Math.max(d, Number(f)) : e = !1 | |
}); | |
if (!a && e && d < 2 * c) { | |
var f = [], | |
g; | |
for (g in b) f[g] = b[g]; | |
return f | |
} | |
a && !this.A().e() && (b[".priority"] = this.A().K()); | |
return b | |
}; | |
h.hash = function() { | |
if (null === this.Bb) { | |
var a = ""; | |
this.A().e() || (a += "priority:" + le(this.A().K()) + ":"); | |
this.U(M, function(b, c) { | |
var d = c.hash(); | |
"" !== d && (a += ":" + b + ":" + d) | |
}); | |
this.Bb = "" === a ? "" : Jc(a) | |
} | |
return this.Bb | |
}; | |
h.qf = function(a, b, c) { | |
return (c = oe(this, c)) ? (a = cc(c, new E(a, b))) ? a.name : null : cc(this.m, a) | |
}; | |
function wd(a, b) { | |
var c; | |
c = (c = oe(a, b)) ? (c = c.Rc()) && c.name : a.m.Rc(); | |
return c ? new E(c, a.m.get(c)) : null | |
} | |
function xd(a, b) { | |
var c; | |
c = (c = oe(a, b)) ? (c = c.ec()) && c.name : a.m.ec(); | |
return c ? new E(c, a.m.get(c)) : null | |
} | |
h.U = function(a, b) { | |
var c = oe(this, a); | |
return c ? c.ha(function(a) { | |
return b(a.name, a.S) | |
}) : this.m.ha(b) | |
}; | |
h.Wb = function(a) { | |
return this.Xb(a.Sc(), a) | |
}; | |
h.Xb = function(a, b) { | |
var c = oe(this, b); | |
if (c) return c.Xb(a, function(a) { | |
return a | |
}); | |
for (var c = this.m.Xb(a.name, Qb), d = ec(c); null != d && 0 > b.compare(d, a);) H(c), d = ec(c); | |
return c | |
}; | |
h.rf = function(a) { | |
return this.Zb(a.Pc(), a) | |
}; | |
h.Zb = function(a, b) { | |
var c = oe(this, b); | |
if (c) return c.Zb(a, function(a) { | |
return a | |
}); | |
for (var c = this.m.Zb(a.name, Qb), d = ec(c); null != d && 0 < b.compare(d, a);) H(c), d = ec(c); | |
return c | |
}; | |
h.Cc = function(a) { | |
return this.e() ? a.e() ? 0 : -1 : a.N() || a.e() ? 1 : a === Sd ? -1 : 0 | |
}; | |
h.mb = function(a) { | |
if (a === Vd || ta(this.wb.cc, a.toString())) return this; | |
var b = this.wb, | |
c = this.m; | |
J(a !== Vd, "KeyIndex always exists and isn't meant to be added to the IndexMap."); | |
for (var d = [], e = !1, c = c.Wb(Qb), f = H(c); f;) e = e || a.Hc(f.S), d.push(f), f = H(c); | |
d = e ? he(d, ud(a)) : Pd; | |
e = a.toString(); | |
c = xa(b.cc); | |
c[e] = a; | |
a = xa(b.yd); | |
a[e] = d; | |
return new T(this.m, this.ba, new fe(a, c)) | |
}; | |
h.Ic = function(a) { | |
return a === Vd || ta(this.wb.cc, a.toString()) | |
}; | |
h.Z = function(a) { | |
if (a === this) return !0; | |
if (a.N()) return !1; | |
if (this.A().Z(a.A()) && this.m.count() === a.m.count()) { | |
var b = this.Wb(M); | |
a = a.Wb(M); | |
for (var c = H(b), d = H(a); c && d;) { | |
if (c.name !== d.name || !c.S.Z(d.S)) return !1; | |
c = H(b); | |
d = H(a) | |
} | |
return null === c && null === d | |
} | |
return !1 | |
}; | |
function oe(a, b) { | |
return b === Vd ? null : a.wb.get(b.toString()) | |
} | |
h.toString = function() { | |
return B(this.K(!0)) | |
}; | |
function L(a, b) { | |
if (null === a) return C; | |
var c = null; | |
"object" === typeof a && ".priority" in a ? c = a[".priority"] : "undefined" !== typeof b && (c = b); | |
J(null === c || "string" === typeof c || "number" === typeof c || "object" === typeof c && ".sv" in c, "Invalid priority type found: " + typeof c); | |
"object" === typeof a && ".value" in a && null !== a[".value"] && (a = a[".value"]); | |
if ("object" !== typeof a || ".sv" in a) return new tc(a, L(c)); | |
if (a instanceof Array) { | |
var d = C, | |
e = a; | |
r(e, function(a, b) { | |
if (u(e, b) && "." !== b.substring(0, 1)) { | |
var c = L(a); | |
if (c.N() || !c.e()) d = | |
d.Q(b, c) | |
} | |
}); | |
return d.da(L(c)) | |
} | |
var f = [], | |
g = !1, | |
k = a; | |
hb(k, function(a) { | |
if ("string" !== typeof a || "." !== a.substring(0, 1)) { | |
var b = L(k[a]); | |
b.e() || (g = g || !b.A().e(), f.push(new E(a, b))) | |
} | |
}); | |
if (0 == f.length) return C; | |
var l = he(f, Rb, function(a) { | |
return a.name | |
}, Tb); | |
if (g) { | |
var m = he(f, ud(M)); | |
return new T(l, L(c), new fe({ | |
".priority": m | |
}, { | |
".priority": M | |
})) | |
} | |
return new T(l, L(c), je) | |
} | |
var pe = Math.log(2); | |
function qe(a) { | |
this.count = parseInt(Math.log(a + 1) / pe, 10); | |
this.hf = this.count - 1; | |
this.bg = a + 1 & parseInt(Array(this.count + 1).join("1"), 2) | |
} | |
function re(a) { | |
var b = !(a.bg & 1 << a.hf); | |
a.hf--; | |
return b | |
} | |
function he(a, b, c, d) { | |
function e(b, d) { | |
var f = d - b; | |
if (0 == f) return null; | |
if (1 == f) { | |
var m = a[b], | |
v = c ? c(m) : m; | |
return new fc(v, m.S, !1, null, null) | |
} | |
var m = parseInt(f / 2, 10) + b, | |
f = e(b, m), | |
y = e(m + 1, d), | |
m = a[m], | |
v = c ? c(m) : m; | |
return new fc(v, m.S, !1, f, y) | |
} | |
a.sort(b); | |
var f = function(b) { | |
function d(b, g) { | |
var k = v - b, | |
y = v; | |
v -= b; | |
var y = e(k + 1, y), | |
k = a[k], | |
I = c ? c(k) : k, | |
y = new fc(I, k.S, g, null, y); | |
f ? f.left = y : m = y; | |
f = y | |
} | |
for (var f = null, m = null, v = a.length, y = 0; y < b.count; ++y) { | |
var I = re(b), | |
vd = Math.pow(2, b.count - (y + 1)); | |
I ? d(vd, !1) : (d(vd, !1), d(vd, !0)) | |
} | |
return m | |
}(new qe(a.length)); | |
return null !== f ? new ac(d || b, f) : new ac(d || b) | |
} | |
function le(a) { | |
return "number" === typeof a ? "number:" + Zc(a) : "string:" + a | |
} | |
function ke(a) { | |
if (a.N()) { | |
var b = a.K(); | |
J("string" === typeof b || "number" === typeof b || "object" === typeof b && u(b, ".sv"), "Priority must be a string or number.") | |
} else J(a === Sd || a.e(), "priority of unexpected type."); | |
J(a === Sd || a.A().e(), "Priority nodes can't have a priority of their own.") | |
} | |
var C = new T(new ac(Tb), null, je); | |
function se() { | |
T.call(this, new ac(Tb), C, je) | |
} | |
ma(se, T); | |
h = se.prototype; | |
h.Cc = function(a) { | |
return a === this ? 0 : 1 | |
}; | |
h.Z = function(a) { | |
return a === this | |
}; | |
h.A = function() { | |
return this | |
}; | |
h.M = function() { | |
return C | |
}; | |
h.e = function() { | |
return !1 | |
}; | |
var Sd = new se, | |
Qd = new E("[MIN_NAME]", C), | |
Xd = new E("[MAX_NAME]", Sd); | |
function Id(a, b) { | |
this.D = a; | |
this.Ud = b | |
} | |
function Fd(a, b, c, d) { | |
return new Id(new sb(b, c, d), a.Ud) | |
} | |
function Jd(a) { | |
return a.D.$ ? a.D.j() : null | |
} | |
Id.prototype.u = function() { | |
return this.Ud | |
}; | |
function tb(a) { | |
return a.Ud.$ ? a.Ud.j() : null | |
}; | |
function te(a, b) { | |
this.V = a; | |
var c = a.o, | |
d = new ld(c.g), | |
c = de(c) ? new ld(c.g) : c.ia ? new rd(c) : new md(c); | |
this.Gf = new zd(c); | |
var e = b.u(), | |
f = b.D, | |
g = d.ta(C, e.j(), null), | |
k = c.ta(C, f.j(), null); | |
this.Ka = new Id(new sb(k, f.$, c.Ga()), new sb(g, e.$, d.Ga())); | |
this.Za = []; | |
this.ig = new dd(a) | |
} | |
function ue(a) { | |
return a.V | |
} | |
h = te.prototype; | |
h.u = function() { | |
return this.Ka.u().j() | |
}; | |
h.hb = function(a) { | |
var b = tb(this.Ka); | |
return b && (de(this.V.o) || !a.e() && !b.M(O(a)).e()) ? b.oa(a) : null | |
}; | |
h.e = function() { | |
return 0 === this.Za.length | |
}; | |
h.Ob = function(a) { | |
this.Za.push(a) | |
}; | |
h.kb = function(a, b) { | |
var c = []; | |
if (b) { | |
J(null == a, "A cancel should cancel all event registrations."); | |
var d = this.V.path; | |
Oa(this.Za, function(a) { | |
(a = a.ff(b, d)) && c.push(a) | |
}) | |
} | |
if (a) { | |
for (var e = [], f = 0; f < this.Za.length; ++f) { | |
var g = this.Za[f]; | |
if (!g.matches(a)) e.push(g); | |
else if (a.sf()) { | |
e = e.concat(this.Za.slice(f + 1)); | |
break | |
} | |
} | |
this.Za = e | |
} else this.Za = []; | |
return c | |
}; | |
h.bb = function(a, b, c) { | |
a.type === Cd && null !== a.source.Ib && (J(tb(this.Ka), "We should always have a full cache before handling merges"), J(Jd(this.Ka), "Missing event cache, even though we have a server cache")); | |
var d = this.Ka; | |
a = this.Gf.bb(d, a, b, c); | |
b = this.Gf; | |
c = a.he; | |
J(c.D.j().Ic(b.I.g), "Event snap not indexed"); | |
J(c.u().j().Ic(b.I.g), "Server snap not indexed"); | |
J(Hb(a.he.u()) || !Hb(d.u()), "Once a server snap is complete, it should never go back"); | |
this.Ka = a.he; | |
return ve(this, a.cg, a.he.D.j(), null) | |
}; | |
function we(a, b) { | |
var c = a.Ka.D, | |
d = []; | |
c.j().N() || c.j().U(M, function(a, b) { | |
d.push(new D("child_added", b, a)) | |
}); | |
c.$ && d.push(Db(c.j())); | |
return ve(a, d, c.j(), b) | |
} | |
function ve(a, b, c, d) { | |
return ed(a.ig, b, c, d ? [d] : a.Za) | |
}; | |
function xe(a, b, c) { | |
this.type = Cd; | |
this.source = a; | |
this.path = b; | |
this.children = c | |
} | |
xe.prototype.Wc = function(a) { | |
if (this.path.e()) return a = this.children.subtree(new K(a)), a.e() ? null : a.value ? new Ub(this.source, F, a.value) : new xe(this.source, F, a); | |
J(O(this.path) === a, "Can't get a merge for a child not on the path of the operation"); | |
return new xe(this.source, G(this.path), this.children) | |
}; | |
xe.prototype.toString = function() { | |
return "Operation(" + this.path + ": " + this.source.toString() + " merge: " + this.children.toString() + ")" | |
}; | |
var Vb = 0, | |
Cd = 1, | |
Xb = 2, | |
$b = 3; | |
function ye(a, b, c, d) { | |
this.ve = a; | |
this.of = b; | |
this.Ib = c; | |
this.af = d; | |
J(!d || b, "Tagged queries must be from server.") | |
} | |
var Yb = new ye(!0, !1, null, !1), | |
ze = new ye(!1, !0, null, !1); | |
ye.prototype.toString = function() { | |
return this.ve ? "user" : this.af ? "server(queryID=" + this.Ib + ")" : "server" | |
}; | |
function Ae(a, b) { | |
this.f = Oc("p:rest:"); | |
this.H = a; | |
this.Gb = b; | |
this.Fa = null; | |
this.aa = {} | |
} | |
function Be(a, b) { | |
if (n(b)) return "tag$" + b; | |
var c = a.o; | |
J(de(c) && c.g == M, "should have a tag if it's not a default query."); | |
return a.path.toString() | |
} | |
h = Ae.prototype; | |
h.xf = function(a, b, c, d) { | |
var e = a.path.toString(); | |
this.f("Listen called for " + e + " " + a.wa()); | |
var f = Be(a, c), | |
g = {}; | |
this.aa[f] = g; | |
a = ee(a.o); | |
var k = this; | |
Ce(this, e + ".json", a, function(a, b) { | |
var v = b; | |
404 === a && (a = v = null); | |
null === a && k.Gb(e, v, !1, c); | |
w(k.aa, f) === g && d(a ? 401 == a ? "permission_denied" : "rest_error:" + a : "ok", null) | |
}) | |
}; | |
h.Of = function(a, b) { | |
var c = Be(a, b); | |
delete this.aa[c] | |
}; | |
h.P = function(a, b) { | |
this.Fa = a; | |
var c = ad(a), | |
d = c.data, | |
c = c.Ac && c.Ac.exp; | |
b && b("ok", { | |
auth: d, | |
expires: c | |
}) | |
}; | |
h.ee = function(a) { | |
this.Fa = null; | |
a("ok", null) | |
}; | |
h.Le = function() {}; | |
h.Bf = function() {}; | |
h.Gd = function() {}; | |
h.put = function() {}; | |
h.yf = function() {}; | |
h.Te = function() {}; | |
function Ce(a, b, c, d) { | |
c = c || {}; | |
c.format = "export"; | |
a.Fa && (c.auth = a.Fa); | |
var e = (a.H.lb ? "https://" : "http://") + a.H.host + b + "?" + jb(c); | |
a.f("Sending REST request for " + e); | |
var f = new XMLHttpRequest; | |
f.onreadystatechange = function() { | |
if (d && 4 === f.readyState) { | |
a.f("REST Response for " + e + " received. status:", f.status, "response:", f.responseText); | |
var b = null; | |
if (200 <= f.status && 300 > f.status) { | |
try { | |
b = mb(f.responseText) | |
} catch (c) { | |
Q("Failed to parse JSON response for " + e + ": " + f.responseText) | |
} | |
d(null, b) | |
} else 401 !== f.status && 404 !== | |
f.status && Q("Got unsuccessful REST response for " + e + " Status: " + f.status), d(f.status); | |
d = null | |
} | |
}; | |
f.open("GET", e, !0); | |
f.send() | |
}; | |
function De(a, b) { | |
this.value = a; | |
this.children = b || Ee | |
} | |
var Ee = new ac(function(a, b) { | |
return a === b ? 0 : a < b ? -1 : 1 | |
}); | |
function Fe(a) { | |
var b = Nd; | |
r(a, function(a, d) { | |
b = b.set(new K(d), a) | |
}); | |
return b | |
} | |
h = De.prototype; | |
h.e = function() { | |
return null === this.value && this.children.e() | |
}; | |
function Ge(a, b, c) { | |
if (null != a.value && c(a.value)) return { | |
path: F, | |
value: a.value | |
}; | |
if (b.e()) return null; | |
var d = O(b); | |
a = a.children.get(d); | |
return null !== a ? (b = Ge(a, G(b), c), null != b ? { | |
path: (new K(d)).w(b.path), | |
value: b.value | |
} : null) : null | |
} | |
function He(a, b) { | |
return Ge(a, b, function() { | |
return !0 | |
}) | |
} | |
h.subtree = function(a) { | |
if (a.e()) return this; | |
var b = this.children.get(O(a)); | |
return null !== b ? b.subtree(G(a)) : Nd | |
}; | |
h.set = function(a, b) { | |
if (a.e()) return new De(b, this.children); | |
var c = O(a), | |
d = (this.children.get(c) || Nd).set(G(a), b), | |
c = this.children.Na(c, d); | |
return new De(this.value, c) | |
}; | |
h.remove = function(a) { | |
if (a.e()) return this.children.e() ? Nd : new De(null, this.children); | |
var b = O(a), | |
c = this.children.get(b); | |
return c ? (a = c.remove(G(a)), b = a.e() ? this.children.remove(b) : this.children.Na(b, a), null === this.value && b.e() ? Nd : new De(this.value, b)) : this | |
}; | |
h.get = function(a) { | |
if (a.e()) return this.value; | |
var b = this.children.get(O(a)); | |
return b ? b.get(G(a)) : null | |
}; | |
function Md(a, b, c) { | |
if (b.e()) return c; | |
var d = O(b); | |
b = Md(a.children.get(d) || Nd, G(b), c); | |
d = b.e() ? a.children.remove(d) : a.children.Na(d, b); | |
return new De(a.value, d) | |
} | |
function Ie(a, b) { | |
return Je(a, F, b) | |
} | |
function Je(a, b, c) { | |
var d = {}; | |
a.children.ha(function(a, f) { | |
d[a] = Je(f, b.w(a), c) | |
}); | |
return c(b, a.value, d) | |
} | |
function Ke(a, b, c) { | |
return Le(a, b, F, c) | |