hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
75c31352269c9a4d953355cf5190b70c385c2c6c | 165 | js | JavaScript | app/containers/LoginPage/actions.js | MaximumBlueGreen/powergrid-client | f49e3e095c34cb8fa64983894beac6c73f3ca1fa | [
"MIT"
] | null | null | null | app/containers/LoginPage/actions.js | MaximumBlueGreen/powergrid-client | f49e3e095c34cb8fa64983894beac6c73f3ca1fa | [
"MIT"
] | 2 | 2019-05-01T15:21:34.000Z | 2019-05-01T15:22:14.000Z | app/containers/LoginPage/actions.js | MaximumBlueGreen/powergrid-client | f49e3e095c34cb8fa64983894beac6c73f3ca1fa | [
"MIT"
] | 1 | 2019-12-22T01:45:24.000Z | 2019-12-22T01:45:24.000Z | /*
*
* LoginPage actions
*
*/
import { CHANGE_MODE_ACTION } from './constants';
export function changeMode() {
return {
type: CHANGE_MODE_ACTION,
};
}
| 11.785714 | 49 | 0.636364 |
75c3d944c4da988269fc46bee67614586e63f23c | 215,449 | js | JavaScript | fb/firebase.js | prashant31191/prashant31191.github.io | 937e201f6d63abb0f7ecdb40560e742b6d81d4e2 | [
"CC-BY-3.0"
] | null | null | null | fb/firebase.js | prashant31191/prashant31191.github.io | 937e201f6d63abb0f7ecdb40560e742b6d81d4e2 | [
"CC-BY-3.0"
] | null | null | null | fb/firebase.js | prashant31191/prashant31191.github.io | 937e201f6d63abb0f7ecdb40560e742b6d81d4e2 | [
"CC-BY-3.0"
] | null | null | null | /*! @license Firebase v2.3.2
License: https://www.firebase.com/terms/terms-of-service.html */
(function () {
var g, aa = this;
function n(a) {
return void 0 !== a
}
function ba() {}
function ca(a) {
a.ub = function () {
return a.uf ? a.uf : a.uf = 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.bh = b.prototype;
a.prototype = new c;
a.prototype.constructor = a;
a.Yg = function (a, c, f) {
for (var h = Array(arguments.length - 2), k = 2; k < arguments.length; k++) h[k - 2] = arguments[k];
return b.prototype[c].apply(a, h)
}
};
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.Sd = 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.Sd ? a.Sd.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.Sd ? a.Sd.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.Va = -1
};
function La() {
this.Va = -1;
this.Va = 64;
this.N = [];
this.me = [];
this.Wf = [];
this.Ld = [];
this.Ld[0] = 128;
for (var a = 1; a < this.Va; ++a) this.Ld[a] = 0;
this.de = this.ac = 0;
this.reset()
}
ma(La, Ka);
La.prototype.reset = function () {
this.N[0] = 1732584193;
this.N[1] = 4023233417;
this.N[2] = 2562383102;
this.N[3] = 271733878;
this.N[4] = 3285377520;
this.de = this.ac = 0
};
function Ma(a, b, c) {
c || (c = 0);
var d = a.Wf;
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.N[0];
c = a.N[1];
for (var h = a.N[2], k = a.N[3], l = a.N[4], m, e = 0; 80 > e; e++) 40 > e ? 20 > e ? (f = k ^ c & (h ^ k), m = 1518500249) : (f = c ^ h ^ k, m = 1859775393) : 60 > e ? (f = c & h | k & (c | h), m = 2400959708) : (f = c ^ h ^ k, m = 3395469782), f = (b <<
5 | b >>> 27) + f + l + m + d[e] & 4294967295, l = k, k = h, h = (c << 30 | c >>> 2) & 4294967295, c = b, b = f;
a.N[0] = a.N[0] + b & 4294967295;
a.N[1] = a.N[1] + c & 4294967295;
a.N[2] = a.N[2] + h & 4294967295;
a.N[3] = a.N[3] + k & 4294967295;
a.N[4] = a.N[4] + l & 4294967295
}
La.prototype.update = function (a, b) {
if (null != a) {
n(b) || (b = a.length);
for (var c = b - this.Va, d = 0, e = this.me, f = this.ac; d < b;) {
if (0 == f)
for (; d <= c;) Ma(this, a, d), d += this.Va;
if (p(a))
for (; d < b;) {
if (e[f] = a.charCodeAt(d), ++f, ++d, f == this.Va) {
Ma(this, e);
f = 0;
break
}
} else
for (; d < b;)
if (e[f] = a[d], ++f, ++d, f == this.Va) {
Ma(this, e);
f = 0;
break
}
}
this.ac = f;
this.de += b
}
};
var u = Array.prototype,
Na = u.indexOf ? function (a, b, c) {
return u.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 = u.forEach ? function (a, b, c) {
u.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 = u.filter ? function (a, b, c) {
return u.filter.call(a, b, c)
} : function (a, b, c) {
for (var d = a.length, e = [], f = 0, h = p(a) ?
a.split("") : a, k = 0; k < d; k++)
if (k in h) {
var l = h[k];
b.call(c, l, k, a) && (e[f++] = l)
}
return e
},
Qa = u.map ? function (a, b, c) {
return u.map.call(a, b, c)
} : function (a, b, c) {
for (var d = a.length, e = Array(d), f = p(a) ? a.split("") : a, h = 0; h < d; h++) h in f && (e[h] = b.call(c, f[h], h, a));
return e
},
Ra = u.reduce ? function (a, b, c, d) {
for (var e = [], f = 1, h = arguments.length; f < h; f++) e.push(arguments[f]);
d && (e[0] = q(b, d));
return u.reduce.apply(a, e)
} : function (a, b, c, d) {
var e = c;
Oa(a, function (c, h) {
e = b.call(d, e, c, h, a)
});
return e
},
Sa = u.every ? function (a, b,
c) {
return u.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 && u.splice.call(a, c, 1)
}
function Wa(a, b, c) {
return 2 >= arguments.length ? u.slice.call(a, b) : u.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],
h = e + 1 < a.length,
k = h ? a[e + 1] : 0,
l = e + 2 < a.length,
m = l ? a[e + 2] : 0,
t = f >> 2,
f = (f & 3) << 4 | k >> 4,
k = (k & 15) << 2 | m >> 6,
m = m & 63;
l || (m = 64, h || (k = 64));
d.push(c[t], 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)
}
};
var hb = hb || "2.3.2";
function v(a, b) {
return Object.prototype.hasOwnProperty.call(a, b)
}
function w(a, b) {
if (Object.prototype.hasOwnProperty.call(a, b)) return a[b]
}
function ib(a, b) {
for (var c in a) Object.prototype.hasOwnProperty.call(a, c) && b(c, a[c])
}
function jb(a) {
var b = {};
ib(a, function (a, d) {
b[a] = d
});
return b
};
function kb(a) {
var b = [];
ib(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 lb(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 y(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(y(a, b, d) + "must be a valid function.");
}
function mb(a, b, c) {
if (n(c) && (!ia(c) || null === c)) throw Error(y(a, b, !0) + "must be a valid context object.");
};
function nb(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 ob() {
this.Wd = C
}
ob.prototype.j = function (a) {
return this.Wd.Q(a)
};
ob.prototype.toString = function () {
return this.Wd.toString()
};
function pb() {}
pb.prototype.qf = function () {
return null
};
pb.prototype.ye = function () {
return null
};
var qb = new pb;
function rb(a, b, c) {
this.Tf = a;
this.Ka = b;
this.Kd = c
}
rb.prototype.qf = function (a) {
var b = this.Ka.O;
if (sb(b, a)) return b.j().R(a);
b = null != this.Kd ? new tb(this.Kd, !0, !1) : this.Ka.w();
return this.Tf.xc(a, b)
};
rb.prototype.ye = function (a, b, c) {
var d = null != this.Kd ? this.Kd : ub(this.Ka);
a = this.Tf.ne(d, b, 1, c, a);
return 0 === a.length ? null : a[0]
};
function vb() {
this.tb = []
}
function wb(a, b) {
for (var c = null, d = 0; d < b.length; d++) {
var e = b[d],
f = e.Zb();
null === c || f.ca(c.Zb()) || (a.tb.push(c), c = null);
null === c && (c = new xb(f));
c.add(e)
}
c && a.tb.push(c)
}
function yb(a, b, c) {
wb(a, c);
zb(a, function (a) {
return a.ca(b)
})
}
function Ab(a, b, c) {
wb(a, c);
zb(a, function (a) {
return a.contains(b) || b.contains(a)
})
}
function zb(a, b) {
for (var c = !0, d = 0; d < a.tb.length; d++) {
var e = a.tb[d];
if (e)
if (e = e.Zb(), b(e)) {
for (var e = a.tb[d], f = 0; f < e.vd.length; f++) {
var h = e.vd[f];
if (null !== h) {
e.vd[f] = null;
var k = h.Vb();
Bb && Cb("event: " + h.toString());
Db(k)
}
}
a.tb[d] = null
} else c = !1
}
c && (a.tb = [])
}
function xb(a) {
this.ra = a;
this.vd = []
}
xb.prototype.add = function (a) {
this.vd.push(a)
};
xb.prototype.Zb = function () {
return this.ra
};
function D(a, b, c, d) {
this.type = a;
this.Ja = b;
this.Wa = c;
this.Ke = d;
this.Qd = void 0
}
function Eb(a) {
return new D(Fb, a)
}
var Fb = "value";
function Gb(a, b, c, d) {
this.ue = b;
this.Zd = c;
this.Qd = d;
this.ud = a
}
Gb.prototype.Zb = function () {
var a = this.Zd.Ib();
return "value" === this.ud ? a.path : a.parent().path
};
Gb.prototype.ze = function () {
return this.ud
};
Gb.prototype.Vb = function () {
return this.ue.Vb(this)
};
Gb.prototype.toString = function () {
return this.Zb().toString() + ":" + this.ud + ":" + B(this.Zd.mf())
};
function Hb(a, b, c) {
this.ue = a;
this.error = b;
this.path = c
}
Hb.prototype.Zb = function () {
return this.path
};
Hb.prototype.ze = function () {
return "cancel"
};
Hb.prototype.Vb = function () {
return this.ue.Vb(this)
};
Hb.prototype.toString = function () {
return this.path.toString() + ":cancel"
};
function tb(a, b, c) {
this.A = a;
this.ea = b;
this.Ub = c
}
function Ib(a) {
return a.ea
}
function Jb(a) {
return a.Ub
}
function Kb(a, b) {
return b.e() ? a.ea && !a.Ub : sb(a, E(b))
}
function sb(a, b) {
return a.ea && !a.Ub || a.A.Da(b)
}
tb.prototype.j = function () {
return this.A
};
function Lb(a) {
this.gg = a;
this.Dd = null
}
Lb.prototype.get = function () {
var a = this.gg.get(),
b = xa(a);
if (this.Dd)
for (var c in this.Dd) b[c] -= this.Dd[c];
this.Dd = a;
return b
};
function Mb(a, b) {
this.Of = {};
this.fd = new Lb(a);
this.ba = b;
var c = 1E4 + 2E4 * Math.random();
setTimeout(q(this.If, this), Math.floor(c))
}
Mb.prototype.If = function () {
var a = this.fd.get(),
b = {},
c = !1,
d;
for (d in a) 0 < a[d] && v(this.Of, d) && (b[d] = a[d], c = !0);
c && this.ba.Ue(b);
setTimeout(q(this.If, this), Math.floor(6E5 * Math.random()))
};
function Nb() {
this.Ec = {}
}
function Ob(a, b, c) {
n(c) || (c = 1);
v(a.Ec, b) || (a.Ec[b] = 0);
a.Ec[b] += c
}
Nb.prototype.get = function () {
return xa(this.Ec)
};
var Pb = {},
Qb = {};
function Rb(a) {
a = a.toString();
Pb[a] || (Pb[a] = new Nb);
return Pb[a]
}
function Sb(a, b) {
var c = a.toString();
Qb[c] || (Qb[c] = b());
return Qb[c]
};
function F(a, b) {
this.name = a;
this.S = b
}
function Tb(a, b) {
return new F(a, b)
};
function Ub(a, b) {
return Vb(a.name, b.name)
}
function Wb(a, b) {
return Vb(a, b)
};
function Xb(a, b, c) {
this.type = Yb;
this.source = a;
this.path = b;
this.Ga = c
}
Xb.prototype.Xc = function (a) {
return this.path.e() ? new Xb(this.source, G, this.Ga.R(a)) : new Xb(this.source, H(this.path), this.Ga)
};
Xb.prototype.toString = function () {
return "Operation(" + this.path + ": " + this.source.toString() + " overwrite: " + this.Ga.toString() + ")"
};
function Zb(a, b) {
this.type = $b;
this.source = a;
this.path = b
}
Zb.prototype.Xc = function () {
return this.path.e() ? new Zb(this.source, G) : new Zb(this.source, H(this.path))
};
Zb.prototype.toString = function () {
return "Operation(" + this.path + ": " + this.source.toString() + " listen_complete)"
};
function ac(a, b) {
this.La = a;
this.wa = b ? b : bc
}
g = ac.prototype;
g.Oa = function (a, b) {
return new ac(this.La, this.wa.Oa(a, b, this.La).Y(null, null, !1, null, null))
};
g.remove = function (a) {
return new ac(this.La, this.wa.remove(a, this.La).Y(null, null, !1, null, null))
};
g.get = function (a) {
for (var b, c = this.wa; !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.wa, 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?");
}
g.e = function () {
return this.wa.e()
};
g.count = function () {
return this.wa.count()
};
g.Sc = function () {
return this.wa.Sc()
};
g.fc = function () {
return this.wa.fc()
};
g.ia = function (a) {
return this.wa.ia(a)
};
g.Xb = function (a) {
return new dc(this.wa, null, this.La, !1, a)
};
g.Yb = function (a, b) {
return new dc(this.wa, a, this.La, !1, b)
};
g.$b = function (a, b) {
return new dc(this.wa, a, this.La, !0, b)
};
g.sf = function (a) {
return new dc(this.wa, null, this.La, !0, a)
};
function dc(a, b, c, d, e) {
this.Ud = e || null;
this.Fe = d;
this.Pa = [];
for (e = 1; !a.e();)
if (e = b ? c(a.key, b) : 1, d && (e *= -1), 0 > e) a = this.Fe ? a.left : a.right;
else if (0 === e) {
this.Pa.push(a);
break
} else this.Pa.push(a), a = this.Fe ? a.right : a.left
}
function J(a) {
if (0 === a.Pa.length) return null;
var b = a.Pa.pop(),
c;
c = a.Ud ? a.Ud(b.key, b.value) : {
key: b.key,
value: b.value
};
if (a.Fe)
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.Ud ? a.Ud(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
}
g = fc.prototype;
g.Y = 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)
};
g.count = function () {
return this.left.count() + 1 + this.right.count()
};
g.e = function () {
return !1
};
g.ia = function (a) {
return this.left.ia(a) || a(this.key, this.value) || this.right.ia(a)
};
function gc(a) {
return a.left.e() ? a : gc(a.left)
}
g.Sc = function () {
return gc(this).key
};
g.fc = function () {
return this.right.e() ? this.key : this.right.fc()
};
g.Oa = function (a, b, c) {
var d, e;
e = this;
d = c(a, e.key);
e = 0 > d ? e.Y(null, null, null, e.left.Oa(a, b, c), null) : 0 === d ? e.Y(null, b, null, null, null) : e.Y(null, null, null, null, e.right.Oa(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.Y(null, null, null, ic(a.left), null);
return hc(a)
}
g.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.Y(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.Y(d.key, d.value, null, null, ic(c.right))
}
c = c.Y(null, null, null, null, c.right.remove(a, b))
}
return hc(c)
};
g.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.Y(null, null, null, null, kc(a.right)), a = mc(a), a = lc(a));
return a
}
function mc(a) {
return a.right.Y(null, null, a.color, a.Y(null, null, !0, null, a.right.left), null)
}
function kc(a) {
return a.left.Y(null, null, a.color, null, a.Y(null, null, !0, a.left.right, null))
}
function lc(a) {
return a.Y(null, null, !a.color, a.left.Y(null, null, !a.left.color, null, null), a.right.Y(null, null, !a.right.color, null, null))
}
function nc() {}
g = nc.prototype;
g.Y = function () {
return this
};
g.Oa = function (a, b) {
return new fc(a, b, null)
};
g.remove = function () {
return this
};
g.count = function () {
return 0
};
g.e = function () {
return !0
};
g.ia = function () {
return !1
};
g.Sc = function () {
return null
};
g.fc = function () {
return null
};
g.fa = function () {
return !1
};
var bc = new nc;
function oc(a, b) {
return a && "object" === typeof a ? (K(".sv" in a, "Unexpected leaf node or priority contents"), b[a[".sv"]]) : a
}
function pc(a, b) {
var c = new qc;
rc(a, new L(""), function (a, e) {
c.nc(a, sc(e, b))
});
return c
}
function sc(a, b) {
var c = a.C().I(),
c = oc(c, b),
d;
if (a.K()) {
var e = oc(a.Ca(), b);
return e !== a.Ca() || c !== a.C().I() ? new tc(e, M(c)) : a
}
d = a;
c !== a.C().I() && (d = d.ga(new tc(c)));
a.P(N, function (a, c) {
var e = sc(c, b);
e !== c && (d = d.U(a, e))
});
return d
};
function uc() {
this.wc = {}
}
uc.prototype.set = function (a, b) {
null == b ? delete this.wc[a] : this.wc[a] = b
};
uc.prototype.get = function (a) {
return v(this.wc, a) ? this.wc[a] : null
};
uc.prototype.remove = function (a) {
delete this.wc[a]
};
uc.prototype.wf = !0;
function vc(a) {
this.Fc = a;
this.Pd = "firebase:"
}
g = vc.prototype;
g.set = function (a, b) {
null == b ? this.Fc.removeItem(this.Pd + a) : this.Fc.setItem(this.Pd + a, B(b))
};
g.get = function (a) {
a = this.Fc.getItem(this.Pd + a);
return null == a ? null : nb(a)
};
g.remove = function (a) {
this.Fc.removeItem(this.Pd + a)
};
g.wf = !1;
g.toString = function () {
return this.Fc.toString()
};
function wc(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 vc(b)
}
} catch (c) {}
return new uc
}
var xc = wc("localStorage"),
yc = wc("sessionStorage");
function zc(a, b, c, d, e) {
this.host = a.toLowerCase();
this.domain = this.host.substr(this.host.indexOf(".") + 1);
this.kb = b;
this.hc = c;
this.Wg = d;
this.Od = e || "";
this.Ya = xc.get("host:" + a) || this.host
}
function Ac(a, b) {
b !== a.Ya && (a.Ya = b, "s-" === a.Ya.substr(0, 2) && xc.set("host:" + a.host, a.Ya))
}
function Bc(a, b, c) {
K("string" === typeof b, "typeof type must == string");
K("object" === typeof c, "typeof params must == object");
if (b === Cc) b = (a.kb ? "wss://" : "ws://") + a.Ya + "/.ws?";
else if (b === Dc) b = (a.kb ? "https://" : "http://") + a.Ya + "/.lp?";
else throw Error("Unknown connection type: " + b);
a.host !== a.Ya && (c.ns = a.hc);
var d = [];
r(c, function (a, b) {
d.push(b + "=" + a)
});
return b + d.join("&")
}
zc.prototype.toString = function () {
var a = (this.kb ? "https://" : "http://") + this.host;
this.Od && (a += "<" + this.Od + ">");
return a
};
var Ec = function () {
var a = 1;
return function () {
return a++
}
}();
function K(a, b) {
if (!a) throw Fc(b);
}
function Fc(a) {
return Error("Firebase (" + hb + ") INTERNAL ASSERT FAILED: " + a)
}
function Gc(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++)],
h = 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 == h || null == k || null == l) throw Error();
d.push(f << 2 | h >> 4);
64 != k && (d.push(h << 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) {
Cb("base64Decode failed: ", m)
}
return null
}
function Hc(a) {
var b = Ic(a);
a = new La;
a.update(b);
var b = [],
c = 8 * a.de;
56 > a.ac ? a.update(a.Ld, 56 - a.ac) : a.update(a.Ld, a.Va - (a.ac - 56));
for (var d = a.Va - 1; 56 <= d; d--) a.me[d] = c & 255, c /= 256;
Ma(a, a.me);
for (d = c = 0; 5 > d; d++)
for (var e = 24; 0 <= e; e -= 8) b[c] = a.N[d] >> e & 255, ++c;
return fb(b)
}
function Jc(a) {
for (var b = "", c = 0; c < arguments.length; c++) b = fa(arguments[c]) ? b + Jc.apply(null, arguments[c]) : "object" === typeof arguments[c] ? b + B(arguments[c]) : b + arguments[c], b += " ";
return b
}
var Bb = null,
Kc = !0;
function Cb(a) {
!0 === Kc && (Kc = !1, null === Bb && !0 === yc.get("logging_enabled") && Lc(!0));
if (Bb) {
var b = Jc.apply(null, arguments);
Bb(b)
}
}
function Mc(a) {
return function () {
Cb(a, arguments)
}
}
function Nc(a) {
if ("undefined" !== typeof console) {
var b = "FIREBASE INTERNAL ERROR: " + Jc.apply(null, arguments);
"undefined" !== typeof console.error ? console.error(b) : console.log(b)
}
}
function Oc(a) {
var b = Jc.apply(null, arguments);
throw Error("FIREBASE FATAL ERROR: " + b);
}
function O(a) {
if ("undefined" !== typeof console) {
var b = "FIREBASE WARNING: " + Jc.apply(null, arguments);
"undefined" !== typeof console.warn ? console.warn(b) : console.log(b)
}
}
function Pc(a) {
var b = "",
c = "",
d = "",
e = "",
f = !0,
h = "https",
k = 443;
if (p(a)) {
var l = a.indexOf("//");
0 <= l && (h = 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 (t) {}
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" === h || "wss" === h, 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,
Tg: d,
kb: f,
scheme: h,
$c: e
}
}
function Qc(a) {
return ga(a) && (a != a || a == Number.POSITIVE_INFINITY || a == Number.NEGATIVE_INFINITY)
}
function Rc(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 Vb(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 = Sc(a),
d = Sc(b);
return null !== c ? null !== d ? 0 == c - d ? a.length - b.length : c - d : -1 : null !== d ? 1 : a < b ? -1 : 1
}
function Tc(a, b) {
if (b && a in b) return b[a];
throw Error("Missing required key (" + a + ") in object: " + B(b));
}
function Uc(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 += Uc(a[b[d]]);
return c + "}"
}
function Vc(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 Wc(a, b) {
if (ea(a))
for (var c = 0; c < a.length; ++c) b(c, a[c]);
else r(a, b)
}
function Xc(a) {
K(!Qc(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 Yc = /^-?\d{1,10}$/;
function Sc(a) {
return Yc.test(a) && (a = Number(a), -2147483648 <= a && 2147483647 >= a) ? a : null
}
function Db(a) {
try {
a()
} catch (b) {
setTimeout(function () {
O("Exception was thrown by user callback.", b.stack || "");
throw b;
}, Math.floor(0))
}
}
function P(a, b) {
if (ha(a)) {
var c = Array.prototype.slice.call(arguments, 1).slice();
Db(function () {
a.apply(null, c)
})
}
};
function Ic(a) {
for (var b = [], c = 0, d = 0; d < a.length; d++) {
var e = a.charCodeAt(d);
55296 <= e && 56319 >= e && (e -= 55296, d++, K(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 Zc(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 $c(a) {
var b = {},
c = {},
d = {},
e = "";
try {
var f = a.split("."),
b = nb(Gc(f[0]) || ""),
c = nb(Gc(f[1]) || ""),
e = f[2],
d = c.d || {};
delete c.d
} catch (h) {}
return {
Zg: b,
Bc: c,
data: d,
Qg: e
}
}
function ad(a) {
a = $c(a).Bc;
return "object" === typeof a && a.hasOwnProperty("iat") ? w(a, "iat") : null
}
function bd(a) {
a = $c(a);
var b = a.Bc;
return !!a.Qg && !!b && "object" === typeof b && b.hasOwnProperty("iat")
};
function cd(a) {
this.W = a;
this.g = a.n.g
}
function dd(a, b, c, d) {
var e = [],
f = [];
Oa(b, function (b) {
"child_changed" === b.type && a.g.Ad(b.Ke, b.Ja) && f.push(new D("child_moved", b.Ja, b.Wa))
});
ed(a, e, "child_removed", b, d, c);
ed(a, e, "child_added", b, d, c);
ed(a, e, "child_moved", f, d, c);
ed(a, e, "child_changed", b, d, c);
ed(a, e, Fb, b, d, c);
return e
}
function ed(a, b, c, d, e, f) {
d = Pa(d, function (a) {
return a.type === c
});
Xa(d, q(a.hg, a));
Oa(d, function (c) {
var d = fd(a, c, f);
Oa(e, function (e) {
e.Kf(c.type) && b.push(e.createEvent(d, a.W))
})
})
}
function fd(a, b, c) {
"value" !== b.type && "child_removed" !== b.type && (b.Qd = c.rf(b.Wa, b.Ja, a.g));
return b
}
cd.prototype.hg = function (a, b) {
if (null == a.Wa || null == b.Wa) throw Fc("Should only compare child_ events.");
return this.g.compare(new F(a.Wa, a.Ja), new F(b.Wa, b.Ja))
};
function gd() {
this.bb = {}
}
function hd(a, b) {
var c = b.type,
d = b.Wa;
K("child_added" == c || "child_changed" == c || "child_removed" == c, "Only child changes supported for tracking");
K(".priority" !== d, "Only non-priority child changes can be tracked.");
var e = w(a.bb, d);
if (e) {
var f = e.type;
if ("child_added" == c && "child_removed" == f) a.bb[d] = new D("child_changed", b.Ja, d, e.Ja);
else if ("child_removed" == c && "child_added" == f) delete a.bb[d];
else if ("child_removed" == c && "child_changed" == f) a.bb[d] = new D("child_removed", e.Ke, d);
else if ("child_changed" == c &&
"child_added" == f) a.bb[d] = new D("child_added", b.Ja, d);
else if ("child_changed" == c && "child_changed" == f) a.bb[d] = new D("child_changed", b.Ja, d, e.Ke);
else throw Fc("Illegal combination of changes: " + b + " occurred after " + e);
} else a.bb[d] = b
};
function id(a, b, c) {
this.Rb = a;
this.pb = b;
this.rb = c || null
}
g = id.prototype;
g.Kf = function (a) {
return "value" === a
};
g.createEvent = function (a, b) {
var c = b.n.g;
return new Gb("value", this, new Q(a.Ja, b.Ib(), c))
};
g.Vb = function (a) {
var b = this.rb;
if ("cancel" === a.ze()) {
K(this.pb, "Raising a cancel event on a listener with no cancel callback");
var c = this.pb;
return function () {
c.call(b, a.error)
}
}
var d = this.Rb;
return function () {
d.call(b, a.Zd)
}
};
g.gf = function (a, b) {
return this.pb ? new Hb(this, a, b) : null
};
g.matches = function (a) {
return a instanceof id ? a.Rb && this.Rb ? a.Rb === this.Rb && a.rb === this.rb : !0 : !1
};
g.tf = function () {
return null !== this.Rb
};
function jd(a, b, c) {
this.ha = a;
this.pb = b;
this.rb = c
}
g = jd.prototype;
g.Kf = function (a) {
a = "children_added" === a ? "child_added" : a;
return ("children_removed" === a ? "child_removed" : a) in this.ha
};
g.gf = function (a, b) {
return this.pb ? new Hb(this, a, b) : null
};
g.createEvent = function (a, b) {
K(null != a.Wa, "Child events should have a childName.");
var c = b.Ib().u(a.Wa);
return new Gb(a.type, this, new Q(a.Ja, c, b.n.g), a.Qd)
};
g.Vb = function (a) {
var b = this.rb;
if ("cancel" === a.ze()) {
K(this.pb, "Raising a cancel event on a listener with no cancel callback");
var c = this.pb;
return function () {
c.call(b, a.error)
}
}
var d = this.ha[a.ud];
return function () {
d.call(b, a.Zd, a.Qd)
}
};
g.matches = function (a) {
if (a instanceof jd) {
if (!this.ha || !a.ha) return !0;
if (this.rb === a.rb) {
var b = pa(a.ha);
if (b === pa(this.ha)) {
if (1 === b) {
var b = qa(a.ha),
c = qa(this.ha);
return c === b && (!a.ha[b] || !this.ha[c] || a.ha[b] === this.ha[c])
}
return oa(this.ha, function (b, c) {
return a.ha[c] === b
})
}
}
}
return !1
};
g.tf = function () {
return null !== this.ha
};
function kd(a) {
this.g = a
}
g = kd.prototype;
g.G = function (a, b, c, d, e, f) {
K(a.Jc(this.g), "A node must be indexed if only a child is updated");
e = a.R(b);
if (e.Q(d).ca(c.Q(d)) && e.e() == c.e()) return a;
null != f && (c.e() ? a.Da(b) ? hd(f, new D("child_removed", e, b)) : K(a.K(), "A child remove without an old child only makes sense on a leaf node") : e.e() ? hd(f, new D("child_added", c, b)) : hd(f, new D("child_changed", c, b, e)));
return a.K() && c.e() ? a : a.U(b, c).lb(this.g)
};
g.xa = function (a, b, c) {
null != c && (a.K() || a.P(N, function (a, e) {
b.Da(a) || hd(c, new D("child_removed", e, a))
}), b.K() || b.P(N, function (b, e) {
if (a.Da(b)) {
var f = a.R(b);
f.ca(e) || hd(c, new D("child_changed", e, b, f))
} else hd(c, new D("child_added", e, b))
}));
return b.lb(this.g)
};
g.ga = function (a, b) {
return a.e() ? C : a.ga(b)
};
g.Na = function () {
return !1
};
g.Wb = function () {
return this
};
function ld(a) {
this.Be = new kd(a.g);
this.g = a.g;
var b;
a.ma ? (b = md(a), b = a.g.Pc(nd(a), b)) : b = a.g.Tc();
this.ed = b;
a.pa ? (b = od(a), a = a.g.Pc(pd(a), b)) : a = a.g.Qc();
this.Gc = a
}
g = ld.prototype;
g.matches = function (a) {
return 0 >= this.g.compare(this.ed, a) && 0 >= this.g.compare(a, this.Gc)
};
g.G = function (a, b, c, d, e, f) {
this.matches(new F(b, c)) || (c = C);
return this.Be.G(a, b, c, d, e, f)
};
g.xa = function (a, b, c) {
b.K() && (b = C);
var d = b.lb(this.g),
d = d.ga(C),
e = this;
b.P(N, function (a, b) {
e.matches(new F(a, b)) || (d = d.U(a, C))
});
return this.Be.xa(a, d, c)
};
g.ga = function (a) {
return a
};
g.Na = function () {
return !0
};
g.Wb = function () {
return this.Be
};
function qd(a) {
this.sa = new ld(a);
this.g = a.g;
K(a.ja, "Only valid if limit has been set");
this.ka = a.ka;
this.Jb = !rd(a)
}
g = qd.prototype;
g.G = function (a, b, c, d, e, f) {
this.sa.matches(new F(b, c)) || (c = C);
return a.R(b).ca(c) ? a : a.Db() < this.ka ? this.sa.Wb().G(a, b, c, d, e, f) : sd(this, a, b, c, e, f)
};
g.xa = function (a, b, c) {
var d;
if (b.K() || b.e()) d = C.lb(this.g);
else if (2 * this.ka < b.Db() && b.Jc(this.g)) {
d = C.lb(this.g);
b = this.Jb ? b.$b(this.sa.Gc, this.g) : b.Yb(this.sa.ed, this.g);
for (var e = 0; 0 < b.Pa.length && e < this.ka;) {
var f = J(b),
h;
if (h = this.Jb ? 0 >= this.g.compare(this.sa.ed, f) : 0 >= this.g.compare(f, this.sa.Gc)) d = d.U(f.name, f.S), e++;
else break
}
} else {
d = b.lb(this.g);
d = d.ga(C);
var k, l, m;
if (this.Jb) {
b = d.sf(this.g);
k = this.sa.Gc;
l = this.sa.ed;
var t = td(this.g);
m = function (a, b) {
return t(b, a)
}
} else b = d.Xb(this.g), k = this.sa.ed,
l = this.sa.Gc, m = td(this.g);
for (var e = 0, z = !1; 0 < b.Pa.length;) f = J(b), !z && 0 >= m(k, f) && (z = !0), (h = z && e < this.ka && 0 >= m(f, l)) ? e++ : d = d.U(f.name, C)
}
return this.sa.Wb().xa(a, d, c)
};
g.ga = function (a) {
return a
};
g.Na = function () {
return !0
};
g.Wb = function () {
return this.sa.Wb()
};
function sd(a, b, c, d, e, f) {
var h;
if (a.Jb) {
var k = td(a.g);
h = function (a, b) {
return k(b, a)
}
} else h = td(a.g);
K(b.Db() == a.ka, "");
var l = new F(c, d),
m = a.Jb ? ud(b, a.g) : vd(b, a.g),
t = a.sa.matches(l);
if (b.Da(c)) {
for (var z = b.R(c), m = e.ye(a.g, m, a.Jb); null != m && (m.name == c || b.Da(m.name));) m = e.ye(a.g, m, a.Jb);
e = null == m ? 1 : h(m, l);
if (t && !d.e() && 0 <= e) return null != f && hd(f, new D("child_changed", d, c, z)), b.U(c, d);
null != f && hd(f, new D("child_removed", z, c));
b = b.U(c, C);
return null != m && a.sa.matches(m) ? (null != f && hd(f, new D("child_added",
m.S, m.name)), b.U(m.name, m.S)) : b
}
return d.e() ? b : t && 0 <= h(m, l) ? (null != f && (hd(f, new D("child_removed", m.S, m.name)), hd(f, new D("child_added", d, c))), b.U(c, d).U(m.name, C)) : b
};
function wd(a, b) {
this.je = a;
this.fg = b
}
function xd(a) {
this.V = a
}
xd.prototype.ab = function (a, b, c, d) {
var e = new gd,
f;
if (b.type === Yb) b.source.we ? c = yd(this, a, b.path, b.Ga, c, d, e) : (K(b.source.pf, "Unknown source."), f = b.source.af || Jb(a.w()) && !b.path.e(), c = Ad(this, a, b.path, b.Ga, c, d, f, e));
else if (b.type === Bd) b.source.we ? c = Cd(this, a, b.path, b.children, c, d, e) : (K(b.source.pf, "Unknown source."), f = b.source.af || Jb(a.w()), c = Dd(this, a, b.path, b.children, c, d, f, e));
else if (b.type === Ed)
if (b.Vd)
if (b = b.path, null != c.tc(b)) c = a;
else {
f = new rb(c, a, d);
d = a.O.j();
if (b.e() || ".priority" === E(b)) Ib(a.w()) ?
b = c.za(ub(a)) : (b = a.w().j(), K(b instanceof R, "serverChildren would be complete if leaf node"), b = c.yc(b)), b = this.V.xa(d, b, e);
else {
var h = E(b),
k = c.xc(h, a.w());
null == k && sb(a.w(), h) && (k = d.R(h));
b = null != k ? this.V.G(d, h, k, H(b), f, e) : a.O.j().Da(h) ? this.V.G(d, h, C, H(b), f, e) : d;
b.e() && Ib(a.w()) && (d = c.za(ub(a)), d.K() && (b = this.V.xa(b, d, e)))
}
d = Ib(a.w()) || null != c.tc(G);
c = Fd(a, b, d, this.V.Na())
} else c = Gd(this, a, b.path, b.Qb, c, d, e);
else if (b.type === $b) d = b.path, b = a.w(), f = b.j(), h = b.ea || d.e(), c = Hd(this, new Id(a.O, new tb(f,
h, b.Ub)), d, c, qb, e);
else throw Fc("Unknown operation type: " + b.type);
e = ra(e.bb);
d = c;
b = d.O;
b.ea && (f = b.j().K() || b.j().e(), h = Jd(a), (0 < e.length || !a.O.ea || f && !b.j().ca(h) || !b.j().C().ca(h.C())) && e.push(Eb(Jd(d))));
return new wd(c, e)
};
function Hd(a, b, c, d, e, f) {
var h = b.O;
if (null != d.tc(c)) return b;
var k;
if (c.e()) K(Ib(b.w()), "If change path is empty, we must have complete server data"), Jb(b.w()) ? (e = ub(b), d = d.yc(e instanceof R ? e : C)) : d = d.za(ub(b)), f = a.V.xa(b.O.j(), d, f);
else {
var l = E(c);
if (".priority" == l) K(1 == Kd(c), "Can't have a priority with additional path components"), f = h.j(), k = b.w().j(), d = d.ld(c, f, k), f = null != d ? a.V.ga(f, d) : h.j();
else {
var m = H(c);
sb(h, l) ? (k = b.w().j(), d = d.ld(c, h.j(), k), d = null != d ? h.j().R(l).G(m, d) : h.j().R(l)) : d = d.xc(l,
b.w());
f = null != d ? a.V.G(h.j(), l, d, m, e, f) : h.j()
}
}
return Fd(b, f, h.ea || c.e(), a.V.Na())
}
function Ad(a, b, c, d, e, f, h, k) {
var l = b.w();
h = h ? a.V : a.V.Wb();
if (c.e()) d = h.xa(l.j(), d, null);
else if (h.Na() && !l.Ub) d = l.j().G(c, d), d = h.xa(l.j(), d, null);
else {
var m = E(c);
if (!Kb(l, c) && 1 < Kd(c)) return b;
var t = H(c);
d = l.j().R(m).G(t, d);
d = ".priority" == m ? h.ga(l.j(), d) : h.G(l.j(), m, d, t, qb, null)
}
l = l.ea || c.e();
b = new Id(b.O, new tb(d, l, h.Na()));
return Hd(a, b, c, e, new rb(e, b, f), k)
}
function yd(a, b, c, d, e, f, h) {
var k = b.O;
e = new rb(e, b, f);
if (c.e()) h = a.V.xa(b.O.j(), d, h), a = Fd(b, h, !0, a.V.Na());
else if (f = E(c), ".priority" === f) h = a.V.ga(b.O.j(), d), a = Fd(b, h, k.ea, k.Ub);
else {
c = H(c);
var l = k.j().R(f);
if (!c.e()) {
var m = e.qf(f);
d = null != m ? ".priority" === Ld(c) && m.Q(c.parent()).e() ? m : m.G(c, d) : C
}
l.ca(d) ? a = b : (h = a.V.G(k.j(), f, d, c, e, h), a = Fd(b, h, k.ea, a.V.Na()))
}
return a
}
function Cd(a, b, c, d, e, f, h) {
var k = b;
Md(d, function (d, m) {
var t = c.u(d);
sb(b.O, E(t)) && (k = yd(a, k, t, m, e, f, h))
});
Md(d, function (d, m) {
var t = c.u(d);
sb(b.O, E(t)) || (k = yd(a, k, t, m, e, f, h))
});
return k
}
function Nd(a, b) {
Md(b, function (b, d) {
a = a.G(b, d)
});
return a
}
function Dd(a, b, c, d, e, f, h, k) {
if (b.w().j().e() && !Ib(b.w())) return b;
var l = b;
c = c.e() ? d : Od(Pd, c, d);
var m = b.w().j();
c.children.ia(function (c, d) {
if (m.Da(c)) {
var I = b.w().j().R(c),
I = Nd(I, d);
l = Ad(a, l, new L(c), I, e, f, h, k)
}
});
c.children.ia(function (c, d) {
var I = !sb(b.w(), c) && null == d.value;
m.Da(c) || I || (I = b.w().j().R(c), I = Nd(I, d), l = Ad(a, l, new L(c), I, e, f, h, k))
});
return l
}
function Gd(a, b, c, d, e, f, h) {
if (null != e.tc(c)) return b;
var k = Jb(b.w()),
l = b.w();
if (null != d.value) {
if (c.e() && l.ea || Kb(l, c)) return Ad(a, b, c, l.j().Q(c), e, f, k, h);
if (c.e()) {
var m = Pd;
l.j().P(Qd, function (a, b) {
m = m.set(new L(a), b)
});
return Dd(a, b, c, m, e, f, k, h)
}
return b
}
m = Pd;
Md(d, function (a) {
var b = c.u(a);
Kb(l, b) && (m = m.set(a, l.j().Q(b)))
});
return Dd(a, b, c, m, e, f, k, h)
};
function Rd() {}
var Sd = {};
function td(a) {
return q(a.compare, a)
}
Rd.prototype.Ad = function (a, b) {
return 0 !== this.compare(new F("[MIN_NAME]", a), new F("[MIN_NAME]", b))
};
Rd.prototype.Tc = function () {
return Td
};
function Ud(a) {
K(!a.e() && ".priority" !== E(a), "Can't create PathIndex with empty path or .priority key");
this.cc = a
}
ma(Ud, Rd);
g = Ud.prototype;
g.Ic = function (a) {
return !a.Q(this.cc).e()
};
g.compare = function (a, b) {
var c = a.S.Q(this.cc),
d = b.S.Q(this.cc),
c = c.Dc(d);
return 0 === c ? Vb(a.name, b.name) : c
};
g.Pc = function (a, b) {
var c = M(a),
c = C.G(this.cc, c);
return new F(b, c)
};
g.Qc = function () {
var a = C.G(this.cc, Vd);
return new F("[MAX_NAME]", a)
};
g.toString = function () {
return this.cc.slice().join("/")
};
function Wd() {}
ma(Wd, Rd);
g = Wd.prototype;
g.compare = function (a, b) {
var c = a.S.C(),
d = b.S.C(),
c = c.Dc(d);
return 0 === c ? Vb(a.name, b.name) : c
};
g.Ic = function (a) {
return !a.C().e()
};
g.Ad = function (a, b) {
return !a.C().ca(b.C())
};
g.Tc = function () {
return Td
};
g.Qc = function () {
return new F("[MAX_NAME]", new tc("[PRIORITY-POST]", Vd))
};
g.Pc = function (a, b) {
var c = M(a);
return new F(b, new tc("[PRIORITY-POST]", c))
};
g.toString = function () {
return ".priority"
};
var N = new Wd;
function Xd() {}
ma(Xd, Rd);
g = Xd.prototype;
g.compare = function (a, b) {
return Vb(a.name, b.name)
};
g.Ic = function () {
throw Fc("KeyIndex.isDefinedOn not expected to be called.");
};
g.Ad = function () {
return !1
};
g.Tc = function () {
return Td
};
g.Qc = function () {
return new F("[MAX_NAME]", C)
};
g.Pc = function (a) {
K(p(a), "KeyIndex indexValue must always be a string.");
return new F(a, C)
};
g.toString = function () {
return ".key"
};
var Qd = new Xd;
function Yd() {}
ma(Yd, Rd);
g = Yd.prototype;
g.compare = function (a, b) {
var c = a.S.Dc(b.S);
return 0 === c ? Vb(a.name, b.name) : c
};
g.Ic = function () {
return !0
};
g.Ad = function (a, b) {
return !a.ca(b)
};
g.Tc = function () {
return Td
};
g.Qc = function () {
return Zd
};
g.Pc = function (a, b) {
var c = M(a);
return new F(b, c)
};
g.toString = function () {
return ".value"
};
var $d = new Yd;
function ae() {
this.Tb = this.pa = this.Lb = this.ma = this.ja = !1;
this.ka = 0;
this.Nb = "";
this.ec = null;
this.xb = "";
this.bc = null;
this.vb = "";
this.g = N
}
var be = new ae;
function rd(a) {
return "" === a.Nb ? a.ma : "l" === a.Nb
}
function nd(a) {
K(a.ma, "Only valid if start has been set");
return a.ec
}
function md(a) {
K(a.ma, "Only valid if start has been set");
return a.Lb ? a.xb : "[MIN_NAME]"
}
function pd(a) {
K(a.pa, "Only valid if end has been set");
return a.bc
}
function od(a) {
K(a.pa, "Only valid if end has been set");
return a.Tb ? a.vb : "[MAX_NAME]"
}
function ce(a) {
var b = new ae;
b.ja = a.ja;
b.ka = a.ka;
b.ma = a.ma;
b.ec = a.ec;
b.Lb = a.Lb;
b.xb = a.xb;
b.pa = a.pa;
b.bc = a.bc;
b.Tb = a.Tb;
b.vb = a.vb;
b.g = a.g;
return b
}
g = ae.prototype;
g.He = function (a) {
var b = ce(this);
b.ja = !0;
b.ka = a;
b.Nb = "";
return b
};
g.Ie = function (a) {
var b = ce(this);
b.ja = !0;
b.ka = a;
b.Nb = "l";
return b
};
g.Je = function (a) {
var b = ce(this);
b.ja = !0;
b.ka = a;
b.Nb = "r";
return b
};
g.$d = function (a, b) {
var c = ce(this);
c.ma = !0;
n(a) || (a = null);
c.ec = a;
null != b ? (c.Lb = !0, c.xb = b) : (c.Lb = !1, c.xb = "");
return c
};
g.td = function (a, b) {
var c = ce(this);
c.pa = !0;
n(a) || (a = null);
c.bc = a;
n(b) ? (c.Tb = !0, c.vb = b) : (c.ah = !1, c.vb = "");
return c
};
function de(a, b) {
var c = ce(a);
c.g = b;
return c
}
function ee(a) {
var b = {};
a.ma && (b.sp = a.ec, a.Lb && (b.sn = a.xb));
a.pa && (b.ep = a.bc, a.Tb && (b.en = a.vb));
if (a.ja) {
b.l = a.ka;
var c = a.Nb;
"" === c && (c = rd(a) ? "l" : "r");
b.vf = c
}
a.g !== N && (b.i = a.g.toString());
return b
}
function S(a) {
return !(a.ma || a.pa || a.ja)
}
function fe(a) {
return S(a) && a.g == N
}
function ge(a) {
var b = {};
if (fe(a)) return b;
var c;
a.g === N ? c = "$priority" : a.g === $d ? c = "$value" : a.g === Qd ? c = "$key" : (K(a.g instanceof Ud, "Unrecognized index type!"), c = a.g.toString());
b.orderBy = B(c);
a.ma && (b.startAt = B(a.ec), a.Lb && (b.startAt += "," + B(a.xb)));
a.pa && (b.endAt = B(a.bc), a.Tb && (b.endAt += "," + B(a.vb)));
a.ja && (rd(a) ? b.limitToFirst = a.ka : b.limitToLast = a.ka);
return b
}
g.toString = function () {
return B(ee(this))
};
function he(a, b) {
this.Bd = a;
this.dc = b
}
he.prototype.get = function (a) {
var b = w(this.Bd, a);
if (!b) throw Error("No index defined for " + a);
return b === Sd ? null : b
};
function ie(a, b, c) {
var d = na(a.Bd, function (d, f) {
var h = w(a.dc, f);
K(h, "Missing index implementation for " + f);
if (d === Sd) {
if (h.Ic(b.S)) {
for (var k = [], l = c.Xb(Tb), m = J(l); m;) m.name != b.name && k.push(m), m = J(l);
k.push(b);
return je(k, td(h))
}
return Sd
}
h = c.get(b.name);
k = d;
h && (k = k.remove(new F(b.name, h)));
return k.Oa(b, b.S)
});
return new he(d, a.dc)
}
function ke(a, b, c) {
var d = na(a.Bd, function (a) {
if (a === Sd) return a;
var d = c.get(b.name);
return d ? a.remove(new F(b.name, d)) : a
});
return new he(d, a.dc)
}
var le = new he({
".priority": Sd
}, {
".priority": N
});
function tc(a, b) {
this.B = a;
K(n(this.B) && null !== this.B, "LeafNode shouldn't be created with null/undefined value.");
this.aa = b || C;
me(this.aa);
this.Cb = null
}
var ne = ["object", "boolean", "number", "string"];
g = tc.prototype;
g.K = function () {
return !0
};
g.C = function () {
return this.aa
};
g.ga = function (a) {
return new tc(this.B, a)
};
g.R = function (a) {
return ".priority" === a ? this.aa : C
};
g.Q = function (a) {
return a.e() ? this : ".priority" === E(a) ? this.aa : C
};
g.Da = function () {
return !1
};
g.rf = function () {
return null
};
g.U = function (a, b) {
return ".priority" === a ? this.ga(b) : b.e() && ".priority" !== a ? this : C.U(a, b).ga(this.aa)
};
g.G = function (a, b) {
var c = E(a);
if (null === c) return b;
if (b.e() && ".priority" !== c) return this;
K(".priority" !== c || 1 === Kd(a), ".priority must be the last token in a path");
return this.U(c, C.G(H(a), b))
};
g.e = function () {
return !1
};
g.Db = function () {
return 0
};
g.P = function () {
return !1
};
g.I = function (a) {
return a && !this.C().e() ? {
".value": this.Ca(),
".priority": this.C().I()
} : this.Ca()
};
g.hash = function () {
if (null === this.Cb) {
var a = "";
this.aa.e() || (a += "priority:" + oe(this.aa.I()) + ":");
var b = typeof this.B,
a = a + (b + ":"),
a = "number" === b ? a + Xc(this.B) : a + this.B;
this.Cb = Hc(a)
}
return this.Cb
};
g.Ca = function () {
return this.B
};
g.Dc = function (a) {
if (a === C) return 1;
if (a instanceof R) return -1;
K(a.K(), "Unknown node type");
var b = typeof a.B,
c = typeof this.B,
d = Na(ne, b),
e = Na(ne, c);
K(0 <= d, "Unknown leaf type: " + b);
K(0 <= e, "Unknown leaf type: " + c);
return d === e ? "object" === c ? 0 : this.B < a.B ? -1 : this.B === a.B ? 0 : 1 : e - d
};
g.lb = function () {
return this
};
g.Jc = function () {
return !0
};
g.ca = function (a) {
return a === this ? !0 : a.K() ? this.B === a.B && this.aa.ca(a.aa) : !1
};
g.toString = function () {
return B(this.I(!0))
};
function R(a, b, c) {
this.m = a;
(this.aa = b) && me(this.aa);
a.e() && K(!this.aa || this.aa.e(), "An empty node cannot have a priority");
this.wb = c;
this.Cb = null
}
g = R.prototype;
g.K = function () {
return !1
};
g.C = function () {
return this.aa || C
};
g.ga = function (a) {
return this.m.e() ? this : new R(this.m, a, this.wb)
};
g.R = function (a) {
if (".priority" === a) return this.C();
a = this.m.get(a);
return null === a ? C : a
};
g.Q = function (a) {
var b = E(a);
return null === b ? this : this.R(b).Q(H(a))
};
g.Da = function (a) {
return null !== this.m.get(a)
};
g.U = function (a, b) {
K(b, "We should always be passing snapshot nodes");
if (".priority" === a) return this.ga(b);
var c = new F(a, b),
d, e;
b.e() ? (d = this.m.remove(a), c = ke(this.wb, c, this.m)) : (d = this.m.Oa(a, b), c = ie(this.wb, c, this.m));
e = d.e() ? C : this.aa;
return new R(d, e, c)
};
g.G = function (a, b) {
var c = E(a);
if (null === c) return b;
K(".priority" !== E(a) || 1 === Kd(a), ".priority must be the last token in a path");
var d = this.R(c).G(H(a), b);
return this.U(c, d)
};
g.e = function () {
return this.m.e()
};
g.Db = function () {
return this.m.count()
};
var pe = /^(0|[1-9]\d*)$/;
g = R.prototype;
g.I = function (a) {
if (this.e()) return null;
var b = {},
c = 0,
d = 0,
e = !0;
this.P(N, function (f, h) {
b[f] = h.I(a);
c++;
e && pe.test(f) ? d = Math.max(d, Number(f)) : e = !1
});
if (!a && e && d < 2 * c) {
var f = [],
h;
for (h in b) f[h] = b[h];
return f
}
a && !this.C().e() && (b[".priority"] = this.C().I());
return b
};
g.hash = function () {
if (null === this.Cb) {
var a = "";
this.C().e() || (a += "priority:" + oe(this.C().I()) + ":");
this.P(N, function (b, c) {
var d = c.hash();
"" !== d && (a += ":" + b + ":" + d)
});
this.Cb = "" === a ? "" : Hc(a)
}
return this.Cb
};
g.rf = function (a, b, c) {
return (c = qe(this, c)) ? (a = cc(c, new F(a, b))) ? a.name : null : cc(this.m, a)
};
function ud(a, b) {
var c;
c = (c = qe(a, b)) ? (c = c.Sc()) && c.name : a.m.Sc();
return c ? new F(c, a.m.get(c)) : null
}
function vd(a, b) {
var c;
c = (c = qe(a, b)) ? (c = c.fc()) && c.name : a.m.fc();
return c ? new F(c, a.m.get(c)) : null
}
g.P = function (a, b) {
var c = qe(this, a);
return c ? c.ia(function (a) {
return b(a.name, a.S)
}) : this.m.ia(b)
};
g.Xb = function (a) {
return this.Yb(a.Tc(), a)
};
g.Yb = function (a, b) {
var c = qe(this, b);
if (c) return c.Yb(a, function (a) {
return a
});
for (var c = this.m.Yb(a.name, Tb), d = ec(c); null != d && 0 > b.compare(d, a);) J(c), d = ec(c);
return c
};
g.sf = function (a) {
return this.$b(a.Qc(), a)
};
g.$b = function (a, b) {
var c = qe(this, b);
if (c) return c.$b(a, function (a) {
return a
});
for (var c = this.m.$b(a.name, Tb), d = ec(c); null != d && 0 < b.compare(d, a);) J(c), d = ec(c);
return c
};
g.Dc = function (a) {
return this.e() ? a.e() ? 0 : -1 : a.K() || a.e() ? 1 : a === Vd ? -1 : 0
};
g.lb = function (a) {
if (a === Qd || ta(this.wb.dc, a.toString())) return this;
var b = this.wb,
c = this.m;
K(a !== Qd, "KeyIndex always exists and isn't meant to be added to the IndexMap.");
for (var d = [], e = !1, c = c.Xb(Tb), f = J(c); f;) e = e || a.Ic(f.S), d.push(f), f = J(c);
d = e ? je(d, td(a)) : Sd;
e = a.toString();
c = xa(b.dc);
c[e] = a;
a = xa(b.Bd);
a[e] = d;
return new R(this.m, this.aa, new he(a, c))
};
g.Jc = function (a) {
return a === Qd || ta(this.wb.dc, a.toString())
};
g.ca = function (a) {
if (a === this) return !0;
if (a.K()) return !1;
if (this.C().ca(a.C()) && this.m.count() === a.m.count()) {
var b = this.Xb(N);
a = a.Xb(N);
for (var c = J(b), d = J(a); c && d;) {
if (c.name !== d.name || !c.S.ca(d.S)) return !1;
c = J(b);
d = J(a)
}
return null === c && null === d
}
return !1
};
function qe(a, b) {
return b === Qd ? null : a.wb.get(b.toString())
}
g.toString = function () {
return B(this.I(!0))
};
function M(a, b) {
if (null === a) return C;
var c = null;
"object" === typeof a && ".priority" in a ? c = a[".priority"] : "undefined" !== typeof b && (c = b);
K(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, M(c));
if (a instanceof Array) {
var d = C,
e = a;
r(e, function (a, b) {
if (v(e, b) && "." !== b.substring(0, 1)) {
var c = M(a);
if (c.K() || !c.e()) d =
d.U(b, c)
}
});
return d.ga(M(c))
}
var f = [],
h = !1,
k = a;
ib(k, function (a) {
if ("string" !== typeof a || "." !== a.substring(0, 1)) {
var b = M(k[a]);
b.e() || (h = h || !b.C().e(), f.push(new F(a, b)))
}
});
if (0 == f.length) return C;
var l = je(f, Ub, function (a) {
return a.name
}, Wb);
if (h) {
var m = je(f, td(N));
return new R(l, M(c), new he({
".priority": m
}, {
".priority": N
}))
}
return new R(l, M(c), le)
}
var re = Math.log(2);
function se(a) {
this.count = parseInt(Math.log(a + 1) / re, 10);
this.jf = this.count - 1;
this.eg = a + 1 & parseInt(Array(this.count + 1).join("1"), 2)
}
function te(a) {
var b = !(a.eg & 1 << a.jf);
a.jf--;
return b
}
function je(a, b, c, d) {
function e(b, d) {
var f = d - b;
if (0 == f) return null;
if (1 == f) {
var m = a[b],
t = c ? c(m) : m;
return new fc(t, m.S, !1, null, null)
}
var m = parseInt(f / 2, 10) + b,
f = e(b, m),
z = e(m + 1, d),
m = a[m],
t = c ? c(m) : m;
return new fc(t, m.S, !1, f, z)
}
a.sort(b);
var f = function (b) {
function d(b, h) {
var k = t - b,
z = t;
t -= b;
var z = e(k + 1, z),
k = a[k],
I = c ? c(k) : k,
z = new fc(I, k.S, h, null, z);
f ? f.left = z : m = z;
f = z
}
for (var f = null, m = null, t = a.length, z = 0; z < b.count; ++z) {
var I = te(b),
zd = Math.pow(2, b.count - (z + 1));
I ? d(zd, !1) : (d(zd, !1), d(zd, !0))
}
return m
}(new se(a.length));
return null !== f ? new ac(d || b, f) : new ac(d || b)
}
function oe(a) {
return "number" === typeof a ? "number:" + Xc(a) : "string:" + a
}
function me(a) {
if (a.K()) {
var b = a.I();
K("string" === typeof b || "number" === typeof b || "object" === typeof b && v(b, ".sv"), "Priority must be a string or number.")
} else K(a === Vd || a.e(), "priority of unexpected type.");
K(a === Vd || a.C().e(), "Priority nodes can't have a priority of their own.")
}
var C = new R(new ac(Wb), null, le);
function ue() {
R.call(this, new ac(Wb), C, le)
}
ma(ue, R);
g = ue.prototype;
g.Dc = function (a) {
return a === this ? 0 : 1
};
g.ca = function (a) {
return a === this
};
g.C = function () {
return this
};
g.R = function () {
return C
};
g.e = function () {
return !1
};
var Vd = new ue,
Td = new F("[MIN_NAME]", C),
Zd = new F("[MAX_NAME]", Vd);
function Id(a, b) {
this.O = a;
this.Yd = b
}
function Fd(a, b, c, d) {
return new Id(new tb(b, c, d), a.Yd)
}
function Jd(a) {
return a.O.ea ? a.O.j() : null
}
Id.prototype.w = function () {
return this.Yd
};
function ub(a) {
return a.Yd.ea ? a.Yd.j() : null
};
function ve(a, b) {
this.W = a;
var c = a.n,
d = new kd(c.g),
c = S(c) ? new kd(c.g) : c.ja ? new qd(c) : new ld(c);
this.Hf = new xd(c);
var e = b.w(),
f = b.O,
h = d.xa(C, e.j(), null),
k = c.xa(C, f.j(), null);
this.Ka = new Id(new tb(k, f.ea, c.Na()), new tb(h, e.ea, d.Na()));
this.Xa = [];
this.lg = new cd(a)
}
function we(a) {
return a.W
}
g = ve.prototype;
g.w = function () {
return this.Ka.w().j()
};
g.fb = function (a) {
var b = ub(this.Ka);
return b && (S(this.W.n) || !a.e() && !b.R(E(a)).e()) ? b.Q(a) : null
};
g.e = function () {
return 0 === this.Xa.length
};
g.Pb = function (a) {
this.Xa.push(a)
};
g.jb = function (a, b) {
var c = [];
if (b) {
K(null == a, "A cancel should cancel all event registrations.");
var d = this.W.path;
Oa(this.Xa, function (a) {
(a = a.gf(b, d)) && c.push(a)
})
}
if (a) {
for (var e = [], f = 0; f < this.Xa.length; ++f) {
var h = this.Xa[f];
if (!h.matches(a)) e.push(h);
else if (a.tf()) {
e = e.concat(this.Xa.slice(f + 1));
break
}
}
this.Xa = e
} else this.Xa = [];
return c
};
g.ab = function (a, b, c) {
a.type === Bd && null !== a.source.Hb && (K(ub(this.Ka), "We should always have a full cache before handling merges"), K(Jd(this.Ka), "Missing event cache, even though we have a server cache"));
var d = this.Ka;
a = this.Hf.ab(d, a, b, c);
b = this.Hf;
c = a.je;
K(c.O.j().Jc(b.V.g), "Event snap not indexed");
K(c.w().j().Jc(b.V.g), "Server snap not indexed");
K(Ib(a.je.w()) || !Ib(d.w()), "Once a server snap is complete, it should never go back");
this.Ka = a.je;
return xe(this, a.fg, a.je.O.j(), null)
};
function ye(a, b) {
var c = a.Ka.O,
d = [];
c.j().K() || c.j().P(N, function (a, b) {
d.push(new D("child_added", b, a))
});
c.ea && d.push(Eb(c.j()));
return xe(a, d, c.j(), b)
}
function xe(a, b, c, d) {
return dd(a.lg, b, c, d ? [d] : a.Xa)
};
function ze(a, b, c) {
this.type = Bd;
this.source = a;
this.path = b;
this.children = c
}
ze.prototype.Xc = function (a) {
if (this.path.e()) return a = this.children.subtree(new L(a)), a.e() ? null : a.value ? new Xb(this.source, G, a.value) : new ze(this.source, G, a);
K(E(this.path) === a, "Can't get a merge for a child not on the path of the operation");
return new ze(this.source, H(this.path), this.children)
};
ze.prototype.toString = function () {
return "Operation(" + this.path + ": " + this.source.toString() + " merge: " + this.children.toString() + ")"
};
function Ae(a, b) {
this.f = Mc("p:rest:");
this.F = a;
this.Gb = b;
this.Aa = null;
this.$ = {}
}
function Be(a, b) {
if (n(b)) return "tag$" + b;
K(fe(a.n), "should have a tag if it's not a default query.");
return a.path.toString()
}
g = Ae.prototype;
g.yf = function (a, b, c, d) {
var e = a.path.toString();
this.f("Listen called for " + e + " " + a.va());
var f = Be(a, c),
h = {};
this.$[f] = h;
a = ge(a.n);
var k = this;
Ce(this, e + ".json", a, function (a, b) {
var t = b;
404 === a && (a = t = null);
null === a && k.Gb(e, t, !1, c);
w(k.$, f) === h && d(a ? 401 == a ? "permission_denied" : "rest_error:" + a : "ok", null)
})
};
g.Rf = function (a, b) {
var c = Be(a, b);
delete this.$[c]
};
g.M = function (a, b) {
this.Aa = a;
var c = $c(a),
d = c.data,
c = c.Bc && c.Bc.exp;
b && b("ok", {
auth: d,
expires: c
})
};
g.ge = function (a) {
this.Aa = null;
a("ok", null)
};
g.Me = function () {};
g.Cf = function () {};
g.Jd = function () {};
g.put = function () {};
g.zf = function () {};
g.Ue = function () {};
function Ce(a, b, c, d) {
c = c || {};
c.format = "export";
a.Aa && (c.auth = a.Aa);
var e = (a.F.kb ? "https://" : "http://") + a.F.host + b + "?" + kb(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 = nb(f.responseText)
} catch (c) {
O("Failed to parse JSON response for " + e + ": " + f.responseText)
}
d(null, b)
} else 401 !== f.status && 404 !==
f.status && O("Got unsuccessful REST response for " + e + " Status: " + f.status), d(f.status);
d = null
}
};
f.open("GET", e, !0);
f.send()
};
function De(a) {
K(ea(a) && 0 < a.length, "Requires a non-empty array");
this.Xf = a;
this.Oc = {}
}
De.prototype.fe = function (a, b) {
var c;
c = this.Oc[a] || [];
var d = c.length;
if (0 < d) {
for (var e = Array(d), f = 0; f < d; f++) e[f] = c[f];
c = e
} else c = [];
for (d = 0; d < c.length; d++) c[d].zc.apply(c[d].Ma, Array.prototype.slice.call(arguments, 1))
};
De.prototype.Eb = function (a, b, c) {
Ee(this, a);
this.Oc[a] = this.Oc[a] || [];
this.Oc[a].push({
zc: b,
Ma: c
});
(a = this.Ae(a)) && b.apply(c, a)
};
De.prototype.ic = function (a, b, c) {
Ee(this, a);
a = this.Oc[a] || [];
for (var d = 0; d < a.length; d++)
if (a[d].zc === b && (!c || c === a[d].Ma)) {
a.splice(d, 1);
break
}
};
function Ee(a, b) {
K(Ta(a.Xf, function (a) {
return a === b
}), "Unknown event: " + b)
};
var Fe = function () {
var a = 0,
b = [];
return function (c) {
var d = c === a;
a = c;
for (var e = Array(8), f = 7; 0 <= f; f--) e[f] = "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(c % 64), c = Math.floor(c / 64);
K(0 === c, "Cannot push at time == 0");
c = e.join("");
if (d) {
for (f = 11; 0 <= f && 63 === b[f]; f--) b[f] = 0;
b[f]++
} else
for (f = 0; 12 > f; f++) b[f] = Math.floor(64 * Math.random());
for (f = 0; 12 > f; f++) c += "-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".charAt(b[f]);
K(20 === c.length, "nextPushId: Length should be 20.");
return c
}
}();
function Ge() {
De.call(this, ["online"]);
this.kc = !0;
if ("undefined" !== typeof window && "undefined" !== typeof window.addEventListener) {
var a = this;
window.addEventListener("online", function () {
a.kc || (a.kc = !0, a.fe("online", !0))
}, !1);
window.addEventListener("offline", function () {
a.kc && (a.kc = !1, a.fe("online", !1))
}, !1)
}
}
ma(Ge, De);
Ge.prototype.Ae = function (a) {
K("online" === a, "Unknown event type: " + a);
return [this.kc]
};
ca(Ge);
function He() {
De.call(this, ["visible"]);
var a, b;
"undefined" !== typeof document && "undefined" !== typeof document.addEventListener && ("undefined" !== typeof document.hidden ? (b = "visibilitychange", a = "hidden") : "undefined" !== typeof document.mozHidden ? (b = "mozvisibilitychange", a = "mozHidden") : "undefined" !== typeof document.msHidden ? (b = "msvisibilitychange", a = "msHidden") : "undefined" !== typeof document.webkitHidden && (b = "webkitvisibilitychange", a = "webkitHidden"));
this.Ob = !0;
if (b) {
var c = this;
document.addEventListener(b,
function () {
var b = !document[a];
b !== c.Ob && (c.Ob = b, c.fe("visible", b))
}, !1)
}
}
ma(He, De);
He.prototype.Ae = function (a) {
K("visible" === a, "Unknown event type: " + a);
return [this.Ob]
};
ca(He);
function L(a, b) {
if (1 == arguments.length) {
this.o = a.split("/");
for (var c = 0, d = 0; d < this.o.length; d++) 0 < this.o[d].length && (this.o[c] = this.o[d], c++);
this.o.length = c;
this.Z = 0
} else this.o = a, this.Z = b
}
function T(a, b) {
var c = E(a);
if (null === c) return b;
if (c === E(b)) return T(H(a), H(b));
throw Error("INTERNAL ERROR: innerPath (" + b + ") is not within outerPath (" + a + ")");
}
function Ie(a, b) {
for (var c = a.slice(), d = b.slice(), e = 0; e < c.length && e < d.length; e++) {
var f = Vb(c[e], d[e]);
if (0 !== f) return f
}
return c.length === d.length ? 0 : c.length < d.length ? -1 : 1
}
function E(a) {
return a.Z >= a.o.length ? null : a.o[a.Z]
}
function Kd(a) {
return a.o.length - a.Z
}
function H(a) {
var b = a.Z;
b < a.o.length && b++;
return new L(a.o, b)
}
function Ld(a) {
return a.Z < a.o.length ? a.o[a.o.length - 1] : null
}
g = L.prototype;
g.toString = function () {
for (var a = "", b = this.Z; b < this.o.length; b++) "" !== this.o[b] && (a += "/" + this.o[b]);
return a || "/"
};
g.slice = function (a) {
return this.o.slice(this.Z + (a || 0))
};
g.parent = function () {
if (this.Z >= this.o.length) return null;
for (var a = [], b = this.Z; b < this.o.length - 1; b++) a.push(this.o[b]);
return new L(a, 0)
};
g.u = function (a) {
for (var b = [], c = this.Z; c < this.o.length; c++) b.push(this.o[c]);
if (a instanceof L)
for (c = a.Z; c < a.o.length; c++) b.push(a.o[c]);
else
for (a = a.split("/"), c = 0; c < a.length; c++) 0 < a[c].length && b.push(a[c]);
return new L(b, 0)
};
g.e = function () {
return this.Z >= this.o.length
};
g.ca = function (a) {
if (Kd(this) !== Kd(a)) return !1;
for (var b = this.Z, c = a.Z; b <= this.o.length; b++, c++)
if (this.o[b] !== a.o[c]) return !1;
return !0
};
g.contains = function (a) {
var b = this.Z,
c = a.Z;
if (Kd(this) > Kd(a)) return !1;
for (; b < this.o.length;) {
if (this.o[b] !== a.o[c]) return !1;
++b;
++c
}
return !0
};
var G = new L("");
function Je(a, b) {
this.Qa = a.slice();
this.Ha = Math.max(1, this.Qa.length);
this.lf = b;
for (var c = 0; c < this.Qa.length; c++) this.Ha += Zc(this.Qa[c]);
Ke(this)
}
Je.prototype.push = function (a) {
0 < this.Qa.length && (this.Ha += 1);
this.Qa.push(a);
this.Ha += Zc(a);
Ke(this)
};
Je.prototype.pop = function () {
var a = this.Qa.pop();
this.Ha -= Zc(a);
0 < this.Qa.length && --this.Ha
};
function Ke(a) {
if (768 < a.Ha) throw Error(a.lf + "has a key path longer than 768 bytes (" + a.Ha + ").");
if (32 < a.Qa.length) throw Error(a.lf + "path specified exceeds the maximum depth that can be written (32) or object contains a cycle " + Le(a));
}
function Le(a) {
return 0 == a.Qa.length ? "" : "in property '" + a.Qa.join(".") + "'"
};
function Me(a, b) {
this.value = a;
this.children = b || Ne
}
var Ne = new ac(function (a, b) {
return a === b ? 0 : a < b ? -1 : 1
});
function Oe(a) {
var b = Pd;
r(a, function (a, d) {
b = b.set(new L(d), a)
});
return b
}
g = Me.prototype;
g.e = function () {
return null === this.value && this.children.e()
};
function Pe(a, b, c) {
if (null != a.value && c(a.value)) return {
path: G,
value: a.value
};
if (b.e()) return null;
var d = E(b);
a = a.children.get(d);
return null !== a ? (b = Pe(a, H(b), c), null != b ? {
path: (new L(d)).u(b.path),
value: b.value
} : null) : null
}
function Qe(a, b) {
return Pe(a, b, function () {
return !0
})
}
g.subtree = function (a) {
if (a.e()) return this;
var b = this.children.get(E(a));
return null !== b ? b.subtree(H(a)) : Pd
};
g.set = function (a, b) {
if (a.e()) return new Me(b, this.children);
var c = E(a),
d = (this.children.get(c) || Pd).set(H(a), b),
c = this.children.Oa(c, d);
return new Me(this.value, c)
};
g.remove = function (a) {
if (a.e()) return this.children.e() ? Pd : new Me(null, this.children);
var b = E(a),
c = this.children.get(b);
return c ? (a = c.remove(H(a)), b = a.e() ? this.children.remove(b) : this.children.Oa(b, a), null === this.value && b.e() ? Pd : new Me(this.value, b)) : this
};
g.get = function (a) {
if (a.e()) return this.value;
var b = this.children.get(E(a));
return b ? b.get(H(a)) : null
};
function Od(a, b, c) {
if (b.e()) return c;
var d = E(b);
b = Od(a.children.get(d) || Pd, H(b), c);
d = b.e() ? a.children.remove(d) : a.children.Oa(d, b);
return new Me(a.value, d)
}
function Re(a, b) {
return Se(a, G, b)
}
function Se(a, b, c) {
var d = {};
a.children.ia(function (a, f) {
d[a] = Se(f, b.u(a), c)
});
return c(b, a.value, d)
}
function Te(a, b, c) {
return Ue(a, b, G, c)
}
function Ue(a, b, c, d) {
var e = a.value ? d(c, a.value) : !1;
if (e) return e;
if (b.e()) return null;
e = E(b);
return (a = a.children.get(e)) ? Ue(a, H(b), c.u(e), d) : null
}
function Ve(a, b, c) {
We(a, b, G, c)
}
function We(a, b, c, d) {
if (b.e()) return a;
a.value && d(c, a.value);
var e = E(b);
return (a = a.children.get(e)) ? We(a, H(b), c.u(e), d) : Pd
}
function Md(a, b) {
Xe(a, G, b)
}
function Xe(a, b, c) {
a.children.ia(function (a, e) {
Xe(e, b.u(a), c)
});
a.value && c(b, a.value)
}
function Ye(a, b) {
a.children.ia(function (a, d) {
d.value && b(a, d.value)
})
}
var Pd = new Me(null);
Me.prototype.toString = function () {
var a = {};
Md(this, function (b, c) {
a[b.toString()] = c.toString()
});
return B(a)
};
function Ze(a, b, c) {
this.type = Ed;
this.source = $e;
this.path = a;
this.Qb = b;
this.Vd = c
}
Ze.prototype.Xc = function (a) {
if (this.path.e()) {
if (null != this.Qb.value) return K(this.Qb.children.e(), "affectedTree should not have overlapping affected paths."), this;
a = this.Qb.subtree(new L(a));
return new Ze(G, a, this.Vd)
}
K(E(this.path) === a, "operationForChild called for unrelated child.");
return new Ze(H(this.path), this.Qb, this.Vd)
};
Ze.prototype.toString = function () {
return "Operation(" + this.path + ": " + this.source.toString() + " ack write revert=" + this.Vd + " affectedTree=" + this.Qb + ")"
};
var Yb = 0,
Bd = 1,
Ed = 2,
$b = 3;
function af(a, b, c, d) {
this.we = a;
this.pf = b;
this.Hb = c;
this.af = d;
K(!d || b, "Tagged queries must be from server.")
}
var $e = new af(!0, !1, null, !1),
bf = new af(!1, !0, null, !1);
af.prototype.toString = function () {
return this.we ? "user" : this.af ? "server(queryID=" + this.Hb + ")" : "server"
};
function cf(a) {
this.X = a
}
var df = new cf(new Me(null));
function ef(a, b, c) {
if (b.e()) return new cf(new Me(c));
var d = Qe(a.X, b);
if (null != d) {
var e = d.path,
d = d.value;
b = T(e, b);
d = d.G(b, c);
return new cf(a.X.set(e, d))
}
a = Od(a.X, b, new Me(c));
return new cf(a)
}
function ff(a, b, c) {
var d = a;
ib(c, function (a, c) {
d = ef(d, b.u(a), c)
});
return d
}
cf.prototype.Rd = function (a) {
if (a.e()) return df;
a = Od(this.X, a, Pd);
return new cf(a)
};
function gf(a, b) {
var c = Qe(a.X, b);
return null != c ? a.X.get(c.path).Q(T(c.path, b)) : null
}
function hf(a) {
var b = [],
c = a.X.value;
null != c ? c.K() || c.P(N, function (a, c) {
b.push(new F(a, c))
}) : a.X.children.ia(function (a, c) {
null != c.value && b.push(new F(a, c.value))
});
return b
}
function jf(a, b) {
if (b.e()) return a;
var c = gf(a, b);
return null != c ? new cf(new Me(c)) : new cf(a.X.subtree(b))
}
cf.prototype.e = function () {
return this.X.e()
};
cf.prototype.apply = function (a) {
return kf(G, this.X, a)
};
function kf(a, b, c) {
if (null != b.value) return c.G(a, b.value);
var d = null;
b.children.ia(function (b, f) {
".priority" === b ? (K(null !== f.value, "Priority writes must always be leaf nodes"), d = f.value) : c = kf(a.u(b), f, c)
});
c.Q(a).e() || null === d || (c = c.G(a.u(".priority"), d));
return c
};
function lf() {
this.T = df;
this.na = [];
this.Mc = -1
}
function mf(a, b) {
for (var c = 0; c < a.na.length; c++) {
var d = a.na[c];
if (d.kd === b) return d
}
return null
}
g = lf.prototype;
g.Rd = function (a) {
var b = Ua(this.na, function (b) {
return b.kd === a
});
K(0 <= b, "removeWrite called with nonexistent writeId.");
var c = this.na[b];
this.na.splice(b, 1);
for (var d = c.visible, e = !1, f = this.na.length - 1; d && 0 <= f;) {
var h = this.na[f];
h.visible && (f >= b && nf(h, c.path) ? d = !1 : c.path.contains(h.path) && (e = !0));
f--
}
if (d) {
if (e) this.T = of(this.na, pf, G), this.Mc = 0 < this.na.length ? this.na[this.na.length - 1].kd : -1;
else if (c.Ga) this.T = this.T.Rd(c.path);
else {
var k = this;
r(c.children, function (a, b) {
k.T = k.T.Rd(c.path.u(b))
})
}
return !0
}
return !1
};
g.za = function (a, b, c, d) {
if (c || d) {
var e = jf(this.T, a);
return !d && e.e() ? b : d || null != b || null != gf(e, G) ? (e = of(this.na, function (b) {
return (b.visible || d) && (!c || !(0 <= Na(c, b.kd))) && (b.path.contains(a) || a.contains(b.path))
}, a), b = b || C, e.apply(b)) : null
}
e = gf(this.T, a);
if (null != e) return e;
e = jf(this.T, a);
return e.e() ? b : null != b || null != gf(e, G) ? (b = b || C, e.apply(b)) : null
};
g.yc = function (a, b) {
var c = C,
d = gf(this.T, a);
if (d) d.K() || d.P(N, function (a, b) {
c = c.U(a, b)
});
else if (b) {
var e = jf(this.T, a);
b.P(N, function (a, b) {
var d = jf(e, new L(a)).apply(b);
c = c.U(a, d)
});
Oa(hf(e), function (a) {
c = c.U(a.name, a.S)
})
} else e = jf(this.T, a), Oa(hf(e), function (a) {
c = c.U(a.name, a.S)
});
return c
};
g.ld = function (a, b, c, d) {
K(c || d, "Either existingEventSnap or existingServerSnap must exist");
a = a.u(b);
if (null != gf(this.T, a)) return null;
a = jf(this.T, a);
return a.e() ? d.Q(b) : a.apply(d.Q(b))
};
g.xc = function (a, b, c) {
a = a.u(b);
var d = gf(this.T, a);
return null != d ? d : sb(c, b) ? jf(this.T, a).apply(c.j().R(b)) : null
};
g.tc = function (a) {
return gf(this.T, a)
};
g.ne = function (a, b, c, d, e, f) {
var h;
a = jf(this.T, a);
h = gf(a, G);
if (null == h)
if (null != b) h = a.apply(b);
else return [];
h = h.lb(f);
if (h.e() || h.K()) return [];
b = [];
a = td(f);
e = e ? h.$b(c, f) : h.Yb(c, f);
for (f = J(e); f && b.length < d;) 0 !== a(f, c) && b.push(f), f = J(e);
return b
};
function nf(a, b) {
return a.Ga ? a.path.contains(b) : !!ua(a.children, function (c, d) {
return a.path.u(d).contains(b)
})
}
function pf(a) {
return a.visible
}
function of(a, b, c) {
for (var d = df, e = 0; e < a.length; ++e) {
var f = a[e];
if (b(f)) {
var h = f.path;
if (f.Ga) c.contains(h) ? (h = T(c, h), d = ef(d, h, f.Ga)) : h.contains(c) && (h = T(h, c), d = ef(d, G, f.Ga.Q(h)));
else if (f.children)
if (c.contains(h)) h = T(c, h), d = ff(d, h, f.children);
else {
if (h.contains(c))
if (h = T(h, c), h.e()) d = ff(d, G, f.children);
else if (f = w(f.children, E(h))) f = f.Q(H(h)), d = ef(d, G, f)
} else throw Fc("WriteRecord should have .snap or .children");
}
}
return d
}
function qf(a, b) {
this.Mb = a;
this.X = b
}
g = qf.prototype;
g.za = function (a, b, c) {
return this.X.za(this.Mb, a, b, c)
};
g.yc = function (a) {
return this.X.yc(this.Mb, a)
};
g.ld = function (a, b, c) {
return this.X.ld(this.Mb, a, b, c)
};
g.tc = function (a) {
return this.X.tc(this.Mb.u(a))
};
g.ne = function (a, b, c, d, e) {
return this.X.ne(this.Mb, a, b, c, d, e)
};
g.xc = function (a, b) {
return this.X.xc(this.Mb, a, b)
};
g.u = function (a) {
return new qf(this.Mb.u(a), this.X)
};
function rf() {
this.ya = {}
}
g = rf.prototype;
g.e = function () {
return wa(this.ya)
};
g.ab = function (a, b, c) {
var d = a.source.Hb;
if (null !== d) return d = w(this.ya, d), K(null != d, "SyncTree gave us an op for an invalid query."), d.ab(a, b, c);
var e = [];
r(this.ya, function (d) {
e = e.concat(d.ab(a, b, c))
});
return e
};
g.Pb = function (a, b, c, d, e) {
var f = a.va(),
h = w(this.ya, f);
if (!h) {
var h = c.za(e ? d : null),
k = !1;
h ? k = !0 : (h = d instanceof R ? c.yc(d) : C, k = !1);
h = new ve(a, new Id(new tb(h, k, !1), new tb(d, e, !1)));
this.ya[f] = h
}
h.Pb(b);
return ye(h, b)
};
g.jb = function (a, b, c) {
var d = a.va(),
e = [],
f = [],
h = null != sf(this);
if ("default" === d) {
var k = this;
r(this.ya, function (a, d) {
f = f.concat(a.jb(b, c));
a.e() && (delete k.ya[d], S(a.W.n) || e.push(a.W))
})
} else {
var l = w(this.ya, d);
l && (f = f.concat(l.jb(b, c)), l.e() && (delete this.ya[d], S(l.W.n) || e.push(l.W)))
}
h && null == sf(this) && e.push(new U(a.k, a.path));
return {
Kg: e,
mg: f
}
};
function tf(a) {
return Pa(ra(a.ya), function (a) {
return !S(a.W.n)
})
}
g.fb = function (a) {
var b = null;
r(this.ya, function (c) {
b = b || c.fb(a)
});
return b
};
function uf(a, b) {
if (S(b.n)) return sf(a);
var c = b.va();
return w(a.ya, c)
}
function sf(a) {
return va(a.ya, function (a) {
return S(a.W.n)
}) || null
};
function vf(a) {
this.ta = Pd;
this.ib = new lf;
this.$e = {};
this.mc = {};
this.Nc = a
}
function wf(a, b, c, d, e) {
var f = a.ib,
h = e;
K(d > f.Mc, "Stacking an older write on top of newer ones");
n(h) || (h = !0);
f.na.push({
path: b,
Ga: c,
kd: d,
visible: h
});
h && (f.T = ef(f.T, b, c));
f.Mc = d;
return e ? xf(a, new Xb($e, b, c)) : []
}
function yf(a, b, c, d) {
var e = a.ib;
K(d > e.Mc, "Stacking an older merge on top of newer ones");
e.na.push({
path: b,
children: c,
kd: d,
visible: !0
});
e.T = ff(e.T, b, c);
e.Mc = d;
c = Oe(c);
return xf(a, new ze($e, b, c))
}
function zf(a, b, c) {
c = c || !1;
var d = mf(a.ib, b);
if (a.ib.Rd(b)) {
var e = Pd;
null != d.Ga ? e = e.set(G, !0) : ib(d.children, function (a, b) {
e = e.set(new L(a), b)
});
return xf(a, new Ze(d.path, e, c))
}
return []
}
function Af(a, b, c) {
c = Oe(c);
return xf(a, new ze(bf, b, c))
}
function Bf(a, b, c, d) {
d = Cf(a, d);
if (null != d) {
var e = Df(d);
d = e.path;
e = e.Hb;
b = T(d, b);
c = new Xb(new af(!1, !0, e, !0), b, c);
return Ef(a, d, c)
}
return []
}
function Ff(a, b, c, d) {
if (d = Cf(a, d)) {
var e = Df(d);
d = e.path;
e = e.Hb;
b = T(d, b);
c = Oe(c);
c = new ze(new af(!1, !0, e, !0), b, c);
return Ef(a, d, c)
}
return []
}
vf.prototype.Pb = function (a, b) {
var c = a.path,
d = null,
e = !1;
Ve(this.ta, c, function (a, b) {
var f = T(a, c);
d = d || b.fb(f);
e = e || null != sf(b)
});
var f = this.ta.get(c);
f ? (e = e || null != sf(f), d = d || f.fb(G)) : (f = new rf, this.ta = this.ta.set(c, f));
var h;
null != d ? h = !0 : (h = !1, d = C, Ye(this.ta.subtree(c), function (a, b) {
var c = b.fb(G);
c && (d = d.U(a, c))
}));
var k = null != uf(f, a);
if (!k && !S(a.n)) {
var l = Gf(a);
K(!(l in this.mc), "View does not exist, but we have a tag");
var m = Hf++;
this.mc[l] = m;
this.$e["_" + m] = l
}
h = f.Pb(a, b, new qf(c, this.ib), d, h);
k ||
e || (f = uf(f, a), h = h.concat(If(this, a, f)));
return h
};
vf.prototype.jb = function (a, b, c) {
var d = a.path,
e = this.ta.get(d),
f = [];
if (e && ("default" === a.va() || null != uf(e, a))) {
f = e.jb(a, b, c);
e.e() && (this.ta = this.ta.remove(d));
e = f.Kg;
f = f.mg;
b = -1 !== Ua(e, function (a) {
return S(a.n)
});
var h = Te(this.ta, d, function (a, b) {
return null != sf(b)
});
if (b && !h && (d = this.ta.subtree(d), !d.e()))
for (var d = Jf(d), k = 0; k < d.length; ++k) {
var l = d[k],
m = l.W,
l = Kf(this, l);
this.Nc.Xe(Lf(m), Mf(this, m), l.xd, l.H)
}
if (!h && 0 < e.length && !c)
if (b) this.Nc.ae(Lf(a), null);
else {
var t = this;
Oa(e, function (a) {
a.va();
var b = t.mc[Gf(a)];
t.Nc.ae(Lf(a), b)
})
}
Nf(this, e)
}
return f
};
vf.prototype.za = function (a, b) {
var c = this.ib,
d = Te(this.ta, a, function (b, c) {
var d = T(b, a);
if (d = c.fb(d)) return d
});
return c.za(a, d, b, !0)
};
function Jf(a) {
return Re(a, function (a, c, d) {
if (c && null != sf(c)) return [sf(c)];
var e = [];
c && (e = tf(c));
r(d, function (a) {
e = e.concat(a)
});
return e
})
}
function Nf(a, b) {
for (var c = 0; c < b.length; ++c) {
var d = b[c];
if (!S(d.n)) {
var d = Gf(d),
e = a.mc[d];
delete a.mc[d];
delete a.$e["_" + e]
}
}
}
function Lf(a) {
return S(a.n) && !fe(a.n) ? a.Ib() : a
}
function If(a, b, c) {
var d = b.path,
e = Mf(a, b);
c = Kf(a, c);
b = a.Nc.Xe(Lf(b), e, c.xd, c.H);
d = a.ta.subtree(d);
if (e) K(null == sf(d.value), "If we're adding a query, it shouldn't be shadowed");
else
for (e = Re(d, function (a, b, c) {
if (!a.e() && b && null != sf(b)) return [we(sf(b))];
var d = [];
b && (d = d.concat(Qa(tf(b), function (a) {
return a.W
})));
r(c, function (a) {
d = d.concat(a)
});
return d
}), d = 0; d < e.length; ++d) c = e[d], a.Nc.ae(Lf(c), Mf(a, c));
return b
}
function Kf(a, b) {
var c = b.W,
d = Mf(a, c);
return {
xd: function () {
return (b.w() || C).hash()
},
H: function (b) {
if ("ok" === b) {
if (d) {
var f = c.path;
if (b = Cf(a, d)) {
var h = Df(b);
b = h.path;
h = h.Hb;
f = T(b, f);
f = new Zb(new af(!1, !0, h, !0), f);
b = Ef(a, b, f)
} else b = []
} else b = xf(a, new Zb(bf, c.path));
return b
}
f = "Unknown Error";
"too_big" === b ? f = "The data requested exceeds the maximum size that can be accessed with a single request." : "permission_denied" == b ? f = "Client doesn't have permission to access the desired data." : "unavailable" == b &&
(f = "The service is unavailable");
f = Error(b + ": " + f);
f.code = b.toUpperCase();
return a.jb(c, null, f)
}
}
}
function Gf(a) {
return a.path.toString() + "$" + a.va()
}
function Df(a) {
var b = a.indexOf("$");
K(-1 !== b && b < a.length - 1, "Bad queryKey.");
return {
Hb: a.substr(b + 1),
path: new L(a.substr(0, b))
}
}
function Cf(a, b) {
var c = a.$e,
d = "_" + b;
return d in c ? c[d] : void 0
}
function Mf(a, b) {
var c = Gf(b);
return w(a.mc, c)
}
var Hf = 1;
function Ef(a, b, c) {
var d = a.ta.get(b);
K(d, "Missing sync point for query tag that we're tracking");
return d.ab(c, new qf(b, a.ib), null)
}
function xf(a, b) {
return Of(a, b, a.ta, null, new qf(G, a.ib))
}
function Of(a, b, c, d, e) {
if (b.path.e()) return Pf(a, b, c, d, e);
var f = c.get(G);
null == d && null != f && (d = f.fb(G));
var h = [],
k = E(b.path),
l = b.Xc(k);
if ((c = c.children.get(k)) && l) var m = d ? d.R(k) : null,
k = e.u(k),
h = h.concat(Of(a, l, c, m, k));
f && (h = h.concat(f.ab(b, e, d)));
return h
}
function Pf(a, b, c, d, e) {
var f = c.get(G);
null == d && null != f && (d = f.fb(G));
var h = [];
c.children.ia(function (c, f) {
var m = d ? d.R(c) : null,
t = e.u(c),
z = b.Xc(c);
z && (h = h.concat(Pf(a, z, f, m, t)))
});
f && (h = h.concat(f.ab(b, e, d)));
return h
};
function Qf() {
this.children = {};
this.nd = 0;
this.value = null
}
function Rf(a, b, c) {
this.Gd = a ? a : "";
this.Zc = b ? b : null;
this.A = c ? c : new Qf
}
function Sf(a, b) {
for (var c = b instanceof L ? b : new L(b), d = a, e; null !== (e = E(c));) d = new Rf(e, d, w(d.A.children, e) || new Qf), c = H(c);
return d
}
g = Rf.prototype;
g.Ca = function () {
return this.A.value
};
function Tf(a, b) {
K("undefined" !== typeof b, "Cannot set value to undefined");
a.A.value = b;
Uf(a)
}
g.clear = function () {
this.A.value = null;
this.A.children = {};
this.A.nd = 0;
Uf(this)
};
g.wd = function () {
return 0 < this.A.nd
};
g.e = function () {
return null === this.Ca() && !this.wd()
};
g.P = function (a) {
var b = this;
r(this.A.children, function (c, d) {
a(new Rf(d, b, c))
})
};
function Vf(a, b, c, d) {
c && !d && b(a);
a.P(function (a) {
Vf(a, b, !0, d)
});
c && d && b(a)
}
function Wf(a, b) {
for (var c = a.parent(); null !== c && !b(c);) c = c.parent()
}
g.path = function () {
return new L(null === this.Zc ? this.Gd : this.Zc.path() + "/" + this.Gd)
};
g.name = function () {
return this.Gd
};
g.parent = function () {
return this.Zc
};
function Uf(a) {
if (null !== a.Zc) {
var b = a.Zc,
c = a.Gd,
d = a.e(),
e = v(b.A.children, c);
d && e ? (delete b.A.children[c], b.A.nd--, Uf(b)) : d || e || (b.A.children[c] = a.A, b.A.nd++, Uf(b))
}
};
var Xf = /[\[\].#$\/\u0000-\u001F\u007F]/,
Yf = /[\[\].#$\u0000-\u001F\u007F]/,
Zf = /^[a-zA-Z][a-zA-Z._\-+]+$/;
function $f(a) {
return p(a) && 0 !== a.length && !Xf.test(a)
}
function ag(a) {
return null === a || p(a) || ga(a) && !Qc(a) || ia(a) && v(a, ".sv")
}
function bg(a, b, c, d) {
d && !n(b) || cg(y(a, 1, d), b, c)
}
function cg(a, b, c) {
c instanceof L && (c = new Je(c, a));
if (!n(b)) throw Error(a + "contains undefined " + Le(c));
if (ha(b)) throw Error(a + "contains a function " + Le(c) + " with contents: " + b.toString());
if (Qc(b)) throw Error(a + "contains " + b.toString() + " " + Le(c));
if (p(b) && b.length > 10485760 / 3 && 10485760 < Zc(b)) throw Error(a + "contains a string greater than 10485760 utf8 bytes " + Le(c) + " ('" + b.substring(0, 50) + "...')");
if (ia(b)) {
var d = !1,
e = !1;
ib(b, function (b, h) {
if (".value" === b) d = !0;
else if (".priority" !== b && ".sv" !== b && (e = !0, !$f(b))) throw Error(a + " contains an invalid key (" + b + ") " + Le(c) + '. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');
c.push(b);
cg(a, h, c);
c.pop()
});
if (d && e) throw Error(a + ' contains ".value" child ' + Le(c) + " in addition to actual children.");
}
}
function dg(a, b) {
var c, d;
for (c = 0; c < b.length; c++) {
d = b[c];
for (var e = d.slice(), f = 0; f < e.length; f++)
if ((".priority" !== e[f] || f !== e.length - 1) && !$f(e[f])) throw Error(a + "contains an invalid key (" + e[f] + ") in path " + d.toString() + '. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');
}
b.sort(Ie);
e = null;
for (c = 0; c < b.length; c++) {
d = b[c];
if (null !== e && e.contains(d)) throw Error(a + "contains a path " + e.toString() + " that is ancestor of another path " + d.toString());
e = d
}
}
function eg(a, b, c) {
var d = y(a, 1, !1);
if (!ia(b) || ea(b)) throw Error(d + " must be an object containing the children to replace.");
var e = [];
ib(b, function (a, b) {
var k = new L(a);
cg(d, b, c.u(k));
if (".priority" === Ld(k) && !ag(b)) throw Error(d + "contains an invalid value for '" + k.toString() + "', which must be a valid Firebase priority (a string, finite number, server value, or null).");
e.push(k)
});
dg(d, e)
}
function fg(a, b, c) {
if (Qc(c)) throw Error(y(a, b, !1) + "is " + c.toString() + ", but must be a valid Firebase priority (a string, finite number, server value, or null).");
if (!ag(c)) throw Error(y(a, b, !1) + "must be a valid Firebase priority (a string, finite number, server value, or null).");
}
function gg(a, b, c) {
if (!c || n(b)) switch (b) {
case "value":
case "child_added":
case "child_removed":
case "child_changed":
case "child_moved":
break;
default:
throw Error(y(a, 1, c) + 'must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".');
}
}
function hg(a, b) {
if (n(b) && !$f(b)) throw Error(y(a, 2, !0) + 'was an invalid key: "' + b + '". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").');
}
function ig(a, b) {
if (!p(b) || 0 === b.length || Yf.test(b)) throw Error(y(a, 1, !1) + 'was an invalid path: "' + b + '". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"');
}
function jg(a, b) {
if (".info" === E(b)) throw Error(a + " failed: Can't modify data under /.info/");
}
function kg(a, b) {
if (!p(b)) throw Error(y(a, 1, !1) + "must be a valid credential (a string).");
}
function lg(a, b, c) {
if (!p(c)) throw Error(y(a, b, !1) + "must be a valid string.");
}
function mg(a, b) {
lg(a, 1, b);
if (!Zf.test(b)) throw Error(y(a, 1, !1) + "'" + b + "' is not a valid authentication provider.");
}
function ng(a, b, c, d) {
if (!d || n(c))
if (!ia(c) || null === c) throw Error(y(a, b, d) + "must be a valid object.");
}
function og(a, b, c) {
if (!ia(b) || !v(b, c)) throw Error(y(a, 1, !1) + 'must contain the key "' + c + '"');
if (!p(w(b, c))) throw Error(y(a, 1, !1) + 'must contain the key "' + c + '" with type "string"');
};
function pg() {
this.set = {}
}
g = pg.prototype;
g.add = function (a, b) {
this.set[a] = null !== b ? b : !0
};
g.contains = function (a) {
return v(this.set, a)
};
g.get = function (a) {
return this.contains(a) ? this.set[a] : void 0
};
g.remove = function (a) {
delete this.set[a]
};
g.clear = function () {
this.set = {}
};
g.e = function () {
return wa(this.set)
};
g.count = function () {
return pa(this.set)
};
function qg(a, b) {
r(a.set, function (a, d) {
b(d, a)
})
}
g.keys = function () {
var a = [];
r(this.set, function (b, c) {
a.push(c)
});
return a
};
function qc() {
this.m = this.B = null
}
qc.prototype.find = function (a) {
if (null != this.B) return this.B.Q(a);
if (a.e() || null == this.m) return null;
var b = E(a);
a = H(a);
return this.m.contains(b) ? this.m.get(b).find(a) : null
};
qc.prototype.nc = function (a, b) {
if (a.e()) this.B = b, this.m = null;
else if (null !== this.B) this.B = this.B.G(a, b);
else {
null == this.m && (this.m = new pg);
var c = E(a);
this.m.contains(c) || this.m.add(c, new qc);
c = this.m.get(c);
a = H(a);
c.nc(a, b)
}
};
function rg(a, b) {
if (b.e()) return a.B = null, a.m = null, !0;
if (null !== a.B) {
if (a.B.K()) return !1;
var c = a.B;
a.B = null;
c.P(N, function (b, c) {
a.nc(new L(b), c)
});
return rg(a, b)
}
return null !== a.m ? (c = E(b), b = H(b), a.m.contains(c) && rg(a.m.get(c), b) && a.m.remove(c), a.m.e() ? (a.m = null, !0) : !1) : !0
}
function rc(a, b, c) {
null !== a.B ? c(b, a.B) : a.P(function (a, e) {
var f = new L(b.toString() + "/" + a);
rc(e, f, c)
})
}
qc.prototype.P = function (a) {
null !== this.m && qg(this.m, function (b, c) {
a(b, c)
})
};
var sg = "auth.firebase.com";
function tg(a, b, c) {
this.od = a || {};
this.ee = b || {};
this.$a = c || {};
this.od.remember || (this.od.remember = "default")
}
var ug = ["remember", "redirectTo"];
function vg(a) {
var b = {},
c = {};
ib(a || {}, function (a, e) {
0 <= Na(ug, a) ? b[a] = e : c[a] = e
});
return new tg(b, {}, c)
};
function wg(a, b) {
this.Qe = ["session", a.Od, a.hc].join(":");
this.be = b
}
wg.prototype.set = function (a, b) {
if (!b)
if (this.be.length) b = this.be[0];
else throw Error("fb.login.SessionManager : No storage options available!");
b.set(this.Qe, a)
};
wg.prototype.get = function () {
var a = Qa(this.be, q(this.qg, this)),
a = Pa(a, function (a) {
return null !== a
});
Xa(a, function (a, c) {
return ad(c.token) - ad(a.token)
});
return 0 < a.length ? a.shift() : null
};
wg.prototype.qg = function (a) {
try {
var b = a.get(this.Qe);
if (b && b.token) return b
} catch (c) {}
return null
};
wg.prototype.clear = function () {
var a = this;
Oa(this.be, function (b) {
b.remove(a.Qe)
})
};
function xg() {
return "undefined" !== typeof navigator && "string" === typeof navigator.userAgent ? navigator.userAgent : ""
}
function yg() {
return "undefined" !== typeof window && !!(window.cordova || window.phonegap || window.PhoneGap) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(xg())
}
function zg() {
return "undefined" !== typeof location && /^file:\//.test(location.href)
}
function Ag(a) {
var b = xg();
if ("" === b) return !1;
if ("Microsoft Internet Explorer" === navigator.appName) {
if ((b = b.match(/MSIE ([0-9]{1,}[\.0-9]{0,})/)) && 1 < b.length) return parseFloat(b[1]) >= a
} else if (-1 < b.indexOf("Trident") && (b = b.match(/rv:([0-9]{2,2}[\.0-9]{0,})/)) && 1 < b.length) return parseFloat(b[1]) >= a;
return !1
};
function Bg() {
var a = window.opener.frames,
b;
for (b = a.length - 1; 0 <= b; b--) try {
if (a[b].location.protocol === window.location.protocol && a[b].location.host === window.location.host && "__winchan_relay_frame" === a[b].name) return a[b]
} catch (c) {}
return null
}
function Cg(a, b, c) {
a.attachEvent ? a.attachEvent("on" + b, c) : a.addEventListener && a.addEventListener(b, c, !1)
}
function Dg(a, b, c) {
a.detachEvent ? a.detachEvent("on" + b, c) : a.removeEventListener && a.removeEventListener(b, c, !1)
}
function Eg(a) {
/^https?:\/\//.test(a) || (a = window.location.href);
var b = /^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(a);
return b ? b[1] : a
}
function Fg(a) {
var b = "";
try {
a = a.replace("#", "");
var c = lb(a);
c && v(c, "__firebase_request_key") && (b = w(c, "__firebase_request_key"))
} catch (d) {}
return b
}
function Gg() {
var a = Pc(sg);
return a.scheme + "://" + a.host + "/v2"
}
function Hg(a) {
return Gg() + "/" + a + "/auth/channel"
};
function Ig(a) {
var b = this;
this.Ac = a;
this.ce = "*";
Ag(8) ? this.Rc = this.zd = Bg() : (this.Rc = window.opener, this.zd = window);
if (!b.Rc) throw "Unable to find relay frame";
Cg(this.zd, "message", q(this.jc, this));
Cg(this.zd, "message", q(this.Bf, this));
try {
Jg(this, {
a: "ready"
})
} catch (c) {
Cg(this.Rc, "load", function () {
Jg(b, {
a: "ready"
})
})
}
Cg(window, "unload", q(this.Bg, this))
}
function Jg(a, b) {
b = B(b);
Ag(8) ? a.Rc.doPost(b, a.ce) : a.Rc.postMessage(b, a.ce)
}
Ig.prototype.jc = function (a) {
var b = this,
c;
try {
c = nb(a.data)
} catch (d) {}
c && "request" === c.a && (Dg(window, "message", this.jc), this.ce = a.origin, this.Ac && setTimeout(function () {
b.Ac(b.ce, c.d, function (a, c) {
b.dg = !c;
b.Ac = void 0;
Jg(b, {
a: "response",
d: a,
forceKeepWindowOpen: c
})
})
}, 0))
};
Ig.prototype.Bg = function () {
try {
Dg(this.zd, "message", this.Bf)
} catch (a) {}
this.Ac && (Jg(this, {
a: "error",
d: "unknown closed window"
}), this.Ac = void 0);
try {
window.close()
} catch (b) {}
};
Ig.prototype.Bf = function (a) {
if (this.dg && "die" === a.data) try {
window.close()
} catch (b) {}
};
function Kg(a) {
this.pc = Ga() + Ga() + Ga();
this.Ef = a
}
Kg.prototype.open = function (a, b) {
yc.set("redirect_request_id", this.pc);
yc.set("redirect_request_id", this.pc);
b.requestId = this.pc;
b.redirectTo = b.redirectTo || window.location.href;
a += (/\?/.test(a) ? "" : "?") + kb(b);
window.location = a
};
Kg.isAvailable = function () {
return !zg() && !yg()
};
Kg.prototype.Cc = function () {
return "redirect"
};
var Lg = {
NETWORK_ERROR: "Unable to contact the Firebase server.",
SERVER_ERROR: "An unknown server error occurred.",
TRANSPORT_UNAVAILABLE: "There are no login transports available for the requested method.",
REQUEST_INTERRUPTED: "The browser redirected the page before the login request could complete.",
USER_CANCELLED: "The user cancelled authentication."
};
function Mg(a) {
var b = Error(w(Lg, a), a);
b.code = a;
return b
};
function Ng(a) {
var b;
(b = !a.window_features) || (b = xg(), b = -1 !== b.indexOf("Fennec/") || -1 !== b.indexOf("Firefox/") && -1 !== b.indexOf("Android"));
b && (a.window_features = void 0);
a.window_name || (a.window_name = "_blank");
this.options = a
}
Ng.prototype.open = function (a, b, c) {
function d(a) {
h && (document.body.removeChild(h), h = void 0);
t && (t = clearInterval(t));
Dg(window, "message", e);
Dg(window, "unload", d);
if (m && !a) try {
m.close()
} catch (b) {
k.postMessage("die", l)
}
m = k = void 0
}
function e(a) {
if (a.origin === l) try {
var b = nb(a.data);
"ready" === b.a ? k.postMessage(z, l) : "error" === b.a ? (d(!1), c && (c(b.d), c = null)) : "response" === b.a && (d(b.forceKeepWindowOpen), c && (c(null, b.d), c = null))
} catch (e) {}
}
var f = Ag(8),
h, k;
if (!this.options.relay_url) return c(Error("invalid arguments: origin of url and relay_url must match"));
var l = Eg(a);
if (l !== Eg(this.options.relay_url)) c && setTimeout(function () {
c(Error("invalid arguments: origin of url and relay_url must match"))
}, 0);
else {
f && (h = document.createElement("iframe"), h.setAttribute("src", this.options.relay_url), h.style.display = "none", h.setAttribute("name", "__winchan_relay_frame"), document.body.appendChild(h), k = h.contentWindow);
a += (/\?/.test(a) ? "" : "?") + kb(b);
var m = window.open(a, this.options.window_name, this.options.window_features);
k || (k = m);
var t = setInterval(function () {
m && m.closed &&
(d(!1), c && (c(Mg("USER_CANCELLED")), c = null))
}, 500),
z = B({
a: "request",
d: b
});
Cg(window, "unload", d);
Cg(window, "message", e)
}
};
Ng.isAvailable = function () {
var a;
if (a = "postMessage" in window && !zg())(a = yg() || "undefined" !== typeof navigator && (!!xg().match(/Windows Phone/) || !!window.Windows && /^ms-appx:/.test(location.href))) || (a = xg(), a = "undefined" !== typeof navigator && "undefined" !== typeof window && !!(a.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i) || a.match(/CriOS/) || a.match(/Twitter for iPhone/) || a.match(/FBAN\/FBIOS/) || window.navigator.standalone)), a = !a;
return a && !xg().match(/PhantomJS/)
};
Ng.prototype.Cc = function () {
return "popup"
};
function Og(a) {
a.method || (a.method = "GET");
a.headers || (a.headers = {});
a.headers.content_type || (a.headers.content_type = "application/json");
a.headers.content_type = a.headers.content_type.toLowerCase();
this.options = a
}
Og.prototype.open = function (a, b, c) {
function d() {
c && (c(Mg("REQUEST_INTERRUPTED")), c = null)
}
var e = new XMLHttpRequest,
f = this.options.method.toUpperCase(),
h;
Cg(window, "beforeunload", d);
e.onreadystatechange = function () {
if (c && 4 === e.readyState) {
var a;
if (200 <= e.status && 300 > e.status) {
try {
a = nb(e.responseText)
} catch (b) {}
c(null, a)
} else 500 <= e.status && 600 > e.status ? c(Mg("SERVER_ERROR")) : c(Mg("NETWORK_ERROR"));
c = null;
Dg(window, "beforeunload", d)
}
};
if ("GET" === f) a += (/\?/.test(a) ? "" : "?") + kb(b), h = null;
else {
var k = this.options.headers.content_type;
"application/json" === k && (h = B(b));
"application/x-www-form-urlencoded" === k && (h = kb(b))
}
e.open(f, a, !0);
a = {
"X-Requested-With": "XMLHttpRequest",
Accept: "application/json;text/plain"
};
za(a, this.options.headers);
for (var l in a) e.setRequestHeader(l, a[l]);
e.send(h)
};
Og.isAvailable = function () {
var a;
if (a = !!window.XMLHttpRequest) a = xg(), a = !(a.match(/MSIE/) || a.match(/Trident/)) || Ag(10);
return a
};
Og.prototype.Cc = function () {
return "json"
};
function Pg(a) {
this.pc = Ga() + Ga() + Ga();
this.Ef = a
}
Pg.prototype.open = function (a, b, c) {
function d() {
c && (c(Mg("USER_CANCELLED")), c = null)
}
var e = this,
f = Pc(sg),
h;
b.requestId = this.pc;
b.redirectTo = f.scheme + "://" + f.host + "/blank/page.html";
a += /\?/.test(a) ? "" : "?";
a += kb(b);
(h = window.open(a, "_blank", "location=no")) && ha(h.addEventListener) ? (h.addEventListener("loadstart", function (a) {
var b;
if (b = a && a.url) a: {
try {
var m = document.createElement("a");
m.href = a.url;
b = m.host === f.host && "/blank/page.html" === m.pathname;
break a
} catch (t) {}
b = !1
}
b && (a = Fg(a.url), h.removeEventListener("exit",
d), h.close(), a = new tg(null, null, {
requestId: e.pc,
requestKey: a
}), e.Ef.requestWithCredential("/auth/session", a, c), c = null)
}), h.addEventListener("exit", d)) : c(Mg("TRANSPORT_UNAVAILABLE"))
};
Pg.isAvailable = function () {
return yg()
};
Pg.prototype.Cc = function () {
return "redirect"
};
function Qg(a) {
a.callback_parameter || (a.callback_parameter = "callback");
this.options = a;
window.__firebase_auth_jsonp = window.__firebase_auth_jsonp || {}
}
Qg.prototype.open = function (a, b, c) {
function d() {
c && (c(Mg("REQUEST_INTERRUPTED")), c = null)
}
function e() {
setTimeout(function () {
window.__firebase_auth_jsonp[f] = void 0;
wa(window.__firebase_auth_jsonp) && (window.__firebase_auth_jsonp = void 0);
try {
var a = document.getElementById(f);
a && a.parentNode.removeChild(a)
} catch (b) {}
}, 1);
Dg(window, "beforeunload", d)
}
var f = "fn" + (new Date).getTime() + Math.floor(99999 * Math.random());
b[this.options.callback_parameter] = "__firebase_auth_jsonp." + f;
a += (/\?/.test(a) ? "" : "?") + kb(b);
Cg(window, "beforeunload", d);
window.__firebase_auth_jsonp[f] = function (a) {
c && (c(null, a), c = null);
e()
};
Rg(f, a, c)
};
function Rg(a, b, c) {
setTimeout(function () {
try {
var d = document.createElement("script");
d.type = "text/javascript";
d.id = a;
d.async = !0;
d.src = b;
d.onerror = function () {
var b = document.getElementById(a);
null !== b && b.parentNode.removeChild(b);
c && c(Mg("NETWORK_ERROR"))
};
var e = document.getElementsByTagName("head");
(e && 0 != e.length ? e[0] : document.documentElement).appendChild(d)
} catch (f) {
c && c(Mg("NETWORK_ERROR"))
}
}, 0)
}
Qg.isAvailable = function () {
return "undefined" !== typeof document && null != document.createElement
};
Qg.prototype.Cc = function () {
return "json"
};
function Sg(a, b, c, d) {
De.call(this, ["auth_status"]);
this.F = a;
this.df = b;
this.Vg = c;
this.Le = d;
this.sc = new wg(a, [xc, yc]);
this.mb = null;
this.Se = !1;
Tg(this)
}
ma(Sg, De);
g = Sg.prototype;
g.xe = function () {
return this.mb || null
};
function Tg(a) {
yc.get("redirect_request_id") && Ug(a);
var b = a.sc.get();
b && b.token ? (Vg(a, b), a.df(b.token, function (c, d) {
Wg(a, c, d, !1, b.token, b)
}, function (b, d) {
Xg(a, "resumeSession()", b, d)
})) : Vg(a, null)
}
function Yg(a, b, c, d, e, f) {
"firebaseio-demo.com" === a.F.domain && O("Firebase authentication is not supported on demo Firebases (*.firebaseio-demo.com). To secure your Firebase, create a production Firebase at https://www.firebase.com.");
a.df(b, function (f, k) {
Wg(a, f, k, !0, b, c, d || {}, e)
}, function (b, c) {
Xg(a, "auth()", b, c, f)
})
}
function Zg(a, b) {
a.sc.clear();
Vg(a, null);
a.Vg(function (a, d) {
if ("ok" === a) P(b, null);
else {
var e = (a || "error").toUpperCase(),
f = e;
d && (f += ": " + d);
f = Error(f);
f.code = e;
P(b, f)
}
})
}
function Wg(a, b, c, d, e, f, h, k) {
"ok" === b ? (d && (b = c.auth, f.auth = b, f.expires = c.expires, f.token = bd(e) ? e : "", c = null, b && v(b, "uid") ? c = w(b, "uid") : v(f, "uid") && (c = w(f, "uid")), f.uid = c, c = "custom", b && v(b, "provider") ? c = w(b, "provider") : v(f, "provider") && (c = w(f, "provider")), f.provider = c, a.sc.clear(), bd(e) && (h = h || {}, c = xc, "sessionOnly" === h.remember && (c = yc), "none" !== h.remember && a.sc.set(f, c)), Vg(a, f)), P(k, null, f)) : (a.sc.clear(), Vg(a, null), f = a = (b || "error").toUpperCase(), c && (f += ": " + c), f = Error(f), f.code = a, P(k, f))
}
function Xg(a, b, c, d, e) {
O(b + " was canceled: " + d);
a.sc.clear();
Vg(a, null);
a = Error(d);
a.code = c.toUpperCase();
P(e, a)
}
function $g(a, b, c, d, e) {
ah(a);
c = new tg(d || {}, {}, c || {});
bh(a, [Og, Qg], "/auth/" + b, c, e)
}
function ch(a, b, c, d) {
ah(a);
var e = [Ng, Pg];
c = vg(c);
"anonymous" === b || "password" === b ? setTimeout(function () {
P(d, Mg("TRANSPORT_UNAVAILABLE"))
}, 0) : (c.ee.window_features = "menubar=yes,modal=yes,alwaysRaised=yeslocation=yes,resizable=yes,scrollbars=yes,status=yes,height=625,width=625,top=" + ("object" === typeof screen ? .5 * (screen.height - 625) : 0) + ",left=" + ("object" === typeof screen ? .5 * (screen.width - 625) : 0), c.ee.relay_url = Hg(a.F.hc), c.ee.requestWithCredential = q(a.qc, a), bh(a, e, "/auth/" + b, c, d))
}
function Ug(a) {
var b = yc.get("redirect_request_id");
if (b) {
var c = yc.get("redirect_client_options");
yc.remove("redirect_request_id");
yc.remove("redirect_client_options");
var d = [Og, Qg],
b = {
requestId: b,
requestKey: Fg(document.location.hash)
},
c = new tg(c, {}, b);
a.Se = !0;
try {
document.location.hash = document.location.hash.replace(/&__firebase_request_key=([a-zA-z0-9]*)/, "")
} catch (e) {}
bh(a, d, "/auth/session", c, function () {
this.Se = !1
}.bind(a))
}
}
g.se = function (a, b) {
ah(this);
var c = vg(a);
c.$a._method = "POST";
this.qc("/users", c, function (a, c) {
a ? P(b, a) : P(b, a, c)
})
};
g.Te = function (a, b) {
var c = this;
ah(this);
var d = "/users/" + encodeURIComponent(a.email),
e = vg(a);
e.$a._method = "DELETE";
this.qc(d, e, function (a, d) {
!a && d && d.uid && c.mb && c.mb.uid && c.mb.uid === d.uid && Zg(c);
P(b, a)
})
};
g.pe = function (a, b) {
ah(this);
var c = "/users/" + encodeURIComponent(a.email) + "/password",
d = vg(a);
d.$a._method = "PUT";
d.$a.password = a.newPassword;
this.qc(c, d, function (a) {
P(b, a)
})
};
g.oe = function (a, b) {
ah(this);
var c = "/users/" + encodeURIComponent(a.oldEmail) + "/email",
d = vg(a);
d.$a._method = "PUT";
d.$a.email = a.newEmail;
d.$a.password = a.password;
this.qc(c, d, function (a) {
P(b, a)
})
};
g.Ve = function (a, b) {
ah(this);
var c = "/users/" + encodeURIComponent(a.email) + "/password",
d = vg(a);
d.$a._method = "POST";
this.qc(c, d, function (a) {
P(b, a)
})
};
g.qc = function (a, b, c) {
dh(this, [Og, Qg], a, b, c)
};
function bh(a, b, c, d, e) {
dh(a, b, c, d, function (b, c) {
!b && c && c.token && c.uid ? Yg(a, c.token, c, d.od, function (a, b) {
a ? P(e, a) : P(e, null, b)
}) : P(e, b || Mg("UNKNOWN_ERROR"))
})
}
function dh(a, b, c, d, e) {
b = Pa(b, function (a) {
return "function" === typeof a.isAvailable && a.isAvailable()
});
0 === b.length ? setTimeout(function () {
P(e, Mg("TRANSPORT_UNAVAILABLE"))
}, 0) : (b = new(b.shift())(d.ee), d = jb(d.$a), d.v = "js-" + hb, d.transport = b.Cc(), d.suppress_status_codes = !0, a = Gg() + "/" + a.F.hc + c, b.open(a, d, function (a, b) {
if (a) P(e, a);
else if (b && b.error) {
var c = Error(b.error.message);
c.code = b.error.code;
c.details = b.error.details;
P(e, c)
} else P(e, null, b)
}))
}
function Vg(a, b) {
var c = null !== a.mb || null !== b;
a.mb = b;
c && a.fe("auth_status", b);
a.Le(null !== b)
}
g.Ae = function (a) {
K("auth_status" === a, 'initial event must be of type "auth_status"');
return this.Se ? null : [this.mb]
};
function ah(a) {
var b = a.F;
if ("firebaseio.com" !== b.domain && "firebaseio-demo.com" !== b.domain && "auth.firebase.com" === sg) throw Error("This custom Firebase server ('" + a.F.domain + "') does not support delegated login.");
};
var Cc = "websocket",
Dc = "long_polling";
function eh(a) {
this.jc = a;
this.Nd = [];
this.Sb = 0;
this.qe = -1;
this.Fb = null
}
function fh(a, b, c) {
a.qe = b;
a.Fb = c;
a.qe < a.Sb && (a.Fb(), a.Fb = null)
}
function gh(a, b, c) {
for (a.Nd[b] = c; a.Nd[a.Sb];) {
var d = a.Nd[a.Sb];
delete a.Nd[a.Sb];
for (var e = 0; e < d.length; ++e)
if (d[e]) {
var f = a;
Db(function () {
f.jc(d[e])
})
}
if (a.Sb === a.qe) {
a.Fb && (clearTimeout(a.Fb), a.Fb(), a.Fb = null);
break
}
a.Sb++
}
};
function hh(a, b, c, d) {
this.re = a;
this.f = Mc(a);
this.nb = this.ob = 0;
this.Ua = Rb(b);
this.Qf = c;
this.Hc = !1;
this.Bb = d;
this.jd = function (a) {
return Bc(b, Dc, a)
}
}
var ih, jh;
hh.prototype.open = function (a, b) {
this.hf = 0;
this.la = b;
this.Af = new eh(a);
this.zb = !1;
var c = this;
this.qb = setTimeout(function () {
c.f("Timed out trying to connect.");
c.gb();
c.qb = null
}, Math.floor(3E4));
Rc(function () {
if (!c.zb) {
c.Sa = new kh(function (a, b, d, k, l) {
lh(c, arguments);
if (c.Sa)
if (c.qb && (clearTimeout(c.qb), c.qb = null), c.Hc = !0, "start" == a) c.id = b, c.Gf = d;
else if ("close" === a) b ? (c.Sa.Xd = !1, fh(c.Af, b, function () {
c.gb()
})) : c.gb();
else throw Error("Unrecognized command received: " + a);
}, function (a, b) {
lh(c, arguments);
gh(c.Af, a, b)
}, function () {
c.gb()
}, c.jd);
var a = {
start: "t"
};
a.ser = Math.floor(1E8 * Math.random());
c.Sa.he && (a.cb = c.Sa.he);
a.v = "5";
c.Qf && (a.s = c.Qf);
c.Bb && (a.ls = c.Bb);
"undefined" !== typeof location && location.href && -1 !== location.href.indexOf("firebaseio.com") && (a.r = "f");
a = c.jd(a);
c.f("Connecting via long-poll to " + a);
mh(c.Sa, a, function () {})
}
})
};
hh.prototype.start = function () {
var a = this.Sa,
b = this.Gf;
a.ug = this.id;
a.vg = b;
for (a.le = !0; nh(a););
a = this.id;
b = this.Gf;
this.gc = document.createElement("iframe");
var c = {
dframe: "t"
};
c.id = a;
c.pw = b;
this.gc.src = this.jd(c);
this.gc.style.display = "none";
document.body.appendChild(this.gc)
};
hh.isAvailable = function () {
return ih || !jh && "undefined" !== typeof document && null != document.createElement && !("object" === typeof window && window.chrome && window.chrome.extension && !/^chrome/.test(window.location.href)) && !("object" === typeof Windows && "object" === typeof Windows.Xg) && !0
};
g = hh.prototype;
g.Ed = function () {};
g.dd = function () {
this.zb = !0;
this.Sa && (this.Sa.close(), this.Sa = null);
this.gc && (document.body.removeChild(this.gc), this.gc = null);
this.qb && (clearTimeout(this.qb), this.qb = null)
};
g.gb = function () {
this.zb || (this.f("Longpoll is closing itself"), this.dd(), this.la && (this.la(this.Hc), this.la = null))
};
g.close = function () {
this.zb || (this.f("Longpoll is being closed."), this.dd())
};
g.send = function (a) {
a = B(a);
this.ob += a.length;
Ob(this.Ua, "bytes_sent", a.length);
a = Ic(a);
a = fb(a, !0);
a = Vc(a, 1840);
for (var b = 0; b < a.length; b++) {
var c = this.Sa;
c.ad.push({
Mg: this.hf,
Ug: a.length,
kf: a[b]
});
c.le && nh(c);
this.hf++
}
};
function lh(a, b) {
var c = B(b).length;
a.nb += c;
Ob(a.Ua, "bytes_received", c)
}
function kh(a, b, c, d) {
this.jd = d;
this.hb = c;
this.Pe = new pg;
this.ad = [];
this.te = Math.floor(1E8 * Math.random());
this.Xd = !0;
this.he = Ec();
window["pLPCommand" + this.he] = a;
window["pRTLPCB" + this.he] = b;
a = document.createElement("iframe");
a.style.display = "none";
if (document.body) {
document.body.appendChild(a);
try {
a.contentWindow.document || Cb("No IE domain setting required")
} catch (e) {
a.src = "javascript:void((function(){document.open();document.domain='" + document.domain + "';document.close();})())"
}
} else throw "Document body has not initialized. Wait to initialize Firebase until after the document is ready.";
a.contentDocument ? a.eb = a.contentDocument : a.contentWindow ? a.eb = a.contentWindow.document : a.document && (a.eb = a.document);
this.Ea = a;
a = "";
this.Ea.src && "javascript:" === this.Ea.src.substr(0, 11) && (a = '<script>document.domain="' + document.domain + '";\x3c/script>');
a = "<html><body>" + a + "</body></html>";
try {
this.Ea.eb.open(), this.Ea.eb.write(a), this.Ea.eb.close()
} catch (f) {
Cb("frame writing exception"), f.stack && Cb(f.stack), Cb(f)
}
}
kh.prototype.close = function () {
this.le = !1;
if (this.Ea) {
this.Ea.eb.body.innerHTML = "";
var a = this;
setTimeout(function () {
null !== a.Ea && (document.body.removeChild(a.Ea), a.Ea = null)
}, Math.floor(0))
}
var b = this.hb;
b && (this.hb = null, b())
};
function nh(a) {
if (a.le && a.Xd && a.Pe.count() < (0 < a.ad.length ? 2 : 1)) {
a.te++;
var b = {};
b.id = a.ug;
b.pw = a.vg;
b.ser = a.te;
for (var b = a.jd(b), c = "", d = 0; 0 < a.ad.length;)
if (1870 >= a.ad[0].kf.length + 30 + c.length) {
var e = a.ad.shift(),
c = c + "&seg" + d + "=" + e.Mg + "&ts" + d + "=" + e.Ug + "&d" + d + "=" + e.kf;
d++
} else break;
oh(a, b + c, a.te);
return !0
}
return !1
}
function oh(a, b, c) {
function d() {
a.Pe.remove(c);
nh(a)
}
a.Pe.add(c, 1);
var e = setTimeout(d, Math.floor(25E3));
mh(a, b, function () {
clearTimeout(e);
d()
})
}
function mh(a, b, c) {
setTimeout(function () {
try {
if (a.Xd) {
var d = a.Ea.eb.createElement("script");
d.type = "text/javascript";
d.async = !0;
d.src = b;
d.onload = d.onreadystatechange = function () {
var a = d.readyState;
a && "loaded" !== a && "complete" !== a || (d.onload = d.onreadystatechange = null, d.parentNode && d.parentNode.removeChild(d), c())
};
d.onerror = function () {
Cb("Long-poll script failed to load: " + b);
a.Xd = !1;
a.close()
};
a.Ea.eb.body.appendChild(d)
}
} catch (e) {}
}, Math.floor(1))
};
var ph = null;
"undefined" !== typeof MozWebSocket ? ph = MozWebSocket : "undefined" !== typeof WebSocket && (ph = WebSocket);
function qh(a, b, c, d) {
this.re = a;
this.f = Mc(this.re);
this.frames = this.Kc = null;
this.nb = this.ob = this.bf = 0;
this.Ua = Rb(b);
a = {
v: "5"
};
"undefined" !== typeof location && location.href && -1 !== location.href.indexOf("firebaseio.com") && (a.r = "f");
c && (a.s = c);
d && (a.ls = d);
this.ef = Bc(b, Cc, a)
}
var rh;
qh.prototype.open = function (a, b) {
this.hb = b;
this.zg = a;
this.f("Websocket connecting to " + this.ef);
this.Hc = !1;
xc.set("previous_websocket_failure", !0);
try {
this.ua = new ph(this.ef)
} catch (c) {
this.f("Error instantiating WebSocket.");
var d = c.message || c.data;
d && this.f(d);
this.gb();
return
}
var e = this;
this.ua.onopen = function () {
e.f("Websocket connected.");
e.Hc = !0
};
this.ua.onclose = function () {
e.f("Websocket connection was disconnected.");
e.ua = null;
e.gb()
};
this.ua.onmessage = function (a) {
if (null !== e.ua)
if (a = a.data, e.nb +=
a.length, Ob(e.Ua, "bytes_received", a.length), sh(e), null !== e.frames) th(e, a);
else {
a: {
K(null === e.frames, "We already have a frame buffer");
if (6 >= a.length) {
var b = Number(a);
if (!isNaN(b)) {
e.bf = b;
e.frames = [];
a = null;
break a
}
}
e.bf = 1;
e.frames = []
}
null !== a && th(e, a)
}
};
this.ua.onerror = function (a) {
e.f("WebSocket error. Closing connection.");
(a = a.message || a.data) && e.f(a);
e.gb()
}
};
qh.prototype.start = function () {};
qh.isAvailable = function () {
var a = !1;
if ("undefined" !== typeof navigator && navigator.userAgent) {
var b = navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);
b && 1 < b.length && 4.4 > parseFloat(b[1]) && (a = !0)
}
return !a && null !== ph && !rh
};
qh.responsesRequiredToBeHealthy = 2;
qh.healthyTimeout = 3E4;
g = qh.prototype;
g.Ed = function () {
xc.remove("previous_websocket_failure")
};
function th(a, b) {
a.frames.push(b);
if (a.frames.length == a.bf) {
var c = a.frames.join("");
a.frames = null;
c = nb(c);
a.zg(c)
}
}
g.send = function (a) {
sh(this);
a = B(a);
this.ob += a.length;
Ob(this.Ua, "bytes_sent", a.length);
a = Vc(a, 16384);
1 < a.length && this.ua.send(String(a.length));
for (var b = 0; b < a.length; b++) this.ua.send(a[b])
};
g.dd = function () {
this.zb = !0;
this.Kc && (clearInterval(this.Kc), this.Kc = null);
this.ua && (this.ua.close(), this.ua = null)
};
g.gb = function () {
this.zb || (this.f("WebSocket is closing itself"), this.dd(), this.hb && (this.hb(this.Hc), this.hb = null))
};
g.close = function () {
this.zb || (this.f("WebSocket is being closed"), this.dd())
};
function sh(a) {
clearInterval(a.Kc);
a.Kc = setInterval(function () {
a.ua && a.ua.send("0");
sh(a)
}, Math.floor(45E3))
};
function uh(a) {
vh(this, a)
}
var wh = [hh, qh];
function vh(a, b) {
var c = qh && qh.isAvailable(),
d = c && !(xc.wf || !0 === xc.get("previous_websocket_failure"));
b.Wg && (c || O("wss:// URL used, but browser isn't known to support websockets. Trying anyway."), d = !0);
if (d) a.gd = [qh];
else {
var e = a.gd = [];
Wc(wh, function (a, b) {
b && b.isAvailable() && e.push(b)
})
}
}
function xh(a) {
if (0 < a.gd.length) return a.gd[0];
throw Error("No transports available");
};
function yh(a, b, c, d, e, f, h) {
this.id = a;
this.f = Mc("c:" + this.id + ":");
this.jc = c;
this.Wc = d;
this.la = e;
this.Ne = f;
this.F = b;
this.Md = [];
this.ff = 0;
this.Pf = new uh(b);
this.Ta = 0;
this.Bb = h;
this.f("Connection created");
zh(this)
}
function zh(a) {
var b = xh(a.Pf);
a.J = new b("c:" + a.id + ":" + a.ff++, a.F, void 0, a.Bb);
a.Re = b.responsesRequiredToBeHealthy || 0;
var c = Ah(a, a.J),
d = Bh(a, a.J);
a.hd = a.J;
a.cd = a.J;
a.D = null;
a.Ab = !1;
setTimeout(function () {
a.J && a.J.open(c, d)
}, Math.floor(0));
b = b.healthyTimeout || 0;
0 < b && (a.yd = setTimeout(function () {
a.yd = null;
a.Ab || (a.J && 102400 < a.J.nb ? (a.f("Connection exceeded healthy timeout but has received " + a.J.nb + " bytes. Marking connection healthy."), a.Ab = !0, a.J.Ed()) : a.J && 10240 < a.J.ob ? a.f("Connection exceeded healthy timeout but has sent " +
a.J.ob + " bytes. Leaving connection alive.") : (a.f("Closing unhealthy connection after timeout."), a.close()))
}, Math.floor(b)))
}
function Bh(a, b) {
return function (c) {
b === a.J ? (a.J = null, c || 0 !== a.Ta ? 1 === a.Ta && a.f("Realtime connection lost.") : (a.f("Realtime connection failed."), "s-" === a.F.Ya.substr(0, 2) && (xc.remove("host:" + a.F.host), a.F.Ya = a.F.host)), a.close()) : b === a.D ? (a.f("Secondary connection lost."), c = a.D, a.D = null, a.hd !== c && a.cd !== c || a.close()) : a.f("closing an old connection")
}
}
function Ah(a, b) {
return function (c) {
if (2 != a.Ta)
if (b === a.cd) {
var d = Tc("t", c);
c = Tc("d", c);
if ("c" == d) {
if (d = Tc("t", c), "d" in c)
if (c = c.d, "h" === d) {
var d = c.ts,
e = c.v,
f = c.h;
a.Nf = c.s;
Ac(a.F, f);
0 == a.Ta && (a.J.start(), Ch(a, a.J, d), "5" !== e && O("Protocol version mismatch detected"), c = a.Pf, (c = 1 < c.gd.length ? c.gd[1] : null) && Dh(a, c))
} else if ("n" === d) {
a.f("recvd end transmission on primary");
a.cd = a.D;
for (c = 0; c < a.Md.length; ++c) a.Id(a.Md[c]);
a.Md = [];
Eh(a)
} else "s" === d ? (a.f("Connection shutdown command received. Shutting down..."),
a.Ne && (a.Ne(c), a.Ne = null), a.la = null, a.close()) : "r" === d ? (a.f("Reset packet received. New host: " + c), Ac(a.F, c), 1 === a.Ta ? a.close() : (Fh(a), zh(a))) : "e" === d ? Nc("Server Error: " + c) : "o" === d ? (a.f("got pong on primary."), Gh(a), Hh(a)) : Nc("Unknown control packet command: " + d)
} else "d" == d && a.Id(c)
} else if (b === a.D)
if (d = Tc("t", c), c = Tc("d", c), "c" == d) "t" in c && (c = c.t, "a" === c ? Ih(a) : "r" === c ? (a.f("Got a reset on secondary, closing it"), a.D.close(), a.hd !== a.D && a.cd !== a.D || a.close()) : "o" === c && (a.f("got pong on secondary."),
a.Mf--, Ih(a)));
else if ("d" == d) a.Md.push(c);
else throw Error("Unknown protocol layer: " + d);
else a.f("message on old connection")
}
}
yh.prototype.Fa = function (a) {
Jh(this, {
t: "d",
d: a
})
};
function Eh(a) {
a.hd === a.D && a.cd === a.D && (a.f("cleaning up and promoting a connection: " + a.D.re), a.J = a.D, a.D = null)
}
function Ih(a) {
0 >= a.Mf ? (a.f("Secondary connection is healthy."), a.Ab = !0, a.D.Ed(), a.D.start(), a.f("sending client ack on secondary"), a.D.send({
t: "c",
d: {
t: "a",
d: {}
}
}), a.f("Ending transmission on primary"), a.J.send({
t: "c",
d: {
t: "n",
d: {}
}
}), a.hd = a.D, Eh(a)) : (a.f("sending ping on secondary."), a.D.send({
t: "c",
d: {
t: "p",
d: {}
}
}))
}
yh.prototype.Id = function (a) {
Gh(this);
this.jc(a)
};
function Gh(a) {
a.Ab || (a.Re--, 0 >= a.Re && (a.f("Primary connection is healthy."), a.Ab = !0, a.J.Ed()))
}
function Dh(a, b) {
a.D = new b("c:" + a.id + ":" + a.ff++, a.F, a.Nf);
a.Mf = b.responsesRequiredToBeHealthy || 0;
a.D.open(Ah(a, a.D), Bh(a, a.D));
setTimeout(function () {
a.D && (a.f("Timed out trying to upgrade."), a.D.close())
}, Math.floor(6E4))
}
function Ch(a, b, c) {
a.f("Realtime connection established.");
a.J = b;
a.Ta = 1;
a.Wc && (a.Wc(c, a.Nf), a.Wc = null);
0 === a.Re ? (a.f("Primary connection is healthy."), a.Ab = !0) : setTimeout(function () {
Hh(a)
}, Math.floor(5E3))
}
function Hh(a) {
a.Ab || 1 !== a.Ta || (a.f("sending ping on primary."), Jh(a, {
t: "c",
d: {
t: "p",
d: {}
}
}))
}
function Jh(a, b) {
if (1 !== a.Ta) throw "Connection is not connected";
a.hd.send(b)
}
yh.prototype.close = function () {
2 !== this.Ta && (this.f("Closing realtime connection."), this.Ta = 2, Fh(this), this.la && (this.la(), this.la = null))
};
function Fh(a) {
a.f("Shutting down all connections");
a.J && (a.J.close(), a.J = null);
a.D && (a.D.close(), a.D = null);
a.yd && (clearTimeout(a.yd), a.yd = null)
};
function Kh(a, b, c, d) {
this.id = Lh++;
this.f = Mc("p:" + this.id + ":");
this.xf = this.Ee = !1;
this.$ = {};
this.qa = [];
this.Yc = 0;
this.Vc = [];
this.oa = !1;
this.Za = 1E3;
this.Fd = 3E5;
this.Gb = b;
this.Uc = c;
this.Oe = d;
this.F = a;
this.sb = this.Aa = this.Ia = this.Bb = this.We = null;
this.Ob = !1;
this.Td = {};
this.Lg = 0;
this.nf = !0;
this.Lc = this.Ge = null;
Mh(this, 0);
He.ub().Eb("visible", this.Cg, this); - 1 === a.host.indexOf("fblocal") && Ge.ub().Eb("online", this.Ag, this)
}
var Lh = 0,
Nh = 0;
g = Kh.prototype;
g.Fa = function (a, b, c) {
var d = ++this.Lg;
a = {
r: d,
a: a,
b: b
};
this.f(B(a));
K(this.oa, "sendRequest call when we're not connected not allowed.");
this.Ia.Fa(a);
c && (this.Td[d] = c)
};
g.yf = function (a, b, c, d) {
var e = a.va(),
f = a.path.toString();
this.f("Listen called for " + f + " " + e);
this.$[f] = this.$[f] || {};
K(fe(a.n) || !S(a.n), "listen() called for non-default but complete query");
K(!this.$[f][e], "listen() called twice for same path/queryId.");
a = {
H: d,
xd: b,
Ig: a,
tag: c
};
this.$[f][e] = a;
this.oa && Oh(this, a)
};
function Oh(a, b) {
var c = b.Ig,
d = c.path.toString(),
e = c.va();
a.f("Listen on " + d + " for " + e);
var f = {
p: d
};
b.tag && (f.q = ee(c.n), f.t = b.tag);
f.h = b.xd();
a.Fa("q", f, function (f) {
var k = f.d,
l = f.s;
if (k && "object" === typeof k && v(k, "w")) {
var m = w(k, "w");
ea(m) && 0 <= Na(m, "no_index") && O("Using an unspecified index. Consider adding " + ('".indexOn": "' + c.n.g.toString() + '"') + " at " + c.path.toString() + " to your security rules for better performance")
}(a.$[d] && a.$[d][e]) === b && (a.f("listen response", f), "ok" !== l && Ph(a, d, e), b.H && b.H(l,
k))
})
}
g.M = function (a, b, c) {
this.Aa = {
ig: a,
of: !1,
zc: b,
md: c
};
this.f("Authenticating using credential: " + a);
Qh(this);
(b = 40 == a.length) || (a = $c(a).Bc, b = "object" === typeof a && !0 === w(a, "admin"));
b && (this.f("Admin auth credential detected. Reducing max reconnect time."), this.Fd = 3E4)
};
g.ge = function (a) {
delete this.Aa;
this.oa && this.Fa("unauth", {}, function (b) {
a(b.s, b.d)
})
};
function Qh(a) {
var b = a.Aa;
a.oa && b && a.Fa("auth", {
cred: b.ig
}, function (c) {
var d = c.s;
c = c.d || "error";
"ok" !== d && a.Aa === b && delete a.Aa;
b.of ? "ok" !== d && b.md && b.md(d, c) : (b.of = !0, b.zc && b.zc(d, c))
})
}
g.Rf = function (a, b) {
var c = a.path.toString(),
d = a.va();
this.f("Unlisten called for " + c + " " + d);
K(fe(a.n) || !S(a.n), "unlisten() called for non-default but complete query");
if (Ph(this, c, d) && this.oa) {
var e = ee(a.n);
this.f("Unlisten on " + c + " for " + d);
c = {
p: c
};
b && (c.q = e, c.t = b);
this.Fa("n", c)
}
};
g.Me = function (a, b, c) {
this.oa ? Rh(this, "o", a, b, c) : this.Vc.push({
$c: a,
action: "o",
data: b,
H: c
})
};
g.Cf = function (a, b, c) {
this.oa ? Rh(this, "om", a, b, c) : this.Vc.push({
$c: a,
action: "om",
data: b,
H: c
})
};
g.Jd = function (a, b) {
this.oa ? Rh(this, "oc", a, null, b) : this.Vc.push({
$c: a,
action: "oc",
data: null,
H: b
})
};
function Rh(a, b, c, d, e) {
c = {
p: c,
d: d
};
a.f("onDisconnect " + b, c);
a.Fa(b, c, function (a) {
e && setTimeout(function () {
e(a.s, a.d)
}, Math.floor(0))
})
}
g.put = function (a, b, c, d) {
Sh(this, "p", a, b, c, d)
};
g.zf = function (a, b, c, d) {
Sh(this, "m", a, b, c, d)
};
function Sh(a, b, c, d, e, f) {
d = {
p: c,
d: d
};
n(f) && (d.h = f);
a.qa.push({
action: b,
Jf: d,
H: e
});
a.Yc++;
b = a.qa.length - 1;
a.oa ? Th(a, b) : a.f("Buffering put: " + c)
}
function Th(a, b) {
var c = a.qa[b].action,
d = a.qa[b].Jf,
e = a.qa[b].H;
a.qa[b].Jg = a.oa;
a.Fa(c, d, function (d) {
a.f(c + " response", d);
delete a.qa[b];
a.Yc--;
0 === a.Yc && (a.qa = []);
e && e(d.s, d.d)
})
}
g.Ue = function (a) {
this.oa && (a = {
c: a
}, this.f("reportStats", a), this.Fa("s", a, function (a) {
"ok" !== a.s && this.f("reportStats", "Error sending stats: " + a.d)
}))
};
g.Id = function (a) {
if ("r" in a) {
this.f("from server: " + B(a));
var b = a.r,
c = this.Td[b];
c && (delete this.Td[b], c(a.b))
} else {
if ("error" in a) throw "A server-side error has occurred: " + a.error;
"a" in a && (b = a.a, c = a.b, this.f("handleServerMessage", b, c), "d" === b ? this.Gb(c.p, c.d, !1, c.t) : "m" === b ? this.Gb(c.p, c.d, !0, c.t) : "c" === b ? Uh(this, c.p, c.q) : "ac" === b ? (a = c.s, b = c.d, c = this.Aa, delete this.Aa, c && c.md && c.md(a, b)) : "sd" === b ? this.We ? this.We(c) : "msg" in c && "undefined" !== typeof console && console.log("FIREBASE: " + c.msg.replace("\n",
"\nFIREBASE: ")) : Nc("Unrecognized action received from server: " + B(b) + "\nAre you using the latest client?"))
}
};
g.Wc = function (a, b) {
this.f("connection ready");
this.oa = !0;
this.Lc = (new Date).getTime();
this.Oe({
serverTimeOffset: a - (new Date).getTime()
});
this.Bb = b;
if (this.nf) {
var c = {};
c["sdk.js." + hb.replace(/\./g, "-")] = 1;
yg() && (c["framework.cordova"] = 1);
this.Ue(c)
}
Vh(this);
this.nf = !1;
this.Uc(!0)
};
function Mh(a, b) {
K(!a.Ia, "Scheduling a connect when we're already connected/ing?");
a.sb && clearTimeout(a.sb);
a.sb = setTimeout(function () {
a.sb = null;
Wh(a)
}, Math.floor(b))
}
g.Cg = function (a) {
a && !this.Ob && this.Za === this.Fd && (this.f("Window became visible. Reducing delay."), this.Za = 1E3, this.Ia || Mh(this, 0));
this.Ob = a
};
g.Ag = function (a) {
a ? (this.f("Browser went online."), this.Za = 1E3, this.Ia || Mh(this, 0)) : (this.f("Browser went offline. Killing connection."), this.Ia && this.Ia.close())
};
g.Df = function () {
this.f("data client disconnected");
this.oa = !1;
this.Ia = null;
for (var a = 0; a < this.qa.length; a++) {
var b = this.qa[a];
b && "h" in b.Jf && b.Jg && (b.H && b.H("disconnect"), delete this.qa[a], this.Yc--)
}
0 === this.Yc && (this.qa = []);
this.Td = {};
Xh(this) && (this.Ob ? this.Lc && (3E4 < (new Date).getTime() - this.Lc && (this.Za = 1E3), this.Lc = null) : (this.f("Window isn't visible. Delaying reconnect."), this.Za = this.Fd, this.Ge = (new Date).getTime()), a = Math.max(0, this.Za - ((new Date).getTime() - this.Ge)), a *= Math.random(), this.f("Trying to reconnect in " +
a + "ms"), Mh(this, a), this.Za = Math.min(this.Fd, 1.3 * this.Za));
this.Uc(!1)
};
function Wh(a) {
if (Xh(a)) {
a.f("Making a connection attempt");
a.Ge = (new Date).getTime();
a.Lc = null;
var b = q(a.Id, a),
c = q(a.Wc, a),
d = q(a.Df, a),
e = a.id + ":" + Nh++;
a.Ia = new yh(e, a.F, b, c, d, function (b) {
O(b + " (" + a.F.toString() + ")");
a.xf = !0
}, a.Bb)
}
}
g.yb = function () {
this.Ee = !0;
this.Ia ? this.Ia.close() : (this.sb && (clearTimeout(this.sb), this.sb = null), this.oa && this.Df())
};
g.rc = function () {
this.Ee = !1;
this.Za = 1E3;
this.Ia || Mh(this, 0)
};
function Uh(a, b, c) {
c = c ? Qa(c, function (a) {
return Uc(a)
}).join("$") : "default";
(a = Ph(a, b, c)) && a.H && a.H("permission_denied")
}
function Ph(a, b, c) {
b = (new L(b)).toString();
var d;
n(a.$[b]) ? (d = a.$[b][c], delete a.$[b][c], 0 === pa(a.$[b]) && delete a.$[b]) : d = void 0;
return d
}
function Vh(a) {
Qh(a);
r(a.$, function (b) {
r(b, function (b) {
Oh(a, b)
})
});
for (var b = 0; b < a.qa.length; b++) a.qa[b] && Th(a, b);
for (; a.Vc.length;) b = a.Vc.shift(), Rh(a, b.action, b.$c, b.data, b.H)
}
function Xh(a) {
var b;
b = Ge.ub().kc;
return !a.xf && !a.Ee && b
};
var V = {
og: function () {
ih = rh = !0
}
};
V.forceLongPolling = V.og;
V.pg = function () {
jh = !0
};
V.forceWebSockets = V.pg;
V.Pg = function (a, b) {
a.k.Ra.We = b
};
V.setSecurityDebugCallback = V.Pg;
V.Ye = function (a, b) {
a.k.Ye(b)
};
V.stats = V.Ye;
V.Ze = function (a, b) {
a.k.Ze(b)
};
V.statsIncrementCounter = V.Ze;
V.sd = function (a) {
return a.k.sd
};
V.dataUpdateCount = V.sd;
V.sg = function (a, b) {
a.k.De = b
};
V.interceptServerData = V.sg;
V.yg = function (a) {
new Ig(a)
};
V.onPopupOpen = V.yg;
V.Ng = function (a) {
sg = a
};
V.setAuthenticationServer = V.Ng;
function Q(a, b, c) {
this.A = a;
this.W = b;
this.g = c
}
Q.prototype.I = function () {
x("Firebase.DataSnapshot.val", 0, 0, arguments.length);
return this.A.I()
};
Q.prototype.val = Q.prototype.I;
Q.prototype.mf = function () {
x("Firebase.DataSnapshot.exportVal", 0, 0, arguments.length);
return this.A.I(!0)
};
Q.prototype.exportVal = Q.prototype.mf;
Q.prototype.ng = function () {
x("Firebase.DataSnapshot.exists", 0, 0, arguments.length);
return !this.A.e()
};
Q.prototype.exists = Q.prototype.ng;
Q.prototype.u = function (a) {
x("Firebase.DataSnapshot.child", 0, 1, arguments.length);
ga(a) && (a = String(a));
ig("Firebase.DataSnapshot.child", a);
var b = new L(a),
c = this.W.u(b);
return new Q(this.A.Q(b), c, N)
};
Q.prototype.child = Q.prototype.u;
Q.prototype.Da = function (a) {
x("Firebase.DataSnapshot.hasChild", 1, 1, arguments.length);
ig("Firebase.DataSnapshot.hasChild", a);
var b = new L(a);
return !this.A.Q(b).e()
};
Q.prototype.hasChild = Q.prototype.Da;
Q.prototype.C = function () {
x("Firebase.DataSnapshot.getPriority", 0, 0, arguments.length);
return this.A.C().I()
};
Q.prototype.getPriority = Q.prototype.C;
Q.prototype.forEach = function (a) {
x("Firebase.DataSnapshot.forEach", 1, 1, arguments.length);
A("Firebase.DataSnapshot.forEach", 1, a, !1);
if (this.A.K()) return !1;
var b = this;
return !!this.A.P(this.g, function (c, d) {
return a(new Q(d, b.W.u(c), N))
})
};
Q.prototype.forEach = Q.prototype.forEach;
Q.prototype.wd = function () {
x("Firebase.DataSnapshot.hasChildren", 0, 0, arguments.length);
return this.A.K() ? !1 : !this.A.e()
};
Q.prototype.hasChildren = Q.prototype.wd;
Q.prototype.name = function () {
O("Firebase.DataSnapshot.name() being deprecated. Please use Firebase.DataSnapshot.key() instead.");
x("Firebase.DataSnapshot.name", 0, 0, arguments.length);
return this.key()
};
Q.prototype.name = Q.prototype.name;
Q.prototype.key = function () {
x("Firebase.DataSnapshot.key", 0, 0, arguments.length);
return this.W.key()
};
Q.prototype.key = Q.prototype.key;
Q.prototype.Db = function () {
x("Firebase.DataSnapshot.numChildren", 0, 0, arguments.length);
return this.A.Db()
};
Q.prototype.numChildren = Q.prototype.Db;
Q.prototype.Ib = function () {
x("Firebase.DataSnapshot.ref", 0, 0, arguments.length);
return this.W
};
Q.prototype.ref = Q.prototype.Ib;
function Yh(a, b) {
this.F = a;
this.Ua = Rb(a);
this.fd = null;
this.da = new vb;
this.Hd = 1;
this.Ra = null;
b || 0 <= ("object" === typeof window && window.navigator && window.navigator.userAgent || "").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i) ? (this.ba = new Ae(this.F, q(this.Gb, this)), setTimeout(q(this.Uc, this, !0), 0)) : this.ba = this.Ra = new Kh(this.F, q(this.Gb, this), q(this.Uc, this), q(this.Oe, this));
this.Sg = Sb(a, q(function () {
return new Mb(this.Ua, this.ba)
}, this));
this.uc = new Rf;
this.Ce = new ob;
var c = this;
this.Cd = new vf({
Xe: function (a, b, f, h) {
b = [];
f = c.Ce.j(a.path);
f.e() || (b = xf(c.Cd, new Xb(bf, a.path, f)), setTimeout(function () {
h("ok")
}, 0));
return b
},
ae: ba
});
Zh(this, "connected", !1);
this.la = new qc;
this.M = new Sg(a, q(this.ba.M, this.ba), q(this.ba.ge, this.ba), q(this.Le, this));
this.sd = 0;
this.De = null;
this.L = new vf({
Xe: function (a, b, f, h) {
c.ba.yf(a, f, b, function (b, e) {
var f = h(b, e);
Ab(c.da, a.path, f)
});
return []
},
ae: function (a, b) {
c.ba.Rf(a, b)
}
})
}
g = Yh.prototype;
g.toString = function () {
return (this.F.kb ? "https://" : "http://") + this.F.host
};
g.name = function () {
return this.F.hc
};
function $h(a) {
a = a.Ce.j(new L(".info/serverTimeOffset")).I() || 0;
return (new Date).getTime() + a
}
function ai(a) {
a = a = {
timestamp: $h(a)
};
a.timestamp = a.timestamp || (new Date).getTime();
return a
}
g.Gb = function (a, b, c, d) {
this.sd++;
var e = new L(a);
b = this.De ? this.De(a, b) : b;
a = [];
d ? c ? (b = na(b, function (a) {
return M(a)
}), a = Ff(this.L, e, b, d)) : (b = M(b), a = Bf(this.L, e, b, d)) : c ? (d = na(b, function (a) {
return M(a)
}), a = Af(this.L, e, d)) : (d = M(b), a = xf(this.L, new Xb(bf, e, d)));
d = e;
0 < a.length && (d = bi(this, e));
Ab(this.da, d, a)
};
g.Uc = function (a) {
Zh(this, "connected", a);
!1 === a && ci(this)
};
g.Oe = function (a) {
var b = this;
Wc(a, function (a, d) {
Zh(b, d, a)
})
};
g.Le = function (a) {
Zh(this, "authenticated", a)
};
function Zh(a, b, c) {
b = new L("/.info/" + b);
c = M(c);
var d = a.Ce;
d.Wd = d.Wd.G(b, c);
c = xf(a.Cd, new Xb(bf, b, c));
Ab(a.da, b, c)
}
g.Kb = function (a, b, c, d) {
this.f("set", {
path: a.toString(),
value: b,
$g: c
});
var e = ai(this);
b = M(b, c);
var e = sc(b, e),
f = this.Hd++,
e = wf(this.L, a, e, f, !0);
wb(this.da, e);
var h = this;
this.ba.put(a.toString(), b.I(!0), function (b, c) {
var e = "ok" === b;
e || O("set at " + a + " failed: " + b);
e = zf(h.L, f, !e);
Ab(h.da, a, e);
di(d, b, c)
});
e = ei(this, a);
bi(this, e);
Ab(this.da, e, [])
};
g.update = function (a, b, c) {
this.f("update", {
path: a.toString(),
value: b
});
var d = !0,
e = ai(this),
f = {};
r(b, function (a, b) {
d = !1;
var c = M(a);
f[b] = sc(c, e)
});
if (d) Cb("update() called with empty data. Don't do anything."), di(c, "ok");
else {
var h = this.Hd++,
k = yf(this.L, a, f, h);
wb(this.da, k);
var l = this;
this.ba.zf(a.toString(), b, function (b, d) {
var e = "ok" === b;
e || O("update at " + a + " failed: " + b);
var e = zf(l.L, h, !e),
f = a;
0 < e.length && (f = bi(l, a));
Ab(l.da, f, e);
di(c, b, d)
});
b = ei(this, a);
bi(this, b);
Ab(this.da, a, [])
}
};
function ci(a) {
a.f("onDisconnectEvents");
var b = ai(a),
c = [];
rc(pc(a.la, b), G, function (b, e) {
c = c.concat(xf(a.L, new Xb(bf, b, e)));
var f = ei(a, b);
bi(a, f)
});
a.la = new qc;
Ab(a.da, G, c)
}
g.Jd = function (a, b) {
var c = this;
this.ba.Jd(a.toString(), function (d, e) {
"ok" === d && rg(c.la, a);
di(b, d, e)
})
};
function fi(a, b, c, d) {
var e = M(c);
a.ba.Me(b.toString(), e.I(!0), function (c, h) {
"ok" === c && a.la.nc(b, e);
di(d, c, h)
})
}
function gi(a, b, c, d, e) {
var f = M(c, d);
a.ba.Me(b.toString(), f.I(!0), function (c, d) {
"ok" === c && a.la.nc(b, f);
di(e, c, d)
})
}
function hi(a, b, c, d) {
var e = !0,
f;
for (f in c) e = !1;
e ? (Cb("onDisconnect().update() called with empty data. Don't do anything."), di(d, "ok")) : a.ba.Cf(b.toString(), c, function (e, f) {
if ("ok" === e)
for (var l in c) {
var m = M(c[l]);
a.la.nc(b.u(l), m)
}
di(d, e, f)
})
}
function ii(a, b, c) {
c = ".info" === E(b.path) ? a.Cd.Pb(b, c) : a.L.Pb(b, c);
yb(a.da, b.path, c)
}
g.yb = function () {
this.Ra && this.Ra.yb()
};
g.rc = function () {
this.Ra && this.Ra.rc()
};
g.Ye = function (a) {
if ("undefined" !== typeof console) {
a ? (this.fd || (this.fd = new Lb(this.Ua)), a = this.fd.get()) : a = this.Ua.get();
var b = Ra(sa(a), function (a, b) {
return Math.max(b.length, a)
}, 0),
c;
for (c in a) {
for (var d = a[c], e = c.length; e < b + 2; e++) c += " ";
console.log(c + d)
}
}
};
g.Ze = function (a) {
Ob(this.Ua, a);
this.Sg.Of[a] = !0
};
g.f = function (a) {
var b = "";
this.Ra && (b = this.Ra.id + ":");
Cb(b, arguments)
};
function di(a, b, c) {
a && Db(function () {
if ("ok" == b) a(null);
else {
var d = (b || "error").toUpperCase(),
e = d;
c && (e += ": " + c);
e = Error(e);
e.code = d;
a(e)
}
})
};
function ji(a, b, c, d, e) {
function f() {}
a.f("transaction on " + b);
var h = new U(a, b);
h.Eb("value", f);
c = {
path: b,
update: c,
H: d,
status: null,
Ff: Ec(),
cf: e,
Lf: 0,
ie: function () {
h.ic("value", f)
},
ke: null,
Ba: null,
pd: null,
qd: null,
rd: null
};
d = a.L.za(b, void 0) || C;
c.pd = d;
d = c.update(d.I());
if (n(d)) {
cg("transaction failed: Data returned ", d, c.path);
c.status = 1;
e = Sf(a.uc, b);
var k = e.Ca() || [];
k.push(c);
Tf(e, k);
"object" === typeof d && null !== d && v(d, ".priority") ? (k = w(d, ".priority"), K(ag(k), "Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")) :
k = (a.L.za(b) || C).C().I();
e = ai(a);
d = M(d, k);
e = sc(d, e);
c.qd = d;
c.rd = e;
c.Ba = a.Hd++;
c = wf(a.L, b, e, c.Ba, c.cf);
Ab(a.da, b, c);
ki(a)
} else c.ie(), c.qd = null, c.rd = null, c.H && (a = new Q(c.pd, new U(a, c.path), N), c.H(null, !1, a))
}
function ki(a, b) {
var c = b || a.uc;
b || li(a, c);
if (null !== c.Ca()) {
var d = mi(a, c);
K(0 < d.length, "Sending zero length transaction queue");
Sa(d, function (a) {
return 1 === a.status
}) && ni(a, c.path(), d)
} else c.wd() && c.P(function (b) {
ki(a, b)
})
}
function ni(a, b, c) {
for (var d = Qa(c, function (a) {
return a.Ba
}), e = a.L.za(b, d) || C, d = e, e = e.hash(), f = 0; f < c.length; f++) {
var h = c[f];
K(1 === h.status, "tryToSendTransactionQueue_: items in queue should all be run.");
h.status = 2;
h.Lf++;
var k = T(b, h.path),
d = d.G(k, h.qd)
}
d = d.I(!0);
a.ba.put(b.toString(), d, function (d) {
a.f("transaction put response", {
path: b.toString(),
status: d
});
var e = [];
if ("ok" === d) {
d = [];
for (f = 0; f < c.length; f++) {
c[f].status = 3;
e = e.concat(zf(a.L, c[f].Ba));
if (c[f].H) {
var h = c[f].rd,
k = new U(a, c[f].path);
d.push(q(c[f].H,
null, null, !0, new Q(h, k, N)))
}
c[f].ie()
}
li(a, Sf(a.uc, b));
ki(a);
Ab(a.da, b, e);
for (f = 0; f < d.length; f++) Db(d[f])
} else {
if ("datastale" === d)
for (f = 0; f < c.length; f++) c[f].status = 4 === c[f].status ? 5 : 1;
else
for (O("transaction at " + b.toString() + " failed: " + d), f = 0; f < c.length; f++) c[f].status = 5, c[f].ke = d;
bi(a, b)
}
}, e)
}
function bi(a, b) {
var c = oi(a, b),
d = c.path(),
c = mi(a, c);
pi(a, c, d);
return d
}
function pi(a, b, c) {
if (0 !== b.length) {
for (var d = [], e = [], f = Qa(b, function (a) {
return a.Ba
}), h = 0; h < b.length; h++) {
var k = b[h],
l = T(c, k.path),
m = !1,
t;
K(null !== l, "rerunTransactionsUnderNode_: relativePath should not be null.");
if (5 === k.status) m = !0, t = k.ke, e = e.concat(zf(a.L, k.Ba, !0));
else if (1 === k.status)
if (25 <= k.Lf) m = !0, t = "maxretry", e = e.concat(zf(a.L, k.Ba, !0));
else {
var z = a.L.za(k.path, f) || C;
k.pd = z;
var I = b[h].update(z.I());
n(I) ? (cg("transaction failed: Data returned ", I, k.path), l = M(I), "object" === typeof I && null !=
I && v(I, ".priority") || (l = l.ga(z.C())), z = k.Ba, I = ai(a), I = sc(l, I), k.qd = l, k.rd = I, k.Ba = a.Hd++, Va(f, z), e = e.concat(wf(a.L, k.path, I, k.Ba, k.cf)), e = e.concat(zf(a.L, z, !0))) : (m = !0, t = "nodata", e = e.concat(zf(a.L, k.Ba, !0)))
}
Ab(a.da, c, e);
e = [];
m && (b[h].status = 3, setTimeout(b[h].ie, Math.floor(0)), b[h].H && ("nodata" === t ? (k = new U(a, b[h].path), d.push(q(b[h].H, null, null, !1, new Q(b[h].pd, k, N)))) : d.push(q(b[h].H, null, Error(t), !1, null))))
}
li(a, a.uc);
for (h = 0; h < d.length; h++) Db(d[h]);
ki(a)
}
}
function oi(a, b) {
for (var c, d = a.uc; null !== (c = E(b)) && null === d.Ca();) d = Sf(d, c), b = H(b);
return d
}
function mi(a, b) {
var c = [];
qi(a, b, c);
c.sort(function (a, b) {
return a.Ff - b.Ff
});
return c
}
function qi(a, b, c) {
var d = b.Ca();
if (null !== d)
for (var e = 0; e < d.length; e++) c.push(d[e]);
b.P(function (b) {
qi(a, b, c)
})
}
function li(a, b) {
var c = b.Ca();
if (c) {
for (var d = 0, e = 0; e < c.length; e++) 3 !== c[e].status && (c[d] = c[e], d++);
c.length = d;
Tf(b, 0 < c.length ? c : null)
}
b.P(function (b) {
li(a, b)
})
}
function ei(a, b) {
var c = oi(a, b).path(),
d = Sf(a.uc, b);
Wf(d, function (b) {
ri(a, b)
});
ri(a, d);
Vf(d, function (b) {
ri(a, b)
});
return c
}
function ri(a, b) {
var c = b.Ca();
if (null !== c) {
for (var d = [], e = [], f = -1, h = 0; h < c.length; h++) 4 !== c[h].status && (2 === c[h].status ? (K(f === h - 1, "All SENT items should be at beginning of queue."), f = h, c[h].status = 4, c[h].ke = "set") : (K(1 === c[h].status, "Unexpected transaction status in abort"), c[h].ie(), e = e.concat(zf(a.L, c[h].Ba, !0)), c[h].H && d.push(q(c[h].H, null, Error("set"), !1, null)))); - 1 === f ? Tf(b, null) : c.length = f + 1;
Ab(a.da, b.path(), e);
for (h = 0; h < d.length; h++) Db(d[h])
}
};
function W() {
this.oc = {};
this.Sf = !1
}
W.prototype.yb = function () {
for (var a in this.oc) this.oc[a].yb()
};
W.prototype.rc = function () {
for (var a in this.oc) this.oc[a].rc()
};
W.prototype.ve = function () {
this.Sf = !0
};
ca(W);
W.prototype.interrupt = W.prototype.yb;
W.prototype.resume = W.prototype.rc;
function X(a, b) {
this.bd = a;
this.ra = b
}
X.prototype.cancel = function (a) {
x("Firebase.onDisconnect().cancel", 0, 1, arguments.length);
A("Firebase.onDisconnect().cancel", 1, a, !0);
this.bd.Jd(this.ra, a || null)
};
X.prototype.cancel = X.prototype.cancel;
X.prototype.remove = function (a) {
x("Firebase.onDisconnect().remove", 0, 1, arguments.length);
jg("Firebase.onDisconnect().remove", this.ra);
A("Firebase.onDisconnect().remove", 1, a, !0);
fi(this.bd, this.ra, null, a)
};
X.prototype.remove = X.prototype.remove;
X.prototype.set = function (a, b) {
x("Firebase.onDisconnect().set", 1, 2, arguments.length);
jg("Firebase.onDisconnect().set", this.ra);
bg("Firebase.onDisconnect().set", a, this.ra, !1);
A("Firebase.onDisconnect().set", 2, b, !0);
fi(this.bd, this.ra, a, b)
};
X.prototype.set = X.prototype.set;
X.prototype.Kb = function (a, b, c) {
x("Firebase.onDisconnect().setWithPriority", 2, 3, arguments.length);
jg("Firebase.onDisconnect().setWithPriority", this.ra);
bg("Firebase.onDisconnect().setWithPriority", a, this.ra, !1);
fg("Firebase.onDisconnect().setWithPriority", 2, b);
A("Firebase.onDisconnect().setWithPriority", 3, c, !0);
gi(this.bd, this.ra, a, b, c)
};
X.prototype.setWithPriority = X.prototype.Kb;
X.prototype.update = function (a, b) {
x("Firebase.onDisconnect().update", 1, 2, arguments.length);
jg("Firebase.onDisconnect().update", this.ra);
if (ea(a)) {
for (var c = {}, d = 0; d < a.length; ++d) c["" + d] = a[d];
a = c;
O("Passing an Array to Firebase.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")
}
eg("Firebase.onDisconnect().update", a, this.ra);
A("Firebase.onDisconnect().update", 2, b, !0);
hi(this.bd, this.ra, a, b)
};
X.prototype.update = X.prototype.update;
function Y(a, b, c, d) {
this.k = a;
this.path = b;
this.n = c;
this.lc = d
}
function si(a) {
var b = null,
c = null;
a.ma && (b = nd(a));
a.pa && (c = pd(a));
if (a.g === Qd) {
if (a.ma) {
if ("[MIN_NAME]" != md(a)) throw Error("Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().");
if ("string" !== typeof b) throw Error("Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.");
}
if (a.pa) {
if ("[MAX_NAME]" != od(a)) throw Error("Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().");
if ("string" !==
typeof c) throw Error("Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.");
}
} else if (a.g === N) {
if (null != b && !ag(b) || null != c && !ag(c)) throw Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).");
} else if (K(a.g instanceof Ud || a.g === $d, "unknown index type."), null != b && "object" === typeof b || null != c && "object" === typeof c) throw Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.");
}
function ti(a) {
if (a.ma && a.pa && a.ja && (!a.ja || "" === a.Nb)) throw Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.");
}
function ui(a, b) {
if (!0 === a.lc) throw Error(b + ": You can't combine multiple orderBy calls.");
}
g = Y.prototype;
g.Ib = function () {
x("Query.ref", 0, 0, arguments.length);
return new U(this.k, this.path)
};
g.Eb = function (a, b, c, d) {
x("Query.on", 2, 4, arguments.length);
gg("Query.on", a, !1);
A("Query.on", 2, b, !1);
var e = vi("Query.on", c, d);
if ("value" === a) ii(this.k, this, new id(b, e.cancel || null, e.Ma || null));
else {
var f = {};
f[a] = b;
ii(this.k, this, new jd(f, e.cancel, e.Ma))
}
return b
};
g.ic = function (a, b, c) {
x("Query.off", 0, 3, arguments.length);
gg("Query.off", a, !0);
A("Query.off", 2, b, !0);
mb("Query.off", 3, c);
var d = null,
e = null;
"value" === a ? d = new id(b || null, null, c || null) : a && (b && (e = {}, e[a] = b), d = new jd(e, null, c || null));
e = this.k;
d = ".info" === E(this.path) ? e.Cd.jb(this, d) : e.L.jb(this, d);
yb(e.da, this.path, d)
};
g.Dg = function (a, b) {
function c(h) {
f && (f = !1, e.ic(a, c), b.call(d.Ma, h))
}
x("Query.once", 2, 4, arguments.length);
gg("Query.once", a, !1);
A("Query.once", 2, b, !1);
var d = vi("Query.once", arguments[2], arguments[3]),
e = this,
f = !0;
this.Eb(a, c, function (b) {
e.ic(a, c);
d.cancel && d.cancel.call(d.Ma, b)
})
};
g.He = function (a) {
O("Query.limit() being deprecated. Please use Query.limitToFirst() or Query.limitToLast() instead.");
x("Query.limit", 1, 1, arguments.length);
if (!ga(a) || Math.floor(a) !== a || 0 >= a) throw Error("Query.limit: First argument must be a positive integer.");
if (this.n.ja) throw Error("Query.limit: Limit was already set (by another call to limit, limitToFirst, orlimitToLast.");
var b = this.n.He(a);
ti(b);
return new Y(this.k, this.path, b, this.lc)
};
g.Ie = function (a) {
x("Query.limitToFirst", 1, 1, arguments.length);
if (!ga(a) || Math.floor(a) !== a || 0 >= a) throw Error("Query.limitToFirst: First argument must be a positive integer.");
if (this.n.ja) throw Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");
return new Y(this.k, this.path, this.n.Ie(a), this.lc)
};
g.Je = function (a) {
x("Query.limitToLast", 1, 1, arguments.length);
if (!ga(a) || Math.floor(a) !== a || 0 >= a) throw Error("Query.limitToLast: First argument must be a positive integer.");
if (this.n.ja) throw Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");
return new Y(this.k, this.path, this.n.Je(a), this.lc)
};
g.Eg = function (a) {
x("Query.orderByChild", 1, 1, arguments.length);
if ("$key" === a) throw Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');
if ("$priority" === a) throw Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');
if ("$value" === a) throw Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');
ig("Query.orderByChild", a);
ui(this, "Query.orderByChild");
var b = new L(a);
if (b.e()) throw Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");
b = new Ud(b);
b = de(this.n, b);
si(b);
return new Y(this.k, this.path, b, !0)
};
g.Fg = function () {
x("Query.orderByKey", 0, 0, arguments.length);
ui(this, "Query.orderByKey");
var a = de(this.n, Qd);
si(a);
return new Y(this.k, this.path, a, !0)
};
g.Gg = function () {
x("Query.orderByPriority", 0, 0, arguments.length);
ui(this, "Query.orderByPriority");
var a = de(this.n, N);
si(a);
return new Y(this.k, this.path, a, !0)
};
g.Hg = function () {
x("Query.orderByValue", 0, 0, arguments.length);
ui(this, "Query.orderByValue");
var a = de(this.n, $d);
si(a);
return new Y(this.k, this.path, a, !0)
};
g.$d = function (a, b) {
x("Query.startAt", 0, 2, arguments.length);
bg("Query.startAt", a, this.path, !0);
hg("Query.startAt", b);
var c = this.n.$d(a, b);
ti(c);
si(c);
if (this.n.ma) throw Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");
n(a) || (b = a = null);
return new Y(this.k, this.path, c, this.lc)
};
g.td = function (a, b) {
x("Query.endAt", 0, 2, arguments.length);
bg("Query.endAt", a, this.path, !0);
hg("Query.endAt", b);
var c = this.n.td(a, b);
ti(c);
si(c);
if (this.n.pa) throw Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");
return new Y(this.k, this.path, c, this.lc)
};
g.kg = function (a, b) {
x("Query.equalTo", 1, 2, arguments.length);
bg("Query.equalTo", a, this.path, !1);
hg("Query.equalTo", b);
if (this.n.ma) throw Error("Query.equalTo: Starting point was already set (by another call to endAt or equalTo).");
if (this.n.pa) throw Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");
return this.$d(a, b).td(a, b)
};
g.toString = function () {
x("Query.toString", 0, 0, arguments.length);
for (var a = this.path, b = "", c = a.Z; c < a.o.length; c++) "" !== a.o[c] && (b += "/" + encodeURIComponent(String(a.o[c])));
return this.k.toString() + (b || "/")
};
g.va = function () {
var a = Uc(ee(this.n));
return "{}" === a ? "default" : a
};
function vi(a, b, c) {
var d = {
cancel: null,
Ma: null
};
if (b && c) d.cancel = b, A(a, 3, d.cancel, !0), d.Ma = c, mb(a, 4, d.Ma);
else if (b)
if ("object" === typeof b && null !== b) d.Ma = b;
else if ("function" === typeof b) d.cancel = b;
else throw Error(y(a, 3, !0) + " must either be a cancel callback or a context object.");
return d
}
Y.prototype.ref = Y.prototype.Ib;
Y.prototype.on = Y.prototype.Eb;
Y.prototype.off = Y.prototype.ic;
Y.prototype.once = Y.prototype.Dg;
Y.prototype.limit = Y.prototype.He;
Y.prototype.limitToFirst = Y.prototype.Ie;
Y.prototype.limitToLast = Y.prototype.Je;
Y.prototype.orderByChild = Y.prototype.Eg;
Y.prototype.orderByKey = Y.prototype.Fg;
Y.prototype.orderByPriority = Y.prototype.Gg;
Y.prototype.orderByValue = Y.prototype.Hg;
Y.prototype.startAt = Y.prototype.$d;
Y.prototype.endAt = Y.prototype.td;
Y.prototype.equalTo = Y.prototype.kg;
Y.prototype.toString = Y.prototype.toString;
var Z = {};
Z.vc = Kh;
Z.DataConnection = Z.vc;
Kh.prototype.Rg = function (a, b) {
this.Fa("q", {
p: a
}, b)
};
Z.vc.prototype.simpleListen = Z.vc.prototype.Rg;
Kh.prototype.jg = function (a, b) {
this.Fa("echo", {
d: a
}, b)
};
Z.vc.prototype.echo = Z.vc.prototype.jg;
Kh.prototype.interrupt = Kh.prototype.yb;
Z.Vf = yh;
Z.RealTimeConnection = Z.Vf;
yh.prototype.sendRequest = yh.prototype.Fa;
yh.prototype.close = yh.prototype.close;
Z.rg = function (a) {
var b = Kh.prototype.put;
Kh.prototype.put = function (c, d, e, f) {
n(f) && (f = a());
b.call(this, c, d, e, f)
};
return function () {
Kh.prototype.put = b
}
};
Z.hijackHash = Z.rg;
Z.Uf = zc;
Z.ConnectionTarget = Z.Uf;
Z.va = function (a) {
return a.va()
};
Z.queryIdentifier = Z.va;
Z.tg = function (a) {
return a.k.Ra.$
};
Z.listens = Z.tg;
Z.ve = function (a) {
a.ve()
};
Z.forceRestClient = Z.ve;
function U(a, b) {
var c, d, e;
if (a instanceof Yh) c = a, d = b;
else {
x("new Firebase", 1, 2, arguments.length);
d = Pc(arguments[0]);
c = d.Tg;
"firebase" === d.domain && Oc(d.host + " is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead");
c && "undefined" != c || Oc("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com");
d.kb || "undefined" !== typeof window && window.location && window.location.protocol && -1 !== window.location.protocol.indexOf("https:") && O("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");
c = new zc(d.host, d.kb, c, "ws" === d.scheme || "wss" === d.scheme);
d = new L(d.$c);
e = d.toString();
var f;
!(f = !p(c.host) || 0 === c.host.length || !$f(c.hc)) && (f = 0 !== e.length) && (e && (e = e.replace(/^\/*\.info(\/|$)/, "/")), f = !(p(e) && 0 !== e.length && !Yf.test(e)));
if (f) throw Error(y("new Firebase", 1, !1) + 'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".');
if (b)
if (b instanceof W) e = b;
else if (p(b)) e = W.ub(), c.Od = b;
else throw Error("Expected a valid Firebase.Context for second argument to new Firebase()");
else e = W.ub();
f = c.toString();
var h = w(e.oc, f);
h || (h = new Yh(c, e.Sf), e.oc[f] = h);
c = h
}
Y.call(this, c, d, be, !1)
}
ma(U, Y);
var wi = U,
xi = ["Firebase"],
yi = aa;
xi[0] in yi || !yi.execScript || yi.execScript("var " + xi[0]);
for (var zi; xi.length && (zi = xi.shift());) !xi.length && n(wi) ? yi[zi] = wi : yi = yi[zi] ? yi[zi] : yi[zi] = {};
U.goOffline = function () {
x("Firebase.goOffline", 0, 0, arguments.length);
W.ub().yb()
};
U.goOnline = function () {
x("Firebase.goOnline", 0, 0, arguments.length);
W.ub().rc()
};
function Lc(a, b) {
K(!b || !0 === a || !1 === a, "Can't turn on custom loggers persistently.");
!0 === a ? ("undefined" !== typeof console && ("function" === typeof console.log ? Bb = q(console.log, console) : "object" === typeof console.log && (Bb = function (a) {
console.log(a)
})), b && yc.set("logging_enabled", !0)) : a ? Bb = a : (Bb = null, yc.remove("logging_enabled"))
}
U.enableLogging = Lc;
U.ServerValue = {
TIMESTAMP: {
".sv": "timestamp"
}
};
U.SDK_VERSION = hb;
U.INTERNAL = V;
U.Context = W;
U.TEST_ACCESS = Z;
U.prototype.name = function () {
O("Firebase.name() being deprecated. Please use Firebase.key() instead.");
x("Firebase.name", 0, 0, arguments.length);
return this.key()
};
U.prototype.name = U.prototype.name;
U.prototype.key = function () {
x("Firebase.key", 0, 0, arguments.length);
return this.path.e() ? null : Ld(this.path)
};
U.prototype.key = U.prototype.key;
U.prototype.u = function (a) {
x("Firebase.child", 1, 1, arguments.length);
if (ga(a)) a = String(a);
else if (!(a instanceof L))
if (null === E(this.path)) {
var b = a;
b && (b = b.replace(/^\/*\.info(\/|$)/, "/"));
ig("Firebase.child", b)
} else ig("Firebase.child", a);
return new U(this.k, this.path.u(a))
};
U.prototype.child = U.prototype.u;
U.prototype.parent = function () {
x("Firebase.parent", 0, 0, arguments.length);
var a = this.path.parent();
return null === a ? null : new U(this.k, a)
};
U.prototype.parent = U.prototype.parent;
U.prototype.root = function () {
x("Firebase.ref", 0, 0, arguments.length);
for (var a = this; null !== a.parent();) a = a.parent();
return a
};
U.prototype.root = U.prototype.root;
U.prototype.set = function (a, b) {
x("Firebase.set", 1, 2, arguments.length);
jg("Firebase.set", this.path);
bg("Firebase.set", a, this.path, !1);
A("Firebase.set", 2, b, !0);
this.k.Kb(this.path, a, null, b || null)
};
U.prototype.set = U.prototype.set;
U.prototype.update = function (a, b) {
x("Firebase.update", 1, 2, arguments.length);
jg("Firebase.update", this.path);
if (ea(a)) {
for (var c = {}, d = 0; d < a.length; ++d) c["" + d] = a[d];
a = c;
O("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")
}
eg("Firebase.update", a, this.path);
A("Firebase.update", 2, b, !0);
this.k.update(this.path, a, b || null)
};
U.prototype.update = U.prototype.update;
U.prototype.Kb = function (a, b, c) {
x("Firebase.setWithPriority", 2, 3, arguments.length);
jg("Firebase.setWithPriority", this.path);
bg("Firebase.setWithPriority", a, this.path, !1);
fg("Firebase.setWithPriority", 2, b);
A("Firebase.setWithPriority", 3, c, !0);
if (".length" === this.key() || ".keys" === this.key()) throw "Firebase.setWithPriority failed: " + this.key() + " is a read-only object.";
this.k.Kb(this.path, a, b, c || null)
};
U.prototype.setWithPriority = U.prototype.Kb;
U.prototype.remove = function (a) {
x("Firebase.remove", 0, 1, arguments.length);
jg("Firebase.remove", this.path);
A("Firebase.remove", 1, a, !0);
this.set(null, a)
};
U.prototype.remove = U.prototype.remove;
U.prototype.transaction = function (a, b, c) {
x("Firebase.transaction", 1, 3, arguments.length);
jg("Firebase.transaction", this.path);
A("Firebase.transaction", 1, a, !1);
A("Firebase.transaction", 2, b, !0);
if (n(c) && "boolean" != typeof c) throw Error(y("Firebase.transaction", 3, !0) + "must be a boolean.");
if (".length" === this.key() || ".keys" === this.key()) throw "Firebase.transaction failed: " + this.key() + " is a read-only object.";
"undefined" === typeof c && (c = !0);
ji(this.k, this.path, a, b || null, c)
};
U.prototype.transaction = U.prototype.transaction;
U.prototype.Og = function (a, b) {
x("Firebase.setPriority", 1, 2, arguments.length);
jg("Firebase.setPriority", this.path);
fg("Firebase.setPriority", 1, a);
A("Firebase.setPriority", 2, b, !0);
this.k.Kb(this.path.u(".priority"), a, null, b)
};
U.prototype.setPriority = U.prototype.Og;
U.prototype.push = function (a, b) {
x("Firebase.push", 0, 2, arguments.length);
jg("Firebase.push", this.path);
bg("Firebase.push", a, this.path, !0);
A("Firebase.push", 2, b, !0);
var c = $h(this.k),
c = Fe(c),
c = this.u(c);
"undefined" !== typeof a && null !== a && c.set(a, b);
return c
};
U.prototype.push = U.prototype.push;
U.prototype.hb = function () {
jg("Firebase.onDisconnect", this.path);
return new X(this.k, this.path)
};
U.prototype.onDisconnect = U.prototype.hb;
U.prototype.M = function (a, b, c) {
O("FirebaseRef.auth() being deprecated. Please use FirebaseRef.authWithCustomToken() instead.");
x("Firebase.auth", 1, 3, arguments.length);
kg("Firebase.auth", a);
A("Firebase.auth", 2, b, !0);
A("Firebase.auth", 3, b, !0);
Yg(this.k.M, a, {}, {
remember: "none"
}, b, c)
};
U.prototype.auth = U.prototype.M;
U.prototype.ge = function (a) {
x("Firebase.unauth", 0, 1, arguments.length);
A("Firebase.unauth", 1, a, !0);
Zg(this.k.M, a)
};
U.prototype.unauth = U.prototype.ge;
U.prototype.xe = function () {
x("Firebase.getAuth", 0, 0, arguments.length);
return this.k.M.xe()
};
U.prototype.getAuth = U.prototype.xe;
U.prototype.xg = function (a, b) {
x("Firebase.onAuth", 1, 2, arguments.length);
A("Firebase.onAuth", 1, a, !1);
mb("Firebase.onAuth", 2, b);
this.k.M.Eb("auth_status", a, b)
};
U.prototype.onAuth = U.prototype.xg;
U.prototype.wg = function (a, b) {
x("Firebase.offAuth", 1, 2, arguments.length);
A("Firebase.offAuth", 1, a, !1);
mb("Firebase.offAuth", 2, b);
this.k.M.ic("auth_status", a, b)
};
U.prototype.offAuth = U.prototype.wg;
U.prototype.Zf = function (a, b, c) {
x("Firebase.authWithCustomToken", 2, 3, arguments.length);
kg("Firebase.authWithCustomToken", a);
A("Firebase.authWithCustomToken", 2, b, !1);
ng("Firebase.authWithCustomToken", 3, c, !0);
Yg(this.k.M, a, {}, c || {}, b)
};
U.prototype.authWithCustomToken = U.prototype.Zf;
U.prototype.$f = function (a, b, c) {
x("Firebase.authWithOAuthPopup", 2, 3, arguments.length);
mg("Firebase.authWithOAuthPopup", a);
A("Firebase.authWithOAuthPopup", 2, b, !1);
ng("Firebase.authWithOAuthPopup", 3, c, !0);
ch(this.k.M, a, c, b)
};
U.prototype.authWithOAuthPopup = U.prototype.$f;
U.prototype.ag = function (a, b, c) {
x("Firebase.authWithOAuthRedirect", 2, 3, arguments.length);
mg("Firebase.authWithOAuthRedirect", a);
A("Firebase.authWithOAuthRedirect", 2, b, !1);
ng("Firebase.authWithOAuthRedirect", 3, c, !0);
var d = this.k.M;
ah(d);
var e = [Kg],
f = vg(c);
"anonymous" === a || "firebase" === a ? P(b, Mg("TRANSPORT_UNAVAILABLE")) : (yc.set("redirect_client_options", f.od), bh(d, e, "/auth/" + a, f, b))
};
U.prototype.authWithOAuthRedirect = U.prototype.ag;
U.prototype.bg = function (a, b, c, d) {
x("Firebase.authWithOAuthToken", 3, 4, arguments.length);
mg("Firebase.authWithOAuthToken", a);
A("Firebase.authWithOAuthToken", 3, c, !1);
ng("Firebase.authWithOAuthToken", 4, d, !0);
p(b) ? (lg("Firebase.authWithOAuthToken", 2, b), $g(this.k.M, a + "/token", {
access_token: b
}, d, c)) : (ng("Firebase.authWithOAuthToken", 2, b, !1), $g(this.k.M, a + "/token", b, d, c))
};
U.prototype.authWithOAuthToken = U.prototype.bg;
U.prototype.Yf = function (a, b) {
x("Firebase.authAnonymously", 1, 2, arguments.length);
A("Firebase.authAnonymously", 1, a, !1);
ng("Firebase.authAnonymously", 2, b, !0);
$g(this.k.M, "anonymous", {}, b, a)
};
U.prototype.authAnonymously = U.prototype.Yf;
U.prototype.cg = function (a, b, c) {
x("Firebase.authWithPassword", 2, 3, arguments.length);
ng("Firebase.authWithPassword", 1, a, !1);
og("Firebase.authWithPassword", a, "email");
og("Firebase.authWithPassword", a, "password");
A("Firebase.authWithPassword", 2, b, !1);
ng("Firebase.authWithPassword", 3, c, !0);
$g(this.k.M, "password", a, c, b)
};
U.prototype.authWithPassword = U.prototype.cg;
U.prototype.se = function (a, b) {
x("Firebase.createUser", 2, 2, arguments.length);
ng("Firebase.createUser", 1, a, !1);
og("Firebase.createUser", a, "email");
og("Firebase.createUser", a, "password");
A("Firebase.createUser", 2, b, !1);
this.k.M.se(a, b)
};
U.prototype.createUser = U.prototype.se;
U.prototype.Te = function (a, b) {
x("Firebase.removeUser", 2, 2, arguments.length);
ng("Firebase.removeUser", 1, a, !1);
og("Firebase.removeUser", a, "email");
og("Firebase.removeUser", a, "password");
A("Firebase.removeUser", 2, b, !1);
this.k.M.Te(a, b)
};
U.prototype.removeUser = U.prototype.Te;
U.prototype.pe = function (a, b) {
x("Firebase.changePassword", 2, 2, arguments.length);
ng("Firebase.changePassword", 1, a, !1);
og("Firebase.changePassword", a, "email");
og("Firebase.changePassword", a, "oldPassword");
og("Firebase.changePassword", a, "newPassword");
A("Firebase.changePassword", 2, b, !1);
this.k.M.pe(a, b)
};
U.prototype.changePassword = U.prototype.pe;
U.prototype.oe = function (a, b) {
x("Firebase.changeEmail", 2, 2, arguments.length);
ng("Firebase.changeEmail", 1, a, !1);
og("Firebase.changeEmail", a, "oldEmail");
og("Firebase.changeEmail", a, "newEmail");
og("Firebase.changeEmail", a, "password");
A("Firebase.changeEmail", 2, b, !1);
this.k.M.oe(a, b)
};
U.prototype.changeEmail = U.prototype.oe;
U.prototype.Ve = function (a, b) {
x("Firebase.resetPassword", 2, 2, arguments.length);
ng("Firebase.resetPassword", 1, a, !1);
og("Firebase.resetPassword", a, "email");
A("Firebase.resetPassword", 2, b, !1);
this.k.M.Ve(a, b)
};
U.prototype.resetPassword = U.prototype.Ve;
})();
| 32.008468 | 593 | 0.410687 |
75c6470edfb55613358293dd74612d555a1127fd | 314 | js | JavaScript | client/reducers/demo.js | zhanghanran/VR-Client | 1f5a864412d5199c8b18dffa814ecd121b2d4769 | [
"Apache-2.0"
] | 1 | 2018-12-30T15:49:24.000Z | 2018-12-30T15:49:24.000Z | client/reducers/demo.js | zhanghanran/VR-Client | 1f5a864412d5199c8b18dffa814ecd121b2d4769 | [
"Apache-2.0"
] | null | null | null | client/reducers/demo.js | zhanghanran/VR-Client | 1f5a864412d5199c8b18dffa814ecd121b2d4769 | [
"Apache-2.0"
] | null | null | null | import {handleActions} from 'redux-actions'
const reducers = {}
const initialState = {
}
reducers["DEMO_GET_FINISHED"] = {
next(state=initialState, action) {
return action.payload
},
throw(state) {
return Object.assign({}, state, {})
}
}
export default handleActions(reducers, initialState)
| 20.933333 | 53 | 0.684713 |
75c67a3fffce8515a2c039bc4513ce4579c5bd77 | 2,822 | js | JavaScript | webdocs/tailwind.config.js | NizomiddinWebDev/tgsnakeBot | a46b3c1c9205aa098700ddb35468672533d2cc35 | [
"MIT"
] | 26 | 2021-06-14T10:51:36.000Z | 2021-11-28T08:40:13.000Z | webdocs/tailwind.config.js | NizomiddinWebDev/tgsnakeBot | a46b3c1c9205aa098700ddb35468672533d2cc35 | [
"MIT"
] | 24 | 2021-06-26T23:54:01.000Z | 2021-11-28T00:31:28.000Z | webdocs/tailwind.config.js | NizomiddinWebDev/tgsnakeBot | a46b3c1c9205aa098700ddb35468672533d2cc35 | [
"MIT"
] | 7 | 2021-06-21T05:59:30.000Z | 2021-09-09T22:08:17.000Z | const defaultTheme = require('tailwindcss/defaultTheme')
const colors = require('tailwindcss/colors')
module.exports = {
mode : "jit",
purge: [
'./pages/**/*.{js,ts,jsx,tsx}',
'./components/**/*.{js,ts,jsx,tsx}'
],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
typography(theme) {
return {
DEFAULT:{
css : {
a : {
textDecoration : "none"
},
"code::after" : {
content : ""
},
"code::before" : {
content : ""
},
'h4,h5,h6': {
color: theme('colors.gray.900'),
},
code: {
color: theme('colors.pink.500'),
paddingLeft: '4px',
paddingRight: '4px',
paddingTop: '2px',
paddingBottom: '2px'
}
}
},
dark: {
css: {
color: theme("colors.gray.300"),
'[class~="lead"]': { color: theme("colors.gray.400") },
strong: { color: theme("colors.gray.100") },
a : { color: theme("colors.blue.300") },
"ul > li::before": { backgroundColor: theme("colors.gray.700") },
hr: { borderColor: theme("colors.gray.800") },
blockquote: {
color: theme("colors.gray.100"),
borderLeftColor: theme("colors.gray.800"),
},
h1: { color: theme("colors.gray.100") },
h2: { color: theme("colors.gray.100") },
h3: { color: theme("colors.gray.100") },
h4: { color: theme("colors.gray.100") },
h5: { color: theme("colors.gray.100") },
h6: { color: theme("colors.gray.100") },
"a code": { color: theme("colors.gray.100") },
pre: {
color: theme("colors.gray.200"),
backgroundColor: theme("colors.gray.800"),
},
thead: {
color: theme("colors.gray.100"),
borderBottomColor: theme("colors.gray.700"),
},
"tbody tr": { borderBottomColor: theme("colors.gray.800") },
},
},
};
},
fontFamily : {
poppins : ["Poppins","sans-serif"]
},
colors: {
primary: colors.teal,
gray: colors.trueGray,
code: {
green: '#b5f4a5',
yellow: '#ffe484',
purple: '#d9a9ff',
red: '#ff8383',
blue: '#93ddfd',
white: '#fff',
},
}
},
},
variants: {
extend: {
typography: ['dark']
},
},
plugins: [require('@tailwindcss/typography')],
}
| 30.021277 | 79 | 0.41708 |
75c7f280d30083d0cf72423d2ab28af96b6a6c3b | 662 | js | JavaScript | gulpfile.js | Typecraft/smart_typecraft | eb1144c7060f2d79569265f2da7131b2054fbf9a | [
"MIT"
] | null | null | null | gulpfile.js | Typecraft/smart_typecraft | eb1144c7060f2d79569265f2da7131b2054fbf9a | [
"MIT"
] | null | null | null | gulpfile.js | Typecraft/smart_typecraft | eb1144c7060f2d79569265f2da7131b2054fbf9a | [
"MIT"
] | null | null | null | var gulp = require('gulp');
var sass = require('gulp-sass');
var clean = require('gulp-clean-css');
const scssFolders = 'public/scss/**/*.scss';
gulp.task('sass', () => {
return gulp.src(scssFolders)
.pipe(sass()).on('error', sass.logError)
.pipe(gulp.dest('web/static/css'));
});
gulp.task('sass:production', () => {
return gulp.src(scssFolders)
.pipe(sass()).on('error', sass.logError)
.pipe(clean())
.pipe(gulp.dest('tcweb/static/css'));
});
gulp.task('watch:sass', () => {
gulp.watch(scssFolders, ['sass']);
});
gulp.task('watch', ['watch:sass']);
gulp.task('default', ['sass']);
gulp.task('production', ['sass:production']);
| 23.642857 | 45 | 0.613293 |
75cab6120a6a1286ebac3742e8083cde0dc068fd | 2,103 | js | JavaScript | testPage.js | cat-walk/test-automation | 5899dfba9925938da685f4700171d4d0bbaaa323 | [
"MIT"
] | null | null | null | testPage.js | cat-walk/test-automation | 5899dfba9925938da685f4700171d4d0bbaaa323 | [
"MIT"
] | 1 | 2021-05-10T08:11:01.000Z | 2021-05-10T08:11:01.000Z | testPage.js | cat-walk/test-automation | 5899dfba9925938da685f4700171d4d0bbaaa323 | [
"MIT"
] | null | null | null | const {
extractDataFromPerformanceMetrics,
extractDataFromPerformanceTiming,
getTimeFromPerformanceMetrics
} = require('./helpers');
async function testPage(page) {
try {
const client = await page.target().createCDPSession();
await client.send('Performance.enable');
const url = 'https://baidu.com';
// const url = 'https://summit.aelf.io/test.html';
// await page.goto('http://192.168.199.216:5000/test.html');
// It sees that the size of viewport wxll slow down the puppeteer's spped
// await page.setViewport({ width: 1920, height: 1080 });
await page.goto(url, {
timeout: 120000,
waitUntil: 'networkidle2'
});
const perfGroup = JSON.parse(
await page.evaluate(() => {
const firstContentfulPaint = performance.getEntriesByType('paint')[1]
.startTime;
// const firstPaint = performance.getEntriesByType('paint')[0].startTime;
return JSON.stringify({
performanceTiming: window.performance.timing,
// firstPaint,
firstContentfulPaint
});
})
);
let firstMeaningfulPaint = 0;
let performanceMetrics;
let runTimes = 0;
while (firstMeaningfulPaint === 0) {
await page.waitFor(300);
performanceMetrics = await client.send('Performance.getMetrics');
firstMeaningfulPaint = getTimeFromPerformanceMetrics(
performanceMetrics,
'FirstMeaningfulPaint'
);
runTimes++;
if (runTimes === 30) break;
}
const metricsA = extractDataFromPerformanceMetrics(
performanceMetrics,
'FirstMeaningfulPaint'
);
const {
// firstPaint,
firstContentfulPaint,
performanceTiming
} = perfGroup;
const metricsB = extractDataFromPerformanceTiming(
performanceTiming,
'responseEnd',
'domContentLoadedEventEnd',
'loadEventEnd',
'domInteractive'
);
return {
...metricsB,
// firstPaint,
firstContentfulPaint,
...metricsA
};
} catch (err) {
console.log(err);
}
}
module.exports = testPage;
| 26.2875 | 81 | 0.636709 |
75cd9318ce025ce7bba38618ca6b47cc2837f54a | 40,358 | js | JavaScript | public/assets/vendor/prism/1.15.0/prism.js | gulch/gulchuk-website | 7002132008a22efc67975d825b9b5a01a61ab0f6 | [
"MIT"
] | null | null | null | public/assets/vendor/prism/1.15.0/prism.js | gulch/gulchuk-website | 7002132008a22efc67975d825b9b5a01a61ab0f6 | [
"MIT"
] | null | null | null | public/assets/vendor/prism/1.15.0/prism.js | gulch/gulchuk-website | 7002132008a22efc67975d825b9b5a01a61ab0f6 | [
"MIT"
] | null | null | null | /* PrismJS 1.15.0
https://prismjs.com/download.html?#themes=prism&languages=markup+css+clike+javascript+bash+markup-templating+json+nginx+php+php-extras+sql */
var _self = (typeof window !== 'undefined')
? window // if in browser
: (
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
? self // if in worker
: {} // if in node js
);
/**
* Prism: Lightweight, robust, elegant syntax highlighting
* MIT license http://www.opensource.org/licenses/mit-license.php/
* @author Lea Verou http://lea.verou.me
*/
var Prism = (function(){
// Private helper vars
var lang = /\blang(?:uage)?-([\w-]+)\b/i;
var uniqueId = 0;
var _ = _self.Prism = {
manual: _self.Prism && _self.Prism.manual,
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
util: {
encode: function (tokens) {
if (tokens instanceof Token) {
return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias);
} else if (_.util.type(tokens) === 'Array') {
return tokens.map(_.util.encode);
} else {
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
}
},
type: function (o) {
return Object.prototype.toString.call(o).slice(8, -1);
},
objId: function (obj) {
if (!obj['__id']) {
Object.defineProperty(obj, '__id', { value: ++uniqueId });
}
return obj['__id'];
},
// Deep clone a language definition (e.g. to extend it)
clone: function (o, visited) {
var type = _.util.type(o);
visited = visited || {};
switch (type) {
case 'Object':
if (visited[_.util.objId(o)]) {
return visited[_.util.objId(o)];
}
var clone = {};
visited[_.util.objId(o)] = clone;
for (var key in o) {
if (o.hasOwnProperty(key)) {
clone[key] = _.util.clone(o[key], visited);
}
}
return clone;
case 'Array':
if (visited[_.util.objId(o)]) {
return visited[_.util.objId(o)];
}
var clone = [];
visited[_.util.objId(o)] = clone;
o.forEach(function (v, i) {
clone[i] = _.util.clone(v, visited);
});
return clone;
}
return o;
}
},
languages: {
extend: function (id, redef) {
var lang = _.util.clone(_.languages[id]);
for (var key in redef) {
lang[key] = redef[key];
}
return lang;
},
/**
* Insert a token before another token in a language literal
* As this needs to recreate the object (we cannot actually insert before keys in object literals),
* we cannot just provide an object, we need an object and a key.
* @param inside The key (or language id) of the parent
* @param before The key to insert before.
* @param insert Object with the key/value pairs to insert
* @param root The object that contains `inside`. If equal to Prism.languages, it can be omitted.
*/
insertBefore: function (inside, before, insert, root) {
root = root || _.languages;
var grammar = root[inside];
var ret = {};
for (var token in grammar) {
if (grammar.hasOwnProperty(token)) {
if (token == before) {
for (var newToken in insert) {
if (insert.hasOwnProperty(newToken)) {
ret[newToken] = insert[newToken];
}
}
}
// Do not insert token which also occur in insert. See #1525
if (!insert.hasOwnProperty(token)) {
ret[token] = grammar[token];
}
}
}
var old = root[inside];
root[inside] = ret;
// Update references in other language definitions
_.languages.DFS(_.languages, function(key, value) {
if (value === old && key != inside) {
this[key] = ret;
}
});
return ret;
},
// Traverse a language definition with Depth First Search
DFS: function(o, callback, type, visited) {
visited = visited || {};
for (var i in o) {
if (o.hasOwnProperty(i)) {
callback.call(o, i, o[i], type || i);
if (_.util.type(o[i]) === 'Object' && !visited[_.util.objId(o[i])]) {
visited[_.util.objId(o[i])] = true;
_.languages.DFS(o[i], callback, null, visited);
}
else if (_.util.type(o[i]) === 'Array' && !visited[_.util.objId(o[i])]) {
visited[_.util.objId(o[i])] = true;
_.languages.DFS(o[i], callback, i, visited);
}
}
}
}
},
plugins: {},
highlightAll: function(async, callback) {
_.highlightAllUnder(document, async, callback);
},
highlightAllUnder: function(container, async, callback) {
var env = {
callback: callback,
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
};
_.hooks.run("before-highlightall", env);
var elements = env.elements || container.querySelectorAll(env.selector);
for (var i=0, element; element = elements[i++];) {
_.highlightElement(element, async === true, env.callback);
}
},
highlightElement: function(element, async, callback) {
// Find language
var language, grammar, parent = element;
while (parent && !lang.test(parent.className)) {
parent = parent.parentNode;
}
if (parent) {
language = (parent.className.match(lang) || [,''])[1].toLowerCase();
grammar = _.languages[language];
}
// Set language on the element, if not present
element.className = element.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
if (element.parentNode) {
// Set language on the parent, for styling
parent = element.parentNode;
if (/pre/i.test(parent.nodeName)) {
parent.className = parent.className.replace(lang, '').replace(/\s+/g, ' ') + ' language-' + language;
}
}
var code = element.textContent;
var env = {
element: element,
language: language,
grammar: grammar,
code: code
};
_.hooks.run('before-sanity-check', env);
if (!env.code || !env.grammar) {
if (env.code) {
_.hooks.run('before-highlight', env);
env.element.textContent = env.code;
_.hooks.run('after-highlight', env);
}
_.hooks.run('complete', env);
return;
}
_.hooks.run('before-highlight', env);
if (async && _self.Worker) {
var worker = new Worker(_.filename);
worker.onmessage = function(evt) {
env.highlightedCode = evt.data;
_.hooks.run('before-insert', env);
env.element.innerHTML = env.highlightedCode;
_.hooks.run('after-highlight', env);
_.hooks.run('complete', env);
callback && callback.call(env.element);
};
worker.postMessage(JSON.stringify({
language: env.language,
code: env.code,
immediateClose: true
}));
}
else {
env.highlightedCode = _.highlight(env.code, env.grammar, env.language);
_.hooks.run('before-insert', env);
env.element.innerHTML = env.highlightedCode;
_.hooks.run('after-highlight', env);
_.hooks.run('complete', env);
callback && callback.call(element);
}
},
highlight: function (text, grammar, language) {
var env = {
code: text,
grammar: grammar,
language: language
};
_.hooks.run('before-tokenize', env);
env.tokens = _.tokenize(env.code, env.grammar);
_.hooks.run('after-tokenize', env);
return Token.stringify(_.util.encode(env.tokens), env.language);
},
matchGrammar: function (text, strarr, grammar, index, startPos, oneshot, target) {
var Token = _.Token;
for (var token in grammar) {
if(!grammar.hasOwnProperty(token) || !grammar[token]) {
continue;
}
if (token == target) {
return;
}
var patterns = grammar[token];
patterns = (_.util.type(patterns) === "Array") ? patterns : [patterns];
for (var j = 0; j < patterns.length; ++j) {
var pattern = patterns[j],
inside = pattern.inside,
lookbehind = !!pattern.lookbehind,
greedy = !!pattern.greedy,
lookbehindLength = 0,
alias = pattern.alias;
if (greedy && !pattern.pattern.global) {
// Without the global flag, lastIndex won't work
var flags = pattern.pattern.toString().match(/[imuy]*$/)[0];
pattern.pattern = RegExp(pattern.pattern.source, flags + "g");
}
pattern = pattern.pattern || pattern;
// Don’t cache length as it changes during the loop
for (var i = index, pos = startPos; i < strarr.length; pos += strarr[i].length, ++i) {
var str = strarr[i];
if (strarr.length > text.length) {
// Something went terribly wrong, ABORT, ABORT!
return;
}
if (str instanceof Token) {
continue;
}
if (greedy && i != strarr.length - 1) {
pattern.lastIndex = pos;
var match = pattern.exec(text);
if (!match) {
break;
}
var from = match.index + (lookbehind ? match[1].length : 0),
to = match.index + match[0].length,
k = i,
p = pos;
for (var len = strarr.length; k < len && (p < to || (!strarr[k].type && !strarr[k - 1].greedy)); ++k) {
p += strarr[k].length;
// Move the index i to the element in strarr that is closest to from
if (from >= p) {
++i;
pos = p;
}
}
// If strarr[i] is a Token, then the match starts inside another Token, which is invalid
if (strarr[i] instanceof Token) {
continue;
}
// Number of tokens to delete and replace with the new match
delNum = k - i;
str = text.slice(pos, p);
match.index -= pos;
} else {
pattern.lastIndex = 0;
var match = pattern.exec(str),
delNum = 1;
}
if (!match) {
if (oneshot) {
break;
}
continue;
}
if(lookbehind) {
lookbehindLength = match[1] ? match[1].length : 0;
}
var from = match.index + lookbehindLength,
match = match[0].slice(lookbehindLength),
to = from + match.length,
before = str.slice(0, from),
after = str.slice(to);
var args = [i, delNum];
if (before) {
++i;
pos += before.length;
args.push(before);
}
var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias, match, greedy);
args.push(wrapped);
if (after) {
args.push(after);
}
Array.prototype.splice.apply(strarr, args);
if (delNum != 1)
_.matchGrammar(text, strarr, grammar, i, pos, true, token);
if (oneshot)
break;
}
}
}
},
tokenize: function(text, grammar, language) {
var strarr = [text];
var rest = grammar.rest;
if (rest) {
for (var token in rest) {
grammar[token] = rest[token];
}
delete grammar.rest;
}
_.matchGrammar(text, strarr, grammar, 0, 0, false);
return strarr;
},
hooks: {
all: {},
add: function (name, callback) {
var hooks = _.hooks.all;
hooks[name] = hooks[name] || [];
hooks[name].push(callback);
},
run: function (name, env) {
var callbacks = _.hooks.all[name];
if (!callbacks || !callbacks.length) {
return;
}
for (var i=0, callback; callback = callbacks[i++];) {
callback(env);
}
}
}
};
var Token = _.Token = function(type, content, alias, matchedStr, greedy) {
this.type = type;
this.content = content;
this.alias = alias;
// Copy of the full string this token was created from
this.length = (matchedStr || "").length|0;
this.greedy = !!greedy;
};
Token.stringify = function(o, language, parent) {
if (typeof o == 'string') {
return o;
}
if (_.util.type(o) === 'Array') {
return o.map(function(element) {
return Token.stringify(element, language, o);
}).join('');
}
var env = {
type: o.type,
content: Token.stringify(o.content, language, parent),
tag: 'span',
classes: ['token', o.type],
attributes: {},
language: language,
parent: parent
};
if (o.alias) {
var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias];
Array.prototype.push.apply(env.classes, aliases);
}
_.hooks.run('wrap', env);
var attributes = Object.keys(env.attributes).map(function(name) {
return name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
}).join(' ');
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + (attributes ? ' ' + attributes : '') + '>' + env.content + '</' + env.tag + '>';
};
if (!_self.document) {
if (!_self.addEventListener) {
// in Node.js
return _self.Prism;
}
if (!_.disableWorkerMessageHandler) {
// In worker
_self.addEventListener('message', function (evt) {
var message = JSON.parse(evt.data),
lang = message.language,
code = message.code,
immediateClose = message.immediateClose;
_self.postMessage(_.highlight(code, _.languages[lang], lang));
if (immediateClose) {
_self.close();
}
}, false);
}
return _self.Prism;
}
//Get current script and highlight
var script = document.currentScript || [].slice.call(document.getElementsByTagName("script")).pop();
if (script) {
_.filename = script.src;
if (!_.manual && !script.hasAttribute('data-manual')) {
if(document.readyState !== "loading") {
if (window.requestAnimationFrame) {
window.requestAnimationFrame(_.highlightAll);
} else {
window.setTimeout(_.highlightAll, 16);
}
}
else {
document.addEventListener('DOMContentLoaded', _.highlightAll);
}
}
}
return _self.Prism;
})();
if (typeof module !== 'undefined' && module.exports) {
module.exports = Prism;
}
// hack for components to work correctly in node.js
if (typeof global !== 'undefined') {
global.Prism = Prism;
}
;
Prism.languages.markup = {
'comment': /<!--[\s\S]*?-->/,
'prolog': /<\?[\s\S]+?\?>/,
'doctype': /<!DOCTYPE[\s\S]+?>/i,
'cdata': /<!\[CDATA\[[\s\S]*?]]>/i,
'tag': {
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/i,
greedy: true,
inside: {
'tag': {
pattern: /^<\/?[^\s>\/]+/i,
inside: {
'punctuation': /^<\/?/,
'namespace': /^[^\s>\/:]+:/
}
},
'attr-value': {
pattern: /=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+)/i,
inside: {
'punctuation': [
/^=/,
{
pattern: /(^|[^\\])["']/,
lookbehind: true
}
]
}
},
'punctuation': /\/?>/,
'attr-name': {
pattern: /[^\s>\/]+/,
inside: {
'namespace': /^[^\s>\/:]+:/
}
}
}
},
'entity': /&#?[\da-z]{1,8};/i
};
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
Prism.languages.markup['entity'];
// Plugin to make entity title show the real entity, idea by Roman Komarov
Prism.hooks.add('wrap', function(env) {
if (env.type === 'entity') {
env.attributes['title'] = env.content.replace(/&/, '&');
}
});
Prism.languages.xml = Prism.languages.markup;
Prism.languages.html = Prism.languages.markup;
Prism.languages.mathml = Prism.languages.markup;
Prism.languages.svg = Prism.languages.markup;
Prism.languages.css = {
'comment': /\/\*[\s\S]*?\*\//,
'atrule': {
pattern: /@[\w-]+?.*?(?:;|(?=\s*\{))/i,
inside: {
'rule': /@[\w-]+/
// See rest below
}
},
'url': /url\((?:(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,
'selector': /[^{}\s][^{};]*?(?=\s*\{)/,
'string': {
pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
'property': /[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,
'important': /!important\b/i,
'function': /[-a-z0-9]+(?=\()/i,
'punctuation': /[(){};:,]/
};
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
if (Prism.languages.markup) {
Prism.languages.insertBefore('markup', 'tag', {
'style': {
pattern: /(<style[\s\S]*?>)[\s\S]*?(?=<\/style>)/i,
lookbehind: true,
inside: Prism.languages.css,
alias: 'language-css',
greedy: true
}
});
Prism.languages.insertBefore('inside', 'attr-value', {
'style-attr': {
pattern: /\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,
inside: {
'attr-name': {
pattern: /^\s*style/i,
inside: Prism.languages.markup.tag.inside
},
'punctuation': /^\s*=\s*['"]|['"]\s*$/,
'attr-value': {
pattern: /.+/i,
inside: Prism.languages.css
}
},
alias: 'language-css'
}
}, Prism.languages.markup.tag);
}
;
Prism.languages.clike = {
'comment': [
{
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
lookbehind: true
},
{
pattern: /(^|[^\\:])\/\/.*/,
lookbehind: true,
greedy: true
}
],
'string': {
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
greedy: true
},
'class-name': {
pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,
lookbehind: true,
inside: {
punctuation: /[.\\]/
}
},
'keyword': /\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,
'boolean': /\b(?:true|false)\b/,
'function': /\w+(?=\()/,
'number': /\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,
'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,
'punctuation': /[{}[\];(),.:]/
};
Prism.languages.javascript = Prism.languages.extend('clike', {
'class-name': [
Prism.languages.clike['class-name'],
{
pattern: /(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,
lookbehind: true
}
],
'keyword': [
{
pattern: /((?:^|})\s*)(?:catch|finally)\b/,
lookbehind: true
},
/\b(?:as|async|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/
],
'number': /\b(?:(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\d+n|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
'function': /[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*\(|\.(?:apply|bind|call)\()/,
'operator': /-[-=]?|\+[+=]?|!=?=?|<<?=?|>>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/
});
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/
Prism.languages.insertBefore('javascript', 'keyword', {
'regex': {
pattern: /((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})\]]))/,
lookbehind: true,
greedy: true
},
// This must be declared before keyword because we use "function" inside the look-forward
'function-variable': {
pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\([^()]*\)|[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/i,
alias: 'function'
},
'parameter': [
{
pattern: /(function(?:\s+[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)[^\s()][^()]*?(?=\s*\))/,
lookbehind: true,
inside: Prism.languages.javascript
},
{
pattern: /[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/,
inside: Prism.languages.javascript
},
{
pattern: /(\(\s*)[^\s()][^()]*?(?=\s*\)\s*=>)/,
lookbehind: true,
inside: Prism.languages.javascript
},
{
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)[^\s()][^()]*?(?=\s*\)\s*\{)/,
lookbehind: true,
inside: Prism.languages.javascript
}
],
'constant': /\b[A-Z][A-Z\d_]*\b/
});
Prism.languages.insertBefore('javascript', 'string', {
'template-string': {
pattern: /`(?:\\[\s\S]|\${[^}]+}|[^\\`])*`/,
greedy: true,
inside: {
'interpolation': {
pattern: /\${[^}]+}/,
inside: {
'interpolation-punctuation': {
pattern: /^\${|}$/,
alias: 'punctuation'
},
rest: Prism.languages.javascript
}
},
'string': /[\s\S]+/
}
}
});
if (Prism.languages.markup) {
Prism.languages.insertBefore('markup', 'tag', {
'script': {
pattern: /(<script[\s\S]*?>)[\s\S]*?(?=<\/script>)/i,
lookbehind: true,
inside: Prism.languages.javascript,
alias: 'language-javascript',
greedy: true
}
});
}
Prism.languages.js = Prism.languages.javascript;
(function(Prism) {
var insideString = {
variable: [
// Arithmetic Environment
{
pattern: /\$?\(\([\s\S]+?\)\)/,
inside: {
// If there is a $ sign at the beginning highlight $(( and )) as variable
variable: [{
pattern: /(^\$\(\([\s\S]+)\)\)/,
lookbehind: true
},
/^\$\(\(/
],
number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee]-?\d+)?/,
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/,
// If there is no $ sign at the beginning highlight (( and )) as punctuation
punctuation: /\(\(?|\)\)?|,|;/
}
},
// Command Substitution
{
pattern: /\$\([^)]+\)|`[^`]+`/,
greedy: true,
inside: {
variable: /^\$\(|^`|\)$|`$/
}
},
/\$(?:[\w#?*!@]+|\{[^}]+\})/i
]
};
Prism.languages.bash = {
'shebang': {
pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/,
alias: 'important'
},
'comment': {
pattern: /(^|[^"{\\])#.*/,
lookbehind: true
},
'string': [
//Support for Here-Documents https://en.wikipedia.org/wiki/Here_document
{
pattern: /((?:^|[^<])<<\s*)["']?(\w+?)["']?\s*\r?\n(?:[\s\S])*?\r?\n\2/,
lookbehind: true,
greedy: true,
inside: insideString
},
{
pattern: /(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\1)[^\\])*\1/,
greedy: true,
inside: insideString
}
],
'variable': insideString.variable,
// Originally based on http://ss64.com/bash/
'function': {
pattern: /(^|[\s;|&])(?:alias|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|hash|head|help|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logout|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tail|tar|tee|test|time|timeout|times|top|touch|tr|traceroute|trap|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip|zypper)(?=$|[\s;|&])/,
lookbehind: true
},
'keyword': {
pattern: /(^|[\s;|&])(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|[\s;|&])/,
lookbehind: true
},
'boolean': {
pattern: /(^|[\s;|&])(?:true|false)(?=$|[\s;|&])/,
lookbehind: true
},
'operator': /&&?|\|\|?|==?|!=?|<<<?|>>|<=?|>=?|=~/,
'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/
};
var inside = insideString.variable[1].inside;
inside.string = Prism.languages.bash.string;
inside['function'] = Prism.languages.bash['function'];
inside.keyword = Prism.languages.bash.keyword;
inside['boolean'] = Prism.languages.bash['boolean'];
inside.operator = Prism.languages.bash.operator;
inside.punctuation = Prism.languages.bash.punctuation;
Prism.languages.shell = Prism.languages.bash;
})(Prism);
Prism.languages['markup-templating'] = {};
Object.defineProperties(Prism.languages['markup-templating'], {
buildPlaceholders: {
// Tokenize all inline templating expressions matching placeholderPattern
// If the replaceFilter function is provided, it will be called with every match.
// If it returns false, the match will not be replaced.
value: function (env, language, placeholderPattern, replaceFilter) {
if (env.language !== language) {
return;
}
env.tokenStack = [];
env.code = env.code.replace(placeholderPattern, function(match) {
if (typeof replaceFilter === 'function' && !replaceFilter(match)) {
return match;
}
var i = env.tokenStack.length;
// Check for existing strings
while (env.code.indexOf('___' + language.toUpperCase() + i + '___') !== -1)
++i;
// Create a sparse array
env.tokenStack[i] = match;
return '___' + language.toUpperCase() + i + '___';
});
// Switch the grammar to markup
env.grammar = Prism.languages.markup;
}
},
tokenizePlaceholders: {
// Replace placeholders with proper tokens after tokenizing
value: function (env, language) {
if (env.language !== language || !env.tokenStack) {
return;
}
// Switch the grammar back
env.grammar = Prism.languages[language];
var j = 0;
var keys = Object.keys(env.tokenStack);
var walkTokens = function (tokens) {
if (j >= keys.length) {
return;
}
for (var i = 0; i < tokens.length; i++) {
var token = tokens[i];
if (typeof token === 'string' || (token.content && typeof token.content === 'string')) {
var k = keys[j];
var t = env.tokenStack[k];
var s = typeof token === 'string' ? token : token.content;
var index = s.indexOf('___' + language.toUpperCase() + k + '___');
if (index > -1) {
++j;
var before = s.substring(0, index);
var middle = new Prism.Token(language, Prism.tokenize(t, env.grammar, language), 'language-' + language, t);
var after = s.substring(index + ('___' + language.toUpperCase() + k + '___').length);
var replacement;
if (before || after) {
replacement = [before, middle, after].filter(function (v) { return !!v; });
walkTokens(replacement);
} else {
replacement = middle;
}
if (typeof token === 'string') {
Array.prototype.splice.apply(tokens, [i, 1].concat(replacement));
} else {
token.content = replacement;
}
if (j >= keys.length) {
break;
}
}
} else if (token.content && typeof token.content !== 'string') {
walkTokens(token.content);
}
}
};
walkTokens(env.tokens);
}
}
});
Prism.languages.json = {
'comment': /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,
'property': {
pattern: /"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,
greedy: true
},
'string': {
pattern: /"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,
greedy: true
},
'number': /-?\d+\.?\d*(e[+-]?\d+)?/i,
'punctuation': /[{}[\],]/,
'operator': /:/,
'boolean': /\b(?:true|false)\b/,
'null': /\bnull\b/
};
Prism.languages.jsonp = Prism.languages.json;
Prism.languages.nginx = Prism.languages.extend('clike', {
'comment': {
pattern: /(^|[^"{\\])#.*/,
lookbehind: true
},
'keyword': /\b(?:CONTENT_|DOCUMENT_|GATEWAY_|HTTP_|HTTPS|if_not_empty|PATH_|QUERY_|REDIRECT_|REMOTE_|REQUEST_|SCGI|SCRIPT_|SERVER_|http|events|accept_mutex|accept_mutex_delay|access_log|add_after_body|add_before_body|add_header|addition_types|aio|alias|allow|ancient_browser|ancient_browser_value|auth|auth_basic|auth_basic_user_file|auth_http|auth_http_header|auth_http_timeout|autoindex|autoindex_exact_size|autoindex_localtime|break|charset|charset_map|charset_types|chunked_transfer_encoding|client_body_buffer_size|client_body_in_file_only|client_body_in_single_buffer|client_body_temp_path|client_body_timeout|client_header_buffer_size|client_header_timeout|client_max_body_size|connection_pool_size|create_full_put_path|daemon|dav_access|dav_methods|debug_connection|debug_points|default_type|deny|devpoll_changes|devpoll_events|directio|directio_alignment|disable_symlinks|empty_gif|env|epoll_events|error_log|error_page|expires|fastcgi_buffer_size|fastcgi_buffers|fastcgi_busy_buffers_size|fastcgi_cache|fastcgi_cache_bypass|fastcgi_cache_key|fastcgi_cache_lock|fastcgi_cache_lock_timeout|fastcgi_cache_methods|fastcgi_cache_min_uses|fastcgi_cache_path|fastcgi_cache_purge|fastcgi_cache_use_stale|fastcgi_cache_valid|fastcgi_connect_timeout|fastcgi_hide_header|fastcgi_ignore_client_abort|fastcgi_ignore_headers|fastcgi_index|fastcgi_intercept_errors|fastcgi_keep_conn|fastcgi_max_temp_file_size|fastcgi_next_upstream|fastcgi_no_cache|fastcgi_param|fastcgi_pass|fastcgi_pass_header|fastcgi_read_timeout|fastcgi_redirect_errors|fastcgi_send_timeout|fastcgi_split_path_info|fastcgi_store|fastcgi_store_access|fastcgi_temp_file_write_size|fastcgi_temp_path|flv|geo|geoip_city|geoip_country|google_perftools_profiles|gzip|gzip_buffers|gzip_comp_level|gzip_disable|gzip_http_version|gzip_min_length|gzip_proxied|gzip_static|gzip_types|gzip_vary|if|if_modified_since|ignore_invalid_headers|image_filter|image_filter_buffer|image_filter_jpeg_quality|image_filter_sharpen|image_filter_transparency|imap_capabilities|imap_client_buffer|include|index|internal|ip_hash|keepalive|keepalive_disable|keepalive_requests|keepalive_timeout|kqueue_changes|kqueue_events|large_client_header_buffers|limit_conn|limit_conn_log_level|limit_conn_zone|limit_except|limit_rate|limit_rate_after|limit_req|limit_req_log_level|limit_req_zone|limit_zone|lingering_close|lingering_time|lingering_timeout|listen|location|lock_file|log_format|log_format_combined|log_not_found|log_subrequest|map|map_hash_bucket_size|map_hash_max_size|master_process|max_ranges|memcached_buffer_size|memcached_connect_timeout|memcached_next_upstream|memcached_pass|memcached_read_timeout|memcached_send_timeout|merge_slashes|min_delete_depth|modern_browser|modern_browser_value|mp4|mp4_buffer_size|mp4_max_buffer_size|msie_padding|msie_refresh|multi_accept|open_file_cache|open_file_cache_errors|open_file_cache_min_uses|open_file_cache_valid|open_log_file_cache|optimize_server_names|override_charset|pcre_jit|perl|perl_modules|perl_require|perl_set|pid|pop3_auth|pop3_capabilities|port_in_redirect|post_action|postpone_output|protocol|proxy|proxy_buffer|proxy_buffer_size|proxy_buffering|proxy_buffers|proxy_busy_buffers_size|proxy_cache|proxy_cache_bypass|proxy_cache_key|proxy_cache_lock|proxy_cache_lock_timeout|proxy_cache_methods|proxy_cache_min_uses|proxy_cache_path|proxy_cache_use_stale|proxy_cache_valid|proxy_connect_timeout|proxy_cookie_domain|proxy_cookie_path|proxy_headers_hash_bucket_size|proxy_headers_hash_max_size|proxy_hide_header|proxy_http_version|proxy_ignore_client_abort|proxy_ignore_headers|proxy_intercept_errors|proxy_max_temp_file_size|proxy_method|proxy_next_upstream|proxy_no_cache|proxy_pass|proxy_pass_error_message|proxy_pass_header|proxy_pass_request_body|proxy_pass_request_headers|proxy_read_timeout|proxy_redirect|proxy_redirect_errors|proxy_send_lowat|proxy_send_timeout|proxy_set_body|proxy_set_header|proxy_ssl_session_reuse|proxy_store|proxy_store_access|proxy_temp_file_write_size|proxy_temp_path|proxy_timeout|proxy_upstream_fail_timeout|proxy_upstream_max_fails|random_index|read_ahead|real_ip_header|recursive_error_pages|request_pool_size|reset_timedout_connection|resolver|resolver_timeout|return|rewrite|root|rtsig_overflow_events|rtsig_overflow_test|rtsig_overflow_threshold|rtsig_signo|satisfy|satisfy_any|secure_link_secret|send_lowat|send_timeout|sendfile|sendfile_max_chunk|server|server_name|server_name_in_redirect|server_names_hash_bucket_size|server_names_hash_max_size|server_tokens|set|set_real_ip_from|smtp_auth|smtp_capabilities|so_keepalive|source_charset|split_clients|ssi|ssi_silent_errors|ssi_types|ssi_value_length|ssl|ssl_certificate|ssl_certificate_key|ssl_ciphers|ssl_client_certificate|ssl_crl|ssl_dhparam|ssl_engine|ssl_prefer_server_ciphers|ssl_protocols|ssl_session_cache|ssl_session_timeout|ssl_verify_client|ssl_verify_depth|starttls|stub_status|sub_filter|sub_filter_once|sub_filter_types|tcp_nodelay|tcp_nopush|timeout|timer_resolution|try_files|types|types_hash_bucket_size|types_hash_max_size|underscores_in_headers|uninitialized_variable_warn|upstream|use|user|userid|userid_domain|userid_expires|userid_name|userid_p3p|userid_path|userid_service|valid_referers|variables_hash_bucket_size|variables_hash_max_size|worker_connections|worker_cpu_affinity|worker_priority|worker_processes|worker_rlimit_core|worker_rlimit_nofile|worker_rlimit_sigpending|working_directory|xclient|xml_entities|xslt_entities|xslt_stylesheet|xslt_types|ssl_session_tickets|ssl_stapling|ssl_stapling_verify|ssl_ecdh_curve|ssl_trusted_certificate|more_set_headers|ssl_early_data)\b/i
});
Prism.languages.insertBefore('nginx', 'keyword', {
'variable': /\$[a-z_]+/i
});
/**
* Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/
* Modified by Miles Johnson: http://milesj.me
*
* Supports the following:
* - Extends clike syntax
* - Support for PHP 5.3+ (namespaces, traits, generators, etc)
* - Smarter constant and function matching
*
* Adds the following new token classes:
* constant, delimiter, variable, function, package
*/
(function (Prism) {
Prism.languages.php = Prism.languages.extend('clike', {
'keyword': /\b(?:and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i,
'constant': /\b[A-Z0-9_]{2,}\b/,
'comment': {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,
lookbehind: true
}
});
Prism.languages.insertBefore('php', 'string', {
'shell-comment': {
pattern: /(^|[^\\])#.*/,
lookbehind: true,
alias: 'comment'
}
});
Prism.languages.insertBefore('php', 'keyword', {
'delimiter': {
pattern: /\?>|<\?(?:php|=)?/i,
alias: 'important'
},
'variable': /\$+(?:\w+\b|(?={))/i,
'package': {
pattern: /(\\|namespace\s+|use\s+)[\w\\]+/,
lookbehind: true,
inside: {
punctuation: /\\/
}
}
});
// Must be defined after the function pattern
Prism.languages.insertBefore('php', 'operator', {
'property': {
pattern: /(->)[\w]+/,
lookbehind: true
}
});
var string_interpolation = {
pattern: /{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,
lookbehind: true,
inside: {
rest: Prism.languages.php
}
};
Prism.languages.insertBefore('php', 'string', {
'nowdoc-string': {
pattern: /<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,
greedy: true,
alias: 'string',
inside: {
'delimiter': {
pattern: /^<<<'[^']+'|[a-z_]\w*;$/i,
alias: 'symbol',
inside: {
'punctuation': /^<<<'?|[';]$/
}
}
}
},
'heredoc-string': {
pattern: /<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,
greedy: true,
alias: 'string',
inside: {
'delimiter': {
pattern: /^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,
alias: 'symbol',
inside: {
'punctuation': /^<<<"?|[";]$/
}
},
'interpolation': string_interpolation // See below
}
},
'single-quoted-string': {
pattern: /'(?:\\[\s\S]|[^\\'])*'/,
greedy: true,
alias: 'string'
},
'double-quoted-string': {
pattern: /"(?:\\[\s\S]|[^\\"])*"/,
greedy: true,
alias: 'string',
inside: {
'interpolation': string_interpolation // See below
}
}
});
// The different types of PHP strings "replace" the C-like standard string
delete Prism.languages.php['string'];
Prism.hooks.add('before-tokenize', function(env) {
if (!/(?:<\?php|<\?)/ig.test(env.code)) {
return;
}
var phpPattern = /(?:<\?php|<\?)[\s\S]*?(?:\?>|$)/ig;
Prism.languages['markup-templating'].buildPlaceholders(env, 'php', phpPattern);
});
Prism.hooks.add('after-tokenize', function(env) {
Prism.languages['markup-templating'].tokenizePlaceholders(env, 'php');
});
}(Prism));
Prism.languages.insertBefore('php', 'variable', {
'this': /\$this\b/,
'global': /\$(?:_(?:SERVER|GET|POST|FILES|REQUEST|SESSION|ENV|COOKIE)|GLOBALS|HTTP_RAW_POST_DATA|argc|argv|php_errormsg|http_response_header)\b/,
'scope': {
pattern: /\b[\w\\]+::/,
inside: {
keyword: /static|self|parent/,
punctuation: /::|\\/
}
}
});
Prism.languages.sql = {
'comment': {
pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,
lookbehind: true
},
'variable': [
{
pattern: /@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,
greedy: true
},
/@[\w.$]+/
],
'string': {
pattern: /(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,
greedy: true,
lookbehind: true
},
'function': /\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i, // Should we highlight user defined functions too?
'keyword': /\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,
'boolean': /\b(?:TRUE|FALSE|NULL)\b/i,
'number': /\b0x[\da-f]+\b|\b\d+\.?\d*|\B\.\d+\b/i,
'operator': /[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,
'punctuation': /[;[\]()`,.]/
};
| 35.155052 | 5,601 | 0.640096 |
75cdb9faf85ecad1b55c8d7e53538420cc73a85c | 631 | js | JavaScript | routes/ssr.js | seeia/preact-ssr-demo | e1eae8b7fbe2a805d6560ba5888630534c0ceab0 | [
"MIT"
] | 1 | 2018-04-04T03:10:11.000Z | 2018-04-04T03:10:11.000Z | routes/ssr.js | seeia/preact-ssr-demo | e1eae8b7fbe2a805d6560ba5888630534c0ceab0 | [
"MIT"
] | null | null | null | routes/ssr.js | seeia/preact-ssr-demo | e1eae8b7fbe2a805d6560ba5888630534c0ceab0 | [
"MIT"
] | null | null | null | const express = require('express');
const router = express.Router();
const fs = require('fs')
const render = require('preact-render-to-string');
const { h } = require('preact');
const RGX = /<div id="app"><\/div>/i;
const App = require('../src/index/App').default
const PROJECT_PATH = process.cwd()
console.log('aas', __dirname, process.cwd() + '/../views/template.html')
const template = fs.readFileSync( process.cwd() + '/views/template.html', 'utf8');
router.get('/', (req, res, next) => {
let url = req.url;
let body = render(h(App));
let temp = template.replace(RGX, body)
res.send(temp);
})
module.exports = router; | 33.210526 | 82 | 0.660856 |
75ce71045a69aab2d2f4e2770a9dc9d75b0873b1 | 874 | js | JavaScript | src/styles.js | puckybreg/orange-playground | 25db7294383ace652a53c21af1d01b7b7beca8cf | [
"Apache-2.0"
] | 1 | 2017-09-27T20:40:58.000Z | 2017-09-27T20:40:58.000Z | src/styles.js | puckybreg/orange-playground | 25db7294383ace652a53c21af1d01b7b7beca8cf | [
"Apache-2.0"
] | null | null | null | src/styles.js | puckybreg/orange-playground | 25db7294383ace652a53c21af1d01b7b7beca8cf | [
"Apache-2.0"
] | null | null | null | import { StyleSheet } from 'react-native';
//styles
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
authContainer: {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0,
},
content: {
padding: 30,
flex: 1,
},
inputIcon: {
width: 30,
},
input: {
marginBottom: 20,
},
button: {
marginTop: 20,
alignSelf: 'center',
width: 150,
},
logContainer: {
flex: 1,
alignItems: 'center',
backgroundColor: '#1B1B1B',
},
logText: {
fontWeight: 'bold',
fontSize: 45,
color: '#ffffff',
},
text: {
fontFamily: 'Cochin',
fontWeight: 'bold',
fontSize: 20,
justifyContent: 'center',
},
icon: {
width: 26,
height: 26,
},
});
export default styles; | 15.890909 | 42 | 0.549199 |
75cf6665e9ca3b425a82cb1e4b609357b13725b3 | 1,393 | js | JavaScript | win95/src/components/StartMenu/StartMenu.js | ManSleen/MV-Portfolio | f91259b7c253c065660c1e113ecf0f772cedbcc2 | [
"MIT"
] | null | null | null | win95/src/components/StartMenu/StartMenu.js | ManSleen/MV-Portfolio | f91259b7c253c065660c1e113ecf0f772cedbcc2 | [
"MIT"
] | 4 | 2020-09-06T05:46:17.000Z | 2022-02-26T14:33:05.000Z | win95/src/components/StartMenu/StartMenu.js | ManSleen/MV-Portfolio | f91259b7c253c065660c1e113ecf0f772cedbcc2 | [
"MIT"
] | 1 | 2019-08-18T21:51:36.000Z | 2019-08-18T21:51:36.000Z | import React from "react";
import { List } from "@react95/core";
import "../StartMenu/StartMenu.css";
const StartMenu = () => {
return (
<div className="start-menu-container">
<List width={250}>
<List.Item icon="folder_exe2">
<List>
<List.Item icon="folder_exe">Accessories</List.Item>
<List.Item icon="folder_exe">StartUp</List.Item>
<List.Item icon="microsoft_exchange">Microsoft Exchange</List.Item>
<List.Item icon="ms_dos">MS-DOS Prompt</List.Item>
<List.Item icon="microsoft_network">
The Microsoft Network
</List.Item>
<List.Item icon="windows_explorer">Windows Explorer</List.Item>
</List>
Programs
</List.Item>
<List.Item icon="folder_file">Documents</List.Item>
<List.Item icon="settings">
<List>
<List.Item icon="folder_settings">Control Panel</List.Item>
<List.Item icon="folder_print">Printers</List.Item>
</List>
Settings
</List.Item>
<List.Item icon="file_find">Find</List.Item>
<List.Item icon="help_book">Help</List.Item>
<List.Item icon="loader_bat">Run...</List.Item>
<List.Divider />
<List.Item icon="computer_3">Shut Down...</List.Item>
</List>
</div>
);
};
export default StartMenu;
| 33.97561 | 79 | 0.578607 |
75cf9747da4331268373456a99d02a25bb067ceb | 139 | js | JavaScript | src/application/server/index.js | brunofurmon/job-scheduler | 5d325b17d0081dc03ab98208af31512882130c37 | [
"Unlicense"
] | 6 | 2021-04-05T19:53:16.000Z | 2021-09-23T17:53:22.000Z | src/application/server/index.js | brunofurmon/job-scheduler | 5d325b17d0081dc03ab98208af31512882130c37 | [
"Unlicense"
] | null | null | null | src/application/server/index.js | brunofurmon/job-scheduler | 5d325b17d0081dc03ab98208af31512882130c37 | [
"Unlicense"
] | null | null | null | const container = require('../../container');
const server = container.resolve('server');
(async () => {
await server.start();
})();
| 17.375 | 45 | 0.604317 |
75cfa46e6a39bcec098bef7727b9be4b2ad2fe2c | 632 | js | JavaScript | src/containers/Main.js | hmochizuki/calculator | 24bdb50f2bd38e7c239f53a11be9f75f332c764d | [
"MIT"
] | 2 | 2018-09-17T06:46:16.000Z | 2018-09-17T06:46:16.000Z | src/containers/Main.js | hmochizuki/myHome | 24bdb50f2bd38e7c239f53a11be9f75f332c764d | [
"MIT"
] | null | null | null | src/containers/Main.js | hmochizuki/myHome | 24bdb50f2bd38e7c239f53a11be9f75f332c764d | [
"MIT"
] | null | null | null | import React, {Component} from 'react'
import { connect } from 'react-redux'
import Calculator from './CalculatorContainer'
const chooseMainContent = (content) => {
switch(content) {
case 'calculator':
return(<div><Calculator/></div>)
case 'todoList':
return(<div><p>aaa</p></div>)
default:
return(<div>coming soon!</div>)
}
}
class Main extends Component {
render() {
const {contents} = this.props
return (
<div>{chooseMainContent(contents)}</div>
)
}
}
const mapState = (state, ownProps) => ({
contents: state.app.contents,
});
export default connect(mapState)(Main);
| 19.75 | 46 | 0.637658 |
75d300545b9032e0d90165f595b4eaf802a42a37 | 148 | js | JavaScript | resources/src/modules/sharedComponents/charts/BarChartDataSet.js | jesusantguerrero/ic_payment-vue | d48df449402534f8c4dd942b7cd8d1ff8023491b | [
"MIT"
] | 1 | 2018-03-20T19:29:11.000Z | 2018-03-20T19:29:11.000Z | resources/src/modules/sharedComponents/charts/BarChartDataSet.js | jesusantguerrero/ic_payment-vue | d48df449402534f8c4dd942b7cd8d1ff8023491b | [
"MIT"
] | 1 | 2021-02-03T13:57:53.000Z | 2021-02-03T13:57:53.000Z | resources/src/modules/sharedComponents/charts/BarChartDataSet.js | jesusantguerrero/ic_payment-vue | d48df449402534f8c4dd942b7cd8d1ff8023491b | [
"MIT"
] | 1 | 2019-03-02T05:29:59.000Z | 2019-03-02T05:29:59.000Z | export default [{
label: '',
data: '',
backgroundColor: 'rgba(54, 162, 235, 1)',
borderColor: 'rgba(54, 162, 235, 1)',
borderWidth: 1
}];
| 18.5 | 43 | 0.581081 |
75d329c30e67f9382628cd45218e723badd9b4dd | 352 | js | JavaScript | index.js | luckydrq/tcp-net | 106640a09179674449ff898c727fc0b36cf5dc0f | [
"MIT"
] | 38 | 2019-01-30T14:48:02.000Z | 2022-02-20T05:15:21.000Z | index.js | luckydrq/tcp-net | 106640a09179674449ff898c727fc0b36cf5dc0f | [
"MIT"
] | 2 | 2019-07-17T13:37:30.000Z | 2021-05-08T03:46:03.000Z | index.js | luckydrq/tcp-net | 106640a09179674449ff898c727fc0b36cf5dc0f | [
"MIT"
] | 9 | 2019-07-04T13:34:49.000Z | 2022-02-23T07:52:36.000Z | /**!
* tcp-net
*
* Authors:
* luckydrq <drqzju@gmail.com> (http://github.com/luckydrq)
*/
'use strict';
/**
* Module dependencies.
*/
exports.Connection = require('./lib/connection');
exports.LengthBasedProtocol = require('./lib/protocols/length_based_protocol');
exports.LineBasedProtocol = require('./lib/protocols/line_based_protocol');
| 20.705882 | 79 | 0.704545 |
75d32c8c56dcb455a38bb4ebbb0fa7e9204156b7 | 46,145 | js | JavaScript | scripts/controls/panels.js | dgrechka/FetchClimateWebClient | 9e77e12f03d973f87da41839b6f86e5807a978f8 | [
"MIT"
] | 10 | 2016-09-30T13:31:48.000Z | 2018-08-18T01:59:38.000Z | scripts/controls/panels.js | dgrechka/FetchClimateWebClient | 9e77e12f03d973f87da41839b6f86e5807a978f8 | [
"MIT"
] | null | null | null | scripts/controls/panels.js | dgrechka/FetchClimateWebClient | 9e77e12f03d973f87da41839b6f86e5807a978f8 | [
"MIT"
] | 9 | 2019-11-02T21:36:04.000Z | 2021-11-16T02:52:44.000Z | (function (FC, $) {
(function (Controls) {
"use strict";
Controls.Panel = function (source) {
var self = this;
var _$panel = typeof source !== "undefined" ? source : $("<div></div>");
_$panel.addClass("fc-panel");
Object.defineProperty(self, "$panel", {
get: function () {
return _$panel;
}
});
self.append = function ($child) {
_$panel.append($child);
};
self.appendTo = function ($parent) {
_$panel.appendTo($parent);
};
self.show = function (animation) {
_$panel.show.apply(_$panel, animation);
};
self.hide = function (animation) {
_$panel.hide.apply(_$panel, animation);
};
};
Controls.Panel.isAnyRightPanelVisible = function () {
return $(".fc-panel.right").is(":visible");
};
Controls.NamedPanel = function (source) {
var self = this;
self.base = Controls.Panel;
self.base(source);
var _$header;
var _$content;
Object.defineProperties(self, {
$header: {
get: function () {
return _$header;
},
set: function (title) {
_$header.text(title);
}
},
$content: {
get: function () {
return _$content;
}
}
});
_$header = typeof source !== "undefined" ? self.$panel.find(".fc-panel-header") :
$("<div></div", {
class: "fc-panel-header"
}).appendTo(self.$panel);
_$content = typeof source !== "undefined" ? self.$panel.find(".fc-panel-content") :
$("<div></div>", {
class: "fc-panel-content"
}).appendTo(self.$panel);
};
Controls.NamedPanel.prototype = new Controls.Panel();
Controls.DataSourcePanel = function (source) {
var self = this;
self.base = Controls.NamedPanel;
self.base(source);
self.$panel.addClass("datasource-panel right");
var _$description;
var _$details;
Object.defineProperties(self, {
$description: {
get: function () {
return _$description;
},
set: function (description) {
_$description.text(description);
}
},
$details: {
get: function () {
return _$details;
},
set: function (details) {
if ("undefined" === typeof details) {
return false;
}
var _variables = $("<div></div>");
$("<strong></strong>", {
text: "Variables: "
}).appendTo(_variables);
$("<span></span>", {
text: details.ProvidedVariables.join(", ")
}).appendTo(_variables);
var _copyright = $("<div></div>");
$("<strong></strong>", {
text: "Copyright: "
}).appendTo(_copyright);
$("<span></span>", {
text: details.Copyright || "Not provided"
}).appendTo(_copyright);
_$details.append(_variables)
.append(_copyright);
}
}
});
// Hide the panel on click outside of the panel.
function onDocumentClick(event) {
if (!self.$panel.is(event.target) && !self.$panel.has(event.target).length) {
self.hide();
$(document).off("click", onDocumentClick);
}
}
self.initialize = function (datasource) {
self.$content.empty();
_$description = $("<div></div>", {
class: "datasource-description",
}).appendTo(self.$content);
_$details = $("<div></div>", {
class: "datasource-details"
}).appendTo(self.$content);
self.$header = datasource.Name;
self.$description = datasource.Description;
self.$details = datasource;
$(document).click(onDocumentClick);
};
var _baseHide = self.hide;
self.hide = function () {
_baseHide(["slide",
{ direction: "right" },
500]);
};
var _baseShow = self.show;
self.show = function () {
_baseShow(["slide",
{ direction: "right" },
500]);
};
};
Controls.DataSourcePanel.prototype = new Controls.NamedPanel();
Controls.MapOptionsPanel = function (source) {
var self = this;
self.base = Controls.NamedPanel;
self.base(source);
// TODO: Show attribution of the chosen map, limit map types for
// problematic markets.
var _mapTypes = {
// worldTopo: {
// title: "World Topography",
// value: D3.BingMaps.ESRI.GetWorldTopo()
// },
// deLorme: {
// title: "DeLorme World Basemap",
// value: D3.BingMaps.ESRI.GetDeLorme()
// },
// worldImagery: {
// title: "ESRI World Imager",
// value: D3.BingMaps.ESRI.GetWorldImagery()
// },
// oceanBasemap: {
// title: "Ocean Basemap",
// value: D3.BingMaps.ESRI.GetOceanBasemap()
// },
// worldTerrainBase: {
// title: "World Terrain Base",
// value: D3.BingMaps.ESRI.GetWorldTerrainBase()
// },
// nationalGeographicMap: {
// title: "National Geographic World Map",
// value: D3.BingMaps.ESRI.GetNationalGeographicMap()
// },
// worldShadedRelief: {
// title: "World Shaded Relief",
// value: D3.BingMaps.ESRI.GetWorldShadedRelief()
// },
// tileSource: {
// title: "Open Street Map",
// value: D3.BingMaps.OpenStreetMap.GetTileSource()
// },
road: {
title: "Bing Maps Road",
value: Microsoft.Maps.MapTypeId.road,
selected: true
},
aerial: {
title: "Bing Maps Aerial",
value: Microsoft.Maps.MapTypeId.aerial
},
};
self.$content.append($("<div></div>")
.addClass("control-header")
.text("Map style")
);
var _$mapTypeSelector = $("<div></div>")
.addClass("map-type-selector")
.appendTo(self.$content)
.append($("<select></select>"));
var _$opacitySliderTitle = $("<div></div>")
.addClass("control-header")
.text("Layer opacity")
.appendTo(self.$content);
var _$opacitySlider = $("<div></div>")
.addClass("fc-time-slider transparency-slider")
.appendTo(self.$content)
.labeledSlider();
var labels = FC.parseMatlabSequence("0:100");
_$opacitySlider.setLabels(labels);
self.$header = "Map options";
self.$panel.addClass("map-options-panel right");
Object.defineProperty(self, "$opacitySlider", {
get: function () {
return _$opacitySlider;
}
});
// Hide the panel on click outside of the panel.
function onDocumentClick(event) {
if (!self.$panel.is(event.target) && !self.$panel.has(event.target).length) {
self.hide();
$(document).off("click", onDocumentClick);
}
}
self.initialize = function (map) {
var $select = _$mapTypeSelector.find("select");
for (var option in _mapTypes) {
var $option = $("<option></option>", {
value: option,
text: _mapTypes[option].title
});
$select.append($option);
if (_mapTypes[option].selected) {
$option.attr("selected", true);
}
}
$select.change(function () {
var mapType = _mapTypes[$(this).val()].value;
FC.mapEntities.setMapType(mapType);
});
};
var _baseHide = self.hide;
self.hide = function () {
_baseHide(["slide", { direction: "right" }, 500]);
};
var _baseShow = self.show;
self.show = function () {
_$opacitySlider.toggle(FC.state.activePage === "results");
_$opacitySliderTitle.toggle(FC.state.activePage === "results");
_baseShow(["slide", { direction: "right" }, 500]);
$(document).on("click touchend", onDocumentClick);
};
};
Controls.MapOptionsPanel.prototype = new Controls.NamedPanel();
Controls.MapSearchPanel = function (source) {
var self = this;
self.base = Controls.NamedPanel;
self.base(source);
var _lat, _lon, _name;
var _$pointTemplate = $("#area-selection-point .area-point");
var _$searchMessage = $("<div></div>").addClass("search-message");
var _$searchProgress = $("<div></div>").addClass("search-progress");
var _$searchInput = $("<input></input>")
.addClass("search-input")
.appendTo(self.$content)
.after(_$searchMessage)
.after(_$searchProgress);
self.$header = "Find location";
self.$panel.addClass("map-search-panel right");
// Hide the panel on click outside of the panel.
function onDocumentClick(event) {
if (!self.$panel.is(event.target) && !self.$panel.has(event.target).length) {
self.hide();
$(document).off("click", onDocumentClick);
}
}
// TODO: Add tile and update Client State (as in onPointModeComplete handler).
function onAddPoint(event) {
var mapPoint;
if (_lat && _lon) {
mapPoint = FC.mapEntities.addPoint(_lat, _lon, {
name: _name,
isActive: true
});
self.$content.trigger("pointschanged", {
point: new FC.GeoPoint(_lat, _lon, _name),
mapPoint: mapPoint
});
}
}
// NOTE: http://vivien-chevallier.com/Articles/use-bing-maps-rest-services-with-jquery-to-build-an-autocomplete-box-and-find-a-location-dynamically
self.initialize = function () {
var centerResult = function (item) {
_lat = item.point.coordinates[0];
_lon = item.point.coordinates[1];
_name = item.name;
FC.mapEntities.setView(_lat, _lon);
};
// Fix for iPad touch event.
_$searchInput.on("blur.autocomplete", function (event) {
if ((/iPhone|iPod|iPad/i).test(navigator.userAgent)) {
event.stopImmediatePropagation();
}
});
_$searchInput.autocomplete({
delay: FC.Settings.MAP_SEARCH_DELAY,
minLength: 1,
source: function (request, response) {
// Reset stored coordinates.
_lat = _lon = null;
_$searchMessage.hide();
_$searchProgress.show();
// Make a request for new results.
$.ajax({
url: FC.Settings.BING_MAPS_LOCATIONS_SEARCH_URL,
dataType: "jsonp",
data: {
key: FC.Settings.BING_MAPS_API_KEY,
q: request.term
},
jsonp: "jsonp",
success: function (data) {
var result = data.resourceSets[0];
_$searchProgress.hide();
if (result && result.estimatedTotal > 0) {
response($.map(result.resources, function (item) {
return {
data: item,
label: item.name + " (" + item.address.countryRegion + ")",
value: item.name
};
}));
}
},
error: function (data) {
_$searchProgress.hide();
_$searchMessage.show().text("The search service is unavailable. Please try again later.");
}
});
},
select: function (event, ui) {
centerResult(ui.item.data);
onAddPoint();
}
});
};
var _baseHide = self.hide;
self.hide = function () {
_baseHide(["slide", {
direction: "right",
complete: function () {
_$searchMessage.hide();
_$searchProgress.hide();
}
}, 500]);
};
var _baseShow = self.show;
self.show = function () {
_baseShow(["slide", {
direction: "right",
complete: function () {
_$searchInput.focus();
}
}, 500]);
$(document).on("click touchend", onDocumentClick);
};
};
Controls.MapSearchPanel.prototype = new Controls.NamedPanel();
Controls.MapAreaSelectionPanel = function MapAreaSelectionPanel(source) {
var self = this;
self.base = Controls.NamedPanel;
self.base(source);
var _$gridTemplate = $("#area-selection-grid .area-grid"),
_$pointTemplate = $("#area-selection-point .area-point"),
_$controls = self.$panel.find(".area-selection-panel-controls"),
_$addGridBtn = _$controls.find(".add-grid-btn"),
_$addPointBtn = _$controls.find(".add-point-btn"),
_$clearAllBtn = _$controls.find(".remove-areas-btn"),
_$panelMessage = self.$panel.find(".fc-panel-message"),
_$separator = self.$panel.find(".separator-horizontal");
Object.defineProperties(self, {
$addGridButton: { get: function () { return _$addGridBtn; } },
$addPointButton: { get: function () { return _$addPointBtn; } }
});
self.update = function () {
var isEmpty = FC.state.grids.length === 0 && FC.state.points.length === 0;
if (isEmpty) {
_$clearAllBtn.hide();
_$separator.hide();
_$panelMessage.text(FC.Settings.GEOGRAPHY_EMPTY_MESSAGE).show();
} else {
_$clearAllBtn.show();
_$panelMessage.hide();
_$separator.show();
}
}
var onRegionModeComplete = function (r) {
var gridTile;
if (!r) {
_$addGridBtn.removeClass("active");
return;
}
gridTile = new FC.Controls.AreaSelection.Grid({
source: _$gridTemplate.clone(true, true),
name: r.name,
mesh: {
latmin: r.min.latitude,
lonmin: r.min.longitude,
latmax: r.max.latitude,
lonmax: r.max.longitude,
latcount: 25,
loncount: 25
}
});
// gridTile.name = "Region " + (FC.state.grids.length + 1);
// Adding new grid after last grid in a list if any
if (self.$content.find(".area-grid").length) {
self.$content.find(".area-grid:last").after(gridTile.$area);
}
// otherwise adding before first point in a list if any
else if (self.$content.find(".area-point").length) {
self.$content.find(".area-point:first").before(gridTile.$area);
}
// otherwise adding as first item in a list.
else {
gridTile.appendTo(self.$content);
}
var grid = new FC.GeoGrid(
parseFloat(r.min.latitude),
parseFloat(r.max.latitude),
25,
parseFloat(r.min.longitude),
parseFloat(r.max.longitude),
25,
gridTile.name);
self.$content.parent().nanoScroller();
// Triggers that grids in client state to be updated.
self.$panel.trigger("gridschanged", {
grid: grid,
gridTile: gridTile,
mapRegion: r
});
};
var onPointModeComplete = function (p) {
var pointTile;
if (!p) {
_$addPointBtn.removeClass("active");
return;
}
pointTile = new FC.Controls.AreaSelection.Point({
source: _$pointTemplate.clone(true, true),
name: p.name,
mesh: {
lat: p.latitude,
lon: p.longitude
}
});
// pointTile.name = "Point " + (FC.state.points.length + 1);
// Adding new point in the end of the list.
pointTile.appendTo(self.$content);
var point = new FC.GeoPoint(
parseFloat(p.latitude),
parseFloat(p.longitude),
pointTile.name);
self.$content.parent().nanoScroller();
// Triggers that points in client state to be updated.
self.$panel.trigger("pointschanged", {
point: point,
pointTile: pointTile,
mapPoint: p
});
};
_$addGridBtn.on("click", function addGrid () {
_$addGridBtn.addClass("active");
_$addPointBtn.removeClass("active");
FC.mapEntities.toggleRegionMode(onRegionModeComplete);
});
_$addPointBtn.on("click", function addPoint () {
_$addPointBtn.addClass("active");
_$addGridBtn.removeClass("active");
FC.mapEntities.togglePointMode(onPointModeComplete);
});
_$clearAllBtn.on("click", function removeAreas () {
if (self.$content.find(".area-selection").length && window.confirm("Are you sure want to delete all selected areas?")) {
self.$content.empty();
FC.state.setGrids([]);
FC.state.setPoints([]);
FC.mapEntities.removeAll();
self.update();
}
});
$(window).on("resize", function () {
var paddingTop = parseFloat(self.$panel.css("padding-top").replace(/em|px|pt|%/, "")),
headerHeight = self.$header.outerHeight() +
parseFloat(self.$header.css("margin-top").replace(/em|px|pt|%/, "")) +
parseFloat(self.$header.css("margin-bottom").replace(/em|px|pt|%/, "")),
controlsHeight = self.$panel.find(".area-selection-panel-controls").outerHeight() +
parseFloat(self.$panel.find(".area-selection-panel-controls").css("margin-bottom").replace(/em|px|pt|%/, "")),
separatorHeight = self.$panel.find(".separator-horizontal:first").height(),
// Total height taken in panel.
heightTaken = paddingTop + headerHeight + controlsHeight + separatorHeight;
self.$content.parent().nanoScroller();
self.$content.parent().css("max-height", (self.$panel.outerHeight() - heightTaken) + "px");
//self.$content.css("max-height", (self.$panel.outerHeight() - heightTaken) + "px");
});
// Initializating initial size of selected areas wrapper.
$(window).trigger("resize");
};
Controls.MapAreaSelectionPanel.prototype = new Controls.NamedPanel();
Controls.ResultsPanel = function ResultsPanel(source) {
var self = this;
self.base = Controls.NamedPanel;
self.base(source);
var _$controls = self.$panel.find(".fc-panel-controls");
var _$layersTab = self.$panel.find(".tab.layers");
var _$detailsTab = self.$panel.find(".tab.details");
var _$layersTabContent = self.$panel.find(".tab-content.layers");
var _$detailsTabContent = self.$panel.find(".tab-content.details");
var _$dataInfoControl = self.$panel.find(".data-info-control");
var _$timeChartControl = self.$panel.find(".time-chart-control");
var _$tiles = self.$panel.find(".results-tiles");
var _$probeToggleBtn = self.$panel.find(".toggle-probemode");
var _$panelMessage = self.$panel.find(".fc-panel-message");
var _$slicePanelToggleBtn = self.$panel.find(".toggle-slice-panel-btn");
var _$slicePanelToggleBtnState = self.$panel.find(".toggle-slice-panel-btn-container b");
var _dataInfoControl = new FC.Controls.DataInfoControl(_$dataInfoControl);
var _timeChartControl = new FC.Controls.TimeChartControl(_$timeChartControl);
var _isShowingSlicePanel = true;
$(window).resize(function () {
self.updateTabsHeight();
});
_$probeToggleBtn.on("click", function (event) {
self.toggleProbeMode();
});
Object.defineProperties(self, {
$controls: { get: function () { return _$controls; } },
$layersTab: { get: function () { return _$layersTab; } },
$detailsTab: { get: function () { return _$detailsTab; } },
$layersTabContent: { get: function () { return _$layersTabContent; } },
$detailsTabContent: { get: function () { return _$detailsTabContent; } },
$tiles: { get: function () { return _$tiles; } },
$selectedTile: { get: function () { return _$tiles.find(".selected"); } },
$panelMessage: { get: function () { return _$panelMessage; } },
selectedVariable: { get: function () { return self.$selectedTile.attr("data-variable"); } },
dataInfoControl: { get: function () { return _dataInfoControl; } },
timeChartControl: { get: function () { return _timeChartControl; } }
});
function initialize() {
_dataInfoControl.$dataModeSelector.change(function (event, dataMode) {
FC.state.setDataMode(dataMode);
});
_timeChartControl.$timeSeriesAxisSelector.change(function (event, timeSeriesAxis) {
FC.state.setTimeSeriesAxis(timeSeriesAxis);
});
_$layersTab.click(function () {
_$layersTab.addClass("active");
_$detailsTab.removeClass("active");
_$detailsTabContent.parent().hide();
_$layersTabContent.parent().show();
self.updateTabsHeight();
}).click();
_$detailsTab.click(function () {
_$layersTab.removeClass("active");
_$detailsTab.addClass("active");
_$detailsTabContent.parent().show();
_$layersTabContent.parent().hide();
self.updateTabsHeight();
});
_$slicePanelToggleBtn.click(function () {
if (_isShowingSlicePanel) {
_$slicePanelToggleBtnState.text("Off");
}
else {
_$slicePanelToggleBtnState.text("On");
}
_$slicePanelToggleBtn.toggleClass("on");
_isShowingSlicePanel = !_isShowingSlicePanel;
self.$panel.trigger("showslicepanelchange", {
isShowing: _isShowingSlicePanel
});
});
}
function getVariableDescription(variable) {
return FC.state.config.EnvironmentalVariables.filter(function (v) {
return v.Name === variable;
})[0].Description;
}
self.updateTabsHeight = function () {
var height = self.$panel.height() - self.$header.outerHeight(true) -
self.$controls.outerHeight(true) - _$dataInfoControl.outerHeight(true);
_$layersTabContent.parent().height(height);
_$detailsTabContent.parent().height(height);
_$layersTabContent.parent().nanoScroller();
_$detailsTabContent.parent().nanoScroller();
};
self.selectFirstTile = function () {
var $tiles = _$tiles.children();
var variable = $tiles.first().attr("data-variable");
self.selectTile(variable);
};
self.selectTile = function (variable) {
_$tiles.children().removeClass("selected");
_$tiles.find("[data-variable=" + variable + "]").click();
};
self.getTile = function (variable) {
var $tile = _$tiles.find(".results-tile[data-variable=" + variable + "]");
return $tile.data("tile");
};
self.addTile = function (variable) {
var title = getVariableDescription(variable);
var tile = new FC.Controls.ResultsTile(title, "", true);
var $tile = tile.$tile;
$tile.attr("data-variable", variable);
$tile.data("tile", tile);
_$tiles.append($tile);
};
self.removeTile = function (variable) {
_$tiles.find("[data-variable=" + variable + "]").remove();
};
self.clearTiles = function () {
_$tiles.empty();
};
self.toggleProbeMode = function () {
if (FC.Map.probeMode) {
_$probeToggleBtn.removeClass("active")
.attr("title", "Enable probe mode");
}
else {
_$probeToggleBtn.addClass("active")
.attr("title", "Disable probe mode");
}
FC.Map.toggleProbeMode();
};
self.updatePanelMessage = function (message) {
_$panelMessage.html(message);
return self;
};
initialize();
};
Controls.ResultsPanel.prototype = new Controls.NamedPanel();
Controls.TimeSlicePanel = function TimeSlicePanel(source) {
var self = this;
self.base = Controls.Panel;
self.base(source);
var _$sliceValue = self.$panel.find(".time-slice-value");
var _$yearSlider = self.$panel.find(".fc-time-slider.year").yearSlider();
var _$daySlider = self.$panel.find(".fc-time-slider.day").daySlider();
var _$hourSlider = self.$panel.find(".fc-time-slider.hour").hourSlider();
_$yearSlider.on("slidestart slide slidestop", onSliderFocus);
_$daySlider.on("slidestart slide slidestop", onSliderFocus);
_$hourSlider.on("slidestart slide slidestop", onSliderFocus);
Object.defineProperties(self, {
year: {
get: function () {
return {
$slider: _$yearSlider,
value: _$yearSlider.data("value"),
index: _$yearSlider.data("index"),
labels: _$yearSlider.data("labels"),
min: _$yearSlider.attr("data-min"),
max: _$yearSlider.attr("data-max"),
isVisible: _$yearSlider.is(":visible")
};
}
},
day: {
get: function () {
return {
$slider: _$daySlider,
value: _$daySlider.data("value"),
index: _$daySlider.data("index"),
labels: _$daySlider.data("labels"),
min: _$daySlider.attr("data-min"),
max: _$daySlider.attr("data-max"),
isVisible: _$daySlider.is(":visible")
};
}
},
hour: {
get: function () {
return {
$slider: _$hourSlider,
value: _$hourSlider.data("value"),
index: _$hourSlider.data("index"),
labels: _$hourSlider.data("labels"),
min: _$hourSlider.attr("data-min"),
max: _$hourSlider.attr("data-max"),
isVisible: _$hourSlider.is(":visible")
};
}
}
});
function initialize() {
self.$panel.on("slicechange", function (event, data) {
data = event.data || data;
switch (data.type) {
case "year":
if (FC.state.yearSlice === data.index) {
if (event.stopPropagation) {
event.stopPropagation();
}
return;
}
FC.state.setYearSlice(data.index);
_$yearSlider.setIndex(data.index);
break;
case "day":
if (FC.state.daySlice === data.index) {
if (event.stopPropagation) {
event.stopPropagation();
}
return;
}
FC.state.setDaySlice(data.index);
_$daySlider.setIndex(data.index);
break;
case "hour":
if (FC.state.hourSlice === data.index) {
if (event.stopPropagation) {
event.stopPropagation();
}
return;
}
FC.state.setHourSlice(data.index);
_$hourSlider.setIndex(data.index);
break;
default:
_$yearSlider.setIndex(FC.state.yearSlice);
_$daySlider.setIndex(FC.state.daySlice);
_$hourSlider.setIndex(FC.state.hourSlice);
break;
}
});
self.updateSliders();
_$yearSlider.setIndex(FC.state.yearSlice);
_$daySlider.setIndex(FC.state.daySlice);
_$hourSlider.setIndex(FC.state.hourSlice);
}
function onSliderFocus() {
FC.mapEntities.map.blur();
}
self.updateSliceValue = function () {
var temporal = FC.state.temporal;
var value = "Average value for ";
if (temporal.hourCellMode && temporal.hours.length > 2 || !temporal.hourCellMode) {
value += _$hourSlider.data("value") + ", ";
}
if (temporal.dayCellMode && temporal.days.length > 2 || !temporal.dayCellMode) {
value += _$daySlider.data("value") + ", ";
}
value += _$yearSlider.data("value");
_$sliceValue.text(value);
};
self.updateSliders = function () {
var td = FC.state.temporal;
var years = td.years.slice(0);
var days = td.days.slice(0);
var hours = td.hours.slice(0);
var isLeapYear = (years.length === 1 || years.length === 2 && years[0] === years[1]) && FC.isLeapYear(years[0]);
if (years.length > 2 && td.yearCellMode) {
_$yearSlider.show();
_$yearSlider.setRangeLabels(years);
if (!FC.state.yearSlice) {
self.$panel.trigger("slicechange", {
type: "year",
index: 0
});
}
} else if (years.length > 1 && !td.yearCellMode) {
_$yearSlider.show();
_$yearSlider.setPointLabels(years);
if (!FC.state.yearSlice) {
self.$panel.trigger("slicechange", {
type: "year",
index: 0
});
}
} else {
_$yearSlider.hide();
_$yearSlider.setSingleLabel(years);
}
if (days.length > 2 && td.dayCellMode) {
_$daySlider.show();
_$daySlider.setRangeLabels(days, isLeapYear);
if (!FC.state.daySlice) {
self.$panel.trigger("slicechange", {
type: "day",
index: 0
});
}
} else if (days.length > 1 && !td.dayCellMode) {
_$daySlider.show();
_$daySlider.setPointLabels(days, isLeapYear);
if (!FC.state.daySlice) {
self.$panel.trigger("slicechange", {
type: "day",
index: 0
});
}
} else {
_$daySlider.hide();
_$daySlider.setSingleLabel(days, isLeapYear);
}
if (hours.length > 2 && td.hourCellMode) {
_$hourSlider.show();
_$hourSlider.setRangeLabels(hours);
if (!FC.state.hourSlice) {
self.$panel.trigger("slicechange", {
type: "hour",
index: 0
});
}
} else if (hours.length > 1 && !td.hourCellMode) {
_$hourSlider.show();
_$hourSlider.setPointLabels(hours);
if (!FC.state.hourSlice) {
self.$panel.trigger("slicechange", {
type: "hour",
index: 0
});
}
} else {
_$hourSlider.hide();
_$hourSlider.setSingleLabel(hours);
}
_$yearSlider.setIndex(FC.state.yearSlice);
_$daySlider.setIndex(FC.state.daySlice);
_$hourSlider.setIndex(FC.state.hourSlice);
self.updateSliceValue();
};
initialize();
};
Controls.TimeSlicePanel.prototype = new Controls.Panel();
Controls.ExportPanel = function ExportPanel (source) {
var self = this;
self.base = Controls.NamedPanel;
self.base(source);
var _$dataToCSVBtn = self.$content.find(".action-data-to-file"),
_$dataByEmailBtn = self.$content.find(".action-send-by-email"),
_$dataCopyURLBtn = self.$content.find(".action-copy-url"),
_$copyURLDialog = self.$panel.parent().find(".copy-to-clipboard-dialog"),
_$copyURLDialogOverlay = self.$panel.parent().find(".dialog-overlay"),
_$copyURLDialogInput = _$copyURLDialog.find(".url-input"),
_$copyURLDialogCloseButton = _$copyURLDialog.find(".close-button"),
_$panelMessage = self.$panel.find(".fc-panel-message"),
_$panelContent = self.$panel.find(".fc-panel-content");
_$dataToCSVBtn.on("click", onDataToCSVClicked);
_$dataByEmailBtn.on("click", onDataByEmailClicked);
_$dataCopyURLBtn.on("click", onDataCopyURLClicked);
_$copyURLDialogCloseButton.add(_$copyURLDialogOverlay).click(hideCopyUrlDialog);
_$copyURLDialogInput.focus(onCopyUrlDialogInputFocus);
self.update = function () {
// No grid or point selected, show 'no area selected' message.
if (FC.state.grids.length === 0 && FC.state.points.length === 0) {
_$panelMessage.html(FC.Settings.NO_AREA_SELECTED_MESSAGE).show();
_$panelContent.hide();
} else if ($.isEmptyObject(FC.state.variables)) { // No layer selected, show 'no layer selected' message.
_$panelMessage.html(FC.Settings.NO_LAYERS_SELECTED_MESSAGE).show();
_$panelContent.hide();
} else {
var url = createExportUrl();
if (url !== FC.Settings.FETCHCLIMATE_2_SERVICE_URL + "/export") {
_$panelMessage.hide();
_$panelContent.show();
} else {
_$panelMessage.html(FC.Settings.NO_DATA_AVAILABLE_MESSAGE).show();
_$panelContent.hide();
}
}
}
function onDataToCSVClicked () {
var url = createExportUrl();
if (url !== FC.Settings.FETCHCLIMATE_2_SERVICE_URL + "/export") FC.openUrlInNewTab(url);
}
function onDataByEmailClicked () {
var url = createExportUrl();
if (url !== FC.Settings.FETCHCLIMATE_2_SERVICE_URL + "/export") {
$(this).attr("href", "mailto:?subject=" + FC.Settings.DEFAULT_EMAIL_SUBJECT + "&body=" + url);
}
}
function onDataCopyURLClicked () {
var url = createExportUrl();
if (url !== FC.Settings.FETCHCLIMATE_2_SERVICE_URL + "/export") showCopyURLDialog(url);
}
function createExportUrl () {
var url = FC.Settings.FETCHCLIMATE_2_SERVICE_URL + "/export",
includeGrids = false,
includeGrid = false,
firstParam = true,
request,
pointsHashes = {}; // hash-map of arrays of points names, keys are hashes of points requests
if (FC.state.grids.length) {
FC.state.grids.forEach(function (grid) {
includeGrid = false;
if (grid.data) {
if (Object.keys(grid.data).length > 0) {
Object.keys(grid.data).forEach(function (key) {
request = grid.data[key].request;
// Only grid with at least one variable with request in status 'receiving' or 'completed' can be added to export url.
if (request.status === "receiving" || request.status === "completed") {
// First grid to be added to url, adding grids parameter to url.
if (!includeGrids) {
url += "?g=";
includeGrids = true;
firstParam = false;
}
// First variable of current grid to be added to url, adding grid's name to url.
if (!includeGrid) {
url += encodeURIComponent(grid.name);
includeGrid = true;
}
url += "," + request.hash;
}
});
}
if (includeGrid) {
url += ";";
}
}
});
}
if (FC.state.points.length) {
FC.state.points.forEach(function (point) {
if (point.data) {
if (Object.keys(point.data).length > 0) {
Object.keys(point.data).forEach(function (key) {
request = point.data[key].request;
// Only point with at least one variable with request in status 'receiving' or 'completed' can be added to export url.
if (request.status === "receiving" || request.status === "completed") {
pointsHashes[request.hash] = pointsHashes[request.hash] || [];
pointsHashes[request.hash].push(encodeURIComponent(point.name));
}
});
}
}
});
if (!$.isEmptyObject(pointsHashes)) {
url += firstParam ? "?p=" : "&p=";
Object.keys(pointsHashes).forEach(function (key) {
url += key + "," + pointsHashes[key].join(",") + ";";
});
}
}
// Email clients parse %20 as space and break URL. Replace %20 with +.
url = url.replace(/%20/gi, "+");
return url;
}
function showCopyURLDialog(url) {
_$copyURLDialog.show();
_$copyURLDialogOverlay.show();
_$copyURLDialogInput.val(url);
_$copyURLDialogInput.focus();
}
function hideCopyUrlDialog() {
_$copyURLDialog.hide();
_$copyURLDialogOverlay.hide();
_$copyURLDialogInput.val("");
}
function onCopyUrlDialogInputFocus() {
this.select();
}
};
Controls.ExportPanel.prototype = new Controls.NamedPanel();
})(FC.Controls || (FC.Controls = {}));
})(window.FC = window.FC || {}, jQuery); | 40.908688 | 159 | 0.43398 |
75d38a8ad94f3c096cf2e40668f07f509030535c | 1,823 | js | JavaScript | script.js | kenrick95/NTUBS-WT-web | ae65d7a40202ececf51cfb5a0f00744ff3e36b1f | [
"MIT"
] | null | null | null | script.js | kenrick95/NTUBS-WT-web | ae65d7a40202ececf51cfb5a0f00744ff3e36b1f | [
"MIT"
] | null | null | null | script.js | kenrick95/NTUBS-WT-web | ae65d7a40202ececf51cfb5a0f00744ff3e36b1f | [
"MIT"
] | null | null | null | $(window).load(function() {
$(".convert-emoji").each(function() {
var original = $(this).html();
var converted = emojione.toImage(original);
$(this).html(converted);
});
var wheel = $("#wheel");
var rotation = Math.round(Math.random() * 720 + 720);
var answer = null;
TweenLite.to(wheel, 1, {rotation: "+=" + rotation, ease: Expo.easeOut});
$("#spin-btn").click(function () {
rotation = Math.round(Math.random() * 720 + 720);
TweenLite.to(wheel, 5, {rotation: "+=" + rotation, ease: Expo.easeOut, onComplete: function () {
var tr = $("#wheel").css("transform");
// https://css-tricks.com/get-value-of-css-rotation-through-javascript/
var values = tr.split('(')[1].split(')')[0].split(',');
var a = values[0], b = values[1], c = values[2], d = values[3];
var scale = Math.sqrt(a*a + b*b);
var angle = Math.round(Math.atan2(b, a) * (180/Math.PI));
if (angle < 0)
angle += 360;
var cat = 8 - Math.floor(angle / 45);
var pointed = $("#ws-" + cat + " > .ws-content");
$("#main-question-display").html($(pointed).html());
answer = {
value: $(pointed).data("answer"),
description: $(pointed).data("item")
};
$("#options").show();
$("#backdrop").show();
}});
});
$(".option").click(function () {
var chosen = $(this).data("value");
var correct = answer.value;
if (chosen === correct) {
swal("Yay", "It's a correct one!", "success");
} else {
swal("Nay", "It's not correct!", "error");
}
$("#options").hide();
$("#backdrop").hide();
});
}); | 35.745098 | 105 | 0.477235 |
75d3a743b72250c893896558f8846b4cca55bcd7 | 472 | js | JavaScript | app/components/index.js | m0t0r/duckr-redux-app | fb63beb406ac13d09c462cd106fa6da3cfeb0503 | [
"MIT"
] | 1 | 2018-02-12T13:16:45.000Z | 2018-02-12T13:16:45.000Z | app/components/index.js | m0t0r/duckr-redux-app | fb63beb406ac13d09c462cd106fa6da3cfeb0503 | [
"MIT"
] | null | null | null | app/components/index.js | m0t0r/duckr-redux-app | fb63beb406ac13d09c462cd106fa6da3cfeb0503 | [
"MIT"
] | null | null | null | export Home from './Home/Home';
export Navigation from './navigation/Navigation';
export Authenticate from './authenticate/Authenticate';
export GithubAuthButton from './github-auth-button/GithubAuthButton';
export Feed from './feed/Feed';
export Logout from './logout/Logout';
export Modal from './modal/Modal';
export Duck from './duck/Duck';
export User from './user/User';
export DuckDetails from './duck-details/DuckDetails';
export Replies from './replies/Replies';
| 39.333333 | 69 | 0.760593 |
75d3f680e193face7a553b4401f41e6a94d7b989 | 5,691 | js | JavaScript | vertexShader.glsl.js | tschie/terrain-cdlod | 5c90c81339c1a68058cb3994989aaecab71a4053 | [
"MIT"
] | null | null | null | vertexShader.glsl.js | tschie/terrain-cdlod | 5c90c81339c1a68058cb3994989aaecab71a4053 | [
"MIT"
] | null | null | null | vertexShader.glsl.js | tschie/terrain-cdlod | 5c90c81339c1a68058cb3994989aaecab71a4053 | [
"MIT"
] | null | null | null | // language=glsl
export const terrainVertexShader = `
precision mediump float;
attribute float lodLevel;
flat varying int vLodLevel;
varying vec3 vNormal;
varying vec3 vWorldPos;
uniform float lodRanges[9];
uniform float resolution;
/** Noise **/
vec3 mod289(vec3 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec4 mod289(vec4 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
}
vec4 permute(vec4 x) {
return mod289((x * 34.0 + 1.0) * x);
}
vec4 taylorInvSqrt(vec4 v) {
return 1.79284291400159 - 0.85373472095314 * v;
}
vec3 fade(vec3 t) {
return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
}
float perlinNoise(vec3 v) {
vec3 i0 = mod289(floor(v));
vec3 i1 = mod289(i0 + vec3(1.0));
vec3 f0 = fract(v);
vec3 f1 = f0 - vec3(1.0);
vec3 f = fade(f0);
vec4 ix = vec4(i0.x, i1.x, i0.x, i1.x);
vec4 iy = vec4(i0.y, i0.y, i1.y, i1.y);
vec4 iz0 = vec4(i0.z);
vec4 iz1 = vec4(i1.z);
vec4 ixy = permute(permute(ix) + iy);
vec4 ixy0 = permute(ixy + iz0);
vec4 ixy1 = permute(ixy + iz1);
vec4 gx0 = ixy0 * (1.0 / 7.0);
vec4 gy0 = fract(floor(gx0) * (1.0 / 7.0)) - 0.5;
vec4 gx1 = ixy1 * (1.0 / 7.0);
vec4 gy1 = fract(floor(gx1) * (1.0 / 7.0)) - 0.5;
gx0 = fract(gx0);
gx1 = fract(gx1);
vec4 gz0 = vec4(0.5) - abs(gx0) - abs(gy0);
vec4 sz0 = step(gz0, vec4(0.0));
vec4 gz1 = vec4(0.5) - abs(gx1) - abs(gy1);
vec4 sz1 = step(gz1, vec4(0.0));
gx0 -= sz0 * (step(0.0, gx0) - 0.5);
gy0 -= sz0 * (step(0.0, gy0) - 0.5);
gx1 -= sz1 * (step(0.0, gx1) - 0.5);
gy1 -= sz1 * (step(0.0, gy1) - 0.5);
vec3 g0 = vec3(gx0.x, gy0.x, gz0.x);
vec3 g1 = vec3(gx0.y, gy0.y, gz0.y);
vec3 g2 = vec3(gx0.z, gy0.z, gz0.z);
vec3 g3 = vec3(gx0.w, gy0.w, gz0.w);
vec3 g4 = vec3(gx1.x, gy1.x, gz1.x);
vec3 g5 = vec3(gx1.y, gy1.y, gz1.y);
vec3 g6 = vec3(gx1.z, gy1.z, gz1.z);
vec3 g7 = vec3(gx1.w, gy1.w, gz1.w);
vec4 norm0 = taylorInvSqrt(vec4(dot(g0, g0), dot(g2, g2), dot(g1, g1), dot(g3, g3)));
vec4 norm1 = taylorInvSqrt(vec4(dot(g4, g4), dot(g6, g6), dot(g5, g5), dot(g7, g7)));
g0 *= norm0.x;
g2 *= norm0.y;
g1 *= norm0.z;
g3 *= norm0.w;
g4 *= norm1.x;
g6 *= norm1.y;
g5 *= norm1.z;
g7 *= norm1.w;
vec4 nz = mix(
vec4(
dot(g0, vec3(f0.x, f0.y, f0.z)),
dot(g1, vec3(f1.x, f0.y, f0.z)),
dot(g2, vec3(f0.x, f1.y, f0.z)),
dot(g3, vec3(f1.x, f1.y, f0.z))
),
vec4(
dot(g4, vec3(f0.x, f0.y, f1.z)),
dot(g5, vec3(f1.x, f0.y, f1.z)),
dot(g6, vec3(f0.x, f1.y, f1.z)),
dot(g7, vec3(f1.x, f1.y, f1.z))
),
f.z
);
return 2.2 * mix(mix(nz.x, nz.z, f.y), mix(nz.y, nz.w, f.y), f.x);
}
float fbm(vec3 pos) {
float scale = 1000.0;
float lacunarity = 4.0;
float persistence = 0.3;
float amplitude = 1.0;
float frequency = 1.0;
float noiseHeight = 0.0;
for (int i = 0; i < 5; i++) {
float sampleHeight = perlinNoise(pos / scale * frequency);
noiseHeight += sampleHeight * amplitude;
amplitude *= persistence;
frequency *= lacunarity;
}
return noiseHeight;
}
float easeInCubic(float x) {
return x * x * x;
}
float height(vec3 pos) {
return 200.0 * abs(easeInCubic(fbm(pos)));
}
// rough approximation
vec3 calcNormal(vec3 pos) {
float heightLeft = height(pos + vec3(-1.0, 0.0, 0.0));
float heightRight = height(pos + vec3(1.0, 0.0, 0.0));
float heightDown = height(pos + vec3(0.0, 0.0, -1.0));
float heightUp = height(pos + vec3(1.0, 0.0, 1.0));
return normalize(vec3(heightLeft - heightRight, 2.0, heightDown - heightUp));
}
/** Morphing **/
float morphValue(float dist) {
float low = 0.0;
if (lodLevel != 0.0) {
low = lodRanges[int(lodLevel) - 1];
}
float high = lodRanges[int(lodLevel)];
float factor = (dist - low) / (high - low);
return smoothstep(0.9, 1.0, factor);
}
/**
* vertex: object space
* mesh_pos: vertex normalized pos (0, 1)
**/
vec2 morphVertex(vec2 vertex, vec2 mesh_pos, float morphValue) {
vec2 fraction = fract(mesh_pos * vec2(resolution, resolution) * 0.5) * 2.0 / vec2(resolution, resolution);
return vertex - fraction * morphValue;
}
void main() {
// visualization: pass lod level for color tinting
vLodLevel = int(floor(lodLevel));
// position after moving and scaling tile
vec3 worldPos = (instanceMatrix * vec4(position, 1.0)).xyz;
float dist = length(cameraPosition - worldPos);
float morphK = morphValue(dist);
vec2 normalizedMeshPos = position.xz + vec2(0.5, 0.5);
// morph in object space
vec2 morphedPos = morphVertex(position.xz, normalizedMeshPos, morphK);
vec3 morphedWorldPos = (instanceMatrix * vec4(morphedPos.x, 0.0, morphedPos.y, 1.0)).xyz;
float noiseHeight = height(morphedWorldPos);
vec3 finalPosition = vec3(morphedWorldPos.x, noiseHeight, morphedWorldPos.z);
vWorldPos = finalPosition;
vec3 n = calcNormal(morphedWorldPos);
vNormal = n;
gl_Position = projectionMatrix * viewMatrix * vec4(finalPosition, 1.0);
}
`;
| 32.52 | 114 | 0.524337 |
75d3fea8afd5b71d37dbe1f1231c845ffed26d38 | 652 | js | JavaScript | src/components/common/button-follow.js | acaziasoftcom/acazia-viblo-client | be132e7b16d711c42a8efbedde4b5900208d039d | [
"MIT"
] | 1 | 2018-06-25T09:05:22.000Z | 2018-06-25T09:05:22.000Z | src/components/common/button-follow.js | acaziasoftcom/acazia-viblo-client | be132e7b16d711c42a8efbedde4b5900208d039d | [
"MIT"
] | null | null | null | src/components/common/button-follow.js | acaziasoftcom/acazia-viblo-client | be132e7b16d711c42a8efbedde4b5900208d039d | [
"MIT"
] | null | null | null | import React from 'react';
import { TouchableOpacity, StyleSheet, Text } from 'react-native';
import { Colors } from '../../common/colors';
const ButtonFollow = ({ onPress, style }) => {
return (
<TouchableOpacity onPress={onPress} style={[styles.touch, style]}>
<Text style={{ color: '#fff' }}>FOLLOW</Text>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
touch: {
marginHorizontal: 5,
paddingRight: 15,
paddingLeft: 15,
backgroundColor: 'transparent',
borderColor: Colors.WHITE,
borderWidth: 1,
borderRadius: 20,
paddingBottom: 5,
paddingTop: 5
}
});
export { ButtonFollow };
| 23.285714 | 70 | 0.645706 |
75d63aae01e48f1bd5466753c678cb4ab8fdd79b | 4,529 | js | JavaScript | js/puxl-js/tabs.min.js | vivikthor/crowdfunding.github.io | 984dffab7c26c4011d298763b346349ab1b375b8 | [
"MIT"
] | null | null | null | js/puxl-js/tabs.min.js | vivikthor/crowdfunding.github.io | 984dffab7c26c4011d298763b346349ab1b375b8 | [
"MIT"
] | null | null | null | js/puxl-js/tabs.min.js | vivikthor/crowdfunding.github.io | 984dffab7c26c4011d298763b346349ab1b375b8 | [
"MIT"
] | null | null | null | function puxl_tabs(){"use strict";function e(e){e.focus(),e.setAttribute("aria-selected","true"),e.setAttribute("tabindex","0")}function t(e){e.blur(),e.setAttribute("aria-selected","false"),e.setAttribute("tabindex","-1")}function o(e){e.removeAttribute("hidden"),e.setAttribute("tabindex","0")}function n(e){e.blur(),e.setAttribute("hidden",""),e.setAttribute("tabindex","-1")}function a(){for(s=0;s<r.length;s++){var e,t,o,n=r[s],a={id:"",tabs:[],enabledTabs:[],tabpanels:[]},b=n.children,l=n.childElementCount,u=n.querySelector("[role=tablist]"),c=u.querySelectorAll("[role=tab]"),g=u.childElementCount,A=!1,f=[],y=0;for(!1===n.hasAttribute("id")&&n.setAttribute("id","tabs--"+(s+1)),a.id=n.id,o=0;o<l;o++)"tabpanel"===b[o].getAttribute("role")&&(t=b[o],f.push(t),y++);for(g!==y&&alert("Puxl tabs(): Component .tabs#"+n.id+" must have equal number of tabs ("+g+") and tabpanels ("+y+")."),i=0;i<y;i++)e=c[i],t=f[i],a.tabs.push(e),a.tabpanels.push(t),t.setAttribute("id",n.id+"__tabpanel--"+(i+1)),!1===e.hasAttribute("id")?e.setAttribute("id",n.id+"__tab--"+(i+1)):t.setAttribute("id",e.id+"__tabpanel"),e.setAttribute("aria-controls",t.id),t.setAttribute("aria-labelledby",e.id),!1===e.hasAttribute("disabled")&&a.enabledTabs.push(e),"true"===e.getAttribute("aria-selected")?(A=!0,e.setAttribute("tabindex",0),t.setAttribute("tabindex",0),t.removeAttribute("hidden")):(e.setAttribute("aria-selected","false"),e.setAttribute("tabindex",-1),t.setAttribute("tabindex",-1),t.setAttribute("hidden","")),e.setAttribute("type","button");!1===A&&(a.enabledTabs[0].setAttribute("aria-selected","true"),a.enabledTabs[0].setAttribute("tabindex","0"),document.getElementById(a.enabledTabs[0].getAttribute("aria-controls")).removeAttribute("hidden"),document.getElementById(a.enabledTabs[0].getAttribute("aria-controls")).setAttribute("tabindex","0")),a.enabledTabs[0].setAttribute("tabindex","0"),d.push(a)}}var s,i,r=document.querySelectorAll(".tabs"),d=[],b=[],l=[];if(0===r.length)console.log("Puxl tabs(): No .tabs components were found.");else{for(r.length>=2?console.log("Puxl tabs(): "+r.length+" .tabs components were found."):console.log("Puxl tabs(): "+r.length+" .tabs component was found."),a(),s=0;s<d.length;s++){for(i=0;i<d[s].tabs.length;i++)b.push(d[s].tabs[i]);for(i=0;i<d[s].tabpanels.length;i++)l.push(d[s].tabpanels[i])}b.forEach(function(a){for(s=0;s<d.length;s++)if(a.parentNode.parentNode.id===d[s].id){var i=d[s].tabs,r=d[s].enabledTabs,b=d[s].tabpanels,l=a,u=r.indexOf(a),c=document.getElementById(a.getAttribute("aria-controls"));a.addEventListener("click",function(){i.forEach(function(e){t(e)}),b.forEach(function(e){n(e)}),e(l),o(c)}),a.addEventListener("keydown",function(s){function i(){t(r[u]),n(document.getElementById(r[u].getAttribute("aria-controls"))),e(r[0]),o(document.getElementById(r[0].getAttribute("aria-controls")))}function d(){t(r[u]),n(document.getElementById(r[u].getAttribute("aria-controls"))),e(r[u-1]),o(document.getElementById(r[u-1].getAttribute("aria-controls")))}function b(){t(r[u]),n(document.getElementById(r[u].getAttribute("aria-controls"))),e(r[u+1]),o(document.getElementById(r[u+1].getAttribute("aria-controls")))}function l(){t(r[u]),n(document.getElementById(r[u].getAttribute("aria-controls"))),e(r[r.length-1]),o(document.getElementById(r[r.length-1].getAttribute("aria-controls")))}switch(s.keyCode){case 13:console.log("Puxl tabs(): Pressed Enter (keyCode "+s.keyCode+") on "+a.id+". Focus tabpanel."),document.getElementById(a.getAttribute("aria-controls")).focus();break;case 27:console.log("Puxl tabs(): Pressed Escape (keyCode "+s.keyCode+") on "+a.id+". Loose focus."),a.blur();break;case 35:console.log("Puxl tabs(): Pressed End (keyCode "+s.keyCode+") on "+a.id+". Go to last tab."),l();break;case 36:console.log("Puxl tabs(): Pressed Home (keyCode "+s.keyCode+") on "+a.id+". Go to first tab."),i();break;case 37:console.log("Puxl tabs(): Pressed Left (keyCode "+s.keyCode+") on "+a.id+". Go to previous tab."),d();break;case 38:console.log("Puxl tabs(): Pressed Up (keyCode "+s.keyCode+") on "+a.id+". Go to previous tab."),d();break;case 39:console.log("Puxl tabs(): Pressed Right (keyCode "+s.keyCode+") on "+a.id+". Go to next tab."),b();break;case 40:console.log("Puxl tabs(): Pressed Down (keyCode "+s.keyCode+") on "+a.id+". Go to next tab."),b()}})}}),l.forEach(function(e){e.addEventListener("keydown",function(t){switch(t.keyCode){case 27:console.log("Puxl tabs(): Pressed Escape (keyCode "+t.keyCode+") on "+e.id+". Loose focus."),e.blur()}})})}} | 4,529 | 4,529 | 0.688011 |
75d7c3e3c4c1432d9d399be640d1338c14a0fc5c | 646 | js | JavaScript | test/alg/life/evolve-spec.js | arrowrowe/algorithms-node | 9960076d6bc5007f299eee66de13cc3c3c6ace37 | [
"MIT"
] | 4 | 2015-12-17T08:01:18.000Z | 2016-09-11T05:13:19.000Z | test/alg/life/evolve-spec.js | arrowrowe/algorithms-node | 9960076d6bc5007f299eee66de13cc3c3c6ace37 | [
"MIT"
] | 1 | 2015-12-11T14:37:32.000Z | 2016-01-07T04:11:56.000Z | test/alg/life/evolve-spec.js | arrowrowe/algorithms-node | 9960076d6bc5007f299eee66de13cc3c3c6ace37 | [
"MIT"
] | null | null | null | var lifeEvolve = require('../../../index').life.evolve;
var expect = require('chai').expect;
describe('Life-evolve', () => {
var T = (world, nextWorld) => expect(lifeEvolve(world)).to.eql(nextWorld);
it('produces the future of current world', () => {
var twins = [[
[0, 0, 0],
[1, 1, 1],
[0, 0, 0]
], [
[0, 1, 0],
[0, 1, 0],
[0, 1, 0]
]];
T(twins[0], twins[1]);
T(twins[1], twins[0]);
var taken = [[
[0, 0, 0],
[0, 1, 1],
[0, 1, 0]
], [
[0, 0, 0],
[0, 1, 1],
[0, 1, 1]
]];
T(taken[0], taken[1]);
T(taken[1], taken[1]);
});
});
| 20.83871 | 76 | 0.416409 |
75d7ef3744e72af862c23384a865a646349e2725 | 12,038 | js | JavaScript | test/unit/array.test.js | jwestbrook/prototype | cd7b709b10c23a792da54ea82d47e95f0db92cdc | [
"MIT-0"
] | null | null | null | test/unit/array.test.js | jwestbrook/prototype | cd7b709b10c23a792da54ea82d47e95f0db92cdc | [
"MIT-0"
] | null | null | null | test/unit/array.test.js | jwestbrook/prototype | cd7b709b10c23a792da54ea82d47e95f0db92cdc | [
"MIT-0"
] | 3 | 2015-03-24T23:05:32.000Z | 2019-12-09T07:04:32.000Z | var globalArgsTest = 'nothing to see here';
suite('Array Namespace',function(){
this.timeout(0)
test('$A({}) should equal []',function(){
assert.deepEqual([], $A({}),"$A({}) != []")
});
test('use $A() on function arguments',function(){
function toArrayOnArguments(){
globalArgsTest = $A(arguments);
}
toArrayOnArguments();
assert.deepEqual([],globalArgsTest,"globalArgsTest != []");
toArrayOnArguments('foo');
assert.deepEqual(['foo'],globalArgsTest,"globalArgsTest != ['foo']");
toArrayOnArguments('foo','bar');
assert.deepEqual(['foo','bar'],globalArgsTest,"globalArgsTest != ['foo','bar']");
});
test('use $A() On NodeList',function(){
// direct HTML
assert(0 === $A($('testfixture').childNodes).length,"HTML childNodes length != 0");
// DOM
var element = document.createElement('div');
element.appendChild(document.createTextNode('22'));
(2).times(function(){ element.appendChild(document.createElement('span')) });
assert(3 === $A(element.childNodes).length,"DOM childNodes length != 3");
// HTML String
element = document.createElement('div');
$(element).update('22<span></span><span></span');
assert(3 === $A(element.childNodes).length,"String childNodes length != 3");
});
test("use $A() On Primitive values",function() {
assert.deepEqual(['a', 'b', 'c'], $A('abc'));
assert.deepEqual([], $A(''));
assert.deepEqual([], $A(null));
assert.deepEqual([], $A(undefined));
assert.deepEqual([], $A());
assert.deepEqual([], $A(5));
assert.deepEqual([], $A(true));
});
suite('Instance Methods',function(){
test(".clear() method",function(){
assert.deepEqual([], [].clear());
assert.deepEqual([], [1].clear());
assert.deepEqual([], [1,2].clear());
});
test(".clone() method",function(){
assert.deepEqual([], [].clone());
assert.deepEqual([1], [1].clone());
assert.deepEqual([1,2], [1,2].clone());
assert.deepEqual([0,1,2], [0,1,2].clone());
var a = [0,1,2];
var b = a;
assert.deepEqual(a, b);
b = a.clone();
try{
assert.deepEqual(a, b)
} catch (e) {
assert(e,"Error not thrown")
}
});
test(".entries() method",function(){
assert.deepEqual([[0, 3], [1, 5], [2, 6], [3, 1], [4, 20]],[3, 5, 6, 1, 20].entries(),"[3, 5, 6, 1, 20].entries() != [[0, 3], [1, 5], [2, 6], [3, 1], [4, 20]]")
assert.deepEqual([[0, 'a'], [1, 'b'], [2, 'c']],['a', 'b', 'c'].entries(),"['a', 'b', 'c'].entries() != [[0, 'a'], [1, 'b'], [2, 'c']]")
});
test(".first() method",function(){
assert([].first() === undefined,"[].first() != undefined");
assert(1 === [1].first(),"[1].first() != 1");
assert(1 === [1,2].first(),"[1,2].first() != 1");
});
test(".last() method",function(){
assert([].last() === undefined,"[].last() != undefined");
assert(1 === [1].last(),"[1].last() != 1");
assert(2 === [1,2].last(),"[1,2].last() != 2");
});
test(".compact() method",function(){
assert.deepEqual([],[].compact(),"[] != [].compact()");
assert.deepEqual([1,2,3], [1,2,3].compact(),"[1,2,3] != [1,2,3].compact()");
assert.deepEqual([0,1,2,3], [0,null,1,2,undefined,3].compact(),"[0,1,2,3] != [0,null,1,2,undefined,3].compact()");
assert.deepEqual([1,2,3], [null,1,2,3,null].compact(),"[1,2,3] != [null,1,2,3,null].compact()");
});
test(".flatten() method",function(){
assert.deepEqual([], [].flatten(),"[] != [].flatten()");
assert.deepEqual([1,2,3], [1,2,3].flatten(),"[1,2,3] != [1,2,3].flatten()");
assert.deepEqual([1,2,3], [1,[[[2,3]]]].flatten(),"[1,2,3] != [1,[[[2,3]]]].flatten()");
assert.deepEqual([1,2,3], [[1],[2],[3]].flatten(),"[1,2,3] != [[1],[2],[3]].flatten()");
assert.deepEqual([1,2,3], [[[[[[[1]]]]]],2,3].flatten(),"[1,2,3] != [[[[[[[1]]]]]],2,3].flatten()");
});
test(".indexOf() method",function(){
assert(-1 === [].indexOf(1),"1 found in []");
assert(-1 === [0].indexOf(1),"1 found in [0]");
assert(0 === [1].indexOf(1),"1 not found in [1]");
assert(1 === [0,1,2].indexOf(1),"[0,1,2].indexOf(1) != 1");
assert(0 === [1,2,1].indexOf(1),"[1,2,1].indexOf(1) != 0");
assert(2 === [1,2,1].indexOf(1, -1),"[1,2,1].indexOf(1, -1) != 2");
assert(1 === [undefined,null].indexOf(null),"[undefined,null].indexOf(null) != 1");
// ES5 compatibility tests.
var undef;
var array = [1, 2, 3, 4, 5, undef, 6, 7, 1, 2, 3];
assert(2 === array.indexOf(3, -47),"large negative value for fromIndex");
assert(10 === array.indexOf(3, 4));
assert(10 === array.indexOf(3, -5))
assert(2 === array.indexOf(3, {}),"nonsensical value for fromIndex");
assert(2 === array.indexOf(3, ""),"nonsensical value for fromIndex");
assert(-1 === array.indexOf(3, 41),"fromIndex value larger than the length of the array");
});
test(".lastIndexOf() method",function(){
assert(-1 === [].lastIndexOf(1));
assert(-1 === [0].lastIndexOf(1));
assert(0 === [1].lastIndexOf(1));
assert(2 === [0,2,4,6].lastIndexOf(4));
assert(3 === [4,4,2,4,6].lastIndexOf(4));
assert(3 === [0,2,4,6].lastIndexOf(6,3));
assert(-1 === [0,2,4,6].lastIndexOf(6,2));
assert(0 === [6,2,4,6].lastIndexOf(6,2));
var fixture = [1,2,3,4,3];
assert(4, fixture.lastIndexOf(3));
assert.deepEqual([1,2,3,4,3],fixture);
//tests from http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:lastIndexOf
var array = [2, 5, 9, 2];
assert(3 === array.lastIndexOf(2));
assert(-1 === array.lastIndexOf(7));
assert(3 === array.lastIndexOf(2,3));
assert(0 === array.lastIndexOf(2,2));
assert(0 === array.lastIndexOf(2,-2));
assert(3 === array.lastIndexOf(2,-1));
});
test(".inspect() method",function(){
assert('[]' === [].inspect());
assert('[1]' === [1].inspect());
assert('[\'a\']' === ['a'].inspect());
assert('[\'a\', 1]' === ['a',1].inspect());
});
test(".intersect() method",function(){
assert.deepEqual([1,3], [1,1,3,5].intersect([1,2,3]));
assert.deepEqual([0,1], [0,1,2].intersect([0,1]));
assert.deepEqual([1], [1,1].intersect([1,1]));
assert.deepEqual([], [1,1,3,5].intersect([4]));
assert.deepEqual([], [1].intersect(['1']));
assert.deepEqual(
['B','C','D'],
$R('A','Z').toArray().intersect($R('B','D').toArray())
);
});
test(".reverse() method",function(){
assert.deepEqual([], [].reverse());
assert.deepEqual([1], [1].reverse());
assert.deepEqual([2,1], [1,2].reverse());
assert.deepEqual([3,2,1], [1,2,3].reverse());
});
test(".size() method", function(){
assert(4 === [0, 1, 2, 3].size());
assert(0 === [].size());
});
test(".uniq() method", function(){
assert.deepEqual([1], [1, 1, 1].uniq());
assert.deepEqual([1], [1].uniq());
assert.deepEqual([], [].uniq());
assert.deepEqual([0, 1, 2, 3], [0, 1, 2, 2, 3, 0, 2].uniq());
assert.deepEqual([0, 1, 2, 3], [0, 0, 1, 1, 2, 3, 3, 3].uniq(true));
});
test(".without() method",function(){
assert.deepEqual([], [].without(0));
assert.deepEqual([], [0].without(0));
assert.deepEqual([1], [0,1].without(0));
assert.deepEqual([1,2], [0,1,2].without(0));
});
test(".concat() method", function() {
var x = {};
assert(1 === Array.prototype.concat.length);
assert.deepEqual([0, 1],[0, 1].concat(),"test 2");
assert(2 === [0, 1].concat().length, "test 3");
assert.deepEqual([0, 1, 2, 3, 4],[].concat([0, 1], [2, 3, 4]),"test 4");
assert(5 === [].concat([0, 1], [2, 3, 4]).length, "test 5");
assert.deepEqual([0, x, 1, 2, true, "NaN"], [0].concat(x, [1, 2], true, "NaN"), "test 6");
assert(6 === [0].concat(x, [1, 2], true, "NaN").length, "test 7");
// These tests will fail in older IE because of the trailing comma.
// Nothing we can do about that, so just skip them and let the user know.
if ([,].length === 2)
{
console.log("NOTE: Old versions of IE don't like trailing commas in arrays. Skipping some tests.");
}
else
{
assertenum([undefined, 1, undefined], [,1].concat([], [,]),"concatenation behavior with a trailing comma (1)");
assert(3 === [,1].concat([], [,]).length,"concatenation behavior with a trailing comma (2)");
}
assertenum(["1"], Object.keys([,1].concat([], [,])), "test 10");
// Check that Array.prototype.concat can be used in a generic way
x.concat = Array.prototype.concat;
assert.deepEqual([x], x.concat(),"test 11");
assert(1 === x.concat().length,"test 12");
// Checking an edge case
var arr = []; arr[2] = true;
assertenum([undefined, undefined, true], [].concat(arr),"test 13");
assert(3 === [].concat(arr).length,"test 14");
assert.deepEqual(["2"], Object.keys([].concat(arr)),"test 15");
var args = (function() { return [].concat(arguments) })(1, 2);
assert(1 === args[0][0],"test 16");
});
test(".map() method",function() {
assert.deepEqual([1,2,3], [1,2,3].map());
assert.deepEqual([2,4,6], [1,2,3].map(function(x) { return x * 2; }));
var x = [1,2,3,4];
delete x[1];
delete x[3];
assertenum([1, undefined, 3, undefined], x.map());
assert(4 === x.map().length);
var traversed = [];
x.map(function(val) {
traversed.push(val);
});
assert.deepEqual([1, 3], traversed);
assert(2 === traversed.length);
});
test(".findAll() method", function() {
assert.deepEqual([2, 4, 6], [1, 2, 3, 4, 5, 6].findAll(function(x) {
return (x % 2) == 0;
}));
var x = [1,2,3], traversed = [];
delete x[1];
x.findAll(function(val) { traversed.push(val); });
assert.deepEqual([1, 3], traversed);
assert(2 === traversed.length);
});
test(".any() method",function() {
assert(!([].any()));
assert([true, true, true].any());
assert([true, false, false].any());
assert(![false, false, false].any());
assert([1,2,3,4,5].any(function(value) {
return value > 2;
}));
assert(![1,2,3,4,5].any(function(value) {
return value > 5;
}));
var x = [1,2,3], traversed = [];
delete x[1];
x.any(function(val) { traversed.push(val); });
assert.deepEqual([1, 3], traversed);
assert(2 === traversed.length);
});
test(".all() method",function() {
assert([].all());
assert([true, true, true].all());
assert(![true, false, false].all());
assert(![false, false, false].all());
assert([1,2,3,4,5].all(function(value) {
return value > 0;
}));
assert(![1,2,3,4,5].all(function(value) {
return value > 1;
}));
var x = [1,2,3], traversed = [];
delete x[1];
x.all(function(val) { traversed.push(val); return true; });
assert.deepEqual([1, 3], traversed);
assert(2, traversed.length);
});
});
test("$w()",function(){
assert.deepEqual(['a', 'b', 'c', 'd'], $w('a b c d'));
assert.deepEqual([], $w(' '));
assert.deepEqual([], $w(''));
assert.deepEqual([], $w(null));
assert.deepEqual([], $w(undefined));
assert.deepEqual([], $w());
assert.deepEqual([], $w(10));
assert.deepEqual(['a'], $w('a'));
assert.deepEqual(['a'], $w('a '));
assert.deepEqual(['a'], $w(' a'));
assert.deepEqual(['a', 'b', 'c', 'd'], $w(' a b\nc\t\nd\n'));
});
test(".each() On Sparse Arrays",function() {
var counter = 0;
var sparseArray = [0, 1];
sparseArray[5] = 5;
sparseArray.each( function(item) { counter++; });
assert(3 === counter, "Array#each should skip nonexistent keys in an array");
});
test(".map() Generic", function() {
var result = Array.prototype.map.call({0:0, 1:1, length:2});
assert.deepEqual([0, 1], result);
});
test(".findAll() Generic", function() {
var result = Array.prototype.findAll.call({0:0, 1:1, length:2}, function(x) {
return x === 1;
});
assert.deepEqual([1], result);
});
test(".any() Generic", function() {
assert(Array.prototype.any.call({ 0:false, 1:true, length:2 }));
assert(!Array.prototype.any.call({ 0:false, 1:false, length:2 }));
});
test(".all() Generic", function() {
assert(Array.prototype.all.call({ 0:true, 1:true, length:2 }));
assert(!Array.prototype.all.call({ 0:false, 1:true, length:2 }));
});
}); | 33.532033 | 163 | 0.554826 |
75d81341d99ab03898daef0ec91dc1e41139d2d8 | 3,480 | js | JavaScript | tests/unit/serializers/json-api-serializer/create-includes-graph-snapshot-collections-test.js | richgt/ember-cli-mirage | b69fa19b62c82153dec8232428e885e192351383 | [
"MIT"
] | null | null | null | tests/unit/serializers/json-api-serializer/create-includes-graph-snapshot-collections-test.js | richgt/ember-cli-mirage | b69fa19b62c82153dec8232428e885e192351383 | [
"MIT"
] | 177 | 2019-05-28T09:02:29.000Z | 2021-08-02T05:31:13.000Z | tests/unit/serializers/json-api-serializer/create-includes-graph-snapshot-collections-test.js | Greendale/ember-cli-mirage | 66c61897c0de5b5ebfc0388e06845163a7a1927f | [
"MIT"
] | null | null | null | import JSONAPISerializer from 'ember-cli-mirage/serializers/json-api-serializer';
import Schema from 'ember-cli-mirage/orm/schema';
import Db from 'ember-cli-mirage/db';
import { module, test } from 'qunit';
import { Model, hasMany } from 'ember-cli-mirage';
/*
This test is heavily coupled to the implementation and can be deleted
during a future refactoring.
*/
module('Unit | Serializers | JSON API Serializer | #_createIncludesGraphSnapshot collections', function(hooks) {
hooks.beforeEach(function() {
let serializer;
let registry = {
serializerFor() {
return serializer;
}
};
let type = 'foo';
let request = {};
serializer = new JSONAPISerializer(registry, type, request);
this.serializer = serializer;
});
test('it works on collections with no includes', function(assert) {
let schema = new Schema(new Db(), {
wordSmith: Model.extend({
})
});
schema.wordSmiths.create();
schema.wordSmiths.create();
this.serializer._createRequestedIncludesGraph(schema.wordSmiths.all());
assert.deepEqual(this.serializer.request._includesGraph, {
data: {
'word-smith:1': {},
'word-smith:2': {}
}
});
});
test('it works on collections with hasMany relationships and dot-path includes', function(assert) {
let schema = new Schema(new Db(), {
wordSmith: Model.extend({
redTags: hasMany(),
bluePosts: hasMany()
}),
bluePost: Model.extend({
redTags: hasMany()
}),
redTag: Model.extend({
someColors: hasMany()
}),
someColor: Model.extend()
});
let wordSmith1 = schema.wordSmiths.create();
wordSmith1.createRedTag();
wordSmith1.createRedTag();
let bluePost = wordSmith1.createBluePost();
let redTag = bluePost.createRedTag();
redTag.createSomeColor();
let wordSmith2 = schema.wordSmiths.create();
wordSmith2.createRedTag();
let bluePost2 = wordSmith2.createBluePost();
let redTag2 = bluePost2.createRedTag();
redTag2.createSomeColor();
this.serializer.request = { queryParams: { include: 'red-tags,blue-posts.red-tags.some-colors' } };
this.serializer._createRequestedIncludesGraph(schema.wordSmiths.all());
assert.deepEqual(this.serializer.request._includesGraph, {
data: {
'word-smith:1': {
relationships: {
'red-tags': [ 'red-tag:1', 'red-tag:2' ],
'blue-posts': [ 'blue-post:1' ]
}
},
'word-smith:2': {
relationships: {
'red-tags': [ 'red-tag:4' ],
'blue-posts': [ 'blue-post:2' ]
}
}
},
included: {
'red-tags': {
'red-tag:1': {},
'red-tag:2': {},
'red-tag:3': {
relationships: {
'some-colors': [ 'some-color:1' ]
}
},
'red-tag:4': {},
'red-tag:5': {
relationships: {
'some-colors': [ 'some-color:2' ]
}
}
},
'blue-posts': {
'blue-post:1': {
relationships: {
'red-tags': [ 'red-tag:3' ]
}
},
'blue-post:2': {
relationships: {
'red-tags': [ 'red-tag:5' ]
}
}
},
'some-colors': {
'some-color:1': {},
'some-color:2': {}
}
}
});
});
});
| 27.1875 | 112 | 0.54454 |
75d866c55f9a82a66cc91b6a4f51d02e1dc82368 | 1,857 | js | JavaScript | rollup.config.js | t83714/Active-Record-Node | ebdd146097c35d37d0d2324716bd6881316988bb | [
"MIT"
] | 1 | 2019-08-26T13:42:31.000Z | 2019-08-26T13:42:31.000Z | rollup.config.js | t83714/Active-Record-Node | ebdd146097c35d37d0d2324716bd6881316988bb | [
"MIT"
] | 4 | 2020-09-05T05:39:43.000Z | 2021-09-01T10:12:22.000Z | rollup.config.js | t83714/Active-Record-Node | ebdd146097c35d37d0d2324716bd6881316988bb | [
"MIT"
] | null | null | null | import * as path from "path";
import nodeResolve from "rollup-plugin-node-resolve";
import babel from "rollup-plugin-babel";
import replace from "rollup-plugin-replace";
import { uglify } from "rollup-plugin-uglify";
import json from "rollup-plugin-json";
import commonjs from "rollup-plugin-commonjs";
import pkg from "./package.json";
const ensureArray = maybeArr =>
Array.isArray(maybeArr) ? maybeArr : [maybeArr];
const createConfig = ({ input, output, external, env, min = false, ...props }) => ({
input,
experimentalCodeSplitting: typeof input !== "string",
output: ensureArray(output).map(format =>
Object.assign({}, format, {
name: "Active-Record-Node",
exports: "named"
})
),
external: ["util"],
plugins: [
nodeResolve({
jsnext: true
}),
json({
exclude: ["./node_modules/**"]
}),
commonjs({
include: "./node_modules/**"
}),
babel({
exclude: "./node_modules/**",
runtimeHelpers: true,
babelrcRoots: path.resolve(__dirname, "../*")
}),
env &&
replace({
"process.env.NODE_ENV": JSON.stringify(env)
}),
min &&
uglify({
compress: {
pure_getters: true,
unsafe: true,
unsafe_comps: true
}
})
].filter(Boolean),
...props
});
export default [
createConfig({
input: "src/index.js",
output: {
format: "esm",
file: "dist/" + pkg.name + ".esm.js"
}
}),
createConfig({
input: "src/index.js",
output: {
format: "cjs",
file: "dist/" + pkg.name + ".cjs.js"
}
})
];
| 26.15493 | 84 | 0.495961 |
75d9cc9d49610dc391218abd9b16044b81fc5cde | 892 | js | JavaScript | frontend/src/components/Pages/UnderConstruction.js | david5010/sheliak | 39d0cef25d4df0dd4cb8c5153b18be4eab1a0029 | [
"MIT"
] | 6 | 2022-02-24T00:04:24.000Z | 2022-03-21T08:46:46.000Z | frontend/src/components/Pages/UnderConstruction.js | david5010/sheliak | 39d0cef25d4df0dd4cb8c5153b18be4eab1a0029 | [
"MIT"
] | null | null | null | frontend/src/components/Pages/UnderConstruction.js | david5010/sheliak | 39d0cef25d4df0dd4cb8c5153b18be4eab1a0029 | [
"MIT"
] | 8 | 2022-02-24T00:07:32.000Z | 2022-03-21T01:59:46.000Z | import React from 'react';
// import { Link } from 'react-router-dom';
// import { CommonConstant } from 'constants/index';
class UnderConstruction extends React.Component {
render() {
return (
<div className="app-wrapper page-error-container animated slideInUpTiny animation-duration-3">
<div className="page-error-content">
<div className="error-code mb-4 animated zoomInDown">
<i className="zmdi zmdi-wrench zmdi-hc-fw" />
</div>
<h2 className="text-center fw-regular title bounceIn animation-delay-10 animated">
This page is under construction. Please check it after some days.
</h2>
<p className="text-center zoomIn animation-delay-20 animated">
{/*<Link className="btn btn-primary" to={CommonConstant.URL_HOME}>*/}
{/* Go Home*/}
{/*</Link>*/}
</p>
</div>
</div>
);
}
}
export default UnderConstruction;
| 31.857143 | 97 | 0.665919 |
75db1f967e3154f916a9922c69769cebe8b9a91d | 361 | js | JavaScript | .staging/examples/npmhub/src/lib/element-ready.js | sniperkit/snk.front.admin-sidebox-vuejs | 26fd5ac75d423f27f37d0b074107107091da6de7 | [
"MIT"
] | 1 | 2017-11-12T20:05:53.000Z | 2017-11-12T20:05:53.000Z | .staging/examples/npmhub/src/lib/element-ready.js | sniperkit/snk.front.admin-sidebox-vuejs | 26fd5ac75d423f27f37d0b074107107091da6de7 | [
"MIT"
] | null | null | null | .staging/examples/npmhub/src/lib/element-ready.js | sniperkit/snk.front.admin-sidebox-vuejs | 26fd5ac75d423f27f37d0b074107107091da6de7 | [
"MIT"
] | null | null | null | // Mini version of https://github.com/sindresorhus/element-ready
import select from 'select-dom';
export default function (selector, parent) {
return new Promise(resolve => {
(function check() {
const el = select(selector, parent);
if (el) {
resolve(el);
} else {
requestAnimationFrame(check);
}
})();
});
}
| 22.5625 | 64 | 0.601108 |
75dbf82e1bdffe1242b7315a7c76ee214a3097b7 | 206 | js | JavaScript | dox/html/search/files_5.js | KPO-2020-2021/zad4-AntoniJeziorski | b0ae62f994ff5b760457d637c0f131db05cfac33 | [
"Unlicense"
] | null | null | null | dox/html/search/files_5.js | KPO-2020-2021/zad4-AntoniJeziorski | b0ae62f994ff5b760457d637c0f131db05cfac33 | [
"Unlicense"
] | null | null | null | dox/html/search/files_5.js | KPO-2020-2021/zad4-AntoniJeziorski | b0ae62f994ff5b760457d637c0f131db05cfac33 | [
"Unlicense"
] | null | null | null | var searchData=
[
['scene_2ecpp_176',['scene.cpp',['../scene_8cpp.html',1,'']]],
['scene_2ehh_177',['scene.hh',['../scene_8hh.html',1,'']]],
['size_2ehh_178',['size.hh',['../size_8hh.html',1,'']]]
];
| 29.428571 | 64 | 0.572816 |
75dc659a6f71cd35a1dae3c74e551907cc833b55 | 1,657 | js | JavaScript | Data-Structures/graph/graph.js | slakeyj/data-structures-and-algorithms | c3e34c676dfcddc76f75bde75b94e2b75b51fd25 | [
"MIT"
] | null | null | null | Data-Structures/graph/graph.js | slakeyj/data-structures-and-algorithms | c3e34c676dfcddc76f75bde75b94e2b75b51fd25 | [
"MIT"
] | 2 | 2020-01-02T22:40:07.000Z | 2021-05-10T07:48:17.000Z | Data-Structures/graph/graph.js | slakeyj/data-structures-and-algorithms | c3e34c676dfcddc76f75bde75b94e2b75b51fd25 | [
"MIT"
] | null | null | null | const { Stack, Queue } = require('../stacksAndQueues/stacks-and-queues')
class Graph {
constructor() {
this.adjacencyList = new Map();
}
addNode(node) {
// initialize it with an empty array to add the adjacent nodes to
this.adjacencyList.set(node, []);
return node;
}
addEdge(node, destination, weight) {
if (!this.size()) {
return null;
}
const arrayOne = this.adjacencyList.get(node);
const arrayTwo = this.adjacencyList.get(destination);
if (node !== destination) {
if (!weight) {
arrayOne.push(destination);
arrayTwo.push(node);
} else {
let obj = {};
obj[destination] = weight
arrayOne.push(obj);
obj = {};
obj[node] = weight
arrayTwo.push(obj);
}
// this handles the case of one node and one edge
} else {
arrayOne.push(destination);
}
}
getNodes() {
if (!this.size()) {
return null;
}
return [...this.adjacencyList.keys()];
}
getNeighbors(node) {
if (!this.size()) {
return null;
}
return this.adjacencyList.get(node);
}
size() {
return this.adjacencyList.size;
}
breadthFirst(node) {
const queue = new Queue();
const nodes = [];
const visited = new Set();
queue.enqueue(node);
while (queue.length()) {
let front = queue.dequeue();
nodes.push(front);
this.getNeighbors(node).map(child => {
if (!visited.has(child)) {
visited.add(child);
queue.enqueue(child);
}
})
}
console.log('nodes', nodes)
return nodes;
}
}
module.exports = Graph; | 20.974684 | 72 | 0.561859 |
75dcec50f86b43d656ce200d7f2cce050f68d1d4 | 924 | js | JavaScript | tests/ui-test/src/behind-the-makecode-hardware/speakers.js | Helen09/pxt | 221233c420f34c74885d1b73f4b1b5074b6960aa | [
"MIT"
] | null | null | null | tests/ui-test/src/behind-the-makecode-hardware/speakers.js | Helen09/pxt | 221233c420f34c74885d1b73f4b1b5074b6960aa | [
"MIT"
] | null | null | null | tests/ui-test/src/behind-the-makecode-hardware/speakers.js | Helen09/pxt | 221233c420f34c74885d1b73f4b1b5074b6960aa | [
"MIT"
] | 2 | 2019-10-29T06:56:11.000Z | 2021-05-25T10:18:12.000Z | import { DomObject } from '../lib/dom-object';
import assert from "assert";
let { behindTheMakeCodeHardware} = require('../lib/css-value');
class Speakers extends DomObject {
async speakers() {
console.log('Start test speakers()');
await this.click(behindTheMakeCodeHardware.speakers,behindTheMakeCodeHardware.playVideo);
await this.switchToNewWindow();
let videoTitle = await this.getText(behindTheMakeCodeHardware.videoTitle);
assert.equal(videoTitle, 'Behind the MakeCode Hardware - Speakers with the micro:bit');
console.debug(`The video title of Speakers is "${videoTitle}"`);
await this.catchScreenShot('videoOfSpeakers');
await this.closeCurrentWindow();
}
test() {
it('Start learning the "Speakers"', async () => {
return await this.speakers();
});
}
}
export let speakers = new Speakers(); | 29.806452 | 97 | 0.656926 |
75ddb368fda6e444e1b4ef236cd8dc991d5a3c25 | 673 | js | JavaScript | electronautes/directives/drop.js | nmacia/Termites | 56c82f10a351b3443faab41780c06234fd023700 | [
"MIT"
] | 3 | 2018-03-17T14:58:17.000Z | 2018-06-11T19:13:47.000Z | electronautes/directives/drop.js | nmacia/Termites | 56c82f10a351b3443faab41780c06234fd023700 | [
"MIT"
] | 35 | 2017-05-08T15:58:32.000Z | 2018-03-13T13:37:51.000Z | electronautes/directives/drop.js | nmacia/Electronautes | 56c82f10a351b3443faab41780c06234fd023700 | [
"MIT"
] | 1 | 2018-03-07T11:48:38.000Z | 2018-03-07T11:48:38.000Z | 'use strict';
angular.module('electronautes').directive('tDropTarget', ($rootScope) => {
return {
restrict: 'A',
scope: {
onDrop: '&'
},
link: (scope, el, attrs, controller) => {
el.bind("dragover", (e) => {
return false;
});
el.bind("drop", (e) => {
if (e.preventDefault) e.preventDefault(); // Necessary. Allows us to drop.
if (e.stopPropagation) e.stopPropagation(); // Necessary. Allows us to drop.
var sensor = e.originalEvent.dataTransfer.getData("sensor-id");
scope.onDrop({dragEl: sensor, dropEl: angular.element(el).attr('id')});
});
}
};
}); | 26.92 | 84 | 0.543834 |
75df84c208888ce71b25fbb547a6b55811bf6159 | 8,713 | js | JavaScript | test/node/plugin_browser_ut_ajax_test.js | kujirahand/nadesiko3 | 30b8754646b65743603c40118f3338462f8aeb47 | [
"MIT"
] | 172 | 2017-02-13T01:46:18.000Z | 2022-03-28T07:56:20.000Z | test/node/plugin_browser_ut_ajax_test.js | kujirahand/nadesiko3 | 30b8754646b65743603c40118f3338462f8aeb47 | [
"MIT"
] | 856 | 2017-03-03T14:05:46.000Z | 2022-03-23T13:31:53.000Z | test/node/plugin_browser_ut_ajax_test.js | kujirahand/nadesiko3win32 | d99e6c9b7c3aecbd4497f60251d9fe44ee056efc | [
"MIT"
] | 27 | 2017-03-01T14:26:48.000Z | 2022-02-24T13:47:24.000Z | const assert = require('assert').strict
const PluginBrowser = require('../../src/plugin_browser')
const { PluginUtHelper } = require('../../utils/plugin_ut_helper')
const fetchMock = require('fetch-mock')
const FormDataBase = require('form-data')
class FormData extends FormDataBase {
constructor () {
super()
this.param_list = new Map()
}
set (k, v) {
this.append(k, v)
this.param_list.set(k, v)
}
get (k) {
return this.param_list.get(k)
}
}
global.FormData = FormData
describe('plugin_browser_ajax', () => {
const cu = new PluginUtHelper(PluginBrowser)
const setupSys = () => {
const sys = {}
sys.__v0 = {}
sys.__v0['対象'] = ''
sys.__v0['AJAXオプション'] = ''
sys.__v0['AJAX:ONERROR'] = (e) => {
assert.fail('ajax error')
}
sys.__findVar = function (nameStr, def) {
if (typeof nameStr === 'function') { return nameStr }
if (PluginBrowser[nameStr]) { return PluginBrowser[nameStr].fn }
return def
}
sys.__exec = function (func, params) {
const f = sys.__findVar(func)
if (!f) { throw new Error('システム関数でエイリアスの指定ミス:' + func) }
return f.apply(this, params)
}
sys.resolveCount = 0
return sys
}
afterEach(() => {
fetchMock.reset()
})
it('AJAX送信時', async () => {
fetchMock.get(/^\/dummyutl$/, 'ajax result')
const sys = setupSys()
sys.__v0['AJAX:ONERROR'] = (e) => {
assert.equal(e.message, 'unknown error')
}
PluginBrowser['AJAX送信時'].fn.apply(this, [() => {
assert.equal(sys.__v0['対象'], 'ajax result')
}, '/dummyutl', sys])
})
it('GET送信時 - error', async () => {
fetchMock.get(/^\/reject$/, { throws: new Error('unknown error') })
const sys = setupSys()
sys.__v0.options = {
method: 'GET'
}
sys.__v0['AJAX:ONERROR'] = (e) => {
assert.equal(e.message, 'unknown error')
}
PluginBrowser['GET送信時'].fn.apply(this, [() => {
assert.fail('no exception')
}, '/reject', sys])
})
it('POSTデータ生成', () => {
const param = {
KEY: 'VALUE',
_X: 'XE^ZA',
SPACE: ' '
}
cu.cmpfn('POSTデータ生成', [param], 'KEY=VALUE&_X=XE%5EZA&SPACE=%20')
})
it('POST送信時', async () => {
fetchMock.post(
(url, opts) => {
return (
url === '/post' &&
opts.body === 'param1=data1%5E¶m2=data2%5E%5E'
)
},
{ body: 'post result' }
)
const sys = setupSys()
const param = {
param1: 'data1^',
param2: 'data2^^'
}
PluginBrowser['POST送信時'].fn.apply(this, [() => {
assert.equal(sys.__v0['対象'], 'post result')
}, '/post', param, sys])
})
it('POST送信時 - error', async () => {
fetchMock.post(/^\/postreject$/, { throws: new Error('unknown error') })
const sys = setupSys()
sys.__v0['AJAX:ONERROR'] = (e) => {
assert.equal(e.message, 'unknown error')
}
PluginBrowser['POST送信時'].fn.apply(this, [() => {
assert.fail('no exception')
}, '/postreject', {}, sys])
})
it('POSTフォーム送信時', async () => {
fetchMock.post(
(url, opts) => {
const fd = opts.body
return (
url === '/post' &&
fd.get('param1') === 'data1^' &&
fd.get('param2') === 'data2^^'
)
},
{ body: 'post result' }
)
const sys = setupSys()
const param = {
param1: 'data1^',
param2: 'data2^^'
}
PluginBrowser['POSTフォーム送信時'].fn.apply(this, [() => {
assert.equal(sys.__v0['対象'], 'post result')
}, '/post', param, sys])
})
it('POSTフォーム送信時 - error', async () => {
fetchMock.post(/^\/postreject$/, { throws: new Error('unknown error') })
const sys = setupSys()
sys.__v0['AJAX:ONERROR'] = (e) => {
assert.equal(e.message, 'unknown error')
}
const param = {
param1: 'data1^',
param2: 'data2^^'
}
PluginBrowser['POSTフォーム送信時'].fn.apply(this, [() => {
assert.fail('no exception')
}, '/postreject', param, sys])
})
it('AJAX失敗時', () => {
const sys = setupSys()
const func = (e) => {
return e
}
PluginBrowser['AJAX失敗時'].fn.apply(this, [func, sys])
assert.equal(sys.__v0['AJAX:ONERROR'], func)
})
it('AJAXオプション設定', () => {
const sys = setupSys()
const param = {
KEY: 'VALUE'
}
PluginBrowser['AJAXオプション設定'].fn.apply(this, [param, sys])
assert.equal(sys.__v0['AJAXオプション'], param)
})
it('AJAX送信', async () => {
fetchMock.get(/^\/dummyutl$/, 'ajax result')
const sys = setupSys()
const promise = new Promise((resolve, reject) => {
sys.resolve = resolve
sys.reject = reject
PluginBrowser['AJAX送信'].fn.apply(this, ['/dummyutl', sys])
})
await promise
assert.equal(sys.__v0['対象'], 'ajax result')
})
it('AJAX送信 - error', async () => {
fetchMock.get(/^\/ajaxreject$/, { throws: new Error('unknown error') })
const sys = setupSys()
const promise = new Promise((resolve, reject) => {
sys.resolve = resolve
sys.reject = (err) => {
assert.equal(err, 'unknown error')
resolve()
}
PluginBrowser['AJAX送信'].fn.apply(this, ['/ajaxreject', sys])
})
await promise
})
it('HTTP取得 - error', async () => {
fetchMock.get(/^\/ajaxreject$/, { throws: new Error('unknown error') })
const sys = setupSys()
const promise = new Promise((resolve, reject) => {
sys.resolve = resolve
sys.reject = (err) => {
assert.equal(err, 'unknown error')
resolve()
}
PluginBrowser['HTTP取得'].fn.apply(this, ['/ajaxreject', sys])
})
await promise
})
it('AJAX送信 - error(without 逐次実行)', async () => {
fetchMock.get(/^\/ajaxreject$/, 'ajax result')
const sys = setupSys()
cu.cmpfnex('AJAX送信', ['/ajaxreject', sys], 'Error', '『AJAX送信』は『逐次実行』構文内で利用する必要があります。')
})
it('POST送信', async () => {
fetchMock.post(
(url, opts) => {
return (
url === '/post' &&
opts.body === 'param1=data1%5E¶m2=data2%5E%5E'
)
},
{ body: 'post result' }
)
const sys = setupSys()
const promise = new Promise((resolve, reject) => {
sys.resolve = resolve
sys.reject = reject
const param = {
param1: 'data1^',
param2: 'data2^^'
}
PluginBrowser['POST送信'].fn.apply(this, ['/post', param, sys])
})
await promise
assert.equal(sys.__v0['対象'], 'post result')
})
it('POST送信 - error', async () => {
fetchMock.post(/^\/ajaxreject$/, { throws: new Error('unknown error') })
const sys = setupSys()
const promise = new Promise((resolve, reject) => {
sys.resolve = resolve
sys.reject = (err) => {
assert.equal(err, 'unknown error')
resolve()
}
const param = {
param1: 'data1^',
param2: 'data2^^'
}
PluginBrowser['POST送信'].fn.apply(this, ['/ajaxreject', param, sys])
})
await promise
})
it('POST送信 - error(without 逐次実行)', async () => {
fetchMock.post(/^\/ajaxreject$/, 'ajax result')
const sys = setupSys()
cu.cmpfnex('POST送信', ['/ajaxreject', {}, sys], 'Error', '『POST送信』は『逐次実行』構文内で利用する必要があります。')
})
it('POSTフォーム送信', async () => {
fetchMock.post(
(url, opts) => {
const fd = opts.body
return (
url === '/post' &&
fd.get('param1') === 'data1^' &&
fd.get('param2') === 'data2^^'
)
},
{ body: 'post result' }
)
const sys = setupSys()
const promise = new Promise((resolve, reject) => {
sys.resolve = resolve
sys.reject = (err) => {
assert.equal(err, 'unknown error')
resolve()
}
const param = {
param1: 'data1^',
param2: 'data2^^'
}
PluginBrowser['POSTフォーム送信'].fn.apply(this, ['/post', param, sys])
})
await promise
assert.equal(sys.__v0['対象'], 'post result')
})
it('POSTフォーム送信 - error', async () => {
fetchMock.post(/^\/ajaxreject$/, { throws: new Error('unknown error') })
const sys = setupSys()
const promise = new Promise((resolve, reject) => {
sys.resolve = resolve
sys.reject = (err) => {
assert.equal(err, 'unknown error')
resolve()
}
const param = {
param1: 'data1^',
param2: 'data2^^'
}
PluginBrowser['POSTフォーム送信'].fn.apply(this, ['/ajaxreject', param, sys])
})
await promise
})
it('POSTフォーム送信 - error(without 逐次実行)', async () => {
fetchMock.post(/^\/ajaxreject$/, 'ajax result')
const sys = setupSys()
cu.cmpfnex('POSTフォーム送信', ['/ajaxreject', {}, sys], 'Error', '『POSTフォーム送信』は『逐次実行』構文内で利用する必要があります。')
})
})
| 24.474719 | 102 | 0.536095 |
75e170b2b03b52c7e391aeaec70c61468d36b413 | 25,138 | js | JavaScript | dist/components/svg/HowSvg.js | nitro-neal/mypass-oauth | b39f6f7b453f34a1edc7b6d2d7fe370d6bc849ad | [
"BSD-3-Clause"
] | null | null | null | dist/components/svg/HowSvg.js | nitro-neal/mypass-oauth | b39f6f7b453f34a1edc7b6d2d7fe370d6bc849ad | [
"BSD-3-Clause"
] | null | null | null | dist/components/svg/HowSvg.js | nitro-neal/mypass-oauth | b39f6f7b453f34a1edc7b6d2d7fe370d6bc849ad | [
"BSD-3-Clause"
] | null | null | null | "use strict";var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports, "__esModule", { value: true });exports.default = void 0;var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react = _interopRequireWildcard(require("react"));
class HowSvg extends _react.Component {
render() {
const { loginMethod } = { ...this.props };
return howSvg[loginMethod];
}}exports.default = HowSvg;(0, _defineProperty2.default)(HowSvg, "defaultProps", { loginMethod: "securityAnswers" });
const howSvg = {
securityAnswers: /*#__PURE__*/
_react.default.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
width: "141",
height: "141",
viewBox: "0 0 141 141" }, /*#__PURE__*/
_react.default.createElement("defs", null, /*#__PURE__*/
_react.default.createElement("filter", {
id: "Ellipse_499",
x: "0",
y: "0",
width: "141",
height: "141",
filterUnits: "userSpaceOnUse" }, /*#__PURE__*/
_react.default.createElement("feOffset", { dy: "3", input: "SourceAlpha" }), /*#__PURE__*/
_react.default.createElement("feGaussianBlur", { stdDeviation: "3", result: "blur" }), /*#__PURE__*/
_react.default.createElement("feFlood", { floodOpacity: "0.161" }), /*#__PURE__*/
_react.default.createElement("feComposite", { operator: "in", in2: "blur" }), /*#__PURE__*/
_react.default.createElement("feComposite", { in: "SourceGraphic" }))), /*#__PURE__*/
_react.default.createElement("g", {
id: "Group_2444",
"data-name": "Group 2444",
transform: "translate(-110 -142)" }, /*#__PURE__*/
_react.default.createElement("g", { transform: "matrix(1, 0, 0, 1, 110, 142)", filter: "url(#Ellipse_499)" }, /*#__PURE__*/
_react.default.createElement("circle", {
id: "Ellipse_499-2",
"data-name": "Ellipse 499",
cx: "61.5",
cy: "61.5",
r: "61.5",
transform: "translate(9 6)",
fill: "#fff" })), /*#__PURE__*/
_react.default.createElement("g", {
id: "noun_security_question_2758596",
"data-name": "noun_security question_2758596",
transform: "translate(140.959 171.568)" }, /*#__PURE__*/
_react.default.createElement("path", {
id: "Path_1392",
"data-name": "Path 1392",
d: "M67.635,14.344a4.461,4.461,0,0,1,.134,1.088v19.82a34.262,34.262,0,0,1-17.509,29.8l-8.68,4.873a4.491,4.491,0,0,1-4.392,0l-8.68-4.873A34.262,34.262,0,0,1,11,35.252V15.432c0-1.013.4-4.441,5.468-6.974C21.054,6.162,28.763,5,39.385,5,61.928,5,66.754,10.857,67.635,14.344ZM63.288,35.207V15.432s-1.494-5.961-23.9-5.961c-23.9,0-23.9,5.961-23.9,5.961v19.82A29.792,29.792,0,0,0,30.705,61.227l8.68,4.873,8.68-4.918A29.792,29.792,0,0,0,63.288,35.207ZM39.749,17.373c12.737,0,12.737,9.95,12.737,14.192,0,3.317-2.847,5.109-5.724,6.947S42,41.679,42,43.517a2.248,2.248,0,0,1-4.5,0c0-4.437,3.851-6.842,6.848-8.784,1.543-.971,3.641-2.316,3.641-3.167,0-5.5-.614-9.711-8.241-9.711-8.017,0-8.241,6.035-8.241,6.723a2.248,2.248,0,0,1-4.5,0C27.012,24.708,29.679,17.373,39.749,17.373Zm-.728,38.574A2.547,2.547,0,1,1,41.568,53.4,2.547,2.547,0,0,1,39.021,55.947Z",
transform: "translate(0)",
fill: "#2362c7",
fillRule: "evenodd" })))),
text: /*#__PURE__*/
_react.default.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
xmlnsXlink: "http://www.w3.org/1999/xlink",
width: "141",
height: "141",
viewBox: "0 0 141 141" }, /*#__PURE__*/
_react.default.createElement("defs", null, /*#__PURE__*/
_react.default.createElement("filter", {
id: "Ellipse_499",
x: "0",
y: "0",
width: "141",
height: "141",
filterUnits: "userSpaceOnUse" }, /*#__PURE__*/
_react.default.createElement("feOffset", { dy: "3", input: "SourceAlpha" }), /*#__PURE__*/
_react.default.createElement("feGaussianBlur", { stdDeviation: "3", result: "blur" }), /*#__PURE__*/
_react.default.createElement("feFlood", { floodOpacity: "0.161" }), /*#__PURE__*/
_react.default.createElement("feComposite", { operator: "in", in2: "blur" }), /*#__PURE__*/
_react.default.createElement("feComposite", { in: "SourceGraphic" }))), /*#__PURE__*/
_react.default.createElement("g", {
id: "Group_2495",
"data-name": "Group 2495",
transform: "translate(-110 -142)" }, /*#__PURE__*/
_react.default.createElement("g", { id: "Group_2497", "data-name": "Group 2497" }, /*#__PURE__*/
_react.default.createElement("g", {
transform: "matrix(1, 0, 0, 1, 110, 142)",
filter: "url(#Ellipse_499)" }, /*#__PURE__*/
_react.default.createElement("circle", {
id: "Ellipse_499-2",
"data-name": "Ellipse 499",
cx: "61.5",
cy: "61.5",
r: "61.5",
transform: "translate(9 6)",
fill: "#fff" })), /*#__PURE__*/
_react.default.createElement("g", { id: "Group_2496", "data-name": "Group 2496" }, /*#__PURE__*/
_react.default.createElement("path", {
id: "noun_Key_677345_1_",
"data-name": "noun_Key_677345 (1)",
d: "M31.944,45.28l2.928,2.928a3.313,3.313,0,0,0,2.465,1.02H40.8v2.928a3.975,3.975,0,0,0,3.975,3.975h2.928v3.458a3.5,3.5,0,0,0,1,2.438l2.3,2.3a3.246,3.246,0,0,0,2.292.941h9.13a2.856,2.856,0,0,0,2.849-2.849h0V53.29a3.24,3.24,0,0,0-.954-2.306L45.28,31.944A21.767,21.767,0,1,0,31.944,45.28ZM12.167,12.154A17.789,17.789,0,0,1,41.133,31.665a1.988,1.988,0,0,0,.424,2.18L61.294,53.588v7.705H53.588l-1.941-1.941V54.668a2.557,2.557,0,0,0-2.557-2.557H44.777v-4.3a2.557,2.557,0,0,0-2.557-2.557H37.542l-3.7-3.7a1.988,1.988,0,0,0-2.18-.424,17.789,17.789,0,0,1-19.5-28.966Z",
transform: "translate(143.026 176.026)",
fill: "#2362c7" }), /*#__PURE__*/
_react.default.createElement("g", {
id: "Ellipse_690",
"data-name": "Ellipse 690",
transform: "translate(156 189)",
fill: "#fff",
stroke: "#2362c7",
strokeWidth: "4" }, /*#__PURE__*/
_react.default.createElement("circle", { cx: "7.5", cy: "7.5", r: "7.5", stroke: "none" }), /*#__PURE__*/
_react.default.createElement("circle", { cx: "7.5", cy: "7.5", r: "5.5", fill: "none" })))))),
palm: /*#__PURE__*/
_react.default.createElement("svg", {
xmlns: "http://www.w3.org/2000/svg",
width: "141",
height: "141",
viewBox: "0 0 141 141" }, /*#__PURE__*/
_react.default.createElement("defs", null, /*#__PURE__*/
_react.default.createElement("filter", {
id: "Ellipse_499",
x: "0",
y: "0",
width: "141",
height: "141",
filterUnits: "userSpaceOnUse" }, /*#__PURE__*/
_react.default.createElement("feOffset", { dy: "3", input: "SourceAlpha" }), /*#__PURE__*/
_react.default.createElement("feGaussianBlur", { stdDeviation: "3", result: "blur" }), /*#__PURE__*/
_react.default.createElement("feFlood", { floodOpacity: "0.161" }), /*#__PURE__*/
_react.default.createElement("feComposite", { operator: "in", in2: "blur" }), /*#__PURE__*/
_react.default.createElement("feComposite", { in: "SourceGraphic" }))), /*#__PURE__*/
_react.default.createElement("g", {
id: "Group_2447",
"data-name": "Group 2447",
transform: "translate(-110 -142)" }, /*#__PURE__*/
_react.default.createElement("g", { transform: "matrix(1, 0, 0, 1, 110, 142)", filter: "url(#Ellipse_499)" }, /*#__PURE__*/
_react.default.createElement("circle", {
id: "Ellipse_499-2",
"data-name": "Ellipse 499",
cx: "61.5",
cy: "61.5",
r: "61.5",
transform: "translate(9 6)",
fill: "#fff" })), /*#__PURE__*/
_react.default.createElement("g", { id: "noun_palm_1671954", transform: "translate(136.516 168)" }, /*#__PURE__*/
_react.default.createElement("path", {
id: "Path_1362",
"data-name": "Path 1362",
d: "M41.99,77.384h2.594a24.579,24.579,0,0,0,17.308-7.017A23.587,23.587,0,0,0,69.08,53.383h0V22.434a6.489,6.489,0,0,0-9.785-5.6V14.045A6.491,6.491,0,0,0,48.926,8.829,6.547,6.547,0,0,0,47.6,6.9a6.5,6.5,0,0,0-11.039,3.772,6.433,6.433,0,0,0-3.341-.935,6.514,6.514,0,0,0-6.507,6.507V30.19a5.162,5.162,0,0,0-1.383-.178H21.858a3.214,3.214,0,0,0-3.211,3.211V52.56C18.646,66.945,28.464,77.384,41.99,77.384ZM21.857,33.23H25.33c.733,0,.871.125,1.728,1.1l.049.056a3.2,3.2,0,0,1,.8,2.129v8.618a5.111,5.111,0,0,0,3.733,4.92,14.781,14.781,0,0,1,6.375,3.735,15.2,15.2,0,0,1,4.174,8.174,1.609,1.609,0,0,0,3.174-.53,18.447,18.447,0,0,0-5.075-9.922,17.96,17.96,0,0,0-7.744-4.544,1.918,1.918,0,0,1-1.418-1.832V36.519a6.457,6.457,0,0,0-1.2-3.734V16.244a3.282,3.282,0,0,1,5.611-2.32,3.259,3.259,0,0,1,.96,2.32s0,0,0,.008V36.563a1.609,1.609,0,1,0,3.217,0V11.5a3.284,3.284,0,1,1,6.568,0v2.544a1.637,1.637,0,0,0,.043.357v22.16a1.609,1.609,0,1,0,3.217,0V13.622a3.278,3.278,0,0,1,6.53.423V38.122a1.609,1.609,0,1,0,3.217,0V22.434a3.288,3.288,0,0,1,3.284-3.284,3.287,3.287,0,0,1,3.284,3.284V53.383h0a20.4,20.4,0,0,1-6.221,14.684,21.379,21.379,0,0,1-15.058,6.1H41.99c-11.662,0-20.126-9.087-20.126-21.607Z",
transform: "translate(0 0)",
fill: "#2362c7",
stroke: "#2362c7",
strokeWidth: "1" })))) };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL3N2Zy9Ib3dTdmcuanN4Il0sIm5hbWVzIjpbIkhvd1N2ZyIsIkNvbXBvbmVudCIsInJlbmRlciIsImxvZ2luTWV0aG9kIiwicHJvcHMiLCJob3dTdmciLCJzZWN1cml0eUFuc3dlcnMiLCJ0ZXh0IiwicGFsbSJdLCJtYXBwaW5ncyI6ImdYQUFBOztBQUVlLE1BQU1BLE1BQU4sU0FBcUJDLGdCQUFyQixDQUErQjs7Ozs7QUFLNUNDLEVBQUFBLE1BQU0sR0FBRztBQUNQLFVBQU0sRUFBRUMsV0FBRixLQUFrQixFQUFFLEdBQUcsS0FBS0MsS0FBVixFQUF4QjtBQUNBLFdBQU9DLE1BQU0sQ0FBQ0YsV0FBRCxDQUFiO0FBQ0QsR0FSMkMsQyx1REFBekJILE0sa0JBQ0csRUFDcEJHLFdBQVcsRUFBRSxpQkFETyxFOzs7QUFVeEIsTUFBTUUsTUFBTSxHQUFHO0FBQ2JDLEVBQUFBLGVBQWU7QUFDYjtBQUNFLElBQUEsS0FBSyxFQUFDLDRCQURSO0FBRUUsSUFBQSxLQUFLLEVBQUMsS0FGUjtBQUdFLElBQUEsTUFBTSxFQUFDLEtBSFQ7QUFJRSxJQUFBLE9BQU8sRUFBQyxhQUpWOztBQU1FO0FBQ0U7QUFDRSxJQUFBLEVBQUUsRUFBQyxhQURMO0FBRUUsSUFBQSxDQUFDLEVBQUMsR0FGSjtBQUdFLElBQUEsQ0FBQyxFQUFDLEdBSEo7QUFJRSxJQUFBLEtBQUssRUFBQyxLQUpSO0FBS0UsSUFBQSxNQUFNLEVBQUMsS0FMVDtBQU1FLElBQUEsV0FBVyxFQUFDLGdCQU5kOztBQVFFLDZDQUFVLEVBQUUsRUFBQyxHQUFiLEVBQWlCLEtBQUssRUFBQyxhQUF2QixHQVJGO0FBU0UsbURBQWdCLFlBQVksRUFBQyxHQUE3QixFQUFpQyxNQUFNLEVBQUMsTUFBeEMsR0FURjtBQVVFLDRDQUFTLFlBQVksRUFBQyxPQUF0QixHQVZGO0FBV0UsZ0RBQWEsUUFBUSxFQUFDLElBQXRCLEVBQTJCLEdBQUcsRUFBQyxNQUEvQixHQVhGO0FBWUUsZ0RBQWEsRUFBRSxFQUFDLGVBQWhCLEdBWkYsQ0FERixDQU5GOzs7QUFzQkU7QUFDRSxJQUFBLEVBQUUsRUFBQyxZQURMO0FBRUUsaUJBQVUsWUFGWjtBQUdFLElBQUEsU0FBUyxFQUFDLHNCQUhaOztBQUtFLHNDQUFHLFNBQVMsRUFBQyw4QkFBYixFQUE0QyxNQUFNLEVBQUMsbUJBQW5EO0FBQ0U7QUFDRSxJQUFBLEVBQUUsRUFBQyxlQURMO0FBRUUsaUJBQVUsYUFGWjtBQUdFLElBQUEsRUFBRSxFQUFDLE1BSEw7QUFJRSxJQUFBLEVBQUUsRUFBQyxNQUpMO0FBS0UsSUFBQSxDQUFDLEVBQUMsTUFMSjtBQU1FLElBQUEsU0FBUyxFQUFDLGdCQU5aO0FBT0UsSUFBQSxJQUFJLEVBQUMsTUFQUCxHQURGLENBTEY7OztBQWdCRTtBQUNFLElBQUEsRUFBRSxFQUFDLGdDQURMO0FBRUUsaUJBQVUsZ0NBRlo7QUFHRSxJQUFBLFNBQVMsRUFBQyw0QkFIWjs7QUFLRTtBQUNFLElBQUEsRUFBRSxFQUFDLFdBREw7QUFFRSxpQkFBVSxXQUZaO0FBR0UsSUFBQSxDQUFDLEVBQUMsbTBCQUhKO0FBSUUsSUFBQSxTQUFTLEVBQUMsY0FKWjtBQUtFLElBQUEsSUFBSSxFQUFDLFNBTFA7QUFNRSxJQUFBLFFBQVEsRUFBQyxTQU5YLEdBTEYsQ0FoQkYsQ0F0QkYsQ0FGVzs7Ozs7O0FBeURiQyxFQUFBQSxJQUFJO0FBQ0Y7QUFDRSxJQUFBLEtBQUssRUFBQyw0QkFEUjtBQUVFLElBQUEsVUFBVSxFQUFDLDhCQUZiO0FBR0UsSUFBQSxLQUFLLEVBQUMsS0FIUjtBQUlFLElBQUEsTUFBTSxFQUFDLEtBSlQ7QUFLRSxJQUFBLE9BQU8sRUFBQyxhQUxWOztBQU9FO0FBQ0U7QUFDRSxJQUFBLEVBQUUsRUFBQyxhQURMO0FBRUUsSUFBQSxDQUFDLEVBQUMsR0FGSjtBQUdFLElBQUEsQ0FBQyxFQUFDLEdBSEo7QUFJRSxJQUFBLEtBQUssRUFBQyxLQUpSO0FBS0UsSUFBQSxNQUFNLEVBQUMsS0FMVDtBQU1FLElBQUEsV0FBVyxFQUFDLGdCQU5kOztBQVFFLDZDQUFVLEVBQUUsRUFBQyxHQUFiLEVBQWlCLEtBQUssRUFBQyxhQUF2QixHQVJGO0FBU0UsbURBQWdCLFlBQVksRUFBQyxHQUE3QixFQUFpQyxNQUFNLEVBQUMsTUFBeEMsR0FURjtBQVVFLDRDQUFTLFlBQVksRUFBQyxPQUF0QixHQVZGO0FBV0UsZ0RBQWEsUUFBUSxFQUFDLElBQXRCLEVBQTJCLEdBQUcsRUFBQyxNQUEvQixHQVhGO0FBWUUsZ0RBQWEsRUFBRSxFQUFDLGVBQWhCLEdBWkYsQ0FERixDQVBGOzs7QUF1QkU7QUFDRSxJQUFBLEVBQUUsRUFBQyxZQURMO0FBRUUsaUJBQVUsWUFGWjtBQUdFLElBQUEsU0FBUyxFQUFDLHNCQUhaOztBQUtFLHNDQUFHLEVBQUUsRUFBQyxZQUFOLEVBQW1CLGFBQVUsWUFBN0I7QUFDRTtBQUNFLElBQUEsU0FBUyxFQUFDLDhCQURaO0FBRUUsSUFBQSxNQUFNLEVBQUMsbUJBRlQ7O0FBSUU7QUFDRSxJQUFBLEVBQUUsRUFBQyxlQURMO0FBRUUsaUJBQVUsYUFGWjtBQUdFLElBQUEsRUFBRSxFQUFDLE1BSEw7QUFJRSxJQUFBLEVBQUUsRUFBQyxNQUpMO0FBS0UsSUFBQSxDQUFDLEVBQUMsTUFMSjtBQU1FLElBQUEsU0FBUyxFQUFDLGdCQU5aO0FBT0UsSUFBQSxJQUFJLEVBQUMsTUFQUCxHQUpGLENBREY7OztBQWVFLHNDQUFHLEVBQUUsRUFBQyxZQUFOLEVBQW1CLGFBQVUsWUFBN0I7QUFDRTtBQUNFLElBQUEsRUFBRSxFQUFDLG9CQURMO0FBRUUsaUJBQVUscUJBRlo7QUFHRSxJQUFBLENBQUMsRUFBQyw0aUJBSEo7QUFJRSxJQUFBLFNBQVMsRUFBQyw0QkFKWjtBQUtFLElBQUEsSUFBSSxFQUFDLFNBTFAsR0FERjs7QUFRRTtBQUNFLElBQUEsRUFBRSxFQUFDLGFBREw7QUFFRSxpQkFBVSxhQUZaO0FBR0UsSUFBQSxTQUFTLEVBQUMsb0JBSFo7QUFJRSxJQUFBLElBQUksRUFBQyxNQUpQO0FBS0UsSUFBQSxNQUFNLEVBQUMsU0FMVDtBQU1FLElBQUEsV0FBVyxFQUFDLEdBTmQ7O0FBUUUsMkNBQVEsRUFBRSxFQUFDLEtBQVgsRUFBaUIsRUFBRSxFQUFDLEtBQXBCLEVBQTBCLENBQUMsRUFBQyxLQUE1QixFQUFrQyxNQUFNLEVBQUMsTUFBekMsR0FSRjtBQVNFLDJDQUFRLEVBQUUsRUFBQyxLQUFYLEVBQWlCLEVBQUUsRUFBQyxLQUFwQixFQUEwQixDQUFDLEVBQUMsS0FBNUIsRUFBa0MsSUFBSSxFQUFDLE1BQXZDLEdBVEYsQ0FSRixDQWZGLENBTEYsQ0F2QkYsQ0ExRFc7Ozs7Ozs7QUE2SGJDLEVBQUFBLElBQUk7QUFDRjtBQUNFLElBQUEsS0FBSyxFQUFDLDRCQURSO0FBRUUsSUFBQSxLQUFLLEVBQUMsS0FGUjtBQUdFLElBQUEsTUFBTSxFQUFDLEtBSFQ7QUFJRSxJQUFBLE9BQU8sRUFBQyxhQUpWOztBQU1FO0FBQ0U7QUFDRSxJQUFBLEVBQUUsRUFBQyxhQURMO0FBRUUsSUFBQSxDQUFDLEVBQUMsR0FGSjtBQUdFLElBQUEsQ0FBQyxFQUFDLEdBSEo7QUFJRSxJQUFBLEtBQUssRUFBQyxLQUpSO0FBS0UsSUFBQSxNQUFNLEVBQUMsS0FMVDtBQU1FLElBQUEsV0FBVyxFQUFDLGdCQU5kOztBQVFFLDZDQUFVLEVBQUUsRUFBQyxHQUFiLEVBQWlCLEtBQUssRUFBQyxhQUF2QixHQVJGO0FBU0UsbURBQWdCLFlBQVksRUFBQyxHQUE3QixFQUFpQyxNQUFNLEVBQUMsTUFBeEMsR0FURjtBQVVFLDRDQUFTLFlBQVksRUFBQyxPQUF0QixHQVZGO0FBV0UsZ0RBQWEsUUFBUSxFQUFDLElBQXRCLEVBQTJCLEdBQUcsRUFBQyxNQUEvQixHQVhGO0FBWUUsZ0RBQWEsRUFBRSxFQUFDLGVBQWhCLEdBWkYsQ0FERixDQU5GOzs7QUFzQkU7QUFDRSxJQUFBLEVBQUUsRUFBQyxZQURMO0FBRUUsaUJBQVUsWUFGWjtBQUdFLElBQUEsU0FBUyxFQUFDLHNCQUhaOztBQUtFLHNDQUFHLFNBQVMsRUFBQyw4QkFBYixFQUE0QyxNQUFNLEVBQUMsbUJBQW5EO0FBQ0U7QUFDRSxJQUFBLEVBQUUsRUFBQyxlQURMO0FBRUUsaUJBQVUsYUFGWjtBQUdFLElBQUEsRUFBRSxFQUFDLE1BSEw7QUFJRSxJQUFBLEVBQUUsRUFBQyxNQUpMO0FBS0UsSUFBQSxDQUFDLEVBQUMsTUFMSjtBQU1FLElBQUEsU0FBUyxFQUFDLGdCQU5aO0FBT0UsSUFBQSxJQUFJLEVBQUMsTUFQUCxHQURGLENBTEY7OztBQWdCRSxzQ0FBRyxFQUFFLEVBQUMsbUJBQU4sRUFBMEIsU0FBUyxFQUFDLHdCQUFwQztBQUNFO0FBQ0UsSUFBQSxFQUFFLEVBQUMsV0FETDtBQUVFLGlCQUFVLFdBRlo7QUFHRSxJQUFBLENBQUMsRUFBQyxvcENBSEo7QUFJRSxJQUFBLFNBQVMsRUFBQyxnQkFKWjtBQUtFLElBQUEsSUFBSSxFQUFDLFNBTFA7QUFNRSxJQUFBLE1BQU0sRUFBQyxTQU5UO0FBT0UsSUFBQSxXQUFXLEVBQUMsR0FQZCxHQURGLENBaEJGLENBdEJGLENBOUhXLEVBQWYiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QsIHsgQ29tcG9uZW50IH0gZnJvbSBcInJlYWN0XCI7XG5cbmV4cG9ydCBkZWZhdWx0IGNsYXNzIEhvd1N2ZyBleHRlbmRzIENvbXBvbmVudCB7XG4gIHN0YXRpYyBkZWZhdWx0UHJvcHMgPSB7XG4gICAgbG9naW5NZXRob2Q6IFwic2VjdXJpdHlBbnN3ZXJzXCIsXG4gIH07XG5cbiAgcmVuZGVyKCkge1xuICAgIGNvbnN0IHsgbG9naW5NZXRob2QgfSA9IHsgLi4udGhpcy5wcm9wcyB9O1xuICAgIHJldHVybiBob3dTdmdbbG9naW5NZXRob2RdO1xuICB9XG59XG5cbmNvbnN0IGhvd1N2ZyA9IHtcbiAgc2VjdXJpdHlBbnN3ZXJzOiAoXG4gICAgPHN2Z1xuICAgICAgeG1sbnM9XCJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2Z1wiXG4gICAgICB3aWR0aD1cIjE0MVwiXG4gICAgICBoZWlnaHQ9XCIxNDFcIlxuICAgICAgdmlld0JveD1cIjAgMCAxNDEgMTQxXCJcbiAgICA+XG4gICAgICA8ZGVmcz5cbiAgICAgICAgPGZpbHRlclxuICAgICAgICAgIGlkPVwiRWxsaXBzZV80OTlcIlxuICAgICAgICAgIHg9XCIwXCJcbiAgICAgICAgICB5PVwiMFwiXG4gICAgICAgICAgd2lkdGg9XCIxNDFcIlxuICAgICAgICAgIGhlaWdodD1cIjE0MVwiXG4gICAgICAgICAgZmlsdGVyVW5pdHM9XCJ1c2VyU3BhY2VPblVzZVwiXG4gICAgICAgID5cbiAgICAgICAgICA8ZmVPZmZzZXQgZHk9XCIzXCIgaW5wdXQ9XCJTb3VyY2VBbHBoYVwiIC8+XG4gICAgICAgICAgPGZlR2F1c3NpYW5CbHVyIHN0ZERldmlhdGlvbj1cIjNcIiByZXN1bHQ9XCJibHVyXCIgLz5cbiAgICAgICAgICA8ZmVGbG9vZCBmbG9vZE9wYWNpdHk9XCIwLjE2MVwiIC8+XG4gICAgICAgICAgPGZlQ29tcG9zaXRlIG9wZXJhdG9yPVwiaW5cIiBpbjI9XCJibHVyXCIgLz5cbiAgICAgICAgICA8ZmVDb21wb3NpdGUgaW49XCJTb3VyY2VHcmFwaGljXCIgLz5cbiAgICAgICAgPC9maWx0ZXI+XG4gICAgICA8L2RlZnM+XG4gICAgICA8Z1xuICAgICAgICBpZD1cIkdyb3VwXzI0NDRcIlxuICAgICAgICBkYXRhLW5hbWU9XCJHcm91cCAyNDQ0XCJcbiAgICAgICAgdHJhbnNmb3JtPVwidHJhbnNsYXRlKC0xMTAgLTE0MilcIlxuICAgICAgPlxuICAgICAgICA8ZyB0cmFuc2Zvcm09XCJtYXRyaXgoMSwgMCwgMCwgMSwgMTEwLCAxNDIpXCIgZmlsdGVyPVwidXJsKCNFbGxpcHNlXzQ5OSlcIj5cbiAgICAgICAgICA8Y2lyY2xlXG4gICAgICAgICAgICBpZD1cIkVsbGlwc2VfNDk5LTJcIlxuICAgICAgICAgICAgZGF0YS1uYW1lPVwiRWxsaXBzZSA0OTlcIlxuICAgICAgICAgICAgY3g9XCI2MS41XCJcbiAgICAgICAgICAgIGN5PVwiNjEuNVwiXG4gICAgICAgICAgICByPVwiNjEuNVwiXG4gICAgICAgICAgICB0cmFuc2Zvcm09XCJ0cmFuc2xhdGUoOSA2KVwiXG4gICAgICAgICAgICBmaWxsPVwiI2ZmZlwiXG4gICAgICAgICAgLz5cbiAgICAgICAgPC9nPlxuICAgICAgICA8Z1xuICAgICAgICAgIGlkPVwibm91bl9zZWN1cml0eV9xdWVzdGlvbl8yNzU4NTk2XCJcbiAgICAgICAgICBkYXRhLW5hbWU9XCJub3VuX3NlY3VyaXR5IHF1ZXN0aW9uXzI3NTg1OTZcIlxuICAgICAgICAgIHRyYW5zZm9ybT1cInRyYW5zbGF0ZSgxNDAuOTU5IDE3MS41NjgpXCJcbiAgICAgICAgPlxuICAgICAgICAgIDxwYXRoXG4gICAgICAgICAgICBpZD1cIlBhdGhfMTM5MlwiXG4gICAgICAgICAgICBkYXRhLW5hbWU9XCJQYXRoIDEzOTJcIlxuICAgICAgICAgICAgZD1cIk02Ny42MzUsMTQuMzQ0YTQuNDYxLDQuNDYxLDAsMCwxLC4xMzQsMS4wODh2MTkuODJhMzQuMjYyLDM0LjI2MiwwLDAsMS0xNy41MDksMjkuOGwtOC42OCw0Ljg3M2E0LjQ5MSw0LjQ5MSwwLDAsMS00LjM5MiwwbC04LjY4LTQuODczQTM0LjI2MiwzNC4yNjIsMCwwLDEsMTEsMzUuMjUyVjE1LjQzMmMwLTEuMDEzLjQtNC40NDEsNS40NjgtNi45NzRDMjEuMDU0LDYuMTYyLDI4Ljc2Myw1LDM5LjM4NSw1LDYxLjkyOCw1LDY2Ljc1NCwxMC44NTcsNjcuNjM1LDE0LjM0NFpNNjMuMjg4LDM1LjIwN1YxNS40MzJzLTEuNDk0LTUuOTYxLTIzLjktNS45NjFjLTIzLjksMC0yMy45LDUuOTYxLTIzLjksNS45NjF2MTkuODJBMjkuNzkyLDI5Ljc5MiwwLDAsMCwzMC43MDUsNjEuMjI3bDguNjgsNC44NzMsOC42OC00LjkxOEEyOS43OTIsMjkuNzkyLDAsMCwwLDYzLjI4OCwzNS4yMDdaTTM5Ljc0OSwxNy4zNzNjMTIuNzM3LDAsMTIuNzM3LDkuOTUsMTIuNzM3LDE0LjE5MiwwLDMuMzE3LTIuODQ3LDUuMTA5LTUuNzI0LDYuOTQ3UzQyLDQxLjY3OSw0Miw0My41MTdhMi4yNDgsMi4yNDgsMCwwLDEtNC41LDBjMC00LjQzNywzLjg1MS02Ljg0Miw2Ljg0OC04Ljc4NCwxLjU0My0uOTcxLDMuNjQxLTIuMzE2LDMuNjQxLTMuMTY3LDAtNS41LS42MTQtOS43MTEtOC4yNDEtOS43MTEtOC4wMTcsMC04LjI0MSw2LjAzNS04LjI0MSw2LjcyM2EyLjI0OCwyLjI0OCwwLDAsMS00LjUsMEMyNy4wMTIsMjQuNzA4LDI5LjY3OSwxNy4zNzMsMzkuNzQ5LDE3LjM3M1ptLS43MjgsMzguNTc0QTIuNTQ3LDIuNTQ3LDAsMSwxLDQxLjU2OCw1My40LDIuNTQ3LDIuNTQ3LDAsMCwxLDM5LjAyMSw1NS45NDdaXCJcbiAgICAgICAgICAgIHRyYW5zZm9ybT1cInRyYW5zbGF0ZSgwKVwiXG4gICAgICAgICAgICBmaWxsPVwiIzIzNjJjN1wiXG4gICAgICAgICAgICBmaWxsUnVsZT1cImV2ZW5vZGRcIlxuICAgICAgICAgIC8+XG4gICAgICAgIDwvZz5cbiAgICAgIDwvZz5cbiAgICA8L3N2Zz5cbiAgKSxcbiAgdGV4dDogKFxuICAgIDxzdmdcbiAgICAgIHhtbG5zPVwiaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmdcIlxuICAgICAgeG1sbnNYbGluaz1cImh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmtcIlxuICAgICAgd2lkdGg9XCIxNDFcIlxuICAgICAgaGVpZ2h0PVwiMTQxXCJcbiAgICAgIHZpZXdCb3g9XCIwIDAgMTQxIDE0MVwiXG4gICAgPlxuICAgICAgPGRlZnM+XG4gICAgICAgIDxmaWx0ZXJcbiAgICAgICAgICBpZD1cIkVsbGlwc2VfNDk5XCJcbiAgICAgICAgICB4PVwiMFwiXG4gICAgICAgICAgeT1cIjBcIlxuICAgICAgICAgIHdpZHRoPVwiMTQxXCJcbiAgICAgICAgICBoZWlnaHQ9XCIxNDFcIlxuICAgICAgICAgIGZpbHRlclVuaXRzPVwidXNlclNwYWNlT25Vc2VcIlxuICAgICAgICA+XG4gICAgICAgICAgPGZlT2Zmc2V0IGR5PVwiM1wiIGlucHV0PVwiU291cmNlQWxwaGFcIiAvPlxuICAgICAgICAgIDxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249XCIzXCIgcmVzdWx0PVwiYmx1clwiIC8+XG4gICAgICAgICAgPGZlRmxvb2QgZmxvb2RPcGFjaXR5PVwiMC4xNjFcIiAvPlxuICAgICAgICAgIDxmZUNvbXBvc2l0ZSBvcGVyYXRvcj1cImluXCIgaW4yPVwiYmx1clwiIC8+XG4gICAgICAgICAgPGZlQ29tcG9zaXRlIGluPVwiU291cmNlR3JhcGhpY1wiIC8+XG4gICAgICAgIDwvZmlsdGVyPlxuICAgICAgPC9kZWZzPlxuICAgICAgPGdcbiAgICAgICAgaWQ9XCJHcm91cF8yNDk1XCJcbiAgICAgICAgZGF0YS1uYW1lPVwiR3JvdXAgMjQ5NVwiXG4gICAgICAgIHRyYW5zZm9ybT1cInRyYW5zbGF0ZSgtMTEwIC0xNDIpXCJcbiAgICAgID5cbiAgICAgICAgPGcgaWQ9XCJHcm91cF8yNDk3XCIgZGF0YS1uYW1lPVwiR3JvdXAgMjQ5N1wiPlxuICAgICAgICAgIDxnXG4gICAgICAgICAgICB0cmFuc2Zvcm09XCJtYXRyaXgoMSwgMCwgMCwgMSwgMTEwLCAxNDIpXCJcbiAgICAgICAgICAgIGZpbHRlcj1cInVybCgjRWxsaXBzZV80OTkpXCJcbiAgICAgICAgICA+XG4gICAgICAgICAgICA8Y2lyY2xlXG4gICAgICAgICAgICAgIGlkPVwiRWxsaXBzZV80OTktMlwiXG4gICAgICAgICAgICAgIGRhdGEtbmFtZT1cIkVsbGlwc2UgNDk5XCJcbiAgICAgICAgICAgICAgY3g9XCI2MS41XCJcbiAgICAgICAgICAgICAgY3k9XCI2MS41XCJcbiAgICAgICAgICAgICAgcj1cIjYxLjVcIlxuICAgICAgICAgICAgICB0cmFuc2Zvcm09XCJ0cmFuc2xhdGUoOSA2KVwiXG4gICAgICAgICAgICAgIGZpbGw9XCIjZmZmXCJcbiAgICAgICAgICAgIC8+XG4gICAgICAgICAgPC9nPlxuICAgICAgICAgIDxnIGlkPVwiR3JvdXBfMjQ5NlwiIGRhdGEtbmFtZT1cIkdyb3VwIDI0OTZcIj5cbiAgICAgICAgICAgIDxwYXRoXG4gICAgICAgICAgICAgIGlkPVwibm91bl9LZXlfNjc3MzQ1XzFfXCJcbiAgICAgICAgICAgICAgZGF0YS1uYW1lPVwibm91bl9LZXlfNjc3MzQ1ICgxKVwiXG4gICAgICAgICAgICAgIGQ9XCJNMzEuOTQ0LDQ1LjI4bDIuOTI4LDIuOTI4YTMuMzEzLDMuMzEzLDAsMCwwLDIuNDY1LDEuMDJINDAuOHYyLjkyOGEzLjk3NSwzLjk3NSwwLDAsMCwzLjk3NSwzLjk3NWgyLjkyOHYzLjQ1OGEzLjUsMy41LDAsMCwwLDEsMi40MzhsMi4zLDIuM2EzLjI0NiwzLjI0NiwwLDAsMCwyLjI5Mi45NDFoOS4xM2EyLjg1NiwyLjg1NiwwLDAsMCwyLjg0OS0yLjg0OWgwVjUzLjI5YTMuMjQsMy4yNCwwLDAsMC0uOTU0LTIuMzA2TDQ1LjI4LDMxLjk0NEEyMS43NjcsMjEuNzY3LDAsMSwwLDMxLjk0NCw0NS4yOFpNMTIuMTY3LDEyLjE1NEExNy43ODksMTcuNzg5LDAsMCwxLDQxLjEzMywzMS42NjVhMS45ODgsMS45ODgsMCwwLDAsLjQyNCwyLjE4TDYxLjI5NCw1My41ODh2Ny43MDVINTMuNTg4bC0xLjk0MS0xLjk0MVY1NC42NjhhMi41NTcsMi41NTcsMCwwLDAtMi41NTctMi41NTdINDQuNzc3di00LjNhMi41NTcsMi41NTcsMCwwLDAtMi41NTctMi41NTdIMzcuNTQybC0zLjctMy43YTEuOTg4LDEuOTg4LDAsMCwwLTIuMTgtLjQyNCwxNy43ODksMTcuNzg5LDAsMCwxLTE5LjUtMjguOTY2WlwiXG4gICAgICAgICAgICAgIHRyYW5zZm9ybT1cInRyYW5zbGF0ZSgxNDMuMDI2IDE3Ni4wMjYpXCJcbiAgICAgICAgICAgICAgZmlsbD1cIiMyMzYyYzdcIlxuICAgICAgICAgICAgLz5cbiAgICAgICAgICAgIDxnXG4gICAgICAgICAgICAgIGlkPVwiRWxsaXBzZV82OTBcIlxuICAgICAgICAgICAgICBkYXRhLW5hbWU9XCJFbGxpcHNlIDY5MFwiXG4gICAgICAgICAgICAgIHRyYW5zZm9ybT1cInRyYW5zbGF0ZSgxNTYgMTg5KVwiXG4gICAgICAgICAgICAgIGZpbGw9XCIjZmZmXCJcbiAgICAgICAgICAgICAgc3Ryb2tlPVwiIzIzNjJjN1wiXG4gICAgICAgICAgICAgIHN0cm9rZVdpZHRoPVwiNFwiXG4gICAgICAgICAgICA+XG4gICAgICAgICAgICAgIDxjaXJjbGUgY3g9XCI3LjVcIiBjeT1cIjcuNVwiIHI9XCI3LjVcIiBzdHJva2U9XCJub25lXCIgLz5cbiAgICAgICAgICAgICAgPGNpcmNsZSBjeD1cIjcuNVwiIGN5PVwiNy41XCIgcj1cIjUuNVwiIGZpbGw9XCJub25lXCIgLz5cbiAgICAgICAgICAgIDwvZz5cbiAgICAgICAgICA8L2c+XG4gICAgICAgIDwvZz5cbiAgICAgIDwvZz5cbiAgICA8L3N2Zz5cbiAgKSxcbiAgcGFsbTogKFxuICAgIDxzdmdcbiAgICAgIHhtbG5zPVwiaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmdcIlxuICAgICAgd2lkdGg9XCIxNDFcIlxuICAgICAgaGVpZ2h0PVwiMTQxXCJcbiAgICAgIHZpZXdCb3g9XCIwIDAgMTQxIDE0MVwiXG4gICAgPlxuICAgICAgPGRlZnM+XG4gICAgICAgIDxmaWx0ZXJcbiAgICAgICAgICBpZD1cIkVsbGlwc2VfNDk5XCJcbiAgICAgICAgICB4PVwiMFwiXG4gICAgICAgICAgeT1cIjBcIlxuICAgICAgICAgIHdpZHRoPVwiMTQxXCJcbiAgICAgICAgICBoZWlnaHQ9XCIxNDFcIlxuICAgICAgICAgIGZpbHRlclVuaXRzPVwidXNlclNwYWNlT25Vc2VcIlxuICAgICAgICA+XG4gICAgICAgICAgPGZlT2Zmc2V0IGR5PVwiM1wiIGlucHV0PVwiU291cmNlQWxwaGFcIiAvPlxuICAgICAgICAgIDxmZUdhdXNzaWFuQmx1ciBzdGREZXZpYXRpb249XCIzXCIgcmVzdWx0PVwiYmx1clwiIC8+XG4gICAgICAgICAgPGZlRmxvb2QgZmxvb2RPcGFjaXR5PVwiMC4xNjFcIiAvPlxuICAgICAgICAgIDxmZUNvbXBvc2l0ZSBvcGVyYXRvcj1cImluXCIgaW4yPVwiYmx1clwiIC8+XG4gICAgICAgICAgPGZlQ29tcG9zaXRlIGluPVwiU291cmNlR3JhcGhpY1wiIC8+XG4gICAgICAgIDwvZmlsdGVyPlxuICAgICAgPC9kZWZzPlxuICAgICAgPGdcbiAgICAgICAgaWQ9XCJHcm91cF8yNDQ3XCJcbiAgICAgICAgZGF0YS1uYW1lPVwiR3JvdXAgMjQ0N1wiXG4gICAgICAgIHRyYW5zZm9ybT1cInRyYW5zbGF0ZSgtMTEwIC0xNDIpXCJcbiAgICAgID5cbiAgICAgICAgPGcgdHJhbnNmb3JtPVwibWF0cml4KDEsIDAsIDAsIDEsIDExMCwgMTQyKVwiIGZpbHRlcj1cInVybCgjRWxsaXBzZV80OTkpXCI+XG4gICAgICAgICAgPGNpcmNsZVxuICAgICAgICAgICAgaWQ9XCJFbGxpcHNlXzQ5OS0yXCJcbiAgICAgICAgICAgIGRhdGEtbmFtZT1cIkVsbGlwc2UgNDk5XCJcbiAgICAgICAgICAgIGN4PVwiNjEuNVwiXG4gICAgICAgICAgICBjeT1cIjYxLjVcIlxuICAgICAgICAgICAgcj1cIjYxLjVcIlxuICAgICAgICAgICAgdHJhbnNmb3JtPVwidHJhbnNsYXRlKDkgNilcIlxuICAgICAgICAgICAgZmlsbD1cIiNmZmZcIlxuICAgICAgICAgIC8+XG4gICAgICAgIDwvZz5cbiAgICAgICAgPGcgaWQ9XCJub3VuX3BhbG1fMTY3MTk1NFwiIHRyYW5zZm9ybT1cInRyYW5zbGF0ZSgxMzYuNTE2IDE2OClcIj5cbiAgICAgICAgICA8cGF0aFxuICAgICAgICAgICAgaWQ9XCJQYXRoXzEzNjJcIlxuICAgICAgICAgICAgZGF0YS1uYW1lPVwiUGF0aCAxMzYyXCJcbiAgICAgICAgICAgIGQ9XCJNNDEuOTksNzcuMzg0aDIuNTk0YTI0LjU3OSwyNC41NzksMCwwLDAsMTcuMzA4LTcuMDE3QTIzLjU4NywyMy41ODcsMCwwLDAsNjkuMDgsNTMuMzgzaDBWMjIuNDM0YTYuNDg5LDYuNDg5LDAsMCwwLTkuNzg1LTUuNlYxNC4wNDVBNi40OTEsNi40OTEsMCwwLDAsNDguOTI2LDguODI5LDYuNTQ3LDYuNTQ3LDAsMCwwLDQ3LjYsNi45YTYuNSw2LjUsMCwwLDAtMTEuMDM5LDMuNzcyLDYuNDMzLDYuNDMzLDAsMCwwLTMuMzQxLS45MzUsNi41MTQsNi41MTQsMCwwLDAtNi41MDcsNi41MDdWMzAuMTlhNS4xNjIsNS4xNjIsMCwwLDAtMS4zODMtLjE3OEgyMS44NThhMy4yMTQsMy4yMTQsMCwwLDAtMy4yMTEsMy4yMTFWNTIuNTZDMTguNjQ2LDY2Ljk0NSwyOC40NjQsNzcuMzg0LDQxLjk5LDc3LjM4NFpNMjEuODU3LDMzLjIzSDI1LjMzYy43MzMsMCwuODcxLjEyNSwxLjcyOCwxLjFsLjA0OS4wNTZhMy4yLDMuMiwwLDAsMSwuOCwyLjEyOXY4LjYxOGE1LjExMSw1LjExMSwwLDAsMCwzLjczMyw0LjkyLDE0Ljc4MSwxNC43ODEsMCwwLDEsNi4zNzUsMy43MzUsMTUuMiwxNS4yLDAsMCwxLDQuMTc0LDguMTc0LDEuNjA5LDEuNjA5LDAsMCwwLDMuMTc0LS41MywxOC40NDcsMTguNDQ3LDAsMCwwLTUuMDc1LTkuOTIyLDE3Ljk2LDE3Ljk2LDAsMCwwLTcuNzQ0LTQuNTQ0LDEuOTE4LDEuOTE4LDAsMCwxLTEuNDE4LTEuODMyVjM2LjUxOWE2LjQ1Nyw2LjQ1NywwLDAsMC0xLjItMy43MzRWMTYuMjQ0YTMuMjgyLDMuMjgyLDAsMCwxLDUuNjExLTIuMzIsMy4yNTksMy4yNTksMCwwLDEsLjk2LDIuMzJzMCwwLDAsLjAwOFYzNi41NjNhMS42MDksMS42MDksMCwxLDAsMy4yMTcsMFYxMS41YTMuMjg0LDMuMjg0LDAsMSwxLDYuNTY4LDB2Mi41NDRhMS42MzcsMS42MzcsMCwwLDAsLjA0My4zNTd2MjIuMTZhMS42MDksMS42MDksMCwxLDAsMy4yMTcsMFYxMy42MjJhMy4yNzgsMy4yNzgsMCwwLDEsNi41My40MjNWMzguMTIyYTEuNjA5LDEuNjA5LDAsMSwwLDMuMjE3LDBWMjIuNDM0YTMuMjg4LDMuMjg4LDAsMCwxLDMuMjg0LTMuMjg0LDMuMjg3LDMuMjg3LDAsMCwxLDMuMjg0LDMuMjg0VjUzLjM4M2gwYTIwLjQsMjAuNCwwLDAsMS02LjIyMSwxNC42ODQsMjEuMzc5LDIxLjM3OSwwLDAsMS0xNS4wNTgsNi4xSDQxLjk5Yy0xMS42NjIsMC0yMC4xMjYtOS4wODctMjAuMTI2LTIxLjYwN1pcIlxuICAgICAgICAgICAgdHJhbnNmb3JtPVwidHJhbnNsYXRlKDAgMClcIlxuICAgICAgICAgICAgZmlsbD1cIiMyMzYyYzdcIlxuICAgICAgICAgICAgc3Ryb2tlPVwiIzIzNjJjN1wiXG4gICAgICAgICAgICBzdHJva2VXaWR0aD1cIjFcIlxuICAgICAgICAgIC8+XG4gICAgICAgIDwvZz5cbiAgICAgIDwvZz5cbiAgICA8L3N2Zz5cbiAgKSxcbn07XG4iXX0= | 134.427807 | 16,144 | 0.86964 |
75e1c28e2ffd386cbedb2e7d4d9d7154ff618763 | 280 | js | JavaScript | algorithms/Rotate Array/index.js | Chersquwn/leetcode | 1e1819936a347cfa464cb7faee00f3753c6d9ba7 | [
"MIT"
] | 1 | 2019-04-30T21:14:36.000Z | 2019-04-30T21:14:36.000Z | algorithms/Rotate Array/index.js | Chersquwn/leetcode | 1e1819936a347cfa464cb7faee00f3753c6d9ba7 | [
"MIT"
] | null | null | null | algorithms/Rotate Array/index.js | Chersquwn/leetcode | 1e1819936a347cfa464cb7faee00f3753c6d9ba7 | [
"MIT"
] | null | null | null | // problem https://leetcode.com/problems/rotate-array/
/**
* @param {number[]} nums
* @param {number} k
* @return {void} Do not return anything, modify nums in-place instead.
*/
const rotate = function (nums, k) {
[].unshift.apply(nums, nums.splice(nums.length - k, k))
};
| 25.454545 | 71 | 0.657143 |
75e256182cb84ce9563953794c3eeb1ef11438f9 | 720 | js | JavaScript | frontend/src/styles/typography.js | Elizabeth-Warren/pollaris | 153ca4297ceed1ac1685ca80c5890384800cfa8a | [
"MIT"
] | 78 | 2020-03-27T14:49:11.000Z | 2021-11-15T10:24:11.000Z | frontend/src/styles/typography.js | Elizabeth-Warren/pollaris | 153ca4297ceed1ac1685ca80c5890384800cfa8a | [
"MIT"
] | 10 | 2020-06-06T01:47:56.000Z | 2022-02-27T23:34:30.000Z | frontend/src/styles/typography.js | Elizabeth-Warren/pollaris | 153ca4297ceed1ac1685ca80c5890384800cfa8a | [
"MIT"
] | 14 | 2020-03-27T17:36:30.000Z | 2020-05-21T04:50:07.000Z | import { css } from 'styled-components'
export const link = linkColor => css`
${({ theme }) => theme.fonts.regularBookBold}
background: linear-gradient(to bottom, transparent 0%, transparent 65%, ${linkColor} 65%, ${linkColor} 100%);
color: inherit;
cursor: pointer;
&:hover {
background: none;
}
`
export const simpleLink = ({ fontSize = '14px' }) => css`
${({ theme }) => theme.fonts.regularBookBold};
font-size: ${fontSize};
line-height: 1.38;
transition: 0.5s;
display: inline-block;
cursor: pointer;
text-decoration: underline;
text-decoration-color: ${({ theme }) => theme.colors.liberty};
&:hover {
text-decoration-color: ${({ theme }) => theme.colors.bodyColor};
}
`
| 24.827586 | 111 | 0.643056 |
75e322d9d7135aaf9168f56f27d8bb00e346a3c6 | 2,213 | js | JavaScript | dist/js/script.min.js | vvlladimir/mbd | c8d15a9d5b3627515c58b86a2c2b35152b1cfaf0 | [
"MIT"
] | null | null | null | dist/js/script.min.js | vvlladimir/mbd | c8d15a9d5b3627515c58b86a2c2b35152b1cfaf0 | [
"MIT"
] | null | null | null | dist/js/script.min.js | vvlladimir/mbd | c8d15a9d5b3627515c58b86a2c2b35152b1cfaf0 | [
"MIT"
] | null | null | null | $(document).ready(function(){$("#logo").on("click",function(){location.reload()});var e={async:!0,crossDomain:!0,url:"https://api.themoviedb.org/3/movie/popular?api_key=9e93a8072a4001746ef7cd2093ad1e4a&language=en-US&page=1",method:"GET",headers:{},data:"{}"};$.ajax(e).done(function(e){$("#movies").click("click",function(a){a.stopPropagation(),$("#resultsMovies").slideToggle("fast",function(){$("#movies").toggleClass("active");for(var a=0,t=e.results.length/2;a<t;a++){var s="<ul>";s+='<li><a id="resultLink" href="https://api.themoviedb.org/3/movie/'+e.results[a].id+'?api_key=9e93a8072a4001746ef7cd2093ad1e4a&language=en-US" class="result-row"><img src="https://image.tmdb.org/t/p/w500'+e.results[a].poster_path+'?api_key=9e93a8072a4001746ef7cd2093ad1e4a&language=en-US" height="120px" /> '+e.results[a].title+"</a></li>",s+="</ul>",$("#resultsMovies").append(s)}})})});var a={async:!0,crossDomain:!0,url:"https://api.themoviedb.org/3/tv/popular?api_key=9e93a8072a4001746ef7cd2093ad1e4a&language=en-US&page=1",method:"GET",headers:{},data:"{}"};$.ajax(a).done(function(e){$("#tvShows").click("click",function(a){a.stopPropagation(),$("#resultsTvShows").slideToggle("fast",function(){$("#tvShows").toggleClass("active");for(var a=0,t=e.results.length/2;a<t;a++){var s="<ul>";s+='<li><a id="resultLink" href="https://api.themoviedb.org/3/tv/'+e.results[a].id+'?api_key=9e93a8072a4001746ef7cd2093ad1e4a&language=en-US" class="result-row"><img src="https://image.tmdb.org/t/p/w500'+e.results[a].poster_path+'?api_key=9e93a8072a4001746ef7cd2093ad1e4a&language=en-US" height="120px" /> '+e.results[a].name+"</a></li>",s+="</ul>",$("#resultsTvShows").append(s)}})})});var t={async:!0,crossDomain:!0,url:"https://api.themoviedb.org/3/search/multi?query=searchField&api_key=9e93a8072a4001746ef7cd2093ad1e4a",method:"GET",headers:{},data:"{}"};$.ajax(t).done(function(e){console.log(this),$("#searchMovie").keyup(function(){var a=$("#searchMovie").val(),t=new RegExp(a,"i");$.each(data,function(a,s){var o='<ul class="search-results">';if(-1!=e.results.name.search(t))for(var i=0,l=e.results.length/1;i<l;i++)o+="<li>",o+="<h2>"+e.results[i].name+"</h2>",o+="</li>"}),output+="</ul>",$("#results").html(output)})})}); | 2,213 | 2,213 | 0.691369 |
75e38297d70329f0ccbf3d11426fed5d43d68df9 | 155 | js | JavaScript | lib/phrases.js | tekken-london/dinobot | 9573a9dc476bb6d816de8eed31de8cab81e8129a | [
"MIT"
] | 2 | 2017-07-17T21:02:26.000Z | 2021-03-25T19:18:01.000Z | lib/phrases.js | harounb/dinobot | 9573a9dc476bb6d816de8eed31de8cab81e8129a | [
"MIT"
] | 2 | 2016-09-30T19:48:57.000Z | 2016-10-01T14:20:47.000Z | lib/phrases.js | harounb/dinobot | 9573a9dc476bb6d816de8eed31de8cab81e8129a | [
"MIT"
] | null | null | null | module.exports = [
'I respect it',
'What are you DOING!',
'Why would you do that?',
'Por qué?',
'You know I won that round, yeah?',
'Bad!',
];
| 17.222222 | 37 | 0.567742 |
75e44198ff74c4a660e11f7f39dd6f39ecbce4a8 | 207 | js | JavaScript | src/util/collectify.js | bingenperez/nba | b77b005f7efabdfd8c30d5219e567ec3c9d52f67 | [
"MIT"
] | 453 | 2017-04-14T15:37:21.000Z | 2022-01-18T01:26:47.000Z | src/util/collectify.js | bingenperez/nba | b77b005f7efabdfd8c30d5219e567ec3c9d52f67 | [
"MIT"
] | 57 | 2017-04-17T22:15:33.000Z | 2021-07-26T21:45:51.000Z | src/util/collectify.js | bingenperez/nba | b77b005f7efabdfd8c30d5219e567ec3c9d52f67 | [
"MIT"
] | 160 | 2017-04-26T07:49:03.000Z | 2022-02-12T17:37:11.000Z | module.exports = function collectify (headers, rows) {
return rows.map(function (row) {
return row.reduce(function (cell, val, i) {
cell[headers[i]] = val;
return cell;
}, {});
});
}; | 25.875 | 54 | 0.589372 |
75e489961e8c876b298b2fa18383d12309589c1a | 599 | js | JavaScript | utils/storage.js | zhuyuemings/promets-miniapp | cec4dcdfcbc1aff4b1a5ffebb8aefdcf22b4fbb2 | [
"Apache-2.0"
] | 1 | 2019-05-31T08:26:10.000Z | 2019-05-31T08:26:10.000Z | utils/storage.js | zhuyuemings/promets-miniapp | cec4dcdfcbc1aff4b1a5ffebb8aefdcf22b4fbb2 | [
"Apache-2.0"
] | null | null | null | utils/storage.js | zhuyuemings/promets-miniapp | cec4dcdfcbc1aff4b1a5ffebb8aefdcf22b4fbb2 | [
"Apache-2.0"
] | null | null | null | // storage.js
import { api } from '../api/api'
import { wxPostRequest } from './promise'
const KEY_USER_INFO = 'KEY_USER_INFO';
export function wxSetStorage(key, value) {
return new Promise((resolve, reject) => {
try {
wx.setStorageSync(key, value)
resolve(value);
} catch (e) {
reject(e);
}
});
}
export function wxGetStorage(key) {
return new Promise((resolve, reject) => {
try {
resolve(wx.getStorageSync(key));
} catch (e) {
reject(e);
}
});
} | 23.038462 | 46 | 0.507513 |
75e4a2fd9158c9df2d2af269a01677e8e1e9bc49 | 273 | js | JavaScript | src/form/is-touched.js | eliseev-eag/react-redux-form | 5ed5aced3b030699165ab89eb8aaae64a38d23e1 | [
"MIT"
] | 2,329 | 2016-01-26T15:20:38.000Z | 2022-03-22T02:07:17.000Z | src/form/is-touched.js | eliseev-eag/react-redux-form | 5ed5aced3b030699165ab89eb8aaae64a38d23e1 | [
"MIT"
] | 1,034 | 2016-01-26T15:09:30.000Z | 2022-03-12T22:15:54.000Z | src/form/is-touched.js | davidkpiano/redux-simple-form | 0fd07c6212f746bdf078d50a95c51051d1fd0752 | [
"MIT"
] | 380 | 2016-01-27T14:03:31.000Z | 2022-02-10T07:03:43.000Z | export default function isTouched(formState) {
if (!formState) return false;
// Field is touched
if (!formState.$form) {
return formState.touched;
}
// Any field in form is touched
return Object.keys(formState).some((key) => isTouched(formState[key]));
}
| 22.75 | 73 | 0.688645 |
75e51869e0ab30654f84cdcc9a19e5e405539ebe | 785 | js | JavaScript | lib/electron-server.js | simov/electron-socket | eb19a050537a61fce2b705e6f0a4119539aa8a89 | [
"Apache-2.0"
] | 1 | 2018-01-29T19:45:48.000Z | 2018-01-29T19:45:48.000Z | lib/electron-server.js | simov/electron-socket | eb19a050537a61fce2b705e6f0a4119539aa8a89 | [
"Apache-2.0"
] | null | null | null | lib/electron-server.js | simov/electron-socket | eb19a050537a61fce2b705e6f0a4119539aa8a89 | [
"Apache-2.0"
] | null | null | null |
var engine = require('engine.io')
var ipcMain = require('electron').ipcMain
module.exports = (win) => {
var server = engine.listen(process.env.EL_PORT)
var socket
server.on('connection', (sock) => {
socket = sock // currently supports only a single connection
socket.on('message', (data) => {
var req = JSON.parse(data)
console.log('el-server', req)
win.webContents.send('message', req)
})
})
ipcMain.on('message', (event, req) => {
if (req.message === 'connect') {
// confirm that the server is ready
console.log('electron-server-ready', process.env.EL_PORT, '!')
}
else if (req.message === 'disconnect') {
win.close()
server.close()
}
else {
socket.send(JSON.stringify(req))
}
})
}
| 23.787879 | 68 | 0.594904 |
75e55276b972843f84351bf9306f76c9321dbc4d | 229 | js | JavaScript | src/pages/404.js | driewe/gatsby-tutorial | 58e4fbe8c31010f855b7a9b891e532e6a81bc27a | [
"MIT"
] | null | null | null | src/pages/404.js | driewe/gatsby-tutorial | 58e4fbe8c31010f855b7a9b891e532e6a81bc27a | [
"MIT"
] | null | null | null | src/pages/404.js | driewe/gatsby-tutorial | 58e4fbe8c31010f855b7a9b891e532e6a81bc27a | [
"MIT"
] | null | null | null | import React from 'react'
import Layout from '../components/Layout'
const error = () => {
return (
<Layout>
<h1>Oops! You hit a page that doesn't exist</h1>
</Layout>
)
}
export default error
| 19.083333 | 60 | 0.576419 |
75e739c4876c9d782fae65a0fff4a5bc7ac193e0 | 449 | js | JavaScript | src/runners/node/launch/validate.js | ehmicky/spyd | 8c26062b5a1082b2618ce910fe8b29fcb6b02146 | [
"Apache-2.0"
] | 4 | 2019-08-12T14:45:48.000Z | 2021-01-19T18:24:02.000Z | src/runners/node/launch/validate.js | ehmicky/spyd | 8c26062b5a1082b2618ce910fe8b29fcb6b02146 | [
"Apache-2.0"
] | 1 | 2020-08-08T16:39:47.000Z | 2020-08-08T16:39:47.000Z | src/runners/node/launch/validate.js | ehmicky/spyd | 8c26062b5a1082b2618ce910fe8b29fcb6b02146 | [
"Apache-2.0"
] | null | null | null | import { multipleValidOptions } from 'jest-validate'
import { validateConfigProps } from '../../../utils/validate.js'
// Validate runnerConfig
export const validateConfig = function (runnerConfig) {
validateConfigProps(runnerConfig, { exampleConfig: EXAMPLE_CONFIG })
}
const EXAMPLE_CONFIG = {
tasks: multipleValidOptions('tasks.js', ['tasks.js']),
// eslint-disable-next-line no-magic-numbers
version: multipleValidOptions('12', 12),
}
| 29.933333 | 70 | 0.741648 |
75e742cc061543edb5e62a1851f71541054c6b08 | 108 | js | JavaScript | _/code-snippets/lesson6/6_16.js | paullewallencom/javascript-978-1-7898-0010-4 | 769d9fda3364b99ff3b43856cf5477330d3e288f | [
"Apache-2.0"
] | 20 | 2019-02-18T04:35:04.000Z | 2021-12-16T14:20:52.000Z | _/code-snippets/lesson6/6_16.js | paullewallencom/javascript-978-1-7898-0010-4 | 769d9fda3364b99ff3b43856cf5477330d3e288f | [
"Apache-2.0"
] | null | null | null | _/code-snippets/lesson6/6_16.js | paullewallencom/javascript-978-1-7898-0010-4 | 769d9fda3364b99ff3b43856cf5477330d3e288f | [
"Apache-2.0"
] | 20 | 2019-04-09T17:15:49.000Z | 2022-03-13T01:17:52.000Z | app.get( '/', ( req, res, next ) => next() );
app.get( '/', ( req, res ) => res.end( 'Second handler!' ) );
| 36 | 61 | 0.472222 |
75e9804dde703267574c34c895a0251830791eaa | 237 | js | JavaScript | docs/cocos2d-iphone-mac/html/interface_c_c_flip_x3_d.js | MakeSchool/Kobold2D | 487401773bbbf3604f62b247afeac0c1d6e5f38b | [
"MIT"
] | null | null | null | docs/cocos2d-iphone-mac/html/interface_c_c_flip_x3_d.js | MakeSchool/Kobold2D | 487401773bbbf3604f62b247afeac0c1d6e5f38b | [
"MIT"
] | null | null | null | docs/cocos2d-iphone-mac/html/interface_c_c_flip_x3_d.js | MakeSchool/Kobold2D | 487401773bbbf3604f62b247afeac0c1d6e5f38b | [
"MIT"
] | 2 | 2021-07-21T23:16:05.000Z | 2021-07-29T00:55:14.000Z | var interface_c_c_flip_x3_d =
[
[ "actionWithDuration:", "interface_c_c_flip_x3_d.html#a61912e0504905ba58097d732977c416f", null ],
[ "initWithDuration:", "interface_c_c_flip_x3_d.html#a95b1926ed0a5624adcddab23394ad443", null ]
]; | 47.4 | 102 | 0.793249 |
75ea188e104d346a0438375bd4accc1b3b492739 | 643 | js | JavaScript | src/005/server.js | Yogendra0Sharma/KoaJSWorkshop | a6e213ba1c047ad84fb44490fa7c88ac535f01f5 | [
"Apache-2.0"
] | null | null | null | src/005/server.js | Yogendra0Sharma/KoaJSWorkshop | a6e213ba1c047ad84fb44490fa7c88ac535f01f5 | [
"Apache-2.0"
] | 5 | 2021-03-02T00:36:15.000Z | 2022-03-08T22:58:12.000Z | src/005/server.js | Yogendra0Sharma/KoaJSWorkshop | a6e213ba1c047ad84fb44490fa7c88ac535f01f5 | [
"Apache-2.0"
] | null | null | null | const Koa = require('koa');
// import koa-router
const Router = require('koa-router');
// import koa-parser
const bodyParser = require('koa-parser');
// import lodash
const _ = require('lodash');
const app = new Koa();
const router = require('./routers');
// register bodyParser to application for POST request
app.use(bodyParser());
const PORT = 4000;
// sync models
const db = require('./models');
db.sequelize.sync()
.then(()=>{
console.log("DB sync");
})
app.context.db = db;
// register routes middleware to app
app.use(router.routes());
app.listen(PORT,function(){
console.log(`Server is running on ${PORT}`);
});
| 22.964286 | 54 | 0.66563 |
75ea194b489ab6f19bcefaa5cb9d01e78c3c2c64 | 125 | js | JavaScript | tests/format/js/assignment/chain-two-segments.js | tumido/prettier | 3616182508ebb45aa857c3e1751735181a32728c | [
"MIT"
] | 40,139 | 2017-02-20T22:01:11.000Z | 2022-03-31T19:56:19.000Z | tests/format/js/assignment/chain-two-segments.js | tumido/prettier | 3616182508ebb45aa857c3e1751735181a32728c | [
"MIT"
] | 9,185 | 2017-02-20T22:02:24.000Z | 2022-03-31T20:45:07.000Z | tests/format/js/assignment/chain-two-segments.js | tumido/prettier | 3616182508ebb45aa857c3e1751735181a32728c | [
"MIT"
] | 4,365 | 2017-02-21T16:30:33.000Z | 2022-03-31T02:49:26.000Z | tt.parenR.updateContext = tt.braceR.updateContext = function () {
if (this.state.context.length === 1) {
return;
}
}
| 20.833333 | 65 | 0.648 |
75eabdaaf55772508b1be3c335c5f2884442c5b6 | 1,465 | js | JavaScript | benchmark/single-benchmark.js | ronami/carmi | 46ed8e46993aaf2a3f1cb75531dd0eed2fed1d9d | [
"MIT"
] | 53 | 2018-05-15T13:25:52.000Z | 2022-03-31T10:19:53.000Z | benchmark/single-benchmark.js | ronami/carmi | 46ed8e46993aaf2a3f1cb75531dd0eed2fed1d9d | [
"MIT"
] | 61 | 2018-07-03T09:18:52.000Z | 2021-09-01T01:43:48.000Z | benchmark/single-benchmark.js | ronami/carmi | 46ed8e46993aaf2a3f1cb75531dd0eed2fed1d9d | [
"MIT"
] | 18 | 2018-10-17T19:46:29.000Z | 2021-07-12T06:50:10.000Z | const args = process.argv.slice(2);
// const args = 'todos ./generated/todos.carmi 50000 5000 10'.split(' ');
const objectHash = require('object-hash');
const test = require(`./${args[0]}`);
const countItems = parseInt(args[2], 10);
const countChanges = parseInt(args[3], 10);
const batchSize = parseInt(args[4], 10);
const shouldProfile = args[5] === 'true';
const initialState = test.getInitialState(countItems);
const modelFunc = require(args[1]);
const cpuUsageAfterInitialState = process.cpuUsage();
console.log(`${args[0]} - ${args[1]}: items:${countItems} ops:${countChanges} inBatches:${batchSize}`);
if (shouldProfile) {
console.profile('run');
}
const inst = modelFunc(initialState);
if (batchSize > 1) {
for (let batchCount = 0; batchCount < countChanges / batchSize; batchCount++) {
inst.$runInBatch(() => {
test.benchmark(inst, batchCount * batchSize, Math.min(countChanges, batchCount + 1 * batchSize));
});
}
} else {
test.benchmark(inst, 0, countChanges);
}
if (shouldProfile) {
console.profileEnd('run');
}
const cpuUsage = process.cpuUsage(cpuUsageAfterInitialState);
const instValues = Object.keys(inst).reduce((acc, key) => {
if (typeof inst[key] !== 'function' && key[0] !== '$') {
acc[key] = inst[key];
}
return acc;
}, {});
const hash = objectHash(instValues);
const msg = process.send ? process.send.bind(process) : console.log.bind(console);
msg(Object.assign({hash}, cpuUsage, process.memoryUsage()));
| 34.880952 | 103 | 0.682594 |
75ee8de20772e6773e279bc8aedf58e640f6e372 | 903 | js | JavaScript | DOM Manipulatons/05. Encode-and-Decode-Messages/app.js | TsvetomirN1/JS-Advanced | 4a6c4a41ec432e82fe4782d9736b9f1c3c7edb48 | [
"Apache-2.0"
] | 2 | 2020-06-14T21:39:03.000Z | 2020-06-17T04:07:13.000Z | DOM Manipulatons/05. Encode-and-Decode-Messages/app.js | TsvetomirN1/JS-Advanced | 4a6c4a41ec432e82fe4782d9736b9f1c3c7edb48 | [
"Apache-2.0"
] | null | null | null | DOM Manipulatons/05. Encode-and-Decode-Messages/app.js | TsvetomirN1/JS-Advanced | 4a6c4a41ec432e82fe4782d9736b9f1c3c7edb48 | [
"Apache-2.0"
] | null | null | null | function encodeAndDecodeMessages() {
const buttons = document.getElementsByTagName('button');
const messages = document.getElementsByTagName('textarea');
buttons[0].addEventListener('click', encodeMessages);
buttons[1].addEventListener('click', decodeMessages);
function encodeMessages() {
const text = messages[0].value;
let encoded = '';
for (let i = 0; i < text.length; i++) {
encoded += String.fromCharCode(ascii(text[i]) + 1)
}
messages[0].value = '';
messages[1].value = encoded
}
function decodeMessages() {
const text = messages[1].value;
let decoded = '';
for (let i = 0; i < text.length; i++) {
decoded += String.fromCharCode(ascii(text[i]) - 1);
}
messages[1].value = decoded;
}
function ascii(c) {
return c.charCodeAt(0);
}
} | 28.21875 | 63 | 0.578073 |
75eefd5e34399d4e94c02ad330a8e430866fafc5 | 52 | js | JavaScript | ui/app/components/loading-screen/index.js | TrejGun/BitWallet | e3e5ee7171557481d589394d37bdf56a30a236b2 | [
"MIT"
] | null | null | null | ui/app/components/loading-screen/index.js | TrejGun/BitWallet | e3e5ee7171557481d589394d37bdf56a30a236b2 | [
"MIT"
] | null | null | null | ui/app/components/loading-screen/index.js | TrejGun/BitWallet | e3e5ee7171557481d589394d37bdf56a30a236b2 | [
"MIT"
] | 1 | 2019-12-01T11:47:49.000Z | 2019-12-01T11:47:49.000Z | export {default} from "./loading-screen.component";
| 26 | 51 | 0.75 |
75ef0ba749d81b9559f3427347fcef8e66bc5b03 | 10,975 | js | JavaScript | portfolio/src/main/webapp/script.js | kcirerick/stepsetup | 3e3d9836e6498c5c56b7ddf70d15f6d644df223f | [
"Apache-2.0"
] | null | null | null | portfolio/src/main/webapp/script.js | kcirerick/stepsetup | 3e3d9836e6498c5c56b7ddf70d15f6d644df223f | [
"Apache-2.0"
] | 5 | 2020-07-07T23:29:31.000Z | 2020-07-16T20:34:31.000Z | portfolio/src/main/webapp/script.js | kcirerick/stepsetup | 3e3d9836e6498c5c56b7ddf70d15f6d644df223f | [
"Apache-2.0"
] | null | null | null | // Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/** Adds a random greeting to the page. */
function addRandomQuote() {
const quotes=
['Life happens wherever you are, whether you make it or not.', 'Pride is not the opposite of shame, but its source.',
'In the darkness, hope is something you give yourself.', 'If you keep moving you will come to a better place.',
'You must actively shape your own destiny and the destiny of the world.', 'We can\'t concern ourselves with what was. We must act on what is.',
'Anyone is capable of great good and great evil.',
'you must look within yourself to save yourself from your other self, only then will you find your true self reveal itself'];
const buttonText = ['Give me more wisdom', 'MORE!!', 'Enlighten me again!', 'Teach me your ways.', 'Another one!', 'I like that, tell me another.'];
// Pick a random greeting.
let quote = quotes[Math.floor(Math.random() * quotes.length)];
//Pick random button text.
let genButton = buttonText[Math.floor(Math.random() * buttonText.length)];
// Retrieve current quote.
currQuote = document.getElementById('quote-container').innerText;
currButton= document.getElementById('genquote').innerText;
// Pick a random greeting until we get a new quote.
while(currQuote === quote) {
quote = quotes[Math.floor(Math.random() * quotes.length)];
}
//Pick random button text until we get a new message.
while(currButton === genButton) {
genButton = buttonText[Math.floor(Math.random() * buttonText.length)];
}
//Add new quote and button text to page.
document.getElementById('quote-container').innerText = quote;
document.getElementById('genquote').innerText = genButton;
}
/** Create hover effect on given elements. */
function filterOn(element) {
element.style.filter = "grayscale(100%)";
}
function filterOff(element) {
element.style.filter = "grayscale(0%)";
}
function largerFont(element) {
element.style.fontSize = "130%";
}
function normalFont(element) {
element.style.fontSize = "100%";
}
/** Slideshow. */
var slideIndex = 1;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
/** Displays slideshow by setting specified dot and picture as active
* and all others as inactive. */
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
/** Initializes webpage with updates comments, login status, and map features. */
function updatePage() {
updateComments();
fetchLogin();
initMap();
}
/** Copies specified number of user-created comments onto site from datastore. */
function updateComments(maxComments = 5) {
// Reset comments
var commentDiv = document.getElementById("comment-container");
commentDiv.innerHTML='';
//Write comments to commentDiv
fetch('/data').then(response => response.json()).then((strResponse) => {
if(strResponse.length < maxComments) {maxComments = strResponse.length}
for(i = 0; i < maxComments; i++) {
commentDiv.innerHTML += strResponse[i];
}
});
}
/** Update number of comments visible on the page */
function updateCommentNum() {
updateComments(document.getElementById("numComments").value);
}
/** Creates an <p> element containing text. */
function createPElement(text) {
const pElement = document.createElement('p');
pElement.innerText = text;
return pElement;
}
/** Deletes comments from datastore and refreshes page. */
function deleteComments() {
fetch('/delete-data');
}
/** Fetches login information and updates html within the
* loginPrompt div to reflect the login status. */
function fetchLogin() {
var commentBox = document.getElementById('commentBox');
var loginPrompt = document.getElementById('loginPrompt');
loginPrompt.innerHTML = "";
fetch('/login').then(response => response.json()).then((loginStatus) => {
if(loginStatus[0] == "True") {
commentBox.style.display = "block";
} else {
commentBox.style.display = "none";
}
for(i = 1; i < loginStatus.length; i++) {
loginPrompt.innerHTML += loginStatus[i];
}
});
}
/** Initializes Map API. */
function initMap() {
var worldCenter = {lat: 40.52, lng: 34.34};
// Initialize map.
var map = new google.maps.Map(document.getElementById("map"), {
center: worldCenter,
zoom: 3,
styles: [
{ "elementType": "geometry",
"stylers": [{"color": "#ebe3cd"}]
},
{ "elementType": "labels.text.fill",
"stylers": [{"color": "#523735"}]
},
{ "elementType": "labels.text.stroke",
"stylers": [{"color": "#f5f1e6"}]
},
{
"featureType": "administrative",
"elementType": "geometry.stroke",
"stylers": [{"color": "#c9b2a6"}]
},
{
"featureType": "administrative.land_parcel",
"elementType": "geometry.stroke",
"stylers": [{"color": "#dcd2be"}]
},
{
"featureType": "administrative.land_parcel",
"elementType": "labels.text.fill",
"stylers": [{"color": "#ae9e90"}]
},
{
"featureType": "landscape.natural",
"elementType": "geometry",
"stylers": [{"color": "#dfd2ae"}]
},
{
"featureType": "poi",
"elementType": "geometry",
"stylers": [{"color": "#dfd2ae"}]
},
{
"featureType": "poi",
"elementType": "labels.text",
"stylers": [{"visibility": "off"}]
},
{
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [{"color": "#93817c"}]
},
{
"featureType": "poi.business",
"stylers": [{"visibility": "off"}]
},
{
"featureType": "poi.park",
"elementType": "geometry.fill",
"stylers": [{"color": "#a5b076"}]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
"stylers": [{"color": "#447530"}]
},
{
"featureType": "road",
"elementType": "geometry",
"stylers": [{"color": "#f5f1e6"}]
},
{
"featureType": "road",
"elementType": "labels.icon",
"stylers": [{"visibility": "off"}]
},
{
"featureType": "road.arterial",
"stylers": [{"visibility": "off"}]
},
{
"featureType": "road.arterial",
"elementType": "geometry",
"stylers": [{"color": "#fdfcf8"}]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [{"color": "#f8c967"}]
},
{
"featureType": "road.highway",
"elementType": "geometry.stroke",
"stylers": [{"color": "#e9bc62"}]
},
{
"featureType": "road.highway",
"elementType": "labels",
"stylers": [{"visibility": "off"}]
},
{
"featureType": "road.highway.controlled_access",
"elementType": "geometry",
"stylers": [{"color": "#e98d58"}]
},
{
"featureType": "road.highway.controlled_access",
"elementType": "geometry.stroke",
"stylers": [{"color": "#db8555"}]
},
{
"featureType": "road.local",
"stylers": [{"visibility": "off"}]
},
{
"featureType": "road.local",
"elementType": "labels.text.fill",
"stylers": [{"color": "#806b63"}]
},
{
"featureType": "transit",
"stylers": [{"visibility": "off"}]
},
{
"featureType": "transit.line",
"elementType": "geometry",
"stylers": [{"color": "#dfd2ae"}]
},
{
"featureType": "transit.line",
"elementType": "labels.text.fill",
"stylers": [{"color": "#8f7d77"}]
},
{
"featureType": "transit.line",
"elementType": "labels.text.stroke",
"stylers": [{"color": "#ebe3cd"}]
},
{
"featureType": "transit.station",
"elementType": "geometry",
"stylers": [{"color": "#dfd2ae"}]
},
{
"featureType": "water",
"elementType": "geometry.fill",
"stylers": [{"color": "#b9d3c2"}]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [{"color": "#92998d"}]
}
]
});
initMarkers(map);
}
/** Initializes markers on map. */
function initMarkers(map) {
var locData = initLocData();
// Initialize a marker for each location.
locData.forEach((currLocation) => {
let coord = {lat: currLocation.lat, lng: currLocation.lng};
let marker = new google.maps.Marker({
position: coord,
map: map,
animation: google.maps.Animation.DROP
});
// Add event listeners to markers.
marker.addListener('mouseover', () => toggleBounce(marker));
marker.addListener('mouseout', () => toggleBounce(marker));
marker.addListener('click', function() {location.href = currLocation.link});
});
}
/** Toggles BOUNCE animation for markers on mouse event. */
function toggleBounce(marker) {
if (marker.getAnimation() !== null) {
marker.setAnimation(null);
} else {
marker.setAnimation(google.maps.Animation.BOUNCE);
}
}
// Initialize location coordinates and links.
function initLocData() {
var locationCoordinates = [
{lat: 20.5937, lng: 78.9629, link: "https://indianaid.carrd.co"}, // India
{lat: 15.5527, lng: 48.5164, link: "https://yemencrisis.carrd.co"}, // Yemen
{lat: 12.8797, lng: 121.7740, link: "https://junkterrorbill.carrd.co"}, // Philippines
{lat: 22.3193, lng: 114.1694, link: "https://standwithhongkong.carrd.co"}, // Hong Kong
{lat: 31.9522, lng: 35.2332, link: "https://helppalestine.carrd.co"}, // Palestine
{lat: 44.9778, lng: -93.2650, link: "https://blacklivesmatter.carrd.co"} // Minneapolis
];
return locationCoordinates;
}
| 30.828652 | 150 | 0.596993 |
75ef33d6f27f74de247c27737d5cecc97ec0d77f | 7,430 | js | JavaScript | tests/unit/mergeCombinedSchemas/mergeCombinedSchemas.test.js | randograms/schema-to-data | 10d1af15c403fa05e17f6faeeeff1e889affd0de | [
"MIT"
] | null | null | null | tests/unit/mergeCombinedSchemas/mergeCombinedSchemas.test.js | randograms/schema-to-data | 10d1af15c403fa05e17f6faeeeff1e889affd0de | [
"MIT"
] | 3 | 2020-08-09T23:07:20.000Z | 2022-02-09T03:31:11.000Z | tests/unit/mergeCombinedSchemas/mergeCombinedSchemas.test.js | randograms/schema-to-data | 10d1af15c403fa05e17f6faeeeff1e889affd0de | [
"MIT"
] | null | null | null | const _ = require('lodash');
const { defaultMocker } = require('../../../lib/mocker');
/**
* Note: object schema keywords are used in this test because the library supports several of these keywords.
* The merge rules for all of the keywords are thoroughly tested in another file
*/
describe('mergeCombinedSchemas/mergeCombinedSchemas', function () {
context('when the schema has an "allOf"', function () {
before(function () {
this.singleTypedSchema = {
type: 'object',
minProperties: 1,
maxProperties: 10,
required: ['a'],
allOf: [
{
type: 'object',
minProperties: 2,
required: ['b'],
allOf: null,
anyOf: null,
oneOf: null,
},
{
type: 'object',
maxProperties: 9,
required: ['c'],
allOf: null,
anyOf: null,
oneOf: null,
},
],
anyOf: null,
oneOf: null,
};
this.result = testUnit(defaultMocker, 'mergeCombinedSchemas', this.singleTypedSchema);
});
it('does not modify the original schema', function () {
expect(this.result).to.not.equal(this.singleTypedSchema);
});
it('merges the combined schemas into the root schema', function () {
expect(this.result).to.eql({
type: 'object',
minProperties: 2,
maxProperties: 9,
required: ['a', 'b', 'c'],
});
});
});
context('when the schema has an "anyOf"', function () {
before(function () {
this.singleTypedSchema = {
type: 'object',
allOf: null,
anyOf: [
{
type: 'object',
required: ['a'],
allOf: null,
anyOf: null,
oneOf: null,
},
{
type: 'object',
required: ['b'],
allOf: null,
anyOf: null,
oneOf: null,
},
],
oneOf: null,
};
this.results = _.times(30, () => testUnit(defaultMocker, 'mergeCombinedSchemas', this.singleTypedSchema));
});
it('always merges at least one relevant subschema', function () {
expect(this.results).to.all.satisfy((schema) => _.isArray(schema.required) && schema.required.length > 0);
});
it('sometimes merges a single subschema', function () {
expect(this.results).to.include.something.that.eqls({
type: 'object',
required: ['a'],
});
});
it('sometimes merges a different single subschema', function () {
expect(this.results).to.include.something.that.eqls({
type: 'object',
required: ['b'],
});
});
it('sometimes merges all relevant subschemas', function () {
expect(this.results).to.include.something.that.eqls({
type: 'object',
required: ['a', 'b'],
});
});
});
context('when the schema has a "oneOf"', function () {
before(function () {
this.singleTypedSchema = {
type: 'object',
allOf: null,
anyOf: null,
oneOf: [
{
type: 'object',
required: ['a'],
allOf: null,
anyOf: null,
oneOf: null,
},
{
type: 'object',
required: ['b'],
allOf: null,
anyOf: null,
oneOf: null,
},
],
};
this.results = _.times(20, () => testUnit(defaultMocker, 'mergeCombinedSchemas', this.singleTypedSchema));
});
it('always merges one compatible subschema', function () {
expect(this.results).to.all.satisfy((mergedSchema) => (
_.isArray(mergedSchema.required) && mergedSchema.required.length === 1
));
});
it('sometimes merges the first compatible subschema', function () {
expect(this.results).to.include.something.that.eqls({
type: 'object',
required: ['a'],
});
});
it('sometimes merges the second compatible subschema', function () {
expect(this.results).to.include.something.that.eqls({
type: 'object',
required: ['b'],
});
});
});
context('when the schema has an "allOf", "anyOf" and "oneOf"', function () {
before(function () {
const singleTypedSchema = {
type: 'object',
required: ['a'],
allOf: [{
type: 'object',
required: ['b'],
allOf: null,
anyOf: null,
oneOf: null,
}],
anyOf: [{
type: 'object',
required: ['c'],
allOf: null,
anyOf: null,
oneOf: null,
}],
oneOf: [{
type: 'object',
required: ['d'],
allOf: null,
anyOf: null,
oneOf: null,
}],
};
this.result = testUnit(defaultMocker, 'mergeCombinedSchemas', singleTypedSchema);
});
it('merges all nested combined schemas', function () {
expect(this.result).to.eql({
type: 'object',
required: ['a', 'b', 'c', 'd'],
});
});
});
context('when the schema has multiple nested combined schemas', function () {
before(function () {
const singleTypedSchema = {
type: 'object',
required: ['a'],
allOf: [{
type: 'object',
required: ['b'],
allOf: [{
type: 'object',
required: ['c'],
allOf: null,
anyOf: null,
oneOf: null,
}],
anyOf: [{
type: 'object',
required: ['d'],
allOf: null,
anyOf: null,
oneOf: null,
}],
oneOf: [{
type: 'object',
required: ['e'],
allOf: null,
anyOf: null,
oneOf: null,
}],
}],
anyOf: [{
type: 'object',
required: ['f'],
allOf: [{
type: 'object',
required: ['g'],
allOf: null,
anyOf: null,
oneOf: null,
}],
anyOf: [{
type: 'object',
required: ['h'],
allOf: null,
anyOf: null,
oneOf: null,
}],
oneOf: [{
type: 'object',
required: ['i'],
allOf: null,
anyOf: null,
oneOf: null,
}],
}],
oneOf: [{
type: 'object',
required: ['j'],
allOf: [{
type: 'object',
required: ['k'],
allOf: null,
anyOf: null,
oneOf: null,
}],
anyOf: [{
type: 'object',
required: ['l'],
allOf: null,
anyOf: null,
oneOf: null,
}],
oneOf: [{
type: 'object',
required: ['m'],
allOf: null,
anyOf: null,
oneOf: null,
}],
}],
};
this.result = testUnit(defaultMocker, 'mergeCombinedSchemas', singleTypedSchema);
});
it('merges all nested combined schemas', function () {
expect(this.result).to.eql({
type: 'object',
required: ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'],
});
});
});
});
| 25.888502 | 112 | 0.457335 |
75f03e3d74b78b4b3bd26bd810d2b38f17660b58 | 312 | js | JavaScript | opt.js | CodeDotJS/dep-graph | 8b494aea6de83993820ba26f5ca620eb588f5630 | [
"MIT"
] | null | null | null | opt.js | CodeDotJS/dep-graph | 8b494aea6de83993820ba26f5ca620eb588f5630 | [
"MIT"
] | null | null | null | opt.js | CodeDotJS/dep-graph | 8b494aea6de83993820ba26f5ca620eb588f5630 | [
"MIT"
] | null | null | null | #!/usr/bin/env node
'use strict';
const depGraphCount = require('.');
const returnData = (username, data) => {
return depGraphCount(username, data).then(res => {
console.log(res);
});
};
returnData('CodeDotJS', 'youtube-playlist');
returnData('facebook', 'react');
returnData('CodeDotJS', 'instavim');
| 17.333333 | 51 | 0.669872 |
75f1068130e49ac1b2711e052f33726648132d31 | 20,984 | js | JavaScript | tests/ParseTable/ParseTableBuilderTest.js | srobfr/microparser | dd7a65cc4cb3b02d02b7be4749851e9774958e05 | [
"MIT"
] | null | null | null | tests/ParseTable/ParseTableBuilderTest.js | srobfr/microparser | dd7a65cc4cb3b02d02b7be4749851e9774958e05 | [
"MIT"
] | 1 | 2021-05-08T03:38:29.000Z | 2021-05-08T03:38:29.000Z | tests/ParseTable/ParseTableBuilderTest.js | srobfr/microparser | dd7a65cc4cb3b02d02b7be4749851e9774958e05 | [
"MIT"
] | null | null | null | const assert = require('assert');
const ParseTableBuilder = require('../../src/ParseTable/ParseTableBuilder');
const ParseTable = require('../../src/ParseTable/ParseTable');
const debug = require('debug')('microparser:parseTableBuilderTest');
const testUtils = require('../testUtils');
/**
* Tests the ParseTable builder.
*/
describe('ParseTableBuilder', function () {
const parseTableBuilder = new ParseTableBuilder();
it('Scalar', function () {
const parseTable = parseTableBuilder.build('A');
debug('parseTable', testUtils.inspect(parseTable));
assert(parseTable instanceof ParseTable);
testUtils.inspectEqual(`ParseTable {
actions: Map { [String: 'A'] => Set { { finish: true } } },
firstSymbols: [ [String: 'A'] ],
topSymbol: [String: 'A'],
originalGrammarsMap: Map { [String: 'A'] => 'A' },
firstsLastsBySymbol:
Map {
[String: 'A'] => { firsts: Set { [String: 'A'] }, lasts: Set { [String: 'A'] } } } }`, parseTable);
});
it('Closure', function () {
const g = (context) => {
};
const parseTable = parseTableBuilder.build(g);
debug('parseTable', testUtils.inspect(parseTable));
testUtils.inspectEqual(`ParseTable {
actions: Map { [Function: g] => Set { { finish: true } } },
firstSymbols: [ [Function: g] ],
topSymbol: [Function: g],
originalGrammarsMap: Map { [Function: g] => [Function: g] },
firstsLastsBySymbol:
Map {
[Function: g] => { firsts: Set { [Function: g] }, lasts: Set { [Function: g] } } } }`, parseTable);
});
describe('Sequence', function () {
it('Start recursion', function () {
assert.throws(() => {
const g = ['A'];
g.unshift(g); // g = [g, 'A'];
parseTableBuilder.build(g);
}, /Wrong grammar \(no first symbol\)/);
});
it('End recursion', function () {
assert.throws(() => {
const g = ['A'];
g.push(g); // g = ['A', g];
parseTableBuilder.build(g);
}, /Wrong grammar \(no terminal symbol\)/);
});
it('Middle recursion', function () {
const g = ['A'];
g.push(g, 'B'); // g = ['A', g, 'B'];
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'B'] => Set { { reduce: [ [String: 'A'], [Circular], [String: 'B'] ] } },
[String: 'A'] => Set { { shift: [String: 'A'] } },
[ [String: 'A'], [Circular], [String: 'B'] ] => Set { { shift: [String: 'B'] }, { finish: true } } }`, parseTable.actions);
});
it('Start & End', function () {
assert.throws(() => {
const g = ['A'];
g.unshift(g);
g.push(g); // g = [g, 'A', g];
const parseTable = parseTableBuilder.build(g);
// debug('parseTable', testUtils.inspect(parseTable));
}, /Wrong grammar/);
});
it('Symbol re-usage', function () {
const w = [','];
const g = ['a', w, 'b', w, 'c'];
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'c'] => Set {
{ reduce:
[ [String: 'a'],
[ [String: ','] ],
[String: 'b'],
[ [String: ','] ],
[String: 'c'] ] } },
[String: ','] => Set { { reduce: [ [String: ','] ] } },
[String: 'a'] => Set { { shift: [String: ','] } },
[ [String: ','] ] => Set { { shift: [String: 'b'] } },
[String: ','] => Set { { reduce: [ [String: ','] ] } },
[String: 'b'] => Set { { shift: [String: ','] } },
[ [String: ','] ] => Set { { shift: [String: 'c'] } },
[ [String: 'a'],
[ [String: ','] ],
[String: 'b'],
[ [String: ','] ],
[String: 'c'] ] => Set { { finish: true } } }`, parseTable.actions);
});
it('Symbol re-usage 2', function () {
const w = {or: [',']};
w.or.push(w);
const g = ['a', w, 'b', w, 'c'];
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'c'] => Set {
{ reduce:
[ [String: 'a'],
{ or: [ [String: ','], [Circular] ] },
[String: 'b'],
{ or: [ [String: ','], [Circular] ] },
[String: 'c'] ] } },
[String: ','] => Set { { reduce: { or: [ [String: ','], [Circular] ] } } },
{ or: [ [String: ','], [Circular] ] } => Set {
{ reduce: { or: [ [String: ','], [Circular] ] } },
{ shift: [String: 'b'] } },
[String: 'a'] => Set { { shift: [String: ','] } },
[String: ','] => Set { { reduce: { or: [ [String: ','], [Circular] ] } } },
{ or: [ [String: ','], [Circular] ] } => Set {
{ reduce: { or: [ [String: ','], [Circular] ] } },
{ shift: [String: 'c'] } },
[String: 'b'] => Set { { shift: [String: ','] } },
[ [String: 'a'],
{ or: [ [String: ','], [Circular] ] },
[String: 'b'],
{ or: [ [String: ','], [Circular] ] },
[String: 'c'] ] => Set { { finish: true } } }`, parseTable.actions);
});
});
describe('Or', function () {
it('Simple', function () {
const g = {or: ['A']};
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'A'] => Set { { reduce: { or: [ [String: 'A'] ] } } },
{ or: [ [String: 'A'] ] } => Set { { finish: true } } }`, parseTable.actions);
});
it('Multiple', function () {
const g = {or: ['A', 'B', 'C']};
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'A'] => Set {
{ reduce: { or: [ [String: 'A'], [String: 'B'], [String: 'C'] ] } } },
[String: 'B'] => Set {
{ reduce: { or: [ [String: 'A'], [String: 'B'], [String: 'C'] ] } } },
[String: 'C'] => Set {
{ reduce: { or: [ [String: 'A'], [String: 'B'], [String: 'C'] ] } } },
{ or: [ [String: 'A'], [String: 'B'], [String: 'C'] ] } => Set { { finish: true } } }`, parseTable.actions);
});
it('Deep', function () {
const g = {or: ['A', 'B', {or: ['C', 'D']}]};
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'A'] => Set {
{ reduce:
{ or:
[ [String: 'A'],
[String: 'B'],
{ or: [ [String: 'C'], [String: 'D'] ] } ] } } },
[String: 'B'] => Set {
{ reduce:
{ or:
[ [String: 'A'],
[String: 'B'],
{ or: [ [String: 'C'], [String: 'D'] ] } ] } } },
[String: 'C'] => Set { { reduce: { or: [ [String: 'C'], [String: 'D'] ] } } },
[String: 'D'] => Set { { reduce: { or: [ [String: 'C'], [String: 'D'] ] } } },
{ or: [ [String: 'C'], [String: 'D'] ] } => Set {
{ reduce:
{ or:
[ [String: 'A'],
[String: 'B'],
{ or: [ [String: 'C'], [String: 'D'] ] } ] } } },
{ or:
[ [String: 'A'],
[String: 'B'],
{ or: [ [String: 'C'], [String: 'D'] ] } ] } => Set { { finish: true } } }`, parseTable.actions);
});
it('Empty', function () {
assert.throws(() => {
const g = [];
g.push(g);
parseTableBuilder.build(g);
}, /Wrong grammar \(no first symbol\)/);
});
it('Recursive', function () {
assert.throws(() => {
const g = {or: []};
g.or.push(g);
parseTableBuilder.build(g);
}, /Wrong grammar \(no first symbol\)/);
});
it('Recursive start with content', function () {
const g = {or: ['A']};
g.or.push(g);
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'A'] => Set { { reduce: { or: [ [String: 'A'], [Circular] ] } } },
{ or: [ [String: 'A'], [Circular] ] } => Set {
{ reduce: { or: [ [String: 'A'], [Circular] ] } },
{ finish: true } } }`, parseTable.actions);
});
it('Recursive end with content', function () {
const g = {or: ['A']};
g.or.unshift(g);
const parseTable = parseTableBuilder.build(g);
// debug('parseTable', testUtils.inspect(parseTable));
testUtils.inspectEqual(`Map {
{ or: [ [Circular], [String: 'A'] ] } => Set {
{ reduce: { or: [ [Circular], [String: 'A'] ] } },
{ finish: true } },
[String: 'A'] => Set { { reduce: { or: [ [Circular], [String: 'A'] ] } } } }`, parseTable.actions);
});
it('Empty Or', function () {
const g = {or: []};
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: ''] => Set { { reduce: { or: [ [String: ''] ] } } },
{ or: [ [String: ''] ] } => Set { { finish: true } } }`, parseTable.actions);
});
});
describe('Multiple', function () {
it('Normal', function () {
const g = {multiple: ['a', 'b']};
const parseTable = parseTableBuilder.build(g);
debug('parseTable', testUtils.inspect(parseTable));
// console.log(util.inspect(parseTable, {hidden: true, depth: 30}));
testUtils.inspectEqual(`ParseTable {
actions:
Map {
[String: 'b'] => Set { { reduce: [ [String: 'a'], [String: 'b'] ] } },
[String: 'a'] => Set { { shift: [String: 'b'] } },
[ [String: 'a'], [String: 'b'] ] => Set {
{ shift: [String: 'a'] },
{ reduce: { multiple: [ [String: 'a'], [String: 'b'] ] } } },
{ multiple: [ [String: 'a'], [String: 'b'] ] } => Set { { finish: true } } },
firstSymbols: [ [String: 'a'] ],
topSymbol: { multiple: [ [String: 'a'], [String: 'b'] ] },
originalGrammarsMap:
Map {
[String: 'a'] => 'a',
[String: 'b'] => 'b',
[ [String: 'a'], [String: 'b'] ] => [ 'a', 'b' ],
{ multiple: [ [String: 'a'], [String: 'b'] ] } => { multiple: [ 'a', 'b' ] } },
firstsLastsBySymbol:
Map {
{ multiple: [ [String: 'a'], [String: 'b'] ] } => { firsts: Set { [String: 'a'] }, lasts: Set { [String: 'b'] } },
[ [String: 'a'], [String: 'b'] ] => { firsts: Set { [String: 'a'] }, lasts: Set { [String: 'b'] } },
[String: 'a'] => { firsts: Set { [String: 'a'] }, lasts: Set { [String: 'a'] } },
[String: 'b'] => { firsts: Set { [String: 'b'] }, lasts: Set { [String: 'b'] } } } }`, parseTable);
});
});
describe('Special cases', function () {
it('Or+Sequence', function () {
const parseTable = parseTableBuilder.build(['A', {or: ['B', 'C']}, 'D']);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'D'] => Set {
{ reduce:
[ [String: 'A'],
{ or: [ [String: 'B'], [String: 'C'] ] },
[String: 'D'] ] } },
[String: 'B'] => Set { { reduce: { or: [ [String: 'B'], [String: 'C'] ] } } },
[String: 'C'] => Set { { reduce: { or: [ [String: 'B'], [String: 'C'] ] } } },
[String: 'A'] => Set { { shift: [String: 'B'] }, { shift: [String: 'C'] } },
{ or: [ [String: 'B'], [String: 'C'] ] } => Set { { shift: [String: 'D'] } },
[ [String: 'A'],
{ or: [ [String: 'B'], [String: 'C'] ] },
[String: 'D'] ] => Set { { finish: true } } }`, parseTable.actions);
});
it('Recursion with exit', function () {
const g = ['A'];
const o = {or: [g, 'End']};
g.push(o); // g = ['A', {or: [g, 'End']}]
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
{ or: [ [ [String: 'A'], [Circular] ], [String: 'End'] ] } => Set {
{ reduce: [ [String: 'A'], { or: [ [Circular], [String: 'End'] ] } ] } },
[ [String: 'A'], { or: [ [Circular], [String: 'End'] ] } ] => Set {
{ reduce: { or: [ [ [String: 'A'], [Circular] ], [String: 'End'] ] } },
{ finish: true } },
[String: 'End'] => Set {
{ reduce: { or: [ [ [String: 'A'], [Circular] ], [String: 'End'] ] } } },
[String: 'A'] => Set { { shift: [String: 'A'] }, { shift: [String: 'End'] } } }`, parseTable.actions);
});
it('Empty sequence Start', function () {
const g = [[], 'B'];
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'B'] => Set { { reduce: [ [ [String: ''] ], [String: 'B'] ] } },
[String: ''] => Set { { reduce: [ [String: ''] ] } },
[ [String: ''] ] => Set { { shift: [String: 'B'] } },
[ [ [String: ''] ], [String: 'B'] ] => Set { { finish: true } } }`, parseTable.actions);
});
it('Empty sequence Middle', function () {
const g = ['A', [], 'B'];
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[String: 'B'] => Set {
{ reduce: [ [String: 'A'], [ [String: ''] ], [String: 'B'] ] } },
[String: ''] => Set { { reduce: [ [String: ''] ] } },
[String: 'A'] => Set { { shift: [String: ''] } },
[ [String: ''] ] => Set { { shift: [String: 'B'] } },
[ [String: 'A'], [ [String: ''] ], [String: 'B'] ] => Set { { finish: true } } }`, parseTable.actions);
});
it('Empty sequence End', function () {
const g = ['A', 'B', []];
const parseTable = parseTableBuilder.build(g);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
[ [String: ''] ] => Set {
{ reduce: [ [String: 'A'], [String: 'B'], [ [String: ''] ] ] } },
[String: 'A'] => Set { { shift: [String: 'B'] } },
[String: ''] => Set { { reduce: [ [String: ''] ] } },
[String: 'B'] => Set { { shift: [String: ''] } },
[ [String: 'A'], [String: 'B'], [ [String: ''] ] ] => Set { { finish: true } } }`, parseTable.actions);
});
it('Complex expression', function () {
const numeric = /^\d+/;
const expr = {or: [numeric]};
const addition = [expr, '+', expr];
const multiplication = [expr, '*', expr];
expr.or.push(['(', expr, ')'], multiplication, addition);
const parseTable = parseTableBuilder.build(expr);
// debug(parseTable);
// console.log(util.inspect(parseTable.actions, {hidden: true, depth: 30}));
testUtils.inspectEqual(`Map {
/^\\d+/ => Set {
{ reduce:
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[ [Circular], [String: '+'], [Circular] ] ] } } },
[String: ')'] => Set {
{ reduce:
[ [String: '('],
{ or:
[ /^\\d+/,
[Circular],
[ [Circular], [String: '*'], [Circular] ],
[ [Circular], [String: '+'], [Circular] ] ] },
[String: ')'] ] } },
[String: '('] => Set { { shift: /^\\d+/ }, { shift: [String: '('] } },
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[ [Circular], [String: '+'], [Circular] ] ] } => Set {
{ shift: [String: ')'] },
{ reduce:
[ { or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[Circular],
[ [Circular], [String: '+'], [Circular] ] ] },
[String: '*'],
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[Circular],
[ [Circular], [String: '+'], [Circular] ] ] } ] },
{ shift: [String: '*'] },
{ reduce:
[ { or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[Circular] ] },
[String: '+'],
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[Circular] ] } ] },
{ shift: [String: '+'] },
{ finish: true } },
[ [String: '('],
{ or:
[ /^\\d+/,
[Circular],
[ [Circular], [String: '*'], [Circular] ],
[ [Circular], [String: '+'], [Circular] ] ] },
[String: ')'] ] => Set {
{ reduce:
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[ [Circular], [String: '+'], [Circular] ] ] } } },
[String: '*'] => Set { { shift: /^\\d+/ }, { shift: [String: '('] } },
[ { or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[Circular],
[ [Circular], [String: '+'], [Circular] ] ] },
[String: '*'],
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[Circular],
[ [Circular], [String: '+'], [Circular] ] ] } ] => Set {
{ reduce:
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[ [Circular], [String: '+'], [Circular] ] ] } } },
[String: '+'] => Set { { shift: /^\\d+/ }, { shift: [String: '('] } },
[ { or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[Circular] ] },
[String: '+'],
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[Circular] ] } ] => Set {
{ reduce:
{ or:
[ /^\\d+/,
[ [String: '('], [Circular], [String: ')'] ],
[ [Circular], [String: '*'], [Circular] ],
[ [Circular], [String: '+'], [Circular] ] ] } } } }`, parseTable.actions);
});
});
it('firstsLastsBySymbol', function () {
const parseTable = parseTableBuilder.build({
multiple: [{or: ['a', 'b']}]
});
// debug(parseTable);
// debug('parseTable', testUtils.inspect(parseTable));
testUtils.inspectEqual(`ParseTable {
actions:
Map {
{ or: [ [String: 'a'], [String: 'b'] ] } => Set { { reduce: [ { or: [ [String: 'a'], [String: 'b'] ] } ] } },
[String: 'a'] => Set { { reduce: { or: [ [String: 'a'], [String: 'b'] ] } } },
[String: 'b'] => Set { { reduce: { or: [ [String: 'a'], [String: 'b'] ] } } },
[ { or: [ [String: 'a'], [String: 'b'] ] } ] => Set {
{ shift: [String: 'a'] },
{ shift: [String: 'b'] },
{ reduce: { multiple: [ { or: [ [String: 'a'], [String: 'b'] ] } ] } } },
{ multiple: [ { or: [ [String: 'a'], [String: 'b'] ] } ] } => Set { { finish: true } } },
firstSymbols: [ [String: 'a'], [String: 'b'] ],
topSymbol: { multiple: [ { or: [ [String: 'a'], [String: 'b'] ] } ] },
originalGrammarsMap:
Map {
[String: 'a'] => 'a',
[String: 'b'] => 'b',
{ or: [ [String: 'a'], [String: 'b'] ] } => { or: [ 'a', 'b' ] },
[ { or: [ [String: 'a'], [String: 'b'] ] } ] => [ { or: [ 'a', 'b' ] } ],
{ multiple: [ { or: [ [String: 'a'], [String: 'b'] ] } ] } => { multiple: [ { or: [ 'a', 'b' ] } ] } },
firstsLastsBySymbol:
Map {
{ multiple: [ { or: [ [String: 'a'], [String: 'b'] ] } ] } => { firsts: Set { [String: 'a'], [String: 'b'] },
lasts: Set { [String: 'a'], [String: 'b'] } },
[ { or: [ [String: 'a'], [String: 'b'] ] } ] => { firsts: Set { [String: 'a'], [String: 'b'] },
lasts: Set { [String: 'a'], [String: 'b'] } },
{ or: [ [String: 'a'], [String: 'b'] ] } => { firsts: Set { [String: 'a'], [String: 'b'] },
lasts: Set { [String: 'a'], [String: 'b'] } },
[String: 'a'] => { firsts: Set { [String: 'a'] }, lasts: Set { [String: 'a'] } },
[String: 'b'] => { firsts: Set { [String: 'b'] }, lasts: Set { [String: 'b'] } } } }`, parseTable);
});
});
| 40.824903 | 125 | 0.442051 |
75f16a355883bd9daf60d25da20ad8957d8f4f68 | 839 | js | JavaScript | web/src/modules/tab/components/Block/Block.js | betofigueiredo/oaktabs | 619b6590c6bf4ba07dce21ef37023e2f3f89baad | [
"MIT"
] | 5 | 2020-10-19T14:37:44.000Z | 2021-11-22T20:56:03.000Z | web/src/modules/tab/components/Block/Block.js | Jamister/Tabs | 619b6590c6bf4ba07dce21ef37023e2f3f89baad | [
"MIT"
] | 7 | 2021-06-28T20:26:38.000Z | 2022-02-27T10:07:31.000Z | web/src/modules/tab/components/Block/Block.js | betofigueiredo/oaktabs | 619b6590c6bf4ba07dce21ef37023e2f3f89baad | [
"MIT"
] | 2 | 2021-01-16T03:37:53.000Z | 2021-01-31T15:56:34.000Z | import React from 'react';
import PropTypes from 'prop-types';
import { useSelector, shallowEqual } from 'react-redux';
// Components
import Column from '../Column';
import BlockEnd from './BlockEnd';
function Block({ full_block_id }) {
const columns = useSelector(store => store.tab.columns, shallowEqual);
const columns_in_this_block = (columns.allIds || [])
.filter(b => b.indexOf(`${full_block_id}-`) !== -1);
return (
<>
{columns_in_this_block.map(full_column_id => (
<Column
key={full_column_id}
full_column_id={full_column_id}
/>
))}
<BlockEnd full_block_id={full_block_id} />
</>
);
}
Block.propTypes = {
full_block_id: PropTypes.string.isRequired,
};
export default Block;
| 26.21875 | 74 | 0.592372 |
75f1bda45976f3fca85f846ff59d2cd0cf91fc59 | 2,340 | js | JavaScript | src/router.js | AbuKhalil95/template-api | 9eeda5b51cb878aea65a5427b803db0561a32a12 | [
"Apache-2.0"
] | null | null | null | src/router.js | AbuKhalil95/template-api | 9eeda5b51cb878aea65a5427b803db0561a32a12 | [
"Apache-2.0"
] | null | null | null | src/router.js | AbuKhalil95/template-api | 9eeda5b51cb878aea65a5427b803db0561a32a12 | [
"Apache-2.0"
] | null | null | null | 'use strict';
const express = require('express');
const router = express.Router();
// ---------------------------------------- Special Routes ---------------------------------------- //
const authRouter = require('./routes/auth-router.js');
const serverErrorHandler = require('./middleware/500.js');
router.use(authRouter);
router.use(serverErrorHandler);
// ---------------------------------------- Generic Routes ---------------------------------------- //
const getModel = require('./middleware/model-finder.js');
router.param('model', getModel);
const bearerAuth = require('./middleware/bearer.js');
const aclMiddleware = require('./middleware/acl-middleware.js');
router.post('/:model', bearerAuth, aclMiddleware('create'), postItem);
router.get('/:model/:id?', bearerAuth, aclMiddleware('read'), getItem);
router.put('/:model/:id', bearerAuth, aclMiddleware('update'), updateItem);
router.delete('/:model/:id', bearerAuth, aclMiddleware('delete'), deleteItem);
// ---------------------------------------- Specific Routes ---------------------------------------- //
// ---------------------------------------- Generic Functions ---------------------------------------- //
function postItem(req, res, next) {
console.log('Posting item: ', req.body);
req.model.create(req.body).then(data => {
res.status(201).json(data);
}).catch(err => {
console.log('error: ', err);
next(err);
});
}
function getItem(req, res, next) {
let paramID = req.params.id;
req.model.get(paramID).then(data => {
let output = {
count: 0,
results: [],
};
output.count = data.length;
output.results = data;
res.status(200).json(output);
}).catch(err => {
console.log('error: ', err);
next(err);
});
}
function updateItem(req, res, next) {
let paramID = req.params.id;
req.model.update(paramID, req.body).then(data => {
res.status(201).json(data);
}).catch(err => {
console.log('error: ', err);
next(err);
});
}
function deleteItem(req, res, next) {
let paramID = req.params.id;
req.model.delete(paramID).then(data => {
res.status(201).json(data);
}).catch(err => {
console.log('error: ', err);
next(err);
});
}
// ---------------------------------------- Specific Functions ---------------------------------------- //
module.exports = router; | 30 | 106 | 0.532479 |
75f25397a8ff4871fe338347ba612dfe1bd3ede9 | 1,509 | js | JavaScript | ts-hello/types-example.js | Doodely/Udemy-Course | 8112a76ec99d5157c17a04fbee774fcc5cca79fd | [
"MIT"
] | null | null | null | ts-hello/types-example.js | Doodely/Udemy-Course | 8112a76ec99d5157c17a04fbee774fcc5cca79fd | [
"MIT"
] | null | null | null | ts-hello/types-example.js | Doodely/Udemy-Course | 8112a76ec99d5157c17a04fbee774fcc5cca79fd | [
"MIT"
] | null | null | null | var count = 5; // Hovering the mouse over 'count' will show it is declared as type 'number'
count = 'a'; // Compilation error for hard-type
/*
Typescript won't complain about the declaration of unassigned variables with
type 'any'. This is practically a var with limited-scope, but isn't very useful
with TypeScript...
*/
var a; // Type is 'any'
a = 1;
a = true;
a = 'a';
/*
So you can use type-annotations to declare the type when you expect a certain type.
We now get proper syntax errors for values outside the expected type.
*/
var b;
b = 1;
b = true;
b = 'b';
/* Common Types */
var c;
var d;
var e;
var f;
var g; // Array of numbers
var gh = [1, 2, 3];
var gi = [1, true, 'a', false];
// Enums & Constants
// Verbose way...
var ColorRed = 0;
var ColorGreen = 1;
var ColorBlue = 2;
// Enum Way
var Color;
(function (Color) {
Color[Color["Red"] = 0] = "Red";
Color[Color["Green"] = 1] = "Green";
Color[Color["Blue"] = 2] = "Blue";
})(Color || (Color = {}));
;
var backgroundColor = Color.Red; // This will have intellisense when you type "." with the properties
// Explicitly setting enums (best practice)
// In the future someone could come in an add a new color, this can help prevent value changes
var otherColor;
(function (otherColor) {
otherColor[otherColor["Red"] = 0] = "Red";
otherColor[otherColor["Green"] = 1] = "Green";
otherColor[otherColor["Blue"] = 2] = "Blue";
})(otherColor || (otherColor = {}));
;
var otherBackgroundColor = otherColor.Red;
| 29.019231 | 101 | 0.65275 |
75f348b41ef1d0677448594e0a3777fa543ef7b1 | 613 | js | JavaScript | packages/mui-codemod/src/v5.0.0/optimal-imports.test/actual.js | dany-freeman/material-ui | e1e335015cabbdc83d3938bba0575d24b9fe5603 | [
"MIT"
] | 51,124 | 2017-11-20T16:24:00.000Z | 2022-02-06T13:55:28.000Z | packages/mui-codemod/src/v5.0.0/optimal-imports.test/actual.js | dany-freeman/material-ui | e1e335015cabbdc83d3938bba0575d24b9fe5603 | [
"MIT"
] | 21,058 | 2017-11-20T16:48:30.000Z | 2022-02-06T12:55:00.000Z | packages/mui-codemod/src/v5.0.0/optimal-imports.test/actual.js | dany-freeman/material-ui | e1e335015cabbdc83d3938bba0575d24b9fe5603 | [
"MIT"
] | 28,842 | 2017-11-20T17:30:48.000Z | 2022-02-06T13:21:32.000Z | import MenuItem from '@material-ui/core/MenuItem';
import red from '@material-ui/core/colors/red';
import useTheme from '@material-ui/core/styles/useTheme';
import Tab from '@material-ui/core/Tab';
import { green as greenColor } from '@material-ui/core/colors';
import MuiTabs from '@material-ui/core/Tabs';
import createTheme from '@material-ui/core/styles/createTheme';
import yellow from '@material-ui/core/colors/yellow';
import TableContext from '@material-ui/core/Table/TableContext';
import SwitchBase from '@material-ui/core/internal/SwitchBase';
import Ripple from '@material-ui/core/ButtonBase/Ripple';
| 51.083333 | 64 | 0.781403 |
75f38a1087382f31a354be31ca3f4a5fd47e22ee | 6,461 | js | JavaScript | reaction.js | delapuente/reaction | d8fce968ff2bd1e575b728776293292baaeb94ff | [
"MIT"
] | 1 | 2015-02-03T12:45:50.000Z | 2015-02-03T12:45:50.000Z | reaction.js | delapuente/reaction | d8fce968ff2bd1e575b728776293292baaeb94ff | [
"MIT"
] | null | null | null | reaction.js | delapuente/reaction | d8fce968ff2bd1e575b728776293292baaeb94ff | [
"MIT"
] | null | null | null | (function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([], factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
var original = root.reaction;
root.reaction = factory();
root.reaction.restore = function () {
root.reaction = original;
return this;
};
}
}(this, function () {
'use strict';
var undefined = void 0;
function DependencyMap() {
this._dependencies = Object.create(null);
this._affected = Object.create(null);
}
DependencyMap.prototype.addDependencies = function (name, dependencies) {
this._checkDependencies(name, dependencies);
this._dependencies[name] = this._dependencies[name] || Object.create(null);
dependencies.forEach(function (dependency) {
this._dependencies[name][dependency] = true;
this._affected[dependency] = this._affected[dependency] || {};
this._affected[dependency][name] = true;
}.bind(this));
};
DependencyMap.prototype._checkDependencies = function (goal, dependencies) {
dependencies.forEach(function (dependency) {
if (dependency === goal) {
throw new Error(
'Cycle detected between "' + goal + '" and "' + dependency + '"'
);
}
this._checkDependencies(goal, this.getDependenciesFor(dependency));
}, this);
};
DependencyMap.prototype.getAffectedBy = function (name) {
return Object.keys(this._affected[name] || Object.create(null));
};
DependencyMap.prototype.getDependenciesFor = function (name) {
return Object.keys(this._dependencies[name] || Object.create(null));
};
var builtins = {
'Math': Math,
'Date': Date
};
builtins.isBuiltin = function (name) {
return builtins[name] instanceof Object;
};
builtins.get = function (name) {
return builtins[name];
};
var keywords = [
'new',
'function',
'return'
];
function serialize(value) {
var serialization = 'void 0';
try {
serialization = JSON.stringify(value);
} catch (e) { }
if (serialization === undefined && value !== undefined) {
switch (value.contructor) {
case Function:
serialization = value.toString();
break;
case Date:
serialization = 'new Date(' + (+value) + ')';
break;
}
}
else {
serialization = 'void 0';
}
return serialization;
}
function reaction(context) {
context = context || {};
var definitions = {};
var dependencies = new DependencyMap();
function declarator() {
var varlist = [].slice.call(arguments);
var options = {};
if (typeof varlist[varlist.length - 1] === 'object') {
options = varlist.pop();
}
varlist.forEach(function (property) {
var wasPresent = Object.keys(context).indexOf(property) > -1;
var wasReactive =
definitions[property] && definitions[property].reactive;
definitions[property] = definitions[property] || {
definition: options.monitorOnly ?
undefined : serialize(context[property]),
value: context[property]
};
definitions[property].reactive =
definitions[property].reactive || !options.monitorOnly;
Object.defineProperty(context, property, {
configurable: true,
enumerable: true,
set: function (newDefinition) {
update(
property,
newDefinition,
definitions,
dependencies,
context,
declarator
);
},
get: function () {
return definitions[property].value;
}
});
if (wasPresent && !wasReactive) {
context[property] = definitions[property].value;
}
});
}
Object.defineProperty(declarator, 'context', { value: context });
return declarator;
}
function update(property, newDefinition, definitions, dependencies, context, declarator) {
if (definitions[property].reactive) {
if (typeof newDefinition === 'number') {
newDefinition = '' + newDefinition;
}
var localDependencies = extractDependencies(newDefinition);
var args = localDependencies.concat([{ monitorOnly: true }]);
declarator.apply(context, args);
dependencies.addDependencies(property, localDependencies);
definitions[property].definition = newDefinition;
}
else {
definitions[property].value = newDefinition;
}
compute(property, definitions, dependencies);
}
function compute(property, definitions, dependencies) {
var value = computeValue(property, definitions, dependencies);
definitions[property].value = value;
var affected = dependencies.getAffectedBy(property);
affected.forEach(function (affectedProperty) {
compute(affectedProperty, definitions, dependencies);
});
}
function computeValue(property, definitions, dependencies) {
var result;
if (!definitions[property].reactive) {
result = definitions[property].value;
}
else {
var formalList = dependencies.getDependenciesFor(property);
var actualList = formalList.map(function (parameterName) {
return builtins.isBuiltin(parameterName) ?
builtins.get(parameterName) :
definitions[parameterName].value;
});
var definition = definitions[property].definition;
var code = '"use strict";\nreturn (' + definition + ');';
var evaluator = new Function(formalList.join(','), code);
result = evaluator.apply(undefined, actualList);
}
return result;
}
function extractDependencies(code) {
code = removeFunctionDetails(code);
var dependencies = [];
var identifier = /(\.\s*?)?([_$a-zA-Z][_$\w]*)/g;
var match = identifier.exec(code);
while (match) {
var point = match[1];
var name = match[2];
if (!point && keywords.indexOf(name) === -1) {
dependencies.push(name);
}
match = identifier.exec(code);
}
return dependencies;
}
function removeFunctionDetails(code) {
var nameAndArgs = /(function)(.*)(\{)/g;
return code.replace(nameAndArgs, function (all, fn, nameAndArgs, bracket) {
return fn + ' () ' + bracket;
});
}
return reaction;
}));
| 30.476415 | 92 | 0.606253 |
75f4e5d039bcdd9ae5627c9bf1441a5c92af7933 | 708 | js | JavaScript | app/components/PageError/tests/index.test.js | matteoterrinoni/dbh-front-end-assignment | 33d20c84aaacaaa43fd6632f7d2bfdd6f5588014 | [
"MIT"
] | null | null | null | app/components/PageError/tests/index.test.js | matteoterrinoni/dbh-front-end-assignment | 33d20c84aaacaaa43fd6632f7d2bfdd6f5588014 | [
"MIT"
] | null | null | null | app/components/PageError/tests/index.test.js | matteoterrinoni/dbh-front-end-assignment | 33d20c84aaacaaa43fd6632f7d2bfdd6f5588014 | [
"MIT"
] | null | null | null | import React from 'react';
import { mount } from 'enzyme';
import PageError from '../';
let pageErrorProps;
describe('<PageError />', () => {
beforeEach(() => {
pageErrorProps = {
error: {
message: 'aaa',
},
};
});
it('should render page-error div if with Error', () => {
const renderedComponent = mount(<PageError {...pageErrorProps} />);
expect(renderedComponent.find('.page-error').length).toEqual(1);
});
it('should not render page-error div if without Error', () => {
pageErrorProps.error = false;
const renderedComponent = mount(<PageError {...pageErrorProps} />);
expect(renderedComponent.find('.page-error').length).toEqual(0);
});
});
| 26.222222 | 71 | 0.617232 |
75f5133411f38a52720fdc3df5112706263db8d1 | 1,079 | js | JavaScript | webscripts/org/alfresco/cmis/parents.get.js | FredericoLimaMendes/alfresco-ms-office-plugin | d470be6a94cd293da7540cb66695710f266fbe29 | [
"Apache-2.0"
] | 6 | 2015-03-24T18:33:59.000Z | 2021-05-25T14:27:09.000Z | webscripts/org/alfresco/cmis/parents.get.js | FredericoLimaMendes/alfresco-ms-office-plugin | d470be6a94cd293da7540cb66695710f266fbe29 | [
"Apache-2.0"
] | null | null | null | webscripts/org/alfresco/cmis/parents.get.js | FredericoLimaMendes/alfresco-ms-office-plugin | d470be6a94cd293da7540cb66695710f266fbe29 | [
"Apache-2.0"
] | 8 | 2015-05-31T21:16:15.000Z | 2021-09-16T09:33:22.000Z | <import resource="classpath:alfresco/templates/webscripts/org/alfresco/cmis/lib/read.lib.js">
script:
{
// locate node and parent
var object = getObjectFromUrl();
if (object.node == null)
{
break script;
}
model.node = object.node;
var parents = [];
for each (var parent in model.node.parents)
{
if (parent.hasPermission("Read") && parent.isContainer)
{
parents.push(parent);
}
}
model.parents = parents;
// property filter
model.filter = args[cmisserver.ARG_FILTER];
if (model.filter === null)
{
model.filter = "*";
}
// rendition filter
model.renditionFilter = args[cmisserver.ARG_RENDITION_FILTER];
if (model.renditionFilter === null || model.renditionFilter.length == 0)
{
model.renditionFilter = "cmis:none";
}
// include allowable actions
var includeAllowableActions = args[cmisserver.ARG_INCLUDE_ALLOWABLE_ACTIONS];
model.includeAllowableActions = (includeAllowableActions == "true" ? true : false);
}
| 26.317073 | 93 | 0.62836 |
75f5952e6b2ddfcde4d907b0fced377ed6bfcc6f | 124 | js | JavaScript | doc/html/search/enums_0.js | DKrepsky/CC3200-Bootloader | 1ec3e176a902199b3e23e9362642665ff34ea6f8 | [
"MIT"
] | 1 | 2019-12-16T12:55:40.000Z | 2019-12-16T12:55:40.000Z | doc/html/search/enums_0.js | DKrepsky/CC3200-Bootloader | 1ec3e176a902199b3e23e9362642665ff34ea6f8 | [
"MIT"
] | null | null | null | doc/html/search/enums_0.js | DKrepsky/CC3200-Bootloader | 1ec3e176a902199b3e23e9362642665ff34ea6f8 | [
"MIT"
] | 1 | 2019-12-16T12:57:24.000Z | 2019-12-16T12:57:24.000Z | var searchData=
[
['bootstatus_5ft',['bootstatus_t',['../boot_8h.html#aa6f58ff2b7253bd35842fc6c449925d6',1,'boot.h']]]
];
| 24.8 | 102 | 0.717742 |
75f7597578724145dd1f7a613d0635e5f1df5516 | 4,114 | js | JavaScript | server/test/chat.test.js | firehiros/basic_chat | 681356bad07d317b99e8a94652556d7c08046b1a | [
"MIT"
] | null | null | null | server/test/chat.test.js | firehiros/basic_chat | 681356bad07d317b99e8a94652556d7c08046b1a | [
"MIT"
] | null | null | null | server/test/chat.test.js | firehiros/basic_chat | 681356bad07d317b99e8a94652556d7c08046b1a | [
"MIT"
] | null | null | null | 'use strict';
const express = require('express');
const bodyParser = require('body-parser');
const axios = require('axios');
const mongoose = require('mongoose');
const socket = require('socket.io-client');
const User = require('./../db/schema/user');
const Room = require('./../db/schema/room');
const config = require('./../config');
const HOST = "http://localhost:8000";
let sender, receiver,
senderInfo, receiverInfo,
senderToken, receiverToken,
pRoom;
describe('TEST CHAT API', () => {
beforeAll((next) => {
mongoose.connection.on('error', function (err) {
throw new Error(err);
});
mongoose.connection.on('disconnected', function() {
throw new Error('Could not connect to database');
});
mongoose.connect(config.db, async (err) => {
// remove all
if (err) {
throw err;
}
// Create User
let response = await axios.post(`${HOST}/account/register`, {
username: 'chat',
email: 'chat@gmail.com',
password: '12345678a',
passwordConfirm: '12345678a'
});
response = await axios.post(`${HOST}/account/register`, {
username: 'chat1',
email: 'chat1@gmail.com',
password: '12345678a',
passwordConfirm: '12345678a'
});
// Get token
response = await axios.post(`${HOST}/account/authenticate`, {
username: "chat",
password: "12345678a"
})
senderToken = response.data.token;
senderInfo = response.data.user;
response = await axios.post(`${HOST}/account/authenticate`, {
username: "chat1",
password: "12345678a"
}).catch((error) => console.log(error));
receiverToken = response.data.token;
receiverInfo = response.data.user;
next();
});
}, 10000);
afterAll((next) => {
mongoose.connection.dropDatabase().then(next);
});
beforeEach(async (next) => {
// Get token
let ioOptions = {
forceNew: true,
reconnection: false,
query: {
token: senderToken
}
}
// connect socket
sender = socket(`${HOST}`, ioOptions);
sender.on('connect', function () {
expect(sender.id).toBeDefined();
});
// connect socket
ioOptions.query.token = receiverToken;
receiver = socket(`${HOST}`, ioOptions);
receiver.on('connect', function () {
expect(receiver.id).toBeDefined();
});
next();
}, 10000)
afterEach(function(next){
// disconnect io clients after each test
sender.disconnect()
receiver.disconnect()
next()
})
it(`Chat with another user By API`, (next) => {
let data = {
text: 'HELLO FRED1'
}
axios.post(`${HOST}/users/${receiverInfo.id}/messages`, data,{
headers: {
'x-access-token': senderToken
}
}).then((response) => {
expect(response.status).toBe(201);
expect(response.data.message.text).toBe('HELLO FRED1');
next()
}).catch((error) => console.log(error));
}, 10000);
it(`Chat with another user By Socket`, (next) => {
let data = {
user: receiverInfo.id,
text: 'HELLO FRED1'
}
receiver.on('chat-messages:new', (res) => {
expect(res.message.text).toBe('HELLO FRED1');
next();
})
sender.on('chat-messages:new', (res) => {
expect(res.message.text).toBe('HELLO FRED1');
next();
})
sender.emit('chat-messages:create', data, (res) => {
expect(res.message.text).toBe('HELLO FRED1');
});
}, 10000);
});
| 29.597122 | 73 | 0.49684 |
75f7b895775c28b030e1c7adfface5467289adb5 | 2,632 | js | JavaScript | test/simple/test-fs-readdir.js | 2fast2fourier/chrome-fs | cd1a299f043e97034e012a717172f112779bf7c3 | [
"MIT"
] | 18 | 2015-06-15T19:54:26.000Z | 2021-04-25T14:48:29.000Z | test/simple/test-fs-readdir.js | 2fast2fourier/chrome-fs | cd1a299f043e97034e012a717172f112779bf7c3 | [
"MIT"
] | 19 | 2015-08-05T10:38:48.000Z | 2019-03-29T05:34:02.000Z | test/simple/test-fs-readdir.js | 2fast2fourier/chrome-fs | cd1a299f043e97034e012a717172f112779bf7c3 | [
"MIT"
] | 8 | 2015-06-15T17:27:28.000Z | 2018-08-21T20:29:00.000Z | // Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var common = require('../common')
var assert = require('assert')
var path = require('path')
var fs = require('../../chrome')
var readdirDir = path.join(common.tmpDir, 'readdir')
var files = ['test.txt']
console.log('readdir ' + readdirDir)
fs.mkdir(readdirDir, function (err) {
assert.equal(err, null)
fs.writeFile(readdirDir + '/test.txt', '', function (err) {
assert.equal(err, null)
fs.readdir(readdirDir, function (err, f) {
assert.equal(err, null)
console.dir(f)
assert.deepEqual(files, f)
fs.unlink(readdirDir + '/test.txt', function (err) {
assert.equal(err, null)
fs.rmdir(readdirDir, function (err) {
assert.equal(err, null)
console.log('test-fs-readdir 1 success')
})
})
})
})
})
// readdir() on file should throw Error
// *nix error ENOENT not supported
// https://github.com/joyent/node/issues/1869
var readdirDir2 = path.join(common.tmpDir, 'readdir2')
fs.mkdir(readdirDir2, function (err) {
assert.equal(err, null)
fs.writeFile(readdirDir2 + '/test2.txt', '', function (err) {
assert.equal(err, null)
fs.readdir(readdirDir2 + '/test2.txt', function (err, f) {
assert.ok(err, 'Expected error from file readdir')
fs.unlink(readdirDir2 + '/test2.txt', function (err) {
assert.equal(err, null)
fs.rmdir(readdirDir2, function (err) {
assert.equal(err, null)
console.log('test-fs-readdir 2 success')
})
})
})
})
})
| 37.6 | 76 | 0.681991 |
75f80ee15f13d540d4dae80ece5b3fcbbb49d274 | 1,850 | js | JavaScript | renderer.js | BenjaminMichael/node-powershell-benchmarks | 24f904a5b06a1b208aa6ef8486a22d2cc4b4247d | [
"CC0-1.0"
] | 1 | 2018-02-17T22:50:34.000Z | 2018-02-17T22:50:34.000Z | renderer.js | BenjaminMichael/node-powershell-benchmarks | 24f904a5b06a1b208aa6ef8486a22d2cc4b4247d | [
"CC0-1.0"
] | null | null | null | renderer.js | BenjaminMichael/node-powershell-benchmarks | 24f904a5b06a1b208aa6ef8486a22d2cc4b4247d | [
"CC0-1.0"
] | 2 | 2018-06-30T19:17:42.000Z | 2018-07-31T06:07:55.000Z | window.Hammer = require('./node_modules/materialize-css/js/hammer.min.js')
require('materialize-css')
const shell = require('node-powershell')
const testData=[1,2,3,4,5,6,7,8,9]
function loading(){
const myPreLoader = `
<div class="preloader-wrapper big active">
<div class="spinner-layer spinner-blue">
<div class="circle-clipper left">
<div class="circle"></div>
</div><div class="gap-patch">
<div class="circle"></div>
</div><div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>`
$('#myH3').html(myPreLoader)
}
$(document).ready(function(){
document.getElementById('clearBtn').addEventListener('click', function(){
document.getElementById('resultsGoHere').innerHTML=""
})
document.getElementById('test1Btn').addEventListener('click', function(){
loading()
let i=0
let max=testData.length
let runningTotal=0
let ps = new shell({
executionPolicy: 'Bypass',
noProfile: true
})
const doPowershell = (val) => {
ps.addCommand(`write-host ${val}`)
ps.invoke()
}
ps.on('output', output => {
runningTotal+=parseInt(output)
document.getElementById('resultsGoHere').innerHTML+=`<div class="chip orange lighten-3 purple-text z-depth-3 text-darken-1 col s2 m2 l2">${output}</div>`
if (i<max) {return doPowershell(testData[i++])}else{
ps.dispose()
document.getElementById('myH3').innerhtml+='<h2>Done.</h2>'
document.getElementById('resultsGoHere').innerHTML+=`<div class="chip orange lighten-3 purple-text z-depth-3 text-darken-1 col s2 m2 l2">total:${runningTotal}</div>`
}
})
doPowershell(testData[i++])
})
})
| 34.90566 | 181 | 0.595135 |
75f8b360387b2eb3093ba249af8ccfd68361bc3b | 887 | js | JavaScript | example/clone.js | johnhaley81/nodegit | 32789a79e71fbc9e04d3eff7425e1771eb595150 | [
"MIT"
] | 1 | 2021-02-10T02:27:05.000Z | 2021-02-10T02:27:05.000Z | example/clone.js | johnhaley81/nodegit | 32789a79e71fbc9e04d3eff7425e1771eb595150 | [
"MIT"
] | null | null | null | example/clone.js | johnhaley81/nodegit | 32789a79e71fbc9e04d3eff7425e1771eb595150 | [
"MIT"
] | 4 | 2017-07-10T02:49:42.000Z | 2021-09-09T09:20:20.000Z | var git = require('../'),
rimraf = require('rimraf'),
path = "/tmp/nodegit-clone-demo";
rimraf(path, function() {
git.Repo.clone("https://github.com/nodegit/nodegit.git", path, null, function(error, repo) {
if (error) throw error;
repo.getCommit('59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5', function(error, commit) {
if (error) throw error;
commit.getEntry('README.md', function(error, entry) {
if (error) throw error;
entry.getBlob(function(error, blob) {
if (error) throw error;
console.log(entry.name(), entry.sha(), blob.size() + 'b');
console.log('========================================================\n\n');
var firstTenLines = blob.toString().split('\n').slice(0, 10).join('\n');
console.log(firstTenLines);
console.log('...');
});
});
});
});
}); | 32.851852 | 94 | 0.538895 |
75f9ea653a4c9cc14dd44f8ab380f67a74d92b43 | 672 | js | JavaScript | Documentation/html/class_u_forms_1_1_graphics_1_1_shape.js | moto2002/UForms | 0e2bbb2ba81884cede99f9264f323289a47e8fa1 | [
"MIT"
] | 15 | 2015-11-01T16:49:25.000Z | 2021-02-20T09:37:25.000Z | Documentation/html/class_u_forms_1_1_graphics_1_1_shape.js | corefan/UForms | 0e2bbb2ba81884cede99f9264f323289a47e8fa1 | [
"MIT"
] | null | null | null | Documentation/html/class_u_forms_1_1_graphics_1_1_shape.js | corefan/UForms | 0e2bbb2ba81884cede99f9264f323289a47e8fa1 | [
"MIT"
] | 10 | 2015-11-01T16:49:29.000Z | 2018-11-16T20:15:05.000Z | var class_u_forms_1_1_graphics_1_1_shape =
[
[ "Draw", "class_u_forms_1_1_graphics_1_1_shape.html#a5c26db7c5948b539cd83b88cdc419861", null ],
[ "m_rect", "class_u_forms_1_1_graphics_1_1_shape.html#ac5e846b6d96f03a09231e25facf6b2b5", null ],
[ "DrawColor", "class_u_forms_1_1_graphics_1_1_shape.html#acd6f6104f6e53ea55a6b9df3196f92bf", null ],
[ "DrawEarly", "class_u_forms_1_1_graphics_1_1_shape.html#a22ea785387f7ca1f6b8fdefef637f747", null ],
[ "ScreenRect", "class_u_forms_1_1_graphics_1_1_shape.html#aac8cb83a47d439c387621a6474292c7c", null ],
[ "ZIndex", "class_u_forms_1_1_graphics_1_1_shape.html#a7509db078e7dbc0d87f6c058880a9dcd", null ]
]; | 74.666667 | 106 | 0.811012 |
75fb511f10870fdd3c215754ba147fa7d7a8ff2b | 579 | js | JavaScript | src/components/MyCommandCell.js | telerik/kendo-react-redux-undo | b97a0b0f724cbce486b89d1ec209c76d082e6e6f | [
"MIT"
] | 3 | 2018-09-18T02:37:16.000Z | 2020-02-10T06:36:07.000Z | src/components/MyCommandCell.js | telerik/kendo-react-redux-undo | b97a0b0f724cbce486b89d1ec209c76d082e6e6f | [
"MIT"
] | null | null | null | src/components/MyCommandCell.js | telerik/kendo-react-redux-undo | b97a0b0f724cbce486b89d1ec209c76d082e6e6f | [
"MIT"
] | null | null | null | import React from 'react';
export default function MyCommandCell(remove) {
return class extends React.Component {
render() {
return (
<td>
<button
className="k-button k-grid-remove-command"
onClick={(e) => window.confirm('Confirm deleting: ' + this.props.dataItem.ProductName) && remove(this.props.dataItem)}>
Remove
</button>
</td>
);
}
}
}; | 34.058824 | 148 | 0.426598 |
75fcf1f7a023294a50f3aa08076bf8facbeab1e8 | 1,142 | js | JavaScript | src/game/libs/Observer.js | setdream/squarewar | ac4c7c5e578202dcffd419f16ba9b68d8bddcd01 | [
"MIT"
] | null | null | null | src/game/libs/Observer.js | setdream/squarewar | ac4c7c5e578202dcffd419f16ba9b68d8bddcd01 | [
"MIT"
] | null | null | null | src/game/libs/Observer.js | setdream/squarewar | ac4c7c5e578202dcffd419f16ba9b68d8bddcd01 | [
"MIT"
] | null | null | null | export default class Observer {
subscribers = {
any: []
}
on(type, fn, context) {
type = type || 'any';
fn = typeof fn === 'function' ? fn : context[fn];
if(typeof this.subscribers[type] === 'undefined') {
this.subscribers[type] = [];
}
this.subscribers[type].push({fn: fn, context: context || this});
}
off(type, fn, context) {
this.visitSubscribers('unsubscribe', type, fn, context);
}
fire(type, publication) {
this.visitSubscribers('publish', type, publication);
}
visitSubscribers(action, type, arg, context) {
const pubtype = type || 'any',
subscribers = this.subscribers[pubtype],
max = subscribers ? subscribers.length : 0;
for (let i = 0; i < max; i += 1) {
if(action === 'publish') {
subscribers[i].fn.call(subscribers[i].context, arg);
} else {
if(subscribers[i].fn === arg && subscribers[i].context === context) {
subscribers.splice(i, 1);
}
}
}
}
} | 28.55 | 85 | 0.501751 |
75ff039e352d6defc16d2228a6824c348a448610 | 5,612 | js | JavaScript | native_client_sdk/src/gonacl_appengine/static/bullet/scenes.js | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | native_client_sdk/src/gonacl_appengine/static/bullet/scenes.js | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | native_client_sdk/src/gonacl_appengine/static/bullet/scenes.js | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | // Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function randomCubeScene(numObjects, zwidth) {
var worldDescription = {};
worldDescription.shapes = [];
worldDescription.shapes.push({
name: 'box',
type: 'cube',
wx: 1,
wy: 1,
wz: 1
});
worldDescription.bodies = [];
for ( var i = 0; i < numObjects; i ++ ) {
var body = {};
body.shape = 'box';
body.position = {};
body.position.x = Math.random() * 30 - 15;
body.position.y = Math.random() * 50 + 10;
body.position.z = Math.random() * zwidth - (zwidth/2);
body.rotation = {};
body.rotation.x = ( Math.random() * 360 ) * Math.PI / 180;
body.rotation.y = ( Math.random() * 360 ) * Math.PI / 180;
body.rotation.z = ( Math.random() * 360 ) * Math.PI / 180;
body.mass = 1.0;
body.friction = 0.8;
worldDescription.bodies.push(body);
}
return worldDescription;
}
function randomCylinderScene(numObjects, zwidth) {
var worldDescription = {};
worldDescription.shapes = [];
worldDescription.shapes.push({
name: 'box',
type: 'cylinder',
height: 1.0,
radius: 0.5
});
worldDescription.bodies = [];
for ( var i = 0; i < numObjects; i ++ ) {
var body = {};
body.shape = 'box';
body.position = {};
body.position.x = Math.random() * 30 - 15;
body.position.y = Math.random() * 50 + 10;
body.position.z = Math.random() * zwidth - (zwidth/2);
body.rotation = {};
body.rotation.x = ( Math.random() * 360 ) * Math.PI / 180;
body.rotation.y = ( Math.random() * 360 ) * Math.PI / 180;
body.rotation.z = ( Math.random() * 360 ) * Math.PI / 180;
body.mass = 1.0;
body.friction = 0.2;
worldDescription.bodies.push(body);
}
return worldDescription;
}
function jengaScene(height) {
var worldDescription = {};
worldDescription.shapes = [];
worldDescription.shapes.push({
name: 'boxX',
type: 'cube',
wx: 5,
wy: 1,
wz: 1
});
worldDescription.shapes.push({
name: 'boxZ',
type: 'cube',
wx: 1,
wy: 1,
wz: 5
});
worldDescription.bodies = [];
var baseHeight = 0.55;
for (var i = 0; i < height; i++) {
var y = i * 1.0 + baseHeight;
if (i % 2 == 0) {
for (var j = 0; j < 5; j++) {
var z = j * 1.0;
var x = 2.5;
var body = {};
body.shape = 'boxX';
body.position = {};
body.position.x = x;
body.position.y = y;
body.position.z = z;
body.rotation = {};
body.rotation.x = 0.0;
body.rotation.y = 0.0;
body.rotation.z = 0.0;
body.mass = 1.0;
body.friction = 0.5;
worldDescription.bodies.push(body);
}
} else {
for (var j = 0; j < 5; j++) {
var z = 2.5;
var x = j * 1.0;
var body = {};
body.shape = 'boxZ';
body.position = {};
body.position.x = x;
body.position.y = y;
body.position.z = z;
body.rotation = {};
body.rotation.x = 0.0;
body.rotation.y = 0.0;
body.rotation.z = 0.0;
body.mass = 1.0;
body.friction = 0.5;
worldDescription.bodies.push(body);
}
}
}
return worldDescription;
}
function randomShapeScene(numObjects) {
var worldDescription = {};
worldDescription.shapes = [];
worldDescription.shapes.push({
name: 'stick',
type: 'cube',
wx: 1,
wy: 1,
wz: 5
});
worldDescription.shapes.push({
name: 'tube',
type: 'cylinder',
radius: 1.0,
height: 2.0
});
worldDescription.shapes.push({
name: 'sphere',
type: 'sphere',
radius: 3.0
});
worldDescription.shapes.push({
name: 'tri',
type: 'convex',
points: [
[0.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, 1.0],
[0.0, 0.0, 1.0],
[2.0, 5.0, 1.0],
[1.0, 1.0, 1.0]
]
});
var numShapes = 4;
worldDescription.bodies = [];
for (var i = 0; i < numObjects; i++) {
var body = {};
if (i % numShapes == 0) {
body.shape = 'stick';
} else if (i % numShapes == 1) {
body.shape = 'tube';
} else if (i % numShapes == 2) {
body.shape = 'sphere';
} else if (i % numShapes == 3) {
body.shape = 'tri';
}
body.position = {};
body.position.x = Math.random() * 30 - 15;
body.position.y = Math.random() * 50 + 1;
body.position.z = Math.random() * 10 - 5;
body.rotation = {};
body.rotation.x = ( Math.random() * 360 ) * Math.PI / 180;
body.rotation.y = ( Math.random() * 360 ) * Math.PI / 180;
body.rotation.z = ( Math.random() * 360 ) * Math.PI / 180;
body.mass = 1.0;
body.friction = 0.4;
worldDescription.bodies.push(body);
}
return worldDescription;
}
function loadJenga10() {
loadWorld(jengaScene(10));
}
function loadJenga20() {
loadWorld(jengaScene(20));
}
function loadRandomShapes() {
loadWorld(randomShapeScene(100));
}
function load250RandomCubes() {
loadWorld(randomCubeScene(250, 10));
}
function load500RandomCylinders() {
loadWorld(randomCylinderScene(500, 15));
}
function load1000RandomCubes() {
loadWorld(randomCubeScene(1000, 20));
}
function load2000RandomCubes() {
loadWorld(randomCubeScene(2000, 20));
}
function loadTextScene(evt) {
var txt = evt.target.result;
if (txt == undefined) {
alert('Could not load file.');
return;
}
var sceneDescription;
try {
sceneDescription = JSON.parse(txt);
} catch(e) {
alert(e);
return;
}
loadWorld(sceneDescription);
}
| 24.085837 | 73 | 0.558624 |
75ff49905a07081e143f68ab435a4a21d2643cbb | 1,163 | js | JavaScript | modules/comments/model.js | k0machi/Belligerence | e979dd3c87bd4a61b63b0f70a87e99aa54e5d234 | [
"MIT"
] | 4 | 2019-02-23T18:13:43.000Z | 2019-03-15T13:56:39.000Z | modules/comments/model.js | k0machi/Belligerence | e979dd3c87bd4a61b63b0f70a87e99aa54e5d234 | [
"MIT"
] | 35 | 2019-03-07T21:16:45.000Z | 2019-03-18T06:26:33.000Z | modules/comments/model.js | k0machi/Belligerence | e979dd3c87bd4a61b63b0f70a87e99aa54e5d234 | [
"MIT"
] | 2 | 2019-03-10T21:44:48.000Z | 2019-03-12T16:35:02.000Z | (function(){
'use strict';
module.exports = function(sequelize, DataTypes) {
var CommentsModel = sequelize.define('comments_table',
{
titleField: {
type: DataTypes.TEXT,
field: 'title'
},
bodyField: {
type: DataTypes.TEXT,
field: 'body'
},
typeField: {
type: DataTypes.STRING,
field: 'type'
},
commenterField: { // hashField
type: DataTypes.STRING,
field: 'commenterField'
},
subjectField: { // hashField
type: DataTypes.STRING,
field: 'subjectField'
},
cheersDetails: { // Dummy field that contains the hashes of all users that have cheered the content.
type: DataTypes.STRING,
field: 'cheers',
defaultValue: ""
},
hashField: {
type: DataTypes.STRING,
defaultValue: ''
}
},
{
hooks: {
beforeCreate: function(model, options) {
var md5 = require("md5"),
config = require('./../../config.js'),
newHash = (md5((Math.random(9999999))+(new Date()))).substring(0,config.db.hashSize);
model.setDataValue('hashField', newHash);
}
}
}
);
return CommentsModel;
};
})(); | 21.537037 | 104 | 0.580396 |
75fff6c8d6923d3166cb05e924df01f4d3b236e6 | 144 | js | JavaScript | src/lib.js | buithi/vue-library | ef6a61dc28d76a77c16e513aa9754c0a43881def | [
"MIT"
] | null | null | null | src/lib.js | buithi/vue-library | ef6a61dc28d76a77c16e513aa9754c0a43881def | [
"MIT"
] | null | null | null | src/lib.js | buithi/vue-library | ef6a61dc28d76a77c16e513aa9754c0a43881def | [
"MIT"
] | null | null | null | import myLibrary from './modules/vue-library/Foo'
import './assets/styles/lib.scss'
import './assets/styles/lib.styl'
export default myLibrary
| 24 | 49 | 0.770833 |
2f006e7ac5ddf2eaae710a8cdbc1cadc1ffdb084 | 5,011 | js | JavaScript | App/Containers/Restore.js | gigglewallet/giggle | f2d8518d5f0d600f9de8b3fb54663a11cead3231 | [
"Apache-1.1"
] | 5 | 2019-04-26T04:24:12.000Z | 2020-02-13T17:49:39.000Z | App/Containers/Restore.js | gigglewallet/giggle | f2d8518d5f0d600f9de8b3fb54663a11cead3231 | [
"Apache-1.1"
] | 9 | 2019-08-12T01:14:41.000Z | 2022-02-18T07:35:44.000Z | App/Containers/Restore.js | gigglewallet/giggle | f2d8518d5f0d600f9de8b3fb54663a11cead3231 | [
"Apache-1.1"
] | 5 | 2019-04-25T09:48:31.000Z | 2019-08-12T06:51:05.000Z | import React, { Component } from 'react'
import { Text, View, ScrollView } from 'react-native'
import { NextBtn } from '../Components/Buttons'
import { PhraseItem } from '../Components/TextFields'
import { ThreeStepUI } from '../Components/UI'
import { Colors, Fonts, Metrics } from '../Themes'
import styled from 'styled-components/native'
import I18n from 'react-native-i18n'
// Styles
import styles from './Styles/LaunchScreenStyles'
import { connect } from 'react-redux'
import GiggleActions from '../Redux/GiggleRedux'
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
import { is } from 'immutable'
class Restore extends Component {
state = {
switchAmount: 24,
containerHeight: 500,
isAgree: false,
phrases: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']
// phrases: 'appear caution owner absorb judge orange speed sleep worth design debris into ivory oven pulp paper saddle simple mom canyon price bike inflict style'.split(' ')
// phrases: ['index', 'life', 'scrub', 'vast', 'mixture', 'early', 'night', 'gun', 'genius', 'fault', 'silk', 'couple', 'curious', 'dragon', 'stuff', 'mother', 'task', 'dynamic', 'meat', 'word', 'convince', 'park', 'waste', 'define']
// simulator
// phrases: 'index life scrub vast mixture early night gun genius fault silk couple curious dragon stuff mother task dynamic meat word convince park waste define'.split(' ')
// real phone
// phrases: 'hundred copper milk actress sight seminar board lava unveil perfect reopen diagram desert hand history edge room midnight short beach auto finish social quote'.split(' ')
}
componentDidMount = () => {
const { is12Phrase } = this.props
if (is12Phrase) {
this.setState({
switchAmount: 12,
containerHeight: 250
})
} else {
this.setState({
switchAmount: 24,
containerHeight: 500
})
}
}
setPhrase = (idx, value) => {
let { phrases, switchAmount } = this.state
let flag = true
phrases[idx] = value.toLowerCase()
for (let i = 0; i < switchAmount; i++) {
if (phrases[i].trim() === '') {
flag = false
}
}
this.setState({ phrases: phrases, isAgree: flag })
}
saveWalletPassword = () => {
const { navigation, updateRestorePhrase } = this.props
const { phrases } = this.state
const phrase = phrases.join(' ').trim()
updateRestorePhrase(phrase)
navigation.navigate('ResetWalletPassword')
}
render () {
let { phrases, isAgree, switchAmount, containerHeight } = this.state
let PhraseLists = []
for (let i = 0; i < switchAmount; i++) {
PhraseLists.push(<PhraseItem key={i} number={i + 1} phrase={phrases[i]} idx={i} setState={this.setPhrase} />)
}
return (
<View style={styles.mainContainer} >
<TopContainer>
<View>
<Text style={{ justifyContent: 'center', color: Colors.gary2, ...Fonts.style.h8 }}>{I18n.t('enterYourRecoveryPhrase')}</Text>
</View>
<KeyboardAwareScrollView keyboardShouldPersistTaps='handled'>
<PhraseContainer height={containerHeight}>
{Metrics.screenWidth > 320
? PhraseLists
: <ScrollView>
{PhraseLists}
</ScrollView>
}
</PhraseContainer>
</KeyboardAwareScrollView>
</TopContainer>
<BottomContainer>
<View style={{ width: '100%', alignItems: 'flex-end', justifyContent: 'space-between', flexDirection: 'row' }}>
<ThreeStepUI totalSteps={3} nowStep={1} />
<NextBtn disabled={!isAgree} onPress={this.saveWalletPassword}>
{I18n.t('next')}
</NextBtn>
</View>
</BottomContainer>
</View>
)
}
}
const mapStateToProps = (state) => {
return {
restorePhrase: state.giggle.restorePhrase,
is12Phrase: state.walletStatus.is12Phrase
}
}
const mapDispatchToProps = (dispatch) => {
return {
walletPhrase: (avatarCode, password) => dispatch(GiggleActions.walletPhrase(avatarCode, password)),
walletRecovery: (avatarCode, password, mnemonic) => dispatch(GiggleActions.walletRecovery(avatarCode, password, mnemonic)),
updateRestorePhrase: (phrase) => dispatch(GiggleActions.updateRestorePhrase(phrase))
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Restore)
const PhraseContainer = styled.View`
margin-top: 24
border-radius: 12
background-color: #2b2b44
flex-wrap: wrap
width: ${Metrics.screenWidth > 320 ? 327 : 180}
flex-direction:row;
height: ${props => props.height || 256}
flex:1
`
const TopContainer = styled.View`
padding-left:24
padding-right:24
align-items:center
height:100%
width: 100%
flex: 1
`
const BottomContainer = styled.View`
height: 70
padding-top:10
width:100%
align-items: flex-start
padding-left:24
padding-right:24
`
| 33.18543 | 237 | 0.630613 |
757e24a2e29e9c57b1a19b73f19d7d063b5f65a6 | 888 | js | JavaScript | bin/dev-server.js | sungjk/react-redux-starter | 42efb506924d3e04f21c6c54d1be3d2522051034 | [
"MIT"
] | 1 | 2017-06-15T15:48:12.000Z | 2017-06-15T15:48:12.000Z | bin/dev-server.js | sungjk/react-redux-starter | 42efb506924d3e04f21c6c54d1be3d2522051034 | [
"MIT"
] | null | null | null | bin/dev-server.js | sungjk/react-redux-starter | 42efb506924d3e04f21c6c54d1be3d2522051034 | [
"MIT"
] | null | null | null | const project = require('../config/project.config');
const app = require('../server/main');
const debug = require('debug')('app:bin:dev-server');
const http = require('http');
// const fs = require('fs');
// const https = require('https');
/* eslint-disable */
// const options = {
// key: fs.readFileSync(process.cwd() + '/keys/YourKey.key'),
// cert: fs.readFileSync(process.cwd() + '/keys/YourCrt.crt'),
// ca: [
// fs.readFileSync(process.cwd() + '/keys/YourCA.crt'),
// fs.readFileSync(process.cwd() + '/keys/YourCA.crt'),
// ],
// };
/* eslint-enable */
http.createServer(app).listen(project.server_port, () => {
debug(`Server is now running at http://localhost:${project.server_port}.`);
});
// https.createServer(options, app).listen(project.ssl_server_port, () => {
// debug(`Server is now running at https://localhost:${project.ssl_server_port}.`);
// });
| 35.52 | 85 | 0.640766 |
757e55eb9db4777af6fdb15a490b1491e79363a1 | 497 | js | JavaScript | examples/polling.js | nitreojs/tamtam | 40c91a9598f4162539517aef85d1197919ad1625 | [
"MIT"
] | 7 | 2019-06-27T22:10:22.000Z | 2019-07-24T14:54:29.000Z | examples/polling.js | nitreojs/tamtam | 40c91a9598f4162539517aef85d1197919ad1625 | [
"MIT"
] | 1 | 2020-06-06T10:23:22.000Z | 2020-06-17T09:30:54.000Z | examples/polling.js | nitreojs/tamtam | 40c91a9598f4162539517aef85d1197919ad1625 | [
"MIT"
] | 2 | 2019-06-27T17:35:35.000Z | 2019-06-28T13:36:37.000Z | let { TamTam } = require('tamtam');
let tamtam = new TamTam({
token: 'CO-q7O0h33GT1FkCDyWfMGJi6RtjWIJrLVGB3l7CPR4',
});
tamtam.updates.on('message_created', async (context) => {
await context.reply('Do you see this? I can reply to your message real quick!');
});
/**
* Updates are automatically collected
* on the basis of events that were
* passed to "updates.on"
*/
tamtam.updates.startPolling().then(() => {
// eslint-disable-next-line no-console
console.log('Bot started');
});
| 24.85 | 82 | 0.690141 |
757eb875ec4716ca187e6cbbda57d3e49e243130 | 1,645 | js | JavaScript | processing-service-core/test/api/helpers/assertHelper.js | CAFDataProcessing/data-processing-service | a5b3a3446786c9067f3dc202956a47ea564c1cdf | [
"Apache-2.0"
] | 2 | 2018-12-14T09:16:55.000Z | 2021-06-30T07:29:36.000Z | processing-service-core/test/api/helpers/assertHelper.js | CAFDataProcessing/data-processing-service | a5b3a3446786c9067f3dc202956a47ea564c1cdf | [
"Apache-2.0"
] | 25 | 2017-06-13T16:25:58.000Z | 2019-11-07T14:19:58.000Z | processing-service-core/test/api/helpers/assertHelper.js | CAFDataProcessing/data-processing-service | a5b3a3446786c9067f3dc202956a47ea564c1cdf | [
"Apache-2.0"
] | 8 | 2017-09-06T09:45:16.000Z | 2021-06-30T07:29:48.000Z | /*
* Copyright 2017-2018 Micro Focus or one of its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//Wraps the common NodeJS assert methods, adding additional functionality where necessary
var assertLibrary = require("assert");
module.exports = assertFunction;
var getActualAndExpectedText = function(actual, expected, message){
var output = "\r\nExpected: ";
output += typeof(expected==='object') ? JSON.stringify(expected) : expected;
output += "\r\nActual: ";
output += typeof(actual==='object') ? JSON.stringify(actual) : actual;
return message + output;
};
function failFunction(actual, expected, message){
assertLibrary.fail(actual, expected, getActualAndExpectedText(actual, expected, message));
}
function assertFunction(expression, message){
assertLibrary(expression, message);
}
//adds expected and actual values to the message.
function equalFunction(actual, expected, message){
assertLibrary.equal(actual, expected, getActualAndExpectedText(actual, expected, message));
}
module.exports.assert = assertFunction;
module.exports.equal = equalFunction;
module.exports.fail = failFunction; | 39.166667 | 93 | 0.756231 |
757f378aeae5dca604d3897629df325e0811c5b2 | 256 | js | JavaScript | docs/html/search/functions_3.js | Nexusmaster/PublishQueuePosixRK | c298875946b26a525911969e7d080bd15c5d2a6e | [
"MIT"
] | 3 | 2021-06-12T20:36:33.000Z | 2022-01-27T15:59:16.000Z | docs/html/search/functions_3.js | Nexusmaster/PublishQueuePosixRK | c298875946b26a525911969e7d080bd15c5d2a6e | [
"MIT"
] | 3 | 2021-06-25T04:31:53.000Z | 2022-01-28T18:10:21.000Z | docs/html/search/functions_3.js | Nexusmaster/PublishQueuePosixRK | c298875946b26a525911969e7d080bd15c5d2a6e | [
"MIT"
] | 1 | 2022-01-25T18:14:01.000Z | 2022-01-25T18:14:01.000Z | var searchData=
[
['lock_70',['lock',['../class_publish_queue_posix.html#a9e26d5d2fb67931b3505bcea140d6b6a',1,'PublishQueuePosix']]],
['loop_71',['loop',['../class_publish_queue_posix.html#a157e71d583df634b290b5ab3e08156f5',1,'PublishQueuePosix']]]
];
| 42.666667 | 117 | 0.761719 |
757f7e915dd4f1adcff332b9b0a82665b0b4077f | 408 | js | JavaScript | src/utils.js | nickvirtue/mui-components | d89892733c848a3283613e15d731a5c633418456 | [
"MIT"
] | null | null | null | src/utils.js | nickvirtue/mui-components | d89892733c848a3283613e15d731a5c633418456 | [
"MIT"
] | null | null | null | src/utils.js | nickvirtue/mui-components | d89892733c848a3283613e15d731a5c633418456 | [
"MIT"
] | null | null | null | export const pluralise = (label, count) => `${label}${count !== 1 ? 's' : ''}`
export const supplant = (str, dict) =>
str.replace(/{([^{}]*)}/g,
(a, b) => {
const r = dict[b]
return typeof r === 'string' || typeof r === 'number' ? r : a
}
)
export const cleanProps = ({
dispatch, theme, prepareStyles, onKeyboardFocus, // eslint-disable-line no-unused-vars
...other
}) => other
| 27.2 | 88 | 0.556373 |
757fbabf30235679eca0dc8f253428e9dbbaf093 | 5,871 | js | JavaScript | src/components/cards/cards.js | unchartedsoftware/cards | 4ff0f90c2ff64e69faa0637d6115f06afaf7f5ac | [
"Apache-2.0"
] | 13 | 2019-06-12T20:33:54.000Z | 2022-01-07T23:27:02.000Z | src/components/cards/cards.js | unchartedsoftware/cards | 4ff0f90c2ff64e69faa0637d6115f06afaf7f5ac | [
"Apache-2.0"
] | 12 | 2019-06-05T11:54:19.000Z | 2022-03-29T16:38:51.000Z | src/components/cards/cards.js | unchartedsoftware/cards | 4ff0f90c2ff64e69faa0637d6115f06afaf7f5ac | [
"Apache-2.0"
] | 9 | 2019-10-17T13:12:17.000Z | 2021-01-13T22:24:52.000Z | /*
* Copyright 2018 Uncharted Software Inc.
*/
import cardsTemplate from './cards.handlebars';
import InlineCardsView from '../inlineCardsView/inlineCardsView';
import WrappedCardsView from '../wrappedCardsView/wrappedCardsView';
import Card from '../card/card';
import { IBindable } from '../../util';
import { DEFAULT_CONFIG } from '../constants';
export default class Cards extends IBindable {
constructor(config = {}) { // eslint-disable-line
super();
this._initInlineCardsView();
this._initWrappedCardsView();
this.reset(config);
}
_initInlineCardsView() {
this.inlineCardsView = new InlineCardsView({ config: this._config });
this.inlineCardsView.postRender = () => {
this._fadeOutOverflowingCardMetadataTexts(this.inlineCardsView.cardsInViewPort);
};
this.forward(this.inlineCardsView);
}
_initWrappedCardsView() {
this.wrappedCardsView = new WrappedCardsView({ config: this._config });
this.wrappedCardsView.postRender = () => {
this._fadeOutOverflowingCardMetadataTexts(this.wrappedCardsView.cardInstances);
};
this.forward(this.wrappedCardsView);
}
_initMoreCards(cardsData) {
const cardsInstances = cardsData.map(data => {
const card = new Card({ data, config: Object.assign({}, this._config, {
'card.height': this.inlineMode ? null : this._config['card.height'],
})});
this.forward(card);
return card;
});
this.cardInstances.push(...cardsInstances);
}
_fadeOutOverflowingCardMetadataTexts(cardInstances) {
const overflowBoxElements = [];
cardInstances.forEach(card => {
const cardEle = card.$element && card.$element[0];
const textBoxElements = cardEle && cardEle.querySelectorAll('.meta-data-content .overflow-box');
[].forEach.call(textBoxElements || [], element => {
const textValueElement = element.children && element.children[0];
if (textValueElement) {
const boxWidth = element.offsetWidth;
const boxHeight = element.offsetHeight;
const valueWidth = textValueElement.offsetWidth;
const valueHeight = textValueElement.offsetHeight;
const isOverflowing = valueWidth > boxWidth || valueHeight > boxHeight;
isOverflowing && overflowBoxElements.push(element);
}
});
});
overflowBoxElements.forEach(element => element.classList.add('overflow'));
}
reset(config) {
this._config = Object.assign({}, DEFAULT_CONFIG, config);
this.cardInstances = [];
this.inlineMode = Boolean(this._config.inlineMode);
this.inlineCardsView.reset({ config: this._config });
this.wrappedCardsView.reset({ config: this._config });
return this;
}
render() {
this.$element = $(cardsTemplate({
inlineMode: this.inlineMode,
}));
this.inlineMode
? this.$element.html(this.inlineCardsView.render())
: this.$element.html(this.wrappedCardsView.render());
return this.$element;
}
resize() {
if (this.$element) {
this.inlineMode
? this.inlineCardsView.resize()
: this.wrappedCardsView.resize();
}
}
clearCards() {
this.cardInstances = [];
this.inlineCardsView.cardInstances = [];
this.wrappedCardsView.cardInstances = [];
this.inlineMode
? this.$element.html(this.inlineCardsView.render())
: this.$element.html(this.wrappedCardsView.clearCards());
}
loadData(cardsData) {
this.clearCards();
this._initMoreCards(cardsData);
this.inlineMode
? this.inlineCardsView.updateCardInstances(this.cardInstances)
: this.wrappedCardsView.renderMoreCards(this.cardInstances);
}
loadMoreData(cardsData) {
const numberOfCurrentCards = this.cardInstances.length;
this._initMoreCards(cardsData);
this.inlineMode
? this.inlineCardsView.updateCardInstances(this.cardInstances)
: this.wrappedCardsView.renderMoreCards(this.cardInstances.slice(numberOfCurrentCards));
}
findCardById(cardId) {
return this.cardInstances.find(card => card.data.id === cardId);
}
/**
* Open a reader for the provided card
* @param {Object} card - card instance whose reader will be opened.
*/
openReader(card) {
this.inlineMode
? this.inlineCardsView.openReader(card)
: this.wrappedCardsView.openReader(card);
}
closeReader() {
this.inlineMode
? this.inlineCardsView.closeReader()
: this.wrappedCardsView.closeReader();
}
toggleInlineDisplayMode(state) {
this.closeReader();
this.inlineMode = state === undefined ? !this.inlineMode : state;
this.cardInstances.forEach(card => {
card.$element && card.$element.remove() && (card.$element = undefined);
card._config['card.height'] = this.inlineMode ? null : this._config['card.height'];
});
this.inlineMode
? this.$element.html(this.inlineCardsView.render()) && this.inlineCardsView.updateCardInstances(this.cardInstances)
: this.$element.html(this.wrappedCardsView.clearCards()) && this.wrappedCardsView.renderMoreCards(this.cardInstances);
}
updateReaderContent(card, readerContentData) {
this.inlineMode
? card.updateReaderContent(readerContentData)
: this.wrappedCardsView.verticalReader.updateReaderContent(card, readerContentData);
}
}
| 37.158228 | 130 | 0.62187 |
758014ad87e438d76497ad9541c014c41ea6e2a0 | 203 | js | JavaScript | src/utils/easeInOutQuint.js | patrickfatrick/audio-book-react | 02b06e2fa3635444ffbdf8a3cf8dd0556f622cba | [
"MIT"
] | 5 | 2017-10-22T22:13:41.000Z | 2022-01-02T20:12:12.000Z | src/utils/easeInOutQuint.js | patrickfatrick/audio-book-react | 02b06e2fa3635444ffbdf8a3cf8dd0556f622cba | [
"MIT"
] | 4 | 2020-07-16T15:43:45.000Z | 2022-02-26T09:02:10.000Z | src/utils/easeInOutQuint.js | patrickfatrick/audio-book-react | 02b06e2fa3635444ffbdf8a3cf8dd0556f622cba | [
"MIT"
] | null | null | null | // See https://github.com/danro/easing-js/blob/master/easing.js
export default function easeInOutQuint(pos) {
if ((pos) < 1) {
return 0.5 * (pos ** 5);
}
return 0.5 * (((pos - 2) ** 5) + 2);
}
| 25.375 | 63 | 0.581281 |
75819d17140d11a85e917fd691f93280af7faade | 22,072 | js | JavaScript | fusioncharts-dist-develop/vendors/fc-maps/src/dataset/markers/index.js | DeroMal/SmartSepticTank | 6a9abd4cdbf13af29eaeb88b1d8bf2fa84377e43 | [
"MIT"
] | 2 | 2021-08-03T07:52:16.000Z | 2021-09-30T10:29:14.000Z | fusioncharts-dist-develop/vendors/fc-maps/src/dataset/markers/index.js | DeroMal/SmartSepticTank | 6a9abd4cdbf13af29eaeb88b1d8bf2fa84377e43 | [
"MIT"
] | null | null | null | fusioncharts-dist-develop/vendors/fc-maps/src/dataset/markers/index.js | DeroMal/SmartSepticTank | 6a9abd4cdbf13af29eaeb88b1d8bf2fa84377e43 | [
"MIT"
] | 1 | 2021-08-06T09:48:49.000Z | 2021-08-06T09:48:49.000Z | import Entities from'../entities';import KdTree from'../../../../fc-charts/src/dataset/_internal/kdtree';import Annotation from'../../../../fc-features/src/annotation/ext-annotation';import{addDep}from'../../../../fc-core/src/dependency-manager';import mapsAnimation from'../_internal/map-entities.animation';import{pluck,extend2,parseTooltext,pluckNumber,parseUnsafeString}from'../../../../fc-core/src/lib';import{raiseEventGroup}from'../../../../fc-core/src/event-api';import{priorityList}from'../../../../fc-core/src/schedular';let UNDEF,BLANK='',POSITION_TOP='top',POSITION_BOTTOM='bottom',POSITION_RIGHT='right',POSITION_LEFT='left',POSITION_MIDDLE='middle',POSITION_CENTER='center',INNERRADIUSFACTOR=.6,math=window.Math,mathMin=math.min,mathMax=math.max,MARKER_ITEM_KEY='items',hoverFn=function(a){let b,c=this,d=c.getFromEnv('chart'),e=c.getChildren('mapAnnotations')[0],f=a.markerShape,g=f.groupConfig,h=f.data('unfilteredConfig'),i=h._markerEventArgs,j=a.config;h.hovereffect&&('circle'===f.config.type&&(b=extend2({fillcolor:h.hoverfillcolor,fillalpha:h.hoverfillalpha,fillangle:h.hoverfillangle,fillratio:h.hoverfillratio,gradientUnits:'objectBoundingBox',radialGradient:1},h._hoverattrs)),b=extend2({},h._hoverattrs),e.update(f.getId(),b)),i||(i=h._markerEventArgs={x:+h.x,y:+h.y,scaledX:h.x*g.scaleX,scaledY:h.y*g.scaleY,chartX:h.x*g.scaleX+g.grpXShift,chartY:h.y*g.scaleY+g.grpYShift,id:h.id,label:h.label}),raiseEventGroup(j.options.id,'markerRollOver',i,d.getFromEnv('chartInstance'),j,UNDEF,UNDEF,UNDEF)},hoverOutFn=function(a){let b,c=this,d=c.getFromEnv('chart'),e=c.getChildren('mapAnnotations')[0],f=a.markerShape,g=f.getElement(),h=a.config,i=f.data('unfilteredConfig');g&&i.hovereffect&&('circle'===f.config.type&&(b=extend2({fillcolor:f.config.rawColor,fillalpha:f.config.rawAlpha,fillangle:f.config.rawAngle,fillratio:f.config.rawRatio,gradientUnits:'objectBoundingBox',radialGradient:'radial'===f.config.rawFillPattern},i._defaultattrs)),b=extend2({},i._defaultattrs),e.update(f.getId(),b)),raiseEventGroup(h.id,'markerRollOut',i._markerEventArgs,d.getFromEnv('chartInstance'),UNDEF,UNDEF,UNDEF)},clickFn=function(a,b){let c=this,d=b.config.options,e=c.getFromEnv('chart'),f=b.markerShape,g=f.config,h=f.groupConfig,i=c.getFromEnv('linkClickFN'),j=f.config.link,k=g._markerEventArgs;j&&i&&i.call({link:j},!0),k||(k=g._markerEventArgs={x:+g.x,y:+g.y,scaledX:g.x*h.scaleX,scaledY:g.y*h.scaleY,chartX:g.x*h.scaleX+h.grpXShift,chartY:g.y*h.scaleY+h.grpYShift,id:d.id,label:d.label}),e.fireChartInstanceEvent('markerClick',k,a)},convertToObj=function(a,b){let c,d=a&&a.length||!1,e=b||'id',f={};if(!a)return a;for(;d--;)c=a[d],c[e]!==UNDEF&&(f[c[e].toLowerCase()]=c);return f};addDep({name:'mapsAnimation',type:'animationRule',extension:mapsAnimation});class Markers extends Entities{constructor(){super(),this.components={},this.getLabelAlignment={top:function(a,b,c){return{x:a.toString(),y:(b-c).toString(),align:POSITION_CENTER,valign:POSITION_TOP}},left:function(a,b,c){return{x:(a-c).toString(),y:b.toString(),align:POSITION_RIGHT,valign:POSITION_MIDDLE}},right:function(a,b,c){return{x:(a+c).toString(),y:b.toString(),align:POSITION_LEFT,valign:POSITION_MIDDLE}},bottom:function(a,b,c){return{x:a.toString(),y:(b+c).toString(),align:POSITION_CENTER,valign:POSITION_BOTTOM}},center:function(a,b){return{x:a.toString(),y:b.toString(),align:POSITION_CENTER,valign:POSITION_MIDDLE}}},this.getWrapWidth={right:function(){return arguments[1]},left:function(a,b){return a-b},center:function(a,b){return 2*mathMin(b,a-b)}},this.getWrapHeight={top:function(){return arguments[1]},middle:function(a,b){return 2*mathMin(b,a-b)},bottom:function(a,b){return a-b}},this.hoverFn=hoverFn,this.hoverOutFn=hoverOutFn,this.clickFn=clickFn}getName(){return'markers'}getType(){return'dataset'}configureAttributes(a){if(!a)return;this.JSONData=a;let b,c=this,d=c.getChildren('mapAnnotations')&&c.getChildren('mapAnnotations')[0],e=c.getFromEnv('chart'),f=e.config.markerOpts;d||(b=new Annotation,c.attachChild(b,'mapAnnotations'),d=c.getChildren('mapAnnotations')[0]),d.destroy(),c.calculateDataLimits(),f.dataEnabled?this._parseMarkers():this.defineMarkersNShapes(),this.configureConnectors()}calculateMarkerRadiusLimits(){if(this.JSONData){let a=this,b=a.JSONData,c=a.config,d=a.getFromEnv('chart'),e=d.config.width,f=d.config.height,g=b.markermaxradius,h=b.markerminradius,i=Markers.getMarkerRadiusLimits(e,f,g,h);c.minRadius=i.min,c.maxRadius=i.max}}calculateDataLimits(){let a,b,c,d,e,f=this,g=f.getFromEnv('chart'),h=f.config,j=g.jsonData,k=j.markers||{},l=k[MARKER_ITEM_KEY]||[],m=this.getFromEnv('number-formatter'),n=+Infinity,o=-Infinity;for(e=0,c=l.length;e<c;e++)a=l[e],d=a.value,b=m.getCleanValue(d),null!==b&&(n=mathMin(b,n),o=mathMax(b,o));h.min=n,h.max=o}_parseMarkers(){let a,b,c,d,e,f,g,h,j=this,k=j.getFromEnv('chart'),l=k.jsonData,m=l.markers,n=m[MARKER_ITEM_KEY],o=m.shapes,p=k.config.markerOpts,q=this.getFromEnv('number-formatter'),r=j.components.shapeObjs={},s=j.components.markerObjs={};if(n&&n.length){if(o&&o.length)for(b=o.length;b;b-=1)d=o[b-1],(h=d.id.toLowerCase())&&(r[h]=d);for(b=n.length;b--;)d=n[b],(h=d.id&&d.id.toLowerCase())&&(a=d.value,a!==UNDEF&&''!==a&&(a=parseFloat(a)),c=Markers._initializeMarkerItem(h,d,null,k),e=c.config.options.shapeid,e&&'string'==typeof e&&(e=e.toLowerCase()),f=c.config,g=f.options,f.cleanValue=q.getCleanValue(a),f.formattedValue=null===f.cleanValue?UNDEF:q.dataLabels(a),f.fillColor=pluck(g.fillcolor,g.color,p.fillColor),f.fillAlpha=pluck(g.fillalpha,g.alpha,p.fillAlpha),f.fillRatio=pluck(g.fillratio,p.fillRatio),f.fillAngle=pluck(g.fillangle,p.fillAngle),f.borderThickness=pluckNumber(g.borderthickness,p.borderThickness),f.borderColor=pluck(g.bordercolor,p.borderColor),f.borderAlpha=pluck(g.borderalpha,p.borderAlpha),f.labelPadding=g.labelpadding||p.labelPadding,d.__hideMarker&&(c._isHidden=!0),e&&(c.shapeObj=r[e]),s[h]=c)}}defineMarkersNShapes(){let a,b,c,d,e,f,g,h,j=this,k=j.getFromEnv('chart'),l=k.jsonData,m=l.markers,n=m.definition,o=this.getFromEnv('number-formatter'),p=k.config.markerOpts,q=convertToObj(n)||{},r=convertToObj(m.application)||{},s=m.shapes,t=j.components.shapeObjs=j.components.shapeObjs||(j.components.shapeObjs={}),u=j.components.markerObjs=j.components.markerObjs||(j.components.markerObjs={}),v={},w={};if(n&&n.length){for(d in t)v[d]=!1;for(d in u)w[d]=!1;if(s&&s.length)for(d=s.length;d;d-=1)f=s[d-1],(h=f.id.toLowerCase())&&(t[h]=f,v[h]=!0);for(h in q)f=q[h],e=u[h]=Markers._initializeMarkerItem(h,f,r[h],k),w[h]=!0,g=e.config.options.shapeid,b=e.config,c=f.value,b.cleanValue=o.getCleanValue(c),a=b.options,b.formattedValue=null===b.cleanValue?UNDEF:o.dataLabels(c),b.fillColor=pluck(a.fillcolor,a.color,p.fillColor),b.fillAlpha=pluck(a.fillalpha,a.alpha,p.fillAlpha),b.fillRatio=pluck(a.fillratio,p.fillRatio),b.fillAngle=pluck(a.fillangle,p.fillAngle),b.borderThickness=pluckNumber(a.borderthickness,p.borderThickness),b.borderColor=pluck(a.bordercolor,p.borderColor),b.borderAlpha=pluck(a.borderalpha,p.borderAlpha),b.labelPadding=a.labelpadding||p.labelPadding,b.options.tooltext=pluck(a.tooltext,p.tooltext),b.link=a.link,g&&(e.shapeObj=t[g.toLowerCase()]);for(d in v)v[d]||delete t[d];for(d in u)w[d]||delete u[d]}}static getMarkerRadiusLimits(a,b,c,d){let e=mathMin(a,b),f=.02;return d=parseFloat(d),c=parseFloat(c),isNaN(d)||isNaN(c)?isNaN(d)?isNaN(c)?{min:f*e,max:f*3.5*e}:{min:parseInt(c/10,10),max:c}:{min:d,max:10*d}:d<c?{min:d,max:c}:{min:c,max:d}}getDataLimits(){let a=this,b=a.config;return{min:b.min,max:b.max}}static _initializeMarkerItem(a,b,c){let d,e={},f=e.config;return f||(f=e.config={}),f.id=a,f.definition=b,f.application=c,f.hasValue=null,f.value=null,f.options=null,f.label=null,f.markerShape=null,f.markerLabel=null,f.drawOptions={shape:null,label:null},f.drawComplete=!1,d=e.config.options=extend2({},f.definition),f.dataEnabled?!isNaN(d.value)&&''!==d.value&&(e.value=parseFloat(d.value),e.hasValue=!0):f.applyAll?f.options=extend2(d,f.application):c&&(f.options=extend2(d,f.application)),e}configureConnectors(){let a,b,c,d,e,f,g,h,j,k,l,m,n,o,p,q=this,r=q.getFromEnv('chart'),s=q.getChildren('mapAnnotations')[0],t=r.jsonData,u=q.components,v=t.markers||{},w=v.connector||v.connectors||[],x=u.markerObjs,y=w.length,z=q.components.connectors,A=function(a){return function(b){let c=this,d=c.data('unfilteredConfig');d.hoverEffect&&s.update(c.getId(),d._hoverAttrs),r.fireChartInstanceEvent('connectorrollover',a,b)}},B=function(a){return function(b){let c=this,d=c.data('unfilteredConfig');d.hoverEffect&&s.update(c.getId(),d._defaultAttrs),r.fireChartInstanceEvent('connectorrollout',a,b)}},C=function(a){return function(b){r.fireChartInstanceEvent('connectorClick',a,b)}},D=r.config.connectorOpts,E={};for(z=q.components.connectors=[],p=0;p<y;p++)(o=w[p],o.from||o.to)&&(c=x[o.from.toLowerCase()],d=x[o.to.toLowerCase()],c&&d)&&(e=w[p].label,E=z[p],E||(E=z[p]={}),E.config||(a=E.config={}),E.graphics||(E.graphics={}),a=E.config=extend2({},o),a.fromMarker=c,a.toMarker=d,a.link=o.link,a.showTooltip=pluckNumber(o.showtooltip,D.showTooltip),f=a.tooltext=a.showTooltip?pluck(o.tooltext,D.tooltext):BLANK,g=a.thickness=pluck(o.thickness,D.thickness),h=a.color=pluck(o.color,D.color),j=a.alpha=pluck(o.alpha,D.alpha),a.hoverEffect=pluckNumber(o.showhovereffect,D.showHoverEffect),k=pluck(o.hovercolor,D.hoverColor,h),l=pluck(o.hoveralpha,D.hoverAlpha,j),m=pluck(o.hoverthickness,D.hoverThickness,g),a.dashed=pluck(o.dashed,D.dashed),a.dashLen=pluckNumber(o.dashlen,D.dashlen),a.dashGap=pluckNumber(o.dashgap,D.dashgap),f&&(a.tooltext=f=parseUnsafeString(parseTooltext(f,[3,40,41,42,43],{label:e,fromId:c.config.definition.id,toId:d.config.definition.id,fromLabel:c.config.definition.label,toLabel:d.config.definition.label},b))),a.eventArgs={fromMarkerId:c.config.id,toMarkerId:d.config.id,label:e},a._hoverAttrs={color:k,alpha:l,thickness:m},a._defaultAttrs={color:h,alpha:j,thickness:g},a.type='line',a.onclick=C(a.eventArgs),a.onmouseover=A(a.eventArgs),a.onmouseout=B(a.eventArgs),e&&(n=E.labelConfig,!n&&(n=E.labelConfig={}),n.type='text',n.text=e,n.align=POSITION_CENTER,n.valign=POSITION_MIDDLE,n.font=D.font,n.fillcolor=D.fontColor,n.bgcolor=D.labelBgColor,n.bordercolor=D.labelBorderColor,n.tooltext=a.tooltext))}draw(){let a,b,c,d,e,f,g,h,j=this,k=j.getFromEnv('chart'),l=j.config,m=j.getChildren('mapAnnotations')[0],n=j.components.markerObjs,o=k.config,p=o.markerOpts,q=o.scalingParams,r=k.config.annotationConfig,s=[],t=[],u={},v={};for(e in m.destroy(),j.createContainer(),j._drawConnectors(),j.imageLoadCount=0,j.imageCount=0,l.autoScale=p.autoScale?q.sFactor:1,n)(a=null,b=n[e],d=b.config,d.conIsHidden||(a=this._drawMarkerItem(b)),!!a)&&(v[e]=a,d._annotationIndex=s.length,u[e]=b,a.markerShape&&(c=Object.assign({align:'center',valign:'middle',animationLabel:'markerItem',autoscale:'image'===a.markerShape.type?0:1},a.markerShape),s.push(c)),a.markerLabel&&(c=Object.assign({animationLabel:'markerItem',id:a.markerShape.id},a.markerLabel),t.push(c)));for(e in h=m.addGroup(Object.assign(r,{id:'markers',fillalpha:'100',items:s,scaleimages:1}),j),g=m.addGroup(Object.assign(r,{id:'markerLabels',items:t,scaleimages:1}),j),j.components.markerGroup=h,j.components.markerLabelGroup=g,f=0,n)v[e]&&(b=n[e],b.markerShape=h.retrieveItem(s[f].id),b.markerShape.data('unfilteredConfig',s[f]),v[e].markerLabel&&(b.markerLabel=g.retrieveItem(s[f].id),b.markerLabel.data('unfilteredConfig',t[f])),f++);j.addJob('buildKdtree',j._buildKdTree.bind(j),priorityList.kdTree)}_buildKdTree(){let a,b,c=this,d=c.components.kdArrayMap,e=c.components.markerGroup,f=[],g=e&&e.items,h=g&&g.length||0;for(b=0;b<h;b++)a=g[b].config.id,d[a]&&f.push(d[a]);c.components.kDTree||(c.components.kDTree=new KdTree(!0)),c.components.kDTree._setSearchLimit(1/0,1/0),c.components.kDTree.buildKdTree(f)}_drawMarkerItem(a){let b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t=this,u=t.getFromEnv('chart'),v=u.config,w=t.config,x=v.scalingParams,y=a.config,z=y.options,A=y.definition,B=v.markerOpts,C=B.dataLabels.style,D=z.shapeid,E=z.scale||1,F=z.label||BLANK,G=u.config.scalingParams.scaleFactor*u.config.baseScaleFactor,H=(z.labelpos||POSITION_TOP).toLowerCase(),I=y.formattedValue===UNDEF?UNDEF:y.formattedValue,J=z.tooltext||B.tooltext,K=pluckNumber(A.radius,y.radius,B.radius)*E*w.autoScale||1e-4,L=y.fillColor,M=y.fillAlpha,N=y.fillRatio,O=y.fillAngle,P=y.borderThickness,Q=y.borderColor,R=y.borderAlpha,S=t.getChildren('mapAnnotations')[0],T=t.components.kdArrayMap||(t.components.kdArrayMap={}),U=a.config.id;if(y.autoScale=B.autoScale?G:1,!!D)return(J=J?parseUnsafeString(parseTooltext(J,[1,2,3],{formattedValue:I,label:F},z)):I?F+B.tooltipSepChar+I:F,I!==UNDEF&&null!==I?F=F+B.labelSepChar+I:isNaN(E)?E=1:0>E?E=0:5<E&&(E=5),extend2(z,{x:z.x&&z.x.toString(),y:z.y&&z.y.toString(),fillcolor:L,fillalpha:M,fillratio:N,fillangle:O,borderthickness:P,bordercolor:Q,borderalpha:R,hovereffect:pluck(B.showHoverEffect),radius:K&&K.toString(),link:z.link,showshadow:pluckNumber(z.showshadow,y.shadow),_markerLabel:F,_markerId:z.id,id:(z.id+BLANK).toLowerCase()}),delete z.tooltext,y.tooltext=!!B.showTooltip&&J,n=+z.x*x.sFactor+x.translateX,o=+z.y*x.sFactor+x.translateY,K=z.radius,'triangle'===D?(extend2(z,{type:'polygon',sides:3,startangle:B.startAngle}),s='polygon',r=3):'diamond'===D?(extend2(z,{type:'polygon',sides:4,startangle:B.startAngle}),s='polygon',r=4):'arc'===D?(q=K*INNERRADIUSFACTOR,extend2(z,{type:'arc',startangle:0,endangle:360,innerradius:q}),s='arc'):'circle'===D?(z.type='circle',s='circle'):(l=t.getShapeArgs.call(a),B.dataEnabled&&B.valueToRadius&&z.radius!==UNDEF?delete l.radius:(!l.radius&&(l.radius=B.radius),l.radius*=E*y.autoScale),extend2(z,l),z.id=z._markerId&&z._markerId.toLowerCase(),q=l.innerradius,l.radius&&(K=l.radius),s=l.type&&l.type.toLowerCase(),r=l.sides,K=+K,K&&q&&K<q&&(m=K,z.radius=K=q,z.innerradius=q=m)),z.type=z.type&&z.type.toLowerCase(),extend2(z,{hoverfillcolor:pluck(z.fillhovercolor,B.hoverFillColor,z.fillcolor),hoverfillalpha:pluck(z.fillhoveralpha,B.hoverFillAlpha,z.fillalpha),hoverfillratio:pluck(z.fillhoverratio,B.hoverFillRatio,z.fillratio),hoverfillangle:pluck(z.fillhoverangle,B.hoverFillAngle,z.fillangle),hoverborderthickness:pluckNumber(z.borderhoverthickness,B.hoverBorderThickness,z.borderthickness),hoverbordercolor:pluck(z.borderhovercolor,B.hoverBorderColor,z.bordercolor),hoverborderalpha:pluck(z.borderhoveralpha,B.hoverBorderAlpha,z.borderalpha)}),z._hoverattrs={fillalpha:z.hoverfillalpha,fillcolor:z.hoverfillcolor,fillangle:z.hoverfillangle,fillratio:z.hoverfillratio,borderThickness:'0'===z.showborder?0:z.hoverborderthickness,borderColor:z.hoverbordercolor,borderAlpha:z.hoverborderalpha},z._defaultattrs={fillalpha:z.fillalpha,fillcolor:z.fillcolor,fillangle:z.fillangle,fillratio:z.fillratio,borderThickness:'0'===z.showborder?0:z.borderthickness,borderColor:z.bordercolor,borderAlpha:z.borderalpha},'image'===z.type?(z.borderthickness=z.borderthickness||0,z.onload=function(b){let c=this,d=b.width,e=b.height;p={},z=c.config,n=(+z.derivedX-d/(2*x.sFactor))*x.sFactor,o=(+z.derivedY-e/(2*x.sFactor))*x.sFactor,p=T[U]||(T[U]={}),p.x=n+x.translateX,p.y=o+x.translateY,p.element=a,p.shapeInfo={type:'rect',width:d,height:e},d&&e&&S.update(c.getId(),{x:n,y:o,width:d,height:e,autoscale:0}),t.imageLoadCount++,t.imageLoadCount===t.imageCount&&t._buildKdTree()},z.onerror=function(){t.imageLoadCount++,t.imageLoadCount===t.imageCount&&t._buildKdTree()},t.imageCount++):(p=T[U]||(T[U]={}),p.x=n,p.y=o,p.element=a,p.shapeInfo={type:s,sides:r,radius:+K+z.borderthickness/2,innerradius:q}),y.drawOptions.shape=z,!B.showLabels)?{markerShape:z}:(k=z.labelpadding||B.labelPadding,b=t._getLabelOptions(H,k,z),c=b.align,d=b.valign,e=y._labelBaseWidth,f=y._labelBaseHeight,g=y._labelXOffset,h=y._labelYOffset,i=B.labelWrapWidth?B.labelWrapWidth:t.getWrapWidth[c](e,+b.x+g),j=B.labelWrapHeight?B.labelWrapHeight:t.getWrapHeight[d](f,+b.y+h),i>k&&(i-=k),j>k&&(j-=k),y.drawOptions.label='center'===c&&'middle'===d?extend2({type:'text'},{text:F,tooltext:z.tooltext,x:b.x,y:b.y,align:c,valign:b.valign,wrap:1,wrapwidth:i,wrapheight:j,fontsize:C.fontSize/x.sFactor,font:C.fontFamily,fillcolor:C.fontColor}):extend2({type:'text'},{text:F,tooltext:z.tooltext,x:b.x,y:b.y,align:c,valign:b.valign,wrap:1,wrapwidth:i,wrapheight:j,fontsize:C.fontSize/x.sFactor,font:C.fontFamily,fillcolor:C.fontColor}),{markerShape:z,markerLabel:y.drawOptions.label})}highlightPoint(a,b){let c=a.element,d=this,e=b.originalEvent,f=d.getFromEnv('chart'),g=d.getFromEnv('toolTipController'),h=d.config.currentToolTip,i=f.config.lastHoveredPoint;i&&i!==a&&(i&&d.hoverOutFn(i.element),f.config.lastHoveredPoint=null,g.hide(h));!1===a||('click'===b.type||'touchstart'===b.type?(f.config.lastHoveredPoint!==a&&d.hoverFn(c),d.clickFn(b,c)):'mousemove'===b.type&&f.config.lastHoveredPoint!==a&&d.hoverFn(c),c.config.tooltext&&(h?g.draw(e,c.config.tooltext,h):h=d.config.currentToolTip=g.draw(e,c.config.tooltext)),f.config.lastHoveredPoint=a)}_drawConnectors(){let a,b,c,d,e,f,g,h,k,l,m,n,o,p=this,q=p.getFromEnv('chart'),r=q.config.annotationConfig,s=p.components,t=s.connectors||(p.components.connectors=[]),u=t.length,v=q.config.scalingParams,w=q.config.connectorOpts,z=w.showLabels,A=p.getChildren('mapAnnotations')[0],B=[],C=[],D=[],E={};for(D.push({id:'connectorLabels',fillalpha:'100',items:C}),D.push({id:'connectors',fillalpha:'100',items:B}),c=0;c<u;c++)t[c]&&(E[c]=!0,k=t[c].config.fromMarker.config,l=t[c].config.toMarker.config,e=k.options.x,f=k.options.y,g=l.options.x,h=l.options.y,t[c].config.x=e,t[c].config.y=f,t[c].config.tox=g,t[c].config.toy=h,o=Object.assign({animationLabel:'markerItem'},t[c].config),B.push(o),t[c].labelConfig&&z&&(t[c].labelConfig.x=((+e+ +g)/2).toString(),t[c].labelConfig.y=((+f+ +h)/2).toString(),t[c].labelConfig.fontsize=w.fontSize/(v.scaleFactor*q.config.baseScaleFactor),o=Object.assign({animationLabel:'markerItem'},t[c].labelConfig),C.push(o)));for(m=A.addGroup(Object.assign(r,D[1]),p),n=A.addGroup(Object.assign(r,D[0]),p),(c=0,d=0);c<u;c++)E[c]&&(a=m.items[d],a&&(a.data('unfilteredConfig',B[d]),a.addEventListener('fc-mouseover',t[c].config.onmouseover),a.addEventListener('fc-mouseout',t[c].config.onmouseout),a.addEventListener('fc-click',t[c].config.onclick)),t[c].labelConfig&&z&&(b=n.items[d],b&&b.data('unfilteredConfig')),d++)}getShapeArgs(){let a,b=this,c=b.config,d=extend2({},b.shapeObj);return c.autoScale=1,d?('polygon'===d.type?3>d.sides?d.type='circle':d.startangle=c.startAngle:'arc'===d.type&&(a=(d.radius||c.markerRadius)*c.autoScale,d.radius=a,d.innerradius=d.innerradius&&d.innerradius*c.autoScale||a*INNERRADIUSFACTOR),d):null}_getLabelOptions(a,b,c,d,e){let f,g,h,i=this,j=a&&a.toLowerCase();return i.getLabelAlignment[j]||(j='center'),g=+c.x,h=+c.y,f=d===UNDEF||e===UNDEF?c.radius||0:/^(top|bottom)$/ig.test(j)&&.5*e||/^(left|right)$/ig.test(j)&&.5*d||0,f=+f+ +b,i.getLabelAlignment[j](g,h,f)}addMarkerItem(a){let b,c,d,e,f,g,h,i=this,j=i.getFromEnv('chart'),k=a,l=i.components.markerObjs,m=i.components.shapeObjs,n=i.components.markerGroup,o=i.components.markerLabelGroup,p=i.getChildren('mapAnnotations')[0],q=i.getFromEnv('number-formatter'),r=j.config.markerOpts;if(h=k.id.toLowerCase()){if(l[h])return;delete k.value,i.imageLoadCount=0,b=Markers._initializeMarkerItem(h,k,null),b.dataset=i,g=b.config.options.shapeid,d=b.config,f=k.value,d.cleanValue=q.getCleanValue(f),a=d.options,d.formattedValue=null===d.cleanValue?UNDEF:q.dataLabels(f),d.fillColor=pluck(a.fillcolor,a.color,r.fillColor),d.fillAlpha=pluck(a.fillalpha,a.alpha,r.fillAlpha),d.fillRatio=pluck(a.fillratio,r.fillRatio),d.fillAngle=pluck(a.fillangle,r.fillAngle),d.borderThickness=pluckNumber(a.borderthickness,r.borderThickness),d.borderColor=pluck(a.bordercolor,r.borderColor),d.borderAlpha=pluck(a.borderalpha,r.borderAlpha),d.labelPadding=a.labelpadding||r.labelPadding,d.options.tooltext=pluck(a.tooltext,r.tooltext),d.link=a.link,g&&(b.shapeObj=m[g&&g.toLowerCase()]),l[h]=b,c=i._drawMarkerItem(b),n&&o&&(c.markerShape&&(e=Object.assign({align:'center',valign:'middle',animationLabel:'markerItem',autoscale:'image'===c.markerShape.type?0:1},c.markerShape),b.markerShape=p.addItem(n.getId(),e,i),b.markerShape.data('unfilteredConfig',e)),c.markerLabel&&(e=Object.assign({animationLabel:'markerItem'},c.markerLabel),b.markerLabel=p.addItem(o.getId(),e,i),b.markerLabel.data('unfilteredConfig',e))),i._buildKdTree()}}updateMarkerItem(a,b){let c,d,e,f,g=this,h=g.getFromEnv('chart'),i=g.getChildren('mapAnnotations')[0],j=g.components.markerObjs,k=h.config.markerOpts,l={},m=j[a];if(m){for(d in c=m.config.options,extend2(c,b),g.imageLoadCount=0,e=m.config,b)l[d.toLowerCase()]=b[d]&&b[d].toString();e.fillColor=pluck(l.fillcolor,l.color,k.fillColor),e.fillAlpha=pluck(l.fillalpha,l.alpha,k.fillAlpha),e.fillRatio=pluck(l.fillratio,k.fillRatio),e.fillAngle=pluck(l.fillangle,k.fillAngle),e.borderThickness=pluckNumber(l.borderthickness,k.borderThickness),e.borderColor=pluck(l.bordercolor,k.borderColor),e.borderAlpha=pluck(l.borderalpha,k.borderAlpha),e.labelPadding=l.labelpadding||k.labelPadding,e.options.tooltext=pluck(l.tooltext,k.tooltext),e.link=l.link,f=g._drawMarkerItem(m).markerShape,g._buildKdTree(),i.update(a,f)}}createContainer(){let a=this,b=a.getLinkedParent(),c=a.getFromEnv('animationManager'),d=b.getChildContainer('layer1');a.getChildContainer('abovePlotGroup')||a.addChildContainer('abovePlotGroup',c.setAnimation({el:'group',attr:{name:'abovePlotGroup',opacity:1},container:d,component:a,label:'group'})),a.getChildContainer('belowPlotGroup')||a.addChildContainer('belowPlotGroup',c.setAnimation({el:'group',attr:{name:'belowPlotGroup',opacity:1},container:d,component:a,label:'group'}))}_removeMarkerItem(a){let b,c,d=this,e=d.components,f=e.markerObjs,g=f[a],h=e.kdArrayMap,i=d.getChildren('mapAnnotations')[0];g&&(b=g.markerShape,c=g.markerLabel,b&&i.destroy(b.getId()),c&&i.destroy(c.getId()),delete h[a],d._buildKdTree()),delete f[a]}getElement(a){let b=this;if(b.components.kDTree)return b.components.kDTree.getNeighbour(a)}}export default Markers; | 22,072 | 22,072 | 0.752084 |
7581f1c8e9a58da4800275b470108ce691581aea | 4,091 | js | JavaScript | src/comps/setting/smtp.js | team4yf/yf-fpm-admin | 5322dffa003a0bdd44af4932e117cc0714f9888d | [
"MIT"
] | 1 | 2017-02-04T06:57:46.000Z | 2017-02-04T06:57:46.000Z | src/comps/setting/smtp.js | team4yf/yf-fpm-admin | 5322dffa003a0bdd44af4932e117cc0714f9888d | [
"MIT"
] | null | null | null | src/comps/setting/smtp.js | team4yf/yf-fpm-admin | 5322dffa003a0bdd44af4932e117cc0714f9888d | [
"MIT"
] | null | null | null | import React,{ Component } from 'react'
import { Link } from 'react-router'
import _ from 'lodash'
import YF from 'yf-fpm-client-nodejs'
import each from 'async/each'
import { PageTitle, TextField, Selector, Modal, Panel } from '../../controls'
class Smtp extends Component{
constructor(props) {
super(props)
this.state = {
isCreated: false,
smtp: {
server: 'qq',
user: 'user',
pass: 'pass'
}
}
}
componentDidMount(){
let query = new YF.Query('fpm_setting')
query.condition({scope: 'smtp'}).find()
.then((data)=>{
if (data.length < 1){
// no data
this.setState({isCreated: false})
}else{
let obj = {}
data.forEach((item) =>{
obj[item.name] = item.content
})
this.setState({isCreated: true, smtp: obj})
this.refs.smtpServer.setValue(obj.server)
this.refs.smtpUser.setValue(obj.user)
this.refs.smtpAuth.setValue(obj.pass)
}
})
}
onSubmitHandler(e){
e.preventDefault()
this.refs.icon.style.display = 'inline'
if(this.state.isCreated){
//modify
let rows = []
if(this.refs.smtpServer.isChanged()){
rows.push({ condition: "name='server' and scope='smtp'", row: {content: this.refs.smtpServer.getValue()}})
}
if(this.refs.smtpUser.isChanged()){
rows.push({ condition: "name='user' and scope='smtp'", row: {content: this.refs.smtpUser.getValue()}})
}
if(this.refs.smtpAuth.isChanged()){
rows.push({ condition: "name='pass' and scope='smtp'", row: {content: this.refs.smtpAuth.getValue()}})
}
if(rows.length < 1){
swal('', 'nothing changed', 'warning')
this.refs.icon.style.display = 'none'
return false
}
each(
rows, (item, callback) => {
let obj = new YF.Object('fpm_setting')
obj.getByCondition(item.condition)
.then( obj => {
return obj.save(item.row)
})
.then( data => {
callback()
})
.catch( err => {
console.log(err)
callback(err)
})
},(error) => {
if(error){
swal('', _.isString(error)? error: error.message , 'error')
}else{
//update ok
this.refs.icon.style.display = 'none'
Materialize.toast('Update Success!', 3000)
}
})
}else{
let row = [
{scope: 'smtp', name: 'server', content: this.refs.smtpServer.getValue(), },
{scope: 'smtp', name: 'user', content: this.refs.smtpUser.getValue(), },
{scope: 'smtp', name: 'pass', content: this.refs.smtpAuth.getValue(), },
]
let batch = new YF.Batch('fpm_setting')
batch.insert(row)
.then((data)=>{
this.setState({isCreated: true })
this.refs.icon.style.display = 'none'
})
}
}
render () {
return (
<div>
<PageTitle>SMTP</PageTitle>
<div id="smtp" className="container">
<Panel title="SMTP">
<form className="form-horizontal" onSubmit={this.onSubmitHandler.bind(this)}>
<TextField title="Server"
default={this.state.smtp.server}
ref="smtpServer"/>
<TextField title="User"
default={this.state.smtp.user}
ref="smtpUser"
placeholder="xxxxx@qq.com"/>
<TextField title="AuthCode"
default={this.state.smtp.pass}
ref="smtpAuth"
placeholder="Server Auth Code"/>
<div className="form-group">
<div className="col offset-s2 s10">
<button type="text" className="btn"><span ref="icon" style={{display: 'none'}} ><i className="fa fa-spin fa-circle-o-notch"></i></span> Save</button>
</div>
</div>
</form>
</Panel>
</div>
</div>
)
}
}
export default Smtp
| 30.759398 | 167 | 0.521144 |
7584064b1dad69263ab9f21919a0b615209f57a9 | 1,427 | js | JavaScript | src/pages/contact.js | miracleshaunr/reimersexcavation | 227fd8474aebc50594967c0b4001a2dfa9d391e7 | [
"MIT"
] | null | null | null | src/pages/contact.js | miracleshaunr/reimersexcavation | 227fd8474aebc50594967c0b4001a2dfa9d391e7 | [
"MIT"
] | null | null | null | src/pages/contact.js | miracleshaunr/reimersexcavation | 227fd8474aebc50594967c0b4001a2dfa9d391e7 | [
"MIT"
] | null | null | null | import React from 'react'
import Link from 'gatsby-link'
const Contact = () => (
<div className="contact-container">
<h1>Let's Talk!</h1>
<hr/>
<div className="contact-grid">
<div className="contact-info">
<ul>
<li>
<header>Reimer's Excavation</header>
</li>
<li>
P.O. Box 755 Center Rd. <br/>
Spanish Lookout, BZ C.A.
</li>
<li>
Phone: (501) 675-5442
</li>
<li>
Email: reimersexcavation@gmail.com
</li>
</ul>
<iframe src="https://www.google.com/maps/d/embed?mid=1JsNI0o8lPxnBZn9zTLerE_wOTy3ajbp-" width="640" height="300"></iframe>
</div>
<form action="https://formspree.io/miracle.shaunr@gmail.com"
method="POST">
<input type="text" name="name" placeholder="Name" id="name" required/>
<input type="email" name="_replyto" placeholder="Email" id="email"required/>
<input type="text" name="subject" placeholder="Subject" id="subject" required/>
<textarea placeholder="Message" name="message" id="message" cols="30" rows="10" required></textarea>
<button type="submit" value="Send">Send</button>
</form>
</div>
</div>
)
export default Contact
| 35.675 | 134 | 0.513665 |
75843fcc839c7a2010173561045d5d558c0c4c5d | 619 | js | JavaScript | docs/precache-manifest.78fdc23a2734fe0fec1edce467b2bbf8.js | hukusuke1007/eth-wallet | 717d538d278d9ef0aa15cd134251ea78eb61dccd | [
"MIT"
] | null | null | null | docs/precache-manifest.78fdc23a2734fe0fec1edce467b2bbf8.js | hukusuke1007/eth-wallet | 717d538d278d9ef0aa15cd134251ea78eb61dccd | [
"MIT"
] | null | null | null | docs/precache-manifest.78fdc23a2734fe0fec1edce467b2bbf8.js | hukusuke1007/eth-wallet | 717d538d278d9ef0aa15cd134251ea78eb61dccd | [
"MIT"
] | null | null | null | self.__precacheManifest = [
{
"revision": "b6216d61c03e6ce0c9aea6ca7808f7ca",
"url": "/eth-wallet/robots.txt"
},
{
"revision": "727ae87171438214e5b0",
"url": "/eth-wallet/js/chunk-vendors.0cf6ab3a.js"
},
{
"revision": "2338091b09e7dc56e517",
"url": "/eth-wallet/js/app.b829d848.js"
},
{
"revision": "08fabf9c2a51acd25b896c3abb5c7322",
"url": "/eth-wallet/index.html"
},
{
"revision": "727ae87171438214e5b0",
"url": "/eth-wallet/css/chunk-vendors.23e4ab8b.css"
},
{
"revision": "2338091b09e7dc56e517",
"url": "/eth-wallet/css/app.53f0e386.css"
}
]; | 23.807692 | 55 | 0.623586 |
75855ad9efb244a28e607ce81d0429179501d671 | 147 | js | JavaScript | dist/utilities/restrictions.js | VishalBirth/school | 3c467891db2dd6960d9efbb608bc35d4d18fb215 | [
"MIT"
] | null | null | null | dist/utilities/restrictions.js | VishalBirth/school | 3c467891db2dd6960d9efbb608bc35d4d18fb215 | [
"MIT"
] | null | null | null | dist/utilities/restrictions.js | VishalBirth/school | 3c467891db2dd6960d9efbb608bc35d4d18fb215 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.USER_TYPE = {
STUDENT: 1,
TEACHER: 2,
ADMIN: 3
};
| 18.375 | 62 | 0.632653 |
75868dd649c42f488dc202c6f033bd1dcd41ce9d | 193 | js | JavaScript | lib/node_modules/jquery/src/css/addGetHookIf.min.js | nicku8/imagely | 7304d5994533c822074cf13efd1572a5473e6caa | [
"MIT"
] | 1 | 2018-12-12T09:59:36.000Z | 2018-12-12T09:59:36.000Z | lib/node_modules/jquery/src/css/addGetHookIf.min.js | nicku8/imagely | 7304d5994533c822074cf13efd1572a5473e6caa | [
"MIT"
] | null | null | null | lib/node_modules/jquery/src/css/addGetHookIf.min.js | nicku8/imagely | 7304d5994533c822074cf13efd1572a5473e6caa | [
"MIT"
] | null | null | null | define(function(){function addGetHookIf(conditionFn,hookFn){return{get:function(){if(conditionFn()){delete this.get;return}return(this.get=hookFn).apply(this,arguments)}}}return addGetHookIf}); | 193 | 193 | 0.803109 |
758771230beaafbf79cf3e8d7f051a311e1f7daf | 503 | js | JavaScript | script.js | ARBarber0510/portfolio | e581d23bc23ac5c82f5fee824ce099c20d5c6830 | [
"Unlicense"
] | null | null | null | script.js | ARBarber0510/portfolio | e581d23bc23ac5c82f5fee824ce099c20d5c6830 | [
"Unlicense"
] | null | null | null | script.js | ARBarber0510/portfolio | e581d23bc23ac5c82f5fee824ce099c20d5c6830 | [
"Unlicense"
] | null | null | null |
// Email form
var submitBtn = document.querySelector("#submit-btn");
var nameInput = document.querySelector("#name-input");
var emailInput = document.querySelector("#email-input");
var response = document.querySelector("#response");
submitBtn.addEventListener("click", function(event) {
event.preventDefault();
var response = "Thank you for your submission " + nameInput.value + "! We will reach out to you at " + emailInput.value + ".";
submissionResponseEl.textContent = response;
}); | 26.473684 | 128 | 0.723658 |
7587b3fee97c1a7de504e30be18b0cb4538a71dd | 839 | js | JavaScript | src/models/Usuario.js | joaquinbf/WebDonarPlasmaHC | 41b100a7b0d39f13957b38947a0d3695d60b8d2a | [
"MIT"
] | 2 | 2020-11-12T17:02:46.000Z | 2022-03-01T02:32:29.000Z | src/models/Usuario.js | joaquinbf/WebDonarPlasmaHC | 41b100a7b0d39f13957b38947a0d3695d60b8d2a | [
"MIT"
] | null | null | null | src/models/Usuario.js | joaquinbf/WebDonarPlasmaHC | 41b100a7b0d39f13957b38947a0d3695d60b8d2a | [
"MIT"
] | 1 | 2020-11-12T17:02:57.000Z | 2020-11-12T17:02:57.000Z | const { model, Schema } = require('mongoose');
const bcrypt = require('bcryptjs');
const usuario_schema = new Schema(
{
nombre: {
type: String,
required: true,
},
apellido: {
type: String,
required: true,
},
email: {
type: String,
required: true,
},
password: {
type: String,
required: true,
},
user: {
type: String,
required: true,
unique: true,
},
},
{
timestamps: true,
}
);
usuario_schema.methods.encriptarPassword = async function (password) {
const salt = await bcrypt.genSalt(10);
return await bcrypt.hash(password, salt);
};
usuario_schema.methods.compararPassword = async function (password) {
return await bcrypt.compare(password, this.password);
};
module.exports = model('Usuario', usuario_schema);
| 19.511628 | 70 | 0.61025 |
7588205da7a5bd093741a524cfb5eb68384e103b | 4,728 | js | JavaScript | lists/readr/Video.js | nickhsine/openwarehouse | 50e8223b83d5de4e88c21b91e4f5eadec1512499 | [
"MIT"
] | null | null | null | lists/readr/Video.js | nickhsine/openwarehouse | 50e8223b83d5de4e88c21b91e4f5eadec1512499 | [
"MIT"
] | null | null | null | lists/readr/Video.js | nickhsine/openwarehouse | 50e8223b83d5de4e88c21b91e4f5eadec1512499 | [
"MIT"
] | 4 | 2022-01-11T02:49:55.000Z | 2022-03-30T07:31:28.000Z | const {
Text,
Checkbox,
Select,
Relationship,
File,
Url,
Integer,
} = require('@keystonejs/fields')
const NewDateTime = require('../../fields/NewDateTime/index.js')
const CustomRelationship = require('../../fields/CustomRelationship')
const ImageRelationship = require('../../fields/ImageRelationship')
const { byTracking } = require('@keystonejs/list-plugins')
const { atTracking } = require('../../helpers/list-plugins')
const { GCSAdapter } = require('../../lib/GCSAdapter')
const {
admin,
bot,
moderator,
editor,
contributor,
allowRoles,
} = require('../../helpers/access/mirror-tv')
const cacheHint = require('../../helpers/cacheHint')
const mediaUrlBase = 'assets/videos/'
const gcsDir = 'assets/videos/'
const fileAdapter = new GCSAdapter(gcsDir)
const {
getNewFilename,
getFileDetail,
} = require('../../utils/fileDetailHandler')
const {
deleteOldVideoFileInGCSIfNeeded,
feedNewVideoData,
validateWhichKeyShouldCMSChoose,
} = require('../../utils/videoHandler')
module.exports = {
fields: {
name: {
label: '標題',
type: Text,
isRequired: true,
},
youtubeUrl: {
label: 'Youtube網址',
type: Text,
},
file: {
label: '檔案',
type: File,
adapter: fileAdapter,
},
coverPhoto: {
label: '封面照片',
type: ImageRelationship,
ref: 'Image',
},
description: {
label: '描述',
type: Text,
isMultiline: true,
},
tags: {
label: '標籤',
type: Relationship,
ref: 'Tag',
many: true,
},
meta: {
label: '中繼資料',
type: Text,
adminConfig: {
isReadOnly: true,
},
},
url: {
label: '檔案網址',
type: Url,
adminConfig: {
isReadOnly: true,
},
},
duration: {
label: '影片長度(秒)',
type: Integer,
adminConfig: {
isReadOnly: true,
},
},
},
plugins: [
atTracking({
hasNowBtn: false,
isReadOnly: true,
}),
byTracking(),
],
access: {
update: allowRoles(admin, moderator, editor),
create: allowRoles(admin, moderator, editor),
delete: allowRoles(admin),
},
adminConfig: {
defaultColumns: 'name, tags, state, publishTime, createdAt',
defaultSort: '-createdAt',
},
hooks: {
validateInput: async ({
existingItem,
resolvedData,
addValidationError,
}) => {
const keyToUse = validateWhichKeyShouldCMSChoose(
existingItem,
resolvedData,
addValidationError,
fileAdapter
)
if (!keyToUse) return
switch (keyToUse) {
case 'youtubeUrl':
// video is from youtube
resolvedData.url = resolvedData.youtubeUrl
deleteOldVideoFileInGCSIfNeeded(
existingItem,
resolvedData,
fileAdapter
)
break
case 'file':
// video is from file
// if it has prev data,
// no matter what, clear youtubeUrl
if (existingItem) {
resolvedData.youtubeUrl = ''
}
await feedNewVideoData(resolvedData)
deleteOldVideoFileInGCSIfNeeded(
existingItem,
resolvedData,
fileAdapter
)
break
case 'no-need-to-update':
break
default:
break
}
},
beforeChange: async ({
existingItem,
resolvedData,
addValidationError,
}) => {
// validateWhichKeyShouldCMSChoose(
// existingItem,
// resolvedData,
// addValidationError
// )
},
afterDelete: async ({ existingItem, resolvedData }) => {
deleteOldVideoFileInGCSIfNeeded(
existingItem,
resolvedData,
fileAdapter
)
},
},
labelField: 'name',
cacheHint: cacheHint,
}
| 25.836066 | 69 | 0.461294 |
758a5c421025a3ed21036ec01455fa55a7b6f84a | 337 | js | JavaScript | server/api/index.js | devere-here/emotionalSupportDinosaurs | 1dbf98704f2d021c04005937d49775de4e113d9f | [
"MIT"
] | null | null | null | server/api/index.js | devere-here/emotionalSupportDinosaurs | 1dbf98704f2d021c04005937d49775de4e113d9f | [
"MIT"
] | null | null | null | server/api/index.js | devere-here/emotionalSupportDinosaurs | 1dbf98704f2d021c04005937d49775de4e113d9f | [
"MIT"
] | null | null | null | const router = require('express').Router()
module.exports = router
router.use('/phrases', require('./motivationalWords'));
router.use('/todolist', require('./toDoList'));
router.use('/apiRequests', require('./apiRequests'));
router.use((req, res, next) => {
const error = new Error('Not Found')
error.status = 404
next(error)
})
| 25.923077 | 55 | 0.676558 |
758c8bd678f324001b61d8cad2ee20381e716a3b | 8,498 | js | JavaScript | index.js | kirbo/rust-server-cli-rcon-scheduler | e3b0ccecbf3d781b927507791362a39c704cb0a8 | [
"MIT"
] | 1 | 2017-12-09T15:29:01.000Z | 2017-12-09T15:29:01.000Z | index.js | kirbo/rust-server-cli-rcon-scheduler | e3b0ccecbf3d781b927507791362a39c704cb0a8 | [
"MIT"
] | null | null | null | index.js | kirbo/rust-server-cli-rcon-scheduler | e3b0ccecbf3d781b927507791362a39c704cb0a8 | [
"MIT"
] | null | null | null | var W3CWebSocket = require('websocket').w3cwebsocket;
var Promise = require('promise');
var fs = require('fs');
var rconConfig = require('./rcon.json');
// Should the commands be executed instantly on startup? `true` / `false`
var executeOnStart = false;
// Should the commands be executed instantly after the new schedules have been loaded? `true` / `false`
var executeAfterLoad = false;
// Should the timed commands be executed instantly? `true` / `false`
var executeTimerInstantly = true;
// Value in seconds: interval for checking changes in `schedules.json` and executing the commands with `after` property.
var checkNewSchedules = 10;
/* Don't touch anything below unless you know what you're doing */
var rcon;
var schedules = [];
var timers = new Map();
var toBeExecuted = new Set();
var toBeCleared = new Set();
var first = true;
var second = 1000;
var minute = 60 * second;
var offset = 5;
var lastIndex = 1000;
var callbacks = new Map();
var currentTime;
var currentDate;
var dayChanged = false;
var count = 0;
var connected = false;
var mainInterval = null;
function text(text) {
console.log('[' + new Date + '] ' + text);
}
function rconConnect() {
return new Promise(function (resolve, reject) {
var count = 1;
text('RCON: Connecting...');
rcon = new W3CWebSocket('ws://' + rconConfig.host + ':' + rconConfig.port + '/' + rconConfig.pass);
rcon.onopen = function () {
text('RCON: Connected');
text('Waiting for server to start...');
lastIndex = 1000;
connected = true;
serverStarted(function(){
text('Server is up and running.');
count = 0;
startMainInterval();
resolve(rcon);
})
};
rcon.onerror = function (error) {
if (count > 100) {
text('RCON: Connection failed!');
reject(rcon);
}
text('RCON: Retrying connection in 5 seconds');
setTimeout(function () {
return rconConnect()
.then(
function () {
resolve();
},
function (error) {
reject(error);
}
);
}, 5 * 1000);
count++;
};
rcon.onclose = function () {
if (connected === true) {
clearTimers();
rconConnect();
connected = false;
first = false;
}
};
rcon.onmessage = function (e) {
var data = JSON.parse(e.data);
if (data.Message) {
if (data.Identifier === 1001) {
callbacks.get(data.Identifier)();
}
else if (data.Identifier > 1001) {
text('Response for command: '+callbacks.get(data.Identifier));
console.log(data.Message);
}
}
callbacks.delete(data.Identifier);
};
});
}
function serverStarted(callback) {
return new Promise(function (resolve, reject) {
lastIndex++;
callbacks.set(lastIndex, callback);
rcon.send(JSON.stringify({
Identifier: lastIndex,
Message: 'serverinfo',
Name: "WebRcon"
}));
resolve(rcon);
});
}
function rconCmd(command) {
text('RCON: Sending command: ' + command);
return new Promise(function (resolve, reject) {
lastIndex++;
callbacks.set(lastIndex, command);
rcon.send(JSON.stringify({
Identifier: lastIndex,
Message: command,
Name: "WebRcon"
}));
resolve(rcon);
});
}
function readSchedules(file) {
return JSON.parse(fs.readFileSync(file));
}
function loadSchedules() {
var newSchedules = readSchedules('./schedules.json');
dayChanged = (new Date(currentDate) < new Date());
if (
(JSON.stringify(schedules) !== JSON.stringify(newSchedules))
|| dayChanged
) {
if (dayChanged) {
text('Day changed, reloading schedules.');
setCurrentDate();
}
if (!first) {
text('New schedules loaded!');
clearTimers();
}
schedules = newSchedules;
createTimers();
text('New schedules initialised, waiting for '+offset+' seconds before setting schedules.');
first = false;
}
}
function createTimer(schedule, executeInstantly) {
setTimeout(function() {
if (
(first && executeOnStart)
|| (!first && executeAfterLoad)
|| executeInstantly
|| schedule.executeInstantly
) {
executeCommand(schedule);
}
var timer = setInterval(function() {
executeCommand(schedule);
}, schedule.interval * minute);
timers.set(schedule, timer);
}, offset * 1000);
}
function executeCommand(schedule) {
return new Promise(function (resolve, reject) {
rconCmd(schedule.command).then(function (response) {
resolve(true);
});
});
}
function checkIfWildcard(text, value) {
if (value === '*') {
if (text === 'year') {
return new Date().getFullYear();
}
else if (text === 'month') {
return prefixWithZero(new Date().getMonth() + 1);
}
else if (text === 'day') {
return prefixWithZero(new Date().getDate());
}
}
else {
return value;
}
}
function prefixWithZero(value) {
return ("0" + value).slice(-2);
}
function parseTime(time) {
var returnTime = time;
var regex = /(\d+|\*)-(\d+|\*)-(\d+|\*) (\d+):(\d+)(:(\d+))?/;
var matches = regex.exec(time);
if (matches) {
var year = checkIfWildcard('year', matches[1]);
var month = checkIfWildcard('month', matches[2]);
var day = checkIfWildcard('day', matches[3]);
var hour = prefixWithZero(matches[4]);
var minute = prefixWithZero(matches[5]);
var second = prefixWithZero(matches[7] || 0);
returnTime = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
}
return new Date(returnTime);
}
function checkTimed() {
toBeExecuted.forEach(function(schedule) {
if (
(schedule.after && parseTime(schedule.after) <= new Date() && !schedule.until)
|| (schedule.after && parseTime(schedule.after) <= new Date() && parseTime(schedule.until) > new Date())
) {
if (schedule.interval) {
if (
!schedule.until
|| (schedule.until && parseTime(schedule.until) > new Date())
) {
createTimer(schedule, executeTimerInstantly);
if (schedule.until) {
toBeCleared.add(schedule);
}
}
}
else {
executeCommand(schedule);
}
toBeExecuted.delete(schedule);
}
});
toBeCleared.forEach(function(schedule){
if (schedule.until && parseTime(schedule.until) < new Date()) {
clearInterval(timers.get(schedule));
toBeCleared.delete(schedule);
}
})
}
function createTimers() {
schedules.map(function(schedule) {
if (schedule.interval && !schedule.after) {
createTimer(schedule);
}
else if (schedule.after) {
toBeExecuted.add(schedule);
}
});
}
function clearTimers() {
toBeExecuted = new Set();
toBeCleared = new Set();
timers.forEach(function(timer) {
clearInterval(timer);
});
clearInterval(mainInterval);
schedules = [];
text('Old schedules cleared');
}
function startMainInterval() {
loadSchedules();
mainInterval = setInterval(function() {
loadSchedules();
checkTimed();
}, checkNewSchedules * second);
}
function setCurrentDate() {
currentTime = new Date();
currentDate = currentTime.getFullYear() +'-'+prefixWithZero(new Date().getMonth() + 1) +'-'+prefixWithZero(new Date().getDate()) +' 23:59:59';
}
setCurrentDate();
rconConnect()
.catch(function (error) {
console.error('Error:', error);
})
;
| 28.516779 | 146 | 0.532949 |
758d5b1ca96ee6fc9bc5b431519b9df25f6e5685 | 2,566 | js | JavaScript | src/js/playlist/loader.js | PovilasLT/jwplayer | e8050a5fc31d7977bee4399e2228d5cd4a89decf | [
"Apache-2.0"
] | 1 | 2019-03-28T02:31:08.000Z | 2019-03-28T02:31:08.000Z | src/js/playlist/loader.js | WithoutPants/jwplayer | 7d6ff98dadabb1ed42731726f7c4d280ca726d5f | [
"Apache-2.0"
] | 8 | 2021-03-09T20:10:11.000Z | 2022-02-26T18:53:08.000Z | public/jwplayer-master/src/js/playlist/loader.js | hocongtru95/test_laravel | 5683c26b88a052dd887c3afc528b06d66bd493c5 | [
"MIT"
] | 1 | 2019-10-07T11:02:44.000Z | 2019-10-07T11:02:44.000Z | import { PLAYLIST_LOADED, ERROR } from 'events/events';
import { localName } from 'parsers/parsers';
import parseRss from 'parsers/rssparser';
import { ajax } from 'utils/ajax';
import Events from 'utils/backbone.events';
import { PlayerError, MSG_CANT_PLAY_VIDEO } from 'api/errors';
const PlaylistLoader = function() {
const _this = Object.assign(this, Events);
this.load = function(playlistfile) {
ajax(playlistfile, playlistLoaded, (message, file, url, error) => {
playlistError(error);
});
};
this.destroy = function() {
this.off();
};
function playlistLoaded(loadedEvent) {
try {
const childNodes = loadedEvent.responseXML ? loadedEvent.responseXML.childNodes : null;
let rss = '';
let jsonObj;
if (childNodes) {
for (let i = 0; i < childNodes.length; i++) {
rss = childNodes[i];
// 8: Node.COMMENT_NODE (IE8 doesn't have the Node.COMMENT_NODE constant)
if (rss.nodeType !== 8) {
break;
}
}
if (localName(rss) === 'xml') {
rss = rss.nextSibling;
}
if (localName(rss) === 'rss') {
const rssPlaylist = parseRss(rss);
jsonObj = Object.assign({ playlist: rssPlaylist }, rssPlaylist.feedData);
}
}
// If the response is not valid RSS, check if it is JSON
if (!jsonObj) {
try {
const pl = JSON.parse(loadedEvent.responseText);
// If the response is not a JSON array, try to read playlist of the response
if (Array.isArray(pl)) {
jsonObj = { playlist: pl };
} else if (Array.isArray(pl.playlist)) {
jsonObj = pl;
} else {
throw Error('Playlist is not an array');
}
} catch (e) {
throw new PlayerError(MSG_CANT_PLAY_VIDEO, 621, e);
}
}
_this.trigger(PLAYLIST_LOADED, jsonObj);
} catch (error) {
playlistError(error);
}
}
function playlistError(error) {
if (!error.code) {
error = new PlayerError(MSG_CANT_PLAY_VIDEO, 0);
}
_this.trigger(ERROR, error);
}
};
export default PlaylistLoader;
| 34.213333 | 99 | 0.496103 |
758e308d96d692520508dc4967c9457fd61747cb | 815 | js | JavaScript | src/components/common/ReviewCard.js | AndyForbes93/spot-it | 59dcdb89205b033a9c43ab6008f9cb37fad551f5 | [
"MIT"
] | null | null | null | src/components/common/ReviewCard.js | AndyForbes93/spot-it | 59dcdb89205b033a9c43ab6008f9cb37fad551f5 | [
"MIT"
] | null | null | null | src/components/common/ReviewCard.js | AndyForbes93/spot-it | 59dcdb89205b033a9c43ab6008f9cb37fad551f5 | [
"MIT"
] | null | null | null | import React from 'react';
import "./styles.css"
const imageStyle = {
borderRadius: '50%',
height: '200px'
}
const textStyle = {
backgroundColor: 'rgb(220,220,220)'
}
const ReviewCard = ({ userName , userImage , text }) => {
return(
<div className="card mt-5 " style={textStyle}>
<div className="row no-gutters">
<div clclassNameass="col-auto mt-2">
<img src={userImage} style={imageStyle} class="img-fluid" alt="" />
</div>
<div className="col">
<div className="card-block px-2">
<h5 className="card-title">{userName}:</h5>
<p className="card-text text-muted" >{text}</p>
</div>
</div>
</div>
</div>
)
}
export { ReviewCard } | 26.290323 | 84 | 0.515337 |
758e38c552170cb9660e1d8afd483b48f1040ef6 | 47 | js | JavaScript | node_modules/styled-icons/remix-line/Tape/Tape.esm.js | chs6558/chs6558.github.io | 32dd0275105d1db5b085d3162126b0e847ec9c16 | [
"MIT"
] | null | null | null | node_modules/styled-icons/remix-line/Tape/Tape.esm.js | chs6558/chs6558.github.io | 32dd0275105d1db5b085d3162126b0e847ec9c16 | [
"MIT"
] | null | null | null | node_modules/styled-icons/remix-line/Tape/Tape.esm.js | chs6558/chs6558.github.io | 32dd0275105d1db5b085d3162126b0e847ec9c16 | [
"MIT"
] | null | null | null | export * from '@styled-icons/remix-line/Tape';
| 23.5 | 46 | 0.723404 |
758e760071ffce3a87b9f8646c31528376ad106f | 178 | js | JavaScript | tests/test-utils.js | BabicIgor/RegExp | 3e0057834d766e55268820bb3b24d4700b9ed34e | [
"MIT"
] | null | null | null | tests/test-utils.js | BabicIgor/RegExp | 3e0057834d766e55268820bb3b24d4700b9ed34e | [
"MIT"
] | 1 | 2021-08-03T22:47:40.000Z | 2021-08-03T22:47:40.000Z | tests/test-utils.js | vikigstar/RegExp | 3e0057834d766e55268820bb3b24d4700b9ed34e | [
"MIT"
] | null | null | null | var fs = require("fs")
var path = require("path")
export const readFixture = (fixture) => {
return fs.readFileSync(path.join(__dirname, './fixtures/' + fixture)).toString()
}
| 25.428571 | 82 | 0.679775 |
758f9a24c494e3b70eaa7edb39f1ffc9c3e7965f | 2,183 | js | JavaScript | src/js/breaks.js | saw-jan/tomaatti-timer | 3dd34cbb6585cb837bc42da55f657e82991242e9 | [
"MIT"
] | 1 | 2019-11-01T14:19:17.000Z | 2019-11-01T14:19:17.000Z | src/js/breaks.js | saw-jan/tomaatti-timer | 3dd34cbb6585cb837bc42da55f657e82991242e9 | [
"MIT"
] | 19 | 2019-03-27T21:08:06.000Z | 2019-10-24T18:32:54.000Z | src/js/breaks.js | saw-jan/tomaatti-timer | 3dd34cbb6585cb837bc42da55f657e82991242e9 | [
"MIT"
] | 3 | 2021-05-26T08:43:44.000Z | 2021-06-02T05:27:05.000Z | 'use strict';
import * as controls from './controls.js';
import * as helpers from './helpers.js';
import * as settings from './settings.js';
let tomaattiCycles = 0;
let shortBreakTime = 2;
let longBreakTime = 3;
let isBreak = false;
let breakTimeLabel = document.getElementById('break-time');
let breakStartSound = new Audio('./src/assets/audio/break-start.mp3');
let breakEndSound = new Audio('./src/assets/audio/break-end.mp3');
function breakStarted(ticking) {
console.log(ticking, "state")
tomaattiCycles += 1;
setBreakState(true);
controls.isTimerRunning(false);
if (ticking) {
playBreakStartSound();
}
breakTimeLabel.style.visibility = 'visible';
setTimeout(() => {
breakSelector();
}, 3000);
}
function breakSelector() {
if (tomaattiCycles < 4) {
return short();
} else {
return long();
}
}
function short() {
helpers.countdown(helpers.minutesToMilliseconds(shortBreakTime));
}
function long() {
resetTomaattiCycles();
helpers.countdown(helpers.minutesToMilliseconds(longBreakTime));
}
function breakFinished(ticking) {
isBreak = false;
breakTimeLabel.style.visibility = 'hidden';
controls.tomaattiLabel.removeAttribute('disabled');
controls.startButton.style.display = 'initial';
settings.disableSettingsPage(false);
if (ticking) {
playBreakEndSound();
}
return controls.presetTimer();
}
function getBreakState() {
return isBreak;
}
function setBreakState(state) {
isBreak = state;
return isBreak;
}
function resetTomaattiCycles() {
tomaattiCycles = 0;
return tomaattiCycles;
}
function getShortBreakTime() {
return shortBreakTime;
}
function setShortBreakTime(minutes) {
shortBreakTime = minutes;
return shortBreakTime;
}
function getLongBreakTime() {
return longBreakTime;
}
function setLongBreakTime(minutes) {
longBreakTime = minutes;
return longBreakTime;
}
function playBreakStartSound() {
breakStartSound.load();
breakStartSound.play();
}
function playBreakEndSound() {
breakEndSound.load();
breakEndSound.play();
}
export {
getBreakState,
setBreakState,
setShortBreakTime,
setLongBreakTime,
breakStarted,
breakFinished,
breakTimeLabel
} | 19.845455 | 70 | 0.724691 |
758fdbd95e7611a2c29a182d7ae9674c309436b2 | 139 | js | JavaScript | 6 kyu/Fun with trees max sum.js | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | 6 | 2020-09-03T09:32:25.000Z | 2020-12-07T04:10:01.000Z | 6 kyu/Fun with trees max sum.js | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | 1 | 2021-12-13T15:30:21.000Z | 2021-12-13T15:30:21.000Z | 6 kyu/Fun with trees max sum.js | mwk0408/codewars_solutions | 9b4f502b5f159e68024d494e19a96a226acad5e5 | [
"MIT"
] | null | null | null | function maxSum(root) {
if (!root) {
return 0
}
let num=root.value+Math.max(maxSum(root.left), maxSum(root.right))
return num
} | 19.857143 | 68 | 0.654676 |
759085df4aecc290dadde62b6b78d9c6132e40aa | 1,523 | js | JavaScript | js/main/game/automation.js | Buck4437/color-game | adede691d44bc4195559793980c1d7fca2f61bb6 | [
"MIT"
] | 1 | 2020-07-04T02:15:09.000Z | 2020-07-04T02:15:09.000Z | js/main/game/automation.js | Buck4437/color-game | adede691d44bc4195559793980c1d7fca2f61bb6 | [
"MIT"
] | null | null | null | js/main/game/automation.js | Buck4437/color-game | adede691d44bc4195559793980c1d7fca2f61bb6 | [
"MIT"
] | null | null | null | function updateAutobuyers(){
updateAutobuyersColors()
updateAutobuyersLights()
}
function updateAutobuyersColors(){
let colors = ["red", "green", "blue"]
for (let [index, color] of colors.entries()){
let interval = 1000
if(containBit(player.lights.upgradesBit, 16384)){
interval = 50
}
else{
interval /= Math.max(1,player.colors[color].upgrades.auto||1)
if(containBit(player.lights.upgradesBit, 4*16**index)){
interval /= 2
}
}
setAutoBuyColor(color, player.colors[color].auto, interval)
}
}
function setAutoBuyColor(color, boolean, interval){
player.colors[color].auto = boolean
clearInterval(game.autobuyersInterval[color])
if(player.colors[color].auto){
gainColor(color)
game.autobuyersInterval[color] = setInterval(function(){gainColor(color)}, interval)
}
}
function updateAutobuyersLights(){
setAutoBuyLights(player.lights.auto.isEnabled)
}
function setAutoBuyLights(boolean){
player.lights.auto.isEnabled = boolean
clearInterval(game.autobuyersInterval.lights)
if(boolean){
game.autobuyersInterval.lights = setInterval(tryGainLights, 50)
}
}
function tryGainLights(){
if (!canPrestigeLights()){
return
}
let mode = player.lights.auto.mode
let value = player.lights.auto.value
if (mode == 0){ //Amount
if (gainRateLights().lights >= value){
prestigeLights()
}
}
else if (mode == 1){ //Time
if(player.stats.prestigeTime.lights.current >= value){
prestigeLights()
}
}
}
| 24.967213 | 88 | 0.688116 |
7590992efcfd6543f01c4a6db63f95bc679b444f | 214 | js | JavaScript | index.js | AaryanKhClasses/bacclib | 19c315c5c5c62da1a0bef7d494873a382dcd60ef | [
"MIT"
] | 1 | 2021-05-22T08:02:07.000Z | 2021-05-22T08:02:07.000Z | index.js | AaryanKhClasses/bacclib | 19c315c5c5c62da1a0bef7d494873a382dcd60ef | [
"MIT"
] | null | null | null | index.js | AaryanKhClasses/bacclib | 19c315c5c5c62da1a0bef7d494873a382dcd60ef | [
"MIT"
] | null | null | null | const levelling = require('./modules/levelling')
const economy = require('./modules/economy')
const economyModel = require('./models/economyModel')
module.exports = {
levelling,
economy,
economyModel
} | 23.777778 | 53 | 0.714953 |
7590c733e8d954a25057945cf71539f31480e174 | 328 | js | JavaScript | src/App.js | L1zz13/G0 | 5db32faa4848b9ae255e866cfbf4fc892d12fcdf | [
"Unlicense"
] | 1 | 2018-12-27T17:46:56.000Z | 2018-12-27T17:46:56.000Z | src/App.js | L1zz13/G0 | 5db32faa4848b9ae255e866cfbf4fc892d12fcdf | [
"Unlicense"
] | 6 | 2019-01-24T01:57:49.000Z | 2019-02-03T01:08:11.000Z | src/App.js | L1zz13/G0 | 5db32faa4848b9ae255e866cfbf4fc892d12fcdf | [
"Unlicense"
] | null | null | null | import React, { Component } from "react";
import "./App.css";
import Board from "./board";
import ContainerView from "./go";
var board = new Board(19);
class App extends Component {
render() {
return (
<div className="App">
<ContainerView board={board} />
</div>
);
}
}
export default App;
| 14.909091 | 41 | 0.60061 |
7592f8bd8de9b7ca5a3983fec3cda2bacaf42fdc | 4,086 | js | JavaScript | tests/unit/file-functions-test.js | jeffreyhunter77/drt | a745e60fca00c21be592ad4c5cc177d32e6cc058 | [
"MIT"
] | null | null | null | tests/unit/file-functions-test.js | jeffreyhunter77/drt | a745e60fca00c21be592ad4c5cc177d32e6cc058 | [
"MIT"
] | null | null | null | tests/unit/file-functions-test.js | jeffreyhunter77/drt | a745e60fca00c21be592ad4c5cc177d32e6cc058 | [
"MIT"
] | null | null | null | var assert = require('assert')
, mockfs = require('mock-fs')
, fs = require('fs')
, ffuncs = require('../../lib/file-functions')
;
describe("built-in file functions", function() {
describe("fileExists()", function() {
beforeEach(function() {
mockfs({'test-file.txt': ''});
});
afterEach(function() {
mockfs.restore();
});
it("returns true if a file exists at the named path", function() {
assert(ffuncs.fileExists('test-file.txt'));
});
it("returns false otherwise", function() {
assert(!ffuncs.fileExists('no-such-file.txt'));
});
});
describe("isFile()", function() {
beforeEach(function() {
mockfs({'test-file.txt': '', 'test-dir/test-file.txt': ''});
});
afterEach(function() {
mockfs.restore();
});
it("returns true if file exists and is a regular file", function() {
assert(ffuncs.isFile('test-file.txt'));
});
it ("returns false if the path exists but is not a regular file", function() {
assert(!ffuncs.isFile('test-dir'));
});
it ("returns false if the path does not exist", function() {
assert(!ffuncs.isFile('no-such-file.txt'));
});
});
describe("isDir()", function() {
beforeEach(function() {
mockfs({'test-file.txt': '', 'test-dir/test-file.txt': ''});
});
afterEach(function() {
mockfs.restore();
});
it("returns true if path exists and is a directory", function() {
assert(ffuncs.isDir('test-dir'));
});
it ("returns false if the path exists but is not a directory", function() {
assert(!ffuncs.isDir('test-file.txt'));
});
it ("returns false if the path does not exist", function() {
assert(!ffuncs.isDir('no-such-dir'));
});
});
describe("readFile()", function() {
beforeEach(function() {
mockfs({
'inquiry.txt': '\u00BFC\u00F3mo est\u00E1s?',
});
});
afterEach(function() {
mockfs.restore();
});
it("reads the entire contents of the file as a string", function() {
assert.equal(ffuncs.readFile('inquiry.txt'), '\u00BFC\u00F3mo est\u00E1s?');
});
it("throws an error if the file cannot be read", function() {
assert.throws(function() {
ffuncs.readFile('no-such-file.txt');
}, /ENOENT/);
});
});
describe("writeFile()", function() {
beforeEach(function() {
mockfs({'some-dir/some-file.txt': ''});
});
afterEach(function() {
mockfs.restore();
});
it("writes the entire contents of the file as a string", function() {
ffuncs.writeFile('reply.txt', 'Muy bien, gracias.');
assert.equal(fs.readFileSync('reply.txt', {encoding: 'utf8'}), 'Muy bien, gracias.');
});
it("throws an error if the file cannot be written", function() {
assert.throws(function() {
ffuncs.writeFile('some-dir', 'contents');
}, /./);
});
});
describe("listDir()", function() {
beforeEach(function() {
mockfs({
'some-dir': {
'.hidden-dir': {'file.txt': ''},
'.hidden-file': '',
'dir': {'file.txt': ''},
'file1': '',
'file2': ''
}
});
});
afterEach(function() {
mockfs.restore();
});
it("returns an array listing the contents of the directory", function() {
assert.deepEqual(
ffuncs.listDir('some-dir').sort(),
['dir', 'file1', 'file2']
);
});
it("includes hidden entries when the 'all' option is true", function() {
assert.deepEqual(
ffuncs.listDir('some-dir', {all: true}).sort(),
['.hidden-dir', '.hidden-file', 'dir', 'file1', 'file2']
);
});
it("throws an error if the directory cannot be read", function() {
assert.throws(function() {
ffuncs.listDir('unknown-dir');
}, /ENOENT/);
});
it("throws an error if an invalid option is provided", function() {
assert.throws(function() {
ffuncs.listDir('some-dir', {nonesuch: true});
}, /nonesuch/);
});
});
});
| 25.698113 | 91 | 0.551884 |