@wibetter/json-utils 6.0.1 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +4 -5
  2. package/dist/index.esm.js +572 -5501
  3. package/dist/index.esm.min.js +1 -4535
  4. package/dist/index.js +1 -1600
  5. package/dist/index.js.LICENSE.txt +2 -2
  6. package/dist/types/data/KeyWordList.d.ts +1 -0
  7. package/dist/types/data/TypeDataList.d.ts +129 -0
  8. package/dist/types/data/index.d.ts +31 -0
  9. package/dist/types/data/initSchemaEntity/Api.d.ts +43 -0
  10. package/dist/types/data/initSchemaEntity/Array.d.ts +20 -0
  11. package/dist/types/data/initSchemaEntity/Boolean.d.ts +6 -0
  12. package/dist/types/data/initSchemaEntity/BoxStyle.d.ts +32 -0
  13. package/dist/types/data/initSchemaEntity/Cascader.d.ts +20 -0
  14. package/dist/types/data/initSchemaEntity/Checkbox.d.ts +10 -0
  15. package/dist/types/data/initSchemaEntity/CodeArea.d.ts +7 -0
  16. package/dist/types/data/initSchemaEntity/Color.d.ts +6 -0
  17. package/dist/types/data/initSchemaEntity/DataSource.d.ts +73 -0
  18. package/dist/types/data/initSchemaEntity/Date.d.ts +7 -0
  19. package/dist/types/data/initSchemaEntity/DateTime.d.ts +7 -0
  20. package/dist/types/data/initSchemaEntity/DynamicData.d.ts +105 -0
  21. package/dist/types/data/initSchemaEntity/EmptyArray.d.ts +12 -0
  22. package/dist/types/data/initSchemaEntity/EmptyObject.d.ts +6 -0
  23. package/dist/types/data/initSchemaEntity/Event.d.ts +96 -0
  24. package/dist/types/data/initSchemaEntity/FuncBody.d.ts +7 -0
  25. package/dist/types/data/initSchemaEntity/HtmlArea.d.ts +7 -0
  26. package/dist/types/data/initSchemaEntity/IMG.d.ts +12 -0
  27. package/dist/types/data/initSchemaEntity/Input.d.ts +7 -0
  28. package/dist/types/data/initSchemaEntity/InputImage.d.ts +7 -0
  29. package/dist/types/data/initSchemaEntity/JSONSchema.d.ts +60 -0
  30. package/dist/types/data/initSchemaEntity/Json.d.ts +6 -0
  31. package/dist/types/data/initSchemaEntity/Number.d.ts +8 -0
  32. package/dist/types/data/initSchemaEntity/Object.d.ts +24 -0
  33. package/dist/types/data/initSchemaEntity/PaddingMargin.d.ts +38 -0
  34. package/dist/types/data/initSchemaEntity/Quantity.d.ts +34 -0
  35. package/dist/types/data/initSchemaEntity/Radio.d.ts +9 -0
  36. package/dist/types/data/initSchemaEntity/Select.d.ts +9 -0
  37. package/dist/types/data/initSchemaEntity/TextEditor.d.ts +7 -0
  38. package/dist/types/data/initSchemaEntity/Textarea.d.ts +7 -0
  39. package/dist/types/data/initSchemaEntity/Time.d.ts +7 -0
  40. package/dist/types/data/initSchemaEntity/URL.d.ts +7 -0
  41. package/dist/types/function/getExpectType.d.ts +2 -0
  42. package/dist/types/function/getJsonDataByKeyRoute.d.ts +8 -0
  43. package/dist/types/function/getSchemaByIndexRoute.d.ts +8 -0
  44. package/dist/types/function/getSchemaByKeyRoute.d.ts +8 -0
  45. package/dist/types/function/indexRoute2keyRoute.d.ts +7 -0
  46. package/dist/types/function/json2schema.d.ts +4 -0
  47. package/dist/types/function/json2treeData.d.ts +8 -0
  48. package/dist/types/function/keyRoute2indexRoute.d.ts +7 -0
  49. package/dist/types/function/metaElemAnalyzer.d.ts +2 -0
  50. package/dist/types/function/oldSchemaToNewSchema.d.ts +2 -0
  51. package/dist/types/function/schema2conditionValue.d.ts +4 -0
  52. package/dist/types/function/schema2json.d.ts +5 -0
  53. package/dist/types/function/schemaMetaList.d.ts +1 -0
  54. package/dist/types/main.d.ts +74 -0
  55. package/dist/types/utils/index.d.ts +24 -0
  56. package/dist/types/utils/jsonData.d.ts +8 -0
  57. package/dist/types/utils/jsonSchema.d.ts +55 -0
  58. package/dist/types/utils/typeof.d.ts +32 -0
  59. package/package.json +7 -4
@@ -1,4535 +1 @@
1
- import { cloneDeep as e, isEqual as t, truncate as r } from 'lodash';
2
- import n from 'qs';
3
- var o,
4
- i = {
5
- type: 'event',
6
- title: '事件',
7
- isContainer: !1,
8
- properties: {
9
- type: {
10
- default: 'emit',
11
- type: 'select',
12
- options: [
13
- { label: 'on', value: 'on' },
14
- { label: 'emit', value: 'emit' },
15
- ],
16
- title: '事件类型',
17
- },
18
- trigger: {
19
- type: 'input',
20
- default: 'eventName',
21
- title: '触发事件',
22
- description: '用于输入触发事件的名称',
23
- placeholder: '请输入触发事件的名称',
24
- },
25
- eventData: {
26
- title: '事件数据',
27
- type: 'json',
28
- default: '{}',
29
- description: '传递给触发事件的数据对象',
30
- },
31
- },
32
- propertyOrder: ['type', 'trigger', 'eventData'],
33
- },
34
- a = {
35
- type: 'datasource',
36
- title: '数据源',
37
- isContainer: !1,
38
- properties: {
39
- type: {
40
- default: 'local',
41
- type: 'select',
42
- options: [
43
- { label: '本地数据', value: 'local' },
44
- { label: '接口数据', value: 'remote' },
45
- ],
46
- title: '数据源类型',
47
- },
48
- data: {
49
- title: '本地json数据',
50
- placeholder: '请输入静态json数据',
51
- type: 'json',
52
- default: '{}',
53
- description: '用于设置本地的静态json数据',
54
- isRequired: !0,
55
- },
56
- filter: {
57
- title: '过滤器',
58
- type: 'codearea',
59
- default: '() => {}',
60
- description: '用于定义过滤当前数据的函数',
61
- isRequired: !0,
62
- },
63
- },
64
- propertyOrder: ['type', 'data', 'filter'],
65
- },
66
- s =
67
- (((o = { type: 'object' }).type = 'datasource'),
68
- (o.title = '数据源'),
69
- (o.isContainer = !1),
70
- (o.properties = {
71
- type: {
72
- type: 'select',
73
- default: 'remote',
74
- options: [
75
- { label: '本地数据', value: 'local' },
76
- { label: '接口数据', value: 'remote' },
77
- ],
78
- title: '数据源类型',
79
- },
80
- data: {
81
- type: 'url',
82
- title: '远程json数据',
83
- placeholder: '请输入远程json数据源地址',
84
- default: 'http://xxx',
85
- isRequired: !0,
86
- description: '用于设置获取元素数据的请求地址',
87
- },
88
- filter: {
89
- type: 'codearea',
90
- title: '过滤器',
91
- default: '() => {}',
92
- description: '用于定义过滤当前数据的函数',
93
- isRequired: !0,
94
- },
95
- }),
96
- (o.propertyOrder = ['type', 'data', 'filter']),
97
- o),
98
- u = {
99
- type: 'local',
100
- config: { dataName: '', body: {}, filter: 'return data;' },
101
- data: '{}',
102
- localFilter: 'return data;',
103
- },
104
- c = {
105
- jsonschema: {
106
- type: 'object',
107
- title: 'jsonSchemaObject',
108
- properties: {
109
- func: {
110
- type: 'object',
111
- title: '功能设置',
112
- properties: {
113
- a: {
114
- title: '单文本框',
115
- type: 'input',
116
- default: '',
117
- description: '',
118
- placeholder: '',
119
- isRequired: !1,
120
- },
121
- },
122
- propertyOrder: ['a'],
123
- },
124
- style: {
125
- type: 'object',
126
- title: '样式设置',
127
- properties: {
128
- b: {
129
- title: '单文本框',
130
- type: 'input',
131
- default: '',
132
- description: '',
133
- placeholder: '',
134
- },
135
- },
136
- propertyOrder: ['b'],
137
- },
138
- data: {
139
- type: 'data',
140
- title: '数据设置',
141
- properties: {
142
- c: {
143
- title: '单文本框',
144
- type: 'input',
145
- default: '',
146
- description: '',
147
- placeholder: '',
148
- isRequired: !1,
149
- },
150
- },
151
- propertyOrder: ['c'],
152
- },
153
- },
154
- propertyOrder: ['func', 'style', 'data'],
155
- },
156
- input: {
157
- title: '单文本框',
158
- type: 'input',
159
- default: '',
160
- description: '',
161
- placeholder: '',
162
- },
163
- boolean: { type: 'boolean', title: '布尔值', default: !1, description: '' },
164
- object: {
165
- type: 'object',
166
- title: '对象Object',
167
- description: '',
168
- properties: {
169
- a: {
170
- type: 'input',
171
- title: '单文本框',
172
- default: '',
173
- description: '',
174
- placeholder: '',
175
- },
176
- },
177
- propertyOrder: ['a'],
178
- },
179
- array: {
180
- type: 'array',
181
- title: '数组Array',
182
- description: '',
183
- items: {
184
- type: 'object',
185
- title: '数组项',
186
- description: '',
187
- properties: {
188
- name: {
189
- type: 'input',
190
- title: '名字',
191
- default: '',
192
- description: '',
193
- placeholder: '',
194
- },
195
- },
196
- propertyOrder: ['name'],
197
- },
198
- },
199
- 'empty-array': {
200
- type: 'array',
201
- title: '数组Array',
202
- description: '',
203
- default: [],
204
- items: {
205
- type: 'object',
206
- title: '数组项',
207
- description: '',
208
- properties: {},
209
- },
210
- },
211
- 'empty-object': {
212
- type: 'object',
213
- title: '对象Object',
214
- description: '',
215
- properties: {},
216
- },
217
- url: {
218
- type: 'url',
219
- title: '链接地址url',
220
- default: '',
221
- description: '',
222
- placeholder: '',
223
- },
224
- textarea: {
225
- type: 'textarea',
226
- title: '多行文本框',
227
- default: '',
228
- description: '',
229
- placeholder: '',
230
- },
231
- color: {
232
- type: 'color',
233
- title: '颜色color',
234
- default: '#ffffff',
235
- description: '',
236
- },
237
- image: {
238
- title: '图片',
239
- type: 'image',
240
- default: '',
241
- description: '上传图片',
242
- imgWidth: 200,
243
- imgHeight: 200,
244
- imgRatioReadOnly: !0,
245
- },
246
- number: {
247
- type: 'number',
248
- title: '数量number',
249
- default: 1,
250
- minimum: 0,
251
- maximum: 1e3,
252
- description: '',
253
- },
254
- 'input-image': {
255
- title: '图片地址',
256
- type: 'input-image',
257
- description: '',
258
- accept: '.jpeg,.jpg,.png',
259
- multiple: !0,
260
- },
261
- json: { title: 'json数据', type: 'json', default: '{}', description: '' },
262
- codearea: {
263
- type: 'codearea',
264
- title: '函数类型',
265
- placeholder: '请输入函数方法',
266
- default: 'function func() { console.log("hello, world!"); }',
267
- description: '用于定义函数方法',
268
- },
269
- htmlarea: {
270
- title: '富文本',
271
- type: 'htmlarea',
272
- placeholder: '请输入html代码片段',
273
- default: '<p>hello,world!</p>',
274
- description: '用于放置html代码片段',
275
- },
276
- 'text-editor': {
277
- type: 'text-editor',
278
- title: '富文本',
279
- default: '',
280
- description: '',
281
- placeholder: '',
282
- },
283
- date: {
284
- type: 'date',
285
- title: '日期Date',
286
- default: '',
287
- description: '',
288
- placeholder: '',
289
- },
290
- 'date-time': {
291
- type: 'date-time',
292
- title: '日期时间',
293
- default: '',
294
- description: '',
295
- placeholder: '',
296
- },
297
- time: {
298
- type: 'time',
299
- title: '时间Time',
300
- default: '',
301
- description: '',
302
- placeholder: '',
303
- },
304
- quantity: {
305
- type: 'quantity',
306
- title: '单位计量',
307
- isContainer: !1,
308
- properties: {
309
- unit: {
310
- type: 'number',
311
- title: '单位数值',
312
- default: 50,
313
- minimum: 0,
314
- maximum: 1e3,
315
- description: '',
316
- },
317
- quantity: {
318
- type: 'select',
319
- default: 'px',
320
- options: [
321
- { label: 'px', value: 'px' },
322
- { label: 'rem', value: 'rem' },
323
- { label: 'em', value: 'em' },
324
- { label: '%', value: '%' },
325
- ],
326
- title: '单位类型',
327
- },
328
- },
329
- propertyOrder: ['unit', 'quantity'],
330
- },
331
- 'box-style': {
332
- type: 'box-style',
333
- title: '盒子模型',
334
- isContainer: !1,
335
- properties: {
336
- unit: {
337
- title: '单位数值',
338
- type: 'input',
339
- default: '0',
340
- description: '',
341
- },
342
- quantity: {
343
- type: 'select',
344
- default: 'px',
345
- options: [
346
- { label: 'px', value: 'px' },
347
- { label: 'rem', value: 'rem' },
348
- { label: 'em', value: 'em' },
349
- { label: '%', value: '%' },
350
- ],
351
- title: '单位类型',
352
- },
353
- },
354
- propertyOrder: ['unit', 'quantity'],
355
- },
356
- 'padding-margin': {
357
- type: 'padding-margin',
358
- title: '边距设置',
359
- isContainer: !1,
360
- properties: {
361
- margin: {
362
- title: '外边距',
363
- type: 'input',
364
- default: '0',
365
- description: '',
366
- },
367
- padding: {
368
- title: '内边距',
369
- type: 'input',
370
- default: '0',
371
- description: '',
372
- },
373
- quantity: {
374
- type: 'select',
375
- default: 'px',
376
- options: [
377
- { label: 'px', value: 'px' },
378
- { label: 'rem', value: 'rem' },
379
- { label: 'em', value: 'em' },
380
- { label: '%', value: '%' },
381
- ],
382
- title: '单位类型',
383
- },
384
- },
385
- propertyOrder: ['margin', 'padding', 'quantity'],
386
- },
387
- radio: {
388
- type: 'radio',
389
- title: '单选',
390
- options: [
391
- { label: '选项a', value: 'a' },
392
- { label: '选项b', value: 'b' },
393
- { label: '选项c', value: 'c' },
394
- ],
395
- description: '',
396
- },
397
- select: {
398
- type: 'select',
399
- title: '下拉选择',
400
- options: [
401
- { label: '选项a', value: 'a' },
402
- { label: '选项b', value: 'b' },
403
- { label: '选项c', value: 'c' },
404
- ],
405
- description: '',
406
- },
407
- cascader: {
408
- type: 'cascader',
409
- title: '级联选择',
410
- options: [
411
- {
412
- value: 'zhejiang',
413
- label: 'Zhejiang',
414
- children: [
415
- {
416
- value: 'hangzhou',
417
- label: 'Hangzhou',
418
- children: [{ value: 'xihu', label: 'West Lake' }],
419
- },
420
- ],
421
- },
422
- {
423
- value: 'jiangsu',
424
- label: 'Jiangsu',
425
- children: [
426
- {
427
- value: 'nanjing',
428
- label: 'Nanjing',
429
- children: [{ value: 'zhonghuamen', label: 'Zhong Hua Men' }],
430
- },
431
- ],
432
- },
433
- ],
434
- default: 'a',
435
- description: '',
436
- showSearch: !0,
437
- allowClear: !0,
438
- },
439
- checkboxes: {
440
- type: 'checkboxes',
441
- title: '多选',
442
- options: [
443
- { label: '选项a', value: 'a' },
444
- { label: '选项b', value: 'b' },
445
- { label: '选项c', value: 'c' },
446
- ],
447
- default: ['a'],
448
- description: '',
449
- },
450
- 'dynamic-data': {
451
- type: 'dynamic-data',
452
- title: '动态数据源',
453
- isContainer: !1,
454
- properties: {
455
- type: {
456
- default: 'local',
457
- type: 'select',
458
- options: [
459
- { label: '本地数据', value: 'local' },
460
- { label: '接口数据', value: 'remote' },
461
- ],
462
- title: '数据类型',
463
- },
464
- config: {
465
- title: '接口配置',
466
- type: 'object',
467
- description: '用于存放接口的配置数据(url、请求参数等)',
468
- isRequired: !0,
469
- properties: {
470
- dataName: {
471
- default: 'local',
472
- type: 'select',
473
- options: [
474
- { label: '本地数据', value: 'local' },
475
- { label: '接口数据', value: 'remote' },
476
- ],
477
- title: '数据类型',
478
- },
479
- body: {
480
- type: 'object',
481
- title: '请求参数配置',
482
- description: '用于配置当前接口的请求参数数值',
483
- isRequired: !0,
484
- },
485
- filter: {
486
- title: '过滤器函数体',
487
- type: 'codearea',
488
- default: 'return data;',
489
- description: '用于定义过滤接口数据',
490
- isRequired: !0,
491
- },
492
- },
493
- propertyOrder: ['dataName', 'body', 'filter'],
494
- },
495
- data: {
496
- title: '数据内容',
497
- type: 'json',
498
- default: '{}',
499
- description: '用于存放DynamicData的数据内容',
500
- isRequired: !0,
501
- },
502
- localFilter: {
503
- title: '过滤器',
504
- type: 'codearea',
505
- default: 'return data;',
506
- description: '用于定义过滤本地数据',
507
- isRequired: !0,
508
- },
509
- },
510
- propertyOrder: ['type', 'config', 'data', 'localFilter'],
511
- },
512
- datasource: a,
513
- event: i,
514
- },
515
- p = {
516
- on: {
517
- type: 'event',
518
- title: '事件',
519
- isContainer: !1,
520
- properties: {
521
- type: {
522
- default: 'on',
523
- type: 'select',
524
- options: [
525
- { label: 'on', value: 'on' },
526
- { label: 'emit', value: 'emit' },
527
- ],
528
- title: '事件类型',
529
- },
530
- register: {
531
- type: 'input',
532
- default: 'eventName',
533
- title: '注册事件',
534
- description: '用于输入注册事件的名称',
535
- placeholder: '请输入注册事件的名称',
536
- },
537
- actionFunc: {
538
- title: '执行函数',
539
- type: 'codearea',
540
- default: '() => {}',
541
- description: '',
542
- },
543
- },
544
- propertyOrder: ['type', 'register', 'actionFunc'],
545
- },
546
- emit: i,
547
- },
548
- l = { local: a, remote: s };
549
- function d(e) {
550
- return /^http[s]?:\/\/.*/.test(e);
551
- }
552
- function f(e) {
553
- return 'String' === Object.prototype.toString.call(e).slice(8, -1);
554
- }
555
- function h(e) {
556
- return (
557
- 'number' == typeof e ||
558
- '[object Number]' === Object.prototype.toString.call(e)
559
- );
560
- }
561
- function v(e) {
562
- return 'Boolean' === Object.prototype.toString.call(e).slice(8, -1);
563
- }
564
- function y(e) {
565
- return /^\d{4}-\d{2}-\d{2}$/.test(e);
566
- }
567
- function b(e) {
568
- return (
569
- /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e) ||
570
- /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)
571
- );
572
- }
573
- function m(e) {
574
- return /^\d{2}:\d{2}:\d{2}$/.test(e) || /^\d{2}:\d{2}$/.test(e);
575
- }
576
- function g(e) {
577
- var t = !1;
578
- return (
579
- 'Array' === Object.prototype.toString.call(e).slice(8, -1) && (t = !0), t
580
- );
581
- }
582
- function O(e) {
583
- if (!g(e)) return !1;
584
- for (var t = 0, r = e.length; t < r; t++) {
585
- if (!f(e[t])) return !1;
586
- }
587
- return !0;
588
- }
589
- function E(e) {
590
- var t = !1;
591
- return (
592
- 'Object' === Object.prototype.toString.call(e).slice(8, -1) && (t = !0), t
593
- );
594
- }
595
- function N(e) {
596
- var t = !1;
597
- return c.quantity.properties.quantity.enum.indexOf(e) >= 0 && (t = !0), t;
598
- }
599
- function w(e) {
600
- return /^#[0-9a-f]{6}$/.test(e) || /^#[0-9a-f]{3}$/.test(e);
601
- }
602
- function _(e) {
603
- var t = !1;
604
- return (
605
- 'Function' === Object.prototype.toString.call(e).slice(8, -1) && (t = !0), t
606
- );
607
- }
608
- function j() {
609
- var e = {};
610
- return location.search && (e = n.parse(location.search.substring(1))), e;
611
- }
612
- function x(e) {
613
- var t = '';
614
- return url && (t = n.stringify(e)), t;
615
- }
616
- function S(t) {
617
- return e(t);
618
- }
619
- function D(e, r) {
620
- if ((V(e) && !V(r)) || (!V(e) && V(r)) || typeof e != typeof r) return !1;
621
- if (E(e) && (e.id !== r.id || e.lastUpdateTime !== r.lastUpdateTime))
622
- return !1;
623
- var n = new Date().getTime();
624
- return (
625
- !!(
626
- E(e) &&
627
- e.lastUpdateTime &&
628
- e.lastUpdateTime === r.lastUpdateTime &&
629
- n - e.lastUpdateTime < 500
630
- ) || t(e, r)
631
- );
632
- }
633
- function A(e, r) {
634
- if ((V(e) && !V(r)) || (!V(e) && V(r)) || typeof e != typeof r) return !1;
635
- if (E(e) && (e.id !== r.id || e.lastUpdateTime !== r.lastUpdateTime))
636
- return !1;
637
- var n = new Date().getTime();
638
- return (
639
- !!(
640
- E(e) &&
641
- e.lastUpdateTime &&
642
- e.lastUpdateTime === r.lastUpdateTime &&
643
- n - e.lastUpdateTime < 500
644
- ) ||
645
- !(
646
- !E(e) ||
647
- !(
648
- (V(e.id) && e.id === r.id) ||
649
- (V(e.lastUpdateTime) && e.lastUpdateTime === r.lastUpdateTime)
650
- )
651
- ) ||
652
- t(e, r)
653
- );
654
- }
655
- function V(e) {
656
- var t = !1;
657
- return null != e && (t = !0), t;
658
- }
659
- function T(e, t) {
660
- return r(e, t);
661
- }
662
- function k(e, t) {
663
- var r = t || {};
664
- if (!e) return !1;
665
- var n = new Function('data', 'with(data) { return (' + e + ');}'),
666
- o = '';
667
- try {
668
- o = n(r);
669
- } catch (t) {
670
- return console.warn('表达式运算出错: ' + e + ',报错信息:', t), o;
671
- }
672
- return o;
673
- }
674
- function C(e, t, r) {
675
- var n = t;
676
- if ((r && (n = S(t)), e))
677
- for (var o = e.split('-'), i = 0, a = o.length; i < a; i++) {
678
- var s = o[i];
679
- s && (n = n && n[s]);
680
- }
681
- return n;
682
- }
683
- function R(e, t, r) {
684
- var n = t;
685
- if ((r && (n = S(t)), e))
686
- for (var o = e.split('-'), i = 0, a = o.length; i < a; i++) {
687
- var s = o[i];
688
- if (
689
- '0' !== s ||
690
- ('array' !== n.type &&
691
- 'radio' !== n.type &&
692
- 'select' !== n.type &&
693
- 'checkboxes' !== n.type) ||
694
- (!n.options && !n.items)
695
- ) {
696
- if (s) {
697
- var u = '0';
698
- if (n.propertyOrder) u = n.propertyOrder[s];
699
- else if (n.properties) {
700
- u = Object.keys(n.properties)[s];
701
- }
702
- n = n.properties[u];
703
- }
704
- } else n = n.options || n.items;
705
- }
706
- return n;
707
- }
708
- function P(e, t, r) {
709
- var n = t;
710
- if ((r && (n = S(t)), e && n))
711
- for (var o = e.split('-'), i = 0, a = o.length; i < a; i++) {
712
- var s = o[i];
713
- s && n.properties && (n = n.properties[s]);
714
- }
715
- return n;
716
- }
717
- function U(e, t) {
718
- for (var r = t, n = '', o = e.split('-'), i = 0, a = o.length; i < a; i++) {
719
- var s = o[i];
720
- if ('0' === s && r.items) (r = r.items), (n = n ? n + '-items' : 'items');
721
- else if ('0' === s && r.options)
722
- (r = r.options), (n = n ? n + '-options' : 'options');
723
- else if (s) {
724
- var u = '0';
725
- if (r.propertyOrder) u = r.propertyOrder[s];
726
- else if (r.properties) {
727
- u = Object.keys(r.properties)[s];
728
- }
729
- (r = r.properties[u]), (n = n ? n + '-' + u : u);
730
- }
731
- }
732
- return n;
733
- }
734
- function q(e, t) {
735
- for (var r = t, n = '', o = e.split('-'), i = 0, a = o.length; i < a; i++) {
736
- var s = o[i];
737
- if (s) {
738
- var u = -1;
739
- if (r.propertyOrder)
740
- (u = r.propertyOrder.indexOf(s)), (r = r.properties[s]);
741
- else if (r.properties) {
742
- (u = Object.keys(r.properties).indexOf(s)), (r = r.properties[s]);
743
- } else
744
- r.items
745
- ? ((u = 0), (r = r.items))
746
- : r.options && ((u = 0), (r = r.options));
747
- n = n ? n + '-' + u : u.toString();
748
- }
749
- }
750
- return n;
751
- }
752
- function L(e) {
753
- var t = {};
754
- return (
755
- (t =
756
- e && E(e)
757
- ? (function (e) {
758
- var t;
759
- if (E(e)) {
760
- var r = Object.keys(e);
761
- e.data && e.filter && 2 === r.length
762
- ? (t = g(e.data) || E(e.data) ? S(l.local) : S(l.remote))
763
- : e.trigger && e.eventData && 2 === r.length
764
- ? (t = S(p.emit))
765
- : e.register && e.actionFunc && 2 === r.length
766
- ? (t = S(p.on))
767
- : e.quantity && N(e.quantity) && 2 === r.length
768
- ? (t = S(c.quantity))
769
- : ((t = S(c['empty-object'])),
770
- Object.keys(e).map(function (r) {
771
- var n = e[r];
772
- t.properties[r] = L(n);
773
- }));
774
- }
775
- return t;
776
- })(e)
777
- : e && g(e)
778
- ? (function (e) {
779
- var t;
780
- if (e && g(e))
781
- if (O(e)) {
782
- (t = S(c.select)).items.enum = e;
783
- var r = t.items.enumextra.length,
784
- n = e.length;
785
- if (n > r)
786
- for (var o = r, i = n; o < i; o++)
787
- t.items.enumextra.push('选项' + e(o));
788
- } else {
789
- t = S(c['empty-array']);
790
- var a = L(e[0]);
791
- t.items.properties = a.properties;
792
- }
793
- return t;
794
- })(e)
795
- : (function (e) {
796
- var t = '';
797
- if (v(e)) t = S(c.boolean);
798
- else if (h(e)) t = S(c.number);
799
- else if (d(e)) t = S(c.url);
800
- else if (y(e)) t = S(c.date);
801
- else if (b(e)) t = S(c['date-time']);
802
- else if (m(e)) t = S(c.time);
803
- else if (w(e)) t = S(c.color);
804
- else
805
- try {
806
- t = h(JSON.parse(e)) ? S(c.input) : S(c.json);
807
- } catch (r) {
808
- t = e && e.length > 30 ? S(c.textarea) : S(c.input);
809
- }
810
- return t;
811
- })(e)),
812
- t
813
- );
814
- }
815
- function B(e, t) {
816
- var r = t || {};
817
- if (E(e) && 'object' === getExpectType(e.type) && e.properties) {
818
- (e.propertyOrder ? e.propertyOrder : Object.keys(e.properties)).map(
819
- function (t) {
820
- var n = e.properties[t];
821
- r = I(n, r);
822
- },
823
- );
824
- }
825
- return r;
826
- }
827
- function I(e, t) {
828
- var r = !t,
829
- n = t || {};
830
- if (e && '{}' !== JSON.stringify(e)) {
831
- var o = e.type;
832
- 'object' === o || 'func' === o || 'style' === o || 'data' === o
833
- ? (!r && n.object ? (n.object += 1) : r || (n.object = 1), (n = B(e, n)))
834
- : 'array' === o
835
- ? (!r && n.array ? (n.array += 1) : r || (n.array = 1),
836
- (n = B((e = e.items), n)))
837
- : !r && n[o]
838
- ? (n[o] += 1)
839
- : r || (n[o] = 1);
840
- }
841
- return n;
842
- }
843
- function M(e) {
844
- var t = S(e);
845
- if (
846
- (!t.title && t.description && (t.title = t.description),
847
- t.type || (t.type = t.format),
848
- ('quantity' !== t.type &&
849
- 'array' !== t.type &&
850
- 'datasource' !== t.type &&
851
- 'event' !== t.type &&
852
- 'object' !== t.type) ||
853
- !V(t.default) ||
854
- delete t.default,
855
- 'radio' === t.type &&
856
- ((t.type = 'string'),
857
- t.enum &&
858
- t.enumextra &&
859
- ((t.items = {
860
- type: 'string',
861
- enum: S(t.enum),
862
- enumextra: S(t.enumextra),
863
- }),
864
- delete t.enum,
865
- delete t.enumextra)),
866
- 'quantity' === t.type)
867
- ) {
868
- var r = t.properties,
869
- n = S(c.quantity);
870
- if (r.quantity && E(r.quantity) && r.quantity.default) {
871
- var o = r.quantity.default;
872
- n.properties.quantity.default = 'percent' === o ? '%' : o;
873
- }
874
- t = n;
875
- }
876
- if ('datasource' === t.type) {
877
- var i = t.properties,
878
- a = i.type && i.type.default,
879
- s = i.data && i.data.default,
880
- u = i.filter && i.filter.default;
881
- 'local' === a
882
- ? ((t = S(l.local)).properties.data.default = s ? S(s) : '{}')
883
- : ((t = S(l.remote)).properties.data.default = s ? S(s) : 'http://xxx'),
884
- (t.properties.filter.default = u ? S(u) : '() => {}');
885
- }
886
- if ('event' === t.type) {
887
- var d = t.properties,
888
- f = d.type && d.type.default;
889
- if ('in' === f || 'on' === f) {
890
- var h = (d.filter && d.filter.default) || '() => {}';
891
- (t = S(p.on)),
892
- d.actionFunc &&
893
- E(d.actionFunc) &&
894
- (t.properties.actionFunc.default = d.actionFunc.default || S(h));
895
- } else {
896
- var v = (d.filter && d.filter.default) || '{}';
897
- (t = S(p.emit)),
898
- d.eventData &&
899
- E(d.eventData) &&
900
- (t.properties.eventData.default = d.eventData.default || S(v));
901
- }
902
- }
903
- return (
904
- t.properties &&
905
- (t.propertyOrder || (t.propertyOrder = Object.keys(t.properties)),
906
- t.propertyOrder.map(function (e) {
907
- t.properties[e] = G(t.properties[e]);
908
- })),
909
- t.items && (t.items = G(t.items)),
910
- t
911
- );
912
- }
913
- function G(e) {
914
- var t = S(e);
915
- return (
916
- t.required || delete t.required,
917
- t.type && t.type && (t.type = t.type),
918
- ('quantity' !== t.type &&
919
- 'array' !== t.type &&
920
- 'datasource' !== t.type &&
921
- 'event' !== t.type &&
922
- 'object' !== t.type) ||
923
- !V(t.default) ||
924
- delete t.default,
925
- ('radio' !== t.type && 'checkboxes' !== t.type && 'select' !== t.type) ||
926
- (t.items &&
927
- t.items.enum &&
928
- t.items.enumextra &&
929
- ((t.options = []),
930
- t.items.enum.forEach(function (e, r) {
931
- t.options.push({ label: t.items.enumextra[r] || e, value: e });
932
- }),
933
- delete t.items)),
934
- t.properties &&
935
- (t.propertyOrder || (t.propertyOrder = Object.keys(t.properties)),
936
- t.propertyOrder.map(function (e) {
937
- t.properties[e] = G(t.properties[e]);
938
- })),
939
- 'array' === t.type && t.items && (t.items = G(t.items)),
940
- t
941
- );
942
- }
943
- var z = [];
944
- Object.freeze(z);
945
- var K = {};
946
- function F() {
947
- return ++ft.mobxGuid;
948
- }
949
- function J(e) {
950
- throw (H(!1, e), 'X');
951
- }
952
- function H(e, t) {
953
- if (!e)
954
- throw new Error(
955
- '[mobx] ' +
956
- (t ||
957
- 'An invariant failed, however the error is obfuscated because this is a production build.'),
958
- );
959
- }
960
- function W(e) {
961
- var t = !1;
962
- return function () {
963
- if (!t) return (t = !0), e.apply(this, arguments);
964
- };
965
- }
966
- Object.freeze(K);
967
- var X = function () {};
968
- function $(e) {
969
- return null !== e && 'object' == typeof e;
970
- }
971
- function Y(e) {
972
- if (null === e || 'object' != typeof e) return !1;
973
- var t = Object.getPrototypeOf(e);
974
- return t === Object.prototype || null === t;
975
- }
976
- function Z(e, t, r) {
977
- Object.defineProperty(e, t, {
978
- enumerable: !1,
979
- writable: !0,
980
- configurable: !0,
981
- value: r,
982
- });
983
- }
984
- function Q(e, t) {
985
- var r = Object.getOwnPropertyDescriptor(e, t);
986
- return !r || (!1 !== r.configurable && !1 !== r.writable);
987
- }
988
- function ee(e, t) {
989
- var r = 'isMobX' + e;
990
- return (
991
- (t.prototype[r] = !0),
992
- function (e) {
993
- return $(e) && !0 === e[r];
994
- }
995
- );
996
- }
997
- function te(e) {
998
- return e instanceof Map;
999
- }
1000
- function re(e) {
1001
- return e instanceof Set;
1002
- }
1003
- function ne(e) {
1004
- var t = new Set();
1005
- for (var r in e) t.add(r);
1006
- return (
1007
- Object.getOwnPropertySymbols(e).forEach(function (r) {
1008
- Object.getOwnPropertyDescriptor(e, r).enumerable && t.add(r);
1009
- }),
1010
- Array.from(t)
1011
- );
1012
- }
1013
- function oe(e) {
1014
- return e && e.toString ? e.toString() : new String(e).toString();
1015
- }
1016
- function ie(e) {
1017
- return null === e ? null : 'object' == typeof e ? '' + e : e;
1018
- }
1019
- var ae =
1020
- 'undefined' != typeof Reflect && Reflect.ownKeys
1021
- ? Reflect.ownKeys
1022
- : Object.getOwnPropertySymbols
1023
- ? function (e) {
1024
- return Object.getOwnPropertyNames(e).concat(
1025
- Object.getOwnPropertySymbols(e),
1026
- );
1027
- }
1028
- : Object.getOwnPropertyNames,
1029
- se = Symbol('mobx administration'),
1030
- ue = (function () {
1031
- function e(e) {
1032
- void 0 === e && (e = 'Atom@' + F()),
1033
- (this.name = e),
1034
- (this.isPendingUnobservation = !1),
1035
- (this.isBeingObserved = !1),
1036
- (this.observers = new Set()),
1037
- (this.diffValue = 0),
1038
- (this.lastAccessedBy = 0),
1039
- (this.lowestObserverState = Le.NOT_TRACKING);
1040
- }
1041
- return (
1042
- (e.prototype.onBecomeObserved = function () {
1043
- this.onBecomeObservedListeners &&
1044
- this.onBecomeObservedListeners.forEach(function (e) {
1045
- return e();
1046
- });
1047
- }),
1048
- (e.prototype.onBecomeUnobserved = function () {
1049
- this.onBecomeUnobservedListeners &&
1050
- this.onBecomeUnobservedListeners.forEach(function (e) {
1051
- return e();
1052
- });
1053
- }),
1054
- (e.prototype.reportObserved = function () {
1055
- return gt(this);
1056
- }),
1057
- (e.prototype.reportChanged = function () {
1058
- bt(),
1059
- (function (e) {
1060
- if (e.lowestObserverState === Le.STALE) return;
1061
- (e.lowestObserverState = Le.STALE),
1062
- e.observers.forEach(function (t) {
1063
- t.dependenciesState === Le.UP_TO_DATE &&
1064
- (t.isTracing !== Be.NONE && Ot(t, e), t.onBecomeStale()),
1065
- (t.dependenciesState = Le.STALE);
1066
- });
1067
- })(this),
1068
- mt();
1069
- }),
1070
- (e.prototype.toString = function () {
1071
- return this.name;
1072
- }),
1073
- e
1074
- );
1075
- })(),
1076
- ce = ee('Atom', ue);
1077
- function pe(e, t, r) {
1078
- void 0 === t && (t = X), void 0 === r && (r = X);
1079
- var n,
1080
- o = new ue(e);
1081
- return t !== X && Pt('onBecomeObserved', o, t, n), r !== X && Rt(o, r), o;
1082
- }
1083
- var le = {
1084
- identity: function (e, t) {
1085
- return e === t;
1086
- },
1087
- structural: function (e, t) {
1088
- return _r(e, t);
1089
- },
1090
- default: function (e, t) {
1091
- return Object.is(e, t);
1092
- },
1093
- shallow: function (e, t) {
1094
- return _r(e, t, 1);
1095
- },
1096
- },
1097
- de = function (e, t) {
1098
- return (
1099
- (de =
1100
- Object.setPrototypeOf ||
1101
- ({ __proto__: [] } instanceof Array &&
1102
- function (e, t) {
1103
- e.__proto__ = t;
1104
- }) ||
1105
- function (e, t) {
1106
- for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
1107
- }),
1108
- de(e, t)
1109
- );
1110
- };
1111
- /*! *****************************************************************************
1112
- Copyright (c) Microsoft Corporation. All rights reserved.
1113
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
1114
- this file except in compliance with the License. You may obtain a copy of the
1115
- License at http://www.apache.org/licenses/LICENSE-2.0
1116
-
1117
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1118
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
1119
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
1120
- MERCHANTABLITY OR NON-INFRINGEMENT.
1121
-
1122
- See the Apache Version 2.0 License for specific language governing permissions
1123
- and limitations under the License.
1124
- ***************************************************************************** */ var fe =
1125
- function () {
1126
- return (
1127
- (fe =
1128
- Object.assign ||
1129
- function (e) {
1130
- for (var t, r = 1, n = arguments.length; r < n; r++)
1131
- for (var o in (t = arguments[r]))
1132
- Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
1133
- return e;
1134
- }),
1135
- fe.apply(this, arguments)
1136
- );
1137
- };
1138
- function he(e) {
1139
- var t = 'function' == typeof Symbol && e[Symbol.iterator],
1140
- r = 0;
1141
- return t
1142
- ? t.call(e)
1143
- : {
1144
- next: function () {
1145
- return (
1146
- e && r >= e.length && (e = void 0), { value: e && e[r++], done: !e }
1147
- );
1148
- },
1149
- };
1150
- }
1151
- function ve(e, t) {
1152
- var r = 'function' == typeof Symbol && e[Symbol.iterator];
1153
- if (!r) return e;
1154
- var n,
1155
- o,
1156
- i = r.call(e),
1157
- a = [];
1158
- try {
1159
- for (; (void 0 === t || t-- > 0) && !(n = i.next()).done; ) a.push(n.value);
1160
- } catch (e) {
1161
- o = { error: e };
1162
- } finally {
1163
- try {
1164
- n && !n.done && (r = i.return) && r.call(i);
1165
- } finally {
1166
- if (o) throw o.error;
1167
- }
1168
- }
1169
- return a;
1170
- }
1171
- function ye() {
1172
- for (var e = [], t = 0; t < arguments.length; t++)
1173
- e = e.concat(ve(arguments[t]));
1174
- return e;
1175
- }
1176
- var be = Symbol('mobx did run lazy initializers'),
1177
- me = Symbol('mobx pending decorators'),
1178
- ge = {},
1179
- Oe = {};
1180
- function Ee(e) {
1181
- var t, r;
1182
- if (!0 !== e[be]) {
1183
- var n = e[me];
1184
- if (n) {
1185
- Z(e, be, !0);
1186
- var o = ye(Object.getOwnPropertySymbols(n), Object.keys(n));
1187
- try {
1188
- for (var i = he(o), a = i.next(); !a.done; a = i.next()) {
1189
- var s = n[a.value];
1190
- s.propertyCreator(
1191
- e,
1192
- s.prop,
1193
- s.descriptor,
1194
- s.decoratorTarget,
1195
- s.decoratorArguments,
1196
- );
1197
- }
1198
- } catch (e) {
1199
- t = { error: e };
1200
- } finally {
1201
- try {
1202
- a && !a.done && (r = i.return) && r.call(i);
1203
- } finally {
1204
- if (t) throw t.error;
1205
- }
1206
- }
1207
- }
1208
- }
1209
- }
1210
- function Ne(e, t) {
1211
- return function () {
1212
- var r,
1213
- n = function (n, o, i, a) {
1214
- if (!0 === a) return t(n, o, i, n, r), null;
1215
- if (
1216
- ('production' === process.env.NODE_ENV ||
1217
- we(arguments) ||
1218
- J(
1219
- "This function is a decorator, but it wasn't invoked like a decorator",
1220
- ),
1221
- !Object.prototype.hasOwnProperty.call(n, me))
1222
- ) {
1223
- var s = n[me];
1224
- Z(n, me, fe({}, s));
1225
- }
1226
- return (
1227
- (n[me][o] = {
1228
- prop: o,
1229
- propertyCreator: t,
1230
- descriptor: i,
1231
- decoratorTarget: n,
1232
- decoratorArguments: r,
1233
- }),
1234
- (function (e, t) {
1235
- var r = t ? ge : Oe;
1236
- return (
1237
- r[e] ||
1238
- (r[e] = {
1239
- configurable: !0,
1240
- enumerable: t,
1241
- get: function () {
1242
- return Ee(this), this[e];
1243
- },
1244
- set: function (t) {
1245
- Ee(this), (this[e] = t);
1246
- },
1247
- })
1248
- );
1249
- })(o, e)
1250
- );
1251
- };
1252
- return we(arguments)
1253
- ? ((r = z), n.apply(null, arguments))
1254
- : ((r = Array.prototype.slice.call(arguments)), n);
1255
- };
1256
- }
1257
- function we(e) {
1258
- return (
1259
- ((2 === e.length || 3 === e.length) &&
1260
- ('string' == typeof e[1] || 'symbol' == typeof e[1])) ||
1261
- (4 === e.length && !0 === e[3])
1262
- );
1263
- }
1264
- function _e(e, t, r) {
1265
- return Mt(e)
1266
- ? e
1267
- : Array.isArray(e)
1268
- ? Ue.array(e, { name: r })
1269
- : Y(e)
1270
- ? Ue.object(e, void 0, { name: r })
1271
- : te(e)
1272
- ? Ue.map(e, { name: r })
1273
- : re(e)
1274
- ? Ue.set(e, { name: r })
1275
- : e;
1276
- }
1277
- function je(e) {
1278
- return e;
1279
- }
1280
- function xe(e) {
1281
- H(e);
1282
- var t = Ne(!0, function (t, r, n, o, i) {
1283
- 'production' !== process.env.NODE_ENV &&
1284
- H(
1285
- !n || !n.get,
1286
- '@observable cannot be used on getter (property "' +
1287
- oe(r) +
1288
- '"), use @computed instead.',
1289
- );
1290
- var a = n ? (n.initializer ? n.initializer.call(t) : n.value) : void 0;
1291
- fr(t).addObservableProp(r, a, e);
1292
- }),
1293
- r =
1294
- 'undefined' != typeof process &&
1295
- process.env &&
1296
- 'production' !== process.env.NODE_ENV
1297
- ? function () {
1298
- return arguments.length < 2
1299
- ? J(
1300
- "Incorrect decorator invocation. @observable decorator doesn't expect any arguments",
1301
- )
1302
- : t.apply(null, arguments);
1303
- }
1304
- : t;
1305
- return (r.enhancer = e), r;
1306
- }
1307
- var Se = { deep: !0, name: void 0, defaultDecorator: void 0, proxy: !0 };
1308
- function De(e) {
1309
- /^(deep|name|equals|defaultDecorator|proxy)$/.test(e) ||
1310
- J('invalid option for (extend)observable: ' + e);
1311
- }
1312
- function Ae(e) {
1313
- if (null == e) return Se;
1314
- if ('string' == typeof e) return { name: e, deep: !0, proxy: !0 };
1315
- if ('production' !== process.env.NODE_ENV) {
1316
- if ('object' != typeof e) return J('expected options object');
1317
- Object.keys(e).forEach(De);
1318
- }
1319
- return e;
1320
- }
1321
- Object.freeze(Se);
1322
- var Ve = xe(_e),
1323
- Te = xe(function (e, t, r) {
1324
- return null == e || mr(e) || or(e) || ur(e) || lr(e)
1325
- ? e
1326
- : Array.isArray(e)
1327
- ? Ue.array(e, { name: r, deep: !1 })
1328
- : Y(e)
1329
- ? Ue.object(e, void 0, { name: r, deep: !1 })
1330
- : te(e)
1331
- ? Ue.map(e, { name: r, deep: !1 })
1332
- : re(e)
1333
- ? Ue.set(e, { name: r, deep: !1 })
1334
- : J(
1335
- 'production' !== process.env.NODE_ENV &&
1336
- 'The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets',
1337
- );
1338
- }),
1339
- ke = xe(je),
1340
- Ce = xe(function (e, t, r) {
1341
- if ('production' !== process.env.NODE_ENV && Mt(e))
1342
- throw 'observable.struct should not be used with observable values';
1343
- return _r(e, t) ? t : e;
1344
- });
1345
- function Re(e) {
1346
- return e.defaultDecorator
1347
- ? e.defaultDecorator.enhancer
1348
- : !1 === e.deep
1349
- ? je
1350
- : _e;
1351
- }
1352
- var Pe = {
1353
- box: function (e, t) {
1354
- arguments.length > 2 && qe('box');
1355
- var r = Ae(t);
1356
- return new at(e, Re(r), r.name, !0, r.equals);
1357
- },
1358
- array: function (e, t) {
1359
- arguments.length > 2 && qe('array');
1360
- var r = Ae(t);
1361
- return (function (e, t, r, n) {
1362
- void 0 === r && (r = 'ObservableArray@' + F());
1363
- void 0 === n && (n = !1);
1364
- var o = new er(r, t, n);
1365
- (i = o.values),
1366
- (a = se),
1367
- (s = o),
1368
- Object.defineProperty(i, a, {
1369
- enumerable: !1,
1370
- writable: !1,
1371
- configurable: !0,
1372
- value: s,
1373
- });
1374
- var i, a, s;
1375
- var u = new Proxy(o.values, Qt);
1376
- if (((o.proxy = u), e && e.length)) {
1377
- var c = ot(!0);
1378
- o.spliceWithArray(0, 0, e), it(c);
1379
- }
1380
- return u;
1381
- })(e, Re(r), r.name);
1382
- },
1383
- map: function (e, t) {
1384
- arguments.length > 2 && qe('map');
1385
- var r = Ae(t);
1386
- return new sr(e, Re(r), r.name);
1387
- },
1388
- set: function (e, t) {
1389
- arguments.length > 2 && qe('set');
1390
- var r = Ae(t);
1391
- return new pr(e, Re(r), r.name);
1392
- },
1393
- object: function (e, t, r) {
1394
- 'string' == typeof arguments[1] && qe('object');
1395
- var n = Ae(r);
1396
- if (!1 === n.proxy) return Ut({}, e, t, n);
1397
- var o = qt(n),
1398
- i = (function (e) {
1399
- var t = new Proxy(e, Jt);
1400
- return (e[se].proxy = t), t;
1401
- })(Ut({}, void 0, void 0, n));
1402
- return Lt(i, e, t, o), i;
1403
- },
1404
- ref: ke,
1405
- shallow: Te,
1406
- deep: Ve,
1407
- struct: Ce,
1408
- },
1409
- Ue = function (e, t, r) {
1410
- if ('string' == typeof arguments[1] || 'symbol' == typeof arguments[1])
1411
- return Ve.apply(null, arguments);
1412
- if (Mt(e)) return e;
1413
- var n = Y(e)
1414
- ? Ue.object(e, t, r)
1415
- : Array.isArray(e)
1416
- ? Ue.array(e, t)
1417
- : te(e)
1418
- ? Ue.map(e, t)
1419
- : re(e)
1420
- ? Ue.set(e, t)
1421
- : e;
1422
- if (n !== e) return n;
1423
- J(
1424
- 'production' !== process.env.NODE_ENV &&
1425
- "The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)'",
1426
- );
1427
- };
1428
- function qe(e) {
1429
- J(
1430
- 'Expected one or two arguments to observable.' +
1431
- e +
1432
- '. Did you accidentally try to use observable.' +
1433
- e +
1434
- ' as decorator?',
1435
- );
1436
- }
1437
- Object.keys(Pe).forEach(function (e) {
1438
- return (Ue[e] = Pe[e]);
1439
- });
1440
- var Le,
1441
- Be,
1442
- Ie = Ne(!1, function (e, t, r, n, o) {
1443
- 'production' !== process.env.NODE_ENV &&
1444
- H(
1445
- r && r.get,
1446
- "Trying to declare a computed value for unspecified getter '" +
1447
- oe(t) +
1448
- "'",
1449
- );
1450
- var i = r.get,
1451
- a = r.set,
1452
- s = o[0] || {};
1453
- fr(e).addComputedProp(e, t, fe({ get: i, set: a, context: e }, s));
1454
- });
1455
- Ie({ equals: le.structural }),
1456
- (function (e) {
1457
- (e[(e.NOT_TRACKING = -1)] = 'NOT_TRACKING'),
1458
- (e[(e.UP_TO_DATE = 0)] = 'UP_TO_DATE'),
1459
- (e[(e.POSSIBLY_STALE = 1)] = 'POSSIBLY_STALE'),
1460
- (e[(e.STALE = 2)] = 'STALE');
1461
- })(Le || (Le = {})),
1462
- (function (e) {
1463
- (e[(e.NONE = 0)] = 'NONE'),
1464
- (e[(e.LOG = 1)] = 'LOG'),
1465
- (e[(e.BREAK = 2)] = 'BREAK');
1466
- })(Be || (Be = {}));
1467
- var Me = function (e) {
1468
- this.cause = e;
1469
- };
1470
- function Ge(e) {
1471
- return e instanceof Me;
1472
- }
1473
- function ze(e) {
1474
- switch (e.dependenciesState) {
1475
- case Le.UP_TO_DATE:
1476
- return !1;
1477
- case Le.NOT_TRACKING:
1478
- case Le.STALE:
1479
- return !0;
1480
- case Le.POSSIBLY_STALE:
1481
- for (
1482
- var t = $e(!0), r = We(), n = e.observing, o = n.length, i = 0;
1483
- i < o;
1484
- i++
1485
- ) {
1486
- var a = n[i];
1487
- if (ut(a)) {
1488
- if (ft.disableErrorBoundaries) a.get();
1489
- else
1490
- try {
1491
- a.get();
1492
- } catch (e) {
1493
- return Xe(r), Ye(t), !0;
1494
- }
1495
- if (e.dependenciesState === Le.STALE) return Xe(r), Ye(t), !0;
1496
- }
1497
- }
1498
- return Ze(e), Xe(r), Ye(t), !1;
1499
- }
1500
- }
1501
- function Ke(e) {
1502
- var t = e.observers.size > 0;
1503
- ft.computationDepth > 0 &&
1504
- t &&
1505
- J(
1506
- 'production' !== process.env.NODE_ENV &&
1507
- 'Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: ' +
1508
- e.name,
1509
- ),
1510
- ft.allowStateChanges ||
1511
- (!t && 'strict' !== ft.enforceActions) ||
1512
- J(
1513
- 'production' !== process.env.NODE_ENV &&
1514
- (ft.enforceActions
1515
- ? 'Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: '
1516
- : 'Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ') +
1517
- e.name,
1518
- );
1519
- }
1520
- function Fe(e, t, r) {
1521
- var n = $e(!0);
1522
- Ze(e),
1523
- (e.newObserving = new Array(e.observing.length + 100)),
1524
- (e.unboundDepsCount = 0),
1525
- (e.runId = ++ft.runId);
1526
- var o,
1527
- i = ft.trackingDerivation;
1528
- if (((ft.trackingDerivation = e), !0 === ft.disableErrorBoundaries))
1529
- o = t.call(r);
1530
- else
1531
- try {
1532
- o = t.call(r);
1533
- } catch (e) {
1534
- o = new Me(e);
1535
- }
1536
- return (
1537
- (ft.trackingDerivation = i),
1538
- (function (e) {
1539
- for (
1540
- var t = e.observing,
1541
- r = (e.observing = e.newObserving),
1542
- n = Le.UP_TO_DATE,
1543
- o = 0,
1544
- i = e.unboundDepsCount,
1545
- a = 0;
1546
- a < i;
1547
- a++
1548
- ) {
1549
- 0 === (s = r[a]).diffValue &&
1550
- ((s.diffValue = 1), o !== a && (r[o] = s), o++),
1551
- s.dependenciesState > n && (n = s.dependenciesState);
1552
- }
1553
- (r.length = o), (e.newObserving = null), (i = t.length);
1554
- for (; i--; ) {
1555
- 0 === (s = t[i]).diffValue && vt(s, e), (s.diffValue = 0);
1556
- }
1557
- for (; o--; ) {
1558
- var s;
1559
- 1 === (s = r[o]).diffValue && ((s.diffValue = 0), ht(s, e));
1560
- }
1561
- n !== Le.UP_TO_DATE && ((e.dependenciesState = n), e.onBecomeStale());
1562
- })(e),
1563
- (function (e) {
1564
- if ('production' === process.env.NODE_ENV) return;
1565
- if (0 !== e.observing.length) return;
1566
- (ft.reactionRequiresObservable || e.requiresObservable) &&
1567
- console.warn(
1568
- '[mobx] Derivation ' +
1569
- e.name +
1570
- ' is created/updated without reading any observable value',
1571
- );
1572
- })(e),
1573
- Ye(n),
1574
- o
1575
- );
1576
- }
1577
- function Je(e) {
1578
- var t = e.observing;
1579
- e.observing = [];
1580
- for (var r = t.length; r--; ) vt(t[r], e);
1581
- e.dependenciesState = Le.NOT_TRACKING;
1582
- }
1583
- function He(e) {
1584
- var t = We();
1585
- try {
1586
- return e();
1587
- } finally {
1588
- Xe(t);
1589
- }
1590
- }
1591
- function We() {
1592
- var e = ft.trackingDerivation;
1593
- return (ft.trackingDerivation = null), e;
1594
- }
1595
- function Xe(e) {
1596
- ft.trackingDerivation = e;
1597
- }
1598
- function $e(e) {
1599
- var t = ft.allowStateReads;
1600
- return (ft.allowStateReads = e), t;
1601
- }
1602
- function Ye(e) {
1603
- ft.allowStateReads = e;
1604
- }
1605
- function Ze(e) {
1606
- if (e.dependenciesState !== Le.UP_TO_DATE) {
1607
- e.dependenciesState = Le.UP_TO_DATE;
1608
- for (var t = e.observing, r = t.length; r--; )
1609
- t[r].lowestObserverState = Le.UP_TO_DATE;
1610
- }
1611
- }
1612
- var Qe = 0,
1613
- et = 1,
1614
- tt = Object.getOwnPropertyDescriptor(function () {}, 'name'),
1615
- rt = tt && tt.configurable;
1616
- function nt(e, t, r) {
1617
- 'production' !== process.env.NODE_ENV &&
1618
- (H('function' == typeof t, '`action` can only be invoked on functions'),
1619
- ('string' == typeof e && e) ||
1620
- J("actions should have valid names, got: '" + e + "'"));
1621
- var n = function () {
1622
- return (function (e, t, r, n) {
1623
- var o = (function (e, t, r) {
1624
- var n = Dt() && !!e,
1625
- o = 0;
1626
- if (n && 'production' !== process.env.NODE_ENV) {
1627
- o = Date.now();
1628
- var i = (r && r.length) || 0,
1629
- a = new Array(i);
1630
- if (i > 0) for (var s = 0; s < i; s++) a[s] = r[s];
1631
- Vt({ type: 'action', name: e, object: t, arguments: a });
1632
- }
1633
- var u = We();
1634
- bt();
1635
- var c = ot(!0),
1636
- p = $e(!0),
1637
- l = {
1638
- prevDerivation: u,
1639
- prevAllowStateChanges: c,
1640
- prevAllowStateReads: p,
1641
- notifySpy: n,
1642
- startTime: o,
1643
- actionId: et++,
1644
- parentActionId: Qe,
1645
- };
1646
- return (Qe = l.actionId), l;
1647
- })(e, r, n);
1648
- try {
1649
- return t.apply(r, n);
1650
- } catch (e) {
1651
- throw ((o.error = e), e);
1652
- } finally {
1653
- !(function (e) {
1654
- Qe !== e.actionId &&
1655
- J('invalid action stack. did you forget to finish an action?');
1656
- (Qe = e.parentActionId),
1657
- void 0 !== e.error && (ft.suppressReactionErrors = !0);
1658
- it(e.prevAllowStateChanges),
1659
- Ye(e.prevAllowStateReads),
1660
- mt(),
1661
- Xe(e.prevDerivation),
1662
- e.notifySpy &&
1663
- 'production' !== process.env.NODE_ENV &&
1664
- kt({ time: Date.now() - e.startTime });
1665
- ft.suppressReactionErrors = !1;
1666
- })(o);
1667
- }
1668
- })(e, t, r || this, arguments);
1669
- };
1670
- return (
1671
- (n.isMobxAction = !0),
1672
- 'production' !== process.env.NODE_ENV &&
1673
- rt &&
1674
- Object.defineProperty(n, 'name', { value: e }),
1675
- n
1676
- );
1677
- }
1678
- function ot(e) {
1679
- var t = ft.allowStateChanges;
1680
- return (ft.allowStateChanges = e), t;
1681
- }
1682
- function it(e) {
1683
- ft.allowStateChanges = e;
1684
- }
1685
- var at = (function (e) {
1686
- function t(t, r, n, o, i) {
1687
- void 0 === n && (n = 'ObservableValue@' + F()),
1688
- void 0 === o && (o = !0),
1689
- void 0 === i && (i = le.default);
1690
- var a = e.call(this, n) || this;
1691
- return (
1692
- (a.enhancer = r),
1693
- (a.name = n),
1694
- (a.equals = i),
1695
- (a.hasUnreportedChange = !1),
1696
- (a.value = r(t, void 0, n)),
1697
- o &&
1698
- Dt() &&
1699
- 'production' !== process.env.NODE_ENV &&
1700
- At({ type: 'create', name: a.name, newValue: '' + a.value }),
1701
- a
1702
- );
1703
- }
1704
- return (
1705
- (function (e, t) {
1706
- function r() {
1707
- this.constructor = e;
1708
- }
1709
- de(e, t),
1710
- (e.prototype =
1711
- null === t
1712
- ? Object.create(t)
1713
- : ((r.prototype = t.prototype), new r()));
1714
- })(t, e),
1715
- (t.prototype.dehanceValue = function (e) {
1716
- return void 0 !== this.dehancer ? this.dehancer(e) : e;
1717
- }),
1718
- (t.prototype.set = function (e) {
1719
- var t = this.value;
1720
- if ((e = this.prepareNewValue(e)) !== ft.UNCHANGED) {
1721
- var r = Dt();
1722
- r &&
1723
- 'production' !== process.env.NODE_ENV &&
1724
- Vt({ type: 'update', name: this.name, newValue: e, oldValue: t }),
1725
- this.setNewValue(e),
1726
- r && 'production' !== process.env.NODE_ENV && kt();
1727
- }
1728
- }),
1729
- (t.prototype.prepareNewValue = function (e) {
1730
- if ((Ke(this), Ht(this))) {
1731
- var t = Xt(this, { object: this, type: 'update', newValue: e });
1732
- if (!t) return ft.UNCHANGED;
1733
- e = t.newValue;
1734
- }
1735
- return (
1736
- (e = this.enhancer(e, this.value, this.name)),
1737
- this.equals(this.value, e) ? ft.UNCHANGED : e
1738
- );
1739
- }),
1740
- (t.prototype.setNewValue = function (e) {
1741
- var t = this.value;
1742
- (this.value = e),
1743
- this.reportChanged(),
1744
- $t(this) &&
1745
- Zt(this, { type: 'update', object: this, newValue: e, oldValue: t });
1746
- }),
1747
- (t.prototype.get = function () {
1748
- return this.reportObserved(), this.dehanceValue(this.value);
1749
- }),
1750
- (t.prototype.intercept = function (e) {
1751
- return Wt(this, e);
1752
- }),
1753
- (t.prototype.observe = function (e, t) {
1754
- return (
1755
- t &&
1756
- e({
1757
- object: this,
1758
- type: 'update',
1759
- newValue: this.value,
1760
- oldValue: void 0,
1761
- }),
1762
- Yt(this, e)
1763
- );
1764
- }),
1765
- (t.prototype.toJSON = function () {
1766
- return this.get();
1767
- }),
1768
- (t.prototype.toString = function () {
1769
- return this.name + '[' + this.value + ']';
1770
- }),
1771
- (t.prototype.valueOf = function () {
1772
- return ie(this.get());
1773
- }),
1774
- (t.prototype[Symbol.toPrimitive] = function () {
1775
- return this.valueOf();
1776
- }),
1777
- t
1778
- );
1779
- })(ue);
1780
- ee('ObservableValue', at);
1781
- var st = (function () {
1782
- function e(e) {
1783
- (this.dependenciesState = Le.NOT_TRACKING),
1784
- (this.observing = []),
1785
- (this.newObserving = null),
1786
- (this.isBeingObserved = !1),
1787
- (this.isPendingUnobservation = !1),
1788
- (this.observers = new Set()),
1789
- (this.diffValue = 0),
1790
- (this.runId = 0),
1791
- (this.lastAccessedBy = 0),
1792
- (this.lowestObserverState = Le.UP_TO_DATE),
1793
- (this.unboundDepsCount = 0),
1794
- (this.__mapid = '#' + F()),
1795
- (this.value = new Me(null)),
1796
- (this.isComputing = !1),
1797
- (this.isRunningSetter = !1),
1798
- (this.isTracing = Be.NONE),
1799
- H(e.get, 'missing option for computed: get'),
1800
- (this.derivation = e.get),
1801
- (this.name = e.name || 'ComputedValue@' + F()),
1802
- e.set && (this.setter = nt(this.name + '-setter', e.set)),
1803
- (this.equals =
1804
- e.equals ||
1805
- (e.compareStructural || e.struct ? le.structural : le.default)),
1806
- (this.scope = e.context),
1807
- (this.requiresReaction = !!e.requiresReaction),
1808
- (this.keepAlive = !!e.keepAlive);
1809
- }
1810
- return (
1811
- (e.prototype.onBecomeStale = function () {
1812
- !(function (e) {
1813
- if (e.lowestObserverState !== Le.UP_TO_DATE) return;
1814
- (e.lowestObserverState = Le.POSSIBLY_STALE),
1815
- e.observers.forEach(function (t) {
1816
- t.dependenciesState === Le.UP_TO_DATE &&
1817
- ((t.dependenciesState = Le.POSSIBLY_STALE),
1818
- t.isTracing !== Be.NONE && Ot(t, e),
1819
- t.onBecomeStale());
1820
- });
1821
- })(this);
1822
- }),
1823
- (e.prototype.onBecomeObserved = function () {
1824
- this.onBecomeObservedListeners &&
1825
- this.onBecomeObservedListeners.forEach(function (e) {
1826
- return e();
1827
- });
1828
- }),
1829
- (e.prototype.onBecomeUnobserved = function () {
1830
- this.onBecomeUnobservedListeners &&
1831
- this.onBecomeUnobservedListeners.forEach(function (e) {
1832
- return e();
1833
- });
1834
- }),
1835
- (e.prototype.get = function () {
1836
- this.isComputing &&
1837
- J(
1838
- 'Cycle detected in computation ' +
1839
- this.name +
1840
- ': ' +
1841
- this.derivation,
1842
- ),
1843
- 0 !== ft.inBatch || 0 !== this.observers.size || this.keepAlive
1844
- ? (gt(this),
1845
- ze(this) &&
1846
- this.trackAndCompute() &&
1847
- (function (e) {
1848
- if (e.lowestObserverState === Le.STALE) return;
1849
- (e.lowestObserverState = Le.STALE),
1850
- e.observers.forEach(function (t) {
1851
- t.dependenciesState === Le.POSSIBLY_STALE
1852
- ? (t.dependenciesState = Le.STALE)
1853
- : t.dependenciesState === Le.UP_TO_DATE &&
1854
- (e.lowestObserverState = Le.UP_TO_DATE);
1855
- });
1856
- })(this))
1857
- : ze(this) &&
1858
- (this.warnAboutUntrackedRead(),
1859
- bt(),
1860
- (this.value = this.computeValue(!1)),
1861
- mt());
1862
- var e = this.value;
1863
- if (Ge(e)) throw e.cause;
1864
- return e;
1865
- }),
1866
- (e.prototype.peek = function () {
1867
- var e = this.computeValue(!1);
1868
- if (Ge(e)) throw e.cause;
1869
- return e;
1870
- }),
1871
- (e.prototype.set = function (e) {
1872
- if (this.setter) {
1873
- H(
1874
- !this.isRunningSetter,
1875
- "The setter of computed value '" +
1876
- this.name +
1877
- "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?",
1878
- ),
1879
- (this.isRunningSetter = !0);
1880
- try {
1881
- this.setter.call(this.scope, e);
1882
- } finally {
1883
- this.isRunningSetter = !1;
1884
- }
1885
- } else
1886
- H(
1887
- !1,
1888
- 'production' !== process.env.NODE_ENV &&
1889
- "[ComputedValue '" +
1890
- this.name +
1891
- "'] It is not possible to assign a new value to a computed value.",
1892
- );
1893
- }),
1894
- (e.prototype.trackAndCompute = function () {
1895
- Dt() &&
1896
- 'production' !== process.env.NODE_ENV &&
1897
- At({ object: this.scope, type: 'compute', name: this.name });
1898
- var e = this.value,
1899
- t = this.dependenciesState === Le.NOT_TRACKING,
1900
- r = this.computeValue(!0),
1901
- n = t || Ge(e) || Ge(r) || !this.equals(e, r);
1902
- return n && (this.value = r), n;
1903
- }),
1904
- (e.prototype.computeValue = function (e) {
1905
- var t;
1906
- if (((this.isComputing = !0), ft.computationDepth++, e))
1907
- t = Fe(this, this.derivation, this.scope);
1908
- else if (!0 === ft.disableErrorBoundaries)
1909
- t = this.derivation.call(this.scope);
1910
- else
1911
- try {
1912
- t = this.derivation.call(this.scope);
1913
- } catch (e) {
1914
- t = new Me(e);
1915
- }
1916
- return ft.computationDepth--, (this.isComputing = !1), t;
1917
- }),
1918
- (e.prototype.suspend = function () {
1919
- this.keepAlive || (Je(this), (this.value = void 0));
1920
- }),
1921
- (e.prototype.observe = function (e, t) {
1922
- var r = this,
1923
- n = !0,
1924
- o = void 0;
1925
- return (function (e, t) {
1926
- void 0 === t && (t = K);
1927
- 'production' !== process.env.NODE_ENV &&
1928
- (H(
1929
- 'function' == typeof e,
1930
- 'Autorun expects a function as first argument',
1931
- ),
1932
- H(
1933
- !1 == ('function' == typeof (r = e) && !0 === r.isMobxAction),
1934
- 'Autorun does not accept actions since actions are untrackable',
1935
- ));
1936
- var r;
1937
- var n,
1938
- o = (t && t.name) || e.name || 'Autorun@' + F();
1939
- if (t.scheduler || t.delay) {
1940
- var i = (function (e) {
1941
- return e.scheduler
1942
- ? e.scheduler
1943
- : e.delay
1944
- ? function (t) {
1945
- return setTimeout(t, e.delay);
1946
- }
1947
- : Ct;
1948
- })(t),
1949
- a = !1;
1950
- n = new Nt(
1951
- o,
1952
- function () {
1953
- a ||
1954
- ((a = !0),
1955
- i(function () {
1956
- (a = !1), n.isDisposed || n.track(s);
1957
- }));
1958
- },
1959
- t.onError,
1960
- t.requiresObservable,
1961
- );
1962
- } else
1963
- n = new Nt(
1964
- o,
1965
- function () {
1966
- this.track(s);
1967
- },
1968
- t.onError,
1969
- t.requiresObservable,
1970
- );
1971
- function s() {
1972
- e(n);
1973
- }
1974
- return n.schedule(), n.getDisposer();
1975
- })(function () {
1976
- var i = r.get();
1977
- if (!n || t) {
1978
- var a = We();
1979
- e({ type: 'update', object: r, newValue: i, oldValue: o }), Xe(a);
1980
- }
1981
- (n = !1), (o = i);
1982
- });
1983
- }),
1984
- (e.prototype.warnAboutUntrackedRead = function () {
1985
- 'production' !== process.env.NODE_ENV &&
1986
- (!0 === this.requiresReaction &&
1987
- J(
1988
- '[mobx] Computed value ' +
1989
- this.name +
1990
- ' is read outside a reactive context',
1991
- ),
1992
- this.isTracing !== Be.NONE &&
1993
- console.log(
1994
- "[mobx.trace] '" +
1995
- this.name +
1996
- "' is being read outside a reactive context. Doing a full recompute",
1997
- ),
1998
- ft.computedRequiresReaction &&
1999
- console.warn(
2000
- '[mobx] Computed value ' +
2001
- this.name +
2002
- ' is being read outside a reactive context. Doing a full recompute',
2003
- ));
2004
- }),
2005
- (e.prototype.toJSON = function () {
2006
- return this.get();
2007
- }),
2008
- (e.prototype.toString = function () {
2009
- return this.name + '[' + this.derivation.toString() + ']';
2010
- }),
2011
- (e.prototype.valueOf = function () {
2012
- return ie(this.get());
2013
- }),
2014
- (e.prototype[Symbol.toPrimitive] = function () {
2015
- return this.valueOf();
2016
- }),
2017
- e
2018
- );
2019
- })(),
2020
- ut = ee('ComputedValue', st),
2021
- ct = function () {
2022
- (this.version = 5),
2023
- (this.UNCHANGED = {}),
2024
- (this.trackingDerivation = null),
2025
- (this.computationDepth = 0),
2026
- (this.runId = 0),
2027
- (this.mobxGuid = 0),
2028
- (this.inBatch = 0),
2029
- (this.pendingUnobservations = []),
2030
- (this.pendingReactions = []),
2031
- (this.isRunningReactions = !1),
2032
- (this.allowStateChanges = !0),
2033
- (this.allowStateReads = !0),
2034
- (this.enforceActions = !1),
2035
- (this.spyListeners = []),
2036
- (this.globalReactionErrorHandlers = []),
2037
- (this.computedRequiresReaction = !1),
2038
- (this.reactionRequiresObservable = !1),
2039
- (this.observableRequiresReaction = !1),
2040
- (this.computedConfigurable = !1),
2041
- (this.disableErrorBoundaries = !1),
2042
- (this.suppressReactionErrors = !1);
2043
- },
2044
- pt = {};
2045
- function lt() {
2046
- return 'undefined' != typeof window
2047
- ? window
2048
- : 'undefined' != typeof global
2049
- ? global
2050
- : 'undefined' != typeof self
2051
- ? self
2052
- : pt;
2053
- }
2054
- var dt = !0,
2055
- ft = (function () {
2056
- var e = lt();
2057
- return (
2058
- e.__mobxInstanceCount > 0 && !e.__mobxGlobals && (dt = !1),
2059
- e.__mobxGlobals &&
2060
- e.__mobxGlobals.version !== new ct().version &&
2061
- (dt = !1),
2062
- dt
2063
- ? e.__mobxGlobals
2064
- ? ((e.__mobxInstanceCount += 1),
2065
- e.__mobxGlobals.UNCHANGED || (e.__mobxGlobals.UNCHANGED = {}),
2066
- e.__mobxGlobals)
2067
- : ((e.__mobxInstanceCount = 1), (e.__mobxGlobals = new ct()))
2068
- : (setTimeout(function () {
2069
- J(
2070
- 'There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`',
2071
- );
2072
- }, 1),
2073
- new ct())
2074
- );
2075
- })();
2076
- function ht(e, t) {
2077
- e.observers.add(t),
2078
- e.lowestObserverState > t.dependenciesState &&
2079
- (e.lowestObserverState = t.dependenciesState);
2080
- }
2081
- function vt(e, t) {
2082
- e.observers.delete(t), 0 === e.observers.size && yt(e);
2083
- }
2084
- function yt(e) {
2085
- !1 === e.isPendingUnobservation &&
2086
- ((e.isPendingUnobservation = !0), ft.pendingUnobservations.push(e));
2087
- }
2088
- function bt() {
2089
- ft.inBatch++;
2090
- }
2091
- function mt() {
2092
- if (0 === --ft.inBatch) {
2093
- jt();
2094
- for (var e = ft.pendingUnobservations, t = 0; t < e.length; t++) {
2095
- var r = e[t];
2096
- (r.isPendingUnobservation = !1),
2097
- 0 === r.observers.size &&
2098
- (r.isBeingObserved &&
2099
- ((r.isBeingObserved = !1), r.onBecomeUnobserved()),
2100
- r instanceof st && r.suspend());
2101
- }
2102
- ft.pendingUnobservations = [];
2103
- }
2104
- }
2105
- function gt(e) {
2106
- !(function (e) {
2107
- 'production' !== process.env.NODE_ENV &&
2108
- !ft.allowStateReads &&
2109
- ft.observableRequiresReaction &&
2110
- console.warn(
2111
- '[mobx] Observable ' +
2112
- e.name +
2113
- ' being read outside a reactive context',
2114
- );
2115
- })(e);
2116
- var t = ft.trackingDerivation;
2117
- return null !== t
2118
- ? (t.runId !== e.lastAccessedBy &&
2119
- ((e.lastAccessedBy = t.runId),
2120
- (t.newObserving[t.unboundDepsCount++] = e),
2121
- e.isBeingObserved || ((e.isBeingObserved = !0), e.onBecomeObserved())),
2122
- !0)
2123
- : (0 === e.observers.size && ft.inBatch > 0 && yt(e), !1);
2124
- }
2125
- function Ot(e, t) {
2126
- if (
2127
- (console.log(
2128
- "[mobx.trace] '" +
2129
- e.name +
2130
- "' is invalidated due to a change in: '" +
2131
- t.name +
2132
- "'",
2133
- ),
2134
- e.isTracing === Be.BREAK)
2135
- ) {
2136
- var r = [];
2137
- Et(Bt(gr(e, n)), r, 1),
2138
- new Function(
2139
- "debugger;\n/*\nTracing '" +
2140
- e.name +
2141
- "'\n\nYou are entering this break point because derivation '" +
2142
- e.name +
2143
- "' is being traced and '" +
2144
- t.name +
2145
- "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" +
2146
- (e instanceof st
2147
- ? e.derivation.toString().replace(/[*]\//g, '/')
2148
- : '') +
2149
- '\n\nThe dependencies for this derivation are:\n\n' +
2150
- r.join('\n') +
2151
- '\n*/\n ',
2152
- )();
2153
- }
2154
- var n;
2155
- }
2156
- function Et(e, t, r) {
2157
- t.length >= 1e3
2158
- ? t.push('(and many more)')
2159
- : (t.push('' + new Array(r).join('\t') + e.name),
2160
- e.dependencies &&
2161
- e.dependencies.forEach(function (e) {
2162
- return Et(e, t, r + 1);
2163
- }));
2164
- }
2165
- var Nt = (function () {
2166
- function e(e, t, r, n) {
2167
- void 0 === e && (e = 'Reaction@' + F()),
2168
- void 0 === n && (n = !1),
2169
- (this.name = e),
2170
- (this.onInvalidate = t),
2171
- (this.errorHandler = r),
2172
- (this.requiresObservable = n),
2173
- (this.observing = []),
2174
- (this.newObserving = []),
2175
- (this.dependenciesState = Le.NOT_TRACKING),
2176
- (this.diffValue = 0),
2177
- (this.runId = 0),
2178
- (this.unboundDepsCount = 0),
2179
- (this.__mapid = '#' + F()),
2180
- (this.isDisposed = !1),
2181
- (this._isScheduled = !1),
2182
- (this._isTrackPending = !1),
2183
- (this._isRunning = !1),
2184
- (this.isTracing = Be.NONE);
2185
- }
2186
- return (
2187
- (e.prototype.onBecomeStale = function () {
2188
- this.schedule();
2189
- }),
2190
- (e.prototype.schedule = function () {
2191
- this._isScheduled ||
2192
- ((this._isScheduled = !0), ft.pendingReactions.push(this), jt());
2193
- }),
2194
- (e.prototype.isScheduled = function () {
2195
- return this._isScheduled;
2196
- }),
2197
- (e.prototype.runReaction = function () {
2198
- if (!this.isDisposed) {
2199
- if ((bt(), (this._isScheduled = !1), ze(this))) {
2200
- this._isTrackPending = !0;
2201
- try {
2202
- this.onInvalidate(),
2203
- this._isTrackPending &&
2204
- Dt() &&
2205
- 'production' !== process.env.NODE_ENV &&
2206
- At({ name: this.name, type: 'scheduled-reaction' });
2207
- } catch (e) {
2208
- this.reportExceptionInDerivation(e);
2209
- }
2210
- }
2211
- mt();
2212
- }
2213
- }),
2214
- (e.prototype.track = function (e) {
2215
- if (!this.isDisposed) {
2216
- bt();
2217
- var t,
2218
- r = Dt();
2219
- r &&
2220
- 'production' !== process.env.NODE_ENV &&
2221
- ((t = Date.now()), Vt({ name: this.name, type: 'reaction' })),
2222
- (this._isRunning = !0);
2223
- var n = Fe(this, e, void 0);
2224
- (this._isRunning = !1),
2225
- (this._isTrackPending = !1),
2226
- this.isDisposed && Je(this),
2227
- Ge(n) && this.reportExceptionInDerivation(n.cause),
2228
- r &&
2229
- 'production' !== process.env.NODE_ENV &&
2230
- kt({ time: Date.now() - t }),
2231
- mt();
2232
- }
2233
- }),
2234
- (e.prototype.reportExceptionInDerivation = function (e) {
2235
- var t = this;
2236
- if (this.errorHandler) this.errorHandler(e, this);
2237
- else {
2238
- if (ft.disableErrorBoundaries) throw e;
2239
- var r =
2240
- "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" +
2241
- this +
2242
- "'";
2243
- ft.suppressReactionErrors
2244
- ? console.warn(
2245
- "[mobx] (error in reaction '" +
2246
- this.name +
2247
- "' suppressed, fix error of causing action below)",
2248
- )
2249
- : console.error(r, e),
2250
- Dt() &&
2251
- At({ type: 'error', name: this.name, message: r, error: '' + e }),
2252
- ft.globalReactionErrorHandlers.forEach(function (r) {
2253
- return r(e, t);
2254
- });
2255
- }
2256
- }),
2257
- (e.prototype.dispose = function () {
2258
- this.isDisposed ||
2259
- ((this.isDisposed = !0), this._isRunning || (bt(), Je(this), mt()));
2260
- }),
2261
- (e.prototype.getDisposer = function () {
2262
- var e = this.dispose.bind(this);
2263
- return (e[se] = this), e;
2264
- }),
2265
- (e.prototype.toString = function () {
2266
- return 'Reaction[' + this.name + ']';
2267
- }),
2268
- (e.prototype.trace = function (e) {
2269
- void 0 === e && (e = !1),
2270
- (function () {
2271
- for (var e = [], t = 0; t < arguments.length; t++)
2272
- e[t] = arguments[t];
2273
- var r = !1;
2274
- 'boolean' == typeof e[e.length - 1] && (r = e.pop());
2275
- var n = (function (e) {
2276
- switch (e.length) {
2277
- case 0:
2278
- return ft.trackingDerivation;
2279
- case 1:
2280
- return gr(e[0]);
2281
- case 2:
2282
- return gr(e[0], e[1]);
2283
- }
2284
- })(e);
2285
- if (!n)
2286
- return J(
2287
- 'production' !== process.env.NODE_ENV &&
2288
- "'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly",
2289
- );
2290
- n.isTracing === Be.NONE &&
2291
- console.log("[mobx.trace] '" + n.name + "' tracing enabled");
2292
- n.isTracing = r ? Be.BREAK : Be.LOG;
2293
- })(this, e);
2294
- }),
2295
- e
2296
- );
2297
- })(),
2298
- wt = 100,
2299
- _t = function (e) {
2300
- return e();
2301
- };
2302
- function jt() {
2303
- ft.inBatch > 0 || ft.isRunningReactions || _t(xt);
2304
- }
2305
- function xt() {
2306
- ft.isRunningReactions = !0;
2307
- for (var e = ft.pendingReactions, t = 0; e.length > 0; ) {
2308
- ++t === wt &&
2309
- (console.error(
2310
- "Reaction doesn't converge to a stable state after " +
2311
- wt +
2312
- ' iterations. Probably there is a cycle in the reactive function: ' +
2313
- e[0],
2314
- ),
2315
- e.splice(0));
2316
- for (var r = e.splice(0), n = 0, o = r.length; n < o; n++)
2317
- r[n].runReaction();
2318
- }
2319
- ft.isRunningReactions = !1;
2320
- }
2321
- var St = ee('Reaction', Nt);
2322
- function Dt() {
2323
- return 'production' !== process.env.NODE_ENV && !!ft.spyListeners.length;
2324
- }
2325
- function At(e) {
2326
- if ('production' !== process.env.NODE_ENV && ft.spyListeners.length)
2327
- for (var t = ft.spyListeners, r = 0, n = t.length; r < n; r++) t[r](e);
2328
- }
2329
- function Vt(e) {
2330
- 'production' !== process.env.NODE_ENV &&
2331
- At(fe(fe({}, e), { spyReportStart: !0 }));
2332
- }
2333
- var Tt = { spyReportEnd: !0 };
2334
- function kt(e) {
2335
- 'production' !== process.env.NODE_ENV &&
2336
- At(e ? fe(fe({}, e), { spyReportEnd: !0 }) : Tt);
2337
- }
2338
- var Ct = function (e) {
2339
- return e();
2340
- };
2341
- function Rt(e, t, r) {
2342
- return Pt('onBecomeUnobserved', e, t, r);
2343
- }
2344
- function Pt(e, t, r, n) {
2345
- var o = 'function' == typeof n ? gr(t, r) : gr(t),
2346
- i = 'function' == typeof n ? n : r,
2347
- a = e + 'Listeners';
2348
- return (
2349
- o[a] ? o[a].add(i) : (o[a] = new Set([i])),
2350
- 'function' != typeof o[e]
2351
- ? J(
2352
- 'production' !== process.env.NODE_ENV &&
2353
- 'Not an atom that can be (un)observed',
2354
- )
2355
- : function () {
2356
- var e = o[a];
2357
- e && (e.delete(i), 0 === e.size && delete o[a]);
2358
- }
2359
- );
2360
- }
2361
- function Ut(e, t, r, n) {
2362
- 'production' !== process.env.NODE_ENV &&
2363
- (H(
2364
- arguments.length >= 2 && arguments.length <= 4,
2365
- "'extendObservable' expected 2-4 arguments",
2366
- ),
2367
- H(
2368
- 'object' == typeof e,
2369
- "'extendObservable' expects an object as first argument",
2370
- ),
2371
- H(
2372
- !ur(e),
2373
- "'extendObservable' should not be used on maps, use map.merge instead",
2374
- ));
2375
- var o = qt((n = Ae(n)));
2376
- return Ee(e), fr(e, n.name, o.enhancer), t && Lt(e, t, r, o), e;
2377
- }
2378
- function qt(e) {
2379
- return e.defaultDecorator || (!1 === e.deep ? ke : Ve);
2380
- }
2381
- function Lt(e, t, r, n) {
2382
- var o, i, a, s;
2383
- if (
2384
- 'production' !== process.env.NODE_ENV &&
2385
- (H(
2386
- !Mt(t),
2387
- 'Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540',
2388
- ),
2389
- r)
2390
- ) {
2391
- var u = ne(r);
2392
- try {
2393
- for (var c = he(u), p = c.next(); !p.done; p = c.next()) {
2394
- (f = p.value) in t ||
2395
- J(
2396
- "Trying to declare a decorator for unspecified property '" +
2397
- oe(f) +
2398
- "'",
2399
- );
2400
- }
2401
- } catch (e) {
2402
- o = { error: e };
2403
- } finally {
2404
- try {
2405
- p && !p.done && (i = c.return) && i.call(c);
2406
- } finally {
2407
- if (o) throw o.error;
2408
- }
2409
- }
2410
- }
2411
- bt();
2412
- try {
2413
- u = ae(t);
2414
- try {
2415
- for (var l = he(u), d = l.next(); !d.done; d = l.next()) {
2416
- var f = d.value,
2417
- h = Object.getOwnPropertyDescriptor(t, f);
2418
- 'production' !== process.env.NODE_ENV &&
2419
- (Y(t) ||
2420
- J(
2421
- "'extendObservable' only accepts plain objects as second argument",
2422
- ),
2423
- It(h.value) &&
2424
- J(
2425
- "Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead",
2426
- ));
2427
- var v = r && f in r ? r[f] : h.get ? Ie : n;
2428
- 'production' !== process.env.NODE_ENV &&
2429
- 'function' != typeof v &&
2430
- J("Not a valid decorator for '" + oe(f) + "', got: " + v);
2431
- var y = v(e, f, h, !0);
2432
- y && Object.defineProperty(e, f, y);
2433
- }
2434
- } catch (e) {
2435
- a = { error: e };
2436
- } finally {
2437
- try {
2438
- d && !d.done && (s = l.return) && s.call(l);
2439
- } finally {
2440
- if (a) throw a.error;
2441
- }
2442
- }
2443
- } finally {
2444
- mt();
2445
- }
2446
- }
2447
- function Bt(e) {
2448
- var t,
2449
- r,
2450
- n = { name: e.name };
2451
- return (
2452
- e.observing &&
2453
- e.observing.length > 0 &&
2454
- (n.dependencies = ((t = e.observing),
2455
- (r = []),
2456
- t.forEach(function (e) {
2457
- -1 === r.indexOf(e) && r.push(e);
2458
- }),
2459
- r).map(Bt)),
2460
- n
2461
- );
2462
- }
2463
- function It(e) {
2464
- return arguments.length > 1
2465
- ? J(
2466
- 'production' !== process.env.NODE_ENV &&
2467
- 'isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property',
2468
- )
2469
- : (function (e, t) {
2470
- if (null == e) return !1;
2471
- if (void 0 !== t) {
2472
- if (!1 === mr(e)) return !1;
2473
- if (!e[se].values.has(t)) return !1;
2474
- var r = gr(e, t);
2475
- return ut(r);
2476
- }
2477
- return ut(e);
2478
- })(e);
2479
- }
2480
- function Mt(e) {
2481
- return (
2482
- 1 !== arguments.length &&
2483
- J(
2484
- 'production' !== process.env.NODE_ENV &&
2485
- 'isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property',
2486
- ),
2487
- (function (e, t) {
2488
- return (
2489
- null != e &&
2490
- (void 0 !== t
2491
- ? 'production' !== process.env.NODE_ENV && (ur(e) || or(e))
2492
- ? J(
2493
- 'isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.',
2494
- )
2495
- : !!mr(e) && e[se].values.has(t)
2496
- : mr(e) || !!e[se] || ce(e) || St(e) || ut(e))
2497
- );
2498
- })(e)
2499
- );
2500
- }
2501
- function Gt(e, t, r) {
2502
- if (2 !== arguments.length || lr(e))
2503
- if (mr(e)) {
2504
- var n = e[se];
2505
- n.values.get(t)
2506
- ? n.write(t, r)
2507
- : n.addObservableProp(t, r, n.defaultEnhancer);
2508
- } else if (ur(e)) e.set(t, r);
2509
- else if (lr(e)) e.add(t);
2510
- else {
2511
- if (!or(e))
2512
- return J(
2513
- 'production' !== process.env.NODE_ENV &&
2514
- "'set()' can only be used on observable objects, arrays and maps",
2515
- );
2516
- 'number' != typeof t && (t = parseInt(t, 10)),
2517
- H(t >= 0, "Not a valid index: '" + t + "'"),
2518
- bt(),
2519
- t >= e.length && (e.length = t + 1),
2520
- (e[t] = r),
2521
- mt();
2522
- }
2523
- else {
2524
- bt();
2525
- var o = t;
2526
- try {
2527
- for (var i in o) Gt(e, i, o[i]);
2528
- } finally {
2529
- mt();
2530
- }
2531
- }
2532
- }
2533
- function zt(e, t) {
2534
- void 0 === t && (t = void 0), bt();
2535
- try {
2536
- return e.apply(t);
2537
- } finally {
2538
- mt();
2539
- }
2540
- }
2541
- function Kt(e) {
2542
- return e[se];
2543
- }
2544
- function Ft(e) {
2545
- return 'string' == typeof e || 'number' == typeof e || 'symbol' == typeof e;
2546
- }
2547
- var Jt = {
2548
- has: function (e, t) {
2549
- if (t === se || 'constructor' === t || t === be) return !0;
2550
- var r = Kt(e);
2551
- return Ft(t) ? r.has(t) : t in e;
2552
- },
2553
- get: function (e, t) {
2554
- if (t === se || 'constructor' === t || t === be) return e[t];
2555
- var r = Kt(e),
2556
- n = r.values.get(t);
2557
- if (n instanceof ue) {
2558
- var o = n.get();
2559
- return void 0 === o && r.has(t), o;
2560
- }
2561
- return Ft(t) && r.has(t), e[t];
2562
- },
2563
- set: function (e, t, r) {
2564
- return !!Ft(t) && (Gt(e, t, r), !0);
2565
- },
2566
- deleteProperty: function (e, t) {
2567
- return !!Ft(t) && (Kt(e).remove(t), !0);
2568
- },
2569
- ownKeys: function (e) {
2570
- return Kt(e).keysAtom.reportObserved(), Reflect.ownKeys(e);
2571
- },
2572
- preventExtensions: function (e) {
2573
- return J('Dynamic observable objects cannot be frozen'), !1;
2574
- },
2575
- };
2576
- function Ht(e) {
2577
- return void 0 !== e.interceptors && e.interceptors.length > 0;
2578
- }
2579
- function Wt(e, t) {
2580
- var r = e.interceptors || (e.interceptors = []);
2581
- return (
2582
- r.push(t),
2583
- W(function () {
2584
- var e = r.indexOf(t);
2585
- -1 !== e && r.splice(e, 1);
2586
- })
2587
- );
2588
- }
2589
- function Xt(e, t) {
2590
- var r = We();
2591
- try {
2592
- for (
2593
- var n = ye(e.interceptors || []), o = 0, i = n.length;
2594
- o < i &&
2595
- (H(
2596
- !(t = n[o](t)) || t.type,
2597
- 'Intercept handlers should return nothing or a change object',
2598
- ),
2599
- t);
2600
- o++
2601
- );
2602
- return t;
2603
- } finally {
2604
- Xe(r);
2605
- }
2606
- }
2607
- function $t(e) {
2608
- return void 0 !== e.changeListeners && e.changeListeners.length > 0;
2609
- }
2610
- function Yt(e, t) {
2611
- var r = e.changeListeners || (e.changeListeners = []);
2612
- return (
2613
- r.push(t),
2614
- W(function () {
2615
- var e = r.indexOf(t);
2616
- -1 !== e && r.splice(e, 1);
2617
- })
2618
- );
2619
- }
2620
- function Zt(e, t) {
2621
- var r = We(),
2622
- n = e.changeListeners;
2623
- if (n) {
2624
- for (var o = 0, i = (n = n.slice()).length; o < i; o++) n[o](t);
2625
- Xe(r);
2626
- }
2627
- }
2628
- var Qt = {
2629
- get: function (e, t) {
2630
- return t === se
2631
- ? e[se]
2632
- : 'length' === t
2633
- ? e[se].getArrayLength()
2634
- : 'number' == typeof t
2635
- ? tr.get.call(e, t)
2636
- : 'string' != typeof t || isNaN(t)
2637
- ? tr.hasOwnProperty(t)
2638
- ? tr[t]
2639
- : e[t]
2640
- : tr.get.call(e, parseInt(t));
2641
- },
2642
- set: function (e, t, r) {
2643
- return (
2644
- 'length' === t && e[se].setArrayLength(r),
2645
- 'number' == typeof t && tr.set.call(e, t, r),
2646
- 'symbol' == typeof t || isNaN(t)
2647
- ? (e[t] = r)
2648
- : tr.set.call(e, parseInt(t), r),
2649
- !0
2650
- );
2651
- },
2652
- preventExtensions: function (e) {
2653
- return J('Observable arrays cannot be frozen'), !1;
2654
- },
2655
- };
2656
- var er = (function () {
2657
- function e(e, t, r) {
2658
- (this.owned = r),
2659
- (this.values = []),
2660
- (this.proxy = void 0),
2661
- (this.lastKnownLength = 0),
2662
- (this.atom = new ue(e || 'ObservableArray@' + F())),
2663
- (this.enhancer = function (r, n) {
2664
- return t(r, n, e + '[..]');
2665
- });
2666
- }
2667
- return (
2668
- (e.prototype.dehanceValue = function (e) {
2669
- return void 0 !== this.dehancer ? this.dehancer(e) : e;
2670
- }),
2671
- (e.prototype.dehanceValues = function (e) {
2672
- return void 0 !== this.dehancer && e.length > 0
2673
- ? e.map(this.dehancer)
2674
- : e;
2675
- }),
2676
- (e.prototype.intercept = function (e) {
2677
- return Wt(this, e);
2678
- }),
2679
- (e.prototype.observe = function (e, t) {
2680
- return (
2681
- void 0 === t && (t = !1),
2682
- t &&
2683
- e({
2684
- object: this.proxy,
2685
- type: 'splice',
2686
- index: 0,
2687
- added: this.values.slice(),
2688
- addedCount: this.values.length,
2689
- removed: [],
2690
- removedCount: 0,
2691
- }),
2692
- Yt(this, e)
2693
- );
2694
- }),
2695
- (e.prototype.getArrayLength = function () {
2696
- return this.atom.reportObserved(), this.values.length;
2697
- }),
2698
- (e.prototype.setArrayLength = function (e) {
2699
- if ('number' != typeof e || e < 0)
2700
- throw new Error('[mobx.array] Out of range: ' + e);
2701
- var t = this.values.length;
2702
- if (e !== t)
2703
- if (e > t) {
2704
- for (var r = new Array(e - t), n = 0; n < e - t; n++) r[n] = void 0;
2705
- this.spliceWithArray(t, 0, r);
2706
- } else this.spliceWithArray(e, t - e);
2707
- }),
2708
- (e.prototype.updateArrayLength = function (e, t) {
2709
- if (e !== this.lastKnownLength)
2710
- throw new Error(
2711
- '[mobx] Modification exception: the internal structure of an observable array was changed.',
2712
- );
2713
- this.lastKnownLength += t;
2714
- }),
2715
- (e.prototype.spliceWithArray = function (e, t, r) {
2716
- var n = this;
2717
- Ke(this.atom);
2718
- var o = this.values.length;
2719
- if (
2720
- (void 0 === e
2721
- ? (e = 0)
2722
- : e > o
2723
- ? (e = o)
2724
- : e < 0 && (e = Math.max(0, o + e)),
2725
- (t =
2726
- 1 === arguments.length
2727
- ? o - e
2728
- : null == t
2729
- ? 0
2730
- : Math.max(0, Math.min(t, o - e))),
2731
- void 0 === r && (r = z),
2732
- Ht(this))
2733
- ) {
2734
- var i = Xt(this, {
2735
- object: this.proxy,
2736
- type: 'splice',
2737
- index: e,
2738
- removedCount: t,
2739
- added: r,
2740
- });
2741
- if (!i) return z;
2742
- (t = i.removedCount), (r = i.added);
2743
- }
2744
- if (
2745
- ((r =
2746
- 0 === r.length
2747
- ? r
2748
- : r.map(function (e) {
2749
- return n.enhancer(e, void 0);
2750
- })),
2751
- 'production' !== process.env.NODE_ENV)
2752
- ) {
2753
- var a = r.length - t;
2754
- this.updateArrayLength(o, a);
2755
- }
2756
- var s = this.spliceItemsIntoValues(e, t, r);
2757
- return (
2758
- (0 === t && 0 === r.length) || this.notifyArraySplice(e, r, s),
2759
- this.dehanceValues(s)
2760
- );
2761
- }),
2762
- (e.prototype.spliceItemsIntoValues = function (e, t, r) {
2763
- var n;
2764
- if (r.length < 1e4)
2765
- return (n = this.values).splice.apply(n, ye([e, t], r));
2766
- var o = this.values.slice(e, e + t);
2767
- return (
2768
- (this.values = this.values
2769
- .slice(0, e)
2770
- .concat(r, this.values.slice(e + t))),
2771
- o
2772
- );
2773
- }),
2774
- (e.prototype.notifyArrayChildUpdate = function (e, t, r) {
2775
- var n = !this.owned && Dt(),
2776
- o = $t(this),
2777
- i =
2778
- o || n
2779
- ? {
2780
- object: this.proxy,
2781
- type: 'update',
2782
- index: e,
2783
- newValue: t,
2784
- oldValue: r,
2785
- }
2786
- : null;
2787
- n &&
2788
- 'production' !== process.env.NODE_ENV &&
2789
- Vt(fe(fe({}, i), { name: this.atom.name })),
2790
- this.atom.reportChanged(),
2791
- o && Zt(this, i),
2792
- n && 'production' !== process.env.NODE_ENV && kt();
2793
- }),
2794
- (e.prototype.notifyArraySplice = function (e, t, r) {
2795
- var n = !this.owned && Dt(),
2796
- o = $t(this),
2797
- i =
2798
- o || n
2799
- ? {
2800
- object: this.proxy,
2801
- type: 'splice',
2802
- index: e,
2803
- removed: r,
2804
- added: t,
2805
- removedCount: r.length,
2806
- addedCount: t.length,
2807
- }
2808
- : null;
2809
- n &&
2810
- 'production' !== process.env.NODE_ENV &&
2811
- Vt(fe(fe({}, i), { name: this.atom.name })),
2812
- this.atom.reportChanged(),
2813
- o && Zt(this, i),
2814
- n && 'production' !== process.env.NODE_ENV && kt();
2815
- }),
2816
- e
2817
- );
2818
- })(),
2819
- tr = {
2820
- intercept: function (e) {
2821
- return this[se].intercept(e);
2822
- },
2823
- observe: function (e, t) {
2824
- return void 0 === t && (t = !1), this[se].observe(e, t);
2825
- },
2826
- clear: function () {
2827
- return this.splice(0);
2828
- },
2829
- replace: function (e) {
2830
- var t = this[se];
2831
- return t.spliceWithArray(0, t.values.length, e);
2832
- },
2833
- toJS: function () {
2834
- return this.slice();
2835
- },
2836
- toJSON: function () {
2837
- return this.toJS();
2838
- },
2839
- splice: function (e, t) {
2840
- for (var r = [], n = 2; n < arguments.length; n++)
2841
- r[n - 2] = arguments[n];
2842
- var o = this[se];
2843
- switch (arguments.length) {
2844
- case 0:
2845
- return [];
2846
- case 1:
2847
- return o.spliceWithArray(e);
2848
- case 2:
2849
- return o.spliceWithArray(e, t);
2850
- }
2851
- return o.spliceWithArray(e, t, r);
2852
- },
2853
- spliceWithArray: function (e, t, r) {
2854
- return this[se].spliceWithArray(e, t, r);
2855
- },
2856
- push: function () {
2857
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2858
- var r = this[se];
2859
- return r.spliceWithArray(r.values.length, 0, e), r.values.length;
2860
- },
2861
- pop: function () {
2862
- return this.splice(Math.max(this[se].values.length - 1, 0), 1)[0];
2863
- },
2864
- shift: function () {
2865
- return this.splice(0, 1)[0];
2866
- },
2867
- unshift: function () {
2868
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2869
- var r = this[se];
2870
- return r.spliceWithArray(0, 0, e), r.values.length;
2871
- },
2872
- reverse: function () {
2873
- 'production' !== process.env.NODE_ENV &&
2874
- console.warn(
2875
- '[mobx] `observableArray.reverse()` will not update the array in place. Use `observableArray.slice().reverse()` to suppress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().reverse())` to reverse & update in place',
2876
- );
2877
- var e = this.slice();
2878
- return e.reverse.apply(e, arguments);
2879
- },
2880
- sort: function (e) {
2881
- 'production' !== process.env.NODE_ENV &&
2882
- console.warn(
2883
- '[mobx] `observableArray.sort()` will not update the array in place. Use `observableArray.slice().sort()` to suppress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().sort())` to sort & update in place',
2884
- );
2885
- var t = this.slice();
2886
- return t.sort.apply(t, arguments);
2887
- },
2888
- remove: function (e) {
2889
- var t = this[se],
2890
- r = t.dehanceValues(t.values).indexOf(e);
2891
- return r > -1 && (this.splice(r, 1), !0);
2892
- },
2893
- get: function (e) {
2894
- var t = this[se];
2895
- if (t) {
2896
- if (e < t.values.length)
2897
- return t.atom.reportObserved(), t.dehanceValue(t.values[e]);
2898
- console.warn(
2899
- '[mobx.array] Attempt to read an array index (' +
2900
- e +
2901
- ') that is out of bounds (' +
2902
- t.values.length +
2903
- '). Please check length first. Out of bound indices will not be tracked by MobX',
2904
- );
2905
- }
2906
- },
2907
- set: function (e, t) {
2908
- var r = this[se],
2909
- n = r.values;
2910
- if (e < n.length) {
2911
- Ke(r.atom);
2912
- var o = n[e];
2913
- if (Ht(r)) {
2914
- var i = Xt(r, {
2915
- type: 'update',
2916
- object: r.proxy,
2917
- index: e,
2918
- newValue: t,
2919
- });
2920
- if (!i) return;
2921
- t = i.newValue;
2922
- }
2923
- (t = r.enhancer(t, o)) !== o &&
2924
- ((n[e] = t), r.notifyArrayChildUpdate(e, t, o));
2925
- } else {
2926
- if (e !== n.length)
2927
- throw new Error(
2928
- '[mobx.array] Index out of bounds, ' +
2929
- e +
2930
- ' is larger than ' +
2931
- n.length,
2932
- );
2933
- r.spliceWithArray(e, 0, [t]);
2934
- }
2935
- },
2936
- };
2937
- [
2938
- 'concat',
2939
- 'flat',
2940
- 'includes',
2941
- 'indexOf',
2942
- 'join',
2943
- 'lastIndexOf',
2944
- 'slice',
2945
- 'toString',
2946
- 'toLocaleString',
2947
- ].forEach(function (e) {
2948
- 'function' == typeof Array.prototype[e] &&
2949
- (tr[e] = function () {
2950
- var t = this[se];
2951
- t.atom.reportObserved();
2952
- var r = t.dehanceValues(t.values);
2953
- return r[e].apply(r, arguments);
2954
- });
2955
- }),
2956
- [
2957
- 'every',
2958
- 'filter',
2959
- 'find',
2960
- 'findIndex',
2961
- 'flatMap',
2962
- 'forEach',
2963
- 'map',
2964
- 'some',
2965
- ].forEach(function (e) {
2966
- 'function' == typeof Array.prototype[e] &&
2967
- (tr[e] = function (t, r) {
2968
- var n = this,
2969
- o = this[se];
2970
- return (
2971
- o.atom.reportObserved(),
2972
- o.dehanceValues(o.values)[e](function (e, o) {
2973
- return t.call(r, e, o, n);
2974
- }, r)
2975
- );
2976
- });
2977
- }),
2978
- ['reduce', 'reduceRight'].forEach(function (e) {
2979
- tr[e] = function () {
2980
- var t = this,
2981
- r = this[se];
2982
- r.atom.reportObserved();
2983
- var n = arguments[0];
2984
- return (
2985
- (arguments[0] = function (e, o, i) {
2986
- return (o = r.dehanceValue(o)), n(e, o, i, t);
2987
- }),
2988
- r.values[e].apply(r.values, arguments)
2989
- );
2990
- };
2991
- });
2992
- var rr,
2993
- nr = ee('ObservableArrayAdministration', er);
2994
- function or(e) {
2995
- return $(e) && nr(e[se]);
2996
- }
2997
- var ir,
2998
- ar = {},
2999
- sr = (function () {
3000
- function e(e, t, r) {
3001
- if (
3002
- (void 0 === t && (t = _e),
3003
- void 0 === r && (r = 'ObservableMap@' + F()),
3004
- (this.enhancer = t),
3005
- (this.name = r),
3006
- (this[rr] = ar),
3007
- (this._keysAtom = pe(this.name + '.keys()')),
3008
- (this[Symbol.toStringTag] = 'Map'),
3009
- 'function' != typeof Map)
3010
- )
3011
- throw new Error(
3012
- 'mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js',
3013
- );
3014
- (this._data = new Map()), (this._hasMap = new Map()), this.merge(e);
3015
- }
3016
- return (
3017
- (e.prototype._has = function (e) {
3018
- return this._data.has(e);
3019
- }),
3020
- (e.prototype.has = function (e) {
3021
- var t = this;
3022
- if (!ft.trackingDerivation) return this._has(e);
3023
- var r = this._hasMap.get(e);
3024
- if (!r) {
3025
- var n = (r = new at(
3026
- this._has(e),
3027
- je,
3028
- this.name + '.' + oe(e) + '?',
3029
- !1,
3030
- ));
3031
- this._hasMap.set(e, n),
3032
- Rt(n, function () {
3033
- return t._hasMap.delete(e);
3034
- });
3035
- }
3036
- return r.get();
3037
- }),
3038
- (e.prototype.set = function (e, t) {
3039
- var r = this._has(e);
3040
- if (Ht(this)) {
3041
- var n = Xt(this, {
3042
- type: r ? 'update' : 'add',
3043
- object: this,
3044
- newValue: t,
3045
- name: e,
3046
- });
3047
- if (!n) return this;
3048
- t = n.newValue;
3049
- }
3050
- return r ? this._updateValue(e, t) : this._addValue(e, t), this;
3051
- }),
3052
- (e.prototype.delete = function (e) {
3053
- var t = this;
3054
- if (
3055
- (Ke(this._keysAtom), Ht(this)) &&
3056
- !(o = Xt(this, { type: 'delete', object: this, name: e }))
3057
- )
3058
- return !1;
3059
- if (this._has(e)) {
3060
- var r = Dt(),
3061
- n = $t(this),
3062
- o =
3063
- n || r
3064
- ? {
3065
- type: 'delete',
3066
- object: this,
3067
- oldValue: this._data.get(e).value,
3068
- name: e,
3069
- }
3070
- : null;
3071
- return (
3072
- r &&
3073
- 'production' !== process.env.NODE_ENV &&
3074
- Vt(fe(fe({}, o), { name: this.name, key: e })),
3075
- zt(function () {
3076
- t._keysAtom.reportChanged(),
3077
- t._updateHasMapEntry(e, !1),
3078
- t._data.get(e).setNewValue(void 0),
3079
- t._data.delete(e);
3080
- }),
3081
- n && Zt(this, o),
3082
- r && 'production' !== process.env.NODE_ENV && kt(),
3083
- !0
3084
- );
3085
- }
3086
- return !1;
3087
- }),
3088
- (e.prototype._updateHasMapEntry = function (e, t) {
3089
- var r = this._hasMap.get(e);
3090
- r && r.setNewValue(t);
3091
- }),
3092
- (e.prototype._updateValue = function (e, t) {
3093
- var r = this._data.get(e);
3094
- if ((t = r.prepareNewValue(t)) !== ft.UNCHANGED) {
3095
- var n = Dt(),
3096
- o = $t(this),
3097
- i =
3098
- o || n
3099
- ? {
3100
- type: 'update',
3101
- object: this,
3102
- oldValue: r.value,
3103
- name: e,
3104
- newValue: t,
3105
- }
3106
- : null;
3107
- n &&
3108
- 'production' !== process.env.NODE_ENV &&
3109
- Vt(fe(fe({}, i), { name: this.name, key: e })),
3110
- r.setNewValue(t),
3111
- o && Zt(this, i),
3112
- n && 'production' !== process.env.NODE_ENV && kt();
3113
- }
3114
- }),
3115
- (e.prototype._addValue = function (e, t) {
3116
- var r = this;
3117
- Ke(this._keysAtom),
3118
- zt(function () {
3119
- var n = new at(t, r.enhancer, r.name + '.' + oe(e), !1);
3120
- r._data.set(e, n),
3121
- (t = n.value),
3122
- r._updateHasMapEntry(e, !0),
3123
- r._keysAtom.reportChanged();
3124
- });
3125
- var n = Dt(),
3126
- o = $t(this),
3127
- i =
3128
- o || n ? { type: 'add', object: this, name: e, newValue: t } : null;
3129
- n &&
3130
- 'production' !== process.env.NODE_ENV &&
3131
- Vt(fe(fe({}, i), { name: this.name, key: e })),
3132
- o && Zt(this, i),
3133
- n && 'production' !== process.env.NODE_ENV && kt();
3134
- }),
3135
- (e.prototype.get = function (e) {
3136
- return this.has(e)
3137
- ? this.dehanceValue(this._data.get(e).get())
3138
- : this.dehanceValue(void 0);
3139
- }),
3140
- (e.prototype.dehanceValue = function (e) {
3141
- return void 0 !== this.dehancer ? this.dehancer(e) : e;
3142
- }),
3143
- (e.prototype.keys = function () {
3144
- return this._keysAtom.reportObserved(), this._data.keys();
3145
- }),
3146
- (e.prototype.values = function () {
3147
- var e = this,
3148
- t = this.keys();
3149
- return Dr({
3150
- next: function () {
3151
- var r = t.next(),
3152
- n = r.done,
3153
- o = r.value;
3154
- return { done: n, value: n ? void 0 : e.get(o) };
3155
- },
3156
- });
3157
- }),
3158
- (e.prototype.entries = function () {
3159
- var e = this,
3160
- t = this.keys();
3161
- return Dr({
3162
- next: function () {
3163
- var r = t.next(),
3164
- n = r.done,
3165
- o = r.value;
3166
- return { done: n, value: n ? void 0 : [o, e.get(o)] };
3167
- },
3168
- });
3169
- }),
3170
- (e.prototype[((rr = se), Symbol.iterator)] = function () {
3171
- return this.entries();
3172
- }),
3173
- (e.prototype.forEach = function (e, t) {
3174
- var r, n;
3175
- try {
3176
- for (var o = he(this), i = o.next(); !i.done; i = o.next()) {
3177
- var a = ve(i.value, 2),
3178
- s = a[0],
3179
- u = a[1];
3180
- e.call(t, u, s, this);
3181
- }
3182
- } catch (e) {
3183
- r = { error: e };
3184
- } finally {
3185
- try {
3186
- i && !i.done && (n = o.return) && n.call(o);
3187
- } finally {
3188
- if (r) throw r.error;
3189
- }
3190
- }
3191
- }),
3192
- (e.prototype.merge = function (e) {
3193
- var t = this;
3194
- return (
3195
- ur(e) && (e = e.toJS()),
3196
- zt(function () {
3197
- var r = ot(!0);
3198
- try {
3199
- Y(e)
3200
- ? ne(e).forEach(function (r) {
3201
- return t.set(r, e[r]);
3202
- })
3203
- : Array.isArray(e)
3204
- ? e.forEach(function (e) {
3205
- var r = ve(e, 2),
3206
- n = r[0],
3207
- o = r[1];
3208
- return t.set(n, o);
3209
- })
3210
- : te(e)
3211
- ? (e.constructor !== Map &&
3212
- J(
3213
- 'Cannot initialize from classes that inherit from Map: ' +
3214
- e.constructor.name,
3215
- ),
3216
- e.forEach(function (e, r) {
3217
- return t.set(r, e);
3218
- }))
3219
- : null != e && J('Cannot initialize map from ' + e);
3220
- } finally {
3221
- it(r);
3222
- }
3223
- }),
3224
- this
3225
- );
3226
- }),
3227
- (e.prototype.clear = function () {
3228
- var e = this;
3229
- zt(function () {
3230
- He(function () {
3231
- var t, r;
3232
- try {
3233
- for (var n = he(e.keys()), o = n.next(); !o.done; o = n.next()) {
3234
- var i = o.value;
3235
- e.delete(i);
3236
- }
3237
- } catch (e) {
3238
- t = { error: e };
3239
- } finally {
3240
- try {
3241
- o && !o.done && (r = n.return) && r.call(n);
3242
- } finally {
3243
- if (t) throw t.error;
3244
- }
3245
- }
3246
- });
3247
- });
3248
- }),
3249
- (e.prototype.replace = function (e) {
3250
- var t = this;
3251
- return (
3252
- zt(function () {
3253
- var r,
3254
- n,
3255
- o,
3256
- i,
3257
- a = (function (e) {
3258
- if (te(e) || ur(e)) return e;
3259
- if (Array.isArray(e)) return new Map(e);
3260
- if (Y(e)) {
3261
- var t = new Map();
3262
- for (var r in e) t.set(r, e[r]);
3263
- return t;
3264
- }
3265
- return J("Cannot convert to map from '" + e + "'");
3266
- })(e),
3267
- s = new Map(),
3268
- u = !1;
3269
- try {
3270
- for (
3271
- var c = he(t._data.keys()), p = c.next();
3272
- !p.done;
3273
- p = c.next()
3274
- ) {
3275
- var l = p.value;
3276
- if (!a.has(l))
3277
- if (t.delete(l)) u = !0;
3278
- else {
3279
- var d = t._data.get(l);
3280
- s.set(l, d);
3281
- }
3282
- }
3283
- } catch (e) {
3284
- r = { error: e };
3285
- } finally {
3286
- try {
3287
- p && !p.done && (n = c.return) && n.call(c);
3288
- } finally {
3289
- if (r) throw r.error;
3290
- }
3291
- }
3292
- try {
3293
- for (
3294
- var f = he(a.entries()), h = f.next();
3295
- !h.done;
3296
- h = f.next()
3297
- ) {
3298
- var v = ve(h.value, 2),
3299
- y = ((l = v[0]), (d = v[1]), t._data.has(l));
3300
- if ((t.set(l, d), t._data.has(l))) {
3301
- var b = t._data.get(l);
3302
- s.set(l, b), y || (u = !0);
3303
- }
3304
- }
3305
- } catch (e) {
3306
- o = { error: e };
3307
- } finally {
3308
- try {
3309
- h && !h.done && (i = f.return) && i.call(f);
3310
- } finally {
3311
- if (o) throw o.error;
3312
- }
3313
- }
3314
- if (!u)
3315
- if (t._data.size !== s.size) t._keysAtom.reportChanged();
3316
- else
3317
- for (
3318
- var m = t._data.keys(),
3319
- g = s.keys(),
3320
- O = m.next(),
3321
- E = g.next();
3322
- !O.done;
3323
-
3324
- ) {
3325
- if (O.value !== E.value) {
3326
- t._keysAtom.reportChanged();
3327
- break;
3328
- }
3329
- (O = m.next()), (E = g.next());
3330
- }
3331
- t._data = s;
3332
- }),
3333
- this
3334
- );
3335
- }),
3336
- Object.defineProperty(e.prototype, 'size', {
3337
- get: function () {
3338
- return this._keysAtom.reportObserved(), this._data.size;
3339
- },
3340
- enumerable: !0,
3341
- configurable: !0,
3342
- }),
3343
- (e.prototype.toPOJO = function () {
3344
- var e,
3345
- t,
3346
- r = {};
3347
- try {
3348
- for (var n = he(this), o = n.next(); !o.done; o = n.next()) {
3349
- var i = ve(o.value, 2),
3350
- a = i[0],
3351
- s = i[1];
3352
- r['symbol' == typeof a ? a : oe(a)] = s;
3353
- }
3354
- } catch (t) {
3355
- e = { error: t };
3356
- } finally {
3357
- try {
3358
- o && !o.done && (t = n.return) && t.call(n);
3359
- } finally {
3360
- if (e) throw e.error;
3361
- }
3362
- }
3363
- return r;
3364
- }),
3365
- (e.prototype.toJS = function () {
3366
- return new Map(this);
3367
- }),
3368
- (e.prototype.toJSON = function () {
3369
- return this.toPOJO();
3370
- }),
3371
- (e.prototype.toString = function () {
3372
- var e = this;
3373
- return (
3374
- this.name +
3375
- '[{ ' +
3376
- Array.from(this.keys())
3377
- .map(function (t) {
3378
- return oe(t) + ': ' + e.get(t);
3379
- })
3380
- .join(', ') +
3381
- ' }]'
3382
- );
3383
- }),
3384
- (e.prototype.observe = function (e, t) {
3385
- return (
3386
- 'production' !== process.env.NODE_ENV &&
3387
- H(
3388
- !0 !== t,
3389
- "`observe` doesn't support fireImmediately=true in combination with maps.",
3390
- ),
3391
- Yt(this, e)
3392
- );
3393
- }),
3394
- (e.prototype.intercept = function (e) {
3395
- return Wt(this, e);
3396
- }),
3397
- e
3398
- );
3399
- })(),
3400
- ur = ee('ObservableMap', sr),
3401
- cr = {},
3402
- pr = (function () {
3403
- function e(e, t, r) {
3404
- if (
3405
- (void 0 === t && (t = _e),
3406
- void 0 === r && (r = 'ObservableSet@' + F()),
3407
- (this.name = r),
3408
- (this[ir] = cr),
3409
- (this._data = new Set()),
3410
- (this._atom = pe(this.name)),
3411
- (this[Symbol.toStringTag] = 'Set'),
3412
- 'function' != typeof Set)
3413
- )
3414
- throw new Error(
3415
- 'mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js',
3416
- );
3417
- (this.enhancer = function (e, n) {
3418
- return t(e, n, r);
3419
- }),
3420
- e && this.replace(e);
3421
- }
3422
- return (
3423
- (e.prototype.dehanceValue = function (e) {
3424
- return void 0 !== this.dehancer ? this.dehancer(e) : e;
3425
- }),
3426
- (e.prototype.clear = function () {
3427
- var e = this;
3428
- zt(function () {
3429
- He(function () {
3430
- var t, r;
3431
- try {
3432
- for (
3433
- var n = he(e._data.values()), o = n.next();
3434
- !o.done;
3435
- o = n.next()
3436
- ) {
3437
- var i = o.value;
3438
- e.delete(i);
3439
- }
3440
- } catch (e) {
3441
- t = { error: e };
3442
- } finally {
3443
- try {
3444
- o && !o.done && (r = n.return) && r.call(n);
3445
- } finally {
3446
- if (t) throw t.error;
3447
- }
3448
- }
3449
- });
3450
- });
3451
- }),
3452
- (e.prototype.forEach = function (e, t) {
3453
- var r, n;
3454
- try {
3455
- for (var o = he(this), i = o.next(); !i.done; i = o.next()) {
3456
- var a = i.value;
3457
- e.call(t, a, a, this);
3458
- }
3459
- } catch (e) {
3460
- r = { error: e };
3461
- } finally {
3462
- try {
3463
- i && !i.done && (n = o.return) && n.call(o);
3464
- } finally {
3465
- if (r) throw r.error;
3466
- }
3467
- }
3468
- }),
3469
- Object.defineProperty(e.prototype, 'size', {
3470
- get: function () {
3471
- return this._atom.reportObserved(), this._data.size;
3472
- },
3473
- enumerable: !0,
3474
- configurable: !0,
3475
- }),
3476
- (e.prototype.add = function (e) {
3477
- var t = this;
3478
- if (
3479
- (Ke(this._atom), Ht(this)) &&
3480
- !(o = Xt(this, { type: 'add', object: this, newValue: e }))
3481
- )
3482
- return this;
3483
- if (!this.has(e)) {
3484
- zt(function () {
3485
- t._data.add(t.enhancer(e, void 0)), t._atom.reportChanged();
3486
- });
3487
- var r = Dt(),
3488
- n = $t(this),
3489
- o = n || r ? { type: 'add', object: this, newValue: e } : null;
3490
- r && 'production' !== process.env.NODE_ENV && Vt(o),
3491
- n && Zt(this, o),
3492
- r && 'production' !== process.env.NODE_ENV && kt();
3493
- }
3494
- return this;
3495
- }),
3496
- (e.prototype.delete = function (e) {
3497
- var t = this;
3498
- if (
3499
- Ht(this) &&
3500
- !(o = Xt(this, { type: 'delete', object: this, oldValue: e }))
3501
- )
3502
- return !1;
3503
- if (this.has(e)) {
3504
- var r = Dt(),
3505
- n = $t(this),
3506
- o = n || r ? { type: 'delete', object: this, oldValue: e } : null;
3507
- return (
3508
- r &&
3509
- 'production' !== process.env.NODE_ENV &&
3510
- Vt(fe(fe({}, o), { name: this.name })),
3511
- zt(function () {
3512
- t._atom.reportChanged(), t._data.delete(e);
3513
- }),
3514
- n && Zt(this, o),
3515
- r && 'production' !== process.env.NODE_ENV && kt(),
3516
- !0
3517
- );
3518
- }
3519
- return !1;
3520
- }),
3521
- (e.prototype.has = function (e) {
3522
- return (
3523
- this._atom.reportObserved(), this._data.has(this.dehanceValue(e))
3524
- );
3525
- }),
3526
- (e.prototype.entries = function () {
3527
- var e = 0,
3528
- t = Array.from(this.keys()),
3529
- r = Array.from(this.values());
3530
- return Dr({
3531
- next: function () {
3532
- var n = e;
3533
- return (
3534
- (e += 1),
3535
- n < r.length ? { value: [t[n], r[n]], done: !1 } : { done: !0 }
3536
- );
3537
- },
3538
- });
3539
- }),
3540
- (e.prototype.keys = function () {
3541
- return this.values();
3542
- }),
3543
- (e.prototype.values = function () {
3544
- this._atom.reportObserved();
3545
- var e = this,
3546
- t = 0,
3547
- r = Array.from(this._data.values());
3548
- return Dr({
3549
- next: function () {
3550
- return t < r.length
3551
- ? { value: e.dehanceValue(r[t++]), done: !1 }
3552
- : { done: !0 };
3553
- },
3554
- });
3555
- }),
3556
- (e.prototype.replace = function (e) {
3557
- var t = this;
3558
- return (
3559
- lr(e) && (e = e.toJS()),
3560
- zt(function () {
3561
- var r = ot(!0);
3562
- try {
3563
- Array.isArray(e) || re(e)
3564
- ? (t.clear(),
3565
- e.forEach(function (e) {
3566
- return t.add(e);
3567
- }))
3568
- : null != e && J('Cannot initialize set from ' + e);
3569
- } finally {
3570
- it(r);
3571
- }
3572
- }),
3573
- this
3574
- );
3575
- }),
3576
- (e.prototype.observe = function (e, t) {
3577
- return (
3578
- 'production' !== process.env.NODE_ENV &&
3579
- H(
3580
- !0 !== t,
3581
- "`observe` doesn't support fireImmediately=true in combination with sets.",
3582
- ),
3583
- Yt(this, e)
3584
- );
3585
- }),
3586
- (e.prototype.intercept = function (e) {
3587
- return Wt(this, e);
3588
- }),
3589
- (e.prototype.toJS = function () {
3590
- return new Set(this);
3591
- }),
3592
- (e.prototype.toString = function () {
3593
- return this.name + '[ ' + Array.from(this).join(', ') + ' ]';
3594
- }),
3595
- (e.prototype[((ir = se), Symbol.iterator)] = function () {
3596
- return this.values();
3597
- }),
3598
- e
3599
- );
3600
- })(),
3601
- lr = ee('ObservableSet', pr),
3602
- dr = (function () {
3603
- function e(e, t, r, n) {
3604
- void 0 === t && (t = new Map()),
3605
- (this.target = e),
3606
- (this.values = t),
3607
- (this.name = r),
3608
- (this.defaultEnhancer = n),
3609
- (this.keysAtom = new ue(r + '.keys'));
3610
- }
3611
- return (
3612
- (e.prototype.read = function (e) {
3613
- return this.values.get(e).get();
3614
- }),
3615
- (e.prototype.write = function (e, t) {
3616
- var r = this.target,
3617
- n = this.values.get(e);
3618
- if (n instanceof st) n.set(t);
3619
- else {
3620
- if (Ht(this)) {
3621
- if (
3622
- !(a = Xt(this, {
3623
- type: 'update',
3624
- object: this.proxy || r,
3625
- name: e,
3626
- newValue: t,
3627
- }))
3628
- )
3629
- return;
3630
- t = a.newValue;
3631
- }
3632
- if ((t = n.prepareNewValue(t)) !== ft.UNCHANGED) {
3633
- var o = $t(this),
3634
- i = Dt(),
3635
- a =
3636
- o || i
3637
- ? {
3638
- type: 'update',
3639
- object: this.proxy || r,
3640
- oldValue: n.value,
3641
- name: e,
3642
- newValue: t,
3643
- }
3644
- : null;
3645
- i &&
3646
- 'production' !== process.env.NODE_ENV &&
3647
- Vt(fe(fe({}, a), { name: this.name, key: e })),
3648
- n.setNewValue(t),
3649
- o && Zt(this, a),
3650
- i && 'production' !== process.env.NODE_ENV && kt();
3651
- }
3652
- }
3653
- }),
3654
- (e.prototype.has = function (e) {
3655
- var t = this.pendingKeys || (this.pendingKeys = new Map()),
3656
- r = t.get(e);
3657
- if (r) return r.get();
3658
- var n = !!this.values.get(e);
3659
- return (
3660
- (r = new at(n, je, this.name + '.' + oe(e) + '?', !1)),
3661
- t.set(e, r),
3662
- r.get()
3663
- );
3664
- }),
3665
- (e.prototype.addObservableProp = function (e, t, r) {
3666
- void 0 === r && (r = this.defaultEnhancer);
3667
- var n,
3668
- o,
3669
- i = this.target;
3670
- if (
3671
- ((n = i),
3672
- (o = e),
3673
- 'production' === process.env.NODE_ENV ||
3674
- Q(n, o) ||
3675
- J(
3676
- "Cannot make property '" +
3677
- o.toString() +
3678
- "' observable, it is not configurable and writable in the target object",
3679
- ),
3680
- Ht(this))
3681
- ) {
3682
- var a = Xt(this, {
3683
- object: this.proxy || i,
3684
- name: e,
3685
- type: 'add',
3686
- newValue: t,
3687
- });
3688
- if (!a) return;
3689
- t = a.newValue;
3690
- }
3691
- var s = new at(t, r, this.name + '.' + oe(e), !1);
3692
- this.values.set(e, s),
3693
- (t = s.value),
3694
- Object.defineProperty(
3695
- i,
3696
- e,
3697
- (function (e) {
3698
- return (
3699
- hr[e] ||
3700
- (hr[e] = {
3701
- configurable: !0,
3702
- enumerable: !0,
3703
- get: function () {
3704
- return this[se].read(e);
3705
- },
3706
- set: function (t) {
3707
- this[se].write(e, t);
3708
- },
3709
- })
3710
- );
3711
- })(e),
3712
- ),
3713
- this.notifyPropertyAddition(e, t);
3714
- }),
3715
- (e.prototype.addComputedProp = function (e, t, r) {
3716
- var n = this.target;
3717
- (r.name = r.name || this.name + '.' + oe(t)),
3718
- this.values.set(t, new st(r)),
3719
- (e === n || Q(e, t)) &&
3720
- Object.defineProperty(
3721
- e,
3722
- t,
3723
- (function (e) {
3724
- return (
3725
- vr[e] ||
3726
- (vr[e] = {
3727
- configurable: ft.computedConfigurable,
3728
- enumerable: !1,
3729
- get: function () {
3730
- return yr(this).read(e);
3731
- },
3732
- set: function (t) {
3733
- yr(this).write(e, t);
3734
- },
3735
- })
3736
- );
3737
- })(t),
3738
- );
3739
- }),
3740
- (e.prototype.remove = function (e) {
3741
- if (this.values.has(e)) {
3742
- var t = this.target;
3743
- if (Ht(this))
3744
- if (
3745
- !(s = Xt(this, {
3746
- object: this.proxy || t,
3747
- name: e,
3748
- type: 'remove',
3749
- }))
3750
- )
3751
- return;
3752
- try {
3753
- bt();
3754
- var r = $t(this),
3755
- n = Dt(),
3756
- o = this.values.get(e),
3757
- i = o && o.get();
3758
- if (
3759
- (o && o.set(void 0),
3760
- this.keysAtom.reportChanged(),
3761
- this.values.delete(e),
3762
- this.pendingKeys)
3763
- ) {
3764
- var a = this.pendingKeys.get(e);
3765
- a && a.set(!1);
3766
- }
3767
- delete this.target[e];
3768
- var s =
3769
- r || n
3770
- ? {
3771
- type: 'remove',
3772
- object: this.proxy || t,
3773
- oldValue: i,
3774
- name: e,
3775
- }
3776
- : null;
3777
- n &&
3778
- 'production' !== process.env.NODE_ENV &&
3779
- Vt(fe(fe({}, s), { name: this.name, key: e })),
3780
- r && Zt(this, s),
3781
- n && 'production' !== process.env.NODE_ENV && kt();
3782
- } finally {
3783
- mt();
3784
- }
3785
- }
3786
- }),
3787
- (e.prototype.illegalAccess = function (e, t) {
3788
- console.warn(
3789
- "Property '" +
3790
- t +
3791
- "' of '" +
3792
- e +
3793
- "' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner",
3794
- );
3795
- }),
3796
- (e.prototype.observe = function (e, t) {
3797
- return (
3798
- 'production' !== process.env.NODE_ENV &&
3799
- H(
3800
- !0 !== t,
3801
- "`observe` doesn't support the fire immediately property for observable objects.",
3802
- ),
3803
- Yt(this, e)
3804
- );
3805
- }),
3806
- (e.prototype.intercept = function (e) {
3807
- return Wt(this, e);
3808
- }),
3809
- (e.prototype.notifyPropertyAddition = function (e, t) {
3810
- var r = $t(this),
3811
- n = Dt(),
3812
- o =
3813
- r || n
3814
- ? {
3815
- type: 'add',
3816
- object: this.proxy || this.target,
3817
- name: e,
3818
- newValue: t,
3819
- }
3820
- : null;
3821
- if (
3822
- (n &&
3823
- 'production' !== process.env.NODE_ENV &&
3824
- Vt(fe(fe({}, o), { name: this.name, key: e })),
3825
- r && Zt(this, o),
3826
- n && 'production' !== process.env.NODE_ENV && kt(),
3827
- this.pendingKeys)
3828
- ) {
3829
- var i = this.pendingKeys.get(e);
3830
- i && i.set(!0);
3831
- }
3832
- this.keysAtom.reportChanged();
3833
- }),
3834
- (e.prototype.getKeys = function () {
3835
- var e, t;
3836
- this.keysAtom.reportObserved();
3837
- var r = [];
3838
- try {
3839
- for (var n = he(this.values), o = n.next(); !o.done; o = n.next()) {
3840
- var i = ve(o.value, 2),
3841
- a = i[0];
3842
- i[1] instanceof at && r.push(a);
3843
- }
3844
- } catch (t) {
3845
- e = { error: t };
3846
- } finally {
3847
- try {
3848
- o && !o.done && (t = n.return) && t.call(n);
3849
- } finally {
3850
- if (e) throw e.error;
3851
- }
3852
- }
3853
- return r;
3854
- }),
3855
- e
3856
- );
3857
- })();
3858
- function fr(e, t, r) {
3859
- if (
3860
- (void 0 === t && (t = ''),
3861
- void 0 === r && (r = _e),
3862
- Object.prototype.hasOwnProperty.call(e, se))
3863
- )
3864
- return e[se];
3865
- 'production' !== process.env.NODE_ENV &&
3866
- H(
3867
- Object.isExtensible(e),
3868
- 'Cannot make the designated object observable; it is not extensible',
3869
- ),
3870
- Y(e) || (t = (e.constructor.name || 'ObservableObject') + '@' + F()),
3871
- t || (t = 'ObservableObject@' + F());
3872
- var n = new dr(e, new Map(), oe(t), r);
3873
- return Z(e, se, n), n;
3874
- }
3875
- var hr = Object.create(null),
3876
- vr = Object.create(null);
3877
- function yr(e) {
3878
- var t = e[se];
3879
- return t || (Ee(e), e[se]);
3880
- }
3881
- var br = ee('ObservableObjectAdministration', dr);
3882
- function mr(e) {
3883
- return !!$(e) && (Ee(e), br(e[se]));
3884
- }
3885
- function gr(e, t) {
3886
- if ('object' == typeof e && null !== e) {
3887
- if (or(e))
3888
- return (
3889
- void 0 !== t &&
3890
- J(
3891
- 'production' !== process.env.NODE_ENV &&
3892
- 'It is not possible to get index atoms from arrays',
3893
- ),
3894
- e[se].atom
3895
- );
3896
- if (lr(e)) return e[se];
3897
- if (ur(e)) {
3898
- var r = e;
3899
- return void 0 === t
3900
- ? r._keysAtom
3901
- : ((n = r._data.get(t) || r._hasMap.get(t)) ||
3902
- J(
3903
- 'production' !== process.env.NODE_ENV &&
3904
- "the entry '" +
3905
- t +
3906
- "' does not exist in the observable map '" +
3907
- Er(e) +
3908
- "'",
3909
- ),
3910
- n);
3911
- }
3912
- var n;
3913
- if ((Ee(e), t && !e[se] && e[t], mr(e)))
3914
- return t
3915
- ? ((n = e[se].values.get(t)) ||
3916
- J(
3917
- 'production' !== process.env.NODE_ENV &&
3918
- "no observable property '" +
3919
- t +
3920
- "' found on the observable object '" +
3921
- Er(e) +
3922
- "'",
3923
- ),
3924
- n)
3925
- : J(
3926
- 'production' !== process.env.NODE_ENV &&
3927
- 'please specify a property',
3928
- );
3929
- if (ce(e) || ut(e) || St(e)) return e;
3930
- } else if ('function' == typeof e && St(e[se])) return e[se];
3931
- return J(
3932
- 'production' !== process.env.NODE_ENV && 'Cannot obtain atom from ' + e,
3933
- );
3934
- }
3935
- function Or(e, t) {
3936
- return (
3937
- e || J('Expecting some object'),
3938
- void 0 !== t
3939
- ? Or(gr(e, t))
3940
- : ce(e) || ut(e) || St(e) || ur(e) || lr(e)
3941
- ? e
3942
- : (Ee(e),
3943
- e[se]
3944
- ? e[se]
3945
- : void J(
3946
- 'production' !== process.env.NODE_ENV &&
3947
- 'Cannot obtain administration from ' + e,
3948
- ))
3949
- );
3950
- }
3951
- function Er(e, t) {
3952
- return (void 0 !== t ? gr(e, t) : mr(e) || ur(e) || lr(e) ? Or(e) : gr(e))
3953
- .name;
3954
- }
3955
- var Nr,
3956
- wr = Object.prototype.toString;
3957
- function _r(e, t, r) {
3958
- return void 0 === r && (r = -1), jr(e, t, r);
3959
- }
3960
- function jr(e, t, r, n, o) {
3961
- if (e === t) return 0 !== e || 1 / e == 1 / t;
3962
- if (null == e || null == t) return !1;
3963
- if (e != e) return t != t;
3964
- var i = typeof e;
3965
- if ('function' !== i && 'object' !== i && 'object' != typeof t) return !1;
3966
- var a = wr.call(e);
3967
- if (a !== wr.call(t)) return !1;
3968
- switch (a) {
3969
- case '[object RegExp]':
3970
- case '[object String]':
3971
- return '' + e == '' + t;
3972
- case '[object Number]':
3973
- return +e != +e ? +t != +t : 0 === +e ? 1 / +e == 1 / t : +e === +t;
3974
- case '[object Date]':
3975
- case '[object Boolean]':
3976
- return +e === +t;
3977
- case '[object Symbol]':
3978
- return (
3979
- 'undefined' != typeof Symbol &&
3980
- Symbol.valueOf.call(e) === Symbol.valueOf.call(t)
3981
- );
3982
- case '[object Map]':
3983
- case '[object Set]':
3984
- r >= 0 && r++;
3985
- }
3986
- (e = xr(e)), (t = xr(t));
3987
- var s = '[object Array]' === a;
3988
- if (!s) {
3989
- if ('object' != typeof e || 'object' != typeof t) return !1;
3990
- var u = e.constructor,
3991
- c = t.constructor;
3992
- if (
3993
- u !== c &&
3994
- !(
3995
- 'function' == typeof u &&
3996
- u instanceof u &&
3997
- 'function' == typeof c &&
3998
- c instanceof c
3999
- ) &&
4000
- 'constructor' in e &&
4001
- 'constructor' in t
4002
- )
4003
- return !1;
4004
- }
4005
- if (0 === r) return !1;
4006
- r < 0 && (r = -1), (o = o || []);
4007
- for (var p = (n = n || []).length; p--; ) if (n[p] === e) return o[p] === t;
4008
- if ((n.push(e), o.push(t), s)) {
4009
- if ((p = e.length) !== t.length) return !1;
4010
- for (; p--; ) if (!jr(e[p], t[p], r - 1, n, o)) return !1;
4011
- } else {
4012
- var l = Object.keys(e),
4013
- d = void 0;
4014
- if (((p = l.length), Object.keys(t).length !== p)) return !1;
4015
- for (; p--; )
4016
- if (!Sr(t, (d = l[p])) || !jr(e[d], t[d], r - 1, n, o)) return !1;
4017
- }
4018
- return n.pop(), o.pop(), !0;
4019
- }
4020
- function xr(e) {
4021
- return or(e)
4022
- ? e.slice()
4023
- : te(e) || ur(e) || re(e) || lr(e)
4024
- ? Array.from(e.entries())
4025
- : e;
4026
- }
4027
- function Sr(e, t) {
4028
- return Object.prototype.hasOwnProperty.call(e, t);
4029
- }
4030
- function Dr(e) {
4031
- return (e[Symbol.iterator] = Ar), e;
4032
- }
4033
- function Ar() {
4034
- return this;
4035
- }
4036
- if ('undefined' == typeof Proxy || 'undefined' == typeof Symbol)
4037
- throw new Error(
4038
- "[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore.",
4039
- );
4040
- try {
4041
- process.env.NODE_ENV;
4042
- } catch (e) {
4043
- var Vr = lt();
4044
- 'undefined' == typeof process && (Vr.process = {}), (Vr.process.env = {});
4045
- }
4046
- !(function () {
4047
- if (
4048
- 'testCodeMinification' !== function () {}.name &&
4049
- 'production' !== process.env.NODE_ENV &&
4050
- 'undefined' != typeof process &&
4051
- 'true' !== process.env.IGNORE_MOBX_MINIFY_WARNING
4052
- ) {
4053
- var e = ['process', 'env', 'NODE_ENV'].join('.');
4054
- console.warn(
4055
- "[mobx] you are running a minified build, but '" +
4056
- e +
4057
- "' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle",
4058
- );
4059
- }
4060
- })(),
4061
- 'object' == typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ &&
4062
- __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({
4063
- spy: function (e) {
4064
- return 'production' === process.env.NODE_ENV
4065
- ? (console.warn('[mobx.spy] Is a no-op in production builds'),
4066
- function () {})
4067
- : (ft.spyListeners.push(e),
4068
- W(function () {
4069
- ft.spyListeners = ft.spyListeners.filter(function (t) {
4070
- return t !== e;
4071
- });
4072
- }));
4073
- },
4074
- extras: { getDebugName: Er },
4075
- $mobx: se,
4076
- });
4077
- var Tr =
4078
- (((Nr = {
4079
- array: 'array',
4080
- boolean: 'boolean',
4081
- 'box-style': 'object',
4082
- 'padding-margin': 'object',
4083
- codearea: 'string',
4084
- color: 'string',
4085
- datasource: 'object',
4086
- date: 'string',
4087
- 'date-time': 'string',
4088
- 'dynamic-data': 'object',
4089
- event: 'object',
4090
- 'func-body': 'string',
4091
- htmlarea: 'string',
4092
- image: 'string',
4093
- input: 'string',
4094
- json: 'string',
4095
- number: 'number',
4096
- 'input-image': 'string',
4097
- object: 'object',
4098
- quantity: 'object',
4099
- radio: 'string',
4100
- select: 'array',
4101
- }).select = 'string'),
4102
- (Nr.textarea = 'string'),
4103
- (Nr['text-editor'] = 'string'),
4104
- (Nr.time = 'string'),
4105
- (Nr.url = 'string'),
4106
- Nr);
4107
- function kr(e) {
4108
- return Tr[e] || e;
4109
- }
4110
- function Cr(e, t) {
4111
- Tr[e]
4112
- ? console.warn('当前已经存在' + e + '(' + Tr[e] + '),暂时不支持覆盖。')
4113
- : (Tr[e] = t);
4114
- }
4115
- function Rr(e) {
4116
- var t = !0;
4117
- if (!e) return t;
4118
- var r = e.type;
4119
- return (
4120
- (('object' === r &&
4121
- e.properties &&
4122
- e.propertyOrder &&
4123
- e.propertyOrder.length > 0) ||
4124
- ('array' === r &&
4125
- e.items &&
4126
- e.items.properties &&
4127
- e.items.propertyOrder &&
4128
- e.items.propertyOrder.length > 0) ||
4129
- (e.type && 'array' !== e.type && 'object' !== e.type) ||
4130
- e.type) &&
4131
- (t = !1),
4132
- t
4133
- );
4134
- }
4135
- function Pr(e) {
4136
- var t = !1,
4137
- r = e.lastUpdateTime,
4138
- n = new Date('2024-10-05T00:01:00.691Z').getTime();
4139
- return r && new Date(r).getTime() >= n && (t = !0), t;
4140
- }
4141
- function Ur(e) {
4142
- var t = !1,
4143
- r = kr(e.type),
4144
- n = void 0 === e.isContainer || e.isContainer;
4145
- return 'object' === r && n && (t = !0), t;
4146
- }
4147
- function qr(e) {
4148
- var t = !0;
4149
- return (
4150
- 'object' === e.type && e.propertyOrder && e.properties
4151
- ? e.propertyOrder.map(function (r) {
4152
- var n = e.properties[r];
4153
- ('object' === e.type && n.propertyOrder && n.properties) || (t = !1);
4154
- })
4155
- : (t = !1),
4156
- t
4157
- );
4158
- }
4159
- function Lr(e, t) {
4160
- var r = e.split('-'),
4161
- n = t.split('-');
4162
- return r.pop(), n.pop(), r.join('-') === n.join('-');
4163
- }
4164
- function Br(e, t) {
4165
- for (
4166
- var r = e.split('-'),
4167
- n = t.split('-'),
4168
- o = 'before',
4169
- i = 0,
4170
- a = (r.length > n.length ? n : r).length;
4171
- i < a;
4172
- i += 1
4173
- ) {
4174
- Number(r[i]) > Number(n[i]) && (o = 'after');
4175
- }
4176
- return o;
4177
- }
4178
- function Ir(e) {
4179
- var t = e.split('-');
4180
- return t.pop(), t.join('-');
4181
- }
4182
- function Mr(e) {
4183
- var t = e.split('-'),
4184
- r = t.pop(),
4185
- n = Number(r) + 1;
4186
- return t.push('' + n), t.join('-');
4187
- }
4188
- function Gr(e) {
4189
- var t = e.split('-'),
4190
- r = t.pop();
4191
- return [t.join('-'), r];
4192
- }
4193
- function zr(e) {
4194
- var t = e.split('-'),
4195
- r = t.pop();
4196
- return t.push(Number(r) - 1), t.join('-');
4197
- }
4198
- function Kr(e) {
4199
- var t = e.split('-'),
4200
- r = t.pop();
4201
- return t.push(Number(r) + 1), t.join('-');
4202
- }
4203
- function Fr(e, t) {
4204
- var r = '',
4205
- n = !1;
4206
- if (!1 !== e.defaultActiveFirstOption && e.defaultActiveFirstOption)
4207
- return (
4208
- e.options && e.options[0] && ((r = e.options[0].value), (n = !0)),
4209
- (t || e.multiple) && (r = n ? [r] : []),
4210
- r
4211
- );
4212
- }
4213
- function Jr(e, t) {
4214
- var r,
4215
- n,
4216
- o = void 0,
4217
- i = t;
4218
- V(i) &&
4219
- V(e.default) &&
4220
- (typeof i != typeof e.default ||
4221
- ((r = i), (n = e.default), E(r) + '-' + g(r) != E(n) + '-' + g(n))) &&
4222
- (i = void 0);
4223
- var a = V(i) ? i : e.default;
4224
- switch (e.type) {
4225
- case 'select':
4226
- case 'radio':
4227
- o = null != a ? a : Fr(e);
4228
- break;
4229
- case 'checkboxes':
4230
- o = null != a ? a : Fr(e, !0);
4231
- break;
4232
- case 'color':
4233
- ('#fff' !== a && '#FFF' !== a) || (a = '#ffffff'),
4234
- (o = V(a) ? a : '#ffffff');
4235
- break;
4236
- case 'boolean':
4237
- o = !!V(a) && a;
4238
- break;
4239
- case 'number':
4240
- o = V(a) ? a : void 0;
4241
- break;
4242
- case 'json':
4243
- var s = '';
4244
- if (E(a) || g(a)) s = a;
4245
- else if (_(a) || '' === a) s = {};
4246
- else
4247
- try {
4248
- s = JSON.parse(a);
4249
- } catch (e) {
4250
- s = {};
4251
- }
4252
- o = s;
4253
- break;
4254
- default:
4255
- o =
4256
- 'input' === e.type && '0' === e.default
4257
- ? a || e.default
4258
- : V(a)
4259
- ? a
4260
- : void 0;
4261
- }
4262
- return o;
4263
- }
4264
- function Hr(e, t) {
4265
- var r = {},
4266
- n = e.type;
4267
- if (E(e) && 'object' === kr(e.type)) {
4268
- var o = e,
4269
- i = t;
4270
- V(i) &&
4271
- ((V(o.default) && typeof i != typeof e.default) || !E(i)) &&
4272
- (i = void 0);
4273
- var a = V(i) ? i : o.default;
4274
- if ('dynamic-data' === n)
4275
- (r = S(u)),
4276
- a && E(a) && '{}' !== JSON.stringify(a) && (r = Object.assign(r, a));
4277
- else if ('datasource' === n)
4278
- o.properties &&
4279
- o.properties.type &&
4280
- o.properties.type.default &&
4281
- 'local' === o.properties.type.default
4282
- ? ((r = { data: '{}', filter: '() => {}' }),
4283
- a && a.data && (r.data = a.data),
4284
- a && a.filter && (r.filter = a.filter),
4285
- 'http://xxx' === r.data && (r.data = '{}'))
4286
- : ((r = { data: 'http://xxx', filter: '() => {}' }),
4287
- a && a.data && (r.data = a.data),
4288
- a && a.filter && (r.filter = a.filter),
4289
- '{}' === r.data && (r.data = 'http://xxx'));
4290
- else if ('event' === n)
4291
- o.properties &&
4292
- o.properties.type &&
4293
- o.properties.type.default &&
4294
- 'emit' === o.properties.type.default
4295
- ? a && 'out' === a.type
4296
- ? (r = { trigger: (a && a.filter) || 'eventName', eventData: '{}' })
4297
- : ((r = { trigger: 'eventName', eventData: '{}' }),
4298
- a && a.trigger && (r.trigger = a.trigger),
4299
- a && a.eventData && (r.eventData = a.eventData))
4300
- : a && 'in' === a.type
4301
- ? (r = {
4302
- register: 'eventName',
4303
- actionFunc: (a && a.filter) || '() => {}',
4304
- })
4305
- : ((r = { register: 'eventName', actionFunc: '() => {}' }),
4306
- a && a.register && (r.register = a.register),
4307
- a && a.actionFunc && (r.actionFunc = a.actionFunc));
4308
- else if (!1 === e.isContainer && a && E(a) && '{}' !== JSON.stringify(a))
4309
- r = Object.assign(r, a);
4310
- else if (void 0 === i && o.default && E(o.default)) r = o.default;
4311
- else if (e.properties) {
4312
- (e.propertyOrder ? e.propertyOrder : Object.keys(e.properties)).map(
4313
- function (n) {
4314
- var o = e.properties[n],
4315
- i = t && t[n];
4316
- switch (kr(o.type)) {
4317
- case 'array':
4318
- r[n] = Wr(o, i);
4319
- break;
4320
- case 'object':
4321
- r[n] = Hr(o, i);
4322
- break;
4323
- default:
4324
- r[n] = Jr(o, i);
4325
- }
4326
- },
4327
- );
4328
- }
4329
- }
4330
- return r;
4331
- }
4332
- function Wr(e, t) {
4333
- var r = [];
4334
- if (e && 'array' === kr(e.type)) {
4335
- var n = t;
4336
- V(n) &&
4337
- ((V(e.default) && typeof n != typeof e.default) || !g(n)) &&
4338
- (n = void 0);
4339
- var o = V(n) ? n : e.default;
4340
- if ('array' === kr(e.type))
4341
- if (g(o))
4342
- o.map(function (t) {
4343
- r.push(Hr(e.items, t));
4344
- });
4345
- else if (o) r = o;
4346
- else {
4347
- var i = Hr(e.items, o);
4348
- r.push(i);
4349
- }
4350
- else r = V(o) ? o : [];
4351
- }
4352
- return r;
4353
- }
4354
- function Xr(e, t) {
4355
- return 'object' === kr(e.type)
4356
- ? Hr(e, t)
4357
- : 'array' === kr(e.type)
4358
- ? Wr(e, t)
4359
- : Jr(e, t);
4360
- }
4361
- var $r = c;
4362
- function Yr(e, t) {
4363
- var r = t || [];
4364
- if (e && '{}' !== JSON.stringify(e))
4365
- if (E(e))
4366
- if (
4367
- e.type &&
4368
- 'remote' === e.type &&
4369
- e.config &&
4370
- E(e.config) &&
4371
- e.config.dataName &&
4372
- V(e.localFilter) &&
4373
- V(e.data)
4374
- ) {
4375
- var n = e.config.body;
4376
- if (n && !E(n))
4377
- try {
4378
- n = JSON.parse(n);
4379
- } catch (e) {
4380
- n = {};
4381
- }
4382
- r.push({ id: e.config.id, dataName: e.config.dataName, body: n });
4383
- } else {
4384
- Object.keys(e).map(function (t) {
4385
- Yr(e[t], r);
4386
- });
4387
- }
4388
- else
4389
- g(e) &&
4390
- e.map(function (e) {
4391
- Yr(e, r);
4392
- });
4393
- return r;
4394
- }
4395
- function Zr(e, t) {
4396
- var r = t || 'data';
4397
- return (
4398
- e.split('-').map(function (e) {
4399
- r = /^\d+$/.test(e) ? r + '[' + e + ']' : r + '.' + e;
4400
- }),
4401
- r
4402
- );
4403
- }
4404
- function Qr(e, t) {
4405
- var r = [];
4406
- E(e)
4407
- ? Object.keys(e).map(function (n) {
4408
- var o = e[n],
4409
- i = t ? t + '-' + n : n;
4410
- E(o) || g(o)
4411
- ? r.push({ title: n, value: i, key: i, children: Qr(o, i) })
4412
- : r.push({ title: n, value: i, key: i });
4413
- })
4414
- : g(e) &&
4415
- e.map(function (e, n) {
4416
- var o = n.toString(),
4417
- i = t ? t + '-' + n : o;
4418
- E(e) || g(e)
4419
- ? r.push({ title: o, value: i, key: i, children: Qr(e, i) })
4420
- : r.push({ title: o, value: i, key: i });
4421
- });
4422
- return r;
4423
- }
4424
- function en(e, t) {
4425
- var r = '';
4426
- if ('object' === kr(e.type) && e.properties) {
4427
- (e.propertyOrder ? e.propertyOrder : Object.keys(e.properties)).map(
4428
- function (n) {
4429
- var o = e.properties[n],
4430
- i = t[n];
4431
- ('array' === kr(o.type) && 'object' === kr(o.type)) ||
4432
- (i &&
4433
- o.isConditionProp &&
4434
- (r.indexOf('-') > 0 ? (r += '-' + i) : (r = i)));
4435
- },
4436
- );
4437
- }
4438
- return r;
4439
- }
4440
- function tn(e) {
4441
- var t = e.split('-');
4442
- return t.pop(), t.join('-');
4443
- }
4444
- function rn(e) {
4445
- var t = e.split('-'),
4446
- r = t.pop();
4447
- return [t.join('-'), r];
4448
- }
4449
- var nn = [
4450
- 'key',
4451
- 'enum',
4452
- 'enumextra',
4453
- 'items',
4454
- 'input',
4455
- 'boolean',
4456
- 'number',
4457
- 'color',
4458
- 'url',
4459
- 'textarea',
4460
- 'text-editor',
4461
- 'radio',
4462
- 'select',
4463
- 'checkboxes',
4464
- 'date',
4465
- 'date-time',
4466
- 'time',
4467
- 'json',
4468
- 'codearea',
4469
- 'htmlarea',
4470
- 'quantity',
4471
- 'box-style',
4472
- 'dynamic-data',
4473
- 'datasource',
4474
- 'event',
4475
- 'array',
4476
- 'object',
4477
- ];
4478
- export {
4479
- l as DataSourceTypeList,
4480
- p as EventTypeDataList,
4481
- nn as KeyWordList,
4482
- c as TypeDataList,
4483
- Zr as dataRoute2dataPath,
4484
- Yr as dynamicDataAnalyzer,
4485
- k as evalExpression,
4486
- Br as getCurPosition,
4487
- Fr as getDefaultOptionVal,
4488
- kr as getExpectType,
4489
- C as getJsonDataByKeyRoute,
4490
- Mr as getNextIndexRoute,
4491
- Ir as getParentIndexRoute,
4492
- Gr as getParentIndexRoute_CurIndex,
4493
- tn as getParentKeyRoute,
4494
- rn as getParentKeyRoute_CurKey,
4495
- R as getSchemaByIndexRoute,
4496
- P as getSchemaByKeyRoute,
4497
- V as hasProperties,
4498
- U as indexRoute2keyRoute,
4499
- g as isArray,
4500
- v as isBoolean,
4501
- w as isColor,
4502
- Ur as isContainerSchema,
4503
- y as isDateStr,
4504
- b as isDateTimeStr,
4505
- Rr as isEmptySchema,
4506
- D as isEqual,
4507
- A as isEqualByIdT,
4508
- _ as isFunction,
4509
- Pr as isNewSchemaData,
4510
- h as isNumber,
4511
- E as isObject,
4512
- N as isQuantity,
4513
- Lr as isSameParent,
4514
- O as isSelect,
4515
- f as isString,
4516
- qr as isStructuredSchema,
4517
- m as isTimeStr,
4518
- d as isURL,
4519
- L as json2schema,
4520
- Qr as json2treeData,
4521
- q as keyRoute2indexRoute,
4522
- I as metaElemAnalyzer,
4523
- Kr as moveBackward,
4524
- zr as moveForward,
4525
- S as objClone,
4526
- G as oldSchemaToNewSchema,
4527
- M as oldSchemaToNewSchemaV1,
4528
- Cr as registerExpectType,
4529
- en as schema2conditionValue,
4530
- Xr as schema2json,
4531
- $r as schemaMetaList,
4532
- T as truncate,
4533
- j as urlParse,
4534
- x as urlStringify,
4535
- };
1
+ import{isEqual as e,cloneDeep as t,truncate as r}from"lodash";import a from"qs";var i={type:"event",title:"事件",isContainer:!1,properties:{type:{default:"emit",type:"select",options:[{label:"on",value:"on"},{label:"emit",value:"emit"}],title:"事件类型"},trigger:{type:"input",default:"eventName",title:"触发事件",description:"用于输入触发事件的名称",placeholder:"请输入触发事件的名称"},eventData:{title:"事件数据",type:"json",default:"{}",description:"传递给触发事件的数据对象"}},propertyOrder:["type","trigger","eventData"]},n={type:"datasource",title:"数据源",isContainer:!1,properties:{type:{default:"local",type:"select",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据源类型"},data:{title:"本地json数据",placeholder:"请输入静态json数据",type:"json",default:"{}",description:"用于设置本地的静态json数据",isRequired:!0},filter:{title:"过滤器",type:"codearea",default:"() => {}",description:"用于定义过滤当前数据的函数",isRequired:!0}},propertyOrder:["type","data","filter"]},o={type:"local",config:{url:"",method:"get",headers:{},data:{},dataType:"json"},data:"{}",localFilter:"return data;"},p={jsonschema:{type:"object",title:"jsonSchemaObject",properties:{func:{type:"object",title:"功能设置",properties:{a:{title:"单文本框",type:"input",default:"",description:"",placeholder:"",isRequired:!1}},propertyOrder:["a"]},style:{type:"object",title:"样式设置",properties:{b:{title:"单文本框",type:"input",default:"",description:"",placeholder:""}},propertyOrder:["b"]},data:{type:"data",title:"数据设置",properties:{c:{title:"单文本框",type:"input",default:"",description:"",placeholder:"",isRequired:!1}},propertyOrder:["c"]}},propertyOrder:["func","style","data"]},input:{title:"单文本框",type:"input",default:"",description:"",placeholder:""},boolean:{type:"boolean",title:"布尔值",default:!1,description:""},object:{type:"object",title:"对象Object",description:"",properties:{a:{type:"input",title:"单文本框",default:"",description:"",placeholder:""}},propertyOrder:["a"]},array:{type:"array",title:"数组Array",description:"",items:{type:"object",title:"数组项",description:"",properties:{name:{type:"input",title:"名字",default:"",description:"",placeholder:""}},propertyOrder:["name"]}},"empty-array":{type:"array",title:"数组Array",description:"",default:[],items:{type:"object",title:"数组项",description:"",properties:{}}},"empty-object":{type:"object",title:"对象Object",description:"",properties:{}},url:{type:"url",title:"链接地址url",default:"",description:"",placeholder:""},textarea:{type:"textarea",title:"多行文本框",default:"",description:"",placeholder:""},color:{type:"color",title:"颜色color",default:"#ffffff",description:""},image:{title:"图片",type:"image",default:"",description:"上传图片",imgWidth:200,imgHeight:200,imgRatioReadOnly:!0},number:{type:"number",title:"数量number",default:1,minimum:0,maximum:1e3,description:""},"input-image":{title:"图片地址",type:"input-image",description:"",accept:".jpeg,.jpg,.png",multiple:!0},json:{title:"json数据",type:"json",default:"{}",description:""},codearea:{type:"codearea",title:"函数类型",placeholder:"请输入函数方法",default:'function func() { console.log("hello, world!"); }',description:"用于定义函数方法"},htmlarea:{title:"富文本",type:"htmlarea",placeholder:"请输入html代码片段",default:"<p>hello,world!</p>",description:"用于放置html代码片段"},"text-editor":{type:"text-editor",title:"富文本",default:"",description:"",placeholder:""},date:{type:"date",title:"日期Date",default:"",description:"",placeholder:""},"date-time":{type:"date-time",title:"日期时间",default:"",description:"",placeholder:""},time:{type:"time",title:"时间Time",default:"",description:"",placeholder:""},quantity:{type:"quantity",title:"单位计量",isContainer:!1,properties:{unit:{type:"number",title:"单位数值",default:50,minimum:0,maximum:1e3,description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["unit","quantity"]},"box-style":{type:"box-style",title:"盒子模型",isContainer:!1,properties:{unit:{title:"单位数值",type:"input",default:"0",description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["unit","quantity"]},"padding-margin":{type:"padding-margin",title:"边距设置",isContainer:!1,properties:{margin:{title:"外边距",type:"input",default:"0",description:""},padding:{title:"内边距",type:"input",default:"0",description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["margin","padding","quantity"]},radio:{type:"radio",title:"单选",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],description:""},select:{type:"select",title:"下拉选择",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],description:""},cascader:{type:"cascader",title:"级联选择",options:[{value:"zhejiang",label:"Zhejiang",children:[{value:"hangzhou",label:"Hangzhou",children:[{value:"xihu",label:"West Lake"}]}]},{value:"jiangsu",label:"Jiangsu",children:[{value:"nanjing",label:"Nanjing",children:[{value:"zhonghuamen",label:"Zhong Hua Men"}]}]}],default:"a",description:"",showSearch:!0,allowClear:!0},checkboxes:{type:"checkboxes",title:"多选",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],default:["a"],description:""},"dynamic-data":{type:"dynamic-data",title:"动态数据源",isContainer:!1,properties:{type:{default:"local",type:"select",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据类型"},config:{title:"接口配置",type:"api",description:"用于存放接口的配置数据(url、请求参数等)",isRequired:!0,properties:{url:{type:"url",title:"请求地址",default:"",description:"API 的 URL",isRequired:!0},method:{type:"select",title:"请求方式",default:"get",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"PUT",value:"put"},{label:"PATCH",value:"patch"},{label:"DELETE",value:"delete"}],isRequired:!0},headers:{type:"json",title:"请求头",default:"{}",description:"请求头对象"},data:{type:"json",title:"请求参数",default:"{}",description:"请求体或查询参数"},dataType:{type:"select",title:"数据格式",default:"json",options:[{label:"JSON",value:"json"},{label:"FormData",value:"form-data"},{label:"Form",value:"form"}]},cache:{type:"number",title:"缓存时间",default:void 0,description:"缓存时间(ms),不设置则不缓存"}},propertyOrder:["url","method","headers","data","dataType","cache"]},data:{title:"数据内容",type:"json",default:"{}",description:"用于存放DynamicData的数据内容",isRequired:!0},localFilter:{title:"过滤器",type:"codearea",default:"return data;",description:"用于定义过滤本地数据",isRequired:!0}},propertyOrder:["type","config","data","localFilter"]},datasource:n,event:i,api:{type:"api",title:"API 配置",isContainer:!1,properties:{url:{type:"url",title:"请求地址",default:"",description:"API 的 URL",isRequired:!0},method:{type:"select",title:"请求方式",default:"get",options:[{label:"GET",value:"get"},{label:"POST",value:"post"},{label:"PUT",value:"put"},{label:"DELETE",value:"delete"}],isRequired:!0},headers:{type:"json",title:"请求头",default:"{}",description:"请求头对象"},data:{type:"json",title:"请求参数",default:"{}",description:"请求体或查询参数"}},propertyOrder:["url","method","headers","data"]}},l={on:{type:"event",title:"事件",isContainer:!1,properties:{type:{default:"on",type:"select",options:[{label:"on",value:"on"},{label:"emit",value:"emit"}],title:"事件类型"},register:{type:"input",default:"eventName",title:"注册事件",description:"用于输入注册事件的名称",placeholder:"请输入注册事件的名称"},actionFunc:{title:"执行函数",type:"codearea",default:"() => {}",description:""}},propertyOrder:["type","register","actionFunc"]},emit:i},s={local:n,remote:{type:"datasource",title:"数据源",isContainer:!1,properties:{type:{type:"select",default:"remote",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据源类型"},data:{type:"url",title:"远程json数据",placeholder:"请输入远程json数据源地址",default:"http://xxx",isRequired:!0,description:"用于设置获取元素数据的请求地址"},filter:{type:"codearea",title:"过滤器",default:"() => {}",description:"用于定义过滤当前数据的函数",isRequired:!0}},propertyOrder:["type","data","filter"]}};function u(e){return/^http[s]?:\/\/.*/.test(e)}function d(e){return"String"===Object.prototype.toString.call(e).slice(8,-1)}function c(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function y(e){return"Boolean"===Object.prototype.toString.call(e).slice(8,-1)}function f(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)}function m(e){return/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e)||/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)}function v(e){return/^\d{2}:\d{2}:\d{2}$/.test(e)||/^\d{2}:\d{2}$/.test(e)}function b(e){var t=!1;return"Array"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function g(e){if(!b(e))return!1;for(var t=0,r=e.length;t<r;t++)if(!d(e[t]))return!1;return!0}function h(e){var t=!1;return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function j(e){var t,r=!1;return((null===(t=p.quantity.properties.quantity)||void 0===t?void 0:t.enum)||[]).indexOf(e)>=0&&(r=!0),r}function O(e){return/^#[0-9a-f]{6}$/.test(e)||/^#[0-9a-f]{3}$/.test(e)}function x(e){var t=!1;return"Function"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function S(){var e={};return location.search&&(e=a.parse(location.search.substring(1))),e}function T(e){var t="";return e&&(t=a.stringify(e)),t}function q(e){return t(e)}function k(t,r){if(R(t)&&!R(r)||!R(t)&&R(r)||typeof t!=typeof r)return!1;if(h(t)&&(t.id!==r.id||t.lastUpdateTime!==r.lastUpdateTime))return!1;var a=(new Date).getTime();return!!(h(t)&&t.lastUpdateTime&&t.lastUpdateTime===r.lastUpdateTime&&a-t.lastUpdateTime<500)||e(t,r)}function D(t,r){if(R(t)&&!R(r)||!R(t)&&R(r)||typeof t!=typeof r)return!1;if(h(t)&&(t.id!==r.id||t.lastUpdateTime!==r.lastUpdateTime))return!1;var a=(new Date).getTime();return!!(h(t)&&t.lastUpdateTime&&t.lastUpdateTime===r.lastUpdateTime&&a-t.lastUpdateTime<500)||!(!h(t)||!(R(t.id)&&t.id===r.id||R(t.lastUpdateTime)&&t.lastUpdateTime===r.lastUpdateTime))||e(t,r)}function R(e){var t=!1;return null!=e&&(t=!0),t}function F(e,t){return r(e,t)}function N(e,t){var r=t||{};if(!e)return!1;var a=new Function("data","with(data) { return ("+e+");}"),i="";try{i=a(r)}catch(t){return console.warn("表达式运算出错: "+e+",报错信息:",t),i}return i}function C(e,t,r){var a=t;if(r&&(a=q(t)),e)for(var i=e.split("-"),n=0,o=i.length;n<o;n++){var p=i[n];p&&(a=a&&a[p])}return a}function U(e,t,r){var a=t;if(r&&(a=q(t)),e)for(var i="string"==typeof e?e.split("-"):[e.toString()],n=0,o=i.length;n<o;n++){var p=i[n];if("0"!==p||"array"!==a.type&&"radio"!==a.type&&"select"!==a.type&&"checkboxes"!==a.type||!a.options&&!a.items){if(p){var l="0";a.propertyOrder?l=a.propertyOrder[p]:a.properties&&(l=Object.keys(a.properties)[Number(p)]),a=a.properties[l]}}else a=a.options||a.items}return a}function w(e,t,r){var a=t;if(r&&(a=q(t)),e&&a)for(var i=e.split("-"),n=0,o=i.length;n<o;n++){var p=i[n];p&&a.properties&&(a=a.properties[p])}return a}function E(e,t){for(var r=t,a="",i="string"==typeof e?e.split("-"):[e.toString()],n=0,o=i.length;n<o;n++){var p=i[n];if("0"===p&&r.items)r=r.items,a=a?a+"-items":"items";else if("0"===p&&r.options)r=r.options,a=a?a+"-options":"options";else if(p){var l="0";r.propertyOrder?l=r.propertyOrder[p]:r.properties&&(l=Object.keys(r.properties)[Number(p)]),r=r.properties[l],a=a?a+"-"+l:l}}return a}function P(e,t){for(var r=t,a="",i=e.split("-"),n=0,o=i.length;n<o;n++){var p=i[n];if(p){var l=-1;r.propertyOrder?(l=r.propertyOrder.indexOf(p),r=r.properties[p]):r.properties?(l=Object.keys(r.properties).indexOf(p),r=r.properties[p]):r.items?(l=0,r=r.items):r.options&&(l=0,r=r.options),a=a?a+"-"+l:l.toString()}}return a}function A(e){var t;return t=e&&h(e)?function(e){var t={};if(h(e)){var r=Object.keys(e);e.data&&e.filter&&2===r.length?t=b(e.data)||h(e.data)?q(s.local):q(s.remote):e.trigger&&e.eventData&&2===r.length?t=q(l.emit):e.register&&e.actionFunc&&2===r.length?t=q(l.on):e.quantity&&j(e.quantity)&&2===r.length?t=q(p.quantity):(t=q(p["empty-object"]),Object.keys(e).map(function(r){var a=e[r];t.properties[r]=A(a)}))}return t}(e):e&&b(e)?function(e){var t;if(e&&b(e))if(g(e)){(t=q(p.select)).items.enum=e;var r=t.items.enumextra.length,a=e.length;if(a>r)for(var i=r,n=a;i<n;i++)t.items.enumextra.push("选项"+e(i))}else{t=q(p["empty-array"]);var o=A(e[0]);t.items.properties=o.properties}return t}(e):function(e){var t="";if(y(e))t=q(p.boolean);else if(c(e))t=q(p.number);else if(u(e))t=q(p.url);else if(f(e))t=q(p.date);else if(m(e))t=q(p["date-time"]);else if(v(e))t=q(p.time);else if(O(e))t=q(p.color);else try{t=c(JSON.parse(e))?q(p.input):q(p.json)}catch(r){t=e&&e.length>30?q(p.textarea):q(p.input)}return t}(e),t}var L={array:"array",boolean:"boolean","box-style":"object","padding-margin":"object",codearea:"string",color:"string",datasource:"object",date:"string","date-time":"string","dynamic-data":"object",event:"object","func-body":"string",htmlarea:"string",image:"string",input:"string",json:"string",number:"number","input-image":"string",object:"object",quantity:"object",radio:"string",select:"string",textarea:"string","text-editor":"string",time:"string",url:"string"};function I(e){return L[e]||e}function J(e,t){L[e]?console.warn("当前已经存在"+e+"("+L[e]+"),暂时不支持覆盖。"):L[e]=t}function $(e,t){var r=t||{};return h(e)&&"object"===I(e.type)&&e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map(function(t){var a=e.properties[t];r=B(a,r)}),r}function B(e,t){var r=!t,a=t||{};if(e&&"{}"!==JSON.stringify(e)){var i=e.type;"object"===i||"func"===i||"style"===i||"data"===i?(!r&&a.object?a.object+=1:r||(a.object=1),a=$(e,a)):"array"===i?(!r&&a.array?a.array+=1:r||(a.array=1),a=$(e=e.items,a)):!r&&a[i]?a[i]+=1:r||(a[i]=1)}return a}function K(e){var t=q(e);if(!t.title&&t.description&&(t.title=t.description),t.type||(t.type=t.format),"quantity"!==t.type&&"array"!==t.type&&"datasource"!==t.type&&"event"!==t.type&&"object"!==t.type||!R(t.default)||delete t.default,"radio"===t.type&&(t.type="string",t.enum&&t.enumextra&&(t.items={type:"string",enum:q(t.enum),enumextra:q(t.enumextra)},delete t.enum,delete t.enumextra)),"quantity"===t.type){var r=t.properties,a=q(p.quantity);if(r.quantity&&h(r.quantity)&&r.quantity.default){var i=r.quantity.default;a.properties.quantity.default="percent"===i?"%":i}t=a}if("datasource"===t.type){var n=t.properties,o=n.type&&n.type.default,u=n.data&&n.data.default,d=n.filter&&n.filter.default;"local"===o?(t=q(s.local)).properties.data.default=u?q(u):"{}":(t=q(s.remote)).properties.data.default=u?q(u):"http://xxx",t.properties.filter.default=d?q(d):"() => {}"}if("event"===t.type){var c=t.properties,y=c.type&&c.type.default;if("in"===y||"on"===y){var f=c.filter&&c.filter.default||"() => {}";t=q(l.on),c.actionFunc&&h(c.actionFunc)&&(t.properties.actionFunc.default=c.actionFunc.default||q(f))}else{var m=c.filter&&c.filter.default||"{}";t=q(l.emit),c.eventData&&h(c.eventData)&&(t.properties.eventData.default=c.eventData.default||q(m))}}return t.properties&&(t.propertyOrder||(t.propertyOrder=Object.keys(t.properties)),t.propertyOrder.map(function(e){t.properties[e]=z(t.properties[e])})),t.items&&(t.items=z(t.items)),t}function z(e){var t=q(e);return t.required||delete t.required,t.type&&t.type&&(t.type=t.type),"quantity"!==t.type&&"array"!==t.type&&"datasource"!==t.type&&"event"!==t.type&&"object"!==t.type||!R(t.default)||delete t.default,"radio"!==t.type&&"checkboxes"!==t.type&&"select"!==t.type||t.items&&t.items.enum&&t.items.enumextra&&(t.options=[],t.items.enum.forEach(function(e,r){t.options.push({label:t.items.enumextra[r]||e,value:e})}),delete t.items),t.properties&&(t.propertyOrder||(t.propertyOrder=Object.keys(t.properties)),t.propertyOrder.map(function(e){t.properties[e]=z(t.properties[e])})),"array"===t.type&&t.items&&(t.items=z(t.items)),t}function H(e){var t=!0;if(!e)return t;var r=e.type;return("object"===r&&e.properties&&e.propertyOrder&&e.propertyOrder.length>0||"array"===r&&e.items&&e.items.properties&&e.items.propertyOrder&&e.items.propertyOrder.length>0||e.type&&"array"!==e.type&&"object"!==e.type||e.type)&&(t=!1),t}function V(e){var t=!1,r=e.lastUpdateTime,a=new Date("2024-10-05T00:01:00.691Z").getTime();return r&&new Date(r).getTime()>=a&&(t=!0),t}function W(e){var t=!1,r=I(e.type),a=void 0===e.isContainer||e.isContainer;return"object"===r&&a&&(t=!0),t}function Z(e){var t=!0;return"object"===e.type&&e.propertyOrder&&e.properties?e.propertyOrder.map(function(r){var a=e.properties[r];"object"===e.type&&a.propertyOrder&&a.properties||(t=!1)}):t=!1,t}function G(e,t){var r=e.split("-"),a=t.split("-");return r.pop(),a.pop(),r.join("-")===a.join("-")}function M(e,t){for(var r=e.split("-"),a=t.split("-"),i="before",n=0,o=(r.length>a.length?a:r).length;n<o;n+=1)Number(r[n])>Number(a[n])&&(i="after");return i}function _(e){var t="string"==typeof e?e.split("-"):[e.toString()];return t.pop(),t.join("-")}function Q(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop(),a=Number(r)+1;return t.push(""+a),t.join("-")}function X(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop()||"";return[t.join("-"),r]}function Y(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop();return t.push(Number(r)-1),t.join("-")}function ee(e){var t="string"==typeof e?e.split("-"):[e.toString()],r=t.pop();return t.push(Number(r)+1),t.join("-")}function te(e,t){var r="",a=!1;if(!1!==e.defaultActiveFirstOption&&e.defaultActiveFirstOption)return e.options&&e.options[0]&&(r=e.options[0].value,a=!0),(t||e.multiple)&&(r=a?[r]:[]),r}function re(e,t){var r,a,i=void 0,n=t;R(n)&&R(e.default)&&(typeof n!=typeof e.default||(r=n,a=e.default,h(r)+"-"+b(r)!=h(a)+"-"+b(a)))&&(n=void 0);var o=R(n)?n:e.default;switch(e.type){case"select":case"radio":i=null!=o?o:te(e);break;case"checkboxes":i=null!=o?o:te(e,!0);break;case"color":"#fff"!==o&&"#FFF"!==o||(o="#ffffff"),i=R(o)?o:"#ffffff";break;case"boolean":i=!!R(o)&&o;break;case"number":i=R(o)?o:void 0;break;case"json":var p="";if(h(o)||b(o))p=o;else if(x(o)||""===o)p={};else try{p=JSON.parse(o)}catch(e){p={}}i=p;break;default:i="input"===e.type&&"0"===e.default?o||e.default:R(o)?o:void 0}return i}function ae(e,t){var r={},a=e.type;if(h(e)&&"object"===I(e.type)){var i=e,n=t;R(n)&&(R(i.default)&&typeof n!=typeof e.default||!h(n))&&(n=void 0);var p=R(n)?n:i.default;"dynamic-data"===a?(r=q(o),p&&h(p)&&"{}"!==JSON.stringify(p)&&(r=Object.assign(r,p))):"datasource"===a?i.properties&&i.properties.type&&i.properties.type.default&&"local"===i.properties.type.default?(r={data:"{}",filter:"() => {}"},p&&p.data&&(r.data=p.data),p&&p.filter&&(r.filter=p.filter),"http://xxx"===r.data&&(r.data="{}")):(r={data:"http://xxx",filter:"() => {}"},p&&p.data&&(r.data=p.data),p&&p.filter&&(r.filter=p.filter),"{}"===r.data&&(r.data="http://xxx")):"event"===a?i.properties&&i.properties.type&&i.properties.type.default&&"emit"===i.properties.type.default?p&&"out"===p.type?r={trigger:p&&p.filter||"eventName",eventData:"{}"}:(r={trigger:"eventName",eventData:"{}"},p&&p.trigger&&(r.trigger=p.trigger),p&&p.eventData&&(r.eventData=p.eventData)):p&&"in"===p.type?r={register:"eventName",actionFunc:p&&p.filter||"() => {}"}:(r={register:"eventName",actionFunc:"() => {}"},p&&p.register&&(r.register=p.register),p&&p.actionFunc&&(r.actionFunc=p.actionFunc)):!1===e.isContainer&&p&&h(p)&&"{}"!==JSON.stringify(p)?r=Object.assign(r,p):void 0===n&&i.default&&h(i.default)?r=i.default:e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map(function(a){var i=e.properties[a],n=t&&t[a];switch(I(i.type)){case"array":r[a]=ie(i,n);break;case"object":r[a]=ae(i,n);break;default:r[a]=re(i,n)}})}return r}function ie(e,t){var r=[];if(e&&"array"===I(e.type)){var a=t;R(a)&&(R(e.default)&&typeof a!=typeof e.default||!b(a))&&(a=void 0);var i=R(a)?a:e.default;if("array"===I(e.type))if(b(i))i.map(function(t){r.push(ae(e.items,t))});else if(i)r=i;else{var n=ae(e.items,i);r.push(n)}else r=R(i)?i:[]}return r}function ne(e,t){return"object"===I(e.type)?ae(e,t):"array"===I(e.type)?ie(e,t):re(e,t)}var oe=p;function pe(e,t){var r=t||"data";return e.split("-").map(function(e){r=/^\d+$/.test(e)?r+"["+e+"]":r+"."+e}),r}function le(e,t){var r=[];return h(e)?Object.keys(e).map(function(a){var i=e[a],n=t?t+"-"+a:a;h(i)||b(i)?r.push({title:a,value:n,key:n,children:le(i,n)}):r.push({title:a,value:n,key:n})}):b(e)&&e.map(function(e,a){var i=a.toString(),n=t?t+"-"+a:i;h(e)||b(e)?r.push({title:i,value:n,key:n,children:le(e,n)}):r.push({title:i,value:n,key:n})}),r}function se(e,t){var r="";return"object"===I(e.type)&&e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map(function(a){var i=e.properties[a],n=t[a];"array"===I(i.type)&&"object"===I(i.type)||n&&i.isConditionProp&&(r.indexOf("-")>0?r+="-"+n:r=n)}),r}function ue(e){var t=e.split("-");return t.pop(),t.join("-")}function de(e){var t=e.split("-"),r=t.pop()||"";return[t.join("-"),r]}var ce=["key","enum","enumextra","items","input","boolean","number","color","url","textarea","text-editor","radio","select","checkboxes","date","date-time","time","json","codearea","htmlarea","quantity","box-style","dynamic-data","datasource","event","array","object"];export{s as DataSourceTypeList,l as EventTypeDataList,ce as KeyWordList,p as TypeDataList,pe as dataRoute2dataPath,N as evalExpression,M as getCurPosition,te as getDefaultOptionVal,I as getExpectType,C as getJsonDataByKeyRoute,Q as getNextIndexRoute,_ as getParentIndexRoute,X as getParentIndexRoute_CurIndex,ue as getParentKeyRoute,de as getParentKeyRoute_CurKey,U as getSchemaByIndexRoute,w as getSchemaByKeyRoute,R as hasProperties,E as indexRoute2keyRoute,b as isArray,y as isBoolean,O as isColor,W as isContainerSchema,f as isDateStr,m as isDateTimeStr,H as isEmptySchema,k as isEqual,D as isEqualByIdT,x as isFunction,V as isNewSchemaData,c as isNumber,h as isObject,j as isQuantity,G as isSameParent,g as isSelect,d as isString,Z as isStructuredSchema,v as isTimeStr,u as isURL,A as json2schema,le as json2treeData,P as keyRoute2indexRoute,B as metaElemAnalyzer,ee as moveBackward,Y as moveForward,q as objClone,z as oldSchemaToNewSchema,K as oldSchemaToNewSchemaV1,J as registerExpectType,se as schema2conditionValue,ne as schema2json,oe as schemaMetaList,F as truncate,S as urlParse,T as urlStringify};