feat(es/minifier): Improve name mangler (#3638)

This commit is contained in:
Donny/강동윤 2022-02-20 21:08:26 +09:00 committed by GitHub
parent 18ae83d853
commit e9fabd61e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 2062 additions and 1958 deletions

View File

@ -1 +1 @@
export function testme(){for(var a=arguments.length,b=new Array(a),c=0;c<a;c++)b[c]=arguments[c];/^toto.+/.test(b.join(""))&&global.other(!0)}
export function testme(){for(var b=arguments.length,c=new Array(b),a=0;a<b;a++)c[a]=arguments[a];/^toto.+/.test(c.join(""))&&global.other(!0)}

View File

@ -1 +1 @@
class a{#a;constructor(b){this.#a=b} #b(){setTimeout(()=>{this.#a.textContent="TESTED"},1e3)}run(){this.#b()}}export{a as default}
class a{#a;constructor(a){this.#a=a} #b(){setTimeout(()=>{this.#a.textContent="TESTED"},1e3)}run(){this.#b()}}export{a as default}

View File

@ -3,7 +3,7 @@
158
],
{
2943: function(a, b, c) {
2943: function(c, b, a) {
"use strict";
var d = function(a) {
var b = a.data;
@ -11,7 +11,7 @@
children: b.foo
});
};
c.r(b), c.d(b, {
a.r(b), a.d(b, {
"__N_SSG": function() {
return f;
},
@ -19,7 +19,7 @@
return d;
}
});
var e = c(4512), f = !0;
var e = a(4512), f = !0;
},
7139: function(a, b, c) {
(window.__NEXT_P = window.__NEXT_P || []).push([

View File

@ -1 +1 @@
import*as a from"@swc/helpers";import{Color as b,rgbConvert as c,Rgb as d}from"./color.js";var e=Math.PI/180,f=180/Math.PI,g=-0.5210501878999999-.1347134789;export default function h(b,e,h,i){return 1===arguments.length?(function(b){if(a._instanceof(b,Cubehelix))return new Cubehelix(b.h,b.s,b.l,b.opacity);a._instanceof(b,d)||(b=c(b));var e=b.r/255,h=b.g/255,i=b.b/255,j=(g*i+ -1.7884503806*e-3.5172982438*h)/(g+ -1.7884503806-3.5172982438),k=i-j,l=-((1.97294*(h-j)- -0.29227*k)/.90649),m=Math.sqrt(l*l+k*k)/(1.97294*j*(1-j)),n=m?Math.atan2(l,k)*f-120:NaN;return new Cubehelix(n<0?n+360:n,m,j,b.opacity)})(b):new Cubehelix(b,e,h,null==i?1:i)};export function Cubehelix(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}!function(a,b,c){a.prototype=b.prototype=c,c.constructor=a}(Cubehelix,h,function(a,b){var c=Object.create(a.prototype);for(var d in b)c[d]=b[d];return c}(b,{brighter:function(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new Cubehelix(this.h,this.s,this.l*a,this.opacity)},darker:function(a){return a=null==a?.7:Math.pow(.7,a),new Cubehelix(this.h,this.s,this.l*a,this.opacity)},rgb:function(){var a=isNaN(this.h)?0:(this.h+120)*e,b=+this.l,c=isNaN(this.s)?0:this.s*b*(1-b),f=Math.cos(a),g=Math.sin(a);return new d(255*(b+c*(-0.14861*f+1.78277*g)),255*(b+c*(-0.29227*f+ -0.90649*g)),255*(b+c*(1.97294*f)),this.opacity)}}))
import*as c from"@swc/helpers";import{Color as a,rgbConvert as d,Rgb as e}from"./color.js";var f=Math.PI/180,g=180/Math.PI,h=-0.5210501878999999-.1347134789;export default function b(a,f,i,b){return 1===arguments.length?(function(a){if(c._instanceof(a,Cubehelix))return new Cubehelix(a.h,a.s,a.l,a.opacity);c._instanceof(a,e)||(a=d(a));var n=a.r/255,k=a.g/255,l=a.b/255,b=(h*l+ -1.7884503806*n-3.5172982438*k)/(h+ -1.7884503806-3.5172982438),f=l-b,i=-((1.97294*(k-b)- -0.29227*f)/.90649),m=Math.sqrt(i*i+f*f)/(1.97294*b*(1-b)),j=m?Math.atan2(i,f)*g-120:NaN;return new Cubehelix(j<0?j+360:j,m,b,a.opacity)})(a):new Cubehelix(a,f,i,null==b?1:b)};export function Cubehelix(a,b,c,d){this.h=+a,this.s=+b,this.l=+c,this.opacity=+d}!function(a,c,b){a.prototype=c.prototype=b,b.constructor=a}(Cubehelix,b,function(d,a){var b=Object.create(d.prototype);for(var c in a)b[c]=a[c];return b}(a,{brighter:function(a){return a=null==a?1.4285714285714286:Math.pow(1.4285714285714286,a),new Cubehelix(this.h,this.s,this.l*a,this.opacity)},darker:function(a){return a=null==a?.7:Math.pow(.7,a),new Cubehelix(this.h,this.s,this.l*a,this.opacity)},rgb:function(){var d=isNaN(this.h)?0:(this.h+120)*f,a=+this.l,b=isNaN(this.s)?0:this.s*a*(1-a),c=Math.cos(d),g=Math.sin(d);return new e(255*(a+b*(-0.14861*c+1.78277*g)),255*(a+b*(-0.29227*c+ -0.90649*g)),255*(a+b*(1.97294*c)),this.opacity)}}))

File diff suppressed because one or more lines are too long

View File

@ -1,28 +1,28 @@
import * as a from "@swc/helpers";
import b, { extend as c } from "./define.js";
import { Color as d, rgbConvert as e, Rgb as f, darker as g, brighter as h } from "./color.js";
import { deg2rad as i, rad2deg as j } from "./math.js";
var k = -0.5210501878999999 - 0.1347134789;
export default function l(b, c, d, g) {
return 1 === arguments.length ? (function(b) {
if (a._instanceof(b, Cubehelix)) return new Cubehelix(b.h, b.s, b.l, b.opacity);
a._instanceof(b, f) || (b = e(b));
var c = b.r / 255, d = b.g / 255, g = b.b / 255, h = (k * g + -1.7884503806 * c - 3.5172982438 * d) / (k + -1.7884503806 - 3.5172982438), i = g - h, l = -((1.97294 * (d - h) - -0.29227 * i) / 0.90649), m = Math.sqrt(l * l + i * i) / (1.97294 * h * (1 - h)), n = m ? Math.atan2(l, i) * j - 120 : NaN;
return new Cubehelix(n < 0 ? n + 360 : n, m, h, b.opacity);
})(b) : new Cubehelix(b, c, d, null == g ? 1 : g);
import * as e from "@swc/helpers";
import a, { extend as b } from "./define.js";
import { Color as c, rgbConvert as f, Rgb as g, darker as h, brighter as i } from "./color.js";
import { deg2rad as j, rad2deg as k } from "./math.js";
var l = -0.5210501878999999 - 0.1347134789;
export default function d(a, c, d, b) {
return 1 === arguments.length ? (function(a) {
if (e._instanceof(a, Cubehelix)) return new Cubehelix(a.h, a.s, a.l, a.opacity);
e._instanceof(a, g) || (a = f(a));
var n = a.r / 255, i = a.g / 255, j = a.b / 255, b = (l * j + -1.7884503806 * n - 3.5172982438 * i) / (l + -1.7884503806 - 3.5172982438), c = j - b, d = -((1.97294 * (i - b) - -0.29227 * c) / 0.90649), m = Math.sqrt(d * d + c * c) / (1.97294 * b * (1 - b)), h = m ? Math.atan2(d, c) * k - 120 : NaN;
return new Cubehelix(h < 0 ? h + 360 : h, m, b, a.opacity);
})(a) : new Cubehelix(a, c, d, null == b ? 1 : b);
};
export function Cubehelix(a, b, c, d) {
this.h = +a, this.s = +b, this.l = +c, this.opacity = +d;
}
b(Cubehelix, l, c(d, {
a(Cubehelix, d, b(c, {
brighter: function(a) {
return a = null == a ? h : Math.pow(h, a), new Cubehelix(this.h, this.s, this.l * a, this.opacity);
return a = null == a ? i : Math.pow(i, a), new Cubehelix(this.h, this.s, this.l * a, this.opacity);
},
darker: function(a) {
return a = null == a ? g : Math.pow(g, a), new Cubehelix(this.h, this.s, this.l * a, this.opacity);
return a = null == a ? h : Math.pow(h, a), new Cubehelix(this.h, this.s, this.l * a, this.opacity);
},
rgb: function() {
var a = isNaN(this.h) ? 0 : (this.h + 120) * i, b = +this.l, c = isNaN(this.s) ? 0 : this.s * b * (1 - b), d = Math.cos(a), e = Math.sin(a);
return new f(255 * (b + c * (-0.14861 * d + 1.78277 * e)), 255 * (b + c * (-0.29227 * d + -0.90649 * e)), 255 * (b + c * (1.97294 * d)), this.opacity);
var d = isNaN(this.h) ? 0 : (this.h + 120) * j, a = +this.l, b = isNaN(this.s) ? 0 : this.s * a * (1 - a), c = Math.cos(d), e = Math.sin(d);
return new g(255 * (a + b * (-0.14861 * c + 1.78277 * e)), 255 * (a + b * (-0.29227 * c + -0.90649 * e)), 255 * (a + b * (1.97294 * c)), this.opacity);
}
}));

View File

@ -27,32 +27,32 @@ function n(a, b, c) {
}
export default function o(c) {
var e = function(b, c) {
return function(d) {
var e, f, g, h = [], i = -1, j = 0, k = b.length;
for(a._instanceof(d, Date) || (d = new Date(+d)); ++i < k;)37 === b.charCodeAt(i) && (h.push(b.slice(j, i)), null != (f = p[e = b.charAt(++i)]) ? e = b.charAt(++i) : f = "e" === e ? " " : "0", (g = c[e]) && (e = g(d, f)), h.push(e), j = i + 1);
return h.push(b.slice(j, i)), h.join("");
return function(f) {
var e, h, j, g = [], d = -1, i = 0, k = b.length;
for(a._instanceof(f, Date) || (f = new Date(+f)); ++d < k;)37 === b.charCodeAt(d) && (g.push(b.slice(i, d)), null != (h = p[e = b.charAt(++d)]) ? e = b.charAt(++d) : h = "e" === e ? " " : "0", (j = c[e]) && (e = j(f, h)), g.push(e), i = d + 1);
return g.push(b.slice(i, d)), g.join("");
};
}, f = function(a, c) {
return function(e) {
var f, j, k = n(1900, void 0, 1);
if (h(k, a, e += "", 0) != e.length) return null;
if ("Q" in k) return new Date(k.Q);
if ("s" in k) return new Date(1000 * k.s + ("L" in k ? k.L : 0));
if (!c || "Z" in k || (k.Z = 0), "p" in k && (k.H = k.H % 12 + 12 * k.p), void 0 === k.m && (k.m = "q" in k ? k.q : 0), "V" in k) {
if (k.V < 1 || k.V > 53) return null;
"w" in k || (k.w = 1), "Z" in k ? (f = (j = (f = m(n(k.y, 0, 1))).getUTCDay()) > 4 || 0 === j ? i.ceil(f) : i(f), f = g.offset(f, (k.V - 1) * 7), k.y = f.getUTCFullYear(), k.m = f.getUTCMonth(), k.d = f.getUTCDate() + (k.w + 6) % 7) : (f = (j = (f = l(n(k.y, 0, 1))).getDay()) > 4 || 0 === j ? d.ceil(f) : d(f), f = b.offset(f, (k.V - 1) * 7), k.y = f.getFullYear(), k.m = f.getMonth(), k.d = f.getDate() + (k.w + 6) % 7);
} else ("W" in k || "U" in k) && ("w" in k || (k.w = "u" in k ? k.u % 7 : "W" in k ? 1 : 0), j = "Z" in k ? m(n(k.y, 0, 1)).getUTCDay() : l(n(k.y, 0, 1)).getDay(), k.m = 0, k.d = "W" in k ? (k.w + 6) % 7 + 7 * k.W - (j + 5) % 7 : k.w + 7 * k.U - (j + 6) % 7);
return "Z" in k ? (k.H += k.Z / 100 | 0, k.M += k.Z % 100, m(k)) : l(k);
}, aa = function(a, c) {
return function(j) {
var f, h, e = n(1900, void 0, 1);
if (ua(e, a, j += "", 0) != j.length) return null;
if ("Q" in e) return new Date(e.Q);
if ("s" in e) return new Date(1000 * e.s + ("L" in e ? e.L : 0));
if (!c || "Z" in e || (e.Z = 0), "p" in e && (e.H = e.H % 12 + 12 * e.p), void 0 === e.m && (e.m = "q" in e ? e.q : 0), "V" in e) {
if (e.V < 1 || e.V > 53) return null;
"w" in e || (e.w = 1), "Z" in e ? (f = (h = (f = m(n(e.y, 0, 1))).getUTCDay()) > 4 || 0 === h ? i.ceil(f) : i(f), f = g.offset(f, (e.V - 1) * 7), e.y = f.getUTCFullYear(), e.m = f.getUTCMonth(), e.d = f.getUTCDate() + (e.w + 6) % 7) : (f = (h = (f = l(n(e.y, 0, 1))).getDay()) > 4 || 0 === h ? d.ceil(f) : d(f), f = b.offset(f, (e.V - 1) * 7), e.y = f.getFullYear(), e.m = f.getMonth(), e.d = f.getDate() + (e.w + 6) % 7);
} else ("W" in e || "U" in e) && ("w" in e || (e.w = "u" in e ? e.u % 7 : "W" in e ? 1 : 0), h = "Z" in e ? m(n(e.y, 0, 1)).getUTCDay() : l(n(e.y, 0, 1)).getDay(), e.m = 0, e.d = "W" in e ? (e.w + 6) % 7 + 7 * e.W - (h + 5) % 7 : e.w + 7 * e.U - (h + 6) % 7);
return "Z" in e ? (e.H += e.Z / 100 | 0, e.M += e.Z % 100, m(e)) : l(e);
};
}, h = function(a, b, c, d) {
for(var e, f, g = 0, h = b.length, i = c.length; g < h;){
if (d >= i) return -1;
if (37 === (e = b.charCodeAt(g++))) {
if (!(f = Qa[(e = b.charAt(g++)) in p ? b.charAt(g++) : e]) || (d = f(a, c, d)) < 0) return -1;
} else if (e != c.charCodeAt(d++)) return -1;
}, ua = function(g, b, e, a) {
for(var c, f, d = 0, h = b.length, i = e.length; d < h;){
if (a >= i) return -1;
if (37 === (c = b.charCodeAt(d++))) {
if (!(f = Qa[(c = b.charAt(d++)) in p ? b.charAt(d++) : c]) || (a = f(g, e, a)) < 0) return -1;
} else if (c != e.charCodeAt(a++)) return -1;
}
return d;
}, j = c.dateTime, k = c.date, o = c.time, q = c.periods, r = c.days, s = c.shortDays, t = c.months, u = c.shortMonths, aa = v(q), ua = w(q), Ga = v(r), Ha = w(r), Ia = v(s), Ja = w(s), Ka = v(t), La = w(t), Ma = v(u), Na = w(u), Oa = {
return a;
}, j = c.dateTime, k = c.date, o = c.time, q = c.periods, r = c.days, s = c.shortDays, t = c.months, u = c.shortMonths, Ga = v(q), Ha = w(q), Ia = v(r), Ja = w(r), Ka = v(s), La = w(s), Ma = v(t), Na = w(t), Oa = v(u), Pa = w(u), f = {
a: function(a) {
return s[a.getDay()];
},
@ -97,7 +97,7 @@ export default function o(c) {
Y: ga,
Z: ia,
"%": Da
}, Pa = {
}, h = {
a: function(a) {
return s[a.getUTCDay()];
},
@ -143,24 +143,24 @@ export default function o(c) {
Z: Ca,
"%": Da
}, Qa = {
a: function(a, b, c) {
var d = Ia.exec(b.slice(c));
return d ? (a.w = Ja.get(d[0].toLowerCase()), c + d[0].length) : -1;
a: function(c, d, b) {
var a = Ka.exec(d.slice(b));
return a ? (c.w = La.get(a[0].toLowerCase()), b + a[0].length) : -1;
},
A: function(a, b, c) {
var d = Ga.exec(b.slice(c));
return d ? (a.w = Ha.get(d[0].toLowerCase()), c + d[0].length) : -1;
A: function(c, d, b) {
var a = Ia.exec(d.slice(b));
return a ? (c.w = Ja.get(a[0].toLowerCase()), b + a[0].length) : -1;
},
b: function(a, b, c) {
var d = Ma.exec(b.slice(c));
return d ? (a.m = Na.get(d[0].toLowerCase()), c + d[0].length) : -1;
b: function(c, d, b) {
var a = Oa.exec(d.slice(b));
return a ? (c.m = Pa.get(a[0].toLowerCase()), b + a[0].length) : -1;
},
B: function(a, b, c) {
var d = Ka.exec(b.slice(c));
return d ? (a.m = La.get(d[0].toLowerCase()), c + d[0].length) : -1;
B: function(c, d, b) {
var a = Ma.exec(d.slice(b));
return a ? (c.m = Na.get(a[0].toLowerCase()), b + a[0].length) : -1;
},
c: function(a, b, c) {
return h(a, j, b, c);
return ua(a, j, b, c);
},
d: H,
e: H,
@ -173,9 +173,9 @@ export default function o(c) {
L: M,
m: G,
M: K,
p: function(a, b, c) {
var d = aa.exec(b.slice(c));
return d ? (a.p = ua.get(d[0].toLowerCase()), c + d[0].length) : -1;
p: function(c, d, b) {
var a = Ga.exec(d.slice(b));
return a ? (c.p = Ha.get(a[0].toLowerCase()), b + a[0].length) : -1;
},
q: F,
Q: P,
@ -187,40 +187,40 @@ export default function o(c) {
w: x,
W: B,
x: function(a, b, c) {
return h(a, k, b, c);
return ua(a, k, b, c);
},
X: function(a, b, c) {
return h(a, o, b, c);
return ua(a, o, b, c);
},
y: D,
Y: C,
Z: E,
"%": O
};
return Oa.x = e(k, Oa), Oa.X = e(o, Oa), Oa.c = e(j, Oa), Pa.x = e(k, Pa), Pa.X = e(o, Pa), Pa.c = e(j, Pa), {
format: function(a) {
var b = e(a += "", Oa);
return b.toString = function() {
return a;
}, b;
return f.x = e(k, f), f.X = e(o, f), f.c = e(j, f), h.x = e(k, h), h.X = e(o, h), h.c = e(j, h), {
format: function(b) {
var a = e(b += "", f);
return a.toString = function() {
return b;
}, a;
},
parse: function(a) {
var b = f(a += "", !1);
return b.toString = function() {
return a;
}, b;
parse: function(b) {
var a = aa(b += "", !1);
return a.toString = function() {
return b;
}, a;
},
utcFormat: function(a) {
var b = e(a += "", Pa);
return b.toString = function() {
return a;
}, b;
utcFormat: function(b) {
var a = e(b += "", h);
return a.toString = function() {
return b;
}, a;
},
utcParse: function(a) {
var b = f(a += "", !0);
return b.toString = function() {
return a;
}, b;
utcParse: function(b) {
var a = aa(b += "", !0);
return a.toString = function() {
return b;
}, a;
}
};
};
@ -229,9 +229,9 @@ var p = {
"_": " ",
"0": "0"
}, q = /^\s*\d+/, r = /^%/, s = /[\\^$*+?|[\]().{}]/g;
function t(a, b, c) {
var d = a < 0 ? "-" : "", e = (d ? -a : a) + "", f = e.length;
return d + (f < c ? new Array(c - f + 1).join(b) + e : e);
function t(a, f, c) {
var d = a < 0 ? "-" : "", b = (d ? -a : a) + "", e = b.length;
return d + (e < c ? new Array(c - e + 1).join(f) + b : b);
}
function u(a) {
return a.replace(s, "\\$&");
@ -247,85 +247,85 @@ function w(a) {
];
}));
}
function x(a, b, c) {
var d = q.exec(b.slice(c, c + 1));
return d ? (a.w = +d[0], c + d[0].length) : -1;
function x(c, d, a) {
var b = q.exec(d.slice(a, a + 1));
return b ? (c.w = +b[0], a + b[0].length) : -1;
}
function y(a, b, c) {
var d = q.exec(b.slice(c, c + 1));
return d ? (a.u = +d[0], c + d[0].length) : -1;
function y(c, d, a) {
var b = q.exec(d.slice(a, a + 1));
return b ? (c.u = +b[0], a + b[0].length) : -1;
}
function z(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.U = +d[0], c + d[0].length) : -1;
function z(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.U = +b[0], a + b[0].length) : -1;
}
function A(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.V = +d[0], c + d[0].length) : -1;
function A(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.V = +b[0], a + b[0].length) : -1;
}
function B(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.W = +d[0], c + d[0].length) : -1;
function B(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.W = +b[0], a + b[0].length) : -1;
}
function C(a, b, c) {
var d = q.exec(b.slice(c, c + 4));
return d ? (a.y = +d[0], c + d[0].length) : -1;
function C(c, d, a) {
var b = q.exec(d.slice(a, a + 4));
return b ? (c.y = +b[0], a + b[0].length) : -1;
}
function D(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.y = +d[0] + (+d[0] > 68 ? 1900 : 2000), c + d[0].length) : -1;
function D(c, d, b) {
var a = q.exec(d.slice(b, b + 2));
return a ? (c.y = +a[0] + (+a[0] > 68 ? 1900 : 2000), b + a[0].length) : -1;
}
function E(a, b, c) {
var d = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(b.slice(c, c + 6));
return d ? (a.Z = d[1] ? 0 : -(d[2] + (d[3] || "00")), c + d[0].length) : -1;
function E(c, d, b) {
var a = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(d.slice(b, b + 6));
return a ? (c.Z = a[1] ? 0 : -(a[2] + (a[3] || "00")), b + a[0].length) : -1;
}
function F(a, b, c) {
var d = q.exec(b.slice(c, c + 1));
return d ? (a.q = 3 * d[0] - 3, c + d[0].length) : -1;
function F(c, d, a) {
var b = q.exec(d.slice(a, a + 1));
return b ? (c.q = 3 * b[0] - 3, a + b[0].length) : -1;
}
function G(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.m = d[0] - 1, c + d[0].length) : -1;
function G(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.m = b[0] - 1, a + b[0].length) : -1;
}
function H(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.d = +d[0], c + d[0].length) : -1;
function H(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.d = +b[0], a + b[0].length) : -1;
}
function I(a, b, c) {
var d = q.exec(b.slice(c, c + 3));
return d ? (a.m = 0, a.d = +d[0], c + d[0].length) : -1;
function I(c, d, a) {
var b = q.exec(d.slice(a, a + 3));
return b ? (c.m = 0, c.d = +b[0], a + b[0].length) : -1;
}
function J(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.H = +d[0], c + d[0].length) : -1;
function J(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.H = +b[0], a + b[0].length) : -1;
}
function K(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.M = +d[0], c + d[0].length) : -1;
function K(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.M = +b[0], a + b[0].length) : -1;
}
function L(a, b, c) {
var d = q.exec(b.slice(c, c + 2));
return d ? (a.S = +d[0], c + d[0].length) : -1;
function L(c, d, a) {
var b = q.exec(d.slice(a, a + 2));
return b ? (c.S = +b[0], a + b[0].length) : -1;
}
function M(a, b, c) {
var d = q.exec(b.slice(c, c + 3));
return d ? (a.L = +d[0], c + d[0].length) : -1;
function M(c, d, a) {
var b = q.exec(d.slice(a, a + 3));
return b ? (c.L = +b[0], a + b[0].length) : -1;
}
function N(a, b, c) {
var d = q.exec(b.slice(c, c + 6));
return d ? (a.L = Math.floor(d[0] / 1000), c + d[0].length) : -1;
function N(c, d, a) {
var b = q.exec(d.slice(a, a + 6));
return b ? (c.L = Math.floor(b[0] / 1000), a + b[0].length) : -1;
}
function O(a, b, c) {
var d = r.exec(b.slice(c, c + 1));
return d ? c + d[0].length : -1;
function O(d, c, a) {
var b = r.exec(c.slice(a, a + 1));
return b ? a + b[0].length : -1;
}
function P(a, b, c) {
var d = q.exec(b.slice(c));
return d ? (a.Q = +d[0], c + d[0].length) : -1;
function P(c, d, b) {
var a = q.exec(d.slice(b));
return a ? (c.Q = +a[0], b + a[0].length) : -1;
}
function Q(a, b, c) {
var d = q.exec(b.slice(c));
return d ? (a.s = +d[0], c + d[0].length) : -1;
function Q(c, d, b) {
var a = q.exec(d.slice(b));
return a ? (c.s = +a[0], b + a[0].length) : -1;
}
function R(a, b) {
return t(a.getDate(), b, 2);
@ -354,9 +354,9 @@ function Y(a, b) {
function Z(a, b) {
return t(a.getSeconds(), b, 2);
}
function $(a) {
var b = a.getDay();
return 0 === b ? 7 : b;
function $(b) {
var a = b.getDay();
return 0 === a ? 7 : a;
}
function _(a, b) {
return t(c.count(f(a) - 1, a), b, 2);
@ -383,13 +383,13 @@ function fa(a, b) {
function ga(a, b) {
return t(a.getFullYear() % 10000, b, 4);
}
function ha(a, b) {
var c = a.getDay();
return t((a = c >= 4 || 0 === c ? e(a) : e.ceil(a)).getFullYear() % 10000, b, 4);
function ha(a, c) {
var b = a.getDay();
return t((a = b >= 4 || 0 === b ? e(a) : e.ceil(a)).getFullYear() % 10000, c, 4);
}
function ia(a) {
var b = a.getTimezoneOffset();
return (b > 0 ? "-" : (b *= -1, "+")) + t(b / 60 | 0, "0", 2) + t(b % 60, "0", 2);
function ia(b) {
var a = b.getTimezoneOffset();
return (a > 0 ? "-" : (a *= -1, "+")) + t(a / 60 | 0, "0", 2) + t(a % 60, "0", 2);
}
function ja(a, b) {
return t(a.getUTCDate(), b, 2);
@ -418,9 +418,9 @@ function qa(a, b) {
function ra(a, b) {
return t(a.getUTCSeconds(), b, 2);
}
function sa(a) {
var b = a.getUTCDay();
return 0 === b ? 7 : b;
function sa(b) {
var a = b.getUTCDay();
return 0 === a ? 7 : a;
}
function ta(a, b) {
return t(h.count(k(a) - 1, a), b, 2);
@ -447,9 +447,9 @@ function za(a, b) {
function Aa(a, b) {
return t(a.getUTCFullYear() % 10000, b, 4);
}
function Ba(a, b) {
var c = a.getUTCDay();
return t((a = c >= 4 || 0 === c ? j(a) : j.ceil(a)).getUTCFullYear() % 10000, b, 4);
function Ba(a, c) {
var b = a.getUTCDay();
return t((a = b >= 4 || 0 === b ? j(a) : j.ceil(a)).getUTCFullYear() % 10000, c, 4);
}
function Ca() {
return "+0000";

View File

@ -1,5 +1,5 @@
"use strict";
var a, b = require("@firebase/util"), c = require("tslib"), d = require("@firebase/component"), e = require("@firebase/app"), f = require("@firebase/logger"), g = function(a) {
var a, b = require("@firebase/util"), j = require("tslib"), k = require("@firebase/component"), c = require("@firebase/app"), f = require("@firebase/logger"), l = function(a) {
if (a && a.__esModule) return a;
var b = Object.create(null);
return a && Object.keys(a).forEach(function(c) {
@ -13,11 +13,11 @@ var a, b = require("@firebase/util"), c = require("tslib"), d = require("@fireba
});
}
}), b.default = a, Object.freeze(b);
}(e), h = function() {
}(c), m = function() {
var a = function(a, b) {
var c = this;
this._delegate = a, this.firebase = b, e._addComponent(a, new d.Component("app-compat", function() {
return c;
var d = this;
this._delegate = a, this.firebase = b, c._addComponent(a, new k.Component("app-compat", function() {
return d;
}, "PUBLIC")), this.container = a.container;
};
return Object.defineProperty(a.prototype, "automaticDataCollectionEnabled", {
@ -46,20 +46,20 @@ var a, b = require("@firebase/util"), c = require("tslib"), d = require("@fireba
return new Promise(function(b) {
a._delegate.checkDestroyed(), b();
}).then(function() {
return a.firebase.INTERNAL.removeApp(a.name), e.deleteApp(a._delegate);
return a.firebase.INTERNAL.removeApp(a.name), c.deleteApp(a._delegate);
});
}, a.prototype._getService = function(a, b) {
void 0 === b && (b = e._DEFAULT_ENTRY_NAME), this._delegate.checkDestroyed();
var c, d = this._delegate.container.getProvider(a);
return d.isInitialized() || (null === (c = d.getComponent()) || void 0 === c ? void 0 : c.instantiationMode) !== "EXPLICIT" || d.initialize(), d.getImmediate({
}, a.prototype._getService = function(e, b) {
void 0 === b && (b = c._DEFAULT_ENTRY_NAME), this._delegate.checkDestroyed();
var d, a = this._delegate.container.getProvider(e);
return a.isInitialized() || (null === (d = a.getComponent()) || void 0 === d ? void 0 : d.instantiationMode) !== "EXPLICIT" || a.initialize(), a.getImmediate({
identifier: b
});
}, a.prototype._removeServiceInstance = function(a, b) {
void 0 === b && (b = e._DEFAULT_ENTRY_NAME), this._delegate.container.getProvider(a).clearInstance(b);
}, a.prototype._removeServiceInstance = function(b, a) {
void 0 === a && (a = c._DEFAULT_ENTRY_NAME), this._delegate.container.getProvider(b).clearInstance(a);
}, a.prototype._addComponent = function(a) {
e._addComponent(this._delegate, a);
c._addComponent(this._delegate, a);
}, a.prototype._addOrOverwriteComponent = function(a) {
e._addOrOverwriteComponent(this._delegate, a);
c._addOrOverwriteComponent(this._delegate, a);
}, a.prototype.toJSON = function() {
return {
name: this.name,
@ -67,74 +67,74 @@ var a, b = require("@firebase/util"), c = require("tslib"), d = require("@fireba
options: this.options
};
}, a;
}(), i = ((a = {})["no-app"] = "No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()", a["invalid-app-argument"] = "firebase.{$appName}() takes either no argument or a Firebase App instance.", a), j = new b.ErrorFactory("app-compat", "Firebase", i);
function k() {
var a, d, e, f, i = (a = h, d = function(a) {
if (a = a || g._DEFAULT_ENTRY_NAME, !b.contains(e, a)) throw j.create("no-app", {
}(), g = ((a = {})["no-app"] = "No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()", a["invalid-app-argument"] = "firebase.{$appName}() takes either no argument or a Firebase App instance.", a), n = new b.ErrorFactory("app-compat", "Firebase", g);
function h() {
var e, c, f, a, d = (e = m, c = function(a) {
if (a = a || l._DEFAULT_ENTRY_NAME, !b.contains(f, a)) throw n.create("no-app", {
appName: a
});
return e[a];
}, e = {}, (f = {
return f[a];
}, f = {}, (a = {
__esModule: !0,
initializeApp: function(c, d) {
initializeApp: function(h, d) {
void 0 === d && (d = {});
var h = g.initializeApp(c, d);
if (b.contains(e, h.name)) return e[h.name];
var i = new a(h, f);
return e[h.name] = i, i;
var c = l.initializeApp(h, d);
if (b.contains(f, c.name)) return f[c.name];
var g = new e(c, a);
return f[c.name] = g, g;
},
app: d,
registerVersion: g.registerVersion,
setLogLevel: g.setLogLevel,
onLog: g.onLog,
app: c,
registerVersion: l.registerVersion,
setLogLevel: l.setLogLevel,
onLog: l.onLog,
apps: null,
SDK_VERSION: g.SDK_VERSION,
SDK_VERSION: l.SDK_VERSION,
INTERNAL: {
registerComponent: function(c) {
var e = c.name, h = e.replace("-compat", "");
if (g._registerComponent(c) && "PUBLIC" === c.type) {
var i = function(a) {
if (void 0 === a && (a = d()), "function" != typeof a[h]) throw j.create("invalid-app-argument", {
appName: e
registerComponent: function(d) {
var h = d.name, f = h.replace("-compat", "");
if (l._registerComponent(d) && "PUBLIC" === d.type) {
var g = function(a) {
if (void 0 === a && (a = c()), "function" != typeof a[f]) throw n.create("invalid-app-argument", {
appName: h
});
return a[h]();
return a[f]();
};
void 0 !== c.serviceProps && b.deepExtend(i, c.serviceProps), f[h] = i, a.prototype[h] = function() {
for(var a = [], b = 0; b < arguments.length; b++)a[b] = arguments[b];
return this._getService.bind(this, e).apply(this, c.multipleInstances ? a : []);
void 0 !== d.serviceProps && b.deepExtend(g, d.serviceProps), a[f] = g, e.prototype[f] = function() {
for(var b = [], a = 0; a < arguments.length; a++)b[a] = arguments[a];
return this._getService.bind(this, h).apply(this, d.multipleInstances ? b : []);
};
}
return "PUBLIC" === c.type ? f[h] : null;
return "PUBLIC" === d.type ? a[f] : null;
},
removeApp: function(a) {
delete e[a];
delete f[a];
},
useAsService: function(a, b) {
return "serverAuth" === b ? null : b;
useAsService: function(b, a) {
return "serverAuth" === a ? null : a;
},
modularAPIs: g
modularAPIs: l
}
}).default = f, Object.defineProperty(f, "apps", {
}).default = a, Object.defineProperty(a, "apps", {
get: function() {
return Object.keys(e).map(function(a) {
return e[a];
return Object.keys(f).map(function(a) {
return f[a];
});
}
}), d.App = a, f);
return i.INTERNAL = c.__assign(c.__assign({}, i.INTERNAL), {
createFirebaseNamespace: k,
}), c.App = e, a);
return d.INTERNAL = j.__assign(j.__assign({}, d.INTERNAL), {
createFirebaseNamespace: h,
extendNamespace: function(a) {
b.deepExtend(i, a);
b.deepExtend(d, a);
},
createSubscribe: b.createSubscribe,
ErrorFactory: b.ErrorFactory,
deepExtend: b.deepExtend
}), i;
}), d;
}
var l = k(), m = new f.Logger("@firebase/app-compat");
var i = h(), d = new f.Logger("@firebase/app-compat");
if (b.isBrowser() && void 0 !== self.firebase) {
m.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");
var n = self.firebase.SDK_VERSION;
n && n.indexOf("LITE") >= 0 && m.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ");
d.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");
var e = self.firebase.SDK_VERSION;
e && e.indexOf("LITE") >= 0 && d.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ");
}
e.registerVersion("@firebase/app-compat", "0.1.5", void 0), module.exports = l;
c.registerVersion("@firebase/app-compat", "0.1.5", void 0), module.exports = i;

View File

@ -1,49 +1,49 @@
export default function(c, e) {
try {
if ("string" == typeof c && c.length > 0) return (function(a) {
if ((a = String(a)).length > 100) throw new Error("Value exceeds the maximum length of 100 characters.");
var b = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);
if (!b) return NaN;
var c = parseFloat(b[1]), d = (b[2] || "ms").toLowerCase();
if ("string" == typeof c && c.length > 0) return (function(b) {
if ((b = String(b)).length > 100) throw new Error("Value exceeds the maximum length of 100 characters.");
var c = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(b);
if (!c) return NaN;
var a = parseFloat(c[1]), d = (c[2] || "ms").toLowerCase();
switch(d){
case "years":
case "year":
case "yrs":
case "yr":
case "y":
return 31557600000 * c;
return 31557600000 * a;
case "weeks":
case "week":
case "w":
return 604800000 * c;
return 604800000 * a;
case "days":
case "day":
case "d":
return 86400000 * c;
return 86400000 * a;
case "hours":
case "hour":
case "hrs":
case "hr":
case "h":
return 3600000 * c;
return 3600000 * a;
case "minutes":
case "minute":
case "mins":
case "min":
case "m":
return 60000 * c;
return 60000 * a;
case "seconds":
case "second":
case "secs":
case "sec":
case "s":
return 1000 * c;
return 1000 * a;
case "milliseconds":
case "millisecond":
case "msecs":
case "msec":
case "ms":
return c;
return a;
default:
throw new Error("The unit ".concat(d, " was matched, but no matching case exists."));
}
@ -59,12 +59,12 @@ function a(a) {
var b = Math.abs(a);
return b >= 86400000 ? "".concat(Math.round(a / 86400000), "d") : b >= 3600000 ? "".concat(Math.round(a / 3600000), "h") : b >= 60000 ? "".concat(Math.round(a / 60000), "m") : b >= 1000 ? "".concat(Math.round(a / 1000), "s") : "".concat(a, "ms");
}
function b(a) {
var b = Math.abs(a);
return b >= 86400000 ? c(a, b, 86400000, "day") : b >= 3600000 ? c(a, b, 3600000, "hour") : b >= 60000 ? c(a, b, 60000, "minute") : b >= 1000 ? c(a, b, 1000, "second") : "".concat(a, " ms");
function b(b) {
var a = Math.abs(b);
return a >= 86400000 ? c(b, a, 86400000, "day") : a >= 3600000 ? c(b, a, 3600000, "hour") : a >= 60000 ? c(b, a, 60000, "minute") : a >= 1000 ? c(b, a, 1000, "second") : "".concat(b, " ms");
}
function c(a, b, c, d) {
return "".concat(Math.round(a / c), " ").concat(d).concat(b >= 1.5 * c ? "s" : "");
function c(b, c, a, d) {
return "".concat(Math.round(b / a), " ").concat(d).concat(c >= 1.5 * a ? "s" : "");
}
function d(a) {
return "object" == typeof a && null !== a && "message" in a;

View File

@ -28,22 +28,22 @@ Promise.all(assignAll).then(function() {
return c.apply(this, arguments);
};
}());
export var listOfUser = function(c) {
var d;
return new Promise((d = a.asyncToGenerator(b.mark(function a(d, e) {
export var listOfUser = function(d) {
var c;
return new Promise((c = a.asyncToGenerator(b.mark(function a(c, e) {
var f;
return b.wrap(function(a) {
for(;;)switch(a.prev = a.next){
case 0:
f = "Select Distinct id from \"TABLE\" Where id = '".concat(c, "' And user_id IS not null"), postgreSQL.query(f, null, function(a, b) {
a ? e(a) : d(b.rows);
f = "Select Distinct id from \"TABLE\" Where id = '".concat(d, "' And user_id IS not null"), postgreSQL.query(f, null, function(a, b) {
a ? e(a) : c(b.rows);
});
case 2:
case "end":
return a.stop();
}
}, a);
})), function(d, e) {
return d.apply(this, arguments);
})), function(c, e) {
return c.apply(this, arguments);
}));
};

View File

@ -1,28 +1,28 @@
import * as a from "@swc/helpers";
Promise.all(assignAll).then(function() {
var b = a.asyncToGenerator(function*(a) {
var b = a.asyncToGenerator(function*(e) {
let b = "DELETE FROM \"TABLE\" WHERE \"UUID\" IN ( ";
for(let c in obj){
let d = obj[c];
b += `'${d.id}', `;
let e = yield listOfUser(d.id);
e.forEach((a)=>{
insertQuery += `INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES ('${uuidv4()}', '${d.id}', now());`;
let a = obj[c];
b += `'${a.id}', `;
let d = yield listOfUser(a.id);
d.forEach((b)=>{
insertQuery += `INSERT INTO "TABLE"("UUID", id, other_ids_here) VALUES ('${uuidv4()}', '${a.id}', now());`;
});
}
});
return function(a) {
return function(e) {
return b.apply(this, arguments);
};
}());
export const listOfUser = function(b) {
var c;
return new Promise((c = a.asyncToGenerator(function*(a, c) {
const d = `Select Distinct id from "TABLE" Where id = '${b}' And user_id IS not null`;
postgreSQL.query(d, null, function(b, d) {
b ? c(b) : a(d.rows);
export const listOfUser = function(c) {
var b;
return new Promise((b = a.asyncToGenerator(function*(b, d) {
const a = `Select Distinct id from "TABLE" Where id = '${c}' And user_id IS not null`;
postgreSQL.query(a, null, function(a, c) {
a ? d(a) : b(c.rows);
});
}), function(a, c) {
return c.apply(this, arguments);
}), function(b, d) {
return b.apply(this, arguments);
}));
};

View File

@ -5,9 +5,9 @@ import * as f from "react";
export default function g() {
var g = a.slicedToArray(f.useState({
hits: []
}), 2), h = g[0], i = g[1], j = a.slicedToArray(f.useState("react"), 2), k = j[0], l = j[1];
}), 2), j = g[0], k = g[1], h = a.slicedToArray(f.useState("react"), 2), i = h[0], l = h[1];
return f.useEffect(function() {
"" !== k && (function() {
"" !== i && (function() {
return c.apply(this, arguments);
})();
function c() {
@ -16,11 +16,11 @@ export default function g() {
return b.wrap(function(a) {
for(;;)switch(a.prev = a.next){
case 0:
return a.next = 2, fetch("https://hn.algolia.com/api/v1/search?query=" + k);
return a.next = 2, fetch("https://hn.algolia.com/api/v1/search?query=" + i);
case 2:
return c = a.sent, a.next = 5, c.json();
case 5:
i(d = a.sent);
k(d = a.sent);
case 7:
case "end":
return a.stop();
@ -29,17 +29,17 @@ export default function g() {
}))).apply(this, arguments);
}
}, [
k
i
]), d(e, {
children: [
c("input", {
value: k,
value: i,
onChange: function(a) {
return l(a.target.value);
}
}),
c("ul", {
children: h.hits.map(function(a) {
children: j.hits.map(function(a) {
return c("li", {
children: c("a", {
href: a.url,

View File

@ -2,69 +2,69 @@
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = void 0;
var a = require("react/jsx-runtime"), b = function(a) {
var d = require("react/jsx-runtime"), c = function(a) {
if (a && a.__esModule) return a;
var b = {};
var c = {};
if (null != a) {
for(var c in a)if (Object.prototype.hasOwnProperty.call(a, c)) {
var d = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(a, c) : {};
d.get || d.set ? Object.defineProperty(b, c, d) : b[c] = a[c];
for(var b in a)if (Object.prototype.hasOwnProperty.call(a, b)) {
var d = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(a, b) : {};
d.get || d.set ? Object.defineProperty(c, b, d) : c[b] = a[b];
}
}
return b.default = a, b;
}(require("react")), c = function(a) {
return c.default = a, c;
}(require("react")), a = function(a) {
return a && a.__esModule ? a : {
default: a
};
}(require("prop-types"));
function d(a, b) {
for(var c = 0; c < b.length; c++){
var d = b[c];
d.enumerable = d.enumerable || !1, d.configurable = !0, "value" in d && (d.writable = !0), Object.defineProperty(a, d.key, d);
function e(d, c) {
for(var b = 0; b < c.length; b++){
var a = c[b];
a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(d, a.key, a);
}
}
function e(a, c, d) {
return c in a ? Object.defineProperty(a, c, {
value: d,
function f(a, b, c) {
return b in a ? Object.defineProperty(a, b, {
value: c,
enumerable: !0,
configurable: !0,
writable: !0
}) : a[c] = d, a;
}
function f(a) {
return f = Object.setPrototypeOf ? Object.getPrototypeOf : function f(a) {
return a.__proto__ || Object.getPrototypeOf(a);
}, f(a);
}) : a[b] = c, a;
}
function g(a) {
for(var c = 1; c < arguments.length; c++){
var d = null != arguments[c] ? arguments[c] : {}, f = Object.keys(d);
"function" == typeof Object.getOwnPropertySymbols && (f = f.concat(Object.getOwnPropertySymbols(d).filter(function(a) {
return Object.getOwnPropertyDescriptor(d, a).enumerable;
}))), f.forEach(function(c) {
e(a, c, d[c]);
return g = Object.setPrototypeOf ? Object.getPrototypeOf : function g(a) {
return a.__proto__ || Object.getPrototypeOf(a);
}, g(a);
}
function h(d) {
for(var b = 1; b < arguments.length; b++){
var e = null != arguments[b] ? arguments[b] : {}, c = Object.keys(e);
"function" == typeof Object.getOwnPropertySymbols && (c = c.concat(Object.getOwnPropertySymbols(e).filter(function(a) {
return Object.getOwnPropertyDescriptor(e, a).enumerable;
}))), c.forEach(function(b) {
f(d, b, e[b]);
});
}
return a;
return d;
}
function h(a, b) {
return h = Object.setPrototypeOf || function h(a, b) {
function i(a, b) {
return i = Object.setPrototypeOf || function i(a, b) {
return a.__proto__ = b, a;
}, h(a, b);
}, i(a, b);
}
var i = function(b) {
var b = function(l) {
"use strict";
!function(a, b) {
if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function");
a.prototype = Object.create(b && b.prototype, {
!function(b, a) {
if ("function" != typeof a && null !== a) throw new TypeError("Super expression must either be null or a function");
b.prototype = Object.create(a && a.prototype, {
constructor: {
value: a,
value: b,
writable: !0,
configurable: !0
}
}), b && h(a, b);
}(i, b);
var c, e, j, k, l, m = (k = i, l = function() {
}), a && i(b, a);
}(b, l);
var c, f, j, m, n, o = (m = b, n = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
@ -74,25 +74,25 @@ var i = function(b) {
return !1;
}
}(), function() {
var a, b, c, d, e = f(k);
if (l) {
var g = f(this).constructor;
d = Reflect.construct(e, arguments, g);
} else d = e.apply(this, arguments);
return b = this, (c = d) && ("object" == ((a = c) && "undefined" != typeof Symbol && a.constructor === Symbol ? "symbol" : typeof a) || "function" == typeof c) ? c : (function(b) {
if (void 0 === b) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return b;
})(b);
var a, e, b, d, f = g(m);
if (n) {
var h = g(this).constructor;
d = Reflect.construct(f, arguments, h);
} else d = f.apply(this, arguments);
return e = this, (b = d) && ("object" == ((a = b) && "undefined" != typeof Symbol && a.constructor === Symbol ? "symbol" : typeof a) || "function" == typeof b) ? b : (function(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
})(e);
});
function i() {
function b() {
var a;
return !function(a, c) {
if (!(a instanceof c)) throw new TypeError("Cannot call a class as a function");
}(this, i), a = m.apply(this, arguments), a.storeHighlightedItemReference = function(b) {
}(this, b), a = o.apply(this, arguments), a.storeHighlightedItemReference = function(b) {
a.props.onHighlightedItemChange(null === b ? null : b.item);
}, a;
}
return c = i, e = [
return c = b, f = [
{
key: "shouldComponentUpdate",
value: function(a) {
@ -102,46 +102,46 @@ var i = function(b) {
{
key: "render",
value: function() {
var b = this, c = this.props, d = c.items, e = c.itemProps, f = c.renderItem, h = c.renderItemData, i = c.sectionIndex, j = c.highlightedItemIndex, k = c.getItemId, l = c.theme, m = c.keyPrefix, n = null === i ? m : "".concat(m, "section-").concat(i, "-"), o = "function" == typeof e;
return a.jsx("ul", g({
var j = this, a = this.props, e = a.items, f = a.itemProps, k = a.renderItem, l = a.renderItemData, b = a.sectionIndex, m = a.highlightedItemIndex, n = a.getItemId, g = a.theme, c = a.keyPrefix, i = null === b ? c : "".concat(c, "section-").concat(b, "-"), o = "function" == typeof f;
return d.jsx("ul", h({
role: "listbox"
}, l("".concat(n, "items-list"), "itemsList"), {
children: d.map(function(c, d) {
var m = d === j, p = "".concat(n, "item-").concat(d), q = o ? e({
sectionIndex: i,
itemIndex: d
}) : e, r = g({
id: k(i, d),
"aria-selected": m
}, l(p, "item", 0 === d && "itemFirst", m && "itemHighlighted"), q);
return m && (r.ref = b.storeHighlightedItemReference), a.jsx(Item, g({}, r, {
sectionIndex: i,
isHighlighted: m,
itemIndex: d,
item: c,
renderItem: f,
renderItemData: h
}, g("".concat(i, "items-list"), "itemsList"), {
children: e.map(function(p, a) {
var c = a === m, q = "".concat(i, "item-").concat(a), r = o ? f({
sectionIndex: b,
itemIndex: a
}) : f, e = h({
id: n(b, a),
"aria-selected": c
}, g(q, "item", 0 === a && "itemFirst", c && "itemHighlighted"), r);
return c && (e.ref = j.storeHighlightedItemReference), d.jsx(Item, h({}, e, {
sectionIndex: b,
isHighlighted: c,
itemIndex: a,
item: p,
renderItem: k,
renderItemData: l
}));
})
}));
}
}
], d(c.prototype, e), j && d(c, j), i;
}(b.Component);
exports.default = i, i.propTypes = {
items: c.default.array.isRequired,
itemProps: c.default.oneOfType([
c.default.object,
c.default.func
], e(c.prototype, f), j && e(c, j), b;
}(c.Component);
exports.default = b, b.propTypes = {
items: a.default.array.isRequired,
itemProps: a.default.oneOfType([
a.default.object,
a.default.func
]),
renderItem: c.default.func.isRequired,
renderItemData: c.default.object.isRequired,
sectionIndex: c.default.number,
highlightedItemIndex: c.default.number,
onHighlightedItemChange: c.default.func.isRequired,
getItemId: c.default.func.isRequired,
theme: c.default.func.isRequired,
keyPrefix: c.default.string.isRequired
}, i.defaultProps = {
renderItem: a.default.func.isRequired,
renderItemData: a.default.object.isRequired,
sectionIndex: a.default.number,
highlightedItemIndex: a.default.number,
onHighlightedItemChange: a.default.func.isRequired,
getItemId: a.default.func.isRequired,
theme: a.default.func.isRequired,
keyPrefix: a.default.string.isRequired
}, b.defaultProps = {
sectionIndex: null
}, new i();
}, new b();

View File

@ -2,65 +2,65 @@
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.default = void 0;
var a = require("react/jsx-runtime"), b = function(a) {
var c = require("react/jsx-runtime"), b = function(a) {
if (a && a.__esModule) return a;
var b = {};
var c = {};
if (null != a) {
for(var c in a)if (Object.prototype.hasOwnProperty.call(a, c)) {
var d = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(a, c) : {};
d.get || d.set ? Object.defineProperty(b, c, d) : b[c] = a[c];
for(var b in a)if (Object.prototype.hasOwnProperty.call(a, b)) {
var d = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(a, b) : {};
d.get || d.set ? Object.defineProperty(c, b, d) : c[b] = a[b];
}
}
return b.default = a, b;
return c.default = a, c;
}(require("react"));
function c(a, b) {
for(var c = 0; c < b.length; c++){
var d = b[c];
d.enumerable = d.enumerable || !1, d.configurable = !0, "value" in d && (d.writable = !0), Object.defineProperty(a, d.key, d);
function d(d, c) {
for(var b = 0; b < c.length; b++){
var a = c[b];
a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(d, a.key, a);
}
}
function d(a, c, d) {
return c in a ? Object.defineProperty(a, c, {
value: d,
function e(a, b, c) {
return b in a ? Object.defineProperty(a, b, {
value: c,
enumerable: !0,
configurable: !0,
writable: !0
}) : a[c] = d, a;
}
function e(a) {
return e = Object.setPrototypeOf ? Object.getPrototypeOf : function e(a) {
return a.__proto__ || Object.getPrototypeOf(a);
}, e(a);
}) : a[b] = c, a;
}
function f(a) {
for(var c = 1; c < arguments.length; c++){
var e = null != arguments[c] ? arguments[c] : {}, f = Object.keys(e);
"function" == typeof Object.getOwnPropertySymbols && (f = f.concat(Object.getOwnPropertySymbols(e).filter(function(a) {
return Object.getOwnPropertyDescriptor(e, a).enumerable;
}))), f.forEach(function(c) {
d(a, c, e[c]);
return f = Object.setPrototypeOf ? Object.getPrototypeOf : function f(a) {
return a.__proto__ || Object.getPrototypeOf(a);
}, f(a);
}
function g(d) {
for(var b = 1; b < arguments.length; b++){
var f = null != arguments[b] ? arguments[b] : {}, c = Object.keys(f);
"function" == typeof Object.getOwnPropertySymbols && (c = c.concat(Object.getOwnPropertySymbols(f).filter(function(a) {
return Object.getOwnPropertyDescriptor(f, a).enumerable;
}))), c.forEach(function(b) {
e(d, b, f[b]);
});
}
return a;
return d;
}
function g(a, b) {
return g = Object.setPrototypeOf || function g(a, b) {
function h(a, b) {
return h = Object.setPrototypeOf || function h(a, b) {
return a.__proto__ = b, a;
}, g(a, b);
}, h(a, b);
}
var h = function(b) {
var a = function(k) {
"use strict";
!function(a, b) {
if ("function" != typeof b && null !== b) throw new TypeError("Super expression must either be null or a function");
a.prototype = Object.create(b && b.prototype, {
!function(b, a) {
if ("function" != typeof a && null !== a) throw new TypeError("Super expression must either be null or a function");
b.prototype = Object.create(a && a.prototype, {
constructor: {
value: a,
value: b,
writable: !0,
configurable: !0
}
}), b && g(a, b);
}(h, b);
var d, i, j, k, l, m = (k = h, l = function() {
}), a && h(b, a);
}(a, k);
var b, e, i, l, m, n = (l = a, m = function() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
@ -70,25 +70,25 @@ var h = function(b) {
return !1;
}
}(), function() {
var a, b, c, d, f = e(k);
if (l) {
var g = e(this).constructor;
d = Reflect.construct(f, arguments, g);
} else d = f.apply(this, arguments);
return b = this, (c = d) && ("object" == ((a = c) && "undefined" != typeof Symbol && a.constructor === Symbol ? "symbol" : typeof a) || "function" == typeof c) ? c : (function(b) {
if (void 0 === b) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return b;
})(b);
var a, e, b, d, g = f(l);
if (m) {
var h = f(this).constructor;
d = Reflect.construct(g, arguments, h);
} else d = g.apply(this, arguments);
return e = this, (b = d) && ("object" == ((a = b) && "undefined" != typeof Symbol && a.constructor === Symbol ? "symbol" : typeof a) || "function" == typeof b) ? b : (function(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e;
})(e);
});
function h() {
var a;
return !function(a, d) {
if (!(a instanceof d)) throw new TypeError("Cannot call a class as a function");
}(this, h), a = m.apply(this, arguments), a.storeHighlightedItemReference = function(b) {
a.props.onHighlightedItemChange(null === b ? null : b.item);
}, a;
function a() {
var c;
return !function(a, b) {
if (!(a instanceof b)) throw new TypeError("Cannot call a class as a function");
}(this, a), c = n.apply(this, arguments), c.storeHighlightedItemReference = function(a) {
c.props.onHighlightedItemChange(null === a ? null : a.item);
}, c;
}
return d = h, i = [
return b = a, e = [
{
key: "shouldComponentUpdate",
value: function(a) {
@ -100,34 +100,34 @@ var h = function(b) {
{
key: "render",
value: function() {
var b = this, c = this.props, d = c.items, e = c.itemProps, g = c.renderItem, h = c.renderItemData, i = c.sectionIndex, j = c.highlightedItemIndex, k = c.getItemId, l = c.theme, m = c.keyPrefix, n = null === i ? m : "".concat(m, "section-").concat(i, "-"), o = "function" == typeof e;
return a.jsx("ul", f({
var j = this, a = this.props, e = a.items, f = a.itemProps, k = a.renderItem, l = a.renderItemData, b = a.sectionIndex, m = a.highlightedItemIndex, n = a.getItemId, h = a.theme, d = a.keyPrefix, i = null === b ? d : "".concat(d, "section-").concat(b, "-"), o = "function" == typeof f;
return c.jsx("ul", g({
role: "listbox"
}, l("".concat(n, "items-list"), "itemsList"), {
children: d.map(function(c, d) {
var m = d === j, p = "".concat(n, "item-").concat(d), q = o ? e({
sectionIndex: i,
itemIndex: d
}) : e, r = f({
id: k(i, d),
"aria-selected": m
}, l(p, "item", 0 === d && "itemFirst", m && "itemHighlighted"), q);
return m && (r.ref = b.storeHighlightedItemReference), a.jsx(Item, f({}, r, {
sectionIndex: i,
isHighlighted: m,
itemIndex: d,
item: c,
renderItem: g,
renderItemData: h
}, h("".concat(i, "items-list"), "itemsList"), {
children: e.map(function(p, a) {
var d = a === m, q = "".concat(i, "item-").concat(a), r = o ? f({
sectionIndex: b,
itemIndex: a
}) : f, e = g({
id: n(b, a),
"aria-selected": d
}, h(q, "item", 0 === a && "itemFirst", d && "itemHighlighted"), r);
return d && (e.ref = j.storeHighlightedItemReference), c.jsx(Item, g({}, e, {
sectionIndex: b,
isHighlighted: d,
itemIndex: a,
item: p,
renderItem: k,
renderItemData: l
}));
})
}));
}
}
], c(d.prototype, i), j && c(d, j), h;
], d(b.prototype, e), i && d(b, i), a;
}(b.Component);
exports.default = h, h.propTypes = {
exports.default = a, a.propTypes = {
items: 500
}, h.defaultProps = {
}, a.defaultProps = {
sectionIndex: null
}, new h();
}, new a();

View File

@ -19,39 +19,39 @@ var i = function(a) {
return Boolean(a.props.indexId);
}, l = function(a, b) {
return a.props.indexId === b;
}, m = function(a, b) {
var c = k(a), d = k(b);
return c && !d ? -1 : !c && d ? 1 : 0;
}, m = function(c, d) {
var a = k(c), b = k(d);
return a && !b ? -1 : !a && b ? 1 : 0;
};
export default function n(e) {
var f = e.indexName, g = e.initialState, n = e.searchClient, p = e.resultsState, q = e.stalledSearchDelay, r = function(a) {
return C.getWidgets().filter(function(a) {
var p = e.indexName, q = e.initialState, g = e.searchClient, n = e.resultsState, z = e.stalledSearchDelay, A = function(a) {
return v.getWidgets().filter(function(a) {
return Boolean(a.getMetadata);
}).map(function(b) {
return b.getMetadata(a);
});
}, s = function() {
var b = C.getWidgets().filter(function(a) {
var b = v.getWidgets().filter(function(a) {
return Boolean(a.getSearchParameters);
}).filter(function(a) {
return !i(a) && !k(a);
}).reduce(function(a, b) {
return b.getSearchParameters(a);
}, B), c = C.getWidgets().filter(function(a) {
}, G), c = v.getWidgets().filter(function(a) {
return Boolean(a.getSearchParameters);
}).filter(function(a) {
var b = i(a) && j(a, f), c = k(a) && l(a, f);
var b = i(a) && j(a, p), c = k(a) && l(a, p);
return b || c;
}).sort(m).reduce(function(a, b) {
return b.getSearchParameters(a);
}, b), d = C.getWidgets().filter(function(a) {
}, b), d = v.getWidgets().filter(function(a) {
return Boolean(a.getSearchParameters);
}).filter(function(a) {
var b = i(a) && !j(a, f), c = k(a) && !l(a, f);
var b = i(a) && !j(a, p), c = k(a) && !l(a, p);
return b || c;
}).sort(m).reduce(function(b, c) {
var d = i(c) ? c.props.indexContextValue.targetedIndex : c.props.indexId, e = b[d] || [];
return a.objectSpread({}, b, a.defineProperty({}, d, e.concat(c)));
}).sort(m).reduce(function(c, b) {
var d = i(b) ? b.props.indexContextValue.targetedIndex : b.props.indexId, e = c[d] || [];
return a.objectSpread({}, c, a.defineProperty({}, d, e.concat(b)));
}, {}), e = Object.keys(d).map(function(a) {
return {
parameters: d[a].reduce(function(a, b) {
@ -64,49 +64,49 @@ export default function n(e) {
mainParameters: c,
derivedParameters: e
};
}, t = function() {
if (!z) {
var a = s(y.state), b = a.mainParameters, c = a.derivedParameters;
y.derivedHelpers.slice().forEach(function(a) {
}, B = function() {
if (!E) {
var a = s(r.state), b = a.mainParameters, c = a.derivedParameters;
r.derivedHelpers.slice().forEach(function(a) {
a.detach();
}), c.forEach(function(a) {
var b = a.indexId, c = a.parameters, d = y.derive(function() {
return c;
var b = a.indexId, d = a.parameters, c = r.derive(function() {
return d;
});
d.on("result", u({
c.on("result", t({
indexId: b
})).on("error", v);
}), y.setState(b), y.search();
})).on("error", u);
}), r.setState(b), r.search();
}
}, u = function(b) {
}, t = function(b) {
var c = b.indexId;
return function(b) {
var d = G.getState(), e = !y.derivedHelpers.length, f = d.results ? d.results : {};
f = !e && f.getFacetByName ? {} : f, f = e ? b.results : a.objectSpread({}, f, a.defineProperty({}, c, b.results));
var g = G.getState(), h = g.isSearchStalled;
y.hasPendingRequests() || (clearTimeout(A), A = null, h = !1), g.resultsFacetValues;
var i = a.objectWithoutProperties(g, [
return function(e) {
var f = y.getState(), g = !r.derivedHelpers.length, b = f.results ? f.results : {};
b = !g && b.getFacetByName ? {} : b, b = g ? e.results : a.objectSpread({}, b, a.defineProperty({}, c, e.results));
var d = y.getState(), h = d.isSearchStalled;
r.hasPendingRequests() || (clearTimeout(F), F = null, h = !1), d.resultsFacetValues;
var i = a.objectWithoutProperties(d, [
"resultsFacetValues"
]);
G.setState(a.objectSpread({}, i, {
results: f,
y.setState(a.objectSpread({}, i, {
results: b,
isSearchStalled: h,
searching: !1,
error: null
}));
};
}, v = function(b) {
var c = b.error, d = G.getState(), e = d.isSearchStalled;
y.hasPendingRequests() || (clearTimeout(A), e = !1), d.resultsFacetValues;
var f = a.objectWithoutProperties(d, [
}, u = function(d) {
var e = d.error, b = y.getState(), c = b.isSearchStalled;
r.hasPendingRequests() || (clearTimeout(F), c = !1), b.resultsFacetValues;
var f = a.objectWithoutProperties(b, [
"resultsFacetValues"
]);
G.setState(a.objectSpread({}, f, {
isSearchStalled: e,
error: c,
y.setState(a.objectSpread({}, f, {
isSearchStalled: c,
error: e,
searching: !1
}));
}, w = function(b, c) {
}, C = function(b, c) {
if (b.transporter) {
b.transporter.responsesCache.set({
method: "search",
@ -142,7 +142,7 @@ export default function n(e) {
return a.concat(b.rawResults);
}, [])
})));
}, x = function(b, c) {
}, D = function(b, c) {
if (b.transporter) {
b.transporter.responsesCache.set({
method: "search",
@ -170,41 +170,41 @@ export default function n(e) {
b.cache = a.objectSpread({}, b.cache, a.defineProperty({}, d, JSON.stringify({
results: c.rawResults
})));
}, y = b(n, f, a.objectSpread({}, d));
h(n), y.on("search", function() {
A || (A = setTimeout(function() {
var b = G.getState(), c = b.resultsFacetValues, d = a.objectWithoutProperties(b, [
}, r = b(g, p, a.objectSpread({}, d));
h(g), r.on("search", function() {
F || (F = setTimeout(function() {
var b = y.getState(), d = b.resultsFacetValues, c = a.objectWithoutProperties(b, [
"resultsFacetValues"
]);
G.setState(a.objectSpread({}, d, {
y.setState(a.objectSpread({}, c, {
isSearchStalled: !0
}));
}, q));
}).on("result", u({
indexId: f
})).on("error", v);
var z = !1, A = null, B = y.state, C = c(function() {
var b = r(G.getState().widgets);
G.setState(a.objectSpread({}, G.getState(), {
}, z));
}).on("result", t({
indexId: p
})).on("error", u);
var E = !1, F = null, G = r.state, v = c(function() {
var b = A(y.getState().widgets);
y.setState(a.objectSpread({}, y.getState(), {
metadata: b,
searching: !0
})), t();
})), B();
});
!function(b, c) {
if (c && (b.transporter && !b._cacheHydrated || b._useCache && "function" == typeof b.addAlgoliaAgent)) {
if (b.transporter && !b._cacheHydrated) {
b._cacheHydrated = !0;
var d = b.search;
b.search = function(c) {
for(var e = arguments.length, f = new Array(e > 1 ? e - 1 : 0), g = 1; g < e; g++)f[g - 1] = arguments[g];
var h = c.map(function(b) {
b.search = function(g) {
for(var e = arguments.length, f = new Array(e > 1 ? e - 1 : 0), c = 1; c < e; c++)f[c - 1] = arguments[c];
var h = g.map(function(b) {
var c, d;
return a.objectSpread({}, b, {
params: (c = b.params, d = function(a) {
for(var b = arguments.length, c = new Array(b > 1 ? b - 1 : 0), d = 1; d < b; d++)c[d - 1] = arguments[d];
params: (c = b.params, d = function(c) {
for(var b = arguments.length, d = new Array(b > 1 ? b - 1 : 0), a = 1; a < b; a++)d[a - 1] = arguments[a];
var e = 0;
return a.replace(/%s/g, function() {
return encodeURIComponent(c[e++]);
return c.replace(/%s/g, function() {
return encodeURIComponent(d[e++]);
});
}, Object.keys(c).map(function(a) {
var b;
@ -219,65 +219,65 @@ export default function n(e) {
].concat(a.toConsumableArray(f))
}, function() {
return d.apply(void 0, [
c
g
].concat(a.toConsumableArray(f)));
});
};
}
if (Array.isArray(c.results)) {
w(b, c.results);
C(b, c.results);
return;
}
x(b, c);
D(b, c);
}
}(n, p);
var D, E, F, G = (E = {
widgets: void 0 === g ? {} : g,
metadata: o(p),
results: (D = p) ? Array.isArray(D.results) ? D.results.reduce(function(c, d) {
return a.objectSpread({}, c, a.defineProperty({}, d._internalIndexId, new b.SearchResults(new b.SearchParameters(d.state), d.rawResults)));
}, {}) : new b.SearchResults(new b.SearchParameters(D.state), D.rawResults) : null,
}(g, n);
var f, w, x, y = (w = {
widgets: void 0 === q ? {} : q,
metadata: o(n),
results: (f = n) ? Array.isArray(f.results) ? f.results.reduce(function(d, c) {
return a.objectSpread({}, d, a.defineProperty({}, c._internalIndexId, new b.SearchResults(new b.SearchParameters(c.state), c.rawResults)));
}, {}) : new b.SearchResults(new b.SearchParameters(f.state), f.rawResults) : null,
error: null,
searching: !1,
isSearchStalled: !0,
searchingForFacetValues: !1
}, F = [], {
}, x = [], {
getState: function() {
return E;
return w;
},
setState: function(a) {
E = a, F.forEach(function(a) {
w = a, x.forEach(function(a) {
return a();
});
},
subscribe: function(a) {
return F.push(a), function() {
F.splice(F.indexOf(a), 1);
return x.push(a), function() {
x.splice(x.indexOf(a), 1);
};
}
});
return {
store: G,
widgetsManager: C,
store: y,
widgetsManager: v,
getWidgetsIds: function() {
return G.getState().metadata.reduce(function(a, b) {
return y.getState().metadata.reduce(function(a, b) {
return void 0 !== b.id ? a.concat(b.id) : a;
}, []);
},
getSearchParameters: s,
onSearchForFacetValues: function(b) {
var c = b.facetName, d = b.query, e = b.maxFacetHits;
G.setState(a.objectSpread({}, G.getState(), {
var d = b.facetName, e = b.query, c = b.maxFacetHits;
y.setState(a.objectSpread({}, y.getState(), {
searchingForFacetValues: !0
})), y.searchForFacetValues(c, d, Math.max(1, Math.min(void 0 === e ? 10 : e, 100))).then(function(b) {
var e;
G.setState(a.objectSpread({}, G.getState(), {
})), r.searchForFacetValues(d, e, Math.max(1, Math.min(void 0 === c ? 10 : c, 100))).then(function(c) {
var b;
y.setState(a.objectSpread({}, y.getState(), {
error: null,
searchingForFacetValues: !1,
resultsFacetValues: a.objectSpread({}, G.getState().resultsFacetValues, (e = {}, a.defineProperty(e, c, b.facetHits), a.defineProperty(e, "query", d), e))
resultsFacetValues: a.objectSpread({}, y.getState().resultsFacetValues, (b = {}, a.defineProperty(b, d, c.facetHits), a.defineProperty(b, "query", e), b))
}));
}, function(b) {
G.setState(a.objectSpread({}, G.getState(), {
y.setState(a.objectSpread({}, y.getState(), {
searchingForFacetValues: !1,
error: b
}));
@ -288,32 +288,32 @@ export default function n(e) {
});
},
onExternalStateUpdate: function(b) {
var c = r(b);
G.setState(a.objectSpread({}, G.getState(), {
var c = A(b);
y.setState(a.objectSpread({}, y.getState(), {
widgets: b,
metadata: c,
searching: !0
})), t();
})), B();
},
transitionState: function(a) {
var b = G.getState().widgets;
return C.getWidgets().filter(function(a) {
var b = y.getState().widgets;
return v.getWidgets().filter(function(a) {
return Boolean(a.transitionState);
}).reduce(function(a, c) {
return c.transitionState(b, a);
}, a);
},
updateClient: function(a) {
h(a), y.setClient(a), t();
h(a), r.setClient(a), B();
},
updateIndex: function(a) {
B = B.setIndex(a);
G = G.setIndex(a);
},
clearCache: function() {
y.clearCache(), t();
r.clearCache(), B();
},
skipSearch: function() {
z = !0;
E = !0;
}
};
};

View File

@ -1,4 +1,4 @@
for(var a = 0; a < points.length; a++)for(var b in points[a], keys){
for(var c = 0; c < keys[key].length; c++)console.log(c);
for(var a = 0; a < points.length; a++)for(var c in points[a], keys){
for(var b = 0; b < keys[key].length; b++)console.log(b);
console.log(a);
}

View File

@ -1,8 +1,75 @@
use swc_ecma_ast::Module;
use std::cmp::Ordering;
use swc_common::collections::AHashMap;
use swc_ecma_ast::*;
use swc_ecma_visit::{noop_visit_type, Visit};
use crate::util::base54::{incr_base54, BASE54_DEFAULT_CHARS};
/// TODO: Use [u8; 64] instead
type CharFreq = AHashMap<u8, f32>;
#[derive(Debug)]
pub struct CharFreqInfo {}
pub(crate) struct CharFreqInfo {
frequency: CharFreq,
pub fn compute_char_freq(_: &Module) -> CharFreqInfo {
CharFreqInfo {}
chars: [u8; 64],
}
pub(crate) fn compute_char_freq(_m: &Module) -> CharFreqInfo {
let mut base54 = CharFreqInfo {
frequency: AHashMap::with_capacity_and_hasher(64, Default::default()),
chars: *BASE54_DEFAULT_CHARS,
};
// TODO: Implement more visitor methods (or use codegen) and enable this
// m.visit_with(&mut base54);
base54.sort();
base54
}
impl CharFreqInfo {
fn consider(&mut self, s: &str, delta: f32) {
for c in s.chars().rev().filter_map(|c| {
if c.len_utf8() == 1 {
let b = c as u8;
if BASE54_DEFAULT_CHARS.contains(&b) {
return Some(b);
}
None
} else {
None
}
}) {
let freq = self.frequency.entry(c).or_insert(0.0);
*freq += delta;
}
}
fn sort(&mut self) {
fn cmp(f: &CharFreq, a: u8, b: u8) -> Ordering {
let af = f.get(&a).copied().unwrap_or(0.0);
let bf = f.get(&b).copied().unwrap_or(0.0);
af.partial_cmp(&bf).unwrap_or_else(|| a.cmp(&b))
}
self.chars[..53].sort_by(|&a, &b| cmp(&self.frequency, a, b));
self.chars[53..].sort_by(|&a, &b| cmp(&self.frequency, a, b));
}
/// returns `(used_value, identifier_symbol)`
pub fn incr_base54(&self, init: &mut usize) -> (usize, String) {
incr_base54(init, &self.chars)
}
}
impl Visit for CharFreqInfo {
noop_visit_type!();
fn visit_ident(&mut self, i: &Ident) {
self.consider(&i.sym, 1.0);
}
}

View File

@ -7,6 +7,7 @@ use tracing::trace;
use self::scope::Scope;
use super::rename_map::RenameMap;
use crate::pass::compute_char_freq::CharFreqInfo;
mod scope;
@ -17,11 +18,16 @@ pub(super) struct Analyzer {
}
impl Analyzer {
pub(super) fn into_rename_map(mut self, preserved: &AHashSet<Id>) -> AHashMap<Id, JsWord> {
pub(super) fn into_rename_map(
mut self,
freq: &CharFreqInfo,
preserved: &AHashSet<Id>,
) -> AHashMap<Id, JsWord> {
let mut map = RenameMap::default();
let preserved_symbols = preserved.iter().cloned().map(|v| v.0).collect();
self.scope.rename(&mut map, preserved, &preserved_symbols);
self.scope
.rename(freq, &mut map, preserved, &preserved_symbols);
map.into_map()
}
@ -112,6 +118,20 @@ impl Visit for Analyzer {
})
}
fn visit_class_method(&mut self, f: &ClassMethod) {
f.key.visit_with(self);
self.with_scope(|v| {
f.function.visit_with(v);
})
}
fn visit_constructor(&mut self, f: &Constructor) {
self.with_scope(|v| {
f.visit_children_with(v);
})
}
fn visit_default_decl(&mut self, d: &DefaultDecl) {
match d {
DefaultDecl::Class(c) => {

View File

@ -2,7 +2,7 @@ use swc_atoms::{js_word, JsWord};
use swc_common::{collections::AHashSet, util::take::Take};
use swc_ecma_utils::Id;
use crate::{pass::mangle_names::rename_map::RenameMap, util::base54::incr_base54};
use crate::pass::{compute_char_freq::CharFreqInfo, mangle_names::rename_map::RenameMap};
#[derive(Debug, Default)]
pub(crate) struct Scope {
@ -18,7 +18,7 @@ pub struct ScopeData {
/// Usages in current scope.
usages: AHashSet<Id>,
queue: Vec<Id>,
queue: Vec<(Id, u32)>,
}
impl Scope {
@ -29,8 +29,10 @@ impl Scope {
self.data.decls.insert(id.clone());
{
if !self.data.queue.contains(id) {
self.data.queue.push(id.clone());
if let Some((_, cnt)) = self.data.queue.iter_mut().find(|(i, _)| *i == *id) {
*cnt += 1;
} else {
self.data.queue.push((id.clone(), 1));
}
}
}
@ -40,23 +42,31 @@ impl Scope {
return;
}
if let Some((_, cnt)) = self.data.queue.iter_mut().find(|(i, _)| *i == *id) {
*cnt += 1;
}
self.data.usages.insert(id.clone());
}
pub(super) fn rename(
&mut self,
f: &CharFreqInfo,
to: &mut RenameMap,
preserved: &AHashSet<Id>,
preserved_symbols: &AHashSet<JsWord>,
) {
let mut n = 0;
for id in self.data.queue.take() {
if preserved.contains(&id) {
let mut queue = self.data.queue.take();
queue.sort_by(|a, b| b.1.cmp(&a.1));
for (id, cnt) in queue {
if cnt == 0 || preserved.contains(&id) {
continue;
}
loop {
let (_, sym) = incr_base54(&mut n);
let (_, sym) = f.incr_base54(&mut n);
let sym: JsWord = sym.into();
@ -66,13 +76,15 @@ impl Scope {
if self.can_rename(&id, &sym, to) {
to.insert(id.clone(), sym);
self.data.decls.remove(&id);
self.data.usages.remove(&id);
break;
}
}
}
for child in self.children.iter_mut() {
child.rename(to, preserved, preserved_symbols);
child.rename(f, to, preserved, preserved_symbols);
}
}

View File

@ -4,7 +4,7 @@ use swc_ecma_ast::*;
use swc_ecma_utils::{ident::IdentLike, Id};
use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith};
use crate::util::base54::incr_base54;
use crate::util::base54::{incr_base54, BASE54_DEFAULT_CHARS};
pub fn private_name_mangler(keep_private_props: bool) -> impl Fold + VisitMut {
as_folder(PrivateNameMangler {
@ -28,7 +28,7 @@ impl PrivateNameMangler {
let new_sym = if let Some(cached) = self.renamed_private.get(&id) {
cached.clone()
} else {
let sym = incr_base54(&mut self.private_n).1;
let sym = incr_base54(&mut self.private_n, BASE54_DEFAULT_CHARS).1;
let sym: JsWord = sym.into();

View File

@ -9,18 +9,21 @@ use crate::{marks::Marks, option::MangleOptions, pass::compute_char_freq::CharFr
pub(crate) fn name_mangler(
options: MangleOptions,
_char_freq_info: CharFreqInfo,
char_freq_info: CharFreqInfo,
_marks: Marks,
top_level_ctxt: SyntaxContext,
) -> impl VisitMut {
Mangler {
options,
top_level_ctxt,
char_freq_info,
}
}
struct Mangler {
options: MangleOptions,
char_freq_info: CharFreqInfo,
/// Used to check `eval`.
top_level_ctxt: SyntaxContext,
}
@ -54,7 +57,7 @@ impl VisitMut for Mangler {
};
m.visit_with(&mut analyzer);
analyzer.into_rename_map(&preserved)
analyzer.into_rename_map(&self.char_freq_info, &preserved)
};
m.visit_mut_with(&mut rename(&map));
@ -74,7 +77,7 @@ impl VisitMut for Mangler {
};
s.visit_with(&mut analyzer);
analyzer.into_rename_map(&preserved)
analyzer.into_rename_map(&self.char_freq_info, &preserved)
};
s.visit_mut_with(&mut rename(&map));

View File

@ -13,7 +13,7 @@ use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
use crate::{
analyzer::{analyze, ProgramData},
option::ManglePropertiesOptions,
util::base54::incr_base54,
util::base54::{incr_base54, BASE54_DEFAULT_CHARS},
};
pub static JS_ENVIRONMENT_PROPS: Lazy<AHashSet<JsWord>> = Lazy::new(|| {
@ -86,7 +86,7 @@ impl ManglePropertiesState {
if let Some(cached) = self.cache.get(name) {
Some(cached.clone())
} else {
let sym = incr_base54(&mut self.n).1;
let sym = incr_base54(&mut self.n, BASE54_DEFAULT_CHARS).1;
let mangled_name: JsWord = sym.into();
self.cache.insert(name.clone(), mangled_name.clone());

View File

@ -1,9 +1,10 @@
use swc_ecma_ast::IdentExt;
const CHARS: &[u8] = b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
pub(crate) static BASE54_DEFAULT_CHARS: &[u8; 64] =
b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
/// Note: This returns `a` for 0.
pub(crate) fn incr_base54(init: &mut usize) -> (usize, String) {
pub(crate) fn incr_base54(init: &mut usize, chars: &[u8; 64]) -> (usize, String) {
let mut n = *init;
*init += 1;
@ -16,10 +17,10 @@ pub(crate) fn incr_base54(init: &mut usize) -> (usize, String) {
while n > 0 {
n -= 1;
let c = CHARS[n % base] as char;
let c = chars[n % base] as char;
if ret.is_empty() && c.is_digit(10) {
return incr_base54(init);
return incr_base54(init, chars);
}
ret.push(c);
@ -30,7 +31,7 @@ pub(crate) fn incr_base54(init: &mut usize) -> (usize, String) {
if ret.is_reserved() || ret.is_reserved_in_strict_bind() || ret.is_reserved_in_strict_mode(true)
{
return incr_base54(init);
return incr_base54(init, chars);
}
(*init - 1, ret)
@ -39,6 +40,7 @@ pub(crate) fn incr_base54(init: &mut usize) -> (usize, String) {
#[cfg(test)]
mod tests {
use super::incr_base54;
use crate::util::base54::BASE54_DEFAULT_CHARS;
struct Tester {
n: usize,
}
@ -49,7 +51,7 @@ mod tests {
}
fn gen(&mut self, expected: &str) {
let generated = incr_base54(&mut self.n).1;
let generated = incr_base54(&mut self.n, BASE54_DEFAULT_CHARS).1;
assert_eq!(generated, expected);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5301:function(a,b,c){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return c(5075)}])},5075:function(a,b,c){"use strict";c.r(b);var d=c(5893),e=c(7294),f=c(6785),g=c(214),h=c.n(g);function i(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}b.default=function(){var a=(0,e.useState)({width:800,height:600,latitude:37.7577,longitude:-122.4376,zoom:8})[0];return(0,d.jsx)("div",{className:h().container,children:(0,d.jsx)(f.ZP,function(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{},d=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(d=d.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))),d.forEach(function(b){i(a,b,c[b])})}return a}({},a,{mapStyle:"mapbox://styles/mapbox/dark-v10",mapboxApiAccessToken:"pk.eyJ1IjoiZXhhbXBsZXMiLCJhIjoiY2p0MG01MXRqMW45cjQzb2R6b2ptc3J4MSJ9.zA2W0IkI0c6KaAhJfk9bWg"}))})}},214:function(a){a.exports={container:"Home_container__bCOhY",main:"Home_main__nLjiQ",footer:"Home_footer____T7K",title:"Home_title__T09hD",description:"Home_description__41Owk",code:"Home_code__suPER",grid:"Home_grid__GxQ85",card:"Home_card___LpL1",logo:"Home_logo__27_tb"}}},function(a){a.O(0,[634,785,774,888,179],function(){return a(a.s=5301)}),_N_E=a.O()}])
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5301:function(a,b,c){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return c(5075)}])},5075:function(d,b,a){"use strict";a.r(b);var e=a(5893),f=a(7294),g=a(6785),c=a(214),h=a.n(c);function i(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}b.default=function(){var a=(0,f.useState)({width:800,height:600,latitude:37.7577,longitude:-122.4376,zoom:8})[0];return(0,e.jsx)("div",{className:h().container,children:(0,e.jsx)(g.ZP,function(d){for(var a=1;a<arguments.length;a++){var c=null!=arguments[a]?arguments[a]:{},b=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&(b=b.concat(Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable}))),b.forEach(function(a){i(d,a,c[a])})}return d}({},a,{mapStyle:"mapbox://styles/mapbox/dark-v10",mapboxApiAccessToken:"pk.eyJ1IjoiZXhhbXBsZXMiLCJhIjoiY2p0MG01MXRqMW45cjQzb2R6b2ptc3J4MSJ9.zA2W0IkI0c6KaAhJfk9bWg"}))})}},214:function(a){a.exports={container:"Home_container__bCOhY",main:"Home_main__nLjiQ",footer:"Home_footer____T7K",title:"Home_title__T09hD",description:"Home_description__41Owk",code:"Home_code__suPER",grid:"Home_grid__GxQ85",card:"Home_card___LpL1",logo:"Home_logo__27_tb"}}},function(a){a.O(0,[634,785,774,888,179],function(){return a(a.s=5301)}),_N_E=a.O()}])

View File

@ -1 +1 @@
class a extends BaseSchema{matches(b,c){let d=!1,e,f;return c&&("object"==typeof c?{excludeEmptyString:d=!1,message:e,name:f}=c:e=c),this.test({name:f||"matches",message:e||string.matches,params:{regex:b},test:a=>isAbsent(a)||""===a&&d|| -1!==a.search(b)})}}(function(){return new a()}).prototype=a.prototype
class a extends BaseSchema{matches(d,a){let e=!1,b,c;return a&&("object"==typeof a?{excludeEmptyString:e=!1,message:b,name:c}=a:b=a),this.test({name:c||"matches",message:b||string.matches,params:{regex:d},test:a=>isAbsent(a)||""===a&&e|| -1!==a.search(d)})}}(function(){return new a()}).prototype=a.prototype

View File

@ -1,10 +1,10 @@
import*as a from"react";export default function b(){const[b,c]=a.useState({hits:[]}),[d,e]=a.useState("react");return a.useEffect(()=>{""!==d&&a();async function a(){const a=await fetch("https://hn.algolia.com/api/v1/search?query="+d),b=await a.json();c(b)}},[d]),<>
import*as a from"react";export default function b(){const[c,d]=a.useState({hits:[]}),[b,e]=a.useState("react");return a.useEffect(()=>{""!==b&&a();async function a(){const a=await fetch("https://hn.algolia.com/api/v1/search?query="+b),c=await a.json();d(c)}},[b]),<>
<input value={d}onChange={a=>e(a.target.value)}/>
<input value={b}onChange={a=>e(a.target.value)}/>
<ul >
{b.hits.map(a=><li key={a.objectID}>
{c.hits.map(a=><li key={a.objectID}>
<a href={a.url}>{a.title}</a>

View File

@ -1 +1 @@
export default function(c,e){try{if("string"==typeof c&&c.length>0)return(function(a){if((a=String(a)).length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const b=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!b)return NaN;const c=parseFloat(b[1]),d=(b[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return 6048e5*c;case"days":case"day":case"d":return 864e5*c;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*c;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*c;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*c;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:throw new Error(`The unit ${d} was matched, but no matching case exists.`)}})(c);if("number"==typeof c&&isFinite(c))return e?.long?b(c):a(c);throw new Error("Value is not a string or number.")}catch(f){const g=d(f)?`${f.message}. value=${JSON.stringify(c)}`:"An unknown error has occured.";throw new Error(g)}};function a(a){const b=Math.abs(a);return b>=864e5?`${Math.round(a/864e5)}d`:b>=36e5?`${Math.round(a/36e5)}h`:b>=6e4?`${Math.round(a/6e4)}m`:b>=1e3?`${Math.round(a/1e3)}s`:`${a}ms`}function b(a){const b=Math.abs(a);return b>=864e5?c(a,b,864e5,"day"):b>=36e5?c(a,b,36e5,"hour"):b>=6e4?c(a,b,6e4,"minute"):b>=1e3?c(a,b,1e3,"second"):`${a} ms`}function c(a,b,c,d){return`${Math.round(a/c)} ${d}${b>=1.5*c?"s":""}`}function d(a){return"object"==typeof a&&null!==a&&"message"in a}
export default function(c,f){try{if("string"==typeof c&&c.length>0)return(function(b){if((b=String(b)).length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(b);if(!c)return NaN;const a=parseFloat(c[1]),d=(c[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return 864e5*a;case"hours":case"hour":case"hrs":case"hr":case"h":return 36e5*a;case"minutes":case"minute":case"mins":case"min":case"m":return 6e4*a;case"seconds":case"second":case"secs":case"sec":case"s":return 1e3*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:throw new Error(`The unit ${d} was matched, but no matching case exists.`)}})(c);if("number"==typeof c&&isFinite(c))return f?.long?b(c):a(c);throw new Error("Value is not a string or number.")}catch(e){const g=d(e)?`${e.message}. value=${JSON.stringify(c)}`:"An unknown error has occured.";throw new Error(g)}};function a(a){const b=Math.abs(a);return b>=864e5?`${Math.round(a/864e5)}d`:b>=36e5?`${Math.round(a/36e5)}h`:b>=6e4?`${Math.round(a/6e4)}m`:b>=1e3?`${Math.round(a/1e3)}s`:`${a}ms`}function b(b){const a=Math.abs(b);return a>=864e5?c(b,a,864e5,"day"):a>=36e5?c(b,a,36e5,"hour"):a>=6e4?c(b,a,6e4,"minute"):a>=1e3?c(b,a,1e3,"second"):`${b} ms`}function c(b,c,a,d){return`${Math.round(b/a)} ${d}${c>=1.5*a?"s":""}`}function d(a){return"object"==typeof a&&null!==a&&"message"in a}

View File

@ -7,18 +7,18 @@ var a = (this && this.__importDefault) || function(a) {
Object.defineProperty(exports, "__esModule", {
value: true
});
const b = a(require("./config.json"));
function c({ config: a = b.default } = {}) {
function c(b) {
const c = a[b] || null;
if (!c) {
const c = a(require("./config.json"));
function b({ config: a = c.default } = {}) {
function b(e) {
const b = a[e] || null;
if (!b) {
return false;
}
const { available: d , availableBy: e } = c;
if (!e) {
return d;
const { available: c , availableBy: d } = b;
if (!d) {
return c;
}
return Date.now() >= e && d;
return Date.now() >= d && c;
}
function d(b) {
const c = a[b] || null;
@ -26,8 +26,8 @@ function c({ config: a = b.default } = {}) {
}
return {
longlong10: d,
longlong2: c,
longlong2: b,
longlong100: a
};
}
exports.default = c;
exports.default = b;

View File

@ -1,4 +1,4 @@
const a = 1234123;
var b = mn.dateTime, c = mn.date, d = mn.time, e = mn.periods, f = mn.days, g = mn.shortDays, h = mn.months, i = mn.shortMonths, j = $i(e), k = aj(e), l = $i(f), m = aj(f), n = $i(g), o = aj(g), p = $i(h), q = aj(h), r = $i(i), s = aj(i), t = {
a: a
const f = 1234123;
var g = mn.dateTime, h = mn.date, i = mn.time, a = mn.periods, b = mn.days, c = mn.shortDays, d = mn.months, e = mn.shortMonths, j = $i(a), k = aj(a), l = $i(b), m = aj(b), n = $i(c), o = aj(c), p = $i(d), q = aj(d), r = $i(e), s = aj(e), t = {
a: f
};

View File

@ -1,7 +1,7 @@
"use strict";
const a = (a, b)=>{
return b;
const a = (b, a)=>{
return a;
};
const b = (a, b, c)=>{
return c;
const b = (b, c, a)=>{
return a;
};

View File

@ -1,84 +1,84 @@
function a(a, b = {}, c = false) {
function g(a, b = {}, c = false) {
return {
rule: a,
params: b,
implicit: c
};
}
function b(b) {
if (typeof b === "undefined") {
return a("nullable", {
value: b
function h(a) {
if (typeof a === "undefined") {
return g("nullable", {
value: a
}, true);
}
}
function c(a) {
return a.find((a)=>a === b
function i(a) {
return a.find((a)=>a === h
) ? true : false;
}
function d(a) {
function j(a) {
return a === undefined || a === null || a === "";
}
function e(b) {
return d(b) ? a("required", {
value: b
function a(a) {
return j(a) ? g("required", {
value: a
}, true) : undefined;
}
function f(a) {
return a.find((a)=>a === e
function k(b) {
return b.find((b)=>b === a
) ? false : true;
}
const g = (a, b, c, d)=>{
b.attr = c;
const l = (a, b, d, e)=>{
b.attr = d;
if (typeof a === "function") {
return a(b, d || "");
return a(b, e || "");
} else {
for(let e in b){
a = a.replace(`:${e}`, b[e]);
for(let c in b){
a = a.replace(`:${c}`, b[c]);
}
return a;
}
};
const h = (a)=>{
const b = a.split(":");
b.shift();
return b.join(":");
const m = (b)=>{
const a = b.split(":");
a.shift();
return a.join(":");
};
const i = (a, b, c, d, e)=>{
const n = (a, b, c, d, e)=>{
return a[`${b}.${c}`] || a[`${b}.${d}`] || a[b] || a[c] || a[d] || e;
};
const j = (a, { messages: b , attributes: c })=>{
const d = {};
const e = (b || {})["default"] || ":attr is invalid";
for(let f in a){
const k = a[f];
const l = (c || {})[f] || f;
d[f] = {};
for (let m of k){
const n = h(m.rule);
const o = n ? m.rule.substr(0, m.rule.length - n.length - 1) : m.rule;
if (m.rule === "validateObject" && m.params.errors) {
d[f][o] = j(m.params.errors, {
messages: b,
attributes: c
const o = (h, { messages: d , attributes: f })=>{
const c = {};
const i = (d || {})["default"] || ":attr is invalid";
for(let b in h){
const j = h[b];
const k = (f || {})[b] || b;
c[b] = {};
for (let a of j){
const g = m(a.rule);
const e = g ? a.rule.substr(0, a.rule.length - g.length - 1) : a.rule;
if (a.rule === "validateObject" && a.params.errors) {
c[b][e] = o(a.params.errors, {
messages: d,
attributes: f
});
} else if (m.rule === "validateArray" && m.params.errors) {
d[f][o] = j(m.params.errors, {
messages: b,
attributes: c
} else if (a.rule === "validateArray" && a.params.errors) {
c[b][e] = o(a.params.errors, {
messages: d,
attributes: f
});
} else {
const p = i(b || {}, f, m.rule, o, e);
d[f][o] = g(p, m.params, l, n);
const p = n(d || {}, b, a.rule, e, i);
c[b][e] = l(p, a.params, k, g);
}
}
}
return d;
return c;
};
const k = (a)=>{
const p = (a)=>{
return a.match(/^\d+$/) ? true : false;
};
const l = (a, b)=>{
const q = (a, b)=>{
if (typeof a[b] !== "undefined") {
return a[b];
}
@ -86,7 +86,7 @@ const l = (a, b)=>{
const d = c.reduce((a, b)=>{
if (a && typeof a === "object") {
return a[b];
} else if (a instanceof Array && k(b)) {
} else if (a instanceof Array && p(b)) {
const c = parseInt(b);
return a[c];
}
@ -95,18 +95,18 @@ const l = (a, b)=>{
});
return d;
};
const m = (a, b)=>{
const c = l(a, b);
const r = (a, b)=>{
const c = q(a, b);
return typeof c !== "undefined";
};
const n = (a)=>{
const s = (a)=>{
return {
getValue: (b)=>l(a, b)
getValue: (b)=>q(a, b)
,
hasValue: (b)=>m(a, b)
hasValue: (b)=>r(a, b)
};
};
const o = {
const t = {
"fileExists:pathCheck": "file :value doesn't exists",
"fileExists:stringCheck": "file path must be a string",
isArray: ":attr must be an array",
@ -130,103 +130,103 @@ const o = {
required: ":attr is required",
default: ":attr is invalid"
};
const p = (a, b)=>{
const u = (a, b)=>{
return a[b];
};
const q = new Set([
const v = new Set([
"requiredWhenRule",
"requiredIfRule",
"requiredUnlessRule",
]);
const r = async (a, b, e)=>{
const g = [];
if (d(a) && f(b)) {
const h = b.filter((a)=>q.has(a.name)
const w = async (d, b, f)=>{
const e = [];
if (j(d) && k(b)) {
const g = b.filter((a)=>v.has(a.name)
);
if (h.length === 0) {
if (g.length === 0) {
return [];
}
for (let i of b.filter((a)=>q.has(a.name)
for (let h of b.filter((a)=>v.has(a.name)
)){
let j = i(a, e);
if (j instanceof Promise) {
j = await j;
let a = h(d, f);
if (a instanceof Promise) {
a = await a;
}
if (j !== undefined && j.noContext) {
if (a !== undefined && a.noContext) {
return [];
}
if (j !== undefined) {
g.push(j);
if (j.implicit) {
return g;
if (a !== undefined) {
e.push(a);
if (a.implicit) {
return e;
}
}
}
b = b.filter((a)=>!q.has(a.name)
b = b.filter((a)=>!v.has(a.name)
);
}
if (typeof a === "object" && a === null && c(b)) {
if (typeof d === "object" && d === null && i(b)) {
return [];
}
for (let k of b){
let l = k(a, e);
if (l instanceof Promise) {
l = await l;
for (let l of b){
let c = l(d, f);
if (c instanceof Promise) {
c = await c;
}
if (l !== undefined && !l.noContext) {
g.push(l);
if (l.implicit === true) {
if (c !== undefined && !c.noContext) {
e.push(c);
if (c.implicit === true) {
break;
}
}
}
return g;
return e;
};
const s = async (a, b)=>{
const c = {};
const d = n(a);
for(let e in b){
const f = b[e] instanceof Array ? b[e] : [
b[e]
const x = async (c, b)=>{
const d = {};
const f = s(c);
for(let a in b){
const g = b[a] instanceof Array ? b[a] : [
b[a]
];
const g = p(a, e);
const h = await r(g, f, d);
if (h.length) {
c[e] = h;
const h = u(c, a);
const e = await w(h, g, f);
if (e.length) {
d[a] = e;
}
}
return c;
return d;
};
const t = async (a, b, c = {
messages: o
const b = async (c, d, e = {
messages: t
})=>{
const d = await s(a, b);
const e = Object.keys(d).length === 0;
const f = e ? {} : j(d, c);
const a = await x(c, d);
const b = Object.keys(a).length === 0;
const f = b ? {} : o(a, e);
return [
e,
b,
f
];
};
function u(b) {
if (typeof b !== "number") {
return a("isNumber", {
value: b
function c(a) {
if (typeof a !== "number") {
return g("isNumber", {
value: a
});
}
}
const v = {
const d = {
name: "",
age: "20"
};
const [w, x] = await t(v, {
name: e,
const [e, f] = await b(d, {
name: a,
age: [
e,
u
a,
c
]
});
console.log({
passes: w,
errors: x
passes: e,
errors: f
});

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
import a from "./traditional.js";
function b(a) {
import b from "./traditional.js";
function c(a) {
return import(a);
}
import("module_for_side_effects.js");
let c = import("some/module.js");
c.foo();
let a = import("some/module.js");
a.foo();

View File

@ -2,12 +2,12 @@ var o = 0;
function f() {
try {
throw 1;
} catch (a) {
} catch (b) {
try {
throw 2;
} catch (b) {
var b = 3;
console.log(b);
} catch (a) {
var a = 3;
console.log(a);
}
}
console.log(o);

View File

@ -1,13 +1,13 @@
"AAAAAAAA";
"BBBBBBB";
new class {
f(a) {
f(b) {
try {
throw {
m: "PASS"
};
} catch ({ m: b }) {
console.log(b);
} catch ({ m: a }) {
console.log(a);
}
}
}().f();

View File

@ -1,13 +1,13 @@
"AAAAAAAA";
"BBBBBBB";
new class {
f(a) {
f(b) {
try {
throw {
m: "PASS"
};
} catch ({ m: b }) {
console.log(b);
} catch ({ m: a }) {
console.log(a);
}
}
}().f();