@chamn/render 0.1.0 → 0.2.0

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/dist/index.mjs DELETED
@@ -1,4803 +0,0 @@
1
- var ca = Object.defineProperty;
2
- var ua = (t, e, r) => e in t ? ca(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
3
- var y = (t, e, r) => (ua(t, typeof e != "symbol" ? e + "" : e, r), r);
4
- import O, { Component as la, createElement as fa, useEffect as Ln, useRef as Bn, useMemo as pa } from "react";
5
- import * as da from "react-dom";
6
- const ha = (t) => () => {
7
- console.warn(`${t} need to be implement getComponent`);
8
- }, ma = ["customPageRootRender"], Br = [
9
- // 页面渲染
10
- "pageRender",
11
- // 渲染一个组件
12
- "render",
13
- // 将一个 组件 model 节点 转换为一个可被运行的渲染函数
14
- "convertModelToComponent",
15
- "getComponent",
16
- "getContext",
17
- "getUtils",
18
- "getDataLink",
19
- "createDataLink",
20
- "transformProps",
21
- "transformData",
22
- "transformGlobalData",
23
- "errorCatch",
24
- "clear"
25
- ], va = (t) => [...Br, ...ma].reduce((r, n) => {
26
- var o;
27
- return t != null && t[n] ? r[n] = (o = t[n]) == null ? void 0 : o.bind(t) : Br.includes(n) && (r[n] = ha), r;
28
- }, {});
29
- var ga = Object.defineProperty, ya = (t, e, r) => e in t ? ga(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, _ = (t, e, r) => (ya(t, typeof e != "symbol" ? e + "" : e, r), r), ba = typeof global == "object" && global && global.Object === Object && global;
30
- const Fn = ba;
31
- var _a = typeof self == "object" && self && self.Object === Object && self, Sa = Fn || _a || Function("return this")();
32
- const K = Sa;
33
- var ja = K.Symbol;
34
- const V = ja;
35
- var Un = Object.prototype, Oa = Un.hasOwnProperty, wa = Un.toString, kt = V ? V.toStringTag : void 0;
36
- function Ca(t) {
37
- var e = Oa.call(t, kt), r = t[kt];
38
- try {
39
- t[kt] = void 0;
40
- var n = !0;
41
- } catch {
42
- }
43
- var o = wa.call(t);
44
- return n && (e ? t[kt] = r : delete t[kt]), o;
45
- }
46
- var $a = Object.prototype, Ea = $a.toString;
47
- function Na(t) {
48
- return Ea.call(t);
49
- }
50
- var xa = "[object Null]", Ta = "[object Undefined]", Fr = V ? V.toStringTag : void 0;
51
- function ht(t) {
52
- return t == null ? t === void 0 ? Ta : xa : Fr && Fr in Object(t) ? Ca(t) : Na(t);
53
- }
54
- function Y(t) {
55
- return t != null && typeof t == "object";
56
- }
57
- var Ma = "[object Symbol]";
58
- function nr(t) {
59
- return typeof t == "symbol" || Y(t) && ht(t) == Ma;
60
- }
61
- function or(t, e) {
62
- for (var r = -1, n = t == null ? 0 : t.length, o = Array(n); ++r < n; )
63
- o[r] = e(t[r], r, t);
64
- return o;
65
- }
66
- var Aa = Array.isArray;
67
- const R = Aa;
68
- var Pa = 1 / 0, Ur = V ? V.prototype : void 0, kr = Ur ? Ur.toString : void 0;
69
- function kn(t) {
70
- if (typeof t == "string")
71
- return t;
72
- if (R(t))
73
- return or(t, kn) + "";
74
- if (nr(t))
75
- return kr ? kr.call(t) : "";
76
- var e = t + "";
77
- return e == "0" && 1 / t == -Pa ? "-0" : e;
78
- }
79
- function Q(t) {
80
- var e = typeof t;
81
- return t != null && (e == "object" || e == "function");
82
- }
83
- function ar(t) {
84
- return t;
85
- }
86
- var Ra = "[object AsyncFunction]", Ia = "[object Function]", Da = "[object GeneratorFunction]", La = "[object Proxy]";
87
- function sr(t) {
88
- if (!Q(t))
89
- return !1;
90
- var e = ht(t);
91
- return e == Ia || e == Da || e == Ra || e == La;
92
- }
93
- var Ba = K["__core-js_shared__"];
94
- const Te = Ba;
95
- var Gr = function() {
96
- var t = /[^.]+$/.exec(Te && Te.keys && Te.keys.IE_PROTO || "");
97
- return t ? "Symbol(src)_1." + t : "";
98
- }();
99
- function Fa(t) {
100
- return !!Gr && Gr in t;
101
- }
102
- var Ua = Function.prototype, ka = Ua.toString;
103
- function mt(t) {
104
- if (t != null) {
105
- try {
106
- return ka.call(t);
107
- } catch {
108
- }
109
- try {
110
- return t + "";
111
- } catch {
112
- }
113
- }
114
- return "";
115
- }
116
- var Ga = /[\\^$.*+?()[\]{}|]/g, Va = /^\[object .+?Constructor\]$/, za = Function.prototype, Ha = Object.prototype, Ja = za.toString, Wa = Ha.hasOwnProperty, Qa = RegExp(
117
- "^" + Ja.call(Wa).replace(Ga, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
118
- );
119
- function qa(t) {
120
- if (!Q(t) || Fa(t))
121
- return !1;
122
- var e = sr(t) ? Qa : Va;
123
- return e.test(mt(t));
124
- }
125
- function Ya(t, e) {
126
- return t == null ? void 0 : t[e];
127
- }
128
- function vt(t, e) {
129
- var r = Ya(t, e);
130
- return qa(r) ? r : void 0;
131
- }
132
- var Ka = vt(K, "WeakMap");
133
- const Ue = Ka;
134
- var Vr = Object.create, Xa = function() {
135
- function t() {
136
- }
137
- return function(e) {
138
- if (!Q(e))
139
- return {};
140
- if (Vr)
141
- return Vr(e);
142
- t.prototype = e;
143
- var r = new t();
144
- return t.prototype = void 0, r;
145
- };
146
- }();
147
- const Za = Xa;
148
- function ts(t, e, r) {
149
- switch (r.length) {
150
- case 0:
151
- return t.call(e);
152
- case 1:
153
- return t.call(e, r[0]);
154
- case 2:
155
- return t.call(e, r[0], r[1]);
156
- case 3:
157
- return t.call(e, r[0], r[1], r[2]);
158
- }
159
- return t.apply(e, r);
160
- }
161
- function es() {
162
- }
163
- function Gn(t, e) {
164
- var r = -1, n = t.length;
165
- for (e || (e = Array(n)); ++r < n; )
166
- e[r] = t[r];
167
- return e;
168
- }
169
- var rs = 800, ns = 16, os = Date.now;
170
- function as(t) {
171
- var e = 0, r = 0;
172
- return function() {
173
- var n = os(), o = ns - (n - r);
174
- if (r = n, o > 0) {
175
- if (++e >= rs)
176
- return arguments[0];
177
- } else
178
- e = 0;
179
- return t.apply(void 0, arguments);
180
- };
181
- }
182
- function ss(t) {
183
- return function() {
184
- return t;
185
- };
186
- }
187
- var is = function() {
188
- try {
189
- var t = vt(Object, "defineProperty");
190
- return t({}, "", {}), t;
191
- } catch {
192
- }
193
- }();
194
- const le = is;
195
- var cs = le ? function(t, e) {
196
- return le(t, "toString", {
197
- configurable: !0,
198
- enumerable: !1,
199
- value: ss(e),
200
- writable: !0
201
- });
202
- } : ar;
203
- const us = cs;
204
- var ls = as(us);
205
- const Vn = ls;
206
- function fs(t, e) {
207
- for (var r = -1, n = t == null ? 0 : t.length; ++r < n && e(t[r], r, t) !== !1; )
208
- ;
209
- return t;
210
- }
211
- function ps(t, e, r, n) {
212
- for (var o = t.length, a = r + (n ? 1 : -1); n ? a-- : ++a < o; )
213
- if (e(t[a], a, t))
214
- return a;
215
- return -1;
216
- }
217
- function ds(t) {
218
- return t !== t;
219
- }
220
- function hs(t, e, r) {
221
- for (var n = r - 1, o = t.length; ++n < o; )
222
- if (t[n] === e)
223
- return n;
224
- return -1;
225
- }
226
- function ms(t, e, r) {
227
- return e === e ? hs(t, e, r) : ps(t, ds, r);
228
- }
229
- function vs(t, e) {
230
- var r = t == null ? 0 : t.length;
231
- return !!r && ms(t, e, 0) > -1;
232
- }
233
- var gs = 9007199254740991, ys = /^(?:0|[1-9]\d*)$/;
234
- function me(t, e) {
235
- var r = typeof t;
236
- return e = e ?? gs, !!e && (r == "number" || r != "symbol" && ys.test(t)) && t > -1 && t % 1 == 0 && t < e;
237
- }
238
- function ir(t, e, r) {
239
- e == "__proto__" && le ? le(t, e, {
240
- configurable: !0,
241
- enumerable: !0,
242
- value: r,
243
- writable: !0
244
- }) : t[e] = r;
245
- }
246
- function ee(t, e) {
247
- return t === e || t !== t && e !== e;
248
- }
249
- var bs = Object.prototype, _s = bs.hasOwnProperty;
250
- function cr(t, e, r) {
251
- var n = t[e];
252
- (!(_s.call(t, e) && ee(n, r)) || r === void 0 && !(e in t)) && ir(t, e, r);
253
- }
254
- function Nt(t, e, r, n) {
255
- var o = !r;
256
- r || (r = {});
257
- for (var a = -1, i = e.length; ++a < i; ) {
258
- var s = e[a], c = n ? n(r[s], t[s], s, r, t) : void 0;
259
- c === void 0 && (c = t[s]), o ? ir(r, s, c) : cr(r, s, c);
260
- }
261
- return r;
262
- }
263
- var zr = Math.max;
264
- function zn(t, e, r) {
265
- return e = zr(e === void 0 ? t.length - 1 : e, 0), function() {
266
- for (var n = arguments, o = -1, a = zr(n.length - e, 0), i = Array(a); ++o < a; )
267
- i[o] = n[e + o];
268
- o = -1;
269
- for (var s = Array(e + 1); ++o < e; )
270
- s[o] = n[o];
271
- return s[e] = r(i), ts(t, this, s);
272
- };
273
- }
274
- function Hn(t, e) {
275
- return Vn(zn(t, e, ar), t + "");
276
- }
277
- var Ss = 9007199254740991;
278
- function ur(t) {
279
- return typeof t == "number" && t > -1 && t % 1 == 0 && t <= Ss;
280
- }
281
- function ve(t) {
282
- return t != null && ur(t.length) && !sr(t);
283
- }
284
- function js(t, e, r) {
285
- if (!Q(r))
286
- return !1;
287
- var n = typeof e;
288
- return (n == "number" ? ve(r) && me(e, r.length) : n == "string" && e in r) ? ee(r[e], t) : !1;
289
- }
290
- function Os(t) {
291
- return Hn(function(e, r) {
292
- var n = -1, o = r.length, a = o > 1 ? r[o - 1] : void 0, i = o > 2 ? r[2] : void 0;
293
- for (a = t.length > 3 && typeof a == "function" ? (o--, a) : void 0, i && js(r[0], r[1], i) && (a = o < 3 ? void 0 : a, o = 1), e = Object(e); ++n < o; ) {
294
- var s = r[n];
295
- s && t(e, s, n, a);
296
- }
297
- return e;
298
- });
299
- }
300
- var ws = Object.prototype;
301
- function lr(t) {
302
- var e = t && t.constructor, r = typeof e == "function" && e.prototype || ws;
303
- return t === r;
304
- }
305
- function Cs(t, e) {
306
- for (var r = -1, n = Array(t); ++r < t; )
307
- n[r] = e(r);
308
- return n;
309
- }
310
- var $s = "[object Arguments]";
311
- function Hr(t) {
312
- return Y(t) && ht(t) == $s;
313
- }
314
- var Jn = Object.prototype, Es = Jn.hasOwnProperty, Ns = Jn.propertyIsEnumerable, xs = Hr(function() {
315
- return arguments;
316
- }()) ? Hr : function(t) {
317
- return Y(t) && Es.call(t, "callee") && !Ns.call(t, "callee");
318
- };
319
- const Wt = xs;
320
- function Ts() {
321
- return !1;
322
- }
323
- var Wn = typeof exports == "object" && exports && !exports.nodeType && exports, Jr = Wn && typeof module == "object" && module && !module.nodeType && module, Ms = Jr && Jr.exports === Wn, Wr = Ms ? K.Buffer : void 0, As = Wr ? Wr.isBuffer : void 0, Ps = As || Ts;
324
- const Qt = Ps;
325
- var Rs = "[object Arguments]", Is = "[object Array]", Ds = "[object Boolean]", Ls = "[object Date]", Bs = "[object Error]", Fs = "[object Function]", Us = "[object Map]", ks = "[object Number]", Gs = "[object Object]", Vs = "[object RegExp]", zs = "[object Set]", Hs = "[object String]", Js = "[object WeakMap]", Ws = "[object ArrayBuffer]", Qs = "[object DataView]", qs = "[object Float32Array]", Ys = "[object Float64Array]", Ks = "[object Int8Array]", Xs = "[object Int16Array]", Zs = "[object Int32Array]", ti = "[object Uint8Array]", ei = "[object Uint8ClampedArray]", ri = "[object Uint16Array]", ni = "[object Uint32Array]", E = {};
326
- E[qs] = E[Ys] = E[Ks] = E[Xs] = E[Zs] = E[ti] = E[ei] = E[ri] = E[ni] = !0;
327
- E[Rs] = E[Is] = E[Ws] = E[Ds] = E[Qs] = E[Ls] = E[Bs] = E[Fs] = E[Us] = E[ks] = E[Gs] = E[Vs] = E[zs] = E[Hs] = E[Js] = !1;
328
- function oi(t) {
329
- return Y(t) && ur(t.length) && !!E[ht(t)];
330
- }
331
- function fr(t) {
332
- return function(e) {
333
- return t(e);
334
- };
335
- }
336
- var Qn = typeof exports == "object" && exports && !exports.nodeType && exports, Vt = Qn && typeof module == "object" && module && !module.nodeType && module, ai = Vt && Vt.exports === Qn, Me = ai && Fn.process, si = function() {
337
- try {
338
- var t = Vt && Vt.require && Vt.require("util").types;
339
- return t || Me && Me.binding && Me.binding("util");
340
- } catch {
341
- }
342
- }();
343
- const St = si;
344
- var Qr = St && St.isTypedArray, ii = Qr ? fr(Qr) : oi;
345
- const pr = ii;
346
- var ci = Object.prototype, ui = ci.hasOwnProperty;
347
- function qn(t, e) {
348
- var r = R(t), n = !r && Wt(t), o = !r && !n && Qt(t), a = !r && !n && !o && pr(t), i = r || n || o || a, s = i ? Cs(t.length, String) : [], c = s.length;
349
- for (var u in t)
350
- (e || ui.call(t, u)) && !(i && // Safari 9 has enumerable `arguments.length` in strict mode.
351
- (u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
352
- o && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
353
- a && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
354
- me(u, c))) && s.push(u);
355
- return s;
356
- }
357
- function Yn(t, e) {
358
- return function(r) {
359
- return t(e(r));
360
- };
361
- }
362
- var li = Yn(Object.keys, Object);
363
- const fi = li;
364
- var pi = Object.prototype, di = pi.hasOwnProperty;
365
- function hi(t) {
366
- if (!lr(t))
367
- return fi(t);
368
- var e = [];
369
- for (var r in Object(t))
370
- di.call(t, r) && r != "constructor" && e.push(r);
371
- return e;
372
- }
373
- function ge(t) {
374
- return ve(t) ? qn(t) : hi(t);
375
- }
376
- function mi(t) {
377
- var e = [];
378
- if (t != null)
379
- for (var r in Object(t))
380
- e.push(r);
381
- return e;
382
- }
383
- var vi = Object.prototype, gi = vi.hasOwnProperty;
384
- function yi(t) {
385
- if (!Q(t))
386
- return mi(t);
387
- var e = lr(t), r = [];
388
- for (var n in t)
389
- n == "constructor" && (e || !gi.call(t, n)) || r.push(n);
390
- return r;
391
- }
392
- function re(t) {
393
- return ve(t) ? qn(t, !0) : yi(t);
394
- }
395
- var bi = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, _i = /^\w*$/;
396
- function dr(t, e) {
397
- if (R(t))
398
- return !1;
399
- var r = typeof t;
400
- return r == "number" || r == "symbol" || r == "boolean" || t == null || nr(t) ? !0 : _i.test(t) || !bi.test(t) || e != null && t in Object(e);
401
- }
402
- var Si = vt(Object, "create");
403
- const qt = Si;
404
- function ji() {
405
- this.__data__ = qt ? qt(null) : {}, this.size = 0;
406
- }
407
- function Oi(t) {
408
- var e = this.has(t) && delete this.__data__[t];
409
- return this.size -= e ? 1 : 0, e;
410
- }
411
- var wi = "__lodash_hash_undefined__", Ci = Object.prototype, $i = Ci.hasOwnProperty;
412
- function Ei(t) {
413
- var e = this.__data__;
414
- if (qt) {
415
- var r = e[t];
416
- return r === wi ? void 0 : r;
417
- }
418
- return $i.call(e, t) ? e[t] : void 0;
419
- }
420
- var Ni = Object.prototype, xi = Ni.hasOwnProperty;
421
- function Ti(t) {
422
- var e = this.__data__;
423
- return qt ? e[t] !== void 0 : xi.call(e, t);
424
- }
425
- var Mi = "__lodash_hash_undefined__";
426
- function Ai(t, e) {
427
- var r = this.__data__;
428
- return this.size += this.has(t) ? 0 : 1, r[t] = qt && e === void 0 ? Mi : e, this;
429
- }
430
- function lt(t) {
431
- var e = -1, r = t == null ? 0 : t.length;
432
- for (this.clear(); ++e < r; ) {
433
- var n = t[e];
434
- this.set(n[0], n[1]);
435
- }
436
- }
437
- lt.prototype.clear = ji;
438
- lt.prototype.delete = Oi;
439
- lt.prototype.get = Ei;
440
- lt.prototype.has = Ti;
441
- lt.prototype.set = Ai;
442
- function Pi() {
443
- this.__data__ = [], this.size = 0;
444
- }
445
- function ye(t, e) {
446
- for (var r = t.length; r--; )
447
- if (ee(t[r][0], e))
448
- return r;
449
- return -1;
450
- }
451
- var Ri = Array.prototype, Ii = Ri.splice;
452
- function Di(t) {
453
- var e = this.__data__, r = ye(e, t);
454
- if (r < 0)
455
- return !1;
456
- var n = e.length - 1;
457
- return r == n ? e.pop() : Ii.call(e, r, 1), --this.size, !0;
458
- }
459
- function Li(t) {
460
- var e = this.__data__, r = ye(e, t);
461
- return r < 0 ? void 0 : e[r][1];
462
- }
463
- function Bi(t) {
464
- return ye(this.__data__, t) > -1;
465
- }
466
- function Fi(t, e) {
467
- var r = this.__data__, n = ye(r, t);
468
- return n < 0 ? (++this.size, r.push([t, e])) : r[n][1] = e, this;
469
- }
470
- function tt(t) {
471
- var e = -1, r = t == null ? 0 : t.length;
472
- for (this.clear(); ++e < r; ) {
473
- var n = t[e];
474
- this.set(n[0], n[1]);
475
- }
476
- }
477
- tt.prototype.clear = Pi;
478
- tt.prototype.delete = Di;
479
- tt.prototype.get = Li;
480
- tt.prototype.has = Bi;
481
- tt.prototype.set = Fi;
482
- var Ui = vt(K, "Map");
483
- const Yt = Ui;
484
- function ki() {
485
- this.size = 0, this.__data__ = {
486
- hash: new lt(),
487
- map: new (Yt || tt)(),
488
- string: new lt()
489
- };
490
- }
491
- function Gi(t) {
492
- var e = typeof t;
493
- return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
494
- }
495
- function be(t, e) {
496
- var r = t.__data__;
497
- return Gi(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
498
- }
499
- function Vi(t) {
500
- var e = be(this, t).delete(t);
501
- return this.size -= e ? 1 : 0, e;
502
- }
503
- function zi(t) {
504
- return be(this, t).get(t);
505
- }
506
- function Hi(t) {
507
- return be(this, t).has(t);
508
- }
509
- function Ji(t, e) {
510
- var r = be(this, t), n = r.size;
511
- return r.set(t, e), this.size += r.size == n ? 0 : 1, this;
512
- }
513
- function et(t) {
514
- var e = -1, r = t == null ? 0 : t.length;
515
- for (this.clear(); ++e < r; ) {
516
- var n = t[e];
517
- this.set(n[0], n[1]);
518
- }
519
- }
520
- et.prototype.clear = ki;
521
- et.prototype.delete = Vi;
522
- et.prototype.get = zi;
523
- et.prototype.has = Hi;
524
- et.prototype.set = Ji;
525
- var Wi = "Expected a function";
526
- function hr(t, e) {
527
- if (typeof t != "function" || e != null && typeof e != "function")
528
- throw new TypeError(Wi);
529
- var r = function() {
530
- var n = arguments, o = e ? e.apply(this, n) : n[0], a = r.cache;
531
- if (a.has(o))
532
- return a.get(o);
533
- var i = t.apply(this, n);
534
- return r.cache = a.set(o, i) || a, i;
535
- };
536
- return r.cache = new (hr.Cache || et)(), r;
537
- }
538
- hr.Cache = et;
539
- var Qi = 500;
540
- function qi(t) {
541
- var e = hr(t, function(n) {
542
- return r.size === Qi && r.clear(), n;
543
- }), r = e.cache;
544
- return e;
545
- }
546
- var Yi = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Ki = /\\(\\)?/g, Xi = qi(function(t) {
547
- var e = [];
548
- return t.charCodeAt(0) === 46 && e.push(""), t.replace(Yi, function(r, n, o, a) {
549
- e.push(o ? a.replace(Ki, "$1") : n || r);
550
- }), e;
551
- });
552
- const Zi = Xi;
553
- function tc(t) {
554
- return t == null ? "" : kn(t);
555
- }
556
- function xt(t, e) {
557
- return R(t) ? t : dr(t, e) ? [t] : Zi(tc(t));
558
- }
559
- var ec = 1 / 0;
560
- function Tt(t) {
561
- if (typeof t == "string" || nr(t))
562
- return t;
563
- var e = t + "";
564
- return e == "0" && 1 / t == -ec ? "-0" : e;
565
- }
566
- function _e(t, e) {
567
- e = xt(e, t);
568
- for (var r = 0, n = e.length; t != null && r < n; )
569
- t = t[Tt(e[r++])];
570
- return r && r == n ? t : void 0;
571
- }
572
- function Kn(t, e, r) {
573
- var n = t == null ? void 0 : _e(t, e);
574
- return n === void 0 ? r : n;
575
- }
576
- function mr(t, e) {
577
- for (var r = -1, n = e.length, o = t.length; ++r < n; )
578
- t[o + r] = e[r];
579
- return t;
580
- }
581
- var qr = V ? V.isConcatSpreadable : void 0;
582
- function rc(t) {
583
- return R(t) || Wt(t) || !!(qr && t && t[qr]);
584
- }
585
- function vr(t, e, r, n, o) {
586
- var a = -1, i = t.length;
587
- for (r || (r = rc), o || (o = []); ++a < i; ) {
588
- var s = t[a];
589
- e > 0 && r(s) ? e > 1 ? vr(s, e - 1, r, n, o) : mr(o, s) : n || (o[o.length] = s);
590
- }
591
- return o;
592
- }
593
- function nc(t) {
594
- var e = t == null ? 0 : t.length;
595
- return e ? vr(t, 1) : [];
596
- }
597
- function oc(t) {
598
- return Vn(zn(t, void 0, nc), t + "");
599
- }
600
- var ac = Yn(Object.getPrototypeOf, Object);
601
- const gr = ac;
602
- var sc = "[object Object]", ic = Function.prototype, cc = Object.prototype, Xn = ic.toString, uc = cc.hasOwnProperty, lc = Xn.call(Object);
603
- function F(t) {
604
- if (!Y(t) || ht(t) != sc)
605
- return !1;
606
- var e = gr(t);
607
- if (e === null)
608
- return !0;
609
- var r = uc.call(e, "constructor") && e.constructor;
610
- return typeof r == "function" && r instanceof r && Xn.call(r) == lc;
611
- }
612
- function fc(t, e, r) {
613
- var n = -1, o = t.length;
614
- e < 0 && (e = -e > o ? 0 : o + e), r = r > o ? o : r, r < 0 && (r += o), o = e > r ? 0 : r - e >>> 0, e >>>= 0;
615
- for (var a = Array(o); ++n < o; )
616
- a[n] = t[n + e];
617
- return a;
618
- }
619
- function pc() {
620
- this.__data__ = new tt(), this.size = 0;
621
- }
622
- function dc(t) {
623
- var e = this.__data__, r = e.delete(t);
624
- return this.size = e.size, r;
625
- }
626
- function hc(t) {
627
- return this.__data__.get(t);
628
- }
629
- function mc(t) {
630
- return this.__data__.has(t);
631
- }
632
- var vc = 200;
633
- function gc(t, e) {
634
- var r = this.__data__;
635
- if (r instanceof tt) {
636
- var n = r.__data__;
637
- if (!Yt || n.length < vc - 1)
638
- return n.push([t, e]), this.size = ++r.size, this;
639
- r = this.__data__ = new et(n);
640
- }
641
- return r.set(t, e), this.size = r.size, this;
642
- }
643
- function J(t) {
644
- var e = this.__data__ = new tt(t);
645
- this.size = e.size;
646
- }
647
- J.prototype.clear = pc;
648
- J.prototype.delete = dc;
649
- J.prototype.get = hc;
650
- J.prototype.has = mc;
651
- J.prototype.set = gc;
652
- function yc(t, e) {
653
- return t && Nt(e, ge(e), t);
654
- }
655
- function bc(t, e) {
656
- return t && Nt(e, re(e), t);
657
- }
658
- var Zn = typeof exports == "object" && exports && !exports.nodeType && exports, Yr = Zn && typeof module == "object" && module && !module.nodeType && module, _c = Yr && Yr.exports === Zn, Kr = _c ? K.Buffer : void 0, Xr = Kr ? Kr.allocUnsafe : void 0;
659
- function to(t, e) {
660
- if (e)
661
- return t.slice();
662
- var r = t.length, n = Xr ? Xr(r) : new t.constructor(r);
663
- return t.copy(n), n;
664
- }
665
- function Sc(t, e) {
666
- for (var r = -1, n = t == null ? 0 : t.length, o = 0, a = []; ++r < n; ) {
667
- var i = t[r];
668
- e(i, r, t) && (a[o++] = i);
669
- }
670
- return a;
671
- }
672
- function eo() {
673
- return [];
674
- }
675
- var jc = Object.prototype, Oc = jc.propertyIsEnumerable, Zr = Object.getOwnPropertySymbols, wc = Zr ? function(t) {
676
- return t == null ? [] : (t = Object(t), Sc(Zr(t), function(e) {
677
- return Oc.call(t, e);
678
- }));
679
- } : eo;
680
- const yr = wc;
681
- function Cc(t, e) {
682
- return Nt(t, yr(t), e);
683
- }
684
- var $c = Object.getOwnPropertySymbols, Ec = $c ? function(t) {
685
- for (var e = []; t; )
686
- mr(e, yr(t)), t = gr(t);
687
- return e;
688
- } : eo;
689
- const ro = Ec;
690
- function Nc(t, e) {
691
- return Nt(t, ro(t), e);
692
- }
693
- function no(t, e, r) {
694
- var n = e(t);
695
- return R(t) ? n : mr(n, r(t));
696
- }
697
- function ke(t) {
698
- return no(t, ge, yr);
699
- }
700
- function br(t) {
701
- return no(t, re, ro);
702
- }
703
- var xc = vt(K, "DataView");
704
- const Ge = xc;
705
- var Tc = vt(K, "Promise");
706
- const Ve = Tc;
707
- var Mc = vt(K, "Set");
708
- const _t = Mc;
709
- var tn = "[object Map]", Ac = "[object Object]", en = "[object Promise]", rn = "[object Set]", nn = "[object WeakMap]", on = "[object DataView]", Pc = mt(Ge), Rc = mt(Yt), Ic = mt(Ve), Dc = mt(_t), Lc = mt(Ue), ut = ht;
710
- (Ge && ut(new Ge(new ArrayBuffer(1))) != on || Yt && ut(new Yt()) != tn || Ve && ut(Ve.resolve()) != en || _t && ut(new _t()) != rn || Ue && ut(new Ue()) != nn) && (ut = function(t) {
711
- var e = ht(t), r = e == Ac ? t.constructor : void 0, n = r ? mt(r) : "";
712
- if (n)
713
- switch (n) {
714
- case Pc:
715
- return on;
716
- case Rc:
717
- return tn;
718
- case Ic:
719
- return en;
720
- case Dc:
721
- return rn;
722
- case Lc:
723
- return nn;
724
- }
725
- return e;
726
- });
727
- const Kt = ut;
728
- var Bc = Object.prototype, Fc = Bc.hasOwnProperty;
729
- function Uc(t) {
730
- var e = t.length, r = new t.constructor(e);
731
- return e && typeof t[0] == "string" && Fc.call(t, "index") && (r.index = t.index, r.input = t.input), r;
732
- }
733
- var kc = K.Uint8Array;
734
- const fe = kc;
735
- function _r(t) {
736
- var e = new t.constructor(t.byteLength);
737
- return new fe(e).set(new fe(t)), e;
738
- }
739
- function Gc(t, e) {
740
- var r = e ? _r(t.buffer) : t.buffer;
741
- return new t.constructor(r, t.byteOffset, t.byteLength);
742
- }
743
- var Vc = /\w*$/;
744
- function zc(t) {
745
- var e = new t.constructor(t.source, Vc.exec(t));
746
- return e.lastIndex = t.lastIndex, e;
747
- }
748
- var an = V ? V.prototype : void 0, sn = an ? an.valueOf : void 0;
749
- function Hc(t) {
750
- return sn ? Object(sn.call(t)) : {};
751
- }
752
- function oo(t, e) {
753
- var r = e ? _r(t.buffer) : t.buffer;
754
- return new t.constructor(r, t.byteOffset, t.length);
755
- }
756
- var Jc = "[object Boolean]", Wc = "[object Date]", Qc = "[object Map]", qc = "[object Number]", Yc = "[object RegExp]", Kc = "[object Set]", Xc = "[object String]", Zc = "[object Symbol]", tu = "[object ArrayBuffer]", eu = "[object DataView]", ru = "[object Float32Array]", nu = "[object Float64Array]", ou = "[object Int8Array]", au = "[object Int16Array]", su = "[object Int32Array]", iu = "[object Uint8Array]", cu = "[object Uint8ClampedArray]", uu = "[object Uint16Array]", lu = "[object Uint32Array]";
757
- function fu(t, e, r) {
758
- var n = t.constructor;
759
- switch (e) {
760
- case tu:
761
- return _r(t);
762
- case Jc:
763
- case Wc:
764
- return new n(+t);
765
- case eu:
766
- return Gc(t, r);
767
- case ru:
768
- case nu:
769
- case ou:
770
- case au:
771
- case su:
772
- case iu:
773
- case cu:
774
- case uu:
775
- case lu:
776
- return oo(t, r);
777
- case Qc:
778
- return new n();
779
- case qc:
780
- case Xc:
781
- return new n(t);
782
- case Yc:
783
- return zc(t);
784
- case Kc:
785
- return new n();
786
- case Zc:
787
- return Hc(t);
788
- }
789
- }
790
- function ao(t) {
791
- return typeof t.constructor == "function" && !lr(t) ? Za(gr(t)) : {};
792
- }
793
- var pu = "[object Map]";
794
- function du(t) {
795
- return Y(t) && Kt(t) == pu;
796
- }
797
- var cn = St && St.isMap, hu = cn ? fr(cn) : du;
798
- const mu = hu;
799
- var vu = "[object Set]";
800
- function gu(t) {
801
- return Y(t) && Kt(t) == vu;
802
- }
803
- var un = St && St.isSet, yu = un ? fr(un) : gu;
804
- const bu = yu;
805
- var _u = 1, Su = 2, ju = 4, so = "[object Arguments]", Ou = "[object Array]", wu = "[object Boolean]", Cu = "[object Date]", $u = "[object Error]", io = "[object Function]", Eu = "[object GeneratorFunction]", Nu = "[object Map]", xu = "[object Number]", co = "[object Object]", Tu = "[object RegExp]", Mu = "[object Set]", Au = "[object String]", Pu = "[object Symbol]", Ru = "[object WeakMap]", Iu = "[object ArrayBuffer]", Du = "[object DataView]", Lu = "[object Float32Array]", Bu = "[object Float64Array]", Fu = "[object Int8Array]", Uu = "[object Int16Array]", ku = "[object Int32Array]", Gu = "[object Uint8Array]", Vu = "[object Uint8ClampedArray]", zu = "[object Uint16Array]", Hu = "[object Uint32Array]", $ = {};
806
- $[so] = $[Ou] = $[Iu] = $[Du] = $[wu] = $[Cu] = $[Lu] = $[Bu] = $[Fu] = $[Uu] = $[ku] = $[Nu] = $[xu] = $[co] = $[Tu] = $[Mu] = $[Au] = $[Pu] = $[Gu] = $[Vu] = $[zu] = $[Hu] = !0;
807
- $[$u] = $[io] = $[Ru] = !1;
808
- function zt(t, e, r, n, o, a) {
809
- var i, s = e & _u, c = e & Su, u = e & ju;
810
- if (r && (i = o ? r(t, n, o, a) : r(t)), i !== void 0)
811
- return i;
812
- if (!Q(t))
813
- return t;
814
- var f = R(t);
815
- if (f) {
816
- if (i = Uc(t), !s)
817
- return Gn(t, i);
818
- } else {
819
- var p = Kt(t), l = p == io || p == Eu;
820
- if (Qt(t))
821
- return to(t, s);
822
- if (p == co || p == so || l && !o) {
823
- if (i = c || l ? {} : ao(t), !s)
824
- return c ? Nc(t, bc(i, t)) : Cc(t, yc(i, t));
825
- } else {
826
- if (!$[p])
827
- return o ? t : {};
828
- i = fu(t, p, s);
829
- }
830
- }
831
- a || (a = new J());
832
- var d = a.get(t);
833
- if (d)
834
- return d;
835
- a.set(t, i), bu(t) ? t.forEach(function(b) {
836
- i.add(zt(b, e, r, b, t, a));
837
- }) : mu(t) && t.forEach(function(b, S) {
838
- i.set(S, zt(b, e, r, S, t, a));
839
- });
840
- var h = u ? c ? br : ke : c ? re : ge, g = f ? void 0 : h(t);
841
- return fs(g || t, function(b, S) {
842
- g && (S = b, b = t[S]), cr(i, S, zt(b, e, r, S, t, a));
843
- }), i;
844
- }
845
- var Ju = 1, Wu = 4;
846
- function uo(t) {
847
- return zt(t, Ju | Wu);
848
- }
849
- var Qu = "__lodash_hash_undefined__";
850
- function qu(t) {
851
- return this.__data__.set(t, Qu), this;
852
- }
853
- function Yu(t) {
854
- return this.__data__.has(t);
855
- }
856
- function Xt(t) {
857
- var e = -1, r = t == null ? 0 : t.length;
858
- for (this.__data__ = new et(); ++e < r; )
859
- this.add(t[e]);
860
- }
861
- Xt.prototype.add = Xt.prototype.push = qu;
862
- Xt.prototype.has = Yu;
863
- function Ku(t, e) {
864
- for (var r = -1, n = t == null ? 0 : t.length; ++r < n; )
865
- if (e(t[r], r, t))
866
- return !0;
867
- return !1;
868
- }
869
- function lo(t, e) {
870
- return t.has(e);
871
- }
872
- var Xu = 1, Zu = 2;
873
- function fo(t, e, r, n, o, a) {
874
- var i = r & Xu, s = t.length, c = e.length;
875
- if (s != c && !(i && c > s))
876
- return !1;
877
- var u = a.get(t), f = a.get(e);
878
- if (u && f)
879
- return u == e && f == t;
880
- var p = -1, l = !0, d = r & Zu ? new Xt() : void 0;
881
- for (a.set(t, e), a.set(e, t); ++p < s; ) {
882
- var h = t[p], g = e[p];
883
- if (n)
884
- var b = i ? n(g, h, p, e, t, a) : n(h, g, p, t, e, a);
885
- if (b !== void 0) {
886
- if (b)
887
- continue;
888
- l = !1;
889
- break;
890
- }
891
- if (d) {
892
- if (!Ku(e, function(S, j) {
893
- if (!lo(d, j) && (h === S || o(h, S, r, n, a)))
894
- return d.push(j);
895
- })) {
896
- l = !1;
897
- break;
898
- }
899
- } else if (!(h === g || o(h, g, r, n, a))) {
900
- l = !1;
901
- break;
902
- }
903
- }
904
- return a.delete(t), a.delete(e), l;
905
- }
906
- function tl(t) {
907
- var e = -1, r = Array(t.size);
908
- return t.forEach(function(n, o) {
909
- r[++e] = [o, n];
910
- }), r;
911
- }
912
- function Sr(t) {
913
- var e = -1, r = Array(t.size);
914
- return t.forEach(function(n) {
915
- r[++e] = n;
916
- }), r;
917
- }
918
- var el = 1, rl = 2, nl = "[object Boolean]", ol = "[object Date]", al = "[object Error]", sl = "[object Map]", il = "[object Number]", cl = "[object RegExp]", ul = "[object Set]", ll = "[object String]", fl = "[object Symbol]", pl = "[object ArrayBuffer]", dl = "[object DataView]", ln = V ? V.prototype : void 0, Ae = ln ? ln.valueOf : void 0;
919
- function hl(t, e, r, n, o, a, i) {
920
- switch (r) {
921
- case dl:
922
- if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset)
923
- return !1;
924
- t = t.buffer, e = e.buffer;
925
- case pl:
926
- return !(t.byteLength != e.byteLength || !a(new fe(t), new fe(e)));
927
- case nl:
928
- case ol:
929
- case il:
930
- return ee(+t, +e);
931
- case al:
932
- return t.name == e.name && t.message == e.message;
933
- case cl:
934
- case ll:
935
- return t == e + "";
936
- case sl:
937
- var s = tl;
938
- case ul:
939
- var c = n & el;
940
- if (s || (s = Sr), t.size != e.size && !c)
941
- return !1;
942
- var u = i.get(t);
943
- if (u)
944
- return u == e;
945
- n |= rl, i.set(t, e);
946
- var f = fo(s(t), s(e), n, o, a, i);
947
- return i.delete(t), f;
948
- case fl:
949
- if (Ae)
950
- return Ae.call(t) == Ae.call(e);
951
- }
952
- return !1;
953
- }
954
- var ml = 1, vl = Object.prototype, gl = vl.hasOwnProperty;
955
- function yl(t, e, r, n, o, a) {
956
- var i = r & ml, s = ke(t), c = s.length, u = ke(e), f = u.length;
957
- if (c != f && !i)
958
- return !1;
959
- for (var p = c; p--; ) {
960
- var l = s[p];
961
- if (!(i ? l in e : gl.call(e, l)))
962
- return !1;
963
- }
964
- var d = a.get(t), h = a.get(e);
965
- if (d && h)
966
- return d == e && h == t;
967
- var g = !0;
968
- a.set(t, e), a.set(e, t);
969
- for (var b = i; ++p < c; ) {
970
- l = s[p];
971
- var S = t[l], j = e[l];
972
- if (n)
973
- var x = i ? n(j, S, l, e, t, a) : n(S, j, l, t, e, a);
974
- if (!(x === void 0 ? S === j || o(S, j, r, n, a) : x)) {
975
- g = !1;
976
- break;
977
- }
978
- b || (b = l == "constructor");
979
- }
980
- if (g && !b) {
981
- var A = t.constructor, D = e.constructor;
982
- A != D && "constructor" in t && "constructor" in e && !(typeof A == "function" && A instanceof A && typeof D == "function" && D instanceof D) && (g = !1);
983
- }
984
- return a.delete(t), a.delete(e), g;
985
- }
986
- var bl = 1, fn = "[object Arguments]", pn = "[object Array]", ce = "[object Object]", _l = Object.prototype, dn = _l.hasOwnProperty;
987
- function Sl(t, e, r, n, o, a) {
988
- var i = R(t), s = R(e), c = i ? pn : Kt(t), u = s ? pn : Kt(e);
989
- c = c == fn ? ce : c, u = u == fn ? ce : u;
990
- var f = c == ce, p = u == ce, l = c == u;
991
- if (l && Qt(t)) {
992
- if (!Qt(e))
993
- return !1;
994
- i = !0, f = !1;
995
- }
996
- if (l && !f)
997
- return a || (a = new J()), i || pr(t) ? fo(t, e, r, n, o, a) : hl(t, e, c, r, n, o, a);
998
- if (!(r & bl)) {
999
- var d = f && dn.call(t, "__wrapped__"), h = p && dn.call(e, "__wrapped__");
1000
- if (d || h) {
1001
- var g = d ? t.value() : t, b = h ? e.value() : e;
1002
- return a || (a = new J()), o(g, b, r, n, a);
1003
- }
1004
- }
1005
- return l ? (a || (a = new J()), yl(t, e, r, n, o, a)) : !1;
1006
- }
1007
- function jr(t, e, r, n, o) {
1008
- return t === e ? !0 : t == null || e == null || !Y(t) && !Y(e) ? t !== t && e !== e : Sl(t, e, r, n, jr, o);
1009
- }
1010
- var jl = 1, Ol = 2;
1011
- function wl(t, e, r, n) {
1012
- var o = r.length, a = o, i = !n;
1013
- if (t == null)
1014
- return !a;
1015
- for (t = Object(t); o--; ) {
1016
- var s = r[o];
1017
- if (i && s[2] ? s[1] !== t[s[0]] : !(s[0] in t))
1018
- return !1;
1019
- }
1020
- for (; ++o < a; ) {
1021
- s = r[o];
1022
- var c = s[0], u = t[c], f = s[1];
1023
- if (i && s[2]) {
1024
- if (u === void 0 && !(c in t))
1025
- return !1;
1026
- } else {
1027
- var p = new J();
1028
- if (n)
1029
- var l = n(u, f, c, t, e, p);
1030
- if (!(l === void 0 ? jr(f, u, jl | Ol, n, p) : l))
1031
- return !1;
1032
- }
1033
- }
1034
- return !0;
1035
- }
1036
- function po(t) {
1037
- return t === t && !Q(t);
1038
- }
1039
- function Cl(t) {
1040
- for (var e = ge(t), r = e.length; r--; ) {
1041
- var n = e[r], o = t[n];
1042
- e[r] = [n, o, po(o)];
1043
- }
1044
- return e;
1045
- }
1046
- function ho(t, e) {
1047
- return function(r) {
1048
- return r == null ? !1 : r[t] === e && (e !== void 0 || t in Object(r));
1049
- };
1050
- }
1051
- function $l(t) {
1052
- var e = Cl(t);
1053
- return e.length == 1 && e[0][2] ? ho(e[0][0], e[0][1]) : function(r) {
1054
- return r === t || wl(r, t, e);
1055
- };
1056
- }
1057
- function El(t, e) {
1058
- return t != null && e in Object(t);
1059
- }
1060
- function Nl(t, e, r) {
1061
- e = xt(e, t);
1062
- for (var n = -1, o = e.length, a = !1; ++n < o; ) {
1063
- var i = Tt(e[n]);
1064
- if (!(a = t != null && r(t, i)))
1065
- break;
1066
- t = t[i];
1067
- }
1068
- return a || ++n != o ? a : (o = t == null ? 0 : t.length, !!o && ur(o) && me(i, o) && (R(t) || Wt(t)));
1069
- }
1070
- function xl(t, e) {
1071
- return t != null && Nl(t, e, El);
1072
- }
1073
- var Tl = 1, Ml = 2;
1074
- function Al(t, e) {
1075
- return dr(t) && po(e) ? ho(Tt(t), e) : function(r) {
1076
- var n = Kn(r, t);
1077
- return n === void 0 && n === e ? xl(r, t) : jr(e, n, Tl | Ml);
1078
- };
1079
- }
1080
- function Pl(t) {
1081
- return function(e) {
1082
- return e == null ? void 0 : e[t];
1083
- };
1084
- }
1085
- function Rl(t) {
1086
- return function(e) {
1087
- return _e(e, t);
1088
- };
1089
- }
1090
- function Il(t) {
1091
- return dr(t) ? Pl(Tt(t)) : Rl(t);
1092
- }
1093
- function Or(t) {
1094
- return typeof t == "function" ? t : t == null ? ar : typeof t == "object" ? R(t) ? Al(t[0], t[1]) : $l(t) : Il(t);
1095
- }
1096
- function Dl(t) {
1097
- return function(e, r, n) {
1098
- for (var o = -1, a = Object(e), i = n(e), s = i.length; s--; ) {
1099
- var c = i[t ? s : ++o];
1100
- if (r(a[c], c, a) === !1)
1101
- break;
1102
- }
1103
- return e;
1104
- };
1105
- }
1106
- var Ll = Dl();
1107
- const Bl = Ll;
1108
- function ze(t, e, r) {
1109
- (r !== void 0 && !ee(t[e], r) || r === void 0 && !(e in t)) && ir(t, e, r);
1110
- }
1111
- function He(t) {
1112
- return Y(t) && ve(t);
1113
- }
1114
- function Je(t, e) {
1115
- if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
1116
- return t[e];
1117
- }
1118
- function Fl(t) {
1119
- return Nt(t, re(t));
1120
- }
1121
- function Ul(t, e, r, n, o, a, i) {
1122
- var s = Je(t, r), c = Je(e, r), u = i.get(c);
1123
- if (u) {
1124
- ze(t, r, u);
1125
- return;
1126
- }
1127
- var f = a ? a(s, c, r + "", t, e, i) : void 0, p = f === void 0;
1128
- if (p) {
1129
- var l = R(c), d = !l && Qt(c), h = !l && !d && pr(c);
1130
- f = c, l || d || h ? R(s) ? f = s : He(s) ? f = Gn(s) : d ? (p = !1, f = to(c, !0)) : h ? (p = !1, f = oo(c, !0)) : f = [] : F(c) || Wt(c) ? (f = s, Wt(s) ? f = Fl(s) : (!Q(s) || sr(s)) && (f = ao(c))) : p = !1;
1131
- }
1132
- p && (i.set(c, f), o(f, c, n, a, i), i.delete(c)), ze(t, r, f);
1133
- }
1134
- function mo(t, e, r, n, o) {
1135
- t !== e && Bl(e, function(a, i) {
1136
- if (o || (o = new J()), Q(a))
1137
- Ul(t, e, i, r, mo, n, o);
1138
- else {
1139
- var s = n ? n(Je(t, i), a, i + "", t, e, o) : void 0;
1140
- s === void 0 && (s = a), ze(t, i, s);
1141
- }
1142
- }, re);
1143
- }
1144
- function kl(t, e, r) {
1145
- for (var n = -1, o = t == null ? 0 : t.length; ++n < o; )
1146
- if (r(e, t[n]))
1147
- return !0;
1148
- return !1;
1149
- }
1150
- function vo(t) {
1151
- var e = t == null ? 0 : t.length;
1152
- return e ? t[e - 1] : void 0;
1153
- }
1154
- function Gl(t, e) {
1155
- return e.length < 2 ? t : _e(t, fc(e, 0, -1));
1156
- }
1157
- var Vl = Os(function(t, e, r) {
1158
- mo(t, e, r);
1159
- });
1160
- const go = Vl;
1161
- var zl = "Expected a function";
1162
- function Hl(t) {
1163
- if (typeof t != "function")
1164
- throw new TypeError(zl);
1165
- return function() {
1166
- var e = arguments;
1167
- switch (e.length) {
1168
- case 0:
1169
- return !t.call(this);
1170
- case 1:
1171
- return !t.call(this, e[0]);
1172
- case 2:
1173
- return !t.call(this, e[0], e[1]);
1174
- case 3:
1175
- return !t.call(this, e[0], e[1], e[2]);
1176
- }
1177
- return !t.apply(this, e);
1178
- };
1179
- }
1180
- function Jl(t, e) {
1181
- return e = xt(e, t), t = Gl(t, e), t == null || delete t[Tt(vo(e))];
1182
- }
1183
- function Wl(t) {
1184
- return F(t) ? void 0 : t;
1185
- }
1186
- var Ql = 1, ql = 2, Yl = 4, Kl = oc(function(t, e) {
1187
- var r = {};
1188
- if (t == null)
1189
- return r;
1190
- var n = !1;
1191
- e = or(e, function(a) {
1192
- return a = xt(a, t), n || (n = a.length > 1), a;
1193
- }), Nt(t, br(t), r), n && (r = zt(r, Ql | ql | Yl, Wl));
1194
- for (var o = e.length; o--; )
1195
- Jl(r, e[o]);
1196
- return r;
1197
- });
1198
- const yo = Kl;
1199
- function Xl(t, e, r, n) {
1200
- if (!Q(t))
1201
- return t;
1202
- e = xt(e, t);
1203
- for (var o = -1, a = e.length, i = a - 1, s = t; s != null && ++o < a; ) {
1204
- var c = Tt(e[o]), u = r;
1205
- if (c === "__proto__" || c === "constructor" || c === "prototype")
1206
- return t;
1207
- if (o != i) {
1208
- var f = s[c];
1209
- u = n ? n(f, c, s) : void 0, u === void 0 && (u = Q(f) ? f : me(e[o + 1]) ? [] : {});
1210
- }
1211
- cr(s, c, u), s = s[c];
1212
- }
1213
- return t;
1214
- }
1215
- function Zl(t, e, r) {
1216
- for (var n = -1, o = e.length, a = {}; ++n < o; ) {
1217
- var i = e[n], s = _e(t, i);
1218
- r(s, i) && Xl(a, xt(i, t), s);
1219
- }
1220
- return a;
1221
- }
1222
- function tf(t, e) {
1223
- if (t == null)
1224
- return {};
1225
- var r = or(br(t), function(n) {
1226
- return [n];
1227
- });
1228
- return e = Or(e), Zl(t, r, function(n, o) {
1229
- return e(n, o[0]);
1230
- });
1231
- }
1232
- function ef(t, e) {
1233
- return tf(t, Hl(Or(e)));
1234
- }
1235
- var rf = 1 / 0, nf = _t && 1 / Sr(new _t([, -0]))[1] == rf ? function(t) {
1236
- return new _t(t);
1237
- } : es;
1238
- const of = nf;
1239
- var af = 200;
1240
- function sf(t, e, r) {
1241
- var n = -1, o = vs, a = t.length, i = !0, s = [], c = s;
1242
- if (r)
1243
- i = !1, o = kl;
1244
- else if (a >= af) {
1245
- var u = e ? null : of(t);
1246
- if (u)
1247
- return Sr(u);
1248
- i = !1, o = lo, c = new Xt();
1249
- } else
1250
- c = e ? [] : s;
1251
- t:
1252
- for (; ++n < a; ) {
1253
- var f = t[n], p = e ? e(f) : f;
1254
- if (f = r || f !== 0 ? f : 0, i && p === p) {
1255
- for (var l = c.length; l--; )
1256
- if (c[l] === p)
1257
- continue t;
1258
- e && c.push(p), s.push(f);
1259
- } else
1260
- o(c, p, r) || (c !== s && c.push(p), s.push(f));
1261
- }
1262
- return s;
1263
- }
1264
- var cf = Hn(function(t) {
1265
- var e = vo(t);
1266
- return He(e) && (e = void 0), sf(vr(t, 1, He, !0), Or(e));
1267
- });
1268
- const uf = cf;
1269
- class bo extends TypeError {
1270
- constructor(e, r) {
1271
- let n;
1272
- const {
1273
- message: o,
1274
- ...a
1275
- } = e, {
1276
- path: i
1277
- } = e, s = i.length === 0 ? o : `At path: ${i.join(".")} -- ${o}`;
1278
- super(s), this.value = void 0, this.key = void 0, this.type = void 0, this.refinement = void 0, this.path = void 0, this.branch = void 0, this.failures = void 0, Object.assign(this, a), this.name = this.constructor.name, this.failures = () => n ?? (n = [e, ...r()]);
1279
- }
1280
- }
1281
- function lf(t) {
1282
- return W(t) && typeof t[Symbol.iterator] == "function";
1283
- }
1284
- function W(t) {
1285
- return typeof t == "object" && t != null;
1286
- }
1287
- function U(t) {
1288
- return typeof t == "symbol" ? t.toString() : typeof t == "string" ? JSON.stringify(t) : `${t}`;
1289
- }
1290
- function ff(t) {
1291
- const {
1292
- done: e,
1293
- value: r
1294
- } = t.next();
1295
- return e ? void 0 : r;
1296
- }
1297
- function pf(t, e, r, n) {
1298
- if (t === !0)
1299
- return;
1300
- t === !1 ? t = {} : typeof t == "string" && (t = {
1301
- message: t
1302
- });
1303
- const {
1304
- path: o,
1305
- branch: a
1306
- } = e, {
1307
- type: i
1308
- } = r, {
1309
- refinement: s,
1310
- message: c = `Expected a value of type \`${i}\`${s ? ` with refinement \`${s}\`` : ""}, but received: \`${U(n)}\``
1311
- } = t;
1312
- return {
1313
- value: n,
1314
- type: i,
1315
- refinement: s,
1316
- key: o[o.length - 1],
1317
- path: o,
1318
- branch: a,
1319
- ...t,
1320
- message: c
1321
- };
1322
- }
1323
- function* hn(t, e, r, n) {
1324
- lf(t) || (t = [t]);
1325
- for (const o of t) {
1326
- const a = pf(o, e, r, n);
1327
- a && (yield a);
1328
- }
1329
- }
1330
- function* wr(t, e, r) {
1331
- r === void 0 && (r = {});
1332
- const {
1333
- path: n = [],
1334
- branch: o = [t],
1335
- coerce: a = !1,
1336
- mask: i = !1
1337
- } = r, s = {
1338
- path: n,
1339
- branch: o
1340
- };
1341
- if (a && (t = e.coercer(t, s), i && e.type !== "type" && W(e.schema) && W(t) && !Array.isArray(t)))
1342
- for (const u in t)
1343
- e.schema[u] === void 0 && delete t[u];
1344
- let c = "valid";
1345
- for (const u of e.validator(t, s))
1346
- c = "not_valid", yield [u, void 0];
1347
- for (let [u, f, p] of e.entries(t, s)) {
1348
- const l = wr(f, p, {
1349
- path: u === void 0 ? n : [...n, u],
1350
- branch: u === void 0 ? o : [...o, f],
1351
- coerce: a,
1352
- mask: i
1353
- });
1354
- for (const d of l)
1355
- d[0] ? (c = d[0].refinement != null ? "not_refined" : "not_valid", yield [d[0], void 0]) : a && (f = d[1], u === void 0 ? t = f : t instanceof Map ? t.set(u, f) : t instanceof Set ? t.add(f) : W(t) && (f !== void 0 || u in t) && (t[u] = f));
1356
- }
1357
- if (c !== "not_valid")
1358
- for (const u of e.refiner(t, s))
1359
- c = "not_refined", yield [u, void 0];
1360
- c === "valid" && (yield [void 0, t]);
1361
- }
1362
- class X {
1363
- constructor(e) {
1364
- this.TYPE = void 0, this.type = void 0, this.schema = void 0, this.coercer = void 0, this.validator = void 0, this.refiner = void 0, this.entries = void 0;
1365
- const {
1366
- type: r,
1367
- schema: n,
1368
- validator: o,
1369
- refiner: a,
1370
- coercer: i = (c) => c,
1371
- entries: s = function* () {
1372
- }
1373
- } = e;
1374
- this.type = r, this.schema = n, this.entries = s, this.coercer = i, o ? this.validator = (c, u) => {
1375
- const f = o(c, u);
1376
- return hn(f, u, this, c);
1377
- } : this.validator = () => [], a ? this.refiner = (c, u) => {
1378
- const f = a(c, u);
1379
- return hn(f, u, this, c);
1380
- } : this.refiner = () => [];
1381
- }
1382
- /**
1383
- * Assert that a value passes the struct's validation, throwing if it doesn't.
1384
- */
1385
- assert(e) {
1386
- return _o(e, this);
1387
- }
1388
- /**
1389
- * Create a value with the struct's coercion logic, then validate it.
1390
- */
1391
- create(e) {
1392
- return df(e, this);
1393
- }
1394
- /**
1395
- * Check if a value passes the struct's validation.
1396
- */
1397
- is(e) {
1398
- return mf(e, this);
1399
- }
1400
- /**
1401
- * Mask a value, coercing and validating it, but returning only the subset of
1402
- * properties defined by the struct's schema.
1403
- */
1404
- mask(e) {
1405
- return hf(e, this);
1406
- }
1407
- /**
1408
- * Validate a value with the struct's validation logic, returning a tuple
1409
- * representing the result.
1410
- *
1411
- * You may optionally pass `true` for the `withCoercion` argument to coerce
1412
- * the value before attempting to validate it. If you do, the result will
1413
- * contain the coerced result when successful.
1414
- */
1415
- validate(e, r) {
1416
- return r === void 0 && (r = {}), Mt(e, this, r);
1417
- }
1418
- }
1419
- function _o(t, e) {
1420
- const r = Mt(t, e);
1421
- if (r[0])
1422
- throw r[0];
1423
- }
1424
- function df(t, e) {
1425
- const r = Mt(t, e, {
1426
- coerce: !0
1427
- });
1428
- if (r[0])
1429
- throw r[0];
1430
- return r[1];
1431
- }
1432
- function hf(t, e) {
1433
- const r = Mt(t, e, {
1434
- coerce: !0,
1435
- mask: !0
1436
- });
1437
- if (r[0])
1438
- throw r[0];
1439
- return r[1];
1440
- }
1441
- function mf(t, e) {
1442
- return !Mt(t, e)[0];
1443
- }
1444
- function Mt(t, e, r) {
1445
- r === void 0 && (r = {});
1446
- const n = wr(t, e, r), o = ff(n);
1447
- return o[0] ? [new bo(o[0], function* () {
1448
- for (const a of n)
1449
- a[0] && (yield a[0]);
1450
- }), void 0] : [void 0, o[1]];
1451
- }
1452
- function Cr() {
1453
- for (var t = arguments.length, e = new Array(t), r = 0; r < t; r++)
1454
- e[r] = arguments[r];
1455
- const n = e[0].type === "type", o = e.map((i) => i.schema), a = Object.assign({}, ...o);
1456
- return n ? wo(a) : w(a);
1457
- }
1458
- function st(t, e) {
1459
- return new X({
1460
- type: t,
1461
- schema: null,
1462
- validator: e
1463
- });
1464
- }
1465
- function jt(t) {
1466
- return new X({
1467
- type: "dynamic",
1468
- schema: null,
1469
- *entries(e, r) {
1470
- yield* t(e, r).entries(e, r);
1471
- },
1472
- validator(e, r) {
1473
- return t(e, r).validator(e, r);
1474
- },
1475
- coercer(e, r) {
1476
- return t(e, r).coercer(e, r);
1477
- },
1478
- refiner(e, r) {
1479
- return t(e, r).refiner(e, r);
1480
- }
1481
- });
1482
- }
1483
- function So(t, e) {
1484
- const {
1485
- schema: r
1486
- } = t, n = {
1487
- ...r
1488
- };
1489
- for (const o of e)
1490
- delete n[o];
1491
- switch (t.type) {
1492
- case "type":
1493
- return wo(n);
1494
- default:
1495
- return w(n);
1496
- }
1497
- }
1498
- function T() {
1499
- return st("any", () => !0);
1500
- }
1501
- function P(t) {
1502
- return new X({
1503
- type: "array",
1504
- schema: t,
1505
- *entries(e) {
1506
- if (t && Array.isArray(e))
1507
- for (const [r, n] of e.entries())
1508
- yield [r, n, t];
1509
- },
1510
- coercer(e) {
1511
- return Array.isArray(e) ? e.slice() : e;
1512
- },
1513
- validator(e) {
1514
- return Array.isArray(e) || `Expected an array value, but received: ${U(e)}`;
1515
- }
1516
- });
1517
- }
1518
- function ft() {
1519
- return st("boolean", (t) => typeof t == "boolean");
1520
- }
1521
- function We(t) {
1522
- const e = {}, r = t.map((n) => U(n)).join();
1523
- for (const n of t)
1524
- e[n] = n;
1525
- return new X({
1526
- type: "enums",
1527
- schema: e,
1528
- validator(n) {
1529
- return t.includes(n) || `Expected one of \`${r}\`, but received: ${U(n)}`;
1530
- }
1531
- });
1532
- }
1533
- function jo() {
1534
- return st("func", (t) => typeof t == "function" || `Expected a function, but received: ${U(t)}`);
1535
- }
1536
- function L(t) {
1537
- const e = U(t), r = typeof t;
1538
- return new X({
1539
- type: "literal",
1540
- schema: r === "string" || r === "number" || r === "boolean" ? t : null,
1541
- validator(n) {
1542
- return n === t || `Expected the literal \`${e}\`, but received: ${U(n)}`;
1543
- }
1544
- });
1545
- }
1546
- function vf() {
1547
- return st("never", () => !1);
1548
- }
1549
- function Oo() {
1550
- return st("number", (t) => typeof t == "number" && !isNaN(t) || `Expected a number, but received: ${U(t)}`);
1551
- }
1552
- function w(t) {
1553
- const e = t ? Object.keys(t) : [], r = vf();
1554
- return new X({
1555
- type: "object",
1556
- schema: t || null,
1557
- *entries(n) {
1558
- if (t && W(n)) {
1559
- const o = new Set(Object.keys(n));
1560
- for (const a of e)
1561
- o.delete(a), yield [a, n[a], t[a]];
1562
- for (const a of o)
1563
- yield [a, n[a], r];
1564
- }
1565
- },
1566
- validator(n) {
1567
- return W(n) || `Expected an object, but received: ${U(n)}`;
1568
- },
1569
- coercer(n) {
1570
- return W(n) ? {
1571
- ...n
1572
- } : n;
1573
- }
1574
- });
1575
- }
1576
- function m(t) {
1577
- return new X({
1578
- ...t,
1579
- validator: (e, r) => e === void 0 || t.validator(e, r),
1580
- refiner: (e, r) => e === void 0 || t.refiner(e, r)
1581
- });
1582
- }
1583
- function Ht(t, e) {
1584
- return new X({
1585
- type: "record",
1586
- schema: null,
1587
- *entries(r) {
1588
- if (W(r))
1589
- for (const n in r) {
1590
- const o = r[n];
1591
- yield [n, n, t], yield [n, o, e];
1592
- }
1593
- },
1594
- validator(r) {
1595
- return W(r) || `Expected an object, but received: ${U(r)}`;
1596
- }
1597
- });
1598
- }
1599
- function v() {
1600
- return st("string", (t) => typeof t == "string" || `Expected a string, but received: ${U(t)}`);
1601
- }
1602
- function wo(t) {
1603
- const e = Object.keys(t);
1604
- return new X({
1605
- type: "type",
1606
- schema: t,
1607
- *entries(r) {
1608
- if (W(r))
1609
- for (const n of e)
1610
- yield [n, r[n], t[n]];
1611
- },
1612
- validator(r) {
1613
- return W(r) || `Expected an object, but received: ${U(r)}`;
1614
- }
1615
- });
1616
- }
1617
- function B(t) {
1618
- const e = t.map((r) => r.type).join(" | ");
1619
- return new X({
1620
- type: "union",
1621
- schema: null,
1622
- coercer(r, n) {
1623
- return (t.find((o) => {
1624
- const [a] = o.validate(r, {
1625
- coerce: !0
1626
- });
1627
- return !a;
1628
- }) || gf()).coercer(r, n);
1629
- },
1630
- validator(r, n) {
1631
- const o = [];
1632
- for (const a of t) {
1633
- const [...i] = wr(r, a, n), [s] = i;
1634
- if (s[0])
1635
- for (const [c] of i)
1636
- c && o.push(c);
1637
- else
1638
- return [];
1639
- }
1640
- return [`Expected the value to satisfy a union of \`${e}\`, but received: ${U(r)}`, ...o];
1641
- }
1642
- });
1643
- }
1644
- function gf() {
1645
- return st("unknown", () => !0);
1646
- }
1647
- const $r = w({
1648
- package: v(),
1649
- version: v(),
1650
- name: v(),
1651
- exportName: m(v()),
1652
- destructuring: m(ft()),
1653
- subName: m(v()),
1654
- main: m(v()),
1655
- cssPaths: m(P(v()))
1656
- }), yf = P($r), bf = [
1657
- "CBlock",
1658
- "CContainer",
1659
- "CImage",
1660
- "CCanvas",
1661
- "CVideo",
1662
- "CAudio",
1663
- "CText",
1664
- "CNativeTag"
1665
- ];
1666
- var G = /* @__PURE__ */ ((t) => (t.SLOT = "SLOT", t.FUNCTION = "FUNCTION", t.EXPRESSION = "EXPRESSION", t))(G || {}), Er = /* @__PURE__ */ ((t) => (t.DESIGN = "design", t.SAVE = "save", t))(Er || {}), Qe = /* @__PURE__ */ ((t) => (t.FUNC = "FUNC", t.COMP = "COMP", t))(Qe || {});
1667
- const _f = () => st("normalObj", (t) => !F(t) || [G.SLOT, G.EXPRESSION, G.FUNCTION].includes(t == null ? void 0 : t.type) ? !1 : (Mt(t, Ht(v(), Nr)), !0)), Nr = B([
1668
- v(),
1669
- Oo(),
1670
- ft(),
1671
- w({
1672
- type: L(G.SLOT),
1673
- renderType: We([Qe.FUNC, Qe.COMP]),
1674
- // if renderType is Func, params will be useful
1675
- params: m(P(v())),
1676
- // here can't use PropsDataStructDescribe, it will caused "Maximum call stack size exceeded" error
1677
- value: jt(() => B([Ot, P(Ot)]))
1678
- }),
1679
- w({
1680
- type: L(G.EXPRESSION),
1681
- value: v()
1682
- }),
1683
- w({
1684
- type: L(G.FUNCTION),
1685
- value: v()
1686
- }),
1687
- _f(),
1688
- P(
1689
- jt(() => Nr)
1690
- )
1691
- ]), mn = w({
1692
- type: L(G.EXPRESSION),
1693
- value: v()
1694
- }), Ot = w({
1695
- id: m(v()),
1696
- title: m(v()),
1697
- componentName: v(),
1698
- props: m(Ht(v(), Nr)),
1699
- nodeName: m(v()),
1700
- state: m(Ht(v(), T())),
1701
- children: jt(() => m(P(B([v(), Ot])))),
1702
- configure: m(T()),
1703
- css: m(T()),
1704
- style: m(T()),
1705
- classNames: m(P(T())),
1706
- refId: m(v()),
1707
- extra: m(Ht(T(), T())),
1708
- condition: m(B([ft(), mn])),
1709
- loop: m(
1710
- w({
1711
- open: ft(),
1712
- data: B([P(T()), mn]),
1713
- args: m(P(v())),
1714
- forName: m(v()),
1715
- forIndex: m(v()),
1716
- key: m(T()),
1717
- name: m(v())
1718
- })
1719
- ),
1720
- methods: m(P(T()))
1721
- }), pe = B([
1722
- v(),
1723
- w({
1724
- label: v(),
1725
- tip: m(v())
1726
- })
1727
- ]), Sf = w({
1728
- type: L(
1729
- "shape"
1730
- /* SHAPE */
1731
- ),
1732
- value: P(
1733
- w({
1734
- name: v(),
1735
- title: pe,
1736
- valueType: jt(() => Se)
1737
- })
1738
- )
1739
- }), jf = w({
1740
- type: L(
1741
- "enums"
1742
- /* ENUMS */
1743
- ),
1744
- value: P(v())
1745
- });
1746
- w({
1747
- type: L(
1748
- "array"
1749
- /* ARRAY */
1750
- ),
1751
- value: jt(() => Se)
1752
- });
1753
- const Of = w({
1754
- type: L(
1755
- "array"
1756
- /* ARRAY */
1757
- ),
1758
- value: jt(() => P(Se))
1759
- }), Se = B([
1760
- We([
1761
- "array",
1762
- "boolean",
1763
- "number",
1764
- "object",
1765
- "string"
1766
- /* STRING */
1767
- ]),
1768
- We([
1769
- "component",
1770
- "expression",
1771
- "function"
1772
- /* FUNCTION */
1773
- ]),
1774
- Sf,
1775
- jf,
1776
- Of
1777
- ]), wf = B([
1778
- v(),
1779
- w({
1780
- componentName: v(),
1781
- props: m(T()),
1782
- /** 用于标记当前数据的初始值,如添加一个数组元素可以使用该值填充 */
1783
- initialValue: m(T()),
1784
- component: m(T()),
1785
- hiddenLabel: m(ft())
1786
- })
1787
- ]), Pe = w({
1788
- name: v(),
1789
- title: pe,
1790
- // 描述 name 对应值的类型
1791
- valueType: Se,
1792
- description: m(v()),
1793
- defaultValue: T(),
1794
- //用于产生 valueType 类型的值
1795
- setters: m(P(wf)),
1796
- condition: m(jo())
1797
- });
1798
- B([v(), jo()]);
1799
- var qe = /* @__PURE__ */ ((t) => (t.SINGLE = "single", t.GROUP = "group", t))(qe || {});
1800
- B([
1801
- v(),
1802
- w({
1803
- name: v(),
1804
- describe: m(v()),
1805
- params: m(
1806
- w({
1807
- name: v(),
1808
- description: v()
1809
- })
1810
- ),
1811
- template: v()
1812
- })
1813
- ]);
1814
- const Cf = w({
1815
- id: m(v()),
1816
- title: v(),
1817
- snapshot: B([v(), T()]),
1818
- snapshotText: m(v()),
1819
- description: m(v()),
1820
- // 组件分类,用于搜索
1821
- tags: m(P(v())),
1822
- // 分 tab 面板
1823
- groupName: m(v()),
1824
- // 分类
1825
- category: m(v()),
1826
- schema: Cr(So(Ot, ["id"]), w({ componentName: m(v()) }))
1827
- }), $f = w({
1828
- componentName: v(),
1829
- title: v(),
1830
- screenshot: m(v()),
1831
- icon: m(v()),
1832
- // 组件分类,用于搜索
1833
- tags: m(P(v())),
1834
- // 分 tab 面板
1835
- groupName: m(v()),
1836
- // 分类
1837
- category: m(v()),
1838
- // 排序
1839
- priority: m(Oo()),
1840
- npm: m($r),
1841
- snippets: P(Cf),
1842
- props: P(
1843
- B([
1844
- Pe,
1845
- w({
1846
- title: m(pe),
1847
- type: L(
1848
- "single"
1849
- /* SINGLE */
1850
- ),
1851
- content: Pe
1852
- }),
1853
- w({
1854
- title: m(pe),
1855
- type: L(
1856
- "group"
1857
- /* GROUP */
1858
- ),
1859
- content: P(Pe)
1860
- })
1861
- ])
1862
- ),
1863
- fixedProps: m(T()),
1864
- // 可以拖入组件
1865
- isContainer: m(
1866
- B([
1867
- ft(),
1868
- w({
1869
- placeholder: v(),
1870
- width: v(),
1871
- height: v()
1872
- })
1873
- ])
1874
- ),
1875
- disableEditorDragDom: m(T()),
1876
- // 如果是布局组件,可以考虑将拖拽控制权转移 or 实现 resize
1877
- isLayout: m(ft()),
1878
- rootSelector: m(v()),
1879
- // selectionToolBarView: optional(func()),
1880
- advanceCustom: m(T()),
1881
- // 扩展配置
1882
- extra: m(Ht(T(), T()))
1883
- }), Ef = (t) => ({ data: e, message: r, throwError: n }) => {
1884
- const o = t({ data: e, message: r, throwError: n });
1885
- if (o.isValidate)
1886
- return o;
1887
- if (n)
1888
- throw o.message || r ? new Error(`${o.message || r}
1889
- originData: ${JSON.stringify(e)}`) : new Error(`${JSON.stringify(e)}
1890
- data struct format is invalidate`);
1891
- return o.message || r ? console.warn(`${o.message || r}
1892
- originData: ${JSON.stringify(e)}`) : console.warn(`${JSON.stringify(e)}
1893
- data struct format is invalidate`), o;
1894
- }, xr = (t) => {
1895
- const { data: e, message: r, throwError: n, dataStruct: o } = t;
1896
- return Ef(({ data: a }) => {
1897
- try {
1898
- return _o(a, o), {
1899
- isValidate: !0
1900
- };
1901
- } catch (i) {
1902
- let s = i;
1903
- return i instanceof bo && (s = i.failures().map((c) => `【${c.path.join(".")}】: ${c.message}
1904
- `)), {
1905
- isValidate: !1,
1906
- message: s,
1907
- error: i
1908
- };
1909
- }
1910
- })({ data: e, message: r, throwError: n });
1911
- };
1912
- var At = /* @__PURE__ */ ((t) => (t.ROOT_CONTAINER = "RootContainer", t))(At || {});
1913
- const Nf = w({
1914
- type: L(G.FUNCTION),
1915
- value: v()
1916
- }), xf = Cr(
1917
- So(Ot, ["componentName"]),
1918
- w({
1919
- componentName: L(
1920
- "RootContainer"
1921
- /* ROOT_CONTAINER */
1922
- )
1923
- })
1924
- );
1925
- function Tf(t) {
1926
- return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, r) {
1927
- var n = t.get(e);
1928
- n ? n.push(r) : t.set(e, [r]);
1929
- }, off: function(e, r) {
1930
- var n = t.get(e);
1931
- n && (r ? n.splice(n.indexOf(r) >>> 0, 1) : t.set(e, []));
1932
- }, emit: function(e, r) {
1933
- var n = t.get(e);
1934
- n && n.slice().map(function(o) {
1935
- o(r);
1936
- }), (n = t.get("*")) && n.slice().map(function(o) {
1937
- o(e, r);
1938
- });
1939
- } };
1940
- }
1941
- const ne = Tf(), Mf = (t, e) => {
1942
- const r = {
1943
- ...t,
1944
- value: []
1945
- }, n = t.value;
1946
- let o = new pt([]);
1947
- return e && (o = e.materialsMode || new pt([])), n && (R(n) ? r.value = n.map(
1948
- (a) => new M(a, {
1949
- parent: e,
1950
- materials: o
1951
- })
1952
- ) : F(n) && r.value.push(
1953
- new M(n, {
1954
- parent: e,
1955
- materials: o
1956
- })
1957
- )), r;
1958
- };
1959
- class wt {
1960
- constructor(e, r) {
1961
- _(this, "nodeType", "SLOT"), _(this, "rawData"), _(this, "parent"), _(this, "emitter", ne), _(this, "data"), _(this, "id"), _(this, "materialsMode"), this.parent = (r == null ? void 0 : r.parent) || null, this.rawData = e;
1962
- const n = (r == null ? void 0 : r.materials) || new pt([]);
1963
- this.materialsMode = n, this.id = Z(), this.data = Mf(e, this);
1964
- }
1965
- get value() {
1966
- return this.data;
1967
- }
1968
- export(e) {
1969
- const r = this.data, n = (o) => {
1970
- if (o instanceof M)
1971
- return o.export(e);
1972
- if (F(o)) {
1973
- const a = {};
1974
- return Object.keys(o || {}).forEach((i) => {
1975
- a[i] = n(o[i]);
1976
- }), a;
1977
- }
1978
- return R(o) ? o.map((a) => n(a)) : (e === "design" && delete o.id, o);
1979
- };
1980
- return n(r);
1981
- }
1982
- }
1983
- const Co = (t) => {
1984
- let e = [];
1985
- return t.forEach((r) => {
1986
- const n = r;
1987
- n.type ? n.type === qe.SINGLE ? e.push(n.content) : n.type === qe.GROUP && (e = [...e, ...Co(n.content)]) : e.push(r);
1988
- }), e;
1989
- }, Ye = (t, e, r) => {
1990
- if (t.type)
1991
- return t.type === G.SLOT ? new wt(t, { parent: e, materials: r }) : t;
1992
- if (F(t)) {
1993
- const n = {};
1994
- return Object.keys(t).forEach((o) => {
1995
- n[o] = Ke(t[o], e, r);
1996
- }), n;
1997
- } else
1998
- return Array.isArray(t) ? t.map((n) => Ye(n, e, r)) : t;
1999
- }, Ke = (t, e, r) => F(t) ? Ye(t, e, r) : R(t) ? t.map((n) => Ye(n, e, r)) : t;
2000
- class at {
2001
- constructor(e, r, n) {
2002
- _(this, "nodeType", "PROP"), _(this, "rawData"), _(this, "parent"), _(this, "emitter", ne), _(this, "data"), _(this, "name"), _(this, "materialsMode");
2003
- const o = (n == null ? void 0 : n.materials) || new pt([]);
2004
- this.materialsMode = o, this.parent = n == null ? void 0 : n.parent, this.rawData = r, this.name = e, this.data = Ke(r, this, o);
2005
- }
2006
- // TODO:
2007
- isIncludeSlot() {
2008
- return !1;
2009
- }
2010
- // TODO:
2011
- isIncludeExpression() {
2012
- return !1;
2013
- }
2014
- get value() {
2015
- return this.data;
2016
- }
2017
- updateValue(e) {
2018
- const r = this.data;
2019
- this.data = Ke(e ?? r, this, this.materialsMode), this.emitter.emit("onPropChange", {
2020
- value: this.data,
2021
- preValue: r,
2022
- node: this
2023
- }), this.parent && !(this.parent instanceof wt) && this.emitter.emit("onNodeChange", {
2024
- value: this.parent.value,
2025
- preValue: this.parent.value,
2026
- node: this.parent
2027
- });
2028
- }
2029
- get material() {
2030
- const e = this.parent;
2031
- if (e instanceof M) {
2032
- const r = e.material;
2033
- return Co((r == null ? void 0 : r.value.props) || []).find((n) => n.name === this.name);
2034
- } else
2035
- return null;
2036
- }
2037
- export(e) {
2038
- const r = this.data, n = (o) => {
2039
- if (o instanceof at || o instanceof wt || o instanceof M)
2040
- return o.export(e);
2041
- if (R(o))
2042
- return o.map((a) => n(a));
2043
- if (F(o)) {
2044
- const a = {};
2045
- return Object.keys(o || {}).forEach((i) => {
2046
- a[i] = n(o[i]);
2047
- }), a;
2048
- }
2049
- return o;
2050
- };
2051
- return n(r);
2052
- }
2053
- }
2054
- const Af = (t) => {
2055
- if (typeof t == "string")
2056
- return !0;
2057
- xr({
2058
- data: t,
2059
- dataStruct: Ot,
2060
- throwError: !1
2061
- });
2062
- }, vn = (t, e, r = new pt([])) => {
2063
- if (typeof t == "string")
2064
- return t;
2065
- const n = {
2066
- ...t,
2067
- id: t.id ?? Z(),
2068
- children: [],
2069
- props: {},
2070
- methods: t.methods || [],
2071
- configure: go(t.configure || {}, {
2072
- propsSetter: {},
2073
- advanceSetter: {}
2074
- })
2075
- }, o = Object.keys(t.props || {});
2076
- return o.length && o.forEach((a) => {
2077
- var i;
2078
- const s = (i = t.props) == null ? void 0 : i[a];
2079
- if (s instanceof at) {
2080
- n.props[a] = s;
2081
- return;
2082
- }
2083
- n.props[a] = new at(a, s || "", {
2084
- parent: e,
2085
- materials: r
2086
- });
2087
- }), t.children && (Array.isArray(t.children) ? n.children = t.children.map((a) => {
2088
- if (a instanceof M)
2089
- return a;
2090
- if (F(a)) {
2091
- const i = a;
2092
- return new M(i, {
2093
- parent: e,
2094
- materials: r
2095
- });
2096
- } else
2097
- return a;
2098
- }) : (t.children instanceof M && (n.children = [t.children]), n.children = [
2099
- new M(t.children, {
2100
- parent: e,
2101
- materials: r
2102
- })
2103
- ])), n;
2104
- };
2105
- class M {
2106
- constructor(e, r) {
2107
- _(this, "nodeType", "NODE"), _(this, "rawData"), _(this, "data"), _(this, "emitter", ne), _(this, "parent"), _(this, "materialsModel"), _(this, "listenerHandle"), _(this, "onChangeCbQueue"), this.rawData = JSON.parse(JSON.stringify(e)), Af(e);
2108
- const n = (r == null ? void 0 : r.materials) || new pt([]);
2109
- this.parent = (r == null ? void 0 : r.parent) || null, this.materialsModel = n, this.data = vn(e, this, n), this.listenerHandle = [], this.onChangeCbQueue = [], this.registerListener();
2110
- }
2111
- registerListener() {
2112
- const e = (r) => {
2113
- const { node: n } = r;
2114
- n === this && n.id === this.id && this.onChangeCbQueue.forEach((o) => o(r));
2115
- };
2116
- this.emitter.on("onNodeChange", e), this.listenerHandle.push(() => {
2117
- this.emitter.off("onNodeChange", e);
2118
- });
2119
- }
2120
- onChange(e) {
2121
- return this.onChangeCbQueue.push(e), () => {
2122
- this.onChangeCbQueue = this.onChangeCbQueue.filter((r) => r !== e);
2123
- };
2124
- }
2125
- destroy() {
2126
- this.listenerHandle.forEach((e) => e());
2127
- }
2128
- get id() {
2129
- return this.data.id;
2130
- }
2131
- get value() {
2132
- return this.data;
2133
- }
2134
- clone(e) {
2135
- const r = {
2136
- ...this.export("design"),
2137
- id: e || Z()
2138
- };
2139
- return new M(r, {
2140
- materials: this.materialsModel
2141
- });
2142
- }
2143
- updateWithPlainObj(e) {
2144
- const r = {
2145
- ...this.data,
2146
- ...e
2147
- };
2148
- return this.data = vn(r, this), r;
2149
- }
2150
- updateValue(e) {
2151
- const r = this.data, n = this.updateWithPlainObj(e);
2152
- this.emitter.emit("onNodeChange", {
2153
- value: n,
2154
- preValue: r,
2155
- node: this
2156
- });
2157
- }
2158
- contains(e) {
2159
- return Mr(this, e);
2160
- }
2161
- get props() {
2162
- return this.data.props;
2163
- }
2164
- get material() {
2165
- const e = this.materialsModel;
2166
- return e == null ? void 0 : e.findByComponentName(this.data.componentName);
2167
- }
2168
- getPlainProps() {
2169
- const e = this.data, r = {};
2170
- return Object.keys(e.props || {}).forEach((n) => {
2171
- r[n] = e.props[n].export("design");
2172
- }), r;
2173
- }
2174
- // 节点物料中的配置信息
2175
- getMaterialConfig(e) {
2176
- var r;
2177
- return this.data.configure[e] !== void 0 ? this.data.configure.isContainer : (r = this.material) == null ? void 0 : r.value.isContainer;
2178
- }
2179
- isContainer() {
2180
- return this.getMaterialConfig("isContainer");
2181
- }
2182
- export(e) {
2183
- var r;
2184
- const n = this.data;
2185
- if (typeof n == "string")
2186
- return n;
2187
- const o = {};
2188
- Object.keys(n.props || {}).forEach((p) => {
2189
- o[p] = n.props[p].export(e);
2190
- });
2191
- const a = (r = n.children) == null ? void 0 : r.map((p) => p instanceof M ? p.export(e) : p), i = n.configure || {}, s = i.propsSetter || {}, c = {};
2192
- Object.keys(s).forEach((p) => {
2193
- const l = Kn(s, p, !1);
2194
- l && (c[p] = l);
2195
- }), i.propsSetter = c;
2196
- const u = this.materialsModel.usedMaterials.find(
2197
- (p) => {
2198
- var l;
2199
- return p.componentName === ((l = this.material) == null ? void 0 : l.componentName);
2200
- }
2201
- );
2202
- this.material && !u && this.materialsModel.usedMaterials.push(this.material);
2203
- let f = {
2204
- ...n,
2205
- configure: i,
2206
- props: o,
2207
- children: a,
2208
- condition: n.condition
2209
- };
2210
- return e === "design" && delete f.id, f = Tr(f), f;
2211
- }
2212
- }
2213
- const gn = (t, e, r) => {
2214
- const n = {
2215
- ...t,
2216
- id: Z(),
2217
- props: {},
2218
- componentName: At.ROOT_CONTAINER,
2219
- children: [],
2220
- methods: t.methods || [],
2221
- configure: go(t.configure || {}, {
2222
- propsSetter: {},
2223
- advanceSetter: {}
2224
- })
2225
- };
2226
- let o = [];
2227
- R(t.children) ? o = t.children.map((i) => i instanceof M ? i : F(i) ? new M(i, { parent: e, materials: r }) : i) : t.children instanceof M ? o.push(t.children) : t.children && F(t.children) && o.push(new M(t.children, { parent: e, materials: r }));
2228
- const a = Object.keys(t.props || {});
2229
- return a.length && a.forEach((i) => {
2230
- var s;
2231
- const c = (s = t.props) == null ? void 0 : s[i];
2232
- c instanceof at ? n.props[i] = c : n.props[i] = new at(i, c || "", {
2233
- parent: e,
2234
- materials: r
2235
- });
2236
- }), n.children = o, n;
2237
- };
2238
- class Zt {
2239
- constructor(e, { parent: r, materials: n }) {
2240
- _(this, "rawData"), _(this, "data"), _(this, "nodeType", At.ROOT_CONTAINER), _(this, "emitter", ne), _(this, "materialsModel"), _(this, "listenerHandle"), _(this, "onChangeCbQueue"), _(this, "parent"), this.materialsModel = n, this.rawData = JSON.parse(JSON.stringify(e)), this.data = gn(e, this, n), this.listenerHandle = [], this.onChangeCbQueue = [], this.registerListener(), this.parent = r;
2241
- }
2242
- registerListener() {
2243
- const e = (r) => {
2244
- const { node: n } = r;
2245
- n === this && n.id === this.id && this.onChangeCbQueue.forEach((o) => o(r));
2246
- };
2247
- this.emitter.on("onNodeChange", e), this.listenerHandle.push(() => {
2248
- this.emitter.off("onNodeChange", e);
2249
- });
2250
- }
2251
- onChange(e) {
2252
- return this.onChangeCbQueue.push(e), () => {
2253
- this.onChangeCbQueue = this.onChangeCbQueue.filter((r) => r !== e);
2254
- };
2255
- }
2256
- get id() {
2257
- return this.data.id;
2258
- }
2259
- get value() {
2260
- return this.data;
2261
- }
2262
- get props() {
2263
- return this.data.props;
2264
- }
2265
- get material() {
2266
- const e = this.materialsModel;
2267
- return e == null ? void 0 : e.findByComponentName(this.data.componentName);
2268
- }
2269
- updateWithPlainObj(e) {
2270
- const r = {
2271
- ...this.data,
2272
- ...e
2273
- };
2274
- return this.data = gn(r, this, this.materialsModel), r;
2275
- }
2276
- updateValue(e) {
2277
- const r = this.data;
2278
- this.updateWithPlainObj(e), this.emitter.emit("onNodeChange", {
2279
- value: this.data,
2280
- preValue: r,
2281
- node: this
2282
- });
2283
- }
2284
- contains(e) {
2285
- return Mr(this, e);
2286
- }
2287
- /**
2288
- * 从物料 和 node config 中获取合并后的属性,node 中的配置优先级更高
2289
- * @param key 目前只支持 isContainer 属性
2290
- * @returns
2291
- */
2292
- getMaterialConfig(e) {
2293
- var r;
2294
- return this.data.configure[e] !== void 0 ? this.data.configure.isContainer : (r = this.material) == null ? void 0 : r.value.isContainer;
2295
- }
2296
- isContainer() {
2297
- return this.getMaterialConfig("isContainer");
2298
- }
2299
- export(e = Er.SAVE) {
2300
- var r;
2301
- const n = this.data, o = {};
2302
- Object.keys(n.props || {}).forEach((c) => {
2303
- o[c] = n.props[c].export(e);
2304
- });
2305
- const a = ((r = n.children) == null ? void 0 : r.map((c) => {
2306
- var u;
2307
- return (u = c == null ? void 0 : c.export) == null ? void 0 : u.call(c, e);
2308
- })) || [], i = {
2309
- ...n,
2310
- props: o,
2311
- children: a.filter((c) => c),
2312
- condition: n.condition
2313
- };
2314
- let s = yo(i, ["id"]);
2315
- return s = Tr(s), s;
2316
- }
2317
- getPlainProps() {
2318
- const e = this.data, r = {};
2319
- return Object.keys(e.props || {}).forEach((n) => {
2320
- r[n] = e.props[n].export("design");
2321
- }), r;
2322
- }
2323
- destroy() {
2324
- this.listenerHandle.forEach((e) => e());
2325
- }
2326
- clone(e) {
2327
- const r = {
2328
- ...this.export("design"),
2329
- id: e || Z()
2330
- };
2331
- return new Zt(r, {
2332
- materials: this.materialsModel,
2333
- parent: null
2334
- });
2335
- }
2336
- }
2337
- const ct = (t) => (t == null ? void 0 : t.type) === G.EXPRESSION, Pf = (t) => (t == null ? void 0 : t.type) === G.FUNCTION, Z = () => Math.random().toString(32).slice(3, 9), Rf = (t) => (t == null ? void 0 : t.nodeType) === "NODE", Re = (t) => (t == null ? void 0 : t.nodeType) === "PROP", If = (t) => (t == null ? void 0 : t.nodeType) === "SLOT", Tr = (t) => ef(t, (e) => F(e) ? !Object.keys(e).length : R(e) ? !e.length : !e);
2338
- function Df(t, e) {
2339
- const r = [t];
2340
- for (; r.length; ) {
2341
- const n = r.shift();
2342
- if (n && e(n))
2343
- return n;
2344
- const o = (n == null ? void 0 : n.props) || {}, a = (s) => {
2345
- if (s instanceof M) {
2346
- r.push(s);
2347
- return;
2348
- }
2349
- if (s instanceof wt && a(s.value.value), s instanceof at) {
2350
- a(s.value);
2351
- return;
2352
- }
2353
- if (F(s)) {
2354
- const c = s;
2355
- Object.keys(c).forEach((u) => {
2356
- a(c[u]);
2357
- });
2358
- return;
2359
- }
2360
- if (R(s)) {
2361
- s.forEach((c) => {
2362
- a(c);
2363
- });
2364
- return;
2365
- }
2366
- };
2367
- a(o);
2368
- const i = (n == null ? void 0 : n.value.children.filter((s) => s instanceof M)) || [];
2369
- r.push(...i);
2370
- }
2371
- }
2372
- function Mr(t, e) {
2373
- return Df(t, (r) => r.id === e);
2374
- }
2375
- const Lf = (t) => {
2376
- const e = uo(t), r = e.snippets;
2377
- return delete e.snippets, e.snippets = r.map((n) => ({
2378
- ...e,
2379
- ...n,
2380
- id: n.id || `${t.componentName}-${Z()}`,
2381
- title: n.title || t.title,
2382
- category: n.category || t.category,
2383
- tags: [...n.tags || [], ...t.tags || []],
2384
- groupName: n.groupName || t.groupName,
2385
- snapshot: n.snapshot || t.icon,
2386
- snapshotText: n.snapshotText,
2387
- schema: {
2388
- ...n.schema,
2389
- componentName: n.schema.componentName || t.componentName
2390
- }
2391
- })), e;
2392
- };
2393
- class Bf {
2394
- constructor(e) {
2395
- _(this, "rawData"), _(this, "data"), this.rawData = e, this.data = Lf(e);
2396
- }
2397
- get value() {
2398
- return this.data;
2399
- }
2400
- get rawValue() {
2401
- return this.rawData;
2402
- }
2403
- get componentName() {
2404
- return this.data.componentName;
2405
- }
2406
- get snippets() {
2407
- return this.data.snippets;
2408
- }
2409
- getSnippetById(e) {
2410
- return this.data.snippets.find((r) => r.id === e);
2411
- }
2412
- }
2413
- const Ie = (t) => {
2414
- if (!R(t))
2415
- throw new Error("Materials must be a array");
2416
- return t.map((e) => new Bf(e));
2417
- }, Ff = (t) => {
2418
- t == null || t.forEach((e) => {
2419
- xr({
2420
- data: e,
2421
- dataStruct: $f,
2422
- throwError: !1
2423
- });
2424
- });
2425
- };
2426
- class pt {
2427
- constructor(e) {
2428
- _(this, "rawData"), _(this, "data"), _(this, "usedMaterials", []), this.rawData = e, Ff(e), this.data = Ie(e);
2429
- }
2430
- addMaterials(e) {
2431
- const r = Ie(e), n = [], o = this.data.map((i) => {
2432
- const s = r.findIndex((c) => c.componentName === i.componentName);
2433
- return s >= 0 ? (n.push(s), r[s]) : i;
2434
- }), a = r.filter((i, s) => !n.includes(s));
2435
- this.data = [...o, ...a];
2436
- }
2437
- // 使用新的物料整个替换现有的物料列表
2438
- replaceMaterials(e) {
2439
- const r = Ie(e);
2440
- this.data = [...r];
2441
- }
2442
- removeMaterial(e) {
2443
- const r = this.data.filter((n) => !e.includes(n.componentName));
2444
- this.data = r;
2445
- }
2446
- findByComponentName(e) {
2447
- return this.data.find((r) => r.componentName === e);
2448
- }
2449
- findSnippetById(e) {
2450
- const r = [...this.data];
2451
- let n = null;
2452
- for (; !n && r.length; ) {
2453
- const o = r.pop();
2454
- n = o == null ? void 0 : o.getSnippetById(e);
2455
- }
2456
- return n;
2457
- }
2458
- getAllSnippets() {
2459
- const e = this.data.reduce((a, i) => (a.push(...i.snippets), a), []), r = [], n = {
2460
- default: []
2461
- };
2462
- e.forEach((a) => {
2463
- const i = a.groupName || "default";
2464
- r.includes(i) || (r.push(i), n[i] = []), n[i].push(a);
2465
- });
2466
- let o = [];
2467
- return r.forEach((a) => {
2468
- const i = ["default"], s = {
2469
- default: []
2470
- }, c = n[a];
2471
- if (c.length !== 0) {
2472
- c.forEach((p) => {
2473
- const l = p.category || "default";
2474
- i.includes(l) || (i.push(l), s[l] = []), s[l].push(p);
2475
- });
2476
- const u = [];
2477
- i.forEach((p) => {
2478
- s[p].length && u.push({
2479
- name: p,
2480
- list: s[p]
2481
- });
2482
- });
2483
- const f = {
2484
- name: a,
2485
- list: u
2486
- };
2487
- o.push(f);
2488
- }
2489
- }), o = o.sort((a, i) => (a.name || "") > (i.name || "") ? 1 : -1), o;
2490
- }
2491
- get value() {
2492
- return this.data;
2493
- }
2494
- get rawValue() {
2495
- return this.rawData;
2496
- }
2497
- }
2498
- const Uf = w({
2499
- version: v(),
2500
- name: v(),
2501
- css: m(v()),
2502
- renderType: m(B([L(
2503
- "COMPONENT"
2504
- /* COMPONENT */
2505
- ), L(
2506
- "PAGE"
2507
- /* PAGE */
2508
- )])),
2509
- loadType: m(T()),
2510
- lifecycle: m(T()),
2511
- props: m(T()),
2512
- methods: m(P(Nf)),
2513
- componentsMeta: P(
2514
- Cr(
2515
- w({
2516
- componentName: v()
2517
- }),
2518
- $r
2519
- )
2520
- ),
2521
- thirdLibs: m(yf),
2522
- componentsTree: xf,
2523
- assets: m(P(T()))
2524
- }), $o = (t) => (xr({
2525
- data: t,
2526
- dataStruct: Uf,
2527
- throwError: !1
2528
- }), t), De = (t, e, r) => ({
2529
- ...t,
2530
- componentsTree: new Zt(t.componentsTree, {
2531
- parent: e,
2532
- materials: r
2533
- })
2534
- });
2535
- class de {
2536
- constructor(e, r) {
2537
- _(this, "nodeType", "PAGE"), _(this, "rawData"), _(this, "emitter", ne), _(this, "data"), _(this, "parent"), _(this, "materialsModel"), _(this, "assetPackagesList"), $o(e), this.rawData = JSON.parse(JSON.stringify(e)), this.materialsModel = new pt((r == null ? void 0 : r.materials) || []), this.data = De(e, this, this.materialsModel), this.assetPackagesList = [...(r == null ? void 0 : r.assetPackagesList) || [], ...this.data.assets || []];
2538
- }
2539
- updatePage(e) {
2540
- const r = this.data;
2541
- this.rawData = JSON.parse(JSON.stringify(e)), this.data = De(e, this, this.materialsModel), this.emitter.emit("onPageChange", {
2542
- value: this.data,
2543
- preValue: r,
2544
- node: this
2545
- });
2546
- }
2547
- reloadPage(e) {
2548
- const r = this.data;
2549
- e && (this.rawData = JSON.parse(JSON.stringify(e)), this.data = De(e, this, this.materialsModel)), this.emitter.emit("onReloadPage", {
2550
- value: this.data,
2551
- preValue: r,
2552
- node: this
2553
- });
2554
- }
2555
- get value() {
2556
- return this.data;
2557
- }
2558
- // moveNode(from, to, pos) {}
2559
- getNode(e) {
2560
- if (!e)
2561
- return;
2562
- const r = this.data.componentsTree;
2563
- return Mr(r, e);
2564
- }
2565
- addNode(e, r, n = "AFTER") {
2566
- var o;
2567
- if (n === "AFTER" || n === "BEFORE") {
2568
- const a = r.parent;
2569
- if (a === null && r instanceof Zt)
2570
- return console.warn("Not found parent node"), !1;
2571
- if (a instanceof at)
2572
- return console.warn("CProp can not add node"), !1;
2573
- if (a instanceof wt) {
2574
- const s = a.value.value, c = s.findIndex((u) => u === r) ?? -1;
2575
- return c >= 0 ? (n === "BEFORE" ? s.splice(c, 0, e) : s.splice(c + 1, 0, e), e.parent = a, (o = a.parent) == null || o.updateValue(), !0) : !1;
2576
- }
2577
- if (a instanceof de)
2578
- return !1;
2579
- const i = (a == null ? void 0 : a.value.children.findIndex((s) => s === r)) ?? -1;
2580
- return i >= 0 ? (n === "BEFORE" ? a == null || a.value.children.splice(i, 0, e) : a == null || a.value.children.splice(i + 1, 0, e), e.parent = a, a == null || a.updateValue(), !0) : (console.warn("Not found target node"), !1);
2581
- }
2582
- if (n === "CHILD_START")
2583
- return r.value.children.unshift(e), e.parent = r, r.updateValue(), !0;
2584
- if (n === "CHILD_END")
2585
- return r.value.children.push(e), e.parent = r, r.updateValue(), !0;
2586
- if (F(n)) {
2587
- const a = n;
2588
- if (a.type === "CHILD") {
2589
- const i = a.pos, s = a.index || 0;
2590
- return i === "BEFORE" ? r == null || r.value.children.splice(s, 0, e) : r == null || r.value.children.splice(s + 1, 0, e), e.parent = r, r.updateValue(), !0;
2591
- } else
2592
- console.warn("Can not parse pos obj");
2593
- }
2594
- return !1;
2595
- }
2596
- createNode(e) {
2597
- return delete e.id, new M(e, {
2598
- parent: null,
2599
- materials: this.materialsModel
2600
- });
2601
- }
2602
- addNodeById(e, r, n = "AFTER") {
2603
- const o = this.getNode(r);
2604
- return o ? this.addNode(e, o, n) : (console.warn(`Not find a node by ${r}, pls check it`), !1);
2605
- }
2606
- copyNode(e) {
2607
- const r = e.export("design");
2608
- r.id = Z();
2609
- const n = new M(r, {
2610
- parent: e.parent,
2611
- materials: this.materialsModel
2612
- });
2613
- return this.addNode(n, e, "AFTER"), n;
2614
- }
2615
- copyNodeById(e) {
2616
- const r = this.getNode(e);
2617
- return r && r instanceof M ? this.copyNode(r) : !1;
2618
- }
2619
- moveNode(e, r, n) {
2620
- this.deleteNode(e);
2621
- let o = r;
2622
- return ["AFTER", "BEFORE"].includes(n) && (o = r.parent), e.parent = o, this.addNode(e, r, n);
2623
- }
2624
- moveNodeById(e, r, n) {
2625
- const o = this.getNode(e), a = this.getNode(r);
2626
- return o && a && o instanceof M && a instanceof M ? this.moveNode(o, a, n) : !1;
2627
- }
2628
- // replaceNode(targetNode, node) {}
2629
- deleteNode(e) {
2630
- var r;
2631
- const n = e.parent;
2632
- if (!n)
2633
- throw new Error("parent node is null or undefined, pls check it");
2634
- if (n instanceof wt) {
2635
- const o = n.value.value, a = o.findIndex((s) => s === e), i = o[a];
2636
- return o.splice(a, 1), (r = n.parent) == null || r.updateValue(), i;
2637
- }
2638
- if (n instanceof M || n instanceof Zt) {
2639
- const o = n.value.children, a = o.findIndex((s) => s === e), i = o[a];
2640
- return o.splice(a, 1), n.updateValue(), i;
2641
- }
2642
- }
2643
- deleteNodeById(e) {
2644
- const r = this.getNode(e);
2645
- if (r)
2646
- return this.deleteNode(r);
2647
- }
2648
- export(e = Er.SAVE) {
2649
- var r;
2650
- const n = this.data.componentsTree.export(e), o = this.assetPackagesList, a = [], i = this.materialsModel.usedMaterials.map((c) => {
2651
- const u = o.find((f) => {
2652
- var p;
2653
- return f.package === ((p = c.value.npm) == null ? void 0 : p.package);
2654
- });
2655
- return u && a.push(u), {
2656
- componentName: c.componentName,
2657
- ...uo(c.value.npm || {})
2658
- };
2659
- }).filter((c) => c.componentName && c.package && c.version ? !0 : (console.warn(`${c} not a valid material info`), !1));
2660
- this.materialsModel.usedMaterials = [];
2661
- let s = {
2662
- ...this.data,
2663
- componentsTree: Tr(n),
2664
- componentsMeta: i,
2665
- thirdLibs: this.data.thirdLibs,
2666
- assets: []
2667
- };
2668
- return (r = this.data.thirdLibs) == null || r.forEach((c) => {
2669
- const u = o.find((f) => c.package === f.package);
2670
- u && a.push(u);
2671
- }), s.assets = uf(a, (c) => c.package), s = yo(s, ["id"]), JSON.parse(JSON.stringify(s));
2672
- }
2673
- getRootNode() {
2674
- return this.data.componentsTree;
2675
- }
2676
- }
2677
- At.ROOT_CONTAINER;
2678
- var kf = typeof global == "object" && global && global.Object === Object && global;
2679
- const Eo = kf;
2680
- var Gf = typeof self == "object" && self && self.Object === Object && self, Vf = Eo || Gf || Function("return this")();
2681
- const Pt = Vf;
2682
- var zf = Pt.Symbol;
2683
- const Ct = zf;
2684
- var No = Object.prototype, Hf = No.hasOwnProperty, Jf = No.toString, Gt = Ct ? Ct.toStringTag : void 0;
2685
- function Wf(t) {
2686
- var e = Hf.call(t, Gt), r = t[Gt];
2687
- try {
2688
- t[Gt] = void 0;
2689
- var n = !0;
2690
- } catch {
2691
- }
2692
- var o = Jf.call(t);
2693
- return n && (e ? t[Gt] = r : delete t[Gt]), o;
2694
- }
2695
- var Qf = Object.prototype, qf = Qf.toString;
2696
- function Yf(t) {
2697
- return qf.call(t);
2698
- }
2699
- var Kf = "[object Null]", Xf = "[object Undefined]", yn = Ct ? Ct.toStringTag : void 0;
2700
- function oe(t) {
2701
- return t == null ? t === void 0 ? Xf : Kf : yn && yn in Object(t) ? Wf(t) : Yf(t);
2702
- }
2703
- function Rt(t) {
2704
- return t != null && typeof t == "object";
2705
- }
2706
- var Zf = "[object Symbol]";
2707
- function tp(t) {
2708
- return typeof t == "symbol" || Rt(t) && oe(t) == Zf;
2709
- }
2710
- function ep(t, e) {
2711
- for (var r = -1, n = t == null ? 0 : t.length, o = Array(n); ++r < n; )
2712
- o[r] = e(t[r], r, t);
2713
- return o;
2714
- }
2715
- var rp = Array.isArray;
2716
- const $t = rp;
2717
- var np = 1 / 0, bn = Ct ? Ct.prototype : void 0, _n = bn ? bn.toString : void 0;
2718
- function xo(t) {
2719
- if (typeof t == "string")
2720
- return t;
2721
- if ($t(t))
2722
- return ep(t, xo) + "";
2723
- if (tp(t))
2724
- return _n ? _n.call(t) : "";
2725
- var e = t + "";
2726
- return e == "0" && 1 / t == -np ? "-0" : e;
2727
- }
2728
- function gt(t) {
2729
- var e = typeof t;
2730
- return t != null && (e == "object" || e == "function");
2731
- }
2732
- function To(t) {
2733
- return t;
2734
- }
2735
- var op = "[object AsyncFunction]", ap = "[object Function]", sp = "[object GeneratorFunction]", ip = "[object Proxy]";
2736
- function Ar(t) {
2737
- if (!gt(t))
2738
- return !1;
2739
- var e = oe(t);
2740
- return e == ap || e == sp || e == op || e == ip;
2741
- }
2742
- var cp = Pt["__core-js_shared__"];
2743
- const Le = cp;
2744
- var Sn = function() {
2745
- var t = /[^.]+$/.exec(Le && Le.keys && Le.keys.IE_PROTO || "");
2746
- return t ? "Symbol(src)_1." + t : "";
2747
- }();
2748
- function up(t) {
2749
- return !!Sn && Sn in t;
2750
- }
2751
- var lp = Function.prototype, fp = lp.toString;
2752
- function pp(t) {
2753
- if (t != null) {
2754
- try {
2755
- return fp.call(t);
2756
- } catch {
2757
- }
2758
- try {
2759
- return t + "";
2760
- } catch {
2761
- }
2762
- }
2763
- return "";
2764
- }
2765
- var dp = /[\\^$.*+?()[\]{}|]/g, hp = /^\[object .+?Constructor\]$/, mp = Function.prototype, vp = Object.prototype, gp = mp.toString, yp = vp.hasOwnProperty, bp = RegExp(
2766
- "^" + gp.call(yp).replace(dp, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2767
- );
2768
- function _p(t) {
2769
- if (!gt(t) || up(t))
2770
- return !1;
2771
- var e = Ar(t) ? bp : hp;
2772
- return e.test(pp(t));
2773
- }
2774
- function Sp(t, e) {
2775
- return t == null ? void 0 : t[e];
2776
- }
2777
- function Pr(t, e) {
2778
- var r = Sp(t, e);
2779
- return _p(r) ? r : void 0;
2780
- }
2781
- var jn = Object.create, jp = function() {
2782
- function t() {
2783
- }
2784
- return function(e) {
2785
- if (!gt(e))
2786
- return {};
2787
- if (jn)
2788
- return jn(e);
2789
- t.prototype = e;
2790
- var r = new t();
2791
- return t.prototype = void 0, r;
2792
- };
2793
- }();
2794
- const Op = jp;
2795
- function wp(t, e, r) {
2796
- switch (r.length) {
2797
- case 0:
2798
- return t.call(e);
2799
- case 1:
2800
- return t.call(e, r[0]);
2801
- case 2:
2802
- return t.call(e, r[0], r[1]);
2803
- case 3:
2804
- return t.call(e, r[0], r[1], r[2]);
2805
- }
2806
- return t.apply(e, r);
2807
- }
2808
- function Cp(t, e) {
2809
- var r = -1, n = t.length;
2810
- for (e || (e = Array(n)); ++r < n; )
2811
- e[r] = t[r];
2812
- return e;
2813
- }
2814
- var $p = 800, Ep = 16, Np = Date.now;
2815
- function xp(t) {
2816
- var e = 0, r = 0;
2817
- return function() {
2818
- var n = Np(), o = Ep - (n - r);
2819
- if (r = n, o > 0) {
2820
- if (++e >= $p)
2821
- return arguments[0];
2822
- } else
2823
- e = 0;
2824
- return t.apply(void 0, arguments);
2825
- };
2826
- }
2827
- function Tp(t) {
2828
- return function() {
2829
- return t;
2830
- };
2831
- }
2832
- var Mp = function() {
2833
- try {
2834
- var t = Pr(Object, "defineProperty");
2835
- return t({}, "", {}), t;
2836
- } catch {
2837
- }
2838
- }();
2839
- const he = Mp;
2840
- var Ap = he ? function(t, e) {
2841
- return he(t, "toString", {
2842
- configurable: !0,
2843
- enumerable: !1,
2844
- value: Tp(e),
2845
- writable: !0
2846
- });
2847
- } : To;
2848
- const Pp = Ap;
2849
- var Rp = xp(Pp);
2850
- const Ip = Rp;
2851
- var Dp = 9007199254740991, Lp = /^(?:0|[1-9]\d*)$/;
2852
- function Mo(t, e) {
2853
- var r = typeof t;
2854
- return e = e ?? Dp, !!e && (r == "number" || r != "symbol" && Lp.test(t)) && t > -1 && t % 1 == 0 && t < e;
2855
- }
2856
- function Rr(t, e, r) {
2857
- e == "__proto__" && he ? he(t, e, {
2858
- configurable: !0,
2859
- enumerable: !0,
2860
- value: r,
2861
- writable: !0
2862
- }) : t[e] = r;
2863
- }
2864
- function je(t, e) {
2865
- return t === e || t !== t && e !== e;
2866
- }
2867
- var Bp = Object.prototype, Fp = Bp.hasOwnProperty;
2868
- function Up(t, e, r) {
2869
- var n = t[e];
2870
- (!(Fp.call(t, e) && je(n, r)) || r === void 0 && !(e in t)) && Rr(t, e, r);
2871
- }
2872
- function kp(t, e, r, n) {
2873
- var o = !r;
2874
- r || (r = {});
2875
- for (var a = -1, i = e.length; ++a < i; ) {
2876
- var s = e[a], c = n ? n(r[s], t[s], s, r, t) : void 0;
2877
- c === void 0 && (c = t[s]), o ? Rr(r, s, c) : Up(r, s, c);
2878
- }
2879
- return r;
2880
- }
2881
- var On = Math.max;
2882
- function Gp(t, e, r) {
2883
- return e = On(e === void 0 ? t.length - 1 : e, 0), function() {
2884
- for (var n = arguments, o = -1, a = On(n.length - e, 0), i = Array(a); ++o < a; )
2885
- i[o] = n[e + o];
2886
- o = -1;
2887
- for (var s = Array(e + 1); ++o < e; )
2888
- s[o] = n[o];
2889
- return s[e] = r(i), wp(t, this, s);
2890
- };
2891
- }
2892
- function Vp(t, e) {
2893
- return Ip(Gp(t, e, To), t + "");
2894
- }
2895
- var zp = 9007199254740991;
2896
- function Ao(t) {
2897
- return typeof t == "number" && t > -1 && t % 1 == 0 && t <= zp;
2898
- }
2899
- function Ir(t) {
2900
- return t != null && Ao(t.length) && !Ar(t);
2901
- }
2902
- function Hp(t, e, r) {
2903
- if (!gt(r))
2904
- return !1;
2905
- var n = typeof e;
2906
- return (n == "number" ? Ir(r) && Mo(e, r.length) : n == "string" && e in r) ? je(r[e], t) : !1;
2907
- }
2908
- function Jp(t) {
2909
- return Vp(function(e, r) {
2910
- var n = -1, o = r.length, a = o > 1 ? r[o - 1] : void 0, i = o > 2 ? r[2] : void 0;
2911
- for (a = t.length > 3 && typeof a == "function" ? (o--, a) : void 0, i && Hp(r[0], r[1], i) && (a = o < 3 ? void 0 : a, o = 1), e = Object(e); ++n < o; ) {
2912
- var s = r[n];
2913
- s && t(e, s, n, a);
2914
- }
2915
- return e;
2916
- });
2917
- }
2918
- var Wp = Object.prototype;
2919
- function Po(t) {
2920
- var e = t && t.constructor, r = typeof e == "function" && e.prototype || Wp;
2921
- return t === r;
2922
- }
2923
- function Qp(t, e) {
2924
- for (var r = -1, n = Array(t); ++r < t; )
2925
- n[r] = e(r);
2926
- return n;
2927
- }
2928
- var qp = "[object Arguments]";
2929
- function wn(t) {
2930
- return Rt(t) && oe(t) == qp;
2931
- }
2932
- var Ro = Object.prototype, Yp = Ro.hasOwnProperty, Kp = Ro.propertyIsEnumerable, Xp = wn(function() {
2933
- return arguments;
2934
- }()) ? wn : function(t) {
2935
- return Rt(t) && Yp.call(t, "callee") && !Kp.call(t, "callee");
2936
- };
2937
- const Xe = Xp;
2938
- function Zp() {
2939
- return !1;
2940
- }
2941
- var Io = typeof exports == "object" && exports && !exports.nodeType && exports, Cn = Io && typeof module == "object" && module && !module.nodeType && module, td = Cn && Cn.exports === Io, $n = td ? Pt.Buffer : void 0, ed = $n ? $n.isBuffer : void 0, rd = ed || Zp;
2942
- const Do = rd;
2943
- var nd = "[object Arguments]", od = "[object Array]", ad = "[object Boolean]", sd = "[object Date]", id = "[object Error]", cd = "[object Function]", ud = "[object Map]", ld = "[object Number]", fd = "[object Object]", pd = "[object RegExp]", dd = "[object Set]", hd = "[object String]", md = "[object WeakMap]", vd = "[object ArrayBuffer]", gd = "[object DataView]", yd = "[object Float32Array]", bd = "[object Float64Array]", _d = "[object Int8Array]", Sd = "[object Int16Array]", jd = "[object Int32Array]", Od = "[object Uint8Array]", wd = "[object Uint8ClampedArray]", Cd = "[object Uint16Array]", $d = "[object Uint32Array]", N = {};
2944
- N[yd] = N[bd] = N[_d] = N[Sd] = N[jd] = N[Od] = N[wd] = N[Cd] = N[$d] = !0;
2945
- N[nd] = N[od] = N[vd] = N[ad] = N[gd] = N[sd] = N[id] = N[cd] = N[ud] = N[ld] = N[fd] = N[pd] = N[dd] = N[hd] = N[md] = !1;
2946
- function Ed(t) {
2947
- return Rt(t) && Ao(t.length) && !!N[oe(t)];
2948
- }
2949
- function Nd(t) {
2950
- return function(e) {
2951
- return t(e);
2952
- };
2953
- }
2954
- var Lo = typeof exports == "object" && exports && !exports.nodeType && exports, Jt = Lo && typeof module == "object" && module && !module.nodeType && module, xd = Jt && Jt.exports === Lo, Be = xd && Eo.process, Td = function() {
2955
- try {
2956
- var t = Jt && Jt.require && Jt.require("util").types;
2957
- return t || Be && Be.binding && Be.binding("util");
2958
- } catch {
2959
- }
2960
- }();
2961
- const En = Td;
2962
- var Nn = En && En.isTypedArray, Md = Nn ? Nd(Nn) : Ed;
2963
- const Bo = Md;
2964
- var Ad = Object.prototype, Pd = Ad.hasOwnProperty;
2965
- function Rd(t, e) {
2966
- var r = $t(t), n = !r && Xe(t), o = !r && !n && Do(t), a = !r && !n && !o && Bo(t), i = r || n || o || a, s = i ? Qp(t.length, String) : [], c = s.length;
2967
- for (var u in t)
2968
- (e || Pd.call(t, u)) && !(i && // Safari 9 has enumerable `arguments.length` in strict mode.
2969
- (u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2970
- o && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2971
- a && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
2972
- Mo(u, c))) && s.push(u);
2973
- return s;
2974
- }
2975
- function Id(t, e) {
2976
- return function(r) {
2977
- return t(e(r));
2978
- };
2979
- }
2980
- function Dd(t) {
2981
- var e = [];
2982
- if (t != null)
2983
- for (var r in Object(t))
2984
- e.push(r);
2985
- return e;
2986
- }
2987
- var Ld = Object.prototype, Bd = Ld.hasOwnProperty;
2988
- function Fd(t) {
2989
- if (!gt(t))
2990
- return Dd(t);
2991
- var e = Po(t), r = [];
2992
- for (var n in t)
2993
- n == "constructor" && (e || !Bd.call(t, n)) || r.push(n);
2994
- return r;
2995
- }
2996
- function Fo(t) {
2997
- return Ir(t) ? Rd(t, !0) : Fd(t);
2998
- }
2999
- var Ud = Pr(Object, "create");
3000
- const te = Ud;
3001
- function kd() {
3002
- this.__data__ = te ? te(null) : {}, this.size = 0;
3003
- }
3004
- function Gd(t) {
3005
- var e = this.has(t) && delete this.__data__[t];
3006
- return this.size -= e ? 1 : 0, e;
3007
- }
3008
- var Vd = "__lodash_hash_undefined__", zd = Object.prototype, Hd = zd.hasOwnProperty;
3009
- function Jd(t) {
3010
- var e = this.__data__;
3011
- if (te) {
3012
- var r = e[t];
3013
- return r === Vd ? void 0 : r;
3014
- }
3015
- return Hd.call(e, t) ? e[t] : void 0;
3016
- }
3017
- var Wd = Object.prototype, Qd = Wd.hasOwnProperty;
3018
- function qd(t) {
3019
- var e = this.__data__;
3020
- return te ? e[t] !== void 0 : Qd.call(e, t);
3021
- }
3022
- var Yd = "__lodash_hash_undefined__";
3023
- function Kd(t, e) {
3024
- var r = this.__data__;
3025
- return this.size += this.has(t) ? 0 : 1, r[t] = te && e === void 0 ? Yd : e, this;
3026
- }
3027
- function dt(t) {
3028
- var e = -1, r = t == null ? 0 : t.length;
3029
- for (this.clear(); ++e < r; ) {
3030
- var n = t[e];
3031
- this.set(n[0], n[1]);
3032
- }
3033
- }
3034
- dt.prototype.clear = kd;
3035
- dt.prototype.delete = Gd;
3036
- dt.prototype.get = Jd;
3037
- dt.prototype.has = qd;
3038
- dt.prototype.set = Kd;
3039
- function Xd() {
3040
- this.__data__ = [], this.size = 0;
3041
- }
3042
- function Oe(t, e) {
3043
- for (var r = t.length; r--; )
3044
- if (je(t[r][0], e))
3045
- return r;
3046
- return -1;
3047
- }
3048
- var Zd = Array.prototype, th = Zd.splice;
3049
- function eh(t) {
3050
- var e = this.__data__, r = Oe(e, t);
3051
- if (r < 0)
3052
- return !1;
3053
- var n = e.length - 1;
3054
- return r == n ? e.pop() : th.call(e, r, 1), --this.size, !0;
3055
- }
3056
- function rh(t) {
3057
- var e = this.__data__, r = Oe(e, t);
3058
- return r < 0 ? void 0 : e[r][1];
3059
- }
3060
- function nh(t) {
3061
- return Oe(this.__data__, t) > -1;
3062
- }
3063
- function oh(t, e) {
3064
- var r = this.__data__, n = Oe(r, t);
3065
- return n < 0 ? (++this.size, r.push([t, e])) : r[n][1] = e, this;
3066
- }
3067
- function rt(t) {
3068
- var e = -1, r = t == null ? 0 : t.length;
3069
- for (this.clear(); ++e < r; ) {
3070
- var n = t[e];
3071
- this.set(n[0], n[1]);
3072
- }
3073
- }
3074
- rt.prototype.clear = Xd;
3075
- rt.prototype.delete = eh;
3076
- rt.prototype.get = rh;
3077
- rt.prototype.has = nh;
3078
- rt.prototype.set = oh;
3079
- var ah = Pr(Pt, "Map");
3080
- const Uo = ah;
3081
- function sh() {
3082
- this.size = 0, this.__data__ = {
3083
- hash: new dt(),
3084
- map: new (Uo || rt)(),
3085
- string: new dt()
3086
- };
3087
- }
3088
- function ih(t) {
3089
- var e = typeof t;
3090
- return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
3091
- }
3092
- function we(t, e) {
3093
- var r = t.__data__;
3094
- return ih(e) ? r[typeof e == "string" ? "string" : "hash"] : r.map;
3095
- }
3096
- function ch(t) {
3097
- var e = we(this, t).delete(t);
3098
- return this.size -= e ? 1 : 0, e;
3099
- }
3100
- function uh(t) {
3101
- return we(this, t).get(t);
3102
- }
3103
- function lh(t) {
3104
- return we(this, t).has(t);
3105
- }
3106
- function fh(t, e) {
3107
- var r = we(this, t), n = r.size;
3108
- return r.set(t, e), this.size += r.size == n ? 0 : 1, this;
3109
- }
3110
- function It(t) {
3111
- var e = -1, r = t == null ? 0 : t.length;
3112
- for (this.clear(); ++e < r; ) {
3113
- var n = t[e];
3114
- this.set(n[0], n[1]);
3115
- }
3116
- }
3117
- It.prototype.clear = sh;
3118
- It.prototype.delete = ch;
3119
- It.prototype.get = uh;
3120
- It.prototype.has = lh;
3121
- It.prototype.set = fh;
3122
- function ko(t) {
3123
- return t == null ? "" : xo(t);
3124
- }
3125
- var ph = Id(Object.getPrototypeOf, Object);
3126
- const Go = ph;
3127
- var dh = "[object Object]", hh = Function.prototype, mh = Object.prototype, Vo = hh.toString, vh = mh.hasOwnProperty, gh = Vo.call(Object);
3128
- function Et(t) {
3129
- if (!Rt(t) || oe(t) != dh)
3130
- return !1;
3131
- var e = Go(t);
3132
- if (e === null)
3133
- return !0;
3134
- var r = vh.call(e, "constructor") && e.constructor;
3135
- return typeof r == "function" && r instanceof r && Vo.call(r) == gh;
3136
- }
3137
- function yh(t, e, r) {
3138
- var n = -1, o = t.length;
3139
- e < 0 && (e = -e > o ? 0 : o + e), r = r > o ? o : r, r < 0 && (r += o), o = e > r ? 0 : r - e >>> 0, e >>>= 0;
3140
- for (var a = Array(o); ++n < o; )
3141
- a[n] = t[n + e];
3142
- return a;
3143
- }
3144
- function bh(t, e, r) {
3145
- var n = t.length;
3146
- return r = r === void 0 ? n : r, !e && r >= n ? t : yh(t, e, r);
3147
- }
3148
- var _h = "\\ud800-\\udfff", Sh = "\\u0300-\\u036f", jh = "\\ufe20-\\ufe2f", Oh = "\\u20d0-\\u20ff", wh = Sh + jh + Oh, Ch = "\\ufe0e\\ufe0f", $h = "\\u200d", Eh = RegExp("[" + $h + _h + wh + Ch + "]");
3149
- function zo(t) {
3150
- return Eh.test(t);
3151
- }
3152
- function Nh(t) {
3153
- return t.split("");
3154
- }
3155
- var Ho = "\\ud800-\\udfff", xh = "\\u0300-\\u036f", Th = "\\ufe20-\\ufe2f", Mh = "\\u20d0-\\u20ff", Ah = xh + Th + Mh, Ph = "\\ufe0e\\ufe0f", Rh = "[" + Ho + "]", Ze = "[" + Ah + "]", tr = "\\ud83c[\\udffb-\\udfff]", Ih = "(?:" + Ze + "|" + tr + ")", Jo = "[^" + Ho + "]", Wo = "(?:\\ud83c[\\udde6-\\uddff]){2}", Qo = "[\\ud800-\\udbff][\\udc00-\\udfff]", Dh = "\\u200d", qo = Ih + "?", Yo = "[" + Ph + "]?", Lh = "(?:" + Dh + "(?:" + [Jo, Wo, Qo].join("|") + ")" + Yo + qo + ")*", Bh = Yo + qo + Lh, Fh = "(?:" + [Jo + Ze + "?", Ze, Wo, Qo, Rh].join("|") + ")", Uh = RegExp(tr + "(?=" + tr + ")|" + Fh + Bh, "g");
3156
- function kh(t) {
3157
- return t.match(Uh) || [];
3158
- }
3159
- function Gh(t) {
3160
- return zo(t) ? kh(t) : Nh(t);
3161
- }
3162
- function Vh(t) {
3163
- return function(e) {
3164
- e = ko(e);
3165
- var r = zo(e) ? Gh(e) : void 0, n = r ? r[0] : e.charAt(0), o = r ? bh(r, 1).join("") : e.slice(1);
3166
- return n[t]() + o;
3167
- };
3168
- }
3169
- var zh = Vh("toUpperCase");
3170
- const Hh = zh;
3171
- function Jh(t) {
3172
- return Hh(ko(t).toLowerCase());
3173
- }
3174
- function Wh() {
3175
- this.__data__ = new rt(), this.size = 0;
3176
- }
3177
- function Qh(t) {
3178
- var e = this.__data__, r = e.delete(t);
3179
- return this.size = e.size, r;
3180
- }
3181
- function qh(t) {
3182
- return this.__data__.get(t);
3183
- }
3184
- function Yh(t) {
3185
- return this.__data__.has(t);
3186
- }
3187
- var Kh = 200;
3188
- function Xh(t, e) {
3189
- var r = this.__data__;
3190
- if (r instanceof rt) {
3191
- var n = r.__data__;
3192
- if (!Uo || n.length < Kh - 1)
3193
- return n.push([t, e]), this.size = ++r.size, this;
3194
- r = this.__data__ = new It(n);
3195
- }
3196
- return r.set(t, e), this.size = r.size, this;
3197
- }
3198
- function Dt(t) {
3199
- var e = this.__data__ = new rt(t);
3200
- this.size = e.size;
3201
- }
3202
- Dt.prototype.clear = Wh;
3203
- Dt.prototype.delete = Qh;
3204
- Dt.prototype.get = qh;
3205
- Dt.prototype.has = Yh;
3206
- Dt.prototype.set = Xh;
3207
- var Ko = typeof exports == "object" && exports && !exports.nodeType && exports, xn = Ko && typeof module == "object" && module && !module.nodeType && module, Zh = xn && xn.exports === Ko, Tn = Zh ? Pt.Buffer : void 0, Mn = Tn ? Tn.allocUnsafe : void 0;
3208
- function tm(t, e) {
3209
- if (e)
3210
- return t.slice();
3211
- var r = t.length, n = Mn ? Mn(r) : new t.constructor(r);
3212
- return t.copy(n), n;
3213
- }
3214
- var em = Pt.Uint8Array;
3215
- const An = em;
3216
- function rm(t) {
3217
- var e = new t.constructor(t.byteLength);
3218
- return new An(e).set(new An(t)), e;
3219
- }
3220
- function nm(t, e) {
3221
- var r = e ? rm(t.buffer) : t.buffer;
3222
- return new t.constructor(r, t.byteOffset, t.length);
3223
- }
3224
- function om(t) {
3225
- return typeof t.constructor == "function" && !Po(t) ? Op(Go(t)) : {};
3226
- }
3227
- function am(t) {
3228
- return function(e, r, n) {
3229
- for (var o = -1, a = Object(e), i = n(e), s = i.length; s--; ) {
3230
- var c = i[t ? s : ++o];
3231
- if (r(a[c], c, a) === !1)
3232
- break;
3233
- }
3234
- return e;
3235
- };
3236
- }
3237
- var sm = am();
3238
- const im = sm;
3239
- function er(t, e, r) {
3240
- (r !== void 0 && !je(t[e], r) || r === void 0 && !(e in t)) && Rr(t, e, r);
3241
- }
3242
- function cm(t) {
3243
- return Rt(t) && Ir(t);
3244
- }
3245
- function rr(t, e) {
3246
- if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
3247
- return t[e];
3248
- }
3249
- function um(t) {
3250
- return kp(t, Fo(t));
3251
- }
3252
- function lm(t, e, r, n, o, a, i) {
3253
- var s = rr(t, r), c = rr(e, r), u = i.get(c);
3254
- if (u) {
3255
- er(t, r, u);
3256
- return;
3257
- }
3258
- var f = a ? a(s, c, r + "", t, e, i) : void 0, p = f === void 0;
3259
- if (p) {
3260
- var l = $t(c), d = !l && Do(c), h = !l && !d && Bo(c);
3261
- f = c, l || d || h ? $t(s) ? f = s : cm(s) ? f = Cp(s) : d ? (p = !1, f = tm(c, !0)) : h ? (p = !1, f = nm(c, !0)) : f = [] : Et(c) || Xe(c) ? (f = s, Xe(s) ? f = um(s) : (!gt(s) || Ar(s)) && (f = om(c))) : p = !1;
3262
- }
3263
- p && (i.set(c, f), o(f, c, n, a, i), i.delete(c)), er(t, r, f);
3264
- }
3265
- function Xo(t, e, r, n, o) {
3266
- t !== e && im(e, function(a, i) {
3267
- if (o || (o = new Dt()), gt(a))
3268
- lm(t, e, i, r, Xo, n, o);
3269
- else {
3270
- var s = n ? n(rr(t, i), a, i + "", t, e, o) : void 0;
3271
- s === void 0 && (s = a), er(t, i, s);
3272
- }
3273
- }, Fo);
3274
- }
3275
- var fm = Jp(function(t, e, r) {
3276
- Xo(t, e, r);
3277
- });
3278
- const pm = fm, tv = function(t) {
3279
- return !(!t || typeof t != "function" || !t.prototype);
3280
- };
3281
- function dm(t) {
3282
- const e = t == null ? void 0 : t.prototype;
3283
- return !!(e && e.isReactComponent);
3284
- }
3285
- function hm(t) {
3286
- var n, o;
3287
- const r = typeof Symbol == "function" && Symbol.for ? Symbol.for("react.forward_ref") : 60112;
3288
- return (t == null ? void 0 : t.$$typeof) === r || ((n = t == null ? void 0 : t.prototype) == null ? void 0 : n.isReactComponent) || ((o = t == null ? void 0 : t.prototype) == null ? void 0 : o.setState) || t._forwardRef;
3289
- }
3290
- function mm(t) {
3291
- class e extends la {
3292
- render() {
3293
- return fa(t, this.props);
3294
- }
3295
- }
3296
- return e.displayName = t.displayName, e;
3297
- }
3298
- const bt = (t, e) => {
3299
- const r = (n) => {
3300
- const a = `
3301
- ${Object.keys(e).map((i) => `const ${i} = $$context['${i}'];`).join(`
3302
- `)}
3303
- return ${n};
3304
- `;
3305
- return new Function("$$context", a)(e);
3306
- };
3307
- try {
3308
- return r(t);
3309
- } catch (n) {
3310
- console.warn(n);
3311
- const o = `[${t}] expression run failed`;
3312
- return console.warn(o), null;
3313
- }
3314
- }, vm = (t, e, r) => function(...o) {
3315
- let a;
3316
- try {
3317
- a = `
3318
- var $$$__args__$$$ = Array.from(arguments);
3319
- function $$_run_$$() {
3320
- var $$_f_$$ = ${t || "function () {}"};
3321
- var __$$storeManager__ = $$$__args__$$$.pop();
3322
- var $$context = $$$__args__$$$.pop();
3323
- $$context.stateManager = __$$storeManager__.getStateSnapshot();
3324
- return $$_f_$$.apply($$_f_$$, $$$__args__$$$);
3325
- }
3326
- return $$_run_$$();
3327
- `, new Function(a)(...o, e, r);
3328
- } catch (i) {
3329
- console.log(a), console.warn(i);
3330
- }
3331
- }, Pn = (t, e) => {
3332
- const r = {};
3333
- return e.forEach((n, o) => {
3334
- r[n] = t[o];
3335
- }), r;
3336
- }, Rn = (t = []) => {
3337
- const e = {};
3338
- return t.forEach(({ property: r, value: n }) => {
3339
- let o = r.replace("-webkit", "Webkit");
3340
- o = o.replace("-ms", "ms"), o = o.replace("-moz", "Moz"), o = o.replace("-o", "O");
3341
- let a = o.split("-");
3342
- a.length >= 2 && (a = a.map((i, s) => s !== 0 ? Jh(i) : i)), e[a.join("")] = n;
3343
- }), e;
3344
- }, ev = (t) => {
3345
- let e = "";
3346
- return Object.keys(t || {}).forEach((r) => {
3347
- e += `${r}:${t[r]};`;
3348
- }), e;
3349
- }, rv = (t, e) => {
3350
- const r = {};
3351
- return t.forEach((n) => {
3352
- if (n.globalName) {
3353
- const o = e[n.globalName];
3354
- o && (r[n.globalName] = o, o.__esModule && o.default && (r[n.globalName] = o.default));
3355
- }
3356
- }), r;
3357
- }, nv = (t, e = 1) => {
3358
- let r = 0, n = t, o = {}, a = {};
3359
- for (; r < e; )
3360
- Object.keys(n).forEach((i) => {
3361
- o = {
3362
- ...o,
3363
- ...n[i]
3364
- };
3365
- }), a = o, n = o, o = {}, r += 1;
3366
- return a;
3367
- }, gm = (t, e) => {
3368
- const r = [];
3369
- return e.forEach((n) => {
3370
- const a = n.exec(t);
3371
- a != null && a.length && r.push(a[1]);
3372
- }), r;
3373
- }, Zo = (t, e) => {
3374
- const r = {};
3375
- return e.forEach((n) => {
3376
- t[n.name] && (r[n.name] = t[n.name]);
3377
- }), r;
3378
- }, ov = (t, e) => Zo(t, e), av = (t, e) => Zo(t, e), Fe = (t) => {
3379
- var r;
3380
- return ((r = t.value.css) == null ? void 0 : r.class) || `c_${t.id}`;
3381
- }, ym = (t, e) => {
3382
- const r = t.split(".");
3383
- let n, o = e;
3384
- return r.forEach((a) => {
3385
- n = o == null ? void 0 : o[a], o = n;
3386
- }), n || (() => `Component [${t}] not found`);
3387
- }, ue = "DYNAMIC", bm = ["$$context", "$$nodeModel"], In = (t) => {
3388
- let e;
3389
- const r = /* @__PURE__ */ new Set(), n = (f, p) => {
3390
- const l = typeof f == "function" ? f(e) : f;
3391
- if (!Object.is(l, e)) {
3392
- const d = e;
3393
- e = p ?? (typeof l != "object" || l === null) ? l : Object.assign({}, e, l), r.forEach((h) => h(e, d));
3394
- }
3395
- }, o = () => e, c = { setState: n, getState: o, getInitialState: () => u, subscribe: (f) => (r.add(f), () => r.delete(f)), destroy: () => {
3396
- r.clear();
3397
- } }, u = e = t(n, o, c);
3398
- return c;
3399
- }, _m = (t) => t ? In(t) : In;
3400
- class Sm {
3401
- constructor() {
3402
- y(this, "storeMap", /* @__PURE__ */ new Map());
3403
- }
3404
- addStore(e, r) {
3405
- const n = _m(r);
3406
- return this.storeMap.set(e, n), n.name = e, n;
3407
- }
3408
- setStore(e, r) {
3409
- this.storeMap.set(e, r);
3410
- }
3411
- removeStore(e) {
3412
- this.storeMap.delete(e);
3413
- }
3414
- getStore(e) {
3415
- return this.storeMap.get(e);
3416
- }
3417
- getState(e) {
3418
- var r;
3419
- return (r = this.storeMap.get(e)) == null ? void 0 : r.getState();
3420
- }
3421
- getStateObj(e) {
3422
- return {
3423
- state: this.getState(e),
3424
- updateState: (r) => {
3425
- this.setState(e, r);
3426
- }
3427
- };
3428
- }
3429
- setState(e, r) {
3430
- var n;
3431
- return (n = this.storeMap.get(e)) == null ? void 0 : n.setState(r);
3432
- }
3433
- connect(e, r) {
3434
- const n = this.storeMap.get(e);
3435
- return n ? n.subscribe(r) : (console.warn("store not exits"), () => {
3436
- });
3437
- }
3438
- /**
3439
- * storeManger 赋值以及 获取需要做转换
3440
- */
3441
- getStateSnapshot() {
3442
- const e = {};
3443
- return this.storeMap.forEach((r, n) => {
3444
- e[n] = this.getStateObj(n);
3445
- }), e;
3446
- }
3447
- destroy() {
3448
- this.storeMap = /* @__PURE__ */ new Map();
3449
- }
3450
- }
3451
- class jm {
3452
- constructor() {
3453
- y(this, "varSpace", /* @__PURE__ */ new Map());
3454
- }
3455
- get(e) {
3456
- return this.varSpace.get(e);
3457
- }
3458
- add(e, r) {
3459
- this.varSpace.set(e, r);
3460
- }
3461
- remove(e) {
3462
- this.varSpace.delete(e);
3463
- }
3464
- destroy() {
3465
- this.varSpace.clear();
3466
- }
3467
- getStateSnapshot() {
3468
- const e = {};
3469
- return this.varSpace.forEach((r, n) => {
3470
- e[n] = r;
3471
- }), e;
3472
- }
3473
- }
3474
- class Om {
3475
- constructor() {
3476
- y(this, "renderMode", "normal");
3477
- y(this, "components", {});
3478
- y(this, "storeManager", new Sm());
3479
- // 存储节点的变量或者方法
3480
- y(this, "variableManager", new jm());
3481
- y(this, "runtimeComponentCache", /* @__PURE__ */ new Map());
3482
- y(this, "onGetRef");
3483
- y(this, "onGetComponent");
3484
- y(this, "onComponentMount");
3485
- y(this, "onComponentDestroy");
3486
- /**
3487
- * 处理 props 钩子, 可以统一拦截 node 的处理,并修改其值
3488
- */
3489
- y(this, "processNodeConfigHook");
3490
- }
3491
- getComponent(e) {
3492
- var o;
3493
- const r = e.value.componentName;
3494
- let n = ym(r, this.components);
3495
- return hm(n) || (n = mm(n), this.components[r] = n), this.onGetComponent && (n = (o = this.onGetComponent) == null ? void 0 : o.call(this, n, e)), n;
3496
- }
3497
- getContext(e = {}, r) {
3498
- let n = e;
3499
- return r && (n = {
3500
- ...e
3501
- }, n.__proto__ = r || null), n;
3502
- }
3503
- pageRender(e, {
3504
- components: r,
3505
- onGetRef: n,
3506
- $$context: o = {},
3507
- onGetComponent: a,
3508
- onComponentMount: i,
3509
- onComponentDestroy: s,
3510
- renderMode: c,
3511
- processNodeConfigHook: u
3512
- }) {
3513
- this.renderMode = c, this.components = r, this.onGetRef = n, this.onGetComponent = a, this.onComponentMount = i, this.onComponentDestroy = s, this.processNodeConfigHook = u;
3514
- const f = e.value.componentsTree, p = this.getComponent(f), l = this.convertModelToComponent(p, e.value.componentsTree), d = {}, h = f.props;
3515
- return Object.keys(h).forEach((g) => {
3516
- d[g] = h[g].value;
3517
- }), d.$$context = o, this.render(l, d);
3518
- }
3519
- transformProps(e = {}, {
3520
- $$context: r
3521
- }) {
3522
- const n = e, o = (i) => {
3523
- if (Array.isArray(i))
3524
- return i.map((s) => o(s));
3525
- if (Re(i))
3526
- return o(i.value);
3527
- if (If(i)) {
3528
- const s = i.value, c = s.value;
3529
- if (!c)
3530
- return console.warn("slot value is null, this maybe cause some error, pls check it", e), () => {
3531
- };
3532
- const u = (f) => {
3533
- const p = `${f.id}-${ue}`;
3534
- if (this.runtimeComponentCache.get(f.id))
3535
- return {
3536
- key: p,
3537
- component: this.runtimeComponentCache.get(f.id)
3538
- };
3539
- const l = this.getComponent(f), d = this.convertModelToComponent(l, f), h = s.params || [];
3540
- return {
3541
- component: (...S) => {
3542
- const j = Pn(S, h), x = this.getContext(
3543
- {
3544
- params: j
3545
- },
3546
- r
3547
- );
3548
- return this.render(d, {
3549
- $$context: x,
3550
- key: p
3551
- });
3552
- },
3553
- key: p
3554
- };
3555
- };
3556
- if (Array.isArray(c)) {
3557
- const f = c == null ? void 0 : c.map((p) => u(p));
3558
- return (...p) => f.map((l) => {
3559
- if (dm(l.component)) {
3560
- const h = l.component;
3561
- return O.createElement(h, {
3562
- $$context: r,
3563
- key: l.key
3564
- });
3565
- } else {
3566
- const h = l.component;
3567
- return h == null ? void 0 : h(...p);
3568
- }
3569
- });
3570
- } else
3571
- return u(c).component;
3572
- } else {
3573
- if (ct(i))
3574
- return bt(i.value, r || {});
3575
- if (Pf(i))
3576
- return vm(i.value, r, this.storeManager);
3577
- if (Et(i)) {
3578
- let s = i;
3579
- Re(i) && (s = i.value);
3580
- const c = s, u = {};
3581
- return Object.keys(s).forEach((f) => {
3582
- u[f] = o(c[f]);
3583
- }), u;
3584
- } else
3585
- return i;
3586
- }
3587
- }, a = {};
3588
- return Object.keys(n).forEach((i) => {
3589
- const s = n[i];
3590
- a[i] = o(s);
3591
- }), a;
3592
- }
3593
- collectSpecialProps(e = {}, r) {
3594
- const n = [], o = (a, i) => {
3595
- let s = i;
3596
- Re(i) && (s = i.value), r(s) ? n.push({
3597
- keyPath: a,
3598
- val: s
3599
- }) : $t(s) ? s.forEach((c, u) => {
3600
- o([...a, String(u)], c);
3601
- }) : Et(s) && Object.keys(s).forEach((c) => {
3602
- o([...a, c], s[c]);
3603
- });
3604
- };
3605
- return o(["$root"], e), n;
3606
- }
3607
- convertModelToComponent(e, r) {
3608
- const n = this;
3609
- class o extends O.Component {
3610
- constructor(s) {
3611
- super(s);
3612
- y(this, "_CONDITION", !0);
3613
- y(this, "_DESIGN_BOX", !1);
3614
- y(this, "_NODE_MODEL", r);
3615
- y(this, "_NODE_ID", r.id);
3616
- y(this, "UNIQUE_ID", `${r.id}_${Z()}`);
3617
- y(this, "targetComponentRef");
3618
- y(this, "listenerHandle", []);
3619
- y(this, "storeState");
3620
- y(this, "storeListenDisposeList", []);
3621
- /** save dom and media css */
3622
- y(this, "domHeader");
3623
- y(this, "mediaStyleDomMap", {});
3624
- /** 存储当前节点的一些变量和方法,不具有响应性 */
3625
- y(this, "variableSpace");
3626
- y(this, "nodeName");
3627
- y(this, "updateState", (s) => {
3628
- this.storeState.setState(s);
3629
- });
3630
- y(this, "getStyleDomById", (s) => {
3631
- const c = this.mediaStyleDomMap;
3632
- let u = c[s];
3633
- return u || (u = document.createElement("style"), c[s] = u), u.id = s, u;
3634
- });
3635
- y(this, "addMediaCSS", () => {
3636
- var u;
3637
- let s = this.domHeader;
3638
- if (s || (s = (u = document.getElementsByTagName("head")) == null ? void 0 : u[0], this.domHeader = s), !this.domHeader)
3639
- return;
3640
- const c = this._NODE_MODEL.value.css;
3641
- c && c.value.forEach((f) => {
3642
- var d;
3643
- const p = `${this.UNIQUE_ID}_${f.state}`;
3644
- let l = Fe(this._NODE_MODEL);
3645
- if (f.state !== "normal" && (l = `${l}:${f.state}`), f.text) {
3646
- const h = this.getStyleDomById(p);
3647
- h.innerText = `.${l} { ${f.text} }`, s == null || s.appendChild(h);
3648
- }
3649
- (d = f.media) != null && d.length && f.media.forEach((h) => {
3650
- const g = `${p}_${h.type}_${h.value}`, b = this.getStyleDomById(g);
3651
- b.media = `screen and (${h.type}:${h.value}px)`, b.innerHTML = `.${l} { ${h.text} }`, s == null || s.appendChild(b);
3652
- });
3653
- });
3654
- });
3655
- y(this, "removeMediaCSS", () => {
3656
- const s = this.mediaStyleDomMap;
3657
- Object.keys(s).forEach((c) => {
3658
- var u;
3659
- (u = this.domHeader) == null || u.removeChild(s[c]);
3660
- }), this.mediaStyleDomMap = {};
3661
- });
3662
- y(this, "rebuildNode", () => {
3663
- this.storeListenDisposeList.forEach((s) => s()), this.removeMediaCSS(), this.connectStore(), this.addMediaCSS(), this.forceUpdate();
3664
- });
3665
- this.targetComponentRef = O.createRef(), this.state = r.value.state || {};
3666
- const c = r.value.nodeName || r.id;
3667
- this.nodeName = c;
3668
- const u = n.storeManager.getStore(c);
3669
- u ? (this.storeState = u, u.setState({
3670
- ...r.value.state || {}
3671
- })) : this.storeState = n.storeManager.addStore(c, () => ({
3672
- ...r.value.state || {}
3673
- })), this.storeState.subscribe((p) => {
3674
- this.setState({
3675
- ...p
3676
- });
3677
- }), this.connectStore();
3678
- const f = n.variableManager.get(c);
3679
- f ? this.variableSpace = f : (this.variableSpace = {
3680
- staticVar: {},
3681
- methods: {}
3682
- }, n.variableManager.add(c, this.variableSpace));
3683
- }
3684
- connectStore() {
3685
- const s = n.collectSpecialProps(r.props, (l) => !!ct(l)), c = n.collectSpecialProps(
3686
- {
3687
- css: r.value.css,
3688
- class: r.value.classNames
3689
- },
3690
- (l) => !!ct(l)
3691
- );
3692
- let u = [];
3693
- [...s, ...c].map((l) => {
3694
- const d = l.val, h = [
3695
- /\$\$context.stateManager\.(.+?)\./gim,
3696
- /\$\$context.stateManager\["(.+?)"\]/gim,
3697
- /\$\$context.stateManager\['(.+?)'\]/gim,
3698
- /getStateObj\('(.+?)'\)/gim,
3699
- /getStateObj\("(.+?)"\)/gim,
3700
- /getStateById\('(.+?)'\)/gim,
3701
- /getStateById\("(.+?)"\)/gim
3702
- ], g = gm(d.value, h);
3703
- u = [...u, ...g];
3704
- }).filter(Boolean);
3705
- const f = Array.from(new Set(u)), p = [];
3706
- f.length && f.forEach((l) => {
3707
- n.storeManager.getStore(l) || (n.storeManager.addStore(l, () => ({})), console.warn(n.storeManager, l, "not exits"));
3708
- const h = n.storeManager.connect(l, (g) => {
3709
- this.setState({
3710
- ...g
3711
- });
3712
- });
3713
- p.push(h);
3714
- }), this.storeListenDisposeList = p;
3715
- }
3716
- componentDidMount() {
3717
- var c;
3718
- this.addMediaCSS(), n.onGetRef && n.onGetRef(this.targetComponentRef, r, this), (c = n.onComponentMount) == null || c.call(n, this, r);
3719
- const s = () => {
3720
- n.storeManager.setStore(r.value.nodeName || r.id, this.storeState), this.storeState.setState({
3721
- ...this.state,
3722
- ...r.value.state || {}
3723
- }), this.rebuildNode();
3724
- };
3725
- r.onChange(s);
3726
- }
3727
- componentWillUnmount() {
3728
- var s;
3729
- this.storeListenDisposeList.forEach((c) => c()), this.removeMediaCSS(), (s = n.onComponentDestroy) == null || s.call(n, this, r);
3730
- }
3731
- render() {
3732
- var ae;
3733
- const { $$context: s, ...c } = this.props, u = r.value.nodeName || r.id, f = {
3734
- key: r.id,
3735
- ...r.props,
3736
- ...c
3737
- }, p = {
3738
- state: this.state || {},
3739
- staticVar: this.variableSpace.staticVar,
3740
- updateState: this.updateState,
3741
- storeManager: n.storeManager,
3742
- getState: () => n.storeManager.getStateObj(u),
3743
- getStateObj: () => n.storeManager.getStateObj(u),
3744
- getStateObjById: (I) => n.storeManager.getStateObj(I),
3745
- stateManager: n.storeManager.getStateSnapshot(),
3746
- getMethods: () => n.variableManager.get(u).methods,
3747
- getMethodsById: (I) => n.variableManager.get(I).methods,
3748
- getStaticVar: () => n.variableManager.get(u).staticVar,
3749
- getStaticVarById: (I) => n.variableManager.get(I).staticVar
3750
- };
3751
- r.value.componentName === At.ROOT_CONTAINER && (p.globalState = this.state, p.updateGlobalState = this.updateState, p.getGlobalState = () => this.state);
3752
- const l = n.getContext(p, s), g = n.transformProps(
3753
- {
3754
- methods: r.value.methods
3755
- },
3756
- {
3757
- $$context: l
3758
- }
3759
- ).methods.reduce((I, z) => (I[z.name] = z.define, I), {});
3760
- l.methods = g, this.variableSpace.methods = Object.assign(this.variableSpace.methods, g);
3761
- const b = r.value.loop;
3762
- let S = [];
3763
- if (b && b.open) {
3764
- this.targetComponentRef.current = [];
3765
- let I = b.data || [];
3766
- if (ct(b.data)) {
3767
- const z = b.data;
3768
- I = bt(z.value, l || {});
3769
- }
3770
- return S = I.map((...z) => {
3771
- var Dr;
3772
- const Bt = z[1], yt = [b.forName || "item", b.forIndex || "index"], $e = Pn(z, yt);
3773
- let Ee = "loopData";
3774
- b.name && (Ee = `${Ee}${b.name}`);
3775
- const Ft = n.getContext(
3776
- {
3777
- [Ee]: $e
3778
- },
3779
- l
3780
- ), q = n.transformProps(f, {
3781
- $$context: Ft
3782
- }), aa = ((Dr = r.value.classNames) == null ? void 0 : Dr.map((H) => {
3783
- var ie;
3784
- const Ut = H.name;
3785
- return (ct(H.status) ? bt(String(((ie = H.status) == null ? void 0 : ie.value) || ""), Ft) : !1) ? Ut : "";
3786
- })) || [];
3787
- let Ne = `${q.className ?? ""} ${aa.join(" ")}`.trim();
3788
- r.value.css && (Ne = `${Fe(r)} ${Ne}`.trim()), q.className = Ne;
3789
- const sa = n.transformProps(
3790
- {
3791
- style: r.value.style
3792
- },
3793
- {
3794
- $$context: Ft
3795
- }
3796
- );
3797
- r.value.style && (q.style = Rn(sa.style || []));
3798
- const { children: se } = q;
3799
- let xe = [];
3800
- if (se !== void 0)
3801
- delete q.children, xe = Array.isArray(se) ? se : [se];
3802
- else {
3803
- const H = [];
3804
- r.value.children.forEach((Lr, ie) => {
3805
- const ia = n.buildComponent(Lr, {
3806
- $$context: Ft,
3807
- idx: ie
3808
- });
3809
- H.push(ia);
3810
- }), xe = H;
3811
- }
3812
- if (q.key = `${q.key}-${Bt}`, ct(b.key)) {
3813
- const H = b.key, Ut = bt(H.value, Ft || {});
3814
- q.key += `-${Ut}`;
3815
- }
3816
- return q.ref = (H) => {
3817
- this.targetComponentRef.current = this.targetComponentRef.current || [], this.targetComponentRef.current[Bt] = H;
3818
- }, n.render(e, q, ...xe);
3819
- }), S;
3820
- }
3821
- const j = n.transformProps(f, {
3822
- $$context: l
3823
- }), { children: x } = j;
3824
- let A = [];
3825
- if (x !== void 0)
3826
- delete j.children, A = Array.isArray(x) ? x : [x];
3827
- else {
3828
- const I = [];
3829
- r.value.children.forEach((Bt, yt) => {
3830
- const $e = n.buildComponent(Bt, {
3831
- $$context: l,
3832
- idx: yt
3833
- });
3834
- I.push($e);
3835
- }), A = I;
3836
- }
3837
- j.ref = this.targetComponentRef;
3838
- const D = ((ae = r.value.classNames) == null ? void 0 : ae.map((I) => {
3839
- var yt;
3840
- const z = I.name;
3841
- return (ct(I.status) ? bt(((yt = I.status) == null ? void 0 : yt.value) || "", l) : !1) ? z : "";
3842
- })) || [];
3843
- let k = `${j.className ?? ""} ${D.join(" ")}`.trim();
3844
- r.value.css && (k = `${Fe(r)} ${k}`.trim()), j.className = k;
3845
- const Lt = n.transformProps(
3846
- { style: r.value.style },
3847
- {
3848
- $$context: l
3849
- }
3850
- );
3851
- r.value.style && (j.style = Rn(Lt.style || []));
3852
- let C = r.value.condition ?? !0;
3853
- typeof C != "boolean" && (C = bt(C.value, l || {}));
3854
- let ot = {
3855
- condition: C,
3856
- props: j
3857
- };
3858
- n.processNodeConfigHook && (ot = n.processNodeConfigHook(ot, r));
3859
- const it = n.render(e, ot.props, ...A);
3860
- return this._CONDITION = ot.condition, ot.condition ? it : O.createElement(
3861
- "div",
3862
- {
3863
- style: {
3864
- display: "none"
3865
- }
3866
- },
3867
- it
3868
- );
3869
- }
3870
- }
3871
- return y(o, "__CP_TYPE__", ue), o.displayName = `${r.value.componentName}Dynamic`, o;
3872
- }
3873
- // 递归建页面组件结构
3874
- buildComponent(e, {
3875
- $$context: r = {}
3876
- }) {
3877
- const n = this.runtimeComponentCache;
3878
- return typeof e == "string" ? this.render(e) : Rf(e) ? (({ currentNode: a }) => {
3879
- const i = a.value.id;
3880
- let s = null;
3881
- if (n.get(i)) {
3882
- const f = n.get(i);
3883
- s = f == null ? void 0 : f.component;
3884
- } else {
3885
- const f = this.getComponent(a);
3886
- s = this.convertModelToComponent(f, a), !n.get(i) && this.renderMode !== "design" && n.set(i, {
3887
- component: s
3888
- });
3889
- }
3890
- const c = `${i}-${ue}`, u = {
3891
- $$context: r,
3892
- $$nodeModel: e,
3893
- key: c
3894
- };
3895
- return this.render(s, u);
3896
- })({
3897
- currentNode: e
3898
- }) : void 0;
3899
- }
3900
- // 真实渲染
3901
- render(e, r = {}, ...n) {
3902
- return typeof e == "string" || typeof e == "number" ? String(e) : (bm.forEach((a) => {
3903
- a in r && e.__CP_TYPE__ !== ue && delete r[a];
3904
- }), O.createElement(e, r, ...n));
3905
- }
3906
- clear() {
3907
- this.runtimeComponentCache.clear(), this.storeManager.destroy();
3908
- }
3909
- }
3910
- const sv = va(new Om()), wm = [
3911
- "a",
3912
- "abbr",
3913
- "acronym",
3914
- "address",
3915
- "applet",
3916
- "area",
3917
- "article",
3918
- "aside",
3919
- "audio",
3920
- "b",
3921
- "base",
3922
- "basefont",
3923
- "bdi",
3924
- "bdo",
3925
- "bgsound",
3926
- "big",
3927
- "blink",
3928
- "blockquote",
3929
- "body",
3930
- "br",
3931
- "button",
3932
- "canvas",
3933
- "caption",
3934
- "center",
3935
- "cite",
3936
- "code",
3937
- "col",
3938
- "colgroup",
3939
- "command",
3940
- "content",
3941
- "data",
3942
- "datalist",
3943
- "dd",
3944
- "del",
3945
- "details",
3946
- "dfn",
3947
- "dialog",
3948
- "dir",
3949
- "div",
3950
- "dl",
3951
- "dt",
3952
- "element",
3953
- "em",
3954
- "embed",
3955
- "fieldset",
3956
- "figcaption",
3957
- "figure",
3958
- "font",
3959
- "footer",
3960
- "form",
3961
- "frame",
3962
- "frameset",
3963
- "h1",
3964
- "h2",
3965
- "h3",
3966
- "h4",
3967
- "h5",
3968
- "h6",
3969
- "head",
3970
- "header",
3971
- "hgroup",
3972
- "hr",
3973
- "html",
3974
- "i",
3975
- "iframe",
3976
- "image",
3977
- "img",
3978
- "input",
3979
- "ins",
3980
- "isindex",
3981
- "kbd",
3982
- "keygen",
3983
- "label",
3984
- "legend",
3985
- "li",
3986
- "link",
3987
- "listing",
3988
- "main",
3989
- "map",
3990
- "mark",
3991
- "marquee",
3992
- "math",
3993
- "menu",
3994
- "menuitem",
3995
- "meta",
3996
- "meter",
3997
- "multicol",
3998
- "nav",
3999
- "nextid",
4000
- "nobr",
4001
- "noembed",
4002
- "noframes",
4003
- "noscript",
4004
- "object",
4005
- "ol",
4006
- "optgroup",
4007
- "option",
4008
- "output",
4009
- "p",
4010
- "param",
4011
- "picture",
4012
- "plaintext",
4013
- "pre",
4014
- "progress",
4015
- "q",
4016
- "rb",
4017
- "rbc",
4018
- "rp",
4019
- "rt",
4020
- "rtc",
4021
- "ruby",
4022
- "s",
4023
- "samp",
4024
- "script",
4025
- "search",
4026
- "section",
4027
- "select",
4028
- "shadow",
4029
- "slot",
4030
- "small",
4031
- "source",
4032
- "spacer",
4033
- "span",
4034
- "strike",
4035
- "strong",
4036
- "style",
4037
- "sub",
4038
- "summary",
4039
- "sup",
4040
- "svg",
4041
- "table",
4042
- "tbody",
4043
- "td",
4044
- "template",
4045
- "textarea",
4046
- "tfoot",
4047
- "th",
4048
- "thead",
4049
- "time",
4050
- "title",
4051
- "tr",
4052
- "track",
4053
- "tt",
4054
- "u",
4055
- "ul",
4056
- "var",
4057
- "video",
4058
- "wbr",
4059
- "xmp"
4060
- ];
4061
- var Cm = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
4062
- function $m(t) {
4063
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
4064
- }
4065
- var ta = { exports: {} }, Ce = {};
4066
- /**
4067
- * @license React
4068
- * react-jsx-runtime.production.min.js
4069
- *
4070
- * Copyright (c) Facebook, Inc. and its affiliates.
4071
- *
4072
- * This source code is licensed under the MIT license found in the
4073
- * LICENSE file in the root directory of this source tree.
4074
- */
4075
- var Em = O, Nm = Symbol.for("react.element"), xm = Symbol.for("react.fragment"), Tm = Object.prototype.hasOwnProperty, Mm = Em.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, Am = { key: !0, ref: !0, __self: !0, __source: !0 };
4076
- function ea(t, e, r) {
4077
- var n, o = {}, a = null, i = null;
4078
- r !== void 0 && (a = "" + r), e.key !== void 0 && (a = "" + e.key), e.ref !== void 0 && (i = e.ref);
4079
- for (n in e)
4080
- Tm.call(e, n) && !Am.hasOwnProperty(n) && (o[n] = e[n]);
4081
- if (t && t.defaultProps)
4082
- for (n in e = t.defaultProps, e)
4083
- o[n] === void 0 && (o[n] = e[n]);
4084
- return { $$typeof: Nm, type: t, key: a, ref: i, props: o, _owner: Mm.current };
4085
- }
4086
- Ce.Fragment = xm;
4087
- Ce.jsx = ea;
4088
- Ce.jsxs = ea;
4089
- ta.exports = Ce;
4090
- var Pm = ta.exports;
4091
- const Rm = Pm.jsx, nt = (t) => {
4092
- const e = {};
4093
- return t.forEach((r) => {
4094
- e[r.key] = r.value;
4095
- }), e;
4096
- }, Im = [...wm, ...bf], Dm = Im.reduce((t, e) => (t[e] = ({
4097
- children: r,
4098
- $$attributes: n = [],
4099
- ...o
4100
- }) => {
4101
- let a = r;
4102
- return Array.isArray(r) || (a = [r]), O.createElement(e, {
4103
- ...o,
4104
- ...nt(n)
4105
- }, ...a);
4106
- }, t), {}), Lm = ({
4107
- children: t,
4108
- width: e,
4109
- height: r,
4110
- $$attributes: n = [],
4111
- ...o
4112
- }) => {
4113
- let a = t;
4114
- Array.isArray(t) || (a = [t]), a = a.filter((u) => u !== void 0);
4115
- const {
4116
- style: i = {},
4117
- ...s
4118
- } = nt(n), c = {
4119
- height: r,
4120
- width: e,
4121
- ...i,
4122
- ...o.style || {}
4123
- };
4124
- return O.createElement("div", {
4125
- ...o,
4126
- ...s,
4127
- style: c
4128
- }, ...a);
4129
- }, Bm = ({
4130
- afterMount: t,
4131
- beforeDestroy: e,
4132
- $$attributes: r = [],
4133
- ...n
4134
- }) => (Ln(() => (t == null || t(n), () => {
4135
- e == null || e(n);
4136
- }), []), O.createElement("canvas", {
4137
- ...n,
4138
- ...nt(r)
4139
- })), Fm = ({
4140
- children: t,
4141
- $$attributes: e = [],
4142
- ...r
4143
- }) => {
4144
- let n = t;
4145
- return Array.isArray(t) || (n = [t]), O.createElement("img", {
4146
- ...r,
4147
- ...nt(e)
4148
- }, ...n);
4149
- }, Um = ({
4150
- children: t,
4151
- $$attributes: e = [],
4152
- ...r
4153
- }) => {
4154
- let n = t;
4155
- return Array.isArray(t) || (n = [t]), O.createElement("video", {
4156
- ...r,
4157
- ...nt(e)
4158
- }, ...n);
4159
- }, km = ({
4160
- children: t,
4161
- $$attributes: e = [],
4162
- ...r
4163
- }) => {
4164
- let n = t;
4165
- return Array.isArray(t) || (n = [t]), O.createElement("audio", {
4166
- ...r,
4167
- ...nt(e)
4168
- }, ...n);
4169
- }, Gm = ({
4170
- $$attributes: t = [],
4171
- content: e,
4172
- ...r
4173
- }) => O.createElement("span", {
4174
- ...r,
4175
- ...nt(t)
4176
- }, e), Vm = ({
4177
- children: t,
4178
- $$attributes: e = [],
4179
- afterMount: r,
4180
- beforeDestroy: n,
4181
- ...o
4182
- }) => {
4183
- let a = t;
4184
- return Array.isArray(t) || (a = [t]), Ln(() => (r == null || r(o), () => {
4185
- n == null || n(o);
4186
- }), []), /* @__PURE__ */ Rm("div", {
4187
- ...o,
4188
- ...nt(e),
4189
- children: a
4190
- });
4191
- }, zm = ({
4192
- children: t,
4193
- $$attributes: e = [],
4194
- htmlTag: r = "div",
4195
- ...n
4196
- }) => {
4197
- let o = t;
4198
- Array.isArray(t) || (o = [t]);
4199
- const {
4200
- style: a = {},
4201
- ...i
4202
- } = nt(e), s = {
4203
- ...a,
4204
- ...n.style || {}
4205
- };
4206
- return O.createElement(r, {
4207
- ...n,
4208
- ...i,
4209
- style: s
4210
- }, ...o);
4211
- }, Hm = {
4212
- RootContainer: ({
4213
- children: t
4214
- }) => t,
4215
- ...Dm,
4216
- CContainer: Vm,
4217
- CVideo: Um,
4218
- CAudio: km,
4219
- CBlock: Lm,
4220
- CImage: Fm,
4221
- CText: Gm,
4222
- CCanvas: Bm,
4223
- CNativeTag: zm
4224
- };
4225
- class Jm {
4226
- constructor() {
4227
- y(this, "refMap", /* @__PURE__ */ new Map());
4228
- }
4229
- get(e) {
4230
- return this.refMap.get(e);
4231
- }
4232
- add(e, r) {
4233
- this.refMap.set(e, r);
4234
- }
4235
- remove(e) {
4236
- this.refMap.delete(e);
4237
- }
4238
- destroy() {
4239
- this.refMap.clear();
4240
- }
4241
- }
4242
- class Wm extends O.Component {
4243
- constructor(r) {
4244
- super(r);
4245
- y(this, "refManager");
4246
- // save component instance
4247
- y(this, "dynamicComponentInstanceMap", /* @__PURE__ */ new Map());
4248
- y(this, "onGetRef", (r, n, o) => {
4249
- var a, i;
4250
- (i = (a = this.props).onGetRef) == null || i.call(a, r, n, o), this.dynamicComponentInstanceMap.set(n.id, o), this.refManager.add(n.value.refId || n.id, r);
4251
- });
4252
- y(this, "rerender", (r) => {
4253
- if (this.props.adapter.clear(), (r == null ? void 0 : r.nodeType) === "PAGE" && r)
4254
- this.setState({
4255
- pageModel: r
4256
- });
4257
- else if (Et(r) && $o(r)) {
4258
- const n = r;
4259
- this.setState({
4260
- pageModel: new de(n, {
4261
- materials: this.state.pageModel.materialsModel.rawValue
4262
- })
4263
- });
4264
- }
4265
- });
4266
- this.state = {
4267
- pageModel: r.pageModel || new de(r.page)
4268
- }, this.refManager = new Jm();
4269
- }
4270
- getPageModel() {
4271
- return this.state.pageModel;
4272
- }
4273
- componentDidMount() {
4274
- const { render: r } = this.props;
4275
- r && (r.ref.current = this);
4276
- }
4277
- componentWillUnmount() {
4278
- this.refManager.destroy();
4279
- }
4280
- render() {
4281
- const { props: r } = this, { adapter: n, onGetComponent: o, onComponentDestroy: a, onComponentMount: i } = r, { pageModel: s } = this.state;
4282
- if (!s)
4283
- return console.warn("pageModel is null"), null;
4284
- const c = {
4285
- ...Hm,
4286
- ...r.components
4287
- }, u = this.props.$$context ?? {};
4288
- return u.refs = this.refManager, n.pageRender(s, {
4289
- libs: {},
4290
- components: c,
4291
- onGetRef: this.onGetRef,
4292
- onGetComponent: o,
4293
- onComponentMount: i,
4294
- onComponentDestroy: a,
4295
- $$context: u,
4296
- renderMode: r.renderMode,
4297
- processNodeConfigHook: r.processNodeConfigHook
4298
- });
4299
- }
4300
- }
4301
- const iv = () => {
4302
- const t = Bn(null);
4303
- return {
4304
- ref: t,
4305
- rerender: function(...e) {
4306
- t.current && t.current.rerender(...e);
4307
- }
4308
- };
4309
- };
4310
- class Qm extends O.Component {
4311
- constructor(r) {
4312
- super(r);
4313
- y(this, "onDoubleClick", () => {
4314
- this.setState({
4315
- hasError: !1,
4316
- error: null
4317
- });
4318
- });
4319
- this.state = { hasError: !1, error: "" };
4320
- }
4321
- static getDerivedStateFromError(r) {
4322
- return { hasError: !0, error: r };
4323
- }
4324
- componentDidCatch(r, n) {
4325
- var o, a;
4326
- (a = (o = this.props).onError) == null || a.call(o, n);
4327
- }
4328
- render() {
4329
- if (this.state.hasError) {
4330
- const { onDoubleClick: r } = this, n = this.props.node.value;
4331
- console.error(this.props.node, this.props.children);
4332
- const o = O.createElement(
4333
- "div",
4334
- {
4335
- style: {
4336
- backgroundColor: "rgb(255 206 215 / 13%)",
4337
- padding: "5px",
4338
- color: "#ff0000b0",
4339
- textAlign: "center",
4340
- fontSize: "12px"
4341
- }
4342
- },
4343
- "Render error, node id: ",
4344
- n.id,
4345
- ", node name:",
4346
- n.title,
4347
- " component name:",
4348
- n.title || n.componentName,
4349
- O.createElement("p", null, "msg: ", String(this.state.error)),
4350
- O.createElement(
4351
- "button",
4352
- {
4353
- onDoubleClick: r,
4354
- style: {
4355
- border: "1px solid rgba(100,100,100,0.1)",
4356
- backgroundColor: "#fff",
4357
- padding: "5px 10px",
4358
- borderRadius: "2px",
4359
- color: "gray",
4360
- cursor: "pointer",
4361
- marginTop: "5px"
4362
- }
4363
- },
4364
- "double click to refresh"
4365
- ),
4366
- O.createElement("div", {
4367
- style: {
4368
- display: "none"
4369
- }
4370
- })
4371
- );
4372
- return O.createElement(this.props.targetComponent, { onlyRenderChild: !0 }, o);
4373
- }
4374
- return this.props.children;
4375
- }
4376
- }
4377
- class qm {
4378
- constructor() {
4379
- y(this, "instanceMap", /* @__PURE__ */ new Map());
4380
- }
4381
- get(e) {
4382
- return this.instanceMap.get(e);
4383
- }
4384
- add(e, r) {
4385
- const n = this.instanceMap.get(e);
4386
- n ? n.push(r) : this.instanceMap.set(e, [r]);
4387
- }
4388
- remove(e, r) {
4389
- const n = this.instanceMap.get(e);
4390
- if (r !== void 0 && Array.isArray(n)) {
4391
- const o = n.filter((a) => a !== r);
4392
- this.instanceMap.set(e, o);
4393
- } else
4394
- this.instanceMap.delete(e);
4395
- }
4396
- destroy() {
4397
- this.instanceMap.clear();
4398
- }
4399
- }
4400
- const Ym = (t) => {
4401
- const { node: e } = t, r = pa(() => {
4402
- const s = e.isContainer();
4403
- return Et(s) ? s : {
4404
- placeholder: "Drag the component to place it",
4405
- width: "100%",
4406
- height: "100%",
4407
- style: {}
4408
- };
4409
- }, [t.node]), { placeholder: n, height: o, width: a, style: i } = r;
4410
- return O.createElement(
4411
- "div",
4412
- {
4413
- style: {
4414
- margin: 0,
4415
- padding: 0,
4416
- display: "flex",
4417
- alignItems: "center",
4418
- justifyContent: "center",
4419
- backgroundColor: "rgba(200,200,200,0.1)",
4420
- border: "1px solid rgba(0,0,0,0.1)",
4421
- borderRadius: "2px",
4422
- fontSize: "14px",
4423
- color: "gray",
4424
- cursor: "default",
4425
- minHeight: "50px",
4426
- width: a,
4427
- height: o,
4428
- ...i
4429
- }
4430
- },
4431
- n
4432
- );
4433
- };
4434
- class cv extends O.Component {
4435
- constructor(r) {
4436
- super(r);
4437
- y(this, "instanceManager", new qm());
4438
- y(this, "renderRef");
4439
- y(this, "dropPlaceholder", Ym);
4440
- y(this, "_components", {});
4441
- y(this, "onGetComponent", (r, n) => {
4442
- var c, u;
4443
- const o = this;
4444
- let a = r;
4445
- const i = (u = (c = n.material) == null ? void 0 : c.value.advanceCustom) == null ? void 0 : u.wrapComponent;
4446
- i && (a = i(r, {
4447
- node: n,
4448
- ctx: window.__C_ENGINE_DESIGNER_PLUGIN_CTX__
4449
- }));
4450
- class s extends O.Component {
4451
- constructor() {
4452
- super(...arguments);
4453
- y(this, "_DESIGN_BOX", !0);
4454
- y(this, "_NODE_MODEL", n);
4455
- y(this, "_NODE_ID", n.id);
4456
- y(this, "_UNIQUE_ID", `${n.id}_${Z()}`);
4457
- y(this, "_STATUS");
4458
- y(this, "_design_target_component");
4459
- }
4460
- componentDidMount() {
4461
- o.instanceManager.add(n.id, this);
4462
- }
4463
- getTargetComponentRef() {
4464
- return this._design_target_component;
4465
- }
4466
- componentWillUnmount() {
4467
- this._STATUS = "DESTROY", o.instanceManager.remove(n.id, this);
4468
- }
4469
- render() {
4470
- var S, j;
4471
- const { children: l = [], onlyRenderChild: d, ...h } = this.props;
4472
- let g = l;
4473
- if ($t(l) || (g = [l]), !!!g.filter(Boolean).length && (n.isContainer() || n.value.componentName === At.ROOT_CONTAINER)) {
4474
- const x = (j = (S = n.material) == null ? void 0 : S.value.advanceCustom) == null ? void 0 : j.dropPlaceholder;
4475
- g.push(
4476
- O.createElement(x || o.dropPlaceholder, {
4477
- node: n
4478
- })
4479
- );
4480
- }
4481
- return d ? g : O.createElement(
4482
- a,
4483
- {
4484
- ...h
4485
- },
4486
- ...g
4487
- );
4488
- }
4489
- }
4490
- return O.forwardRef(function(p, l) {
4491
- return O.createElement(
4492
- Qm,
4493
- {
4494
- node: n,
4495
- targetComponent: s
4496
- },
4497
- O.createElement(s, {
4498
- ref: l,
4499
- ...p
4500
- })
4501
- );
4502
- });
4503
- });
4504
- this.updateComponents(this.props.components), this.renderRef = O.createRef(), r.dropPlaceholder && (this.dropPlaceholder = r.dropPlaceholder);
4505
- }
4506
- updateComponents(r = {}) {
4507
- this._components = Object.assign(this._components, r), this.forceUpdate();
4508
- }
4509
- componentDidMount() {
4510
- var r, n;
4511
- window.__CHAMN_RENDER_MODE = "DESIGN", this.updateComponents(this.props.components), (n = (r = this.props).onMount) == null || n.call(r, this);
4512
- }
4513
- getPageModel() {
4514
- var r;
4515
- return (r = this.renderRef.current) == null ? void 0 : r.state.pageModel;
4516
- }
4517
- rerender(r) {
4518
- var n;
4519
- return (n = this.renderRef.current) == null ? void 0 : n.rerender(r);
4520
- }
4521
- getInstancesById(r, n) {
4522
- let o = [...this.instanceManager.get(r) || []];
4523
- return n !== void 0 && (o = o.filter((a) => n === (a == null ? void 0 : a._UNIQUE_ID))), o;
4524
- }
4525
- getInstanceByDom(r) {
4526
- const n = ra(r);
4527
- if (!n)
4528
- return null;
4529
- const o = na(n);
4530
- return (o == null ? void 0 : o.stateNode) || null;
4531
- }
4532
- getDomsById(r, n) {
4533
- const o = this.getInstancesById(r), a = [];
4534
- return o == null || o.forEach((i) => {
4535
- var c;
4536
- if ((i == null ? void 0 : i._STATUS) === "DESTROY")
4537
- return;
4538
- const s = da.findDOMNode(i);
4539
- if (s && !(s instanceof Text))
4540
- if (n) {
4541
- const u = Array.from(((c = s.querySelectorAll) == null ? void 0 : c.call(s, n)) || []);
4542
- a.push(...u);
4543
- } else
4544
- a.push(s);
4545
- }), a;
4546
- }
4547
- getDomRectById(r, n) {
4548
- return this.getDomsById(r, n).map((i) => i == null ? void 0 : i.getBoundingClientRect()).filter(Boolean);
4549
- }
4550
- render() {
4551
- const { props: r, onGetComponent: n } = this, { render: o, ...a } = r;
4552
- return o && (o.ref.current = this), O.createElement(Wm, {
4553
- onGetComponent: n,
4554
- ...a,
4555
- components: this._components,
4556
- // 拦截特殊属性配置, 配合设计模式使用
4557
- /**
4558
- * 可以对节点的一些配置数据做统一处理
4559
- * 比如: fixedProps 强制将 fixedProps 内的值覆盖 node 本省的配置
4560
- * 比如: 统一处理节点的 Condition 属性,控制节点是否显示
4561
- * @param config
4562
- * @param node
4563
- * @returns
4564
- */
4565
- processNodeConfigHook: (i, s) => {
4566
- var h, g;
4567
- if (s.nodeType !== "NODE")
4568
- return i;
4569
- const { props: c, condition: u } = i;
4570
- let f = { ...c };
4571
- const p = ((h = s.value.configure) == null ? void 0 : h.devState) || {}, l = (g = s.material) == null ? void 0 : g.value.fixedProps;
4572
- if (l !== void 0) {
4573
- if (Et(l))
4574
- f = {
4575
- ...f,
4576
- ...l
4577
- };
4578
- else if (typeof l == "function") {
4579
- const b = l(f);
4580
- f = {
4581
- ...f,
4582
- ...b
4583
- };
4584
- }
4585
- }
4586
- let d = u;
4587
- return p.condition === !1 && (d = p.condition), {
4588
- props: pm(f, p.props || {}),
4589
- condition: d
4590
- };
4591
- },
4592
- // renderMode: 'design',
4593
- ref: this.renderRef
4594
- });
4595
- }
4596
- }
4597
- const ra = (t) => {
4598
- if (!t)
4599
- return null;
4600
- const e = Object.keys(t).find((r) => r.startsWith("__reactInternalInstance$") || r.startsWith("__reactFiber$")) || "";
4601
- return e ? t[e] : ra(t.parentElement);
4602
- }, na = (t) => {
4603
- var e;
4604
- return t ? (e = t == null ? void 0 : t.stateNode) != null && e._DESIGN_BOX ? t : na(t.return) : null;
4605
- }, uv = () => {
4606
- const t = Bn(null);
4607
- return {
4608
- ref: t,
4609
- rerender: function(...e) {
4610
- t.current && t.current.rerender(...e);
4611
- },
4612
- getInstancesById(e, r) {
4613
- var n;
4614
- return ((n = t.current) == null ? void 0 : n.getInstancesById(e, r)) || [];
4615
- },
4616
- getInstanceByDom(e) {
4617
- var r;
4618
- return ((r = t.current) == null ? void 0 : r.getInstanceByDom(e)) || null;
4619
- },
4620
- getDomsById(e, r) {
4621
- var n;
4622
- return ((n = t.current) == null ? void 0 : n.getDomsById(e, r)) || [];
4623
- },
4624
- getDomRectById(e, r) {
4625
- var n;
4626
- return ((n = t.current) == null ? void 0 : n.getDomRectById(e, r)) || [];
4627
- }
4628
- };
4629
- };
4630
- var oa = { exports: {} };
4631
- (function(t, e) {
4632
- (function(r, n) {
4633
- t.exports = n();
4634
- })(Cm, function() {
4635
- var r = function() {
4636
- }, n = {}, o = {}, a = {};
4637
- function i(l, d) {
4638
- l = l.push ? l : [l];
4639
- var h = [], g = l.length, b = g, S, j, x, A;
4640
- for (S = function(D, k) {
4641
- k.length && h.push(D), b--, b || d(h);
4642
- }; g--; ) {
4643
- if (j = l[g], x = o[j], x) {
4644
- S(j, x);
4645
- continue;
4646
- }
4647
- A = a[j] = a[j] || [], A.push(S);
4648
- }
4649
- }
4650
- function s(l, d) {
4651
- if (l) {
4652
- var h = a[l];
4653
- if (o[l] = d, !!h)
4654
- for (; h.length; )
4655
- h[0](l, d), h.splice(0, 1);
4656
- }
4657
- }
4658
- function c(l, d) {
4659
- l.call && (l = { success: l }), d.length ? (l.error || r)(d) : (l.success || r)(l);
4660
- }
4661
- function u(l, d, h, g) {
4662
- var b = document, S = h.async, j = (h.numRetries || 0) + 1, x = h.before || r, A = l.replace(/[\?|#].*$/, ""), D = l.replace(/^(css|img|module|nomodule)!/, ""), k, Lt, C;
4663
- if (g = g || 0, /(^css!|\.css$)/.test(A))
4664
- C = b.createElement("link"), C.rel = "stylesheet", C.href = D, k = "hideFocus" in C, k && C.relList && (k = 0, C.rel = "preload", C.as = "style");
4665
- else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(A))
4666
- C = b.createElement("img"), C.src = D;
4667
- else if (C = b.createElement("script"), C.src = D, C.async = S === void 0 ? !0 : S, Lt = "noModule" in C, /^module!/.test(A)) {
4668
- if (!Lt)
4669
- return d(l, "l");
4670
- C.type = "module";
4671
- } else if (/^nomodule!/.test(A) && Lt)
4672
- return d(l, "l");
4673
- C.onload = C.onerror = C.onbeforeload = function(ot) {
4674
- var it = ot.type[0];
4675
- if (k)
4676
- try {
4677
- C.sheet.cssText.length || (it = "e");
4678
- } catch (ae) {
4679
- ae.code != 18 && (it = "e");
4680
- }
4681
- if (it == "e") {
4682
- if (g += 1, g < j)
4683
- return u(l, d, h, g);
4684
- } else if (C.rel == "preload" && C.as == "style")
4685
- return C.rel = "stylesheet";
4686
- d(l, it, ot.defaultPrevented);
4687
- }, x(l, C) !== !1 && b.head.appendChild(C);
4688
- }
4689
- function f(l, d, h) {
4690
- l = l.push ? l : [l];
4691
- var g = l.length, b = g, S = [], j, x;
4692
- for (j = function(A, D, k) {
4693
- if (D == "e" && S.push(A), D == "b")
4694
- if (k)
4695
- S.push(A);
4696
- else
4697
- return;
4698
- g--, g || d(S);
4699
- }, x = 0; x < b; x++)
4700
- u(l[x], j, h);
4701
- }
4702
- function p(l, d, h) {
4703
- var g, b;
4704
- if (d && d.trim && (g = d), b = (g ? h : d) || {}, g) {
4705
- if (g in n)
4706
- throw "LoadJS";
4707
- n[g] = !0;
4708
- }
4709
- function S(j, x) {
4710
- f(l, function(A) {
4711
- c(b, A), j && c({ success: j, error: x }, A), s(g, A);
4712
- }, b);
4713
- }
4714
- if (b.returnPromise)
4715
- return new Promise(S);
4716
- S();
4717
- }
4718
- return p.ready = function(d, h) {
4719
- return i(d, function(g) {
4720
- c(h, g);
4721
- }), p;
4722
- }, p.done = function(d) {
4723
- s(d, []);
4724
- }, p.reset = function() {
4725
- n = {}, o = {}, a = {};
4726
- }, p.isDefined = function(d) {
4727
- return d in n;
4728
- }, p;
4729
- });
4730
- })(oa);
4731
- var Km = oa.exports;
4732
- const Dn = /* @__PURE__ */ $m(Km);
4733
- class lv {
4734
- constructor(e, r) {
4735
- y(this, "assets");
4736
- y(this, "loadStatus");
4737
- y(this, "win", window);
4738
- y(this, "_onSuccessList", []);
4739
- y(this, "_onErrorList", []);
4740
- this.assets = JSON.parse(JSON.stringify(e || [])), this.loadStatus = "INIT", r != null && r.window && (this.win = r.window);
4741
- }
4742
- load(e) {
4743
- const r = this.assets || [], n = [];
4744
- for (let o = 0; o < r.length; o++) {
4745
- const a = r[o];
4746
- a.id || (a.id = Z()), n.push(a.id);
4747
- const i = a.resources.map((s) => s.src);
4748
- i.length && Dn(i, a.id, {
4749
- async: (e == null ? void 0 : e.async) ?? !1,
4750
- before: (s, c) => (this.win.document.body.appendChild(c), !1)
4751
- });
4752
- }
4753
- return new Promise((o, a) => {
4754
- if (r.length === 0) {
4755
- this._onSuccessList.forEach((i) => i()), o("");
4756
- return;
4757
- }
4758
- Dn.ready(n, {
4759
- success: () => {
4760
- this._onSuccessList.forEach((i) => i()), o("");
4761
- },
4762
- error: (i) => {
4763
- this._onErrorList.forEach((s) => s(i)), a(i);
4764
- }
4765
- });
4766
- });
4767
- }
4768
- onSuccess(e) {
4769
- return this._onSuccessList.push(e), this;
4770
- }
4771
- onError(e) {
4772
- return this._onErrorList.push(e), this;
4773
- }
4774
- }
4775
- export {
4776
- lv as AssetLoader,
4777
- qm as ComponentInstanceManager,
4778
- Ym as DefaultDropPlaceholder,
4779
- Om as DefineReactAdapter,
4780
- cv as DesignRender,
4781
- sv as ReactAdapter,
4782
- Wm as Render,
4783
- hm as canAcceptsRef,
4784
- rv as collectVariable,
4785
- mm as compWrapper,
4786
- vm as convertCodeStringToFunction,
4787
- ym as findComponentByChainRefer,
4788
- nv as flatObject,
4789
- Rn as formatSourceStylePropertyName,
4790
- va as getAdapter,
4791
- ev as getCSSTextValue,
4792
- ov as getComponentsLibs,
4793
- gm as getMatchVal,
4794
- Fe as getNodeCssClassName,
4795
- Pn as getObjFromArrayMap,
4796
- av as getThirdLibs,
4797
- tv as isClass,
4798
- bt as runExpression,
4799
- dm as shouldConstruct,
4800
- uv as useDesignRender,
4801
- iv as useRender
4802
- };
4803
- //# sourceMappingURL=index.mjs.map