lakutata
Version:
An IoC-based universal application framework.
861 lines (837 loc) • 28 kB
JavaScript
/* Build Date: Mon Jan 05 2026 23:52:23 GMT+0800 (China Standard Time) */
import { c as e } from "../../../../vendor/Package.internal.2.mjs";
var t = {
exports: {}
};
var n = {
exports: {}
};
n.exports;
(function(e, t) {
Object.defineProperty(t, "__esModule", {
value: true
});
t.Gex = void 0;
class Gexer {
constructor(e) {
this.desc = "";
this.gexmap = {};
if (null != e) {
let t = Array.isArray(e) ? e : [ e ];
t.forEach(e => {
this.gexmap[e] = this.re(this.clean(e));
});
}
}
dodgy(e) {
return null == e || Number.isNaN(e);
}
clean(e) {
let t = "" + e;
return this.dodgy(e) ? "" : t;
}
match(e) {
e = "" + e;
let t = false;
let n = Object.keys(this.gexmap);
for (let r = 0; r < n.length && !t; r++) {
t = !!this.gexmap[n[r]].exec(e);
}
return t;
}
on(e) {
if (null == e) {
return null;
}
let t = typeof e;
if ("string" === t || "number" === t || "boolean" === t || e instanceof Date || e instanceof RegExp) {
return this.match(e) ? e : null;
} else if (Array.isArray(e)) {
let t = [];
for (let n = 0; n < e.length; n++) {
if (!this.dodgy(e[n]) && this.match(e[n])) {
t.push(e[n]);
}
}
return t;
} else {
let t = {};
for (let n in e) {
if (Object.prototype.hasOwnProperty.call(e, n)) {
if (this.match(n)) {
t[n] = e[n];
}
}
}
return t;
}
}
esc(e) {
let t = this.clean(e);
t = t.replace(/\*/g, "**");
t = t.replace(/\?/g, "*?");
return t;
}
escregexp(e) {
return e ? ("" + e).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") : "";
}
re(e) {
if ("" === e || e) {
e = this.escregexp(e);
e = e.replace(/\\\*/g, "[\\s\\S]*");
e = e.replace(/\\\?/g, "[\\s\\S]");
e = e.replace(/\[\\s\\S\]\*\[\\s\\S\]\*/g, "\\*");
e = e.replace(/\[\\s\\S\]\*\[\\s\\S\]/g, "\\?");
e = "^" + e + "$";
return new RegExp(e);
} else {
let e = Object.keys(this.gexmap);
return 1 == e.length ? this.gexmap[e[0]] : {
...this.gexmap
};
}
}
toString() {
let e = this.desc;
return "" != e ? e : this.desc = "Gex[" + Object.keys(this.gexmap) + "]";
}
inspect() {
return this.toString();
}
}
function n(e) {
return new Gexer(e);
}
t.Gex = n;
{
e.exports = n;
e.exports.Gex = n;
}
t.default = n;
})(n, n.exports);
var r = n.exports;
var i = {};
var s = e && e.__classPrivateFieldGet || function(e, t, n, r) {
if (n === "a" && !r) throw new TypeError("Private accessor was defined without a getter");
if (typeof t === "function" ? e !== t || !r : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return n === "m" ? r : n === "a" ? r.call(e) : r ? r.value : t.get(e);
};
var l, a, f, o, u, h, c, p, v;
Object.defineProperty(i, "__esModule", {
value: true
});
i.IntervalMatcher = i.GexMatcher = void 0;
const g = r;
class GexMatcher {
constructor() {}
make(e, t) {
if ("string" === typeof t && t.match(/[*?]/)) {
let e = (0, g.Gex)(t);
return {
kind: "gex",
match: t => null != e.on(t),
fix: t,
meta: {},
same(e) {
return null != e && e.kind === this.kind && e.fix === this.fix;
}
};
} else return undefined;
}
scan(e, t) {
let n = e.filter(e => "*" === e.fix).length > 0;
return {
complete: n,
sound: n,
gaps: [],
overs: [],
why: "no-star"
};
}
}
i.GexMatcher = GexMatcher;
const d = new RegExp([ "^/s*", "(=*[<>/(/[]?=*)?" + "/s*" + "([-+0-9a-fA-FeEoOxX]+(/.([0-9a-fA-FeEoOxX]+))?)" + "([/)/]]?)" + "(" + "/s*(,|&+|/|+|/./.)" + "/s*" + "(=*[<>]?=*)" + "/s*" + "([-+.0-9a-fA-FeEoOxX]+)" + "/s*" + "([/)/]]?)" + ")?" + "/s*$" ].join("").replace(/\//g, "\\"));
class IntervalMatcher {
constructor() {
this.kind = "interval";
l.set(this, (e, t) => function n(r) {
return e(r) && t(r);
});
a.set(this, (e, t) => function n(r) {
return e(r) || t(r);
});
f.set(this, e => function e(t) {
return false;
});
o.set(this, e => function e(t) {
return false;
});
u.set(this, e => function t(n) {
return n > e;
});
h.set(this, e => function t(n) {
return n >= e;
});
c.set(this, e => function t(n) {
return n < e;
});
p.set(this, e => function t(n) {
return n <= e;
});
v.set(this, e => function t(n) {
return n === e;
});
}
make(e, t) {
if ("string" === typeof t && t.match(/[=<>.[()\]]/)) {
let e = t.match(d);
let n = {
jo: "and",
o0: "err",
n0: NaN,
o1: "err",
n1: NaN
};
let r = e => false;
if (null != e) {
let i = IntervalMatcher.normop(e[1]) || IntervalMatcher.normop(e[5]);
let g = IntervalMatcher.normop(e[8]) || IntervalMatcher.normop(e[10]);
let d = "=" === i ? s(this, v, "f") : "<" === i ? s(this, c, "f") : ")" === i ? s(this, c, "f") : "<=" === i ? s(this, p, "f") : "]" === i ? s(this, p, "f") : ">" === i ? s(this, u, "f") : "(" === i ? s(this, u, "f") : ">=" === i ? s(this, h, "f") : "[" === i ? s(this, h, "f") : s(this, o, "f");
let m = Number(e[2]);
let x = null == e[9] ? NaN : Number(e[9]);
let k = e[7];
let y = null == k ? s(this, a, "f") : "&" === k.substring(0, 1) ? s(this, l, "f") : "," === k.substring(0, 1) ? s(this, l, "f") : s(this, a, "f");
if (".." === k) {
y = s(this, l, "f");
d = s(this, o, "f") === d ? s(this, h, "f") : d;
g = "" === g ? "<=" : g;
}
let N = null == g ? s(this, f, "f") : "=" === g ? s(this, v, "f") : "<" === g ? s(this, c, "f") : ")" === g ? s(this, c, "f") : "<=" === g ? s(this, p, "f") : "]" === g ? s(this, p, "f") : ">" === g ? s(this, u, "f") : ">=" === g ? s(this, h, "f") : s(this, o, "f");
if (m === x) {
if ("=" === i && null != g) {
x = NaN;
N = s(this, f, "f");
if (g.includes("<")) {
d = s(this, p, "f");
} else if (g.includes(">")) {
d = s(this, h, "f");
} else if (g.includes("=")) {
d = s(this, v, "f");
} else {
d = s(this, o, "f");
}
} else if ("=" === g && null != i) {
x = NaN;
N = s(this, f, "f");
if (i.includes("<")) {
d = s(this, p, "f");
} else if (i.includes(">")) {
d = s(this, h, "f");
} else {
d = s(this, o, "f");
}
}
}
if (s(this, o, "f") !== d) {
if (s(this, f, "f") === N) {
if (s(this, c, "f") === d || s(this, p, "f") === d) {
N = d;
x = m;
d = s(this, h, "f");
m = Number.NEGATIVE_INFINITY;
y = s(this, l, "f");
} else if (s(this, u, "f") === d || s(this, h, "f") === d) {
N = s(this, p, "f");
x = Number.POSITIVE_INFINITY;
y = s(this, l, "f");
}
}
}
if (!isNaN(x) && x < m) {
let e = N;
let t = x;
x = m;
m = t;
if (".." !== k) {
N = d;
d = e;
}
}
let b = d(m);
let M = N(x);
let w = y(b, M);
n = {
jo: w.name,
o0: b.name,
n0: m,
o1: M.name,
n1: x
};
r = e => {
let t = false;
let n = parseFloat(e);
if (!isNaN(n)) {
t = w(n);
}
return t;
};
return {
kind: "interval",
fix: t,
meta: n,
match: r,
same(e) {
return null != e && e.kind === this.kind && e.meta.jo === this.meta.jo && e.meta.o0 === this.meta.o0 && e.meta.n0 === this.meta.n0 && e.meta.o1 === this.meta.o1 && e.meta.n1 === this.meta.n1;
}
};
}
}
}
scan(e, t) {
let n = {
complete: false,
sound: false,
gaps: [],
overs: [],
lower: null,
upper: null
};
let r = Number.NEGATIVE_INFINITY;
let i = Number.POSITIVE_INFINITY;
let s = this.half_intervals(e);
s.reduce((e, t) => {
let n = "eq" === t.o;
let i = "lt" === t.o;
let s = "lte" === t.o;
let l = "gt" === t.o;
let a = "gte" === t.o;
let f = t.n;
if (null == e.lower) {
let i = {
n: r,
o: "gte"
};
e.lower = i;
e.upper = t;
if (!(r == f && a)) {
if (l || a) {
e.gaps.push([ i, {
n: f,
o: l ? "lte" : "lt",
m: 0
} ]);
} else if (n) {
e.gaps.push([ i, {
n: f,
o: "lte",
m: 1
} ]);
}
}
} else {
let r = "eq" === e.upper.o;
let o = "lt" === e.upper.o;
let u = "lte" === e.upper.o;
"gt" === e.upper.o;
"hgte" === e.upper.o;
let h = e.upper.n;
let c = e.upper;
if (f === h) {
if (o && (a || n) || (u || r) && l) ; else if (r || o || u) {
e.gaps.push([ {
n: h,
o: r || u ? "gt" : "gte",
m: 2,
d: {
u: c,
h: t
}
}, {
n: f,
o: n || a ? "lt" : "lte",
m: 3
} ]);
} else ;
} else if (h < f) {
if (i || s) ; else if (r || o || u) {
e.gaps.push([ {
n: h,
o: r || u ? "gt" : "gte",
m: 4
}, {
n: f,
o: n || a ? "lt" : "lte",
m: 5
} ]);
}
} else {
e.overs.push([ {
n: f,
o: n || a ? "gte" : "gt",
m: 10
}, {
n: h,
o: r || u ? "lte" : "lt",
m: 11
} ]);
}
e.upper = t;
}
return e;
}, n);
let l = 0 < s.length && s[s.length - 1];
if (l && i !== l.n && l.o !== "gt" && l.o !== "gte") {
n.gaps.push([ {
n: l.n,
o: l.o === "eq" || l.o === "lte" ? "gt" : "gte",
m: 6
}, {
n: i,
o: "lte",
m: 7
} ]);
}
n.complete = 0 === n.gaps.length;
n.sound = 0 === n.overs.length;
return n;
}
half_intervals(e) {
let t = [];
for (let n of e) {
t.push([ {
n: n.meta.n0,
o: n.meta.o0
}, {
n: n.meta.n1,
o: n.meta.o1
} ]);
}
var n = [ "lt", "lte", "eq", "gte", "gt" ];
var r = t.map(e => [ isNaN(e[0].n) || null == e[0].n ? null : e[0], isNaN(e[1].n) || null == e[1].n ? null : e[1] ].filter(e => null != e)).sort((e, t) => {
if (e[0].n < t[0].n) {
return -1;
} else if (t[0].n < e[0].n) {
return 1;
} else {
var r = n.indexOf(e[0].o);
var i = n.indexOf(t[0].o);
if (r < i) {
return -1;
} else if (i < r) {
return 1;
} else {
if (e[1].n < t[1].n) {
return -1;
} else if (t[1].n < e[1].n) {
return 1;
} else {
var s = n.indexOf(e[1].o);
var l = n.indexOf(t[1].o);
return s < l ? -1 : l < s ? 1 : 0;
}
}
}
}).reduce((e, t) => e.concat(...t), []);
return r;
}
}
i.IntervalMatcher = IntervalMatcher;
l = new WeakMap, a = new WeakMap, f = new WeakMap, o = new WeakMap, u = new WeakMap,
h = new WeakMap, c = new WeakMap, p = new WeakMap, v = new WeakMap;
IntervalMatcher.normop = e => null == e ? null : ((e.match(/([<>\(\)\[\]])/) || [])[1] || "") + ((e.match(/(=)/) || [])[1] || "");
t.exports;
(function(e, t) {
Object.defineProperty(t, "__esModule", {
value: true
});
t.Gex = void 0;
t.Patrun = l;
const n = r;
Object.defineProperty(t, "Gex", {
enumerable: true,
get: function() {
return n.Gex;
}
});
const s = i;
function l(e) {
e = e || {};
var t = {};
var r = {};
let i = [];
if (e.gex) {
i.push(new s.GexMatcher);
}
if (e.interval) {
i.push(new s.IntervalMatcher);
}
t.top = function() {
return r;
};
t.add = function(n, s) {
n = {
...n
};
var l = "function" === typeof e ? e.call(t, n, s) : null;
var a = Object.keys(n).filter(e => null != n[e]).sort();
a.forEach(function(e) {
n[e] = String(n[e]);
});
var f = r;
var o;
for (var u = 0; u < a.length; u++) {
var h = a[u];
var c = n[h];
let e = i.reduce((e, t) => e || t.make(h, c), undefined);
o = f.v;
if (o && h == f.k) {
if (e) {
var p = f.g = f.g || {};
var v = p[h] = p[h] || [];
e = v.find(t => t.same(e)) || (v.push(e), e);
f = e.keymap || (e.keymap = {});
} else {
f = o[c] || (o[c] = {});
}
} else if (!f.k) {
f.k = h;
f.v = {};
if (e) {
var p = f.g = f.g || {};
var v = p[h] = p[h] || [];
e = v.find(t => t.same(e)) || (v.push(e), e);
f = e.keymap || (e.keymap = {});
} else {
f = f.v[c] = {};
}
} else if (h < f.k) {
var g = f.s;
var p = f.g;
f.s = {
k: f.k,
v: f.v
};
if (g) {
f.s.s = g;
}
if (p) {
f.s.g = p;
}
if (f.g) {
f.g = {};
}
f.k = h;
f.v = {};
if (e) {
var p = f.g = f.g || {};
var v = p[h] = p[h] || [];
e = v.find(t => t.same(e)) || (v.push(e), e);
f = e.keymap || (e.keymap = {});
} else {
f = f.v[c] = {};
}
} else {
f = f.s || (f.s = {});
u--;
}
}
if (void 0 !== s && f) {
f.d = s;
if (l) {
f.f = "function" === typeof l ? l : l.find;
f.r = "function" === typeof l.remove ? l.remove : void 0;
}
}
return t;
};
t.findexact = function(e) {
return t.find(e, true);
};
t.find = function(e, n, i) {
if (null == e) return null;
var s = r;
var l = void 0 === r.d ? null : r.d;
var a = r.f;
var f = null;
var o = [];
var u = {};
var h = Object.keys(e).length;
var c = [];
if (void 0 !== r.d) {
c.push(r.d);
}
do {
f = s.k;
if (s.v) {
var p = e[f];
var v = s.v[p];
if (!v && s.g && s.g[f]) {
var g = s.g[f];
for (var d = 0; d < g.length; d++) {
if (g[d].match(p)) {
v = g[d].keymap;
break;
}
}
}
if (v) {
u[f] = true;
if (s.s) {
o.push(s.s);
}
l = void 0 === v.d ? n ? null : l : v.d;
if (i && void 0 !== v.d) {
c.push(v.d);
}
a = v.f;
s = v;
} else {
s = s.s;
}
} else {
s = null;
}
if (null == s && 0 < o.length && (null == l || i && !n)) {
s = o.pop();
}
} while (s);
if (n) {
if (Object.keys(u).length !== h) {
l = null;
}
} else {
if (null == l && void 0 !== r.d) {
l = r.d;
}
}
if (a) {
l = a.call(t, e, l);
}
return i ? c : l;
};
t.remove = function(e) {
var t = r;
var n = null;
var i;
var s = [];
do {
i = t.k;
if (t.v || t.g) {
if (t.v) {
var l = t.v[e[i]];
if (l) {
s.push({
km: t,
v: e[i]
});
}
}
if (null == l && t.g) {
let n = t.g[i] || [];
for (let r = 0; r < n.length; r++) {
if (n[r].fix === e[i]) {
s.push({
km: t,
v: e[i],
mv: n[r]
});
l = n[r].keymap;
break;
}
}
}
if (l) {
n = l.d;
t = l;
} else {
t = t.s;
}
} else {
t = null;
}
} while (t);
if (void 0 !== n) {
var a = s[s.length - 1];
if (a && a.km && a.km.v) {
var f = a.km.v[a.v] || a.mv && a.mv.keymap;
if (f && (!f.r || f.r(e, f.d))) {
delete f.d;
}
}
}
};
t.list = function(e, t) {
e = e || {};
function i(r, s, l, a) {
if (r.v) {
var f = r.k;
var o = (0, n.Gex)(e ? null == e[f] ? t ? null : "*" : e[f] : "*");
var u = {
...s
};
var h = {
...l
};
var c;
for (var p in r.v) {
if (p === e[f] || !t && null == e[f] || o.on(p)) {
var v = {
...u
};
v[f] = p;
var g = {
...h
};
delete g[f];
c = r.v[p];
if (0 === Object.keys(g).length && c && c.d) {
a.push({
match: v,
data: c.d,
find: c.f
});
}
if (c && null != c.v) {
i(c, {
...v
}, {
...g
}, a);
}
}
}
c = r.s;
if (c) {
i(c, {
...u
}, {
...h
}, a);
}
}
}
var s = [];
if (r.d) {
s.push({
match: {},
data: r.d,
find: r.f
});
}
i(r, {}, {
...e
}, s);
return s;
};
t.toString = function(e, t) {
var n = true === e ? true : !!t;
var i = "function" === typeof e ? e : function(e) {
return "function" === typeof e ? "<" + e.name + ">" : "<" + e + ">";
};
function s(e, t) {
for (var n = 0; n < t; n++) {
e.push(" ");
}
}
var l = [];
function a(e, t, n, r) {
var f;
if (void 0 !== e.d) {
t.push(" " + i(e.d));
l.push(r.join(", ") + " -> " + i(e.d));
}
if (e.k) {
t.push("\n");
s(t, n);
t.push(e.k + ":");
}
if (e.v || e.s || e.g) {
n++;
}
if (e.v) {
var o = Object.keys(e.v).sort();
for (var u = 0; u < o.length; u++) {
var h = o[u];
t.push("\n");
s(t, n);
t.push(h + " ->");
f = r.slice();
f.push(e.k + "=" + h);
a(e.v[h], t, n + 1, f);
}
}
if (e.g) {
var o = Object.keys(e.g).sort();
for (var u = 0; u < o.length; u++) {
var c = e.g[o[u]];
for (var p = 0; p < c.length; p++) {
var v = c[p];
t.push("\n");
s(t, n);
t.push(v.fix + " ~>");
f = r.slice();
f.push(e.k + "~" + v.fix);
a(v.keymap, t, n + 1, f);
}
}
}
if (e.s) {
t.push("\n");
s(t, n);
t.push("|");
f = r.slice();
a(e.s, t, n + 1, f);
}
}
var f = [];
a(r, f, 0, []);
return n ? f.join("") : l.join("\n");
};
t.inspect = t.toString;
t.toJSON = function(e) {
return JSON.stringify(r, function(e, t) {
if ("function" === typeof t) return "[Function]";
return t;
}, e);
};
return t;
}
function a(e) {
return new l(e);
}
{
e.exports = a;
e.exports.Patrun = l;
e.exports.Gex = n.Gex;
}
t.default = a;
})(t, t.exports);
var m = t.exports;
class PatternManager {
#e;
constructor(e = {
globMatch: true
}) {
this.#e = m.Patrun({
gex: !!e.globMatch
});
}
add(e, t) {
this.#e.add(e, t);
return this;
}
remove(e) {
this.#e.remove(e);
return this;
}
find(e, t = false) {
return this.#e.find(e, t);
}
list(e) {
return this.#e.list(e);
}
toJSON() {
return this.#e.toJSON();
}
}
export { PatternManager };