From 98816f9827e1483c7436ffafd0713f89d6df0215 Mon Sep 17 00:00:00 2001 From: MicroMilo Date: Thu, 25 May 2023 23:14:43 +0800 Subject: [PATCH] =?UTF-8?q?unipush=20=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- alpha/admin/manifest.json | 13 +- alpha/admin/pages.json | 45 +- .../cloudfunctions/uni-cloud-push/index.js | 13 + .../uni-cloud-push/package.json | 7 + .../node_modules/uni-config-center/index.js | 583 +------------ .../common/uni-config-center/index.js | 583 +------------ .../uni_modules/uni-id-common/changelog.md | 6 + .../uni_modules/uni-id-common/package.json | 13 +- .../common/uni-id-common/index.js | 2 +- .../node_modules/uni-config-center/index.js | 583 +------------ .../common/uni-id-common/package.json | 2 +- .../node_modules/uni-config-center/index.js | 583 +------------ .../node_modules/uni-config-center/index.js | 583 +------------ .../node_modules/uni-id-common/index.js | 2 +- .../node_modules/uni-config-center/index.js | 583 +------------ .../node_modules/uni-id-common/package.json | 2 +- .../node_modules/uni-config-center/index.js | 583 +------------ .../node_modules/uni-config-center/index.js | 583 +------------ .../uni_modules/uni-push-admin/changelog.md | 20 + .../uni-push-admin/js_sdk/validator/push.js | 176 ++++ .../js_sdk/validator/uni-push-log.js | 217 +++++ .../uni_modules/uni-push-admin/menu.json | 36 + .../uni_modules/uni-push-admin/package.json | 86 ++ .../uni-push-admin/pages/extra/extra.vue | 45 + .../uni-push-admin/pages/log/detail.vue | 326 ++++++++ .../uni-push-admin/pages/log/list.vue | 404 +++++++++ .../pages/sendMessage/sendMessage.vue | 782 ++++++++++++++++++ .../uni_modules/uni-push-admin/readme.md | 66 ++ .../cloudfunctions/uni-push-co/index.obj.js | 61 ++ .../cloudfunctions/uni-push-co/package.json | 9 + .../uni-push-co/uni-push-co.param.json | 4 + .../database/opendb-tempdata.schema.json | 26 + .../database/uni-push-log.schema.json | 171 ++++ 33 files changed, 2527 insertions(+), 4671 deletions(-) create mode 100644 alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/index.js create mode 100644 alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/package.json create mode 100644 alpha/admin/uni_modules/uni-push-admin/changelog.md create mode 100644 alpha/admin/uni_modules/uni-push-admin/js_sdk/validator/push.js create mode 100644 alpha/admin/uni_modules/uni-push-admin/js_sdk/validator/uni-push-log.js create mode 100644 alpha/admin/uni_modules/uni-push-admin/menu.json create mode 100644 alpha/admin/uni_modules/uni-push-admin/package.json create mode 100644 alpha/admin/uni_modules/uni-push-admin/pages/extra/extra.vue create mode 100644 alpha/admin/uni_modules/uni-push-admin/pages/log/detail.vue create mode 100644 alpha/admin/uni_modules/uni-push-admin/pages/log/list.vue create mode 100644 alpha/admin/uni_modules/uni-push-admin/pages/sendMessage/sendMessage.vue create mode 100644 alpha/admin/uni_modules/uni-push-admin/readme.md create mode 100644 alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/index.obj.js create mode 100644 alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/package.json create mode 100644 alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/uni-push-co.param.json create mode 100644 alpha/admin/uni_modules/uni-push-admin/uniCloud/database/opendb-tempdata.schema.json create mode 100644 alpha/admin/uni_modules/uni-push-admin/uniCloud/database/uni-push-log.schema.json diff --git a/alpha/admin/manifest.json b/alpha/admin/manifest.json index 7b7c85e..60571eb 100644 --- a/alpha/admin/manifest.json +++ b/alpha/admin/manifest.json @@ -17,7 +17,9 @@ "delay" : 0 }, /* 模块配置 */ - "modules" : {}, + "modules" : { + "Push" : {} + }, /* 应用发布信息 */ "distribute" : { /* android打包配置 */ @@ -43,7 +45,14 @@ /* ios打包配置 */ "ios" : {}, /* SDK配置 */ - "sdkConfigs" : {} + "sdkConfigs" : { + "push" : { + "unipush" : { + "version" : "2", + "offline" : false + } + } + } } }, /* 快应用特有相关 */ diff --git a/alpha/admin/pages.json b/alpha/admin/pages.json index 592e938..a99ccd7 100644 --- a/alpha/admin/pages.json +++ b/alpha/admin/pages.json @@ -136,7 +136,50 @@ "navigationBarTitleText": "设置密码" } } - ], + ,{ + "path": "uni_modules/uni-push-admin/pages/extra/extra", + "style": { + "h5": { + "titleNView": { + "type": "transparent" + } + }, + "navigationBarTitleText": "push-admin", + "navigationStyle": "default" + } +} +,{ + "path": "uni_modules/uni-push-admin/pages/log/list", + "style": { + "h5": { + "titleNView": { + "type": "transparent" + } + }, + "navigationBarTitleText": "推送记录", + "navigationStyle": "default" + } +} +,{ + "path": "uni_modules/uni-push-admin/pages/log/detail", + "style": { + "navigationBarTitleText": "推送详情", + "navigationStyle": "default" + } +} +,{ + "path": "uni_modules/uni-push-admin/pages/sendMessage/sendMessage", + "style": { + "h5": { + "titleNView": { + "type": "transparent" + } + }, + "navigationBarTitleText": "消息推送", + "navigationStyle": "default" + } +} +], "subPackages": [{ "root": "pages/system", "pages": [{ diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/index.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/index.js new file mode 100644 index 0000000..3976e2a --- /dev/null +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/index.js @@ -0,0 +1,13 @@ +// 简单的使用示例 +'use strict'; +const uniPush = uniCloud.getPushManager({appId:"__UNI__AAFC50C"}) //注意这里需要传入你的应用appId +exports.main = async (event, context) => { + return await uniPush.sendMessage({ + "push_clientid": "b4f399168b2b0c434ef3f2cdff9cbed3", //填写上一步在uni-app客户端获取到的客户端推送标识push_clientid + "title": "111111", + "content": "2222", + "payload": { + "text":"体验一下uni-push2.0" + } + }) +}; \ No newline at end of file diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/package.json b/alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/package.json new file mode 100644 index 0000000..13cd6b2 --- /dev/null +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/uni-cloud-push/package.json @@ -0,0 +1,7 @@ +{ + "name": "uni-cloud-push", + "dependencies": {}, + "extensions": { + "uni-cloud-push": {} + } +} \ No newline at end of file diff --git a/alpha/admin/uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/node_modules/uni-config-center/index.js b/alpha/admin/uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/node_modules/uni-config-center/index.js index 1a7d1dd..00ba62f 100644 --- a/alpha/admin/uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/node_modules/uni-config-center/index.js +++ b/alpha/admin/uni_modules/uni-captcha/uniCloud/cloudfunctions/common/uni-captcha/node_modules/uni-config-center/index.js @@ -1,582 +1 @@ -"use strict"; -var t = require("fs"), - r = require("path"); - -function e(t) { - return t && "object" == typeof t && "default" in t ? t : { - default: t - } -} -var n = e(t), - o = e(r), - i = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != - typeof global ? global : "undefined" != typeof self ? self : {}; -var u = function(t) { - var r = { - exports: {} - }; - return t(r, r.exports), r.exports -}((function(t, r) { - var e = "__lodash_hash_undefined__", - n = 9007199254740991, - o = "[object Arguments]", - u = "[object Function]", - c = "[object Object]", - a = /^\[object .+?Constructor\]$/, - f = /^(?:0|[1-9]\d*)$/, - s = {}; - s["[object Float32Array]"] = s["[object Float64Array]"] = s["[object Int8Array]"] = s[ - "[object Int16Array]"] = s["[object Int32Array]"] = s["[object Uint8Array]"] = s[ - "[object Uint8ClampedArray]"] = s["[object Uint16Array]"] = s["[object Uint32Array]"] = !0, s[ - o] = s["[object Array]"] = s["[object ArrayBuffer]"] = s["[object Boolean]"] = s[ - "[object DataView]"] = s["[object Date]"] = s["[object Error]"] = s[u] = s["[object Map]"] = s[ - "[object Number]"] = s[c] = s["[object RegExp]"] = s["[object Set]"] = s["[object String]"] = s[ - "[object WeakMap]"] = !1; - var l = "object" == typeof i && i && i.Object === Object && i, - h = "object" == typeof self && self && self.Object === Object && self, - p = l || h || Function("return this")(), - _ = r && !r.nodeType && r, - v = _ && t && !t.nodeType && t, - d = v && v.exports === _, - y = d && l.process, - g = function() { - try { - var t = v && v.require && v.require("util").types; - return t || y && y.binding && y.binding("util") - } catch (t) {} - }(), - b = g && g.isTypedArray; - - function j(t, r, e) { - switch (e.length) { - case 0: - return t.call(r); - case 1: - return t.call(r, e[0]); - case 2: - return t.call(r, e[0], e[1]); - case 3: - return t.call(r, e[0], e[1], e[2]) - } - return t.apply(r, e) - } - var w, O, m, A = Array.prototype, - z = Function.prototype, - M = Object.prototype, - x = p["__core-js_shared__"], - C = z.toString, - F = M.hasOwnProperty, - U = (w = /[^.]+$/.exec(x && x.keys && x.keys.IE_PROTO || "")) ? "Symbol(src)_1." + w : "", - S = M.toString, - I = C.call(Object), - P = RegExp("^" + C.call(F).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace( - /hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), - T = d ? p.Buffer : void 0, - q = p.Symbol, - E = p.Uint8Array, - $ = T ? T.allocUnsafe : void 0, - D = (O = Object.getPrototypeOf, m = Object, function(t) { - return O(m(t)) - }), - k = Object.create, - B = M.propertyIsEnumerable, - N = A.splice, - L = q ? q.toStringTag : void 0, - R = function() { - try { - var t = vt(Object, "defineProperty"); - return t({}, "", {}), t - } catch (t) {} - }(), - G = T ? T.isBuffer : void 0, - V = Math.max, - W = Date.now, - H = vt(p, "Map"), - J = vt(Object, "create"), - K = function() { - function t() {} - return function(r) { - if (!xt(r)) return {}; - if (k) return k(r); - t.prototype = r; - var e = new t; - return t.prototype = void 0, e - } - }(); - - function Q(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function X(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function Y(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function Z(t) { - var r = this.__data__ = new X(t); - this.size = r.size - } - - function tt(t, r) { - var e = Ot(t), - n = !e && wt(t), - o = !e && !n && At(t), - i = !e && !n && !o && Ft(t), - u = e || n || o || i, - c = u ? function(t, r) { - for (var e = -1, n = Array(t); ++e < t;) n[e] = r(e); - return n - }(t.length, String) : [], - a = c.length; - for (var f in t) !r && !F.call(t, f) || u && ("length" == f || o && ("offset" == f || "parent" == - f) || i && ("buffer" == f || "byteLength" == f || "byteOffset" == f) || dt(f, a)) || c.push( - f); - return c - } - - function rt(t, r, e) { - (void 0 !== e && !jt(t[r], e) || void 0 === e && !(r in t)) && ot(t, r, e) - } - - function et(t, r, e) { - var n = t[r]; - F.call(t, r) && jt(n, e) && (void 0 !== e || r in t) || ot(t, r, e) - } - - function nt(t, r) { - for (var e = t.length; e--;) - if (jt(t[e][0], r)) return e; - return -1 - } - - function ot(t, r, e) { - "__proto__" == r && R ? R(t, r, { - configurable: !0, - enumerable: !0, - value: e, - writable: !0 - }) : t[r] = e - } - Q.prototype.clear = function() { - this.__data__ = J ? J(null) : {}, this.size = 0 - }, Q.prototype.delete = function(t) { - var r = this.has(t) && delete this.__data__[t]; - return this.size -= r ? 1 : 0, r - }, Q.prototype.get = function(t) { - var r = this.__data__; - if (J) { - var n = r[t]; - return n === e ? void 0 : n - } - return F.call(r, t) ? r[t] : void 0 - }, Q.prototype.has = function(t) { - var r = this.__data__; - return J ? void 0 !== r[t] : F.call(r, t) - }, Q.prototype.set = function(t, r) { - var n = this.__data__; - return this.size += this.has(t) ? 0 : 1, n[t] = J && void 0 === r ? e : r, this - }, X.prototype.clear = function() { - this.__data__ = [], this.size = 0 - }, X.prototype.delete = function(t) { - var r = this.__data__, - e = nt(r, t); - return !(e < 0) && (e == r.length - 1 ? r.pop() : N.call(r, e, 1), --this.size, !0) - }, X.prototype.get = function(t) { - var r = this.__data__, - e = nt(r, t); - return e < 0 ? void 0 : r[e][1] - }, X.prototype.has = function(t) { - return nt(this.__data__, t) > -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;t -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;tparseInt(e)):void 0}function o(e,t){const n=r(e),i=r(t);return n?i?function(e,t){const n=Math.max(e.length,t.length);for(let i=0;ir)return 1;if(ne)throw new Error("Config error, tokenExpiresThreshold should be less than tokenExpiresIn")}get customToken(){return this.uniId.interceptorMap.get("customToken")}isTokenInDb(e){return o(e,"1.0.10")>=0}async getUserRecord(){if(this.userRecord)return this.userRecord;const e=await C.doc(this.uid).get();if(this.userRecord=e.data[0],!this.userRecord)throw{errCode:n.ACCOUNT_NOT_EXISTS};switch(this.userRecord.status){case void 0:case 0:break;case 1:throw{errCode:n.ACCOUNT_BANNED};case 2:throw{errCode:n.ACCOUNT_AUDITING};case 3:throw{errCode:n.ACCOUNT_AUDIT_FAILED};case 4:throw{errCode:n.ACCOUNT_CLOSED}}if(this.oldTokenPayload){if(this.isTokenInDb(this.oldTokenPayload.uniIdVersion)){if(-1===(this.userRecord.token||[]).indexOf(this.oldToken))throw{errCode:n.CHECK_TOKEN_FAILED}}if(this.userRecord.valid_token_date&&this.userRecord.valid_token_date>1e3*this.oldTokenPayload.iat)throw{errCode:n.TOKEN_EXPIRED}}return this.userRecord}async updateUserRecord(e){await C.doc(this.uid).update(e)}async getUserPermission(){if(this.userPermission)return this.userPermission;const e=(await this.getUserRecord()).role||[];if(0===e.length)return this.userPermission={role:[],permission:[]},this.userPermission;if(e.includes("admin"))return this.userPermission={role:["admin"],permission:[]},this.userPermission;const t=await m.where({role_id:_.in(e)}).get(),n=(i=t.data.reduce((e,t)=>(t.permission&&e.push(...t.permission),e),[]),Array.from(new Set(i)));var i;return this.userPermission={role:e,permission:n},this.userPermission}async _createToken({uid:e,role:t,permission:i}={}){if(!t||!i){const e=await this.getUserPermission();t=e.role,i=e.permission}let r={uid:e,role:t,permission:i};if(this.uniId.interceptorMap.has("customToken")){const n=this.uniId.interceptorMap.get("customToken");if("function"!=typeof n)throw new Error("Invalid custom token file");r=await n({uid:e,role:t,permission:i})}const o=Date.now(),{tokenSecret:s,tokenExpiresIn:c}=this.config,a=g({...r,uniIdVersion:"1.0.13"},s,{expiresIn:c}),u=await this.getUserRecord(),d=(u.token||[]).filter(e=>{try{const t=this._checkToken(e);if(u.valid_token_date&&u.valid_token_date>1e3*t.iat)return!1}catch(e){if(e.errCode===n.TOKEN_EXPIRED)return!1}return!0});return d.push(a),await this.updateUserRecord({last_login_ip:this.clientInfo.clientIP,last_login_date:o,token:d}),{token:a,tokenExpired:o+1e3*c}}async createToken({uid:e,role:t,permission:i}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"uid"}};this.uid=e;const{token:r,tokenExpired:o}=await this._createToken({uid:e,role:t,permission:i});return{errCode:0,token:r,tokenExpired:o}}async refreshToken({token:e}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const t=this._checkToken(e);this.uid=t.uid,this.oldTokenPayload=t;const{uid:i}=t,{role:r,permission:o}=await this.getUserPermission(),{token:s,tokenExpired:c}=await this._createToken({uid:i,role:r,permission:o});return{errCode:0,token:s,tokenExpired:c}}_checkToken(e){const{tokenSecret:t}=this.config;let i;try{i=k(e,t)}catch(e){if("TokenExpiredError"===e.name)throw{errCode:n.TOKEN_EXPIRED};throw{errCode:n.CHECK_TOKEN_FAILED}}return i}async checkToken(e,{autoRefresh:t=!0}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const i=this._checkToken(e);this.uid=i.uid,this.oldTokenPayload=i;const{tokenExpiresThreshold:r}=this.config,{uid:o,role:s,permission:c}=i,a={role:s,permission:c};if(!s&&!c){const{role:e,permission:t}=await this.getUserPermission();a.role=e,a.permission=t}if(!r||!t){const e={code:0,errCode:0,...i,...a};return delete e.uniIdVersion,e}const u=Date.now();let d={};1e3*i.exp-u<1e3*r&&(d=await this._createToken({uid:o}));const l={code:0,errCode:0,...i,...a,...d};return delete l.uniIdVersion,l}}var E=Object.freeze({__proto__:null,checkToken:async function(e,{autoRefresh:t=!0}={}){return new T({uniId:this}).checkToken(e,{autoRefresh:t})},createToken:async function({uid:e,role:t,permission:n}={}){return new T({uniId:this}).createToken({uid:e,role:t,permission:n})},refreshToken:async function({token:e}={}){return new T({uniId:this}).refreshToken({token:e})}});const w=require("uni-config-center")({pluginId:"uni-id"});class A{constructor({context:e,clientInfo:t,config:n}={}){this._clientInfo=e?function(e){return{appId:e.APPID,platform:e.PLATFORM,locale:e.LOCALE,clientIP:e.CLIENTIP,deviceId:e.DEVICEID}}(e):t,this.config=n||this._getOriginConfig(),this.interceptorMap=new Map,w.hasFile("custom-token.js")&&this.setInterceptor("customToken",require(w.resolve("custom-token.js"))),this._i18n=uniCloud.initI18n({locale:this._clientInfo.locale,fallbackLocale:"zh-Hans",messages:d})}setInterceptor(e,t){this.interceptorMap.set(e,t)}_t(...e){return this._i18n.t(...e)}_parseOriginConfig(e){return Array.isArray(e)?e:e[0]?Object.values(e):e}_getOriginConfig(){if(w.hasFile("config.json")){let e;try{e=w.config()}catch(e){throw new Error("Invalid uni-id config file\n"+e.message)}return this._parseOriginConfig(e)}try{return this._parseOriginConfig(require("uni-id/config.json"))}catch(e){throw new Error("Invalid uni-id config file")}}_getAppConfig(){const e=this._getOriginConfig();return Array.isArray(e)?e.find(e=>e.dcloudAppid===this._clientInfo.appId)||e.find(e=>e.isDefaultConfig):e}_getPlatformConfig(){const e=this._getAppConfig();if(!e)throw new Error(`Config for current app (${this._clientInfo.appId}) was not found, please check your config file or client appId`);let t;switch("app-plus"===this._clientInfo.platform&&(this._clientInfo.platform="app"),"h5"===this._clientInfo.platform&&(this._clientInfo.platform="web"),this._clientInfo.platform){case"web":t="h5";break;case"app":t="app-plus"}const n=[{tokenExpiresIn:7200,tokenExpiresThreshold:1200,passwordErrorLimit:6,passwordErrorRetryTime:3600},e];t&&e[t]&&n.push(e[t]),n.push(e[this._clientInfo.platform]);const i=Object.assign(...n);return["tokenSecret","tokenExpiresIn"].forEach(e=>{if(!i||!i[e])throw new Error(`Config parameter missing, ${e} is required`)}),i}_getConfig(){return this._getPlatformConfig()}}for(const e in E)A.prototype[e]=E[e];function y(e){const t=new A(e);return new Proxy(t,{get(e,t){if(t in e&&0!==t.indexOf("_")){if("function"==typeof e[t])return(n=e[t],function(){let e;try{e=n.apply(this,arguments)}catch(e){if(a(e))return c.call(this,e),e;throw e}return i(e)?e.then(e=>(a(e)&&c.call(this,e),e),e=>{if(a(e))return c.call(this,e),e;throw e}):(a(e)&&c.call(this,e),e)}).bind(e);if("context"!==t&&"config"!==t)return e[t]}var n}})}A.prototype.createInstance=y;const x={createInstance:y};module.exports=x; +"use strict";var e,t=(e=require("crypto"))&&"object"==typeof e&&"default"in e?e.default:e;const n={TOKEN_EXPIRED:"uni-id-token-expired",CHECK_TOKEN_FAILED:"uni-id-check-token-failed",PARAM_REQUIRED:"uni-id-param-required",ACCOUNT_EXISTS:"uni-id-account-exists",ACCOUNT_NOT_EXISTS:"uni-id-account-not-exists",ACCOUNT_CONFLICT:"uni-id-account-conflict",ACCOUNT_BANNED:"uni-id-account-banned",ACCOUNT_AUDITING:"uni-id-account-auditing",ACCOUNT_AUDIT_FAILED:"uni-id-account-audit-failed",ACCOUNT_CLOSED:"uni-id-account-closed"};function i(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function r(e){if(!e)return;const t=e.match(/^(\d+).(\d+).(\d+)/);return t?t.slice(1,4).map(e=>parseInt(e)):void 0}function o(e,t){const n=r(e),i=r(t);return n?i?function(e,t){const n=Math.max(e.length,t.length);for(let i=0;ir)return 1;if(n=e)throw new Error("Config error, tokenExpiresThreshold should be less than tokenExpiresIn");t>e/2&&console.warn(`Please check whether the tokenExpiresThreshold configuration is set too large, tokenExpiresThreshold: ${t}, tokenExpiresIn: ${e}`)}get customToken(){return this.uniId.interceptorMap.get("customToken")}isTokenInDb(e){return o(e,"1.0.10")>=0}async getUserRecord(){if(this.userRecord)return this.userRecord;const e=await C.doc(this.uid).get();if(this.userRecord=e.data[0],!this.userRecord)throw{errCode:n.ACCOUNT_NOT_EXISTS};switch(this.userRecord.status){case void 0:case 0:break;case 1:throw{errCode:n.ACCOUNT_BANNED};case 2:throw{errCode:n.ACCOUNT_AUDITING};case 3:throw{errCode:n.ACCOUNT_AUDIT_FAILED};case 4:throw{errCode:n.ACCOUNT_CLOSED}}if(this.oldTokenPayload){if(this.isTokenInDb(this.oldTokenPayload.uniIdVersion)){if(-1===(this.userRecord.token||[]).indexOf(this.oldToken))throw{errCode:n.CHECK_TOKEN_FAILED}}if(this.userRecord.valid_token_date&&this.userRecord.valid_token_date>1e3*this.oldTokenPayload.iat)throw{errCode:n.TOKEN_EXPIRED}}return this.userRecord}async updateUserRecord(e){await C.doc(this.uid).update(e)}async getUserPermission(){if(this.userPermission)return this.userPermission;const e=(await this.getUserRecord()).role||[];if(0===e.length)return this.userPermission={role:[],permission:[]},this.userPermission;if(e.includes("admin"))return this.userPermission={role:e,permission:[]},this.userPermission;const t=await T.where({role_id:_.in(e)}).get(),n=(i=t.data.reduce((e,t)=>(t.permission&&e.push(...t.permission),e),[]),Array.from(new Set(i)));var i;return this.userPermission={role:e,permission:n},this.userPermission}async _createToken({uid:e,role:t,permission:i}={}){if(!t||!i){const e=await this.getUserPermission();t=e.role,i=e.permission}let r={uid:e,role:t,permission:i};if(this.uniId.interceptorMap.has("customToken")){const n=this.uniId.interceptorMap.get("customToken");if("function"!=typeof n)throw new Error("Invalid custom token file");r=await n({uid:e,role:t,permission:i})}const o=Date.now(),{tokenSecret:s,tokenExpiresIn:c,maxTokenLength:a=10}=this.config,u=g({...r,uniIdVersion:"1.0.16"},s,{expiresIn:c}),d=await this.getUserRecord(),l=(d.token||[]).filter(e=>{try{const t=this._checkToken(e);if(d.valid_token_date&&d.valid_token_date>1e3*t.iat)return!1}catch(e){if(e.errCode===n.TOKEN_EXPIRED)return!1}return!0});return l.push(u),l.length>a&&l.splice(0,l.length-a),await this.updateUserRecord({last_login_ip:this.clientInfo.clientIP,last_login_date:o,token:l}),{token:u,tokenExpired:o+1e3*c}}async createToken({uid:e,role:t,permission:i}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"uid"}};this.uid=e;const{token:r,tokenExpired:o}=await this._createToken({uid:e,role:t,permission:i});return{errCode:0,token:r,tokenExpired:o}}async refreshToken({token:e}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const t=this._checkToken(e);this.uid=t.uid,this.oldTokenPayload=t;const{uid:i}=t,{role:r,permission:o}=await this.getUserPermission(),{token:s,tokenExpired:c}=await this._createToken({uid:i,role:r,permission:o});return{errCode:0,token:s,tokenExpired:c}}_checkToken(e){const{tokenSecret:t}=this.config;let i;try{i=k(e,t)}catch(e){if("TokenExpiredError"===e.name)throw{errCode:n.TOKEN_EXPIRED};throw{errCode:n.CHECK_TOKEN_FAILED}}return i}async checkToken(e,{autoRefresh:t=!0}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const i=this._checkToken(e);this.uid=i.uid,this.oldTokenPayload=i;const{tokenExpiresThreshold:r}=this.config,{uid:o,role:s,permission:c}=i,a={role:s,permission:c};if(!s&&!c){const{role:e,permission:t}=await this.getUserPermission();a.role=e,a.permission=t}if(!r||!t){const e={code:0,errCode:0,...i,...a};return delete e.uniIdVersion,e}const u=Date.now();let d={};1e3*i.exp-u<1e3*r&&(d=await this._createToken({uid:o}));const l={code:0,errCode:0,...i,...a,...d};return delete l.uniIdVersion,l}}var E=Object.freeze({__proto__:null,checkToken:async function(e,{autoRefresh:t=!0}={}){return new m({uniId:this}).checkToken(e,{autoRefresh:t})},createToken:async function({uid:e,role:t,permission:n}={}){return new m({uniId:this}).createToken({uid:e,role:t,permission:n})},refreshToken:async function({token:e}={}){return new m({uniId:this}).refreshToken({token:e})}});const w=require("uni-config-center")({pluginId:"uni-id"});class x{constructor({context:e,clientInfo:t,config:n}={}){this._clientInfo=e?function(e){return{appId:e.APPID,platform:e.PLATFORM,locale:e.LOCALE,clientIP:e.CLIENTIP,deviceId:e.DEVICEID}}(e):t,this.config=n||this._getOriginConfig(),this.interceptorMap=new Map,w.hasFile("custom-token.js")&&this.setInterceptor("customToken",require(w.resolve("custom-token.js")));this._i18n=uniCloud.initI18n({locale:this._clientInfo.locale,fallbackLocale:"zh-Hans",messages:JSON.parse(JSON.stringify(d))}),d[this._i18n.locale]||this._i18n.setLocale("zh-Hans")}setInterceptor(e,t){this.interceptorMap.set(e,t)}_t(...e){return this._i18n.t(...e)}_parseOriginConfig(e){return Array.isArray(e)?e:e[0]?Object.values(e):e}_getOriginConfig(){if(w.hasFile("config.json")){let e;try{e=w.config()}catch(e){throw new Error("Invalid uni-id config file\n"+e.message)}return this._parseOriginConfig(e)}try{return this._parseOriginConfig(require("uni-id/config.json"))}catch(e){throw new Error("Invalid uni-id config file")}}_getAppConfig(){const e=this._getOriginConfig();return Array.isArray(e)?e.find(e=>e.dcloudAppid===this._clientInfo.appId)||e.find(e=>e.isDefaultConfig):e}_getPlatformConfig(){const e=this._getAppConfig();if(!e)throw new Error(`Config for current app (${this._clientInfo.appId}) was not found, please check your config file or client appId`);let t;switch("app-plus"===this._clientInfo.platform&&(this._clientInfo.platform="app"),"h5"===this._clientInfo.platform&&(this._clientInfo.platform="web"),this._clientInfo.platform){case"web":t="h5";break;case"app":t="app-plus"}const n=[{tokenExpiresIn:7200,tokenExpiresThreshold:1200,passwordErrorLimit:6,passwordErrorRetryTime:3600},e];t&&e[t]&&n.push(e[t]),n.push(e[this._clientInfo.platform]);const i=Object.assign(...n);return["tokenSecret","tokenExpiresIn"].forEach(e=>{if(!i||!i[e])throw new Error(`Config parameter missing, ${e} is required`)}),i}_getConfig(){return this._getPlatformConfig()}}for(const e in E)x.prototype[e]=E[e];function y(e){const t=new x(e);return new Proxy(t,{get(e,t){if(t in e&&0!==t.indexOf("_")){if("function"==typeof e[t])return(n=e[t],function(){let e;try{e=n.apply(this,arguments)}catch(e){if(a(e))return c.call(this,e),e;throw e}return i(e)?e.then(e=>(a(e)&&c.call(this,e),e),e=>{if(a(e))return c.call(this,e),e;throw e}):(a(e)&&c.call(this,e),e)}).bind(e);if("context"!==t&&"config"!==t)return e[t]}var n}})}x.prototype.createInstance=y;const A={createInstance:y};module.exports=A; diff --git a/alpha/admin/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/node_modules/uni-config-center/index.js b/alpha/admin/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/node_modules/uni-config-center/index.js index 1a7d1dd..00ba62f 100644 --- a/alpha/admin/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/node_modules/uni-config-center/index.js +++ b/alpha/admin/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/node_modules/uni-config-center/index.js @@ -1,582 +1 @@ -"use strict"; -var t = require("fs"), - r = require("path"); - -function e(t) { - return t && "object" == typeof t && "default" in t ? t : { - default: t - } -} -var n = e(t), - o = e(r), - i = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != - typeof global ? global : "undefined" != typeof self ? self : {}; -var u = function(t) { - var r = { - exports: {} - }; - return t(r, r.exports), r.exports -}((function(t, r) { - var e = "__lodash_hash_undefined__", - n = 9007199254740991, - o = "[object Arguments]", - u = "[object Function]", - c = "[object Object]", - a = /^\[object .+?Constructor\]$/, - f = /^(?:0|[1-9]\d*)$/, - s = {}; - s["[object Float32Array]"] = s["[object Float64Array]"] = s["[object Int8Array]"] = s[ - "[object Int16Array]"] = s["[object Int32Array]"] = s["[object Uint8Array]"] = s[ - "[object Uint8ClampedArray]"] = s["[object Uint16Array]"] = s["[object Uint32Array]"] = !0, s[ - o] = s["[object Array]"] = s["[object ArrayBuffer]"] = s["[object Boolean]"] = s[ - "[object DataView]"] = s["[object Date]"] = s["[object Error]"] = s[u] = s["[object Map]"] = s[ - "[object Number]"] = s[c] = s["[object RegExp]"] = s["[object Set]"] = s["[object String]"] = s[ - "[object WeakMap]"] = !1; - var l = "object" == typeof i && i && i.Object === Object && i, - h = "object" == typeof self && self && self.Object === Object && self, - p = l || h || Function("return this")(), - _ = r && !r.nodeType && r, - v = _ && t && !t.nodeType && t, - d = v && v.exports === _, - y = d && l.process, - g = function() { - try { - var t = v && v.require && v.require("util").types; - return t || y && y.binding && y.binding("util") - } catch (t) {} - }(), - b = g && g.isTypedArray; - - function j(t, r, e) { - switch (e.length) { - case 0: - return t.call(r); - case 1: - return t.call(r, e[0]); - case 2: - return t.call(r, e[0], e[1]); - case 3: - return t.call(r, e[0], e[1], e[2]) - } - return t.apply(r, e) - } - var w, O, m, A = Array.prototype, - z = Function.prototype, - M = Object.prototype, - x = p["__core-js_shared__"], - C = z.toString, - F = M.hasOwnProperty, - U = (w = /[^.]+$/.exec(x && x.keys && x.keys.IE_PROTO || "")) ? "Symbol(src)_1." + w : "", - S = M.toString, - I = C.call(Object), - P = RegExp("^" + C.call(F).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace( - /hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), - T = d ? p.Buffer : void 0, - q = p.Symbol, - E = p.Uint8Array, - $ = T ? T.allocUnsafe : void 0, - D = (O = Object.getPrototypeOf, m = Object, function(t) { - return O(m(t)) - }), - k = Object.create, - B = M.propertyIsEnumerable, - N = A.splice, - L = q ? q.toStringTag : void 0, - R = function() { - try { - var t = vt(Object, "defineProperty"); - return t({}, "", {}), t - } catch (t) {} - }(), - G = T ? T.isBuffer : void 0, - V = Math.max, - W = Date.now, - H = vt(p, "Map"), - J = vt(Object, "create"), - K = function() { - function t() {} - return function(r) { - if (!xt(r)) return {}; - if (k) return k(r); - t.prototype = r; - var e = new t; - return t.prototype = void 0, e - } - }(); - - function Q(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function X(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function Y(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function Z(t) { - var r = this.__data__ = new X(t); - this.size = r.size - } - - function tt(t, r) { - var e = Ot(t), - n = !e && wt(t), - o = !e && !n && At(t), - i = !e && !n && !o && Ft(t), - u = e || n || o || i, - c = u ? function(t, r) { - for (var e = -1, n = Array(t); ++e < t;) n[e] = r(e); - return n - }(t.length, String) : [], - a = c.length; - for (var f in t) !r && !F.call(t, f) || u && ("length" == f || o && ("offset" == f || "parent" == - f) || i && ("buffer" == f || "byteLength" == f || "byteOffset" == f) || dt(f, a)) || c.push( - f); - return c - } - - function rt(t, r, e) { - (void 0 !== e && !jt(t[r], e) || void 0 === e && !(r in t)) && ot(t, r, e) - } - - function et(t, r, e) { - var n = t[r]; - F.call(t, r) && jt(n, e) && (void 0 !== e || r in t) || ot(t, r, e) - } - - function nt(t, r) { - for (var e = t.length; e--;) - if (jt(t[e][0], r)) return e; - return -1 - } - - function ot(t, r, e) { - "__proto__" == r && R ? R(t, r, { - configurable: !0, - enumerable: !0, - value: e, - writable: !0 - }) : t[r] = e - } - Q.prototype.clear = function() { - this.__data__ = J ? J(null) : {}, this.size = 0 - }, Q.prototype.delete = function(t) { - var r = this.has(t) && delete this.__data__[t]; - return this.size -= r ? 1 : 0, r - }, Q.prototype.get = function(t) { - var r = this.__data__; - if (J) { - var n = r[t]; - return n === e ? void 0 : n - } - return F.call(r, t) ? r[t] : void 0 - }, Q.prototype.has = function(t) { - var r = this.__data__; - return J ? void 0 !== r[t] : F.call(r, t) - }, Q.prototype.set = function(t, r) { - var n = this.__data__; - return this.size += this.has(t) ? 0 : 1, n[t] = J && void 0 === r ? e : r, this - }, X.prototype.clear = function() { - this.__data__ = [], this.size = 0 - }, X.prototype.delete = function(t) { - var r = this.__data__, - e = nt(r, t); - return !(e < 0) && (e == r.length - 1 ? r.pop() : N.call(r, e, 1), --this.size, !0) - }, X.prototype.get = function(t) { - var r = this.__data__, - e = nt(r, t); - return e < 0 ? void 0 : r[e][1] - }, X.prototype.has = function(t) { - return nt(this.__data__, t) > -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;t -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;t -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;tparseInt(e)):void 0}function o(e,t){const n=r(e),i=r(t);return n?i?function(e,t){const n=Math.max(e.length,t.length);for(let i=0;ir)return 1;if(ne)throw new Error("Config error, tokenExpiresThreshold should be less than tokenExpiresIn")}get customToken(){return this.uniId.interceptorMap.get("customToken")}isTokenInDb(e){return o(e,"1.0.10")>=0}async getUserRecord(){if(this.userRecord)return this.userRecord;const e=await C.doc(this.uid).get();if(this.userRecord=e.data[0],!this.userRecord)throw{errCode:n.ACCOUNT_NOT_EXISTS};switch(this.userRecord.status){case void 0:case 0:break;case 1:throw{errCode:n.ACCOUNT_BANNED};case 2:throw{errCode:n.ACCOUNT_AUDITING};case 3:throw{errCode:n.ACCOUNT_AUDIT_FAILED};case 4:throw{errCode:n.ACCOUNT_CLOSED}}if(this.oldTokenPayload){if(this.isTokenInDb(this.oldTokenPayload.uniIdVersion)){if(-1===(this.userRecord.token||[]).indexOf(this.oldToken))throw{errCode:n.CHECK_TOKEN_FAILED}}if(this.userRecord.valid_token_date&&this.userRecord.valid_token_date>1e3*this.oldTokenPayload.iat)throw{errCode:n.TOKEN_EXPIRED}}return this.userRecord}async updateUserRecord(e){await C.doc(this.uid).update(e)}async getUserPermission(){if(this.userPermission)return this.userPermission;const e=(await this.getUserRecord()).role||[];if(0===e.length)return this.userPermission={role:[],permission:[]},this.userPermission;if(e.includes("admin"))return this.userPermission={role:["admin"],permission:[]},this.userPermission;const t=await m.where({role_id:_.in(e)}).get(),n=(i=t.data.reduce((e,t)=>(t.permission&&e.push(...t.permission),e),[]),Array.from(new Set(i)));var i;return this.userPermission={role:e,permission:n},this.userPermission}async _createToken({uid:e,role:t,permission:i}={}){if(!t||!i){const e=await this.getUserPermission();t=e.role,i=e.permission}let r={uid:e,role:t,permission:i};if(this.uniId.interceptorMap.has("customToken")){const n=this.uniId.interceptorMap.get("customToken");if("function"!=typeof n)throw new Error("Invalid custom token file");r=await n({uid:e,role:t,permission:i})}const o=Date.now(),{tokenSecret:s,tokenExpiresIn:c}=this.config,a=g({...r,uniIdVersion:"1.0.13"},s,{expiresIn:c}),u=await this.getUserRecord(),d=(u.token||[]).filter(e=>{try{const t=this._checkToken(e);if(u.valid_token_date&&u.valid_token_date>1e3*t.iat)return!1}catch(e){if(e.errCode===n.TOKEN_EXPIRED)return!1}return!0});return d.push(a),await this.updateUserRecord({last_login_ip:this.clientInfo.clientIP,last_login_date:o,token:d}),{token:a,tokenExpired:o+1e3*c}}async createToken({uid:e,role:t,permission:i}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"uid"}};this.uid=e;const{token:r,tokenExpired:o}=await this._createToken({uid:e,role:t,permission:i});return{errCode:0,token:r,tokenExpired:o}}async refreshToken({token:e}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const t=this._checkToken(e);this.uid=t.uid,this.oldTokenPayload=t;const{uid:i}=t,{role:r,permission:o}=await this.getUserPermission(),{token:s,tokenExpired:c}=await this._createToken({uid:i,role:r,permission:o});return{errCode:0,token:s,tokenExpired:c}}_checkToken(e){const{tokenSecret:t}=this.config;let i;try{i=k(e,t)}catch(e){if("TokenExpiredError"===e.name)throw{errCode:n.TOKEN_EXPIRED};throw{errCode:n.CHECK_TOKEN_FAILED}}return i}async checkToken(e,{autoRefresh:t=!0}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const i=this._checkToken(e);this.uid=i.uid,this.oldTokenPayload=i;const{tokenExpiresThreshold:r}=this.config,{uid:o,role:s,permission:c}=i,a={role:s,permission:c};if(!s&&!c){const{role:e,permission:t}=await this.getUserPermission();a.role=e,a.permission=t}if(!r||!t){const e={code:0,errCode:0,...i,...a};return delete e.uniIdVersion,e}const u=Date.now();let d={};1e3*i.exp-u<1e3*r&&(d=await this._createToken({uid:o}));const l={code:0,errCode:0,...i,...a,...d};return delete l.uniIdVersion,l}}var E=Object.freeze({__proto__:null,checkToken:async function(e,{autoRefresh:t=!0}={}){return new T({uniId:this}).checkToken(e,{autoRefresh:t})},createToken:async function({uid:e,role:t,permission:n}={}){return new T({uniId:this}).createToken({uid:e,role:t,permission:n})},refreshToken:async function({token:e}={}){return new T({uniId:this}).refreshToken({token:e})}});const w=require("uni-config-center")({pluginId:"uni-id"});class A{constructor({context:e,clientInfo:t,config:n}={}){this._clientInfo=e?function(e){return{appId:e.APPID,platform:e.PLATFORM,locale:e.LOCALE,clientIP:e.CLIENTIP,deviceId:e.DEVICEID}}(e):t,this.config=n||this._getOriginConfig(),this.interceptorMap=new Map,w.hasFile("custom-token.js")&&this.setInterceptor("customToken",require(w.resolve("custom-token.js"))),this._i18n=uniCloud.initI18n({locale:this._clientInfo.locale,fallbackLocale:"zh-Hans",messages:d})}setInterceptor(e,t){this.interceptorMap.set(e,t)}_t(...e){return this._i18n.t(...e)}_parseOriginConfig(e){return Array.isArray(e)?e:e[0]?Object.values(e):e}_getOriginConfig(){if(w.hasFile("config.json")){let e;try{e=w.config()}catch(e){throw new Error("Invalid uni-id config file\n"+e.message)}return this._parseOriginConfig(e)}try{return this._parseOriginConfig(require("uni-id/config.json"))}catch(e){throw new Error("Invalid uni-id config file")}}_getAppConfig(){const e=this._getOriginConfig();return Array.isArray(e)?e.find(e=>e.dcloudAppid===this._clientInfo.appId)||e.find(e=>e.isDefaultConfig):e}_getPlatformConfig(){const e=this._getAppConfig();if(!e)throw new Error(`Config for current app (${this._clientInfo.appId}) was not found, please check your config file or client appId`);let t;switch("app-plus"===this._clientInfo.platform&&(this._clientInfo.platform="app"),"h5"===this._clientInfo.platform&&(this._clientInfo.platform="web"),this._clientInfo.platform){case"web":t="h5";break;case"app":t="app-plus"}const n=[{tokenExpiresIn:7200,tokenExpiresThreshold:1200,passwordErrorLimit:6,passwordErrorRetryTime:3600},e];t&&e[t]&&n.push(e[t]),n.push(e[this._clientInfo.platform]);const i=Object.assign(...n);return["tokenSecret","tokenExpiresIn"].forEach(e=>{if(!i||!i[e])throw new Error(`Config parameter missing, ${e} is required`)}),i}_getConfig(){return this._getPlatformConfig()}}for(const e in E)A.prototype[e]=E[e];function y(e){const t=new A(e);return new Proxy(t,{get(e,t){if(t in e&&0!==t.indexOf("_")){if("function"==typeof e[t])return(n=e[t],function(){let e;try{e=n.apply(this,arguments)}catch(e){if(a(e))return c.call(this,e),e;throw e}return i(e)?e.then(e=>(a(e)&&c.call(this,e),e),e=>{if(a(e))return c.call(this,e),e;throw e}):(a(e)&&c.call(this,e),e)}).bind(e);if("context"!==t&&"config"!==t)return e[t]}var n}})}A.prototype.createInstance=y;const x={createInstance:y};module.exports=x; +"use strict";var e,t=(e=require("crypto"))&&"object"==typeof e&&"default"in e?e.default:e;const n={TOKEN_EXPIRED:"uni-id-token-expired",CHECK_TOKEN_FAILED:"uni-id-check-token-failed",PARAM_REQUIRED:"uni-id-param-required",ACCOUNT_EXISTS:"uni-id-account-exists",ACCOUNT_NOT_EXISTS:"uni-id-account-not-exists",ACCOUNT_CONFLICT:"uni-id-account-conflict",ACCOUNT_BANNED:"uni-id-account-banned",ACCOUNT_AUDITING:"uni-id-account-auditing",ACCOUNT_AUDIT_FAILED:"uni-id-account-audit-failed",ACCOUNT_CLOSED:"uni-id-account-closed"};function i(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}function r(e){if(!e)return;const t=e.match(/^(\d+).(\d+).(\d+)/);return t?t.slice(1,4).map(e=>parseInt(e)):void 0}function o(e,t){const n=r(e),i=r(t);return n?i?function(e,t){const n=Math.max(e.length,t.length);for(let i=0;ir)return 1;if(n=e)throw new Error("Config error, tokenExpiresThreshold should be less than tokenExpiresIn");t>e/2&&console.warn(`Please check whether the tokenExpiresThreshold configuration is set too large, tokenExpiresThreshold: ${t}, tokenExpiresIn: ${e}`)}get customToken(){return this.uniId.interceptorMap.get("customToken")}isTokenInDb(e){return o(e,"1.0.10")>=0}async getUserRecord(){if(this.userRecord)return this.userRecord;const e=await C.doc(this.uid).get();if(this.userRecord=e.data[0],!this.userRecord)throw{errCode:n.ACCOUNT_NOT_EXISTS};switch(this.userRecord.status){case void 0:case 0:break;case 1:throw{errCode:n.ACCOUNT_BANNED};case 2:throw{errCode:n.ACCOUNT_AUDITING};case 3:throw{errCode:n.ACCOUNT_AUDIT_FAILED};case 4:throw{errCode:n.ACCOUNT_CLOSED}}if(this.oldTokenPayload){if(this.isTokenInDb(this.oldTokenPayload.uniIdVersion)){if(-1===(this.userRecord.token||[]).indexOf(this.oldToken))throw{errCode:n.CHECK_TOKEN_FAILED}}if(this.userRecord.valid_token_date&&this.userRecord.valid_token_date>1e3*this.oldTokenPayload.iat)throw{errCode:n.TOKEN_EXPIRED}}return this.userRecord}async updateUserRecord(e){await C.doc(this.uid).update(e)}async getUserPermission(){if(this.userPermission)return this.userPermission;const e=(await this.getUserRecord()).role||[];if(0===e.length)return this.userPermission={role:[],permission:[]},this.userPermission;if(e.includes("admin"))return this.userPermission={role:e,permission:[]},this.userPermission;const t=await T.where({role_id:_.in(e)}).get(),n=(i=t.data.reduce((e,t)=>(t.permission&&e.push(...t.permission),e),[]),Array.from(new Set(i)));var i;return this.userPermission={role:e,permission:n},this.userPermission}async _createToken({uid:e,role:t,permission:i}={}){if(!t||!i){const e=await this.getUserPermission();t=e.role,i=e.permission}let r={uid:e,role:t,permission:i};if(this.uniId.interceptorMap.has("customToken")){const n=this.uniId.interceptorMap.get("customToken");if("function"!=typeof n)throw new Error("Invalid custom token file");r=await n({uid:e,role:t,permission:i})}const o=Date.now(),{tokenSecret:s,tokenExpiresIn:c,maxTokenLength:a=10}=this.config,u=g({...r,uniIdVersion:"1.0.16"},s,{expiresIn:c}),d=await this.getUserRecord(),l=(d.token||[]).filter(e=>{try{const t=this._checkToken(e);if(d.valid_token_date&&d.valid_token_date>1e3*t.iat)return!1}catch(e){if(e.errCode===n.TOKEN_EXPIRED)return!1}return!0});return l.push(u),l.length>a&&l.splice(0,l.length-a),await this.updateUserRecord({last_login_ip:this.clientInfo.clientIP,last_login_date:o,token:l}),{token:u,tokenExpired:o+1e3*c}}async createToken({uid:e,role:t,permission:i}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"uid"}};this.uid=e;const{token:r,tokenExpired:o}=await this._createToken({uid:e,role:t,permission:i});return{errCode:0,token:r,tokenExpired:o}}async refreshToken({token:e}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const t=this._checkToken(e);this.uid=t.uid,this.oldTokenPayload=t;const{uid:i}=t,{role:r,permission:o}=await this.getUserPermission(),{token:s,tokenExpired:c}=await this._createToken({uid:i,role:r,permission:o});return{errCode:0,token:s,tokenExpired:c}}_checkToken(e){const{tokenSecret:t}=this.config;let i;try{i=k(e,t)}catch(e){if("TokenExpiredError"===e.name)throw{errCode:n.TOKEN_EXPIRED};throw{errCode:n.CHECK_TOKEN_FAILED}}return i}async checkToken(e,{autoRefresh:t=!0}={}){if(!e)throw{errCode:n.PARAM_REQUIRED,errMsgValue:{param:"token"}};this.oldToken=e;const i=this._checkToken(e);this.uid=i.uid,this.oldTokenPayload=i;const{tokenExpiresThreshold:r}=this.config,{uid:o,role:s,permission:c}=i,a={role:s,permission:c};if(!s&&!c){const{role:e,permission:t}=await this.getUserPermission();a.role=e,a.permission=t}if(!r||!t){const e={code:0,errCode:0,...i,...a};return delete e.uniIdVersion,e}const u=Date.now();let d={};1e3*i.exp-u<1e3*r&&(d=await this._createToken({uid:o}));const l={code:0,errCode:0,...i,...a,...d};return delete l.uniIdVersion,l}}var E=Object.freeze({__proto__:null,checkToken:async function(e,{autoRefresh:t=!0}={}){return new m({uniId:this}).checkToken(e,{autoRefresh:t})},createToken:async function({uid:e,role:t,permission:n}={}){return new m({uniId:this}).createToken({uid:e,role:t,permission:n})},refreshToken:async function({token:e}={}){return new m({uniId:this}).refreshToken({token:e})}});const w=require("uni-config-center")({pluginId:"uni-id"});class x{constructor({context:e,clientInfo:t,config:n}={}){this._clientInfo=e?function(e){return{appId:e.APPID,platform:e.PLATFORM,locale:e.LOCALE,clientIP:e.CLIENTIP,deviceId:e.DEVICEID}}(e):t,this.config=n||this._getOriginConfig(),this.interceptorMap=new Map,w.hasFile("custom-token.js")&&this.setInterceptor("customToken",require(w.resolve("custom-token.js")));this._i18n=uniCloud.initI18n({locale:this._clientInfo.locale,fallbackLocale:"zh-Hans",messages:JSON.parse(JSON.stringify(d))}),d[this._i18n.locale]||this._i18n.setLocale("zh-Hans")}setInterceptor(e,t){this.interceptorMap.set(e,t)}_t(...e){return this._i18n.t(...e)}_parseOriginConfig(e){return Array.isArray(e)?e:e[0]?Object.values(e):e}_getOriginConfig(){if(w.hasFile("config.json")){let e;try{e=w.config()}catch(e){throw new Error("Invalid uni-id config file\n"+e.message)}return this._parseOriginConfig(e)}try{return this._parseOriginConfig(require("uni-id/config.json"))}catch(e){throw new Error("Invalid uni-id config file")}}_getAppConfig(){const e=this._getOriginConfig();return Array.isArray(e)?e.find(e=>e.dcloudAppid===this._clientInfo.appId)||e.find(e=>e.isDefaultConfig):e}_getPlatformConfig(){const e=this._getAppConfig();if(!e)throw new Error(`Config for current app (${this._clientInfo.appId}) was not found, please check your config file or client appId`);let t;switch("app-plus"===this._clientInfo.platform&&(this._clientInfo.platform="app"),"h5"===this._clientInfo.platform&&(this._clientInfo.platform="web"),this._clientInfo.platform){case"web":t="h5";break;case"app":t="app-plus"}const n=[{tokenExpiresIn:7200,tokenExpiresThreshold:1200,passwordErrorLimit:6,passwordErrorRetryTime:3600},e];t&&e[t]&&n.push(e[t]),n.push(e[this._clientInfo.platform]);const i=Object.assign(...n);return["tokenSecret","tokenExpiresIn"].forEach(e=>{if(!i||!i[e])throw new Error(`Config parameter missing, ${e} is required`)}),i}_getConfig(){return this._getPlatformConfig()}}for(const e in E)x.prototype[e]=E[e];function y(e){const t=new x(e);return new Proxy(t,{get(e,t){if(t in e&&0!==t.indexOf("_")){if("function"==typeof e[t])return(n=e[t],function(){let e;try{e=n.apply(this,arguments)}catch(e){if(a(e))return c.call(this,e),e;throw e}return i(e)?e.then(e=>(a(e)&&c.call(this,e),e),e=>{if(a(e))return c.call(this,e),e;throw e}):(a(e)&&c.call(this,e),e)}).bind(e);if("context"!==t&&"config"!==t)return e[t]}var n}})}x.prototype.createInstance=y;const A={createInstance:y};module.exports=A; diff --git a/alpha/admin/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/node_modules/uni-id-common/node_modules/uni-config-center/index.js b/alpha/admin/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/node_modules/uni-id-common/node_modules/uni-config-center/index.js index 1a7d1dd..00ba62f 100644 --- a/alpha/admin/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/node_modules/uni-id-common/node_modules/uni-config-center/index.js +++ b/alpha/admin/uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/node_modules/uni-id-common/node_modules/uni-config-center/index.js @@ -1,582 +1 @@ -"use strict"; -var t = require("fs"), - r = require("path"); - -function e(t) { - return t && "object" == typeof t && "default" in t ? t : { - default: t - } -} -var n = e(t), - o = e(r), - i = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != - typeof global ? global : "undefined" != typeof self ? self : {}; -var u = function(t) { - var r = { - exports: {} - }; - return t(r, r.exports), r.exports -}((function(t, r) { - var e = "__lodash_hash_undefined__", - n = 9007199254740991, - o = "[object Arguments]", - u = "[object Function]", - c = "[object Object]", - a = /^\[object .+?Constructor\]$/, - f = /^(?:0|[1-9]\d*)$/, - s = {}; - s["[object Float32Array]"] = s["[object Float64Array]"] = s["[object Int8Array]"] = s[ - "[object Int16Array]"] = s["[object Int32Array]"] = s["[object Uint8Array]"] = s[ - "[object Uint8ClampedArray]"] = s["[object Uint16Array]"] = s["[object Uint32Array]"] = !0, s[ - o] = s["[object Array]"] = s["[object ArrayBuffer]"] = s["[object Boolean]"] = s[ - "[object DataView]"] = s["[object Date]"] = s["[object Error]"] = s[u] = s["[object Map]"] = s[ - "[object Number]"] = s[c] = s["[object RegExp]"] = s["[object Set]"] = s["[object String]"] = s[ - "[object WeakMap]"] = !1; - var l = "object" == typeof i && i && i.Object === Object && i, - h = "object" == typeof self && self && self.Object === Object && self, - p = l || h || Function("return this")(), - _ = r && !r.nodeType && r, - v = _ && t && !t.nodeType && t, - d = v && v.exports === _, - y = d && l.process, - g = function() { - try { - var t = v && v.require && v.require("util").types; - return t || y && y.binding && y.binding("util") - } catch (t) {} - }(), - b = g && g.isTypedArray; - - function j(t, r, e) { - switch (e.length) { - case 0: - return t.call(r); - case 1: - return t.call(r, e[0]); - case 2: - return t.call(r, e[0], e[1]); - case 3: - return t.call(r, e[0], e[1], e[2]) - } - return t.apply(r, e) - } - var w, O, m, A = Array.prototype, - z = Function.prototype, - M = Object.prototype, - x = p["__core-js_shared__"], - C = z.toString, - F = M.hasOwnProperty, - U = (w = /[^.]+$/.exec(x && x.keys && x.keys.IE_PROTO || "")) ? "Symbol(src)_1." + w : "", - S = M.toString, - I = C.call(Object), - P = RegExp("^" + C.call(F).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace( - /hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), - T = d ? p.Buffer : void 0, - q = p.Symbol, - E = p.Uint8Array, - $ = T ? T.allocUnsafe : void 0, - D = (O = Object.getPrototypeOf, m = Object, function(t) { - return O(m(t)) - }), - k = Object.create, - B = M.propertyIsEnumerable, - N = A.splice, - L = q ? q.toStringTag : void 0, - R = function() { - try { - var t = vt(Object, "defineProperty"); - return t({}, "", {}), t - } catch (t) {} - }(), - G = T ? T.isBuffer : void 0, - V = Math.max, - W = Date.now, - H = vt(p, "Map"), - J = vt(Object, "create"), - K = function() { - function t() {} - return function(r) { - if (!xt(r)) return {}; - if (k) return k(r); - t.prototype = r; - var e = new t; - return t.prototype = void 0, e - } - }(); - - function Q(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function X(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function Y(t) { - var r = -1, - e = null == t ? 0 : t.length; - for (this.clear(); ++r < e;) { - var n = t[r]; - this.set(n[0], n[1]) - } - } - - function Z(t) { - var r = this.__data__ = new X(t); - this.size = r.size - } - - function tt(t, r) { - var e = Ot(t), - n = !e && wt(t), - o = !e && !n && At(t), - i = !e && !n && !o && Ft(t), - u = e || n || o || i, - c = u ? function(t, r) { - for (var e = -1, n = Array(t); ++e < t;) n[e] = r(e); - return n - }(t.length, String) : [], - a = c.length; - for (var f in t) !r && !F.call(t, f) || u && ("length" == f || o && ("offset" == f || "parent" == - f) || i && ("buffer" == f || "byteLength" == f || "byteOffset" == f) || dt(f, a)) || c.push( - f); - return c - } - - function rt(t, r, e) { - (void 0 !== e && !jt(t[r], e) || void 0 === e && !(r in t)) && ot(t, r, e) - } - - function et(t, r, e) { - var n = t[r]; - F.call(t, r) && jt(n, e) && (void 0 !== e || r in t) || ot(t, r, e) - } - - function nt(t, r) { - for (var e = t.length; e--;) - if (jt(t[e][0], r)) return e; - return -1 - } - - function ot(t, r, e) { - "__proto__" == r && R ? R(t, r, { - configurable: !0, - enumerable: !0, - value: e, - writable: !0 - }) : t[r] = e - } - Q.prototype.clear = function() { - this.__data__ = J ? J(null) : {}, this.size = 0 - }, Q.prototype.delete = function(t) { - var r = this.has(t) && delete this.__data__[t]; - return this.size -= r ? 1 : 0, r - }, Q.prototype.get = function(t) { - var r = this.__data__; - if (J) { - var n = r[t]; - return n === e ? void 0 : n - } - return F.call(r, t) ? r[t] : void 0 - }, Q.prototype.has = function(t) { - var r = this.__data__; - return J ? void 0 !== r[t] : F.call(r, t) - }, Q.prototype.set = function(t, r) { - var n = this.__data__; - return this.size += this.has(t) ? 0 : 1, n[t] = J && void 0 === r ? e : r, this - }, X.prototype.clear = function() { - this.__data__ = [], this.size = 0 - }, X.prototype.delete = function(t) { - var r = this.__data__, - e = nt(r, t); - return !(e < 0) && (e == r.length - 1 ? r.pop() : N.call(r, e, 1), --this.size, !0) - }, X.prototype.get = function(t) { - var r = this.__data__, - e = nt(r, t); - return e < 0 ? void 0 : r[e][1] - }, X.prototype.has = function(t) { - return nt(this.__data__, t) > -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;t -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;t -1 - }, X.prototype.set = function(t, r) { - var e = this.__data__, - n = nt(e, t); - return n < 0 ? (++this.size, e.push([t, r])) : e[n][1] = r, this - }, Y.prototype.clear = function() { - this.size = 0, this.__data__ = { - hash: new Q, - map: new(H || X), - string: new Q - } - }, Y.prototype.delete = function(t) { - var r = _t(this, t).delete(t); - return this.size -= r ? 1 : 0, r - }, Y.prototype.get = function(t) { - return _t(this, t).get(t) - }, Y.prototype.has = function(t) { - return _t(this, t).has(t) - }, Y.prototype.set = function(t, r) { - var e = _t(this, t), - n = e.size; - return e.set(t, r), this.size += e.size == n ? 0 : 1, this - }, Z.prototype.clear = function() { - this.__data__ = new X, this.size = 0 - }, Z.prototype.delete = function(t) { - var r = this.__data__, - e = r.delete(t); - return this.size = r.size, e - }, Z.prototype.get = function(t) { - return this.__data__.get(t) - }, Z.prototype.has = function(t) { - return this.__data__.has(t) - }, Z.prototype.set = function(t, r) { - var e = this.__data__; - if (e instanceof X) { - var n = e.__data__; - if (!H || n.length < 199) return n.push([t, r]), this.size = ++e.size, this; - e = this.__data__ = new Y(n) - } - return e.set(t, r), this.size = e.size, this - }; - var it, ut = function(t, r, e) { - for (var n = -1, o = Object(t), i = e(t), u = i.length; u--;) { - var c = i[it ? u : ++n]; - if (!1 === r(o[c], c, o)) break - } - return t - }; - - function ct(t) { - return null == t ? void 0 === t ? "[object Undefined]" : "[object Null]" : L && L in Object(t) ? - function(t) { - var r = F.call(t, L), - e = t[L]; - try { - t[L] = void 0; - var n = !0 - } catch (t) {} - var o = S.call(t); - n && (r ? t[L] = e : delete t[L]); - return o - }(t) : function(t) { - return S.call(t) - }(t) - } - - function at(t) { - return Ct(t) && ct(t) == o - } - - function ft(t) { - return !(!xt(t) || function(t) { - return !!U && U in t - }(t)) && (zt(t) ? P : a).test(function(t) { - if (null != t) { - try { - return C.call(t) - } catch (t) {} - try { - return t + "" - } catch (t) {} - } - return "" - }(t)) - } - - function st(t) { - if (!xt(t)) return function(t) { - var r = []; - if (null != t) - for (var e in Object(t)) r.push(e); - return r - }(t); - var r = yt(t), - e = []; - for (var n in t)("constructor" != n || !r && F.call(t, n)) && e.push(n); - return e - } - - function lt(t, r, e, n, o) { - t !== r && ut(r, (function(i, u) { - if (o || (o = new Z), xt(i)) ! function(t, r, e, n, o, i, u) { - var a = gt(t, e), - f = gt(r, e), - s = u.get(f); - if (s) return void rt(t, e, s); - var l = i ? i(a, f, e + "", t, r, u) : void 0, - h = void 0 === l; - if (h) { - var p = Ot(f), - _ = !p && At(f), - v = !p && !_ && Ft(f); - l = f, p || _ || v ? Ot(a) ? l = a : Ct(j = a) && mt(j) ? l = function( - t, r) { - var e = -1, - n = t.length; - r || (r = Array(n)); - for (; ++e < n;) r[e] = t[e]; - return r - }(a) : _ ? (h = !1, l = function(t, r) { - if (r) return t.slice(); - var e = t.length, - n = $ ? $(e) : new t.constructor(e); - return t.copy(n), n - }(f, !0)) : v ? (h = !1, d = f, y = !0 ? (g = d.buffer, b = new g - .constructor(g.byteLength), new E(b).set(new E(g)), b) : d - .buffer, l = new d.constructor(y, d.byteOffset, d.length)) : - l = [] : function(t) { - if (!Ct(t) || ct(t) != c) return !1; - var r = D(t); - if (null === r) return !0; - var e = F.call(r, "constructor") && r.constructor; - return "function" == typeof e && e instanceof e && C.call(e) == - I - }(f) || wt(f) ? (l = a, wt(a) ? l = function(t) { - return function(t, r, e, n) { - var o = !e; - e || (e = {}); - var i = -1, - u = r.length; - for (; ++i < u;) { - var c = r[i], - a = n ? n(e[c], t[c], c, e, t) : void 0; - void 0 === a && (a = t[c]), o ? ot(e, c, a) : - et(e, c, a) - } - return e - }(t, Ut(t)) - }(a) : xt(a) && !zt(a) || (l = function(t) { - return "function" != typeof t.constructor || yt(t) ? - {} : K(D(t)) - }(f))) : h = !1 - } - var d, y, g, b; - var j; - h && (u.set(f, l), o(l, f, n, i, u), u.delete(f)); - rt(t, e, l) - }(t, r, u, e, lt, n, o); - else { - var a = n ? n(gt(t, u), i, u + "", t, r, o) : void 0; - void 0 === a && (a = i), rt(t, u, a) - } - }), Ut) - } - - function ht(t, r) { - return bt(function(t, r, e) { - return r = V(void 0 === r ? t.length - 1 : r, 0), - function() { - for (var n = arguments, o = -1, i = V(n.length - r, 0), u = Array(i); ++o < i;) - u[o] = n[r + o]; - o = -1; - for (var c = Array(r + 1); ++o < r;) c[o] = n[o]; - return c[r] = e(u), j(t, this, c) - } - }(t, r, Pt), t + "") - } - var pt = R ? function(t, r) { - return R(t, "toString", { - configurable: !0, - enumerable: !1, - value: (e = r, function() { - return e - }), - writable: !0 - }); - var e - } : Pt; - - function _t(t, r) { - var e, n, o = t.__data__; - return ("string" == (n = typeof(e = r)) || "number" == n || "symbol" == n || "boolean" == n ? - "__proto__" !== e : null === e) ? o["string" == typeof r ? "string" : "hash"] : o.map - } - - function vt(t, r) { - var e = function(t, r) { - return null == t ? void 0 : t[r] - }(t, r); - return ft(e) ? e : void 0 - } - - function dt(t, r) { - var e = typeof t; - return !!(r = null == r ? n : r) && ("number" == e || "symbol" != e && f.test(t)) && t > -1 && t % - 1 == 0 && t < r - } - - function yt(t) { - var r = t && t.constructor; - return t === ("function" == typeof r && r.prototype || M) - } - - function gt(t, r) { - if (("constructor" !== r || "function" != typeof t[r]) && "__proto__" != r) return t[r] - } - var bt = function(t) { - var r = 0, - e = 0; - return function() { - var n = W(), - o = 16 - (n - e); - if (e = n, o > 0) { - if (++r >= 800) return arguments[0] - } else r = 0; - return t.apply(void 0, arguments) - } - }(pt); - - function jt(t, r) { - return t === r || t != t && r != r - } - var wt = at(function() { - return arguments - }()) ? at : function(t) { - return Ct(t) && F.call(t, "callee") && !B.call(t, "callee") - }, - Ot = Array.isArray; - - function mt(t) { - return null != t && Mt(t.length) && !zt(t) - } - var At = G || function() { - return !1 - }; - - function zt(t) { - if (!xt(t)) return !1; - var r = ct(t); - return r == u || "[object GeneratorFunction]" == r || "[object AsyncFunction]" == r || - "[object Proxy]" == r - } - - function Mt(t) { - return "number" == typeof t && t > -1 && t % 1 == 0 && t <= n - } - - function xt(t) { - var r = typeof t; - return null != t && ("object" == r || "function" == r) - } - - function Ct(t) { - return null != t && "object" == typeof t - } - var Ft = b ? function(t) { - return function(r) { - return t(r) - } - }(b) : function(t) { - return Ct(t) && Mt(t.length) && !!s[ct(t)] - }; - - function Ut(t) { - return mt(t) ? tt(t, !0) : st(t) - } - var St, It = (St = function(t, r, e) { - lt(t, r, e) - }, ht((function(t, r) { - var e = -1, - n = r.length, - o = n > 1 ? r[n - 1] : void 0, - i = n > 2 ? r[2] : void 0; - for (o = St.length > 3 && "function" == typeof o ? (n--, o) : void 0, i && function( - t, r, e) { - if (!xt(e)) return !1; - var n = typeof r; - return !!("number" == n ? mt(e) && dt(r, e.length) : "string" == n && r in - e) && jt(e[r], t) - }(r[0], r[1], i) && (o = n < 3 ? void 0 : o, n = 1), t = Object(t); ++e < n;) { - var u = r[e]; - u && St(t, u, e, o) - } - return t - }))); - - function Pt(t) { - return t - } - t.exports = It -})); -const c = Object.prototype.hasOwnProperty, - a = (t, r) => c.call(t, r); -class f { - constructor({ - pluginId: t, - defaultConfig: r = {}, - customMerge: e, - root: n - }) { - this.pluginId = t, this.defaultConfig = r, this.pluginConfigPath = o.default.resolve(n || __dirname, t), - this.customMerge = e, this._config = void 0 - } - resolve(t) { - return o.default.resolve(this.pluginConfigPath, t) - } - hasFile(t) { - return n.default.existsSync(this.resolve(t)) - } - requireFile(t) { - try { - return require(this.resolve(t)) - } catch (t) { - if ("MODULE_NOT_FOUND" === t.code) return; - throw t - } - } - _getUserConfig() { - return this.requireFile("config.json") - } - config(t, r) { - if (!this._config) { - const t = this._getUserConfig(); - this._config = Array.isArray(t) ? t : (this.customMerge || u)(this.defaultConfig, t) - } - let e = this._config; - return t ? function(t, r, e) { - if ("number" == typeof r) return t[r]; - if ("symbol" == typeof r) return a(t, r) ? t[r] : e; - const n = "string" != typeof(o = r) ? o : o.split(".").reduce(((t, r) => (r.split(/\[([^}]+)\]/g) - .forEach((r => r && t.push(r))), t)), []); - var o; - let i = t; - for (let t = 0; t < n.length; t++) { - const r = n[t]; - if (!a(i, r)) return e; - i = i[r] - } - return i - }(e, t, r) : e - } -} -const s = new class { - constructor() { - this._configMap = new Map - } - plugin({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n = __dirname, - cache: o = !0 - }) { - if (this._configMap.has(t) && o) return this._configMap.get(t); - const i = new f({ - pluginId: t, - defaultConfig: r, - customMerge: e, - root: n - }); - return o && this._configMap.set(t, i), i - } -}; -var l = s.plugin.bind(s); -module.exports = l; \ No newline at end of file +"use strict";var t=require("fs"),r=require("path");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t),o=e(r),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var u=function(t){var r={exports:{}};return t(r,r.exports),r.exports}((function(t,r){var e="__lodash_hash_undefined__",n=9007199254740991,o="[object Arguments]",u="[object Function]",c="[object Object]",a=/^\[object .+?Constructor\]$/,f=/^(?:0|[1-9]\d*)$/,s={};s["[object Float32Array]"]=s["[object Float64Array]"]=s["[object Int8Array]"]=s["[object Int16Array]"]=s["[object Int32Array]"]=s["[object Uint8Array]"]=s["[object Uint8ClampedArray]"]=s["[object Uint16Array]"]=s["[object Uint32Array]"]=!0,s[o]=s["[object Array]"]=s["[object ArrayBuffer]"]=s["[object Boolean]"]=s["[object DataView]"]=s["[object Date]"]=s["[object Error]"]=s[u]=s["[object Map]"]=s["[object Number]"]=s[c]=s["[object RegExp]"]=s["[object Set]"]=s["[object String]"]=s["[object WeakMap]"]=!1;var l="object"==typeof i&&i&&i.Object===Object&&i,h="object"==typeof self&&self&&self.Object===Object&&self,p=l||h||Function("return this")(),_=r&&!r.nodeType&&r,v=_&&t&&!t.nodeType&&t,d=v&&v.exports===_,y=d&&l.process,g=function(){try{var t=v&&v.require&&v.require("util").types;return t||y&&y.binding&&y.binding("util")}catch(t){}}(),b=g&&g.isTypedArray;function j(t,r,e){switch(e.length){case 0:return t.call(r);case 1:return t.call(r,e[0]);case 2:return t.call(r,e[0],e[1]);case 3:return t.call(r,e[0],e[1],e[2])}return t.apply(r,e)}var w,O,m,A=Array.prototype,z=Function.prototype,M=Object.prototype,x=p["__core-js_shared__"],C=z.toString,F=M.hasOwnProperty,U=(w=/[^.]+$/.exec(x&&x.keys&&x.keys.IE_PROTO||""))?"Symbol(src)_1."+w:"",S=M.toString,I=C.call(Object),P=RegExp("^"+C.call(F).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),T=d?p.Buffer:void 0,q=p.Symbol,E=p.Uint8Array,$=T?T.allocUnsafe:void 0,D=(O=Object.getPrototypeOf,m=Object,function(t){return O(m(t))}),k=Object.create,B=M.propertyIsEnumerable,N=A.splice,L=q?q.toStringTag:void 0,R=function(){try{var t=vt(Object,"defineProperty");return t({},"",{}),t}catch(t){}}(),G=T?T.isBuffer:void 0,V=Math.max,W=Date.now,H=vt(p,"Map"),J=vt(Object,"create"),K=function(){function t(){}return function(r){if(!xt(r))return{};if(k)return k(r);t.prototype=r;var e=new t;return t.prototype=void 0,e}}();function Q(t){var r=-1,e=null==t?0:t.length;for(this.clear();++r-1},X.prototype.set=function(t,r){var e=this.__data__,n=nt(e,t);return n<0?(++this.size,e.push([t,r])):e[n][1]=r,this},Y.prototype.clear=function(){this.size=0,this.__data__={hash:new Q,map:new(H||X),string:new Q}},Y.prototype.delete=function(t){var r=_t(this,t).delete(t);return this.size-=r?1:0,r},Y.prototype.get=function(t){return _t(this,t).get(t)},Y.prototype.has=function(t){return _t(this,t).has(t)},Y.prototype.set=function(t,r){var e=_t(this,t),n=e.size;return e.set(t,r),this.size+=e.size==n?0:1,this},Z.prototype.clear=function(){this.__data__=new X,this.size=0},Z.prototype.delete=function(t){var r=this.__data__,e=r.delete(t);return this.size=r.size,e},Z.prototype.get=function(t){return this.__data__.get(t)},Z.prototype.has=function(t){return this.__data__.has(t)},Z.prototype.set=function(t,r){var e=this.__data__;if(e instanceof X){var n=e.__data__;if(!H||n.length<199)return n.push([t,r]),this.size=++e.size,this;e=this.__data__=new Y(n)}return e.set(t,r),this.size=e.size,this};var it,ut=function(t,r,e){for(var n=-1,o=Object(t),i=e(t),u=i.length;u--;){var c=i[it?u:++n];if(!1===r(o[c],c,o))break}return t};function ct(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":L&&L in Object(t)?function(t){var r=F.call(t,L),e=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=S.call(t);n&&(r?t[L]=e:delete t[L]);return o}(t):function(t){return S.call(t)}(t)}function at(t){return Ct(t)&&ct(t)==o}function ft(t){return!(!xt(t)||function(t){return!!U&&U in t}(t))&&(zt(t)?P:a).test(function(t){if(null!=t){try{return C.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}function st(t){if(!xt(t))return function(t){var r=[];if(null!=t)for(var e in Object(t))r.push(e);return r}(t);var r=yt(t),e=[];for(var n in t)("constructor"!=n||!r&&F.call(t,n))&&e.push(n);return e}function lt(t,r,e,n,o){t!==r&&ut(r,(function(i,u){if(o||(o=new Z),xt(i))!function(t,r,e,n,o,i,u){var a=gt(t,e),f=gt(r,e),s=u.get(f);if(s)return void rt(t,e,s);var l=i?i(a,f,e+"",t,r,u):void 0,h=void 0===l;if(h){var p=Ot(f),_=!p&&At(f),v=!p&&!_&&Ft(f);l=f,p||_||v?Ot(a)?l=a:Ct(j=a)&&mt(j)?l=function(t,r){var e=-1,n=t.length;r||(r=Array(n));for(;++e-1&&t%1==0&&t0){if(++r>=800)return arguments[0]}else r=0;return t.apply(void 0,arguments)}}(pt);function jt(t,r){return t===r||t!=t&&r!=r}var wt=at(function(){return arguments}())?at:function(t){return Ct(t)&&F.call(t,"callee")&&!B.call(t,"callee")},Ot=Array.isArray;function mt(t){return null!=t&&Mt(t.length)&&!zt(t)}var At=G||function(){return!1};function zt(t){if(!xt(t))return!1;var r=ct(t);return r==u||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}function Mt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}function xt(t){var r=typeof t;return null!=t&&("object"==r||"function"==r)}function Ct(t){return null!=t&&"object"==typeof t}var Ft=b?function(t){return function(r){return t(r)}}(b):function(t){return Ct(t)&&Mt(t.length)&&!!s[ct(t)]};function Ut(t){return mt(t)?tt(t,!0):st(t)}var St,It=(St=function(t,r,e){lt(t,r,e)},ht((function(t,r){var e=-1,n=r.length,o=n>1?r[n-1]:void 0,i=n>2?r[2]:void 0;for(o=St.length>3&&"function"==typeof o?(n--,o):void 0,i&&function(t,r,e){if(!xt(e))return!1;var n=typeof r;return!!("number"==n?mt(e)&&dt(r,e.length):"string"==n&&r in e)&&jt(e[r],t)}(r[0],r[1],i)&&(o=n<3?void 0:o,n=1),t=Object(t);++ec.call(t,r);class f{constructor({pluginId:t,defaultConfig:r={},customMerge:e,root:n}){this.pluginId=t,this.defaultConfig=r,this.pluginConfigPath=o.default.resolve(n||__dirname,t),this.customMerge=e,this._config=void 0}resolve(t){return o.default.resolve(this.pluginConfigPath,t)}hasFile(t){return n.default.existsSync(this.resolve(t))}requireFile(t){try{return require(this.resolve(t))}catch(t){if("MODULE_NOT_FOUND"===t.code)return;throw t}}_getUserConfig(){return this.requireFile("config.json")}config(t,r){if(!this._config){const t=this._getUserConfig();this._config=Array.isArray(t)?t:(this.customMerge||u)(this.defaultConfig,t)}let e=this._config;return t?function(t,r,e){if("number"==typeof r)return t[r];if("symbol"==typeof r)return a(t,r)?t[r]:e;const n="string"!=typeof(o=r)?o:o.split(".").reduce(((t,r)=>(r.split(/\[([^}]+)\]/g).forEach((r=>r&&t.push(r))),t)),[]);var o;let i=t;for(let t=0;t item.value == formData + let textObj = { + "ALL": "所有用户", + "user_id": "用户ID", + "custom_tag": "用户标签", + "cid": "推送设备标识" + } + callback(textObj[data.audience_type] + '不能为空') + return false + } + } + }, + { + "range": [{ + "text": "所有用户", + "value": "ALL" + }, + { + "text": "用户ID", + "value": "user_id" + }, + { + "text": "用户标签", + "value": "custom_tag" + }, + { + "text": "推送设备标识", + "value": "cid" + } + ] + } + ], + "label": "目标用户" + }, + "audience_value": { + "rules": [{ + "required": false + }, + { + "format": "string" + }, + { + "maxLength": 99 + } + ] + }, + "url": { + "rules": [{ + "required": true + }, + { + "format": "url" + } + ], + "label": "url链接,华为平台必须使用https" + }, + "title": { + "rules": [{ + "format": "string" + }, + { + "required": true + }, + { + "maxLength": 32 + } + ], + "label": "标题" + }, + "content": { + "rules": [{ + "required": true + }, + { + "format": "string" + }, + { + "maxLength": 32 + } + ], + "label": "副标题" + }, + "click_type": { + "rules": [{ + "required": true + }, + { + "format": "string" + }, + { + "range": [{ + "text": "透传参数并唤醒APP", + "value": "intent" + }, + { + "text": "使用浏览器打开链接", + "value": "open_url" + } + ] + } + ], + "label": "点击通知后" + }, + "payload": { + "rules": [{ + "required": true + }, { + "format": "string" + }, + { + validateFunction: function(rule, value, data, callback) { + console.log(value); + if (!value) { + callback('非APP端,透传内容不能为空') + } + } + } + ], + "label": "透传内容" + }, + "badge": { + "rules": [{ + "format": "number" + }], + "label": "角标" + }, + "channel": { + "rules": [{ + "format": "string" + }], + "label": "消息渠道channel_id" + }, + "sound": { + "rules": [{ + "format": "string" + }], + "label": "铃声设置" + }, + "content-available": { + "rules": [{ + "format": "bool" + }], + "label": "是否为静默消息(仅ios有效)" + }, + "force_notification": { + "rules": [{ + "format": "bool" + }], + "label": "强制通知栏消息" + }, +} + +export { + validator +} diff --git a/alpha/admin/uni_modules/uni-push-admin/js_sdk/validator/uni-push-log.js b/alpha/admin/uni_modules/uni-push-admin/js_sdk/validator/uni-push-log.js new file mode 100644 index 0000000..3d6cb6c --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/js_sdk/validator/uni-push-log.js @@ -0,0 +1,217 @@ +// 表单校验规则由 schema2code 生成,不建议直接修改校验规则,而建议通过 schema2code 生成, 详情: https://uniapp.dcloud.net.cn/uniCloud/schema + + +const validator = { + "title": { + "rules": [], + "label": "通知标题" + }, + "subtitle": { + "rules": [], + "label": "副标题" + }, + "audience_type": { + "rules": [{ + "format": "string" + }, + { + "range": [{ + "text": "所有用户", + "value": "ALL" + }, + { + "text": "指定用户ID", + "value": "user_id" + }, + { + "text": "指定用户标签", + "value": "custom_tag" + }, + { + "text": "客户端标识", + "value": "cid" + } + ] + } + ], + "label": "目标用户" + }, + "audience_value": { + "rules": [], + "label": "目标用户标识" + }, + "platform": { + "rules": [{ + "format": "array" + }, + { + "range": [{ + "text": "小程序和H5", + "value": "web" + }, + { + "text": "iOS", + "value": "ios" + }, + { + "text": "Android", + "value": "android" + } + ] + } + ], + "label": "目标平台" + }, + "state": { + "rules": [], + "label": "推送状态" + }, + "channel": { + "rules": [], + "label": "渠道id" + }, + "url": { + "rules": [{ + "format": "url" + }], + "label": "点击打开链接" + }, + "payload": { + "rules": [], + "label": "消息内容" + }, + "badge": { + "rules": [], + "label": "角标值" + }, + "sound": { + "rules": [{ + "format": "string" + }], + "label": "铃声文件名" + }, + "content_available": { + "rules": [], + "label": "消息类型(仅iOS支持)" + }, + "appid": { + "rules": [{ + "format": "string" + }], + "label": "应用的id" + }, + "taskid": { + "rules": [{ + "format": "string" + }], + "label": "任务id" + }, + "msg_num": { + "rules": [{ + "format": "int" + }], + "label": "消息可下发数" + }, + "target_num": { + "rules": [{ + "format": "int" + }], + "label": "消息下发数" + }, + "receive_num": { + "rules": [{ + "format": "int" + }], + "label": "消息接收数" + }, + "display_num": { + "rules": [{ + "format": "int" + }], + "label": "消息展示数" + }, + "click_num": { + "rules": [{ + "format": "int" + }], + "label": "消息点击数" + } +} + +const enumConverter = { + "audience_type_valuetotext": { + "ALL": "所有用户", + "user_id": "用户ID", + "user_tag": "用户标签", + "device_id": "设备id", + "push_clientid": "个推客户端id", + "getui_custom_tag": "个推自定义客户端标签" + }, + "platform_valuetotext": [{ + "text": "小程序和H5", + "value": "web" + }, + { + "text": "iOS", + "value": "ios" + }, + { + "text": "Android", + "value": "android" + } + ] +} + +function filterToWhere(filter, command) { + let where = {} + for (let field in filter) { + let { + type, + value + } = filter[field] + switch (type) { + case "search": + if (typeof value === 'string' && value.length) { + where[field] = new RegExp(value) + } + break; + case "select": + if (value.length) { + let selectValue = [] + for (let s of value) { + selectValue.push(command.eq(s)) + } + where[field] = command.or(selectValue) + } + break; + case "range": + if (value.length) { + let gt = value[0] + let lt = value[1] + where[field] = command.and([command.gte(gt), command.lte(lt)]) + } + break; + case "date": + if (value.length) { + let [s, e] = value + let startDate = new Date(s) + let endDate = new Date(e) + where[field] = command.and([command.gte(startDate), command.lte(endDate)]) + } + break; + case "timestamp": + if (value.length) { + let [startDate, endDate] = value + where[field] = command.and([command.gte(startDate), command.lte(endDate)]) + } + break; + } + } + return where +} + +export { + validator, + enumConverter, + filterToWhere +} diff --git a/alpha/admin/uni_modules/uni-push-admin/menu.json b/alpha/admin/uni_modules/uni-push-admin/menu.json new file mode 100644 index 0000000..bd4bb87 --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/menu.json @@ -0,0 +1,36 @@ +[{ + "menu_id": "uni-push-admin", + "name": "推送管理", + "icon": "uni-icons-paperplane", + "sort": 4000, + "parent_id": "", + "permission": [], + "enable": true +},{ + "menu_id": "uni-push-send", + "name": "消息推送", + "icon": "uni-icons-chat-filled", + "url": "/uni_modules/uni-push-admin/pages/sendMessage/sendMessage", + "sort": 4010, + "parent_id": "uni-push-admin", + "permission": [], + "enable": true +},{ + "menu_id": "uni-push-log", + "name": "推送统计", + "icon": "admin-icons-tongji", + "url": "/uni_modules/uni-push-admin/pages/log/list", + "sort": 4010, + "parent_id": "uni-push-admin", + "permission": [], + "enable": true +},{ + "menu_id": "uni-push-extra", + "name": "其他功能", + "icon": "uni-icons-more-filled", + "url": "/uni_modules/uni-push-admin/pages/extra/extra", + "sort": 4010, + "parent_id": "uni-push-admin", + "permission": [], + "enable": true +}] \ No newline at end of file diff --git a/alpha/admin/uni_modules/uni-push-admin/package.json b/alpha/admin/uni_modules/uni-push-admin/package.json new file mode 100644 index 0000000..e663063 --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-push-admin", + "displayName": "uni-push-admin", + "version": "1.0.8", + "description": "管理员端云端一体统一推送服务控制台", + "keywords": [ + "uni-push-admin" +], + "repository": "", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "uniCloud", + "Admin插件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [ + "uni-id-common" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "y", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/alpha/admin/uni_modules/uni-push-admin/pages/extra/extra.vue b/alpha/admin/uni_modules/uni-push-admin/pages/extra/extra.vue new file mode 100644 index 0000000..450180e --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/pages/extra/extra.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/alpha/admin/uni_modules/uni-push-admin/pages/log/detail.vue b/alpha/admin/uni_modules/uni-push-admin/pages/log/detail.vue new file mode 100644 index 0000000..8561b9e --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/pages/log/detail.vue @@ -0,0 +1,326 @@ + + + + + diff --git a/alpha/admin/uni_modules/uni-push-admin/pages/log/list.vue b/alpha/admin/uni_modules/uni-push-admin/pages/log/list.vue new file mode 100644 index 0000000..4ff131c --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/pages/log/list.vue @@ -0,0 +1,404 @@ + + + + + diff --git a/alpha/admin/uni_modules/uni-push-admin/pages/sendMessage/sendMessage.vue b/alpha/admin/uni_modules/uni-push-admin/pages/sendMessage/sendMessage.vue new file mode 100644 index 0000000..80d3829 --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/pages/sendMessage/sendMessage.vue @@ -0,0 +1,782 @@ + + + + + diff --git a/alpha/admin/uni_modules/uni-push-admin/readme.md b/alpha/admin/uni_modules/uni-push-admin/readme.md new file mode 100644 index 0000000..063a3e7 --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/readme.md @@ -0,0 +1,66 @@ +# 文档已移至uni-push文档[https://uniapp.dcloud.io/uniCloud/uni-push/introduction.html](https://uniapp.dcloud.io/uniCloud/uni-push/introduction.html) + +关于插件更新的说明: + +所有uni_modules,在HBuilderX里点右键都可以直接升级。或者在插件市场导入覆盖。 + +覆盖时HBuilderX会弹出代码差异比对,可以决定接受哪些更改、拒绝哪些更改。 + +当拒绝局部修改时,注意可能产生兼容性问题。 + + + +### 安装指南: +在插件市场打开本插件页面,在右侧点击`使用 HBuilderX 导入插件`,选择你的 `uniCloud admin` 项目点击确定 + +1. 等待下载安装完毕。由于本插件依赖一些插件,下载完成后会显示合并插件页面,自行选择即可 + +2. 找到`/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/index.obj.js`,右键上传DB Schema。如果你在部署客户端时已经上传本步骤可跳过 + +3. 找到`/uni_modules/uni-push-admin/pages_init.json`,手动复制以下内容,添加到项目的 `pages.json` 文件 `pages` 节点 + +```js +{ + "path": "uni_modules/uni-push-admin/pages/extra/extra", + "style": { + "navigationBarTitleText": "push-admin" + /* #ifndef H5 */ + ,"navigationStyle": "default" + /* #endif */ + } +}, { + "path": "uni_modules/uni-push-admin/pages/log/list", + "style": { + "navigationBarTitleText": "推送记录" + /* #ifndef H5 */ + ,"navigationStyle": "default" + /* #endif */ + } +}, { + "path": "uni_modules/uni-push-admin/pages/log/detail", + "style": { + "navigationBarTitleText": "推送详情", + "navigationStyle": "default" + } +}, { + "path": "uni_modules/uni-push-admin/pages/sendMessage/sendMessage", + "style": { + "navigationBarTitleText": "消息推送" + /* #ifndef H5 */ + ,"navigationStyle": "default" + /* #endif */ + } +} +``` + + + +4. 运行项目到`Chrome`(注意:连接云端云函数) + +5. 运行起来uniCloud admin,菜单管理模块会自动读取`/uni_modules/uni-push-admin/pages_init.json`文件中的菜单配置,生成【待添加菜单】,选中`推送管理`、`消息推送`、`推送统计`、`其他功能`,点击`添加选中的菜单`即可 + +
+ +
+ +5. 添加成功后,就可以在左侧的菜单栏中找到`推送管理`菜单 \ No newline at end of file diff --git a/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/index.obj.js b/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/index.obj.js new file mode 100644 index 0000000..bb7eb16 --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/index.obj.js @@ -0,0 +1,61 @@ +// 开发文档: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj +function uniPush(appId) { + return uniCloud.getPushManager({appId}) +} +const uniID = require('uni-id-common') +module.exports = { + _before: async function() { + const clientInfo = this.getClientInfo() + this.uniID = uniID.createInstance({ + clientInfo + }) + const token = this.getUniIdToken() + let payload = await this.uniID.checkToken(token) + let role = payload.role||[] + //检查是不是管理员,或者自己的云函数调用此云函数 + if(clientInfo.source != 'server' && !role.includes('admin')){ + return { + errCode: 'uni-push-co-permission-denied', + errMsg: '你没有访问此接口权限' + } + } + }, + async sendMessage(data) { + const appId = data.appId + data.must_report = true //默认为false,消息接受者为单设备时,不统计推送结果。开启此项将都会统计。但整体推送速度会慢100-500毫秒 + // delete data.appId + let res = await uniPush(appId).sendMessage(data) + if (res.errCode == 0 && res.before_id) { + const UniPushCo = uniCloud.importObject("uni-push-co") + data.before_id = res.before_id //查询的初始id,用于高性能分页查询 + data.taskid = res.data.taskid || Object.keys(res.data)[0] + + UniPushCo.sendMessage(data).catch(e=>{ + // console.log(e.message); + }) + // 等待500毫秒给下一个请求发出去的时间 + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(res) + }, 500) + }) + } + return res + }, + async getReport({ + appId, + taskid + }) { + let res = await uniPush(appId).getReport({ + taskid + }) + //获取推送结果 + console.log(JSON.stringify(res)); + return res + }, + async getAdminUrl(appId) { + let res = await uniPush(appId).getAdminUrl() //获取推送结果 + console.log(JSON.stringify(res)); + return res + } +} diff --git a/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/package.json b/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/package.json new file mode 100644 index 0000000..8699f8c --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/package.json @@ -0,0 +1,9 @@ +{ + "name": "uni-push-admin-co", + "dependencies": { + "uni-id-common": "file:../../../../uni-id-common/uniCloud/cloudfunctions/common/uni-id-common" + }, + "extensions": { + "uni-cloud-push": {} + } +} \ No newline at end of file diff --git a/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/uni-push-co.param.json b/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/uni-push-co.param.json new file mode 100644 index 0000000..6684a94 --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/uniCloud/cloudfunctions/uni-push-co/uni-push-co.param.json @@ -0,0 +1,4 @@ +{ + "method": "sendMessage", + "params": [] +} \ No newline at end of file diff --git a/alpha/admin/uni_modules/uni-push-admin/uniCloud/database/opendb-tempdata.schema.json b/alpha/admin/uni_modules/uni-push-admin/uniCloud/database/opendb-tempdata.schema.json new file mode 100644 index 0000000..1cff7f5 --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/uniCloud/database/opendb-tempdata.schema.json @@ -0,0 +1,26 @@ +{ + "bsonType": "object", + "permission": { + "create": false, + "delete": false, + "read": false, + "update": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "expired": { + "bsonType": "timestamp", + "description": "过期时间" + }, + "value": { + "description": "值" + } + }, + "required": [ + "value", + "expired" + ], + "version": "0.0.1" +} \ No newline at end of file diff --git a/alpha/admin/uni_modules/uni-push-admin/uniCloud/database/uni-push-log.schema.json b/alpha/admin/uni_modules/uni-push-admin/uniCloud/database/uni-push-log.schema.json new file mode 100644 index 0000000..af7503b --- /dev/null +++ b/alpha/admin/uni_modules/uni-push-admin/uniCloud/database/uni-push-log.schema.json @@ -0,0 +1,171 @@ +// 文档教程: https://uniapp.dcloud.net.cn/uniCloud/schema +{ + "bsonType": "object", + "required": [], + "permission": { + "read": false, + "create": false, + "update": false, + "delete": false + }, + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "operator_id":{ + "label": "操作者id", + "description": "记录由哪个用户操作消息推送", + "foreignKey": "uni-id-users._id", + "forceDefaultValue":{ + "$env": "uid" + } + }, + "title": { + "label": "APP通知栏标题" + }, + "content": { + "label": "APP通知栏内容" + }, + "creat_time": { + "label": "创建推送时间", + "forceDefaultValue": { + "$env": "now" + }, + "bsonType": "timestamp" + }, + "audience_type": { + "label": "消息接受者类型", + "bsonType": "string", + "enum": [{ + "text": "所有用户", + "value": "ALL" + }, + { + "text": "用户id", + "value": "user_id" + }, { + "text": "用户标签", + "value": "user_tag" + }, { + "text": "设备id", + "value": "device_id" + }, { + "text": "个推客户端id", + "value": "push_clientid" + }, { + "text": "个推自定义客户端标签", + "value": "getui_custom_tag" + } + ] + }, + "audience_value": { + "label": "目标用户标识", + "bsonType": "string" + }, + "platform": { + "label": "目标平台", + "enum": [{ + "text": "所有", + "value": "ALL" + }, + { + "text": "网页端", + "value": "web" + }, + { + "text": "App-iOS", + "value": "app-ios" + }, + { + "text": "App-Android", + "value": "app-android" + }, + { + "text": "微信小程序", + "value": "mp-weixin" + }, + { + "text": "360小程序", + "value": "mp-360" + }, { + "text": "百度小程序", + "value": "mp-baidu" + }, + { + "text": "支付宝小程序", + "value": "mp-alipay" + }, + { + "text": "字节跳动小程序", + "value": "mp-toutiao" + }, + { + "text": "QQ小程序", + "value": "mp-qq" + }, + { + "text": "快应用联盟", + "value": "quickapp-webview-union" + }, + { + "text": "快应用华为", + "value": "quickapp-webview-huawei" + }, + { + "text": "快手小程序", + "value": "mp-kuaishou" + }, + { + "text": "飞书小程序", + "value": "mp-lark" + }, + { + "text": "京东小程序", + "value": "mp-jd" + } + ] + }, + "state": { + "label": "推送状态" + }, + "channel": { + "label": "渠道id", + "bsonType": "string" + }, + "open_url": { + "label": "点击打开链接", + "format": "url" + }, + "payload": { + "label": "消息内容" + }, + "badge": { + "label": "角标值" + }, + "sound": { + "label": "铃声文件名", + "bsonType": "string" + }, + "content_available": { + "label": "消息类型(仅iOS支持)" + }, + "force_notification": { + "label": "强制通知栏消息" + }, + "appId": { + "label": "应用的id", + "bsonType": "string" + }, + "taskid": { + "label": "任务id", + "bsonType": "string" + }, + "options": { + "label": "其他参数", + "bsonType": "object" + }, + "report": { + "bsonType": "object" + } + } +} -- GitLab