@chatbi-v/core 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -20
- package/dist/chunk-G3OU7D3Y.mjs +47 -0
- package/dist/{config-manager-YVMVSPES.mjs → config-manager-ZARQENTB.mjs} +1 -1
- package/dist/domain/plugin-manager.d.ts +9 -0
- package/dist/domain/plugin-runtime.d.ts +5 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.mjs +58 -392
- package/dist/index.plugin.js +5106 -0
- package/package.json +13 -12
- package/dist/chunk-IOE2RMEZ.mjs +0 -75
- package/dist/index.cjs +0 -2521
package/dist/index.mjs
CHANGED
|
@@ -1,359 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ConfigManager,
|
|
3
|
-
__commonJS,
|
|
4
|
-
__toESM,
|
|
5
3
|
configManager
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
|
|
8
|
-
// ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js
|
|
9
|
-
var require_dayjs_min = __commonJS({
|
|
10
|
-
"../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js"(exports, module) {
|
|
11
|
-
"use strict";
|
|
12
|
-
!(function(t, e) {
|
|
13
|
-
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
|
|
14
|
-
})(exports, (function() {
|
|
15
|
-
"use strict";
|
|
16
|
-
var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
|
|
17
|
-
var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
|
|
18
|
-
return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
|
|
19
|
-
} }, m = function(t2, e2, n2) {
|
|
20
|
-
var r2 = String(t2);
|
|
21
|
-
return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
|
|
22
|
-
}, v = { s: m, z: function(t2) {
|
|
23
|
-
var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
|
|
24
|
-
return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
|
|
25
|
-
}, m: function t2(e2, n2) {
|
|
26
|
-
if (e2.date() < n2.date()) return -t2(n2, e2);
|
|
27
|
-
var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
|
|
28
|
-
return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
|
|
29
|
-
}, a: function(t2) {
|
|
30
|
-
return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
|
|
31
|
-
}, p: function(t2) {
|
|
32
|
-
return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
|
|
33
|
-
}, u: function(t2) {
|
|
34
|
-
return void 0 === t2;
|
|
35
|
-
} }, g = "en", D = {};
|
|
36
|
-
D[g] = M;
|
|
37
|
-
var p = "$isDayjsObject", S = function(t2) {
|
|
38
|
-
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
39
|
-
}, w = function t2(e2, n2, r2) {
|
|
40
|
-
var i2;
|
|
41
|
-
if (!e2) return g;
|
|
42
|
-
if ("string" == typeof e2) {
|
|
43
|
-
var s2 = e2.toLowerCase();
|
|
44
|
-
D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
|
|
45
|
-
var u2 = e2.split("-");
|
|
46
|
-
if (!i2 && u2.length > 1) return t2(u2[0]);
|
|
47
|
-
} else {
|
|
48
|
-
var a2 = e2.name;
|
|
49
|
-
D[a2] = e2, i2 = a2;
|
|
50
|
-
}
|
|
51
|
-
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
52
|
-
}, O = function(t2, e2) {
|
|
53
|
-
if (S(t2)) return t2.clone();
|
|
54
|
-
var n2 = "object" == typeof e2 ? e2 : {};
|
|
55
|
-
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
56
|
-
}, b = v;
|
|
57
|
-
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
58
|
-
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
59
|
-
};
|
|
60
|
-
var _ = (function() {
|
|
61
|
-
function M2(t2) {
|
|
62
|
-
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
63
|
-
}
|
|
64
|
-
var m2 = M2.prototype;
|
|
65
|
-
return m2.parse = function(t2) {
|
|
66
|
-
this.$d = (function(t3) {
|
|
67
|
-
var e2 = t3.date, n2 = t3.utc;
|
|
68
|
-
if (null === e2) return /* @__PURE__ */ new Date(NaN);
|
|
69
|
-
if (b.u(e2)) return /* @__PURE__ */ new Date();
|
|
70
|
-
if (e2 instanceof Date) return new Date(e2);
|
|
71
|
-
if ("string" == typeof e2 && !/Z$/i.test(e2)) {
|
|
72
|
-
var r2 = e2.match($);
|
|
73
|
-
if (r2) {
|
|
74
|
-
var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
|
|
75
|
-
return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return new Date(e2);
|
|
79
|
-
})(t2), this.init();
|
|
80
|
-
}, m2.init = function() {
|
|
81
|
-
var t2 = this.$d;
|
|
82
|
-
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
83
|
-
}, m2.$utils = function() {
|
|
84
|
-
return b;
|
|
85
|
-
}, m2.isValid = function() {
|
|
86
|
-
return !(this.$d.toString() === l);
|
|
87
|
-
}, m2.isSame = function(t2, e2) {
|
|
88
|
-
var n2 = O(t2);
|
|
89
|
-
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
90
|
-
}, m2.isAfter = function(t2, e2) {
|
|
91
|
-
return O(t2) < this.startOf(e2);
|
|
92
|
-
}, m2.isBefore = function(t2, e2) {
|
|
93
|
-
return this.endOf(e2) < O(t2);
|
|
94
|
-
}, m2.$g = function(t2, e2, n2) {
|
|
95
|
-
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
96
|
-
}, m2.unix = function() {
|
|
97
|
-
return Math.floor(this.valueOf() / 1e3);
|
|
98
|
-
}, m2.valueOf = function() {
|
|
99
|
-
return this.$d.getTime();
|
|
100
|
-
}, m2.startOf = function(t2, e2) {
|
|
101
|
-
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
102
|
-
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
103
|
-
return r2 ? i2 : i2.endOf(a);
|
|
104
|
-
}, $2 = function(t3, e3) {
|
|
105
|
-
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
106
|
-
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
107
|
-
switch (f2) {
|
|
108
|
-
case h:
|
|
109
|
-
return r2 ? l2(1, 0) : l2(31, 11);
|
|
110
|
-
case c:
|
|
111
|
-
return r2 ? l2(1, M3) : l2(0, M3 + 1);
|
|
112
|
-
case o:
|
|
113
|
-
var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
|
|
114
|
-
return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
|
|
115
|
-
case a:
|
|
116
|
-
case d:
|
|
117
|
-
return $2(v2 + "Hours", 0);
|
|
118
|
-
case u:
|
|
119
|
-
return $2(v2 + "Minutes", 1);
|
|
120
|
-
case s:
|
|
121
|
-
return $2(v2 + "Seconds", 2);
|
|
122
|
-
case i:
|
|
123
|
-
return $2(v2 + "Milliseconds", 3);
|
|
124
|
-
default:
|
|
125
|
-
return this.clone();
|
|
126
|
-
}
|
|
127
|
-
}, m2.endOf = function(t2) {
|
|
128
|
-
return this.startOf(t2, false);
|
|
129
|
-
}, m2.$set = function(t2, e2) {
|
|
130
|
-
var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
131
|
-
if (o2 === c || o2 === h) {
|
|
132
|
-
var y2 = this.clone().set(d, 1);
|
|
133
|
-
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
134
|
-
} else l2 && this.$d[l2]($2);
|
|
135
|
-
return this.init(), this;
|
|
136
|
-
}, m2.set = function(t2, e2) {
|
|
137
|
-
return this.clone().$set(t2, e2);
|
|
138
|
-
}, m2.get = function(t2) {
|
|
139
|
-
return this[b.p(t2)]();
|
|
140
|
-
}, m2.add = function(r2, f2) {
|
|
141
|
-
var d2, l2 = this;
|
|
142
|
-
r2 = Number(r2);
|
|
143
|
-
var $2 = b.p(f2), y2 = function(t2) {
|
|
144
|
-
var e2 = O(l2);
|
|
145
|
-
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
146
|
-
};
|
|
147
|
-
if ($2 === c) return this.set(c, this.$M + r2);
|
|
148
|
-
if ($2 === h) return this.set(h, this.$y + r2);
|
|
149
|
-
if ($2 === a) return y2(1);
|
|
150
|
-
if ($2 === o) return y2(7);
|
|
151
|
-
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
152
|
-
return b.w(m3, this);
|
|
153
|
-
}, m2.subtract = function(t2, e2) {
|
|
154
|
-
return this.add(-1 * t2, e2);
|
|
155
|
-
}, m2.format = function(t2) {
|
|
156
|
-
var e2 = this, n2 = this.$locale();
|
|
157
|
-
if (!this.isValid()) return n2.invalidDate || l;
|
|
158
|
-
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
|
159
|
-
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
160
|
-
}, d2 = function(t3) {
|
|
161
|
-
return b.s(s2 % 12 || 12, t3, "0");
|
|
162
|
-
}, $2 = f2 || function(t3, e3, n3) {
|
|
163
|
-
var r3 = t3 < 12 ? "AM" : "PM";
|
|
164
|
-
return n3 ? r3.toLowerCase() : r3;
|
|
165
|
-
};
|
|
166
|
-
return r2.replace(y, (function(t3, r3) {
|
|
167
|
-
return r3 || (function(t4) {
|
|
168
|
-
switch (t4) {
|
|
169
|
-
case "YY":
|
|
170
|
-
return String(e2.$y).slice(-2);
|
|
171
|
-
case "YYYY":
|
|
172
|
-
return b.s(e2.$y, 4, "0");
|
|
173
|
-
case "M":
|
|
174
|
-
return a2 + 1;
|
|
175
|
-
case "MM":
|
|
176
|
-
return b.s(a2 + 1, 2, "0");
|
|
177
|
-
case "MMM":
|
|
178
|
-
return h2(n2.monthsShort, a2, c2, 3);
|
|
179
|
-
case "MMMM":
|
|
180
|
-
return h2(c2, a2);
|
|
181
|
-
case "D":
|
|
182
|
-
return e2.$D;
|
|
183
|
-
case "DD":
|
|
184
|
-
return b.s(e2.$D, 2, "0");
|
|
185
|
-
case "d":
|
|
186
|
-
return String(e2.$W);
|
|
187
|
-
case "dd":
|
|
188
|
-
return h2(n2.weekdaysMin, e2.$W, o2, 2);
|
|
189
|
-
case "ddd":
|
|
190
|
-
return h2(n2.weekdaysShort, e2.$W, o2, 3);
|
|
191
|
-
case "dddd":
|
|
192
|
-
return o2[e2.$W];
|
|
193
|
-
case "H":
|
|
194
|
-
return String(s2);
|
|
195
|
-
case "HH":
|
|
196
|
-
return b.s(s2, 2, "0");
|
|
197
|
-
case "h":
|
|
198
|
-
return d2(1);
|
|
199
|
-
case "hh":
|
|
200
|
-
return d2(2);
|
|
201
|
-
case "a":
|
|
202
|
-
return $2(s2, u2, true);
|
|
203
|
-
case "A":
|
|
204
|
-
return $2(s2, u2, false);
|
|
205
|
-
case "m":
|
|
206
|
-
return String(u2);
|
|
207
|
-
case "mm":
|
|
208
|
-
return b.s(u2, 2, "0");
|
|
209
|
-
case "s":
|
|
210
|
-
return String(e2.$s);
|
|
211
|
-
case "ss":
|
|
212
|
-
return b.s(e2.$s, 2, "0");
|
|
213
|
-
case "SSS":
|
|
214
|
-
return b.s(e2.$ms, 3, "0");
|
|
215
|
-
case "Z":
|
|
216
|
-
return i2;
|
|
217
|
-
}
|
|
218
|
-
return null;
|
|
219
|
-
})(t3) || i2.replace(":", "");
|
|
220
|
-
}));
|
|
221
|
-
}, m2.utcOffset = function() {
|
|
222
|
-
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
223
|
-
}, m2.diff = function(r2, d2, l2) {
|
|
224
|
-
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
225
|
-
return b.m(y2, m3);
|
|
226
|
-
};
|
|
227
|
-
switch (M3) {
|
|
228
|
-
case h:
|
|
229
|
-
$2 = D2() / 12;
|
|
230
|
-
break;
|
|
231
|
-
case c:
|
|
232
|
-
$2 = D2();
|
|
233
|
-
break;
|
|
234
|
-
case f:
|
|
235
|
-
$2 = D2() / 3;
|
|
236
|
-
break;
|
|
237
|
-
case o:
|
|
238
|
-
$2 = (g2 - v2) / 6048e5;
|
|
239
|
-
break;
|
|
240
|
-
case a:
|
|
241
|
-
$2 = (g2 - v2) / 864e5;
|
|
242
|
-
break;
|
|
243
|
-
case u:
|
|
244
|
-
$2 = g2 / n;
|
|
245
|
-
break;
|
|
246
|
-
case s:
|
|
247
|
-
$2 = g2 / e;
|
|
248
|
-
break;
|
|
249
|
-
case i:
|
|
250
|
-
$2 = g2 / t;
|
|
251
|
-
break;
|
|
252
|
-
default:
|
|
253
|
-
$2 = g2;
|
|
254
|
-
}
|
|
255
|
-
return l2 ? $2 : b.a($2);
|
|
256
|
-
}, m2.daysInMonth = function() {
|
|
257
|
-
return this.endOf(c).$D;
|
|
258
|
-
}, m2.$locale = function() {
|
|
259
|
-
return D[this.$L];
|
|
260
|
-
}, m2.locale = function(t2, e2) {
|
|
261
|
-
if (!t2) return this.$L;
|
|
262
|
-
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
263
|
-
return r2 && (n2.$L = r2), n2;
|
|
264
|
-
}, m2.clone = function() {
|
|
265
|
-
return b.w(this.$d, this);
|
|
266
|
-
}, m2.toDate = function() {
|
|
267
|
-
return new Date(this.valueOf());
|
|
268
|
-
}, m2.toJSON = function() {
|
|
269
|
-
return this.isValid() ? this.toISOString() : null;
|
|
270
|
-
}, m2.toISOString = function() {
|
|
271
|
-
return this.$d.toISOString();
|
|
272
|
-
}, m2.toString = function() {
|
|
273
|
-
return this.$d.toUTCString();
|
|
274
|
-
}, M2;
|
|
275
|
-
})(), k = _.prototype;
|
|
276
|
-
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach((function(t2) {
|
|
277
|
-
k[t2[1]] = function(e2) {
|
|
278
|
-
return this.$g(e2, t2[0], t2[1]);
|
|
279
|
-
};
|
|
280
|
-
})), O.extend = function(t2, e2) {
|
|
281
|
-
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
282
|
-
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
283
|
-
return O(1e3 * t2);
|
|
284
|
-
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
285
|
-
}));
|
|
286
|
-
}
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
// ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/relativeTime.js
|
|
290
|
-
var require_relativeTime = __commonJS({
|
|
291
|
-
"../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/relativeTime.js"(exports, module) {
|
|
292
|
-
"use strict";
|
|
293
|
-
!(function(r, e) {
|
|
294
|
-
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (r = "undefined" != typeof globalThis ? globalThis : r || self).dayjs_plugin_relativeTime = e();
|
|
295
|
-
})(exports, (function() {
|
|
296
|
-
"use strict";
|
|
297
|
-
return function(r, e, t) {
|
|
298
|
-
r = r || {};
|
|
299
|
-
var n = e.prototype, o = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
|
|
300
|
-
function i(r2, e2, t2, o2) {
|
|
301
|
-
return n.fromToBase(r2, e2, t2, o2);
|
|
302
|
-
}
|
|
303
|
-
t.en.relativeTime = o, n.fromToBase = function(e2, n2, i2, d2, u) {
|
|
304
|
-
for (var f, a, s, l = i2.$locale().relativeTime || o, h = r.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m = h.length, c = 0; c < m; c += 1) {
|
|
305
|
-
var y = h[c];
|
|
306
|
-
y.d && (f = d2 ? t(e2).diff(i2, y.d, true) : i2.diff(e2, y.d, true));
|
|
307
|
-
var p = (r.rounding || Math.round)(Math.abs(f));
|
|
308
|
-
if (s = f > 0, p <= y.r || !y.r) {
|
|
309
|
-
p <= 1 && c > 0 && (y = h[c - 1]);
|
|
310
|
-
var v = l[y.l];
|
|
311
|
-
u && (p = u("" + p)), a = "string" == typeof v ? v.replace("%d", p) : v(p, n2, y.l, s);
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (n2) return a;
|
|
316
|
-
var M = s ? l.future : l.past;
|
|
317
|
-
return "function" == typeof M ? M(a) : M.replace("%s", a);
|
|
318
|
-
}, n.to = function(r2, e2) {
|
|
319
|
-
return i(r2, e2, this, true);
|
|
320
|
-
}, n.from = function(r2, e2) {
|
|
321
|
-
return i(r2, e2, this);
|
|
322
|
-
};
|
|
323
|
-
var d = function(r2) {
|
|
324
|
-
return r2.$u ? t.utc() : t();
|
|
325
|
-
};
|
|
326
|
-
n.toNow = function(r2) {
|
|
327
|
-
return this.to(d(this), r2);
|
|
328
|
-
}, n.fromNow = function(r2) {
|
|
329
|
-
return this.from(d(this), r2);
|
|
330
|
-
};
|
|
331
|
-
};
|
|
332
|
-
}));
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
// ../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/locale/zh-cn.js
|
|
337
|
-
var require_zh_cn = __commonJS({
|
|
338
|
-
"../../node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/locale/zh-cn.js"(exports, module) {
|
|
339
|
-
"use strict";
|
|
340
|
-
!(function(e, _) {
|
|
341
|
-
"object" == typeof exports && "undefined" != typeof module ? module.exports = _(require_dayjs_min()) : "function" == typeof define && define.amd ? define(["dayjs"], _) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_locale_zh_cn = _(e.dayjs);
|
|
342
|
-
})(exports, (function(e) {
|
|
343
|
-
"use strict";
|
|
344
|
-
function _(e2) {
|
|
345
|
-
return e2 && "object" == typeof e2 && "default" in e2 ? e2 : { default: e2 };
|
|
346
|
-
}
|
|
347
|
-
var t = _(e), d = { name: "zh-cn", weekdays: "\u661F\u671F\u65E5_\u661F\u671F\u4E00_\u661F\u671F\u4E8C_\u661F\u671F\u4E09_\u661F\u671F\u56DB_\u661F\u671F\u4E94_\u661F\u671F\u516D".split("_"), weekdaysShort: "\u5468\u65E5_\u5468\u4E00_\u5468\u4E8C_\u5468\u4E09_\u5468\u56DB_\u5468\u4E94_\u5468\u516D".split("_"), weekdaysMin: "\u65E5_\u4E00_\u4E8C_\u4E09_\u56DB_\u4E94_\u516D".split("_"), months: "\u4E00\u6708_\u4E8C\u6708_\u4E09\u6708_\u56DB\u6708_\u4E94\u6708_\u516D\u6708_\u4E03\u6708_\u516B\u6708_\u4E5D\u6708_\u5341\u6708_\u5341\u4E00\u6708_\u5341\u4E8C\u6708".split("_"), monthsShort: "1\u6708_2\u6708_3\u6708_4\u6708_5\u6708_6\u6708_7\u6708_8\u6708_9\u6708_10\u6708_11\u6708_12\u6708".split("_"), ordinal: function(e2, _2) {
|
|
348
|
-
return "W" === _2 ? e2 + "\u5468" : e2 + "\u65E5";
|
|
349
|
-
}, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY\u5E74M\u6708D\u65E5", LLL: "YYYY\u5E74M\u6708D\u65E5Ah\u70B9mm\u5206", LLLL: "YYYY\u5E74M\u6708D\u65E5ddddAh\u70B9mm\u5206", l: "YYYY/M/D", ll: "YYYY\u5E74M\u6708D\u65E5", lll: "YYYY\u5E74M\u6708D\u65E5 HH:mm", llll: "YYYY\u5E74M\u6708D\u65E5dddd HH:mm" }, relativeTime: { future: "%s\u5185", past: "%s\u524D", s: "\u51E0\u79D2", m: "1 \u5206\u949F", mm: "%d \u5206\u949F", h: "1 \u5C0F\u65F6", hh: "%d \u5C0F\u65F6", d: "1 \u5929", dd: "%d \u5929", M: "1 \u4E2A\u6708", MM: "%d \u4E2A\u6708", y: "1 \u5E74", yy: "%d \u5E74" }, meridiem: function(e2, _2) {
|
|
350
|
-
var t2 = 100 * e2 + _2;
|
|
351
|
-
return t2 < 600 ? "\u51CC\u6668" : t2 < 900 ? "\u65E9\u4E0A" : t2 < 1100 ? "\u4E0A\u5348" : t2 < 1300 ? "\u4E2D\u5348" : t2 < 1800 ? "\u4E0B\u5348" : "\u665A\u4E0A";
|
|
352
|
-
} };
|
|
353
|
-
return t.default.locale(d, null, true), d;
|
|
354
|
-
}));
|
|
355
|
-
}
|
|
356
|
-
});
|
|
4
|
+
} from "./chunk-G3OU7D3Y.mjs";
|
|
357
5
|
|
|
358
6
|
// src/ports/plugin-port.ts
|
|
359
7
|
var PLUGIN_TYPES = ["business", "functional", "view", "theme", "renderer", "system"];
|
|
@@ -596,7 +244,7 @@ var PluginErrorBoundary = class extends Component {
|
|
|
596
244
|
};
|
|
597
245
|
|
|
598
246
|
// src/components/PluginSlot.tsx
|
|
599
|
-
import { useMemo } from "react";
|
|
247
|
+
import { useMemo, useState, useEffect } from "react";
|
|
600
248
|
|
|
601
249
|
// src/adapters/local-storage-adapter.ts
|
|
602
250
|
var LocalStorageAdapter = class {
|
|
@@ -1521,7 +1169,9 @@ var PluginManager = class {
|
|
|
1521
1169
|
const runtime = this.runtimes.get(id);
|
|
1522
1170
|
if (runtime) {
|
|
1523
1171
|
try {
|
|
1172
|
+
console.log(`[PluginManager] invoking onLoad for ${id}`);
|
|
1524
1173
|
await runtime.load();
|
|
1174
|
+
console.log(`[PluginManager] onLoad completed for ${id}`);
|
|
1525
1175
|
} catch (e) {
|
|
1526
1176
|
logger7.error(`\u63D2\u4EF6 ${id} \u52A0\u8F7D\u5931\u8D25:`, e);
|
|
1527
1177
|
}
|
|
@@ -1628,31 +1278,38 @@ var PluginManager = class {
|
|
|
1628
1278
|
*/
|
|
1629
1279
|
async loadRemotePlugin(pluginId, url, config) {
|
|
1630
1280
|
logger7.info(`\u6B63\u5728\u4ECE ${url} \u52A0\u8F7D\u8FDC\u7A0B\u63D2\u4EF6 ${pluginId}...`);
|
|
1281
|
+
if (config?.format === "iife") {
|
|
1282
|
+
return this.loadIIFEPlugin(pluginId, url, config);
|
|
1283
|
+
}
|
|
1631
1284
|
try {
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1634
|
-
url
|
|
1635
|
-
);
|
|
1285
|
+
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
1286
|
+
const module = await dynamicImport(url);
|
|
1636
1287
|
return this.instantiatePlugin(pluginId, module, config);
|
|
1637
1288
|
} catch (e) {
|
|
1638
1289
|
logger7.warn(`ESM \u52A0\u8F7D\u5931\u8D25\uFF0C\u5C1D\u8BD5 IIFE \u52A0\u8F7D: ${pluginId}`);
|
|
1639
|
-
return
|
|
1640
|
-
const script = document.createElement("script");
|
|
1641
|
-
script.src = url;
|
|
1642
|
-
script.onload = () => {
|
|
1643
|
-
const globalName = pluginId.replace(/[^a-zA-Z0-9]/g, "_");
|
|
1644
|
-
const pluginModule = window[globalName];
|
|
1645
|
-
if (pluginModule) {
|
|
1646
|
-
resolve(this.instantiatePlugin(pluginId, pluginModule, config));
|
|
1647
|
-
} else {
|
|
1648
|
-
reject(new Error(`\u8FDC\u7A0B\u63D2\u4EF6 ${pluginId} \u52A0\u8F7D\u540E\u672A\u627E\u5230\u5168\u5C40\u53D8\u91CF ${globalName}`));
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
script.onerror = () => reject(new Error(`\u8FDC\u7A0B\u63D2\u4EF6 ${pluginId} \u52A0\u8F7D\u5931\u8D25: ${url}`));
|
|
1652
|
-
document.head.appendChild(script);
|
|
1653
|
-
});
|
|
1290
|
+
return this.loadIIFEPlugin(pluginId, url, config);
|
|
1654
1291
|
}
|
|
1655
1292
|
}
|
|
1293
|
+
/**
|
|
1294
|
+
* IIFE 模式加载插件
|
|
1295
|
+
*/
|
|
1296
|
+
loadIIFEPlugin(pluginId, url, config) {
|
|
1297
|
+
return new Promise((resolve, reject) => {
|
|
1298
|
+
const script = document.createElement("script");
|
|
1299
|
+
script.src = url;
|
|
1300
|
+
script.onload = () => {
|
|
1301
|
+
const globalName = pluginId.replace(/[^a-zA-Z0-9]/g, "_");
|
|
1302
|
+
const pluginModule = window[globalName];
|
|
1303
|
+
if (pluginModule) {
|
|
1304
|
+
resolve(this.instantiatePlugin(pluginId, pluginModule, config));
|
|
1305
|
+
} else {
|
|
1306
|
+
reject(new Error(`\u8FDC\u7A0B\u63D2\u4EF6 ${pluginId} \u52A0\u8F7D\u540E\u672A\u627E\u5230\u5168\u5C40\u53D8\u91CF ${globalName}`));
|
|
1307
|
+
}
|
|
1308
|
+
};
|
|
1309
|
+
script.onerror = () => reject(new Error(`\u8FDC\u7A0B\u63D2\u4EF6 ${pluginId} \u52A0\u8F7D\u5931\u8D25: ${url}`));
|
|
1310
|
+
document.head.appendChild(script);
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1656
1313
|
/**
|
|
1657
1314
|
* 实例化插件
|
|
1658
1315
|
*/
|
|
@@ -1673,7 +1330,8 @@ var PluginManager = class {
|
|
|
1673
1330
|
logger7.warn(`\u63D2\u4EF6 ${pluginId} \u4F7F\u7528\u4E86\u7C7B\u5B9A\u4E49\u6A21\u5F0F\u3002\u5EFA\u8BAE\u7EDF\u4E00\u4F7F\u7528 definePlugin() \u5DE5\u5382\u6A21\u5F0F\u4EE5\u6D88\u9664\u6B67\u4E49\u5E76\u7B80\u5316\u4EE3\u7801\u3002`);
|
|
1674
1331
|
}
|
|
1675
1332
|
const pluginInstance = typeof PluginClass === "function" ? new PluginClass() : PluginClass;
|
|
1676
|
-
|
|
1333
|
+
const isFilePath = pluginId.includes("/") && (pluginId.includes(".ts") || pluginId.includes(".tsx"));
|
|
1334
|
+
if (!isFilePath && pluginId && pluginInstance.metadata) {
|
|
1677
1335
|
if (pluginInstance.metadata.id !== pluginId) {
|
|
1678
1336
|
pluginInstance.metadata.id = pluginId;
|
|
1679
1337
|
}
|
|
@@ -1722,6 +1380,13 @@ var PluginSlot = ({
|
|
|
1722
1380
|
skeleton,
|
|
1723
1381
|
fallback
|
|
1724
1382
|
}) => {
|
|
1383
|
+
const [, forceUpdate] = useState({});
|
|
1384
|
+
useEffect(() => {
|
|
1385
|
+
const unsubscribe = pluginManager.subscribe(() => {
|
|
1386
|
+
forceUpdate({});
|
|
1387
|
+
});
|
|
1388
|
+
return unsubscribe;
|
|
1389
|
+
}, []);
|
|
1725
1390
|
const extensions = pluginManager.getExtensions(slot);
|
|
1726
1391
|
const systemConfig = pluginManager.getSystemConfig("title") ? {
|
|
1727
1392
|
title: pluginManager.getSystemConfig("title"),
|
|
@@ -2203,53 +1868,53 @@ function resolveApiModules(definitionsMap, mocksMap = {}) {
|
|
|
2203
1868
|
}
|
|
2204
1869
|
|
|
2205
1870
|
// src/utils/date.ts
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
1871
|
+
import dayjs from "dayjs";
|
|
1872
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
1873
|
+
import "dayjs/locale/zh-cn";
|
|
1874
|
+
dayjs.extend(relativeTime);
|
|
1875
|
+
dayjs.locale("zh-cn");
|
|
2211
1876
|
var dateUtils = {
|
|
2212
1877
|
/**
|
|
2213
1878
|
* 格式化日期为 YYYY-MM-DD
|
|
2214
1879
|
*/
|
|
2215
1880
|
formatDate(date) {
|
|
2216
|
-
return (
|
|
1881
|
+
return dayjs(date).format("YYYY-MM-DD");
|
|
2217
1882
|
},
|
|
2218
1883
|
/**
|
|
2219
1884
|
* 格式化时间为 HH:mm:ss
|
|
2220
1885
|
*/
|
|
2221
1886
|
formatTime(date) {
|
|
2222
|
-
return (
|
|
1887
|
+
return dayjs(date).format("HH:mm:ss");
|
|
2223
1888
|
},
|
|
2224
1889
|
/**
|
|
2225
1890
|
* 格式化日期时间为 YYYY-MM-DD HH:mm:ss
|
|
2226
1891
|
*/
|
|
2227
1892
|
formatDateTime(date) {
|
|
2228
|
-
return (
|
|
1893
|
+
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");
|
|
2229
1894
|
},
|
|
2230
1895
|
/**
|
|
2231
1896
|
* 获取当前时间戳(毫秒)
|
|
2232
1897
|
*/
|
|
2233
1898
|
now() {
|
|
2234
|
-
return (
|
|
1899
|
+
return dayjs().valueOf();
|
|
2235
1900
|
},
|
|
2236
1901
|
/**
|
|
2237
1902
|
* 获取相对时间(例如:几分钟前)
|
|
2238
1903
|
*/
|
|
2239
1904
|
fromNow(date) {
|
|
2240
|
-
return (
|
|
1905
|
+
return dayjs(date).fromNow();
|
|
2241
1906
|
},
|
|
2242
1907
|
/**
|
|
2243
1908
|
* 原始 dayjs 对象,用于更复杂的场景
|
|
2244
1909
|
*/
|
|
2245
|
-
dayjs
|
|
1910
|
+
dayjs
|
|
2246
1911
|
};
|
|
2247
1912
|
|
|
2248
1913
|
// src/utils/index.ts
|
|
2249
1914
|
var version = "1.0.0";
|
|
2250
1915
|
|
|
2251
1916
|
// src/hooks/use-storage-state.ts
|
|
2252
|
-
import { useCallback, useState } from "react";
|
|
1917
|
+
import { useCallback, useState as useState2 } from "react";
|
|
2253
1918
|
function useStorageState(pluginId, key, options = {}) {
|
|
2254
1919
|
const { defaultValue, scope = "plugin" } = options;
|
|
2255
1920
|
const storageManager = pluginManager.getStorageManager();
|
|
@@ -2257,7 +1922,7 @@ function useStorageState(pluginId, key, options = {}) {
|
|
|
2257
1922
|
const contextStorage = storageManager.getContextStorage(pluginId);
|
|
2258
1923
|
return scope === "shared" ? contextStorage.shared : contextStorage;
|
|
2259
1924
|
}, [pluginId, scope, storageManager]);
|
|
2260
|
-
const [state, setState] =
|
|
1925
|
+
const [state, setState] = useState2(() => {
|
|
2261
1926
|
try {
|
|
2262
1927
|
if (typeof window === "undefined") return defaultValue;
|
|
2263
1928
|
const storage = getStorage();
|
|
@@ -2282,13 +1947,13 @@ function useStorageState(pluginId, key, options = {}) {
|
|
|
2282
1947
|
}
|
|
2283
1948
|
|
|
2284
1949
|
// src/hooks/use-plugin-loader.ts
|
|
2285
|
-
import { useEffect, useRef, useState as
|
|
1950
|
+
import { useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
2286
1951
|
var logger10 = createLogger("PluginLoader");
|
|
2287
1952
|
var usePluginLoader = (options) => {
|
|
2288
|
-
const [pluginsLoaded, setPluginsLoaded] =
|
|
2289
|
-
const [pluginVersion, setPluginVersion] =
|
|
1953
|
+
const [pluginsLoaded, setPluginsLoaded] = useState3(false);
|
|
1954
|
+
const [pluginVersion, setPluginVersion] = useState3(0);
|
|
2290
1955
|
const loadingRef = useRef(false);
|
|
2291
|
-
|
|
1956
|
+
useEffect2(() => {
|
|
2292
1957
|
const unsubscribe = pluginManager.subscribe(() => {
|
|
2293
1958
|
logger10.debug("Plugin state changed, refreshing UI...");
|
|
2294
1959
|
setPluginVersion((v) => v + 1);
|
|
@@ -2312,7 +1977,7 @@ var usePluginLoader = (options) => {
|
|
|
2312
1977
|
}) : {};
|
|
2313
1978
|
const finalRegistry = { ...discoveredRegistry, ...manualRegistry };
|
|
2314
1979
|
if (options.systemConfig) {
|
|
2315
|
-
const { configManager: configManager2 } = await import("./config-manager-
|
|
1980
|
+
const { configManager: configManager2 } = await import("./config-manager-ZARQENTB.mjs");
|
|
2316
1981
|
configManager2.set("system", options.systemConfig);
|
|
2317
1982
|
}
|
|
2318
1983
|
await pluginManager.loadPlugins(pluginConfigs, finalRegistry);
|
|
@@ -2354,6 +2019,7 @@ export {
|
|
|
2354
2019
|
PluginRuntime,
|
|
2355
2020
|
PluginSandbox,
|
|
2356
2021
|
PluginSlot,
|
|
2022
|
+
ProxySandbox,
|
|
2357
2023
|
SUCCESS_CODE,
|
|
2358
2024
|
ScopedStorageAdapter,
|
|
2359
2025
|
ServiceRegistry,
|