@nocobase/plugin-workflow 0.12.0-alpha.3 → 0.12.0-alpha.5

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 (34) hide show
  1. package/dist/client/components/DrawerDescription.d.ts +2 -0
  2. package/dist/client/components/ExecutionStatusSelect.d.ts +4 -0
  3. package/dist/client/components/StatusIcon.d.ts +2 -0
  4. package/dist/client/constants.d.ts +1 -0
  5. package/dist/client/index.js +2299 -324
  6. package/dist/client/nodes/create.d.ts +1 -0
  7. package/dist/client/nodes/query.d.ts +136 -2
  8. package/dist/client/schemas/collection.d.ts +112 -0
  9. package/dist/client/schemas/executions.d.ts +17 -2
  10. package/dist/client/style.d.ts +2 -0
  11. package/dist/client/triggers/collection.d.ts +2 -0
  12. package/dist/client/triggers/form.d.ts +50 -0
  13. package/dist/client/triggers/index.d.ts +1 -0
  14. package/dist/client/triggers/schedule/index.d.ts +2 -1
  15. package/dist/locale/zh-CN.d.ts +34 -0
  16. package/dist/locale/zh-CN.js +34 -0
  17. package/dist/node_modules/cron-parser/package.json +1 -1
  18. package/dist/node_modules/lru-cache/package.json +1 -1
  19. package/dist/server/Plugin.js +10 -2
  20. package/dist/server/Processor.js +6 -5
  21. package/dist/server/actions/executions.d.ts +2 -0
  22. package/dist/server/actions/executions.js +22 -0
  23. package/dist/server/actions/index.js +4 -1
  24. package/dist/server/actions/workflows.d.ts +1 -0
  25. package/dist/server/actions/workflows.js +19 -3
  26. package/dist/server/collections/workflows.js +5 -0
  27. package/dist/server/instructions/query.js +12 -1
  28. package/dist/server/migrations/20230809113132-workflow-options.d.ts +4 -0
  29. package/dist/server/migrations/20230809113132-workflow-options.js +34 -0
  30. package/dist/server/triggers/form.d.ts +11 -0
  31. package/dist/server/triggers/form.js +94 -0
  32. package/dist/server/triggers/index.js +2 -1
  33. package/package.json +2 -2
  34. package/dist/client/components/NodeDescription.d.ts +0 -2
@@ -1,7 +1,8 @@
1
- (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@nocobase/client"), require("@ant-design/icons"), require("antd"), require("react-i18next"), require("@formily/react"), require("@nocobase/utils/client"), require("@formily/core"), require("dayjs"), require("@formily/antd-v5"), require("@nocobase/evaluators/client"), require("lodash"), require("react-router-dom"), require("@emotion/css")) : typeof define === "function" && define.amd ? define(["exports", "react", "@nocobase/client", "@ant-design/icons", "antd", "react-i18next", "@formily/react", "@nocobase/utils/client", "@formily/core", "dayjs", "@formily/antd-v5", "@nocobase/evaluators/client", "lodash", "react-router-dom", "@emotion/css"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nocobase/plugin-workflow"] = {}, global.react, global["@nocobase/client"], global["@ant-design/icons"], global.antd, global["react-i18next"], global["@formily/react"], global["@nocobase/utils"], global["@formily/core"], global.dayjs, global["@formily/antd-v5"], global["@nocobase/evaluators"], global.lodash, global["react-router-dom"], global["@emotion/css"]));
3
- })(this, function(exports2, React, client, icons, antd, reactI18next, react, client$1, core, dayjs, antdV5, client$2, lodash, reactRouterDom, css) {
1
+ (function(global2, factory) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@nocobase/client"), require("@ant-design/icons"), require("antd"), require("react-i18next"), require("@formily/react"), require("@nocobase/utils/client"), require("@formily/core"), require("react-router-dom"), require("dayjs"), require("@formily/antd-v5"), require("@nocobase/evaluators/client"), require("lodash"), require("@emotion/css")) : typeof define === "function" && define.amd ? define(["exports", "react", "@nocobase/client", "@ant-design/icons", "antd", "react-i18next", "@formily/react", "@nocobase/utils/client", "@formily/core", "react-router-dom", "dayjs", "@formily/antd-v5", "@nocobase/evaluators/client", "lodash", "@emotion/css"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["@nocobase/plugin-workflow"] = {}, global2.react, global2["@nocobase/client"], global2["@ant-design/icons"], global2.antd, global2["react-i18next"], global2["@formily/react"], global2["@nocobase/utils"], global2["@formily/core"], global2["react-router-dom"], global2.dayjs, global2["@formily/antd-v5"], global2["@nocobase/evaluators"], global2.lodash, global2["@emotion/css"]));
3
+ })(this, function(exports2, React, client, icons, antd, reactI18next, react, client$1, core, reactRouterDom, dayjs, antdV5, client$2, lodash, css) {
4
4
  "use strict";
5
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
5
6
  function getDefaultExportFromCjs(x2) {
6
7
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
7
8
  }
@@ -47,7 +48,7 @@
47
48
  function useWorkflowTranslation() {
48
49
  return reactI18next.useTranslation(NAMESPACE);
49
50
  }
50
- const useStyles$1 = client.createStyles(({ css: css2, token }) => {
51
+ const useStyles$2 = client.createStyles(({ css: css2, token }) => {
51
52
  return {
52
53
  container: css2`
53
54
  margin-bottom: 1.5em;
@@ -60,6 +61,7 @@
60
61
 
61
62
  dl {
62
63
  display: flex;
64
+ align-items: baseline;
63
65
 
64
66
  dt {
65
67
  color: ${token.colorText};
@@ -76,94 +78,18 @@
76
78
  `
77
79
  };
78
80
  });
79
- function NodeDescription(props) {
80
- const { instruction } = props;
81
- const { styles } = useStyles$1();
81
+ function DrawerDescription(props) {
82
+ const { label, title, description } = props;
83
+ const { styles } = useStyles$2();
82
84
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: client.cx(styles.container, props.className), children: [
83
85
  /* @__PURE__ */ jsxRuntimeExports.jsxs("dl", { children: [
84
- /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { children: lang("Node type") }),
85
- /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { style: { background: "none" }, children: instruction.title }) })
86
+ /* @__PURE__ */ jsxRuntimeExports.jsx("dt", { children: label }),
87
+ /* @__PURE__ */ jsxRuntimeExports.jsx("dd", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { style: { background: "none" }, children: title }) })
86
88
  ] }),
87
- instruction.description ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: instruction.description }) : null
89
+ description ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: description }) : null
88
90
  ] });
89
91
  }
90
- const EXECUTION_STATUS = {
91
- QUEUEING: null,
92
- STARTED: 0,
93
- RESOLVED: 1,
94
- FAILED: -1,
95
- ERROR: -2,
96
- ABORTED: -3,
97
- CANCELED: -4,
98
- REJECTED: -5
99
- };
100
- const ExecutionStatusOptions = [
101
- { value: EXECUTION_STATUS.QUEUEING, label: `{{t("Queueing", { ns: "${NAMESPACE}" })}}`, color: "blue" },
102
- { value: EXECUTION_STATUS.STARTED, label: `{{t("On going", { ns: "${NAMESPACE}" })}}`, color: "gold" },
103
- { value: EXECUTION_STATUS.RESOLVED, label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`, color: "green" },
104
- { value: EXECUTION_STATUS.FAILED, label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`, color: "red" },
105
- { value: EXECUTION_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: "red" },
106
- { value: EXECUTION_STATUS.ABORTED, label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`, color: "red" },
107
- { value: EXECUTION_STATUS.CANCELED, label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`, color: "volcano" },
108
- { value: EXECUTION_STATUS.REJECTED, label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`, color: "volcano" }
109
- ];
110
- const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce(
111
- (map, option) => Object.assign(map, { [option.value]: option }),
112
- {}
113
- );
114
- const JOB_STATUS = {
115
- PENDING: 0,
116
- RESOLVED: 1,
117
- FAILED: -1,
118
- ERROR: -2,
119
- ABORTED: -3,
120
- CANCELED: -4,
121
- REJECTED: -5
122
- };
123
- const JobStatusOptions = [
124
- {
125
- value: JOB_STATUS.PENDING,
126
- label: `{{t("Pending", { ns: "${NAMESPACE}" })}}`,
127
- color: "gold",
128
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ClockCircleOutlined, {})
129
- },
130
- {
131
- value: JOB_STATUS.RESOLVED,
132
- label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
133
- color: "green",
134
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CheckOutlined, {})
135
- },
136
- {
137
- value: JOB_STATUS.FAILED,
138
- label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
139
- color: "red",
140
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ExclamationOutlined, {})
141
- },
142
- { value: JOB_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: "red", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CloseOutlined, {}) },
143
- {
144
- value: JOB_STATUS.ABORTED,
145
- label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
146
- color: "red",
147
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 90 })
148
- },
149
- {
150
- value: JOB_STATUS.CANCELED,
151
- label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
152
- color: "volcano",
153
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 45 })
154
- },
155
- {
156
- value: JOB_STATUS.REJECTED,
157
- label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
158
- color: "volcano",
159
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, {})
160
- }
161
- ];
162
- const JobStatusOptionsMap = JobStatusOptions.reduce(
163
- (map, option) => Object.assign(map, { [option.value]: option }),
164
- {}
165
- );
166
- const useStyles = client.createStyles(({ css: css2, token }) => {
92
+ const useStyles$1 = client.createStyles(({ css: css2, token }) => {
167
93
  return {
168
94
  workflowPageClass: css2`
169
95
  flex-grow: 1;
@@ -219,11 +145,15 @@
219
145
  `,
220
146
  workflowVersionDropdownClass: css2`
221
147
  .ant-dropdown-menu-item {
148
+ justify-content: flex-end;
222
149
  .ant-dropdown-menu-title-content {
150
+ display: flex;
151
+ align-items: baseline;
152
+ justify-content: flex-end;
223
153
  text-align: right;
224
154
 
225
155
  time {
226
- margin-left: 0.5rem;
156
+ width: 12em;
227
157
  color: ${token.colorText};
228
158
  font-size: 80%;
229
159
  }
@@ -245,6 +175,27 @@
245
175
  }
246
176
  }
247
177
  }
178
+ `,
179
+ executionsDropdownRowClass: css2`
180
+ .row {
181
+ display: flex;
182
+ align-items: baseline;
183
+
184
+ &.current {
185
+ font-weight: bold;
186
+ }
187
+
188
+ .id {
189
+ flex-grow: 1;
190
+ text-align: right;
191
+ }
192
+
193
+ time {
194
+ width: 12em;
195
+ color: ${token.colorText};
196
+ font-size: 80%;
197
+ }
198
+ }
248
199
  `,
249
200
  branchBlockClass: css2`
250
201
  display: flex;
@@ -377,7 +328,9 @@
377
328
  font-weight: bold;
378
329
 
379
330
  &:not(:focus) {
380
- transition: background-color 0.3s ease, border-color 0.3s ease;
331
+ transition:
332
+ background-color 0.3s ease,
333
+ border-color 0.3s ease;
381
334
  border-color: ${token.colorBorderBg};
382
335
  background-color: ${token.colorBgContainerDisabled};
383
336
 
@@ -415,20 +368,6 @@
415
368
  &[type='button'] {
416
369
  border: none;
417
370
  }
418
-
419
- &.inner {
420
- position: static;
421
- }
422
-
423
- .ant-tag {
424
- padding: 0;
425
- width: ${token.sizeLG}px;
426
- height: ${token.sizeLG}px;
427
- line-height: ${token.sizeLG}px;
428
- margin-right: 0;
429
- border-radius: 50%;
430
- text-align: center;
431
- }
432
371
  `,
433
372
  nodeHeaderClass: css2`
434
373
  position: relative;
@@ -456,6 +395,10 @@
456
395
  display: flex;
457
396
  flex-direction: column-reverse;
458
397
  align-items: center;
398
+ `,
399
+ nodeJobResultClass: css2`
400
+ padding: 1em;
401
+ background-color: ${token.colorBgContainer};
459
402
  `,
460
403
  addButtonClass: css2`
461
404
  flex-shrink: 0;
@@ -640,6 +583,121 @@
640
583
  dynamicComponent: "FilterDynamicComponent"
641
584
  }
642
585
  };
586
+ const sort = {
587
+ type: "array",
588
+ title: '{{t("Sort")}}',
589
+ "x-decorator": "FormItem",
590
+ "x-component": "ArrayItems",
591
+ items: {
592
+ type: "object",
593
+ properties: {
594
+ space: {
595
+ type: "void",
596
+ "x-component": "Space",
597
+ properties: {
598
+ sort: {
599
+ type: "void",
600
+ "x-decorator": "FormItem",
601
+ "x-component": "ArrayItems.SortHandle"
602
+ },
603
+ field: {
604
+ type: "string",
605
+ enum: "{{useSortableFields()}}",
606
+ required: true,
607
+ "x-decorator": "FormItem",
608
+ "x-component": "Select",
609
+ "x-component-props": {
610
+ style: {
611
+ width: 260
612
+ }
613
+ }
614
+ },
615
+ direction: {
616
+ type: "string",
617
+ "x-decorator": "FormItem",
618
+ "x-component": "Radio.Group",
619
+ "x-component-props": {
620
+ optionType: "button"
621
+ },
622
+ enum: [
623
+ {
624
+ label: '{{t("ASC")}}',
625
+ value: "asc"
626
+ },
627
+ {
628
+ label: '{{t("DESC")}}',
629
+ value: "desc"
630
+ }
631
+ ]
632
+ },
633
+ remove: {
634
+ type: "void",
635
+ "x-decorator": "FormItem",
636
+ "x-component": "ArrayItems.Remove"
637
+ }
638
+ }
639
+ }
640
+ }
641
+ },
642
+ properties: {
643
+ add: {
644
+ type: "void",
645
+ title: '{{t("Add sort field")}}',
646
+ "x-component": "ArrayItems.Addition"
647
+ }
648
+ }
649
+ };
650
+ const pagination = {
651
+ type: "void",
652
+ title: '{{t("Pagination")}}',
653
+ "x-decorator": "SchemaComponentContext.Provider",
654
+ "x-decorator-props": {
655
+ value: { designable: false }
656
+ },
657
+ "x-component": "Grid",
658
+ properties: {
659
+ row: {
660
+ type: "void",
661
+ "x-component": "Grid.Row",
662
+ properties: {
663
+ page: {
664
+ type: "void",
665
+ "x-component": "Grid.Col",
666
+ properties: {
667
+ page: {
668
+ type: "number",
669
+ title: '{{t("Page number")}}',
670
+ "x-decorator": "FormItem",
671
+ "x-component": "Variable.Input",
672
+ "x-component-props": {
673
+ scope: "{{useWorkflowVariableOptions()}}",
674
+ useTypedConstant: ["number", "null"]
675
+ },
676
+ default: 1
677
+ }
678
+ }
679
+ },
680
+ pageSize: {
681
+ type: "void",
682
+ "x-component": "Grid.Col",
683
+ properties: {
684
+ pageSize: {
685
+ type: "number",
686
+ title: '{{t("Page size")}}',
687
+ "x-decorator": "FormItem",
688
+ "x-component": "InputNumber",
689
+ "x-component-props": {
690
+ min: 1,
691
+ max: 100
692
+ },
693
+ default: 20
694
+ }
695
+ }
696
+ }
697
+ }
698
+ }
699
+ }
700
+ };
643
701
  const appends = {
644
702
  type: "array",
645
703
  title: `{{t("Preload associations", { ns: "${NAMESPACE}" })}}`,
@@ -647,6 +705,7 @@
647
705
  "x-decorator": "FormItem",
648
706
  "x-component": "AppendsTreeSelect",
649
707
  "x-component-props": {
708
+ multiple: true,
650
709
  useCollection() {
651
710
  const { values: values2 } = react.useForm();
652
711
  return values2 == null ? void 0 : values2.collection;
@@ -678,6 +737,7 @@
678
737
  const collection$1 = {
679
738
  title: `{{t("Collection event", { ns: "${NAMESPACE}" })}}`,
680
739
  type: "collection",
740
+ description: `{{t("Event will be triggered on collection data row created, updated or deleted.", { ns: "${NAMESPACE}" })}}`,
681
741
  fieldset: {
682
742
  collection: {
683
743
  ...collection$2,
@@ -770,7 +830,1377 @@
770
830
  dependencies: ["collection"],
771
831
  fulfill: {
772
832
  state: {
773
- visible: "{{!!$deps[0]}}"
833
+ visible: "{{!!$deps[0]}}"
834
+ }
835
+ }
836
+ }
837
+ ]
838
+ },
839
+ appends: {
840
+ ...appends,
841
+ "x-reactions": [
842
+ ...appends["x-reactions"],
843
+ {
844
+ dependencies: ["mode"],
845
+ fulfill: {
846
+ state: {
847
+ visible: `{{!($deps[0] & ${COLLECTION_TRIGGER_MODE.DELETED})}}`
848
+ }
849
+ }
850
+ }
851
+ ]
852
+ }
853
+ },
854
+ scope: {
855
+ useCollectionDataSource: client.useCollectionDataSource
856
+ },
857
+ components: {
858
+ FieldsSelect
859
+ },
860
+ useVariables(config, options) {
861
+ var _a;
862
+ const compile = client.useCompile();
863
+ const { getCollectionFields } = client.useCollectionManager();
864
+ const rootFields = [
865
+ {
866
+ collectionName: config.collection,
867
+ name: "data",
868
+ type: "hasOne",
869
+ target: config.collection,
870
+ uiSchema: {
871
+ title: lang("Trigger data")
872
+ }
873
+ }
874
+ ];
875
+ const result = getCollectionFieldOptions({
876
+ // depth,
877
+ ...options,
878
+ fields: rootFields,
879
+ appends: ["data", ...((_a = config.appends) == null ? void 0 : _a.map((item) => `data.${item}`)) || []],
880
+ compile,
881
+ getCollectionFields
882
+ });
883
+ return result;
884
+ },
885
+ useInitializers(config) {
886
+ if (!config.collection) {
887
+ return null;
888
+ }
889
+ return {
890
+ type: "item",
891
+ key: "triggerData",
892
+ title: `{{t("Trigger data", { ns: "${NAMESPACE}" })}}`,
893
+ component: CollectionBlockInitializer,
894
+ collection: config.collection,
895
+ dataSource: "{{$context.data}}"
896
+ };
897
+ },
898
+ initializers: {}
899
+ };
900
+ function arrayMap$2(array, iteratee) {
901
+ var index = -1, length = array == null ? 0 : array.length, result = Array(length);
902
+ while (++index < length) {
903
+ result[index] = iteratee(array[index], index, array);
904
+ }
905
+ return result;
906
+ }
907
+ var _arrayMap = arrayMap$2;
908
+ function listCacheClear$1() {
909
+ this.__data__ = [];
910
+ this.size = 0;
911
+ }
912
+ var _listCacheClear = listCacheClear$1;
913
+ function eq$2(value, other) {
914
+ return value === other || value !== value && other !== other;
915
+ }
916
+ var eq_1 = eq$2;
917
+ var eq$1 = eq_1;
918
+ function assocIndexOf$4(array, key) {
919
+ var length = array.length;
920
+ while (length--) {
921
+ if (eq$1(array[length][0], key)) {
922
+ return length;
923
+ }
924
+ }
925
+ return -1;
926
+ }
927
+ var _assocIndexOf = assocIndexOf$4;
928
+ var assocIndexOf$3 = _assocIndexOf;
929
+ var arrayProto = Array.prototype;
930
+ var splice = arrayProto.splice;
931
+ function listCacheDelete$1(key) {
932
+ var data = this.__data__, index = assocIndexOf$3(data, key);
933
+ if (index < 0) {
934
+ return false;
935
+ }
936
+ var lastIndex = data.length - 1;
937
+ if (index == lastIndex) {
938
+ data.pop();
939
+ } else {
940
+ splice.call(data, index, 1);
941
+ }
942
+ --this.size;
943
+ return true;
944
+ }
945
+ var _listCacheDelete = listCacheDelete$1;
946
+ var assocIndexOf$2 = _assocIndexOf;
947
+ function listCacheGet$1(key) {
948
+ var data = this.__data__, index = assocIndexOf$2(data, key);
949
+ return index < 0 ? void 0 : data[index][1];
950
+ }
951
+ var _listCacheGet = listCacheGet$1;
952
+ var assocIndexOf$1 = _assocIndexOf;
953
+ function listCacheHas$1(key) {
954
+ return assocIndexOf$1(this.__data__, key) > -1;
955
+ }
956
+ var _listCacheHas = listCacheHas$1;
957
+ var assocIndexOf = _assocIndexOf;
958
+ function listCacheSet$1(key, value) {
959
+ var data = this.__data__, index = assocIndexOf(data, key);
960
+ if (index < 0) {
961
+ ++this.size;
962
+ data.push([key, value]);
963
+ } else {
964
+ data[index][1] = value;
965
+ }
966
+ return this;
967
+ }
968
+ var _listCacheSet = listCacheSet$1;
969
+ var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
970
+ function ListCache$4(entries) {
971
+ var index = -1, length = entries == null ? 0 : entries.length;
972
+ this.clear();
973
+ while (++index < length) {
974
+ var entry = entries[index];
975
+ this.set(entry[0], entry[1]);
976
+ }
977
+ }
978
+ ListCache$4.prototype.clear = listCacheClear;
979
+ ListCache$4.prototype["delete"] = listCacheDelete;
980
+ ListCache$4.prototype.get = listCacheGet;
981
+ ListCache$4.prototype.has = listCacheHas;
982
+ ListCache$4.prototype.set = listCacheSet;
983
+ var _ListCache = ListCache$4;
984
+ var ListCache$3 = _ListCache;
985
+ function stackClear$1() {
986
+ this.__data__ = new ListCache$3();
987
+ this.size = 0;
988
+ }
989
+ var _stackClear = stackClear$1;
990
+ function stackDelete$1(key) {
991
+ var data = this.__data__, result = data["delete"](key);
992
+ this.size = data.size;
993
+ return result;
994
+ }
995
+ var _stackDelete = stackDelete$1;
996
+ function stackGet$1(key) {
997
+ return this.__data__.get(key);
998
+ }
999
+ var _stackGet = stackGet$1;
1000
+ function stackHas$1(key) {
1001
+ return this.__data__.has(key);
1002
+ }
1003
+ var _stackHas = stackHas$1;
1004
+ var freeGlobal$1 = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
1005
+ var _freeGlobal = freeGlobal$1;
1006
+ var freeGlobal = _freeGlobal;
1007
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
1008
+ var root$8 = freeGlobal || freeSelf || Function("return this")();
1009
+ var _root = root$8;
1010
+ var root$7 = _root;
1011
+ var Symbol$6 = root$7.Symbol;
1012
+ var _Symbol = Symbol$6;
1013
+ var Symbol$5 = _Symbol;
1014
+ var objectProto$d = Object.prototype;
1015
+ var hasOwnProperty$a = objectProto$d.hasOwnProperty;
1016
+ var nativeObjectToString$1 = objectProto$d.toString;
1017
+ var symToStringTag$1 = Symbol$5 ? Symbol$5.toStringTag : void 0;
1018
+ function getRawTag$1(value) {
1019
+ var isOwn = hasOwnProperty$a.call(value, symToStringTag$1), tag = value[symToStringTag$1];
1020
+ try {
1021
+ value[symToStringTag$1] = void 0;
1022
+ var unmasked = true;
1023
+ } catch (e) {
1024
+ }
1025
+ var result = nativeObjectToString$1.call(value);
1026
+ if (unmasked) {
1027
+ if (isOwn) {
1028
+ value[symToStringTag$1] = tag;
1029
+ } else {
1030
+ delete value[symToStringTag$1];
1031
+ }
1032
+ }
1033
+ return result;
1034
+ }
1035
+ var _getRawTag = getRawTag$1;
1036
+ var objectProto$c = Object.prototype;
1037
+ var nativeObjectToString = objectProto$c.toString;
1038
+ function objectToString$1(value) {
1039
+ return nativeObjectToString.call(value);
1040
+ }
1041
+ var _objectToString = objectToString$1;
1042
+ var Symbol$4 = _Symbol, getRawTag = _getRawTag, objectToString = _objectToString;
1043
+ var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
1044
+ var symToStringTag = Symbol$4 ? Symbol$4.toStringTag : void 0;
1045
+ function baseGetTag$6(value) {
1046
+ if (value == null) {
1047
+ return value === void 0 ? undefinedTag : nullTag;
1048
+ }
1049
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
1050
+ }
1051
+ var _baseGetTag = baseGetTag$6;
1052
+ function isObject$5(value) {
1053
+ var type = typeof value;
1054
+ return value != null && (type == "object" || type == "function");
1055
+ }
1056
+ var isObject_1 = isObject$5;
1057
+ var baseGetTag$5 = _baseGetTag, isObject$4 = isObject_1;
1058
+ var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
1059
+ function isFunction$2(value) {
1060
+ if (!isObject$4(value)) {
1061
+ return false;
1062
+ }
1063
+ var tag = baseGetTag$5(value);
1064
+ return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
1065
+ }
1066
+ var isFunction_1 = isFunction$2;
1067
+ var root$6 = _root;
1068
+ var coreJsData$1 = root$6["__core-js_shared__"];
1069
+ var _coreJsData = coreJsData$1;
1070
+ var coreJsData = _coreJsData;
1071
+ var maskSrcKey = function() {
1072
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
1073
+ return uid ? "Symbol(src)_1." + uid : "";
1074
+ }();
1075
+ function isMasked$1(func) {
1076
+ return !!maskSrcKey && maskSrcKey in func;
1077
+ }
1078
+ var _isMasked = isMasked$1;
1079
+ var funcProto$2 = Function.prototype;
1080
+ var funcToString$2 = funcProto$2.toString;
1081
+ function toSource$2(func) {
1082
+ if (func != null) {
1083
+ try {
1084
+ return funcToString$2.call(func);
1085
+ } catch (e) {
1086
+ }
1087
+ try {
1088
+ return func + "";
1089
+ } catch (e) {
1090
+ }
1091
+ }
1092
+ return "";
1093
+ }
1094
+ var _toSource = toSource$2;
1095
+ var isFunction$1 = isFunction_1, isMasked = _isMasked, isObject$3 = isObject_1, toSource$1 = _toSource;
1096
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1097
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
1098
+ var funcProto$1 = Function.prototype, objectProto$b = Object.prototype;
1099
+ var funcToString$1 = funcProto$1.toString;
1100
+ var hasOwnProperty$9 = objectProto$b.hasOwnProperty;
1101
+ var reIsNative = RegExp(
1102
+ "^" + funcToString$1.call(hasOwnProperty$9).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
1103
+ );
1104
+ function baseIsNative$1(value) {
1105
+ if (!isObject$3(value) || isMasked(value)) {
1106
+ return false;
1107
+ }
1108
+ var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
1109
+ return pattern.test(toSource$1(value));
1110
+ }
1111
+ var _baseIsNative = baseIsNative$1;
1112
+ function getValue$1(object, key) {
1113
+ return object == null ? void 0 : object[key];
1114
+ }
1115
+ var _getValue = getValue$1;
1116
+ var baseIsNative = _baseIsNative, getValue = _getValue;
1117
+ function getNative$7(object, key) {
1118
+ var value = getValue(object, key);
1119
+ return baseIsNative(value) ? value : void 0;
1120
+ }
1121
+ var _getNative = getNative$7;
1122
+ var getNative$6 = _getNative, root$5 = _root;
1123
+ var Map$4 = getNative$6(root$5, "Map");
1124
+ var _Map = Map$4;
1125
+ var getNative$5 = _getNative;
1126
+ var nativeCreate$4 = getNative$5(Object, "create");
1127
+ var _nativeCreate = nativeCreate$4;
1128
+ var nativeCreate$3 = _nativeCreate;
1129
+ function hashClear$1() {
1130
+ this.__data__ = nativeCreate$3 ? nativeCreate$3(null) : {};
1131
+ this.size = 0;
1132
+ }
1133
+ var _hashClear = hashClear$1;
1134
+ function hashDelete$1(key) {
1135
+ var result = this.has(key) && delete this.__data__[key];
1136
+ this.size -= result ? 1 : 0;
1137
+ return result;
1138
+ }
1139
+ var _hashDelete = hashDelete$1;
1140
+ var nativeCreate$2 = _nativeCreate;
1141
+ var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
1142
+ var objectProto$a = Object.prototype;
1143
+ var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
1144
+ function hashGet$1(key) {
1145
+ var data = this.__data__;
1146
+ if (nativeCreate$2) {
1147
+ var result = data[key];
1148
+ return result === HASH_UNDEFINED$1 ? void 0 : result;
1149
+ }
1150
+ return hasOwnProperty$8.call(data, key) ? data[key] : void 0;
1151
+ }
1152
+ var _hashGet = hashGet$1;
1153
+ var nativeCreate$1 = _nativeCreate;
1154
+ var objectProto$9 = Object.prototype;
1155
+ var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
1156
+ function hashHas$1(key) {
1157
+ var data = this.__data__;
1158
+ return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$7.call(data, key);
1159
+ }
1160
+ var _hashHas = hashHas$1;
1161
+ var nativeCreate = _nativeCreate;
1162
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
1163
+ function hashSet$1(key, value) {
1164
+ var data = this.__data__;
1165
+ this.size += this.has(key) ? 0 : 1;
1166
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
1167
+ return this;
1168
+ }
1169
+ var _hashSet = hashSet$1;
1170
+ var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
1171
+ function Hash$1(entries) {
1172
+ var index = -1, length = entries == null ? 0 : entries.length;
1173
+ this.clear();
1174
+ while (++index < length) {
1175
+ var entry = entries[index];
1176
+ this.set(entry[0], entry[1]);
1177
+ }
1178
+ }
1179
+ Hash$1.prototype.clear = hashClear;
1180
+ Hash$1.prototype["delete"] = hashDelete;
1181
+ Hash$1.prototype.get = hashGet;
1182
+ Hash$1.prototype.has = hashHas;
1183
+ Hash$1.prototype.set = hashSet;
1184
+ var _Hash = Hash$1;
1185
+ var Hash = _Hash, ListCache$2 = _ListCache, Map$3 = _Map;
1186
+ function mapCacheClear$1() {
1187
+ this.size = 0;
1188
+ this.__data__ = {
1189
+ "hash": new Hash(),
1190
+ "map": new (Map$3 || ListCache$2)(),
1191
+ "string": new Hash()
1192
+ };
1193
+ }
1194
+ var _mapCacheClear = mapCacheClear$1;
1195
+ function isKeyable$1(value) {
1196
+ var type = typeof value;
1197
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
1198
+ }
1199
+ var _isKeyable = isKeyable$1;
1200
+ var isKeyable = _isKeyable;
1201
+ function getMapData$4(map, key) {
1202
+ var data = map.__data__;
1203
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
1204
+ }
1205
+ var _getMapData = getMapData$4;
1206
+ var getMapData$3 = _getMapData;
1207
+ function mapCacheDelete$1(key) {
1208
+ var result = getMapData$3(this, key)["delete"](key);
1209
+ this.size -= result ? 1 : 0;
1210
+ return result;
1211
+ }
1212
+ var _mapCacheDelete = mapCacheDelete$1;
1213
+ var getMapData$2 = _getMapData;
1214
+ function mapCacheGet$1(key) {
1215
+ return getMapData$2(this, key).get(key);
1216
+ }
1217
+ var _mapCacheGet = mapCacheGet$1;
1218
+ var getMapData$1 = _getMapData;
1219
+ function mapCacheHas$1(key) {
1220
+ return getMapData$1(this, key).has(key);
1221
+ }
1222
+ var _mapCacheHas = mapCacheHas$1;
1223
+ var getMapData = _getMapData;
1224
+ function mapCacheSet$1(key, value) {
1225
+ var data = getMapData(this, key), size = data.size;
1226
+ data.set(key, value);
1227
+ this.size += data.size == size ? 0 : 1;
1228
+ return this;
1229
+ }
1230
+ var _mapCacheSet = mapCacheSet$1;
1231
+ var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
1232
+ function MapCache$2(entries) {
1233
+ var index = -1, length = entries == null ? 0 : entries.length;
1234
+ this.clear();
1235
+ while (++index < length) {
1236
+ var entry = entries[index];
1237
+ this.set(entry[0], entry[1]);
1238
+ }
1239
+ }
1240
+ MapCache$2.prototype.clear = mapCacheClear;
1241
+ MapCache$2.prototype["delete"] = mapCacheDelete;
1242
+ MapCache$2.prototype.get = mapCacheGet;
1243
+ MapCache$2.prototype.has = mapCacheHas;
1244
+ MapCache$2.prototype.set = mapCacheSet;
1245
+ var _MapCache = MapCache$2;
1246
+ var ListCache$1 = _ListCache, Map$2 = _Map, MapCache$1 = _MapCache;
1247
+ var LARGE_ARRAY_SIZE = 200;
1248
+ function stackSet$1(key, value) {
1249
+ var data = this.__data__;
1250
+ if (data instanceof ListCache$1) {
1251
+ var pairs = data.__data__;
1252
+ if (!Map$2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
1253
+ pairs.push([key, value]);
1254
+ this.size = ++data.size;
1255
+ return this;
1256
+ }
1257
+ data = this.__data__ = new MapCache$1(pairs);
1258
+ }
1259
+ data.set(key, value);
1260
+ this.size = data.size;
1261
+ return this;
1262
+ }
1263
+ var _stackSet = stackSet$1;
1264
+ var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
1265
+ function Stack$1(entries) {
1266
+ var data = this.__data__ = new ListCache(entries);
1267
+ this.size = data.size;
1268
+ }
1269
+ Stack$1.prototype.clear = stackClear;
1270
+ Stack$1.prototype["delete"] = stackDelete;
1271
+ Stack$1.prototype.get = stackGet;
1272
+ Stack$1.prototype.has = stackHas;
1273
+ Stack$1.prototype.set = stackSet;
1274
+ var _Stack = Stack$1;
1275
+ function arrayEach$1(array, iteratee) {
1276
+ var index = -1, length = array == null ? 0 : array.length;
1277
+ while (++index < length) {
1278
+ if (iteratee(array[index], index, array) === false) {
1279
+ break;
1280
+ }
1281
+ }
1282
+ return array;
1283
+ }
1284
+ var _arrayEach = arrayEach$1;
1285
+ var getNative$4 = _getNative;
1286
+ var defineProperty$2 = function() {
1287
+ try {
1288
+ var func = getNative$4(Object, "defineProperty");
1289
+ func({}, "", {});
1290
+ return func;
1291
+ } catch (e) {
1292
+ }
1293
+ }();
1294
+ var _defineProperty = defineProperty$2;
1295
+ var defineProperty$1 = _defineProperty;
1296
+ function baseAssignValue$2(object, key, value) {
1297
+ if (key == "__proto__" && defineProperty$1) {
1298
+ defineProperty$1(object, key, {
1299
+ "configurable": true,
1300
+ "enumerable": true,
1301
+ "value": value,
1302
+ "writable": true
1303
+ });
1304
+ } else {
1305
+ object[key] = value;
1306
+ }
1307
+ }
1308
+ var _baseAssignValue = baseAssignValue$2;
1309
+ var baseAssignValue$1 = _baseAssignValue, eq = eq_1;
1310
+ var objectProto$8 = Object.prototype;
1311
+ var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
1312
+ function assignValue$2(object, key, value) {
1313
+ var objValue = object[key];
1314
+ if (!(hasOwnProperty$6.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
1315
+ baseAssignValue$1(object, key, value);
1316
+ }
1317
+ }
1318
+ var _assignValue = assignValue$2;
1319
+ var assignValue$1 = _assignValue, baseAssignValue = _baseAssignValue;
1320
+ function copyObject$5(source, props, object, customizer) {
1321
+ var isNew = !object;
1322
+ object || (object = {});
1323
+ var index = -1, length = props.length;
1324
+ while (++index < length) {
1325
+ var key = props[index];
1326
+ var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
1327
+ if (newValue === void 0) {
1328
+ newValue = source[key];
1329
+ }
1330
+ if (isNew) {
1331
+ baseAssignValue(object, key, newValue);
1332
+ } else {
1333
+ assignValue$1(object, key, newValue);
1334
+ }
1335
+ }
1336
+ return object;
1337
+ }
1338
+ var _copyObject = copyObject$5;
1339
+ function baseTimes$1(n2, iteratee) {
1340
+ var index = -1, result = Array(n2);
1341
+ while (++index < n2) {
1342
+ result[index] = iteratee(index);
1343
+ }
1344
+ return result;
1345
+ }
1346
+ var _baseTimes = baseTimes$1;
1347
+ function isObjectLike$7(value) {
1348
+ return value != null && typeof value == "object";
1349
+ }
1350
+ var isObjectLike_1 = isObjectLike$7;
1351
+ var baseGetTag$4 = _baseGetTag, isObjectLike$6 = isObjectLike_1;
1352
+ var argsTag$2 = "[object Arguments]";
1353
+ function baseIsArguments$1(value) {
1354
+ return isObjectLike$6(value) && baseGetTag$4(value) == argsTag$2;
1355
+ }
1356
+ var _baseIsArguments = baseIsArguments$1;
1357
+ var baseIsArguments = _baseIsArguments, isObjectLike$5 = isObjectLike_1;
1358
+ var objectProto$7 = Object.prototype;
1359
+ var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
1360
+ var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
1361
+ var isArguments$2 = baseIsArguments(function() {
1362
+ return arguments;
1363
+ }()) ? baseIsArguments : function(value) {
1364
+ return isObjectLike$5(value) && hasOwnProperty$5.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
1365
+ };
1366
+ var isArguments_1 = isArguments$2;
1367
+ var isArray$7 = Array.isArray;
1368
+ var isArray_1 = isArray$7;
1369
+ var isBuffer$2 = { exports: {} };
1370
+ function stubFalse() {
1371
+ return false;
1372
+ }
1373
+ var stubFalse_1 = stubFalse;
1374
+ isBuffer$2.exports;
1375
+ (function(module2, exports3) {
1376
+ var root2 = _root, stubFalse2 = stubFalse_1;
1377
+ var freeExports = exports3 && !exports3.nodeType && exports3;
1378
+ var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
1379
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1380
+ var Buffer = moduleExports ? root2.Buffer : void 0;
1381
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
1382
+ var isBuffer2 = nativeIsBuffer || stubFalse2;
1383
+ module2.exports = isBuffer2;
1384
+ })(isBuffer$2, isBuffer$2.exports);
1385
+ var isBufferExports = isBuffer$2.exports;
1386
+ var MAX_SAFE_INTEGER$1 = 9007199254740991;
1387
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
1388
+ function isIndex$1(value, length) {
1389
+ var type = typeof value;
1390
+ length = length == null ? MAX_SAFE_INTEGER$1 : length;
1391
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
1392
+ }
1393
+ var _isIndex = isIndex$1;
1394
+ var MAX_SAFE_INTEGER = 9007199254740991;
1395
+ function isLength$2(value) {
1396
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
1397
+ }
1398
+ var isLength_1 = isLength$2;
1399
+ var baseGetTag$3 = _baseGetTag, isLength$1 = isLength_1, isObjectLike$4 = isObjectLike_1;
1400
+ var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", errorTag$1 = "[object Error]", funcTag$1 = "[object Function]", mapTag$4 = "[object Map]", numberTag$2 = "[object Number]", objectTag$3 = "[object Object]", regexpTag$2 = "[object RegExp]", setTag$4 = "[object Set]", stringTag$2 = "[object String]", weakMapTag$2 = "[object WeakMap]";
1401
+ var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$3 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
1402
+ var typedArrayTags = {};
1403
+ typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
1404
+ typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$2] = typedArrayTags[boolTag$2] = typedArrayTags[dataViewTag$3] = typedArrayTags[dateTag$2] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$4] = typedArrayTags[numberTag$2] = typedArrayTags[objectTag$3] = typedArrayTags[regexpTag$2] = typedArrayTags[setTag$4] = typedArrayTags[stringTag$2] = typedArrayTags[weakMapTag$2] = false;
1405
+ function baseIsTypedArray$1(value) {
1406
+ return isObjectLike$4(value) && isLength$1(value.length) && !!typedArrayTags[baseGetTag$3(value)];
1407
+ }
1408
+ var _baseIsTypedArray = baseIsTypedArray$1;
1409
+ function baseUnary$3(func) {
1410
+ return function(value) {
1411
+ return func(value);
1412
+ };
1413
+ }
1414
+ var _baseUnary = baseUnary$3;
1415
+ var _nodeUtil = { exports: {} };
1416
+ _nodeUtil.exports;
1417
+ (function(module2, exports3) {
1418
+ var freeGlobal2 = _freeGlobal;
1419
+ var freeExports = exports3 && !exports3.nodeType && exports3;
1420
+ var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
1421
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1422
+ var freeProcess = moduleExports && freeGlobal2.process;
1423
+ var nodeUtil2 = function() {
1424
+ try {
1425
+ var types = freeModule && freeModule.require && freeModule.require("util").types;
1426
+ if (types) {
1427
+ return types;
1428
+ }
1429
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
1430
+ } catch (e) {
1431
+ }
1432
+ }();
1433
+ module2.exports = nodeUtil2;
1434
+ })(_nodeUtil, _nodeUtil.exports);
1435
+ var _nodeUtilExports = _nodeUtil.exports;
1436
+ var baseIsTypedArray = _baseIsTypedArray, baseUnary$2 = _baseUnary, nodeUtil$2 = _nodeUtilExports;
1437
+ var nodeIsTypedArray = nodeUtil$2 && nodeUtil$2.isTypedArray;
1438
+ var isTypedArray$1 = nodeIsTypedArray ? baseUnary$2(nodeIsTypedArray) : baseIsTypedArray;
1439
+ var isTypedArray_1 = isTypedArray$1;
1440
+ var baseTimes = _baseTimes, isArguments$1 = isArguments_1, isArray$6 = isArray_1, isBuffer$1 = isBufferExports, isIndex = _isIndex, isTypedArray = isTypedArray_1;
1441
+ var objectProto$6 = Object.prototype;
1442
+ var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
1443
+ function arrayLikeKeys$2(value, inherited) {
1444
+ var isArr = isArray$6(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
1445
+ for (var key in value) {
1446
+ if ((inherited || hasOwnProperty$4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
1447
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
1448
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
1449
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
1450
+ isIndex(key, length)))) {
1451
+ result.push(key);
1452
+ }
1453
+ }
1454
+ return result;
1455
+ }
1456
+ var _arrayLikeKeys = arrayLikeKeys$2;
1457
+ var objectProto$5 = Object.prototype;
1458
+ function isPrototype$3(value) {
1459
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$5;
1460
+ return value === proto;
1461
+ }
1462
+ var _isPrototype = isPrototype$3;
1463
+ function overArg$2(func, transform) {
1464
+ return function(arg) {
1465
+ return func(transform(arg));
1466
+ };
1467
+ }
1468
+ var _overArg = overArg$2;
1469
+ var overArg$1 = _overArg;
1470
+ var nativeKeys$1 = overArg$1(Object.keys, Object);
1471
+ var _nativeKeys = nativeKeys$1;
1472
+ var isPrototype$2 = _isPrototype, nativeKeys = _nativeKeys;
1473
+ var objectProto$4 = Object.prototype;
1474
+ var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
1475
+ function baseKeys$1(object) {
1476
+ if (!isPrototype$2(object)) {
1477
+ return nativeKeys(object);
1478
+ }
1479
+ var result = [];
1480
+ for (var key in Object(object)) {
1481
+ if (hasOwnProperty$3.call(object, key) && key != "constructor") {
1482
+ result.push(key);
1483
+ }
1484
+ }
1485
+ return result;
1486
+ }
1487
+ var _baseKeys = baseKeys$1;
1488
+ var isFunction = isFunction_1, isLength = isLength_1;
1489
+ function isArrayLike$2(value) {
1490
+ return value != null && isLength(value.length) && !isFunction(value);
1491
+ }
1492
+ var isArrayLike_1 = isArrayLike$2;
1493
+ var arrayLikeKeys$1 = _arrayLikeKeys, baseKeys = _baseKeys, isArrayLike$1 = isArrayLike_1;
1494
+ function keys$3(object) {
1495
+ return isArrayLike$1(object) ? arrayLikeKeys$1(object) : baseKeys(object);
1496
+ }
1497
+ var keys_1 = keys$3;
1498
+ var copyObject$4 = _copyObject, keys$2 = keys_1;
1499
+ function baseAssign$1(object, source) {
1500
+ return object && copyObject$4(source, keys$2(source), object);
1501
+ }
1502
+ var _baseAssign = baseAssign$1;
1503
+ function nativeKeysIn$1(object) {
1504
+ var result = [];
1505
+ if (object != null) {
1506
+ for (var key in Object(object)) {
1507
+ result.push(key);
1508
+ }
1509
+ }
1510
+ return result;
1511
+ }
1512
+ var _nativeKeysIn = nativeKeysIn$1;
1513
+ var isObject$2 = isObject_1, isPrototype$1 = _isPrototype, nativeKeysIn = _nativeKeysIn;
1514
+ var objectProto$3 = Object.prototype;
1515
+ var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
1516
+ function baseKeysIn$1(object) {
1517
+ if (!isObject$2(object)) {
1518
+ return nativeKeysIn(object);
1519
+ }
1520
+ var isProto = isPrototype$1(object), result = [];
1521
+ for (var key in object) {
1522
+ if (!(key == "constructor" && (isProto || !hasOwnProperty$2.call(object, key)))) {
1523
+ result.push(key);
1524
+ }
1525
+ }
1526
+ return result;
1527
+ }
1528
+ var _baseKeysIn = baseKeysIn$1;
1529
+ var arrayLikeKeys = _arrayLikeKeys, baseKeysIn = _baseKeysIn, isArrayLike = isArrayLike_1;
1530
+ function keysIn$3(object) {
1531
+ return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
1532
+ }
1533
+ var keysIn_1 = keysIn$3;
1534
+ var copyObject$3 = _copyObject, keysIn$2 = keysIn_1;
1535
+ function baseAssignIn$1(object, source) {
1536
+ return object && copyObject$3(source, keysIn$2(source), object);
1537
+ }
1538
+ var _baseAssignIn = baseAssignIn$1;
1539
+ var _cloneBuffer = { exports: {} };
1540
+ _cloneBuffer.exports;
1541
+ (function(module2, exports3) {
1542
+ var root2 = _root;
1543
+ var freeExports = exports3 && !exports3.nodeType && exports3;
1544
+ var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
1545
+ var moduleExports = freeModule && freeModule.exports === freeExports;
1546
+ var Buffer = moduleExports ? root2.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
1547
+ function cloneBuffer2(buffer, isDeep) {
1548
+ if (isDeep) {
1549
+ return buffer.slice();
1550
+ }
1551
+ var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
1552
+ buffer.copy(result);
1553
+ return result;
1554
+ }
1555
+ module2.exports = cloneBuffer2;
1556
+ })(_cloneBuffer, _cloneBuffer.exports);
1557
+ var _cloneBufferExports = _cloneBuffer.exports;
1558
+ function copyArray$1(source, array) {
1559
+ var index = -1, length = source.length;
1560
+ array || (array = Array(length));
1561
+ while (++index < length) {
1562
+ array[index] = source[index];
1563
+ }
1564
+ return array;
1565
+ }
1566
+ var _copyArray = copyArray$1;
1567
+ function arrayFilter$1(array, predicate) {
1568
+ var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
1569
+ while (++index < length) {
1570
+ var value = array[index];
1571
+ if (predicate(value, index, array)) {
1572
+ result[resIndex++] = value;
1573
+ }
1574
+ }
1575
+ return result;
1576
+ }
1577
+ var _arrayFilter = arrayFilter$1;
1578
+ function stubArray$2() {
1579
+ return [];
1580
+ }
1581
+ var stubArray_1 = stubArray$2;
1582
+ var arrayFilter = _arrayFilter, stubArray$1 = stubArray_1;
1583
+ var objectProto$2 = Object.prototype;
1584
+ var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
1585
+ var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
1586
+ var getSymbols$3 = !nativeGetSymbols$1 ? stubArray$1 : function(object) {
1587
+ if (object == null) {
1588
+ return [];
1589
+ }
1590
+ object = Object(object);
1591
+ return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
1592
+ return propertyIsEnumerable.call(object, symbol);
1593
+ });
1594
+ };
1595
+ var _getSymbols = getSymbols$3;
1596
+ var copyObject$2 = _copyObject, getSymbols$2 = _getSymbols;
1597
+ function copySymbols$1(source, object) {
1598
+ return copyObject$2(source, getSymbols$2(source), object);
1599
+ }
1600
+ var _copySymbols = copySymbols$1;
1601
+ function arrayPush$3(array, values2) {
1602
+ var index = -1, length = values2.length, offset = array.length;
1603
+ while (++index < length) {
1604
+ array[offset + index] = values2[index];
1605
+ }
1606
+ return array;
1607
+ }
1608
+ var _arrayPush = arrayPush$3;
1609
+ var overArg = _overArg;
1610
+ var getPrototype$3 = overArg(Object.getPrototypeOf, Object);
1611
+ var _getPrototype = getPrototype$3;
1612
+ var arrayPush$2 = _arrayPush, getPrototype$2 = _getPrototype, getSymbols$1 = _getSymbols, stubArray = stubArray_1;
1613
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
1614
+ var getSymbolsIn$2 = !nativeGetSymbols ? stubArray : function(object) {
1615
+ var result = [];
1616
+ while (object) {
1617
+ arrayPush$2(result, getSymbols$1(object));
1618
+ object = getPrototype$2(object);
1619
+ }
1620
+ return result;
1621
+ };
1622
+ var _getSymbolsIn = getSymbolsIn$2;
1623
+ var copyObject$1 = _copyObject, getSymbolsIn$1 = _getSymbolsIn;
1624
+ function copySymbolsIn$1(source, object) {
1625
+ return copyObject$1(source, getSymbolsIn$1(source), object);
1626
+ }
1627
+ var _copySymbolsIn = copySymbolsIn$1;
1628
+ var arrayPush$1 = _arrayPush, isArray$5 = isArray_1;
1629
+ function baseGetAllKeys$2(object, keysFunc, symbolsFunc) {
1630
+ var result = keysFunc(object);
1631
+ return isArray$5(object) ? result : arrayPush$1(result, symbolsFunc(object));
1632
+ }
1633
+ var _baseGetAllKeys = baseGetAllKeys$2;
1634
+ var baseGetAllKeys$1 = _baseGetAllKeys, getSymbols = _getSymbols, keys$1 = keys_1;
1635
+ function getAllKeys$1(object) {
1636
+ return baseGetAllKeys$1(object, keys$1, getSymbols);
1637
+ }
1638
+ var _getAllKeys = getAllKeys$1;
1639
+ var baseGetAllKeys = _baseGetAllKeys, getSymbolsIn = _getSymbolsIn, keysIn$1 = keysIn_1;
1640
+ function getAllKeysIn$2(object) {
1641
+ return baseGetAllKeys(object, keysIn$1, getSymbolsIn);
1642
+ }
1643
+ var _getAllKeysIn = getAllKeysIn$2;
1644
+ var getNative$3 = _getNative, root$4 = _root;
1645
+ var DataView$1 = getNative$3(root$4, "DataView");
1646
+ var _DataView = DataView$1;
1647
+ var getNative$2 = _getNative, root$3 = _root;
1648
+ var Promise$2 = getNative$2(root$3, "Promise");
1649
+ var _Promise = Promise$2;
1650
+ var getNative$1 = _getNative, root$2 = _root;
1651
+ var Set$2 = getNative$1(root$2, "Set");
1652
+ var _Set = Set$2;
1653
+ var getNative = _getNative, root$1 = _root;
1654
+ var WeakMap$1 = getNative(root$1, "WeakMap");
1655
+ var _WeakMap = WeakMap$1;
1656
+ var DataView = _DataView, Map$1 = _Map, Promise$1 = _Promise, Set$1 = _Set, WeakMap = _WeakMap, baseGetTag$2 = _baseGetTag, toSource = _toSource;
1657
+ var mapTag$3 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$3 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
1658
+ var dataViewTag$2 = "[object DataView]";
1659
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap);
1660
+ var getTag$3 = baseGetTag$2;
1661
+ if (DataView && getTag$3(new DataView(new ArrayBuffer(1))) != dataViewTag$2 || Map$1 && getTag$3(new Map$1()) != mapTag$3 || Promise$1 && getTag$3(Promise$1.resolve()) != promiseTag || Set$1 && getTag$3(new Set$1()) != setTag$3 || WeakMap && getTag$3(new WeakMap()) != weakMapTag$1) {
1662
+ getTag$3 = function(value) {
1663
+ var result = baseGetTag$2(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
1664
+ if (ctorString) {
1665
+ switch (ctorString) {
1666
+ case dataViewCtorString:
1667
+ return dataViewTag$2;
1668
+ case mapCtorString:
1669
+ return mapTag$3;
1670
+ case promiseCtorString:
1671
+ return promiseTag;
1672
+ case setCtorString:
1673
+ return setTag$3;
1674
+ case weakMapCtorString:
1675
+ return weakMapTag$1;
1676
+ }
1677
+ }
1678
+ return result;
1679
+ };
1680
+ }
1681
+ var _getTag = getTag$3;
1682
+ var objectProto$1 = Object.prototype;
1683
+ var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
1684
+ function initCloneArray$1(array) {
1685
+ var length = array.length, result = new array.constructor(length);
1686
+ if (length && typeof array[0] == "string" && hasOwnProperty$1.call(array, "index")) {
1687
+ result.index = array.index;
1688
+ result.input = array.input;
1689
+ }
1690
+ return result;
1691
+ }
1692
+ var _initCloneArray = initCloneArray$1;
1693
+ var root = _root;
1694
+ var Uint8Array$1 = root.Uint8Array;
1695
+ var _Uint8Array = Uint8Array$1;
1696
+ var Uint8Array = _Uint8Array;
1697
+ function cloneArrayBuffer$3(arrayBuffer) {
1698
+ var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
1699
+ new Uint8Array(result).set(new Uint8Array(arrayBuffer));
1700
+ return result;
1701
+ }
1702
+ var _cloneArrayBuffer = cloneArrayBuffer$3;
1703
+ var cloneArrayBuffer$2 = _cloneArrayBuffer;
1704
+ function cloneDataView$1(dataView, isDeep) {
1705
+ var buffer = isDeep ? cloneArrayBuffer$2(dataView.buffer) : dataView.buffer;
1706
+ return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
1707
+ }
1708
+ var _cloneDataView = cloneDataView$1;
1709
+ var reFlags = /\w*$/;
1710
+ function cloneRegExp$1(regexp) {
1711
+ var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
1712
+ result.lastIndex = regexp.lastIndex;
1713
+ return result;
1714
+ }
1715
+ var _cloneRegExp = cloneRegExp$1;
1716
+ var Symbol$3 = _Symbol;
1717
+ var symbolProto$1 = Symbol$3 ? Symbol$3.prototype : void 0, symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : void 0;
1718
+ function cloneSymbol$1(symbol) {
1719
+ return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
1720
+ }
1721
+ var _cloneSymbol = cloneSymbol$1;
1722
+ var cloneArrayBuffer$1 = _cloneArrayBuffer;
1723
+ function cloneTypedArray$1(typedArray, isDeep) {
1724
+ var buffer = isDeep ? cloneArrayBuffer$1(typedArray.buffer) : typedArray.buffer;
1725
+ return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
1726
+ }
1727
+ var _cloneTypedArray = cloneTypedArray$1;
1728
+ var cloneArrayBuffer = _cloneArrayBuffer, cloneDataView = _cloneDataView, cloneRegExp = _cloneRegExp, cloneSymbol = _cloneSymbol, cloneTypedArray = _cloneTypedArray;
1729
+ var boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", symbolTag$2 = "[object Symbol]";
1730
+ var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
1731
+ function initCloneByTag$1(object, tag, isDeep) {
1732
+ var Ctor = object.constructor;
1733
+ switch (tag) {
1734
+ case arrayBufferTag$1:
1735
+ return cloneArrayBuffer(object);
1736
+ case boolTag$1:
1737
+ case dateTag$1:
1738
+ return new Ctor(+object);
1739
+ case dataViewTag$1:
1740
+ return cloneDataView(object, isDeep);
1741
+ case float32Tag$1:
1742
+ case float64Tag$1:
1743
+ case int8Tag$1:
1744
+ case int16Tag$1:
1745
+ case int32Tag$1:
1746
+ case uint8Tag$1:
1747
+ case uint8ClampedTag$1:
1748
+ case uint16Tag$1:
1749
+ case uint32Tag$1:
1750
+ return cloneTypedArray(object, isDeep);
1751
+ case mapTag$2:
1752
+ return new Ctor();
1753
+ case numberTag$1:
1754
+ case stringTag$1:
1755
+ return new Ctor(object);
1756
+ case regexpTag$1:
1757
+ return cloneRegExp(object);
1758
+ case setTag$2:
1759
+ return new Ctor();
1760
+ case symbolTag$2:
1761
+ return cloneSymbol(object);
1762
+ }
1763
+ }
1764
+ var _initCloneByTag = initCloneByTag$1;
1765
+ var isObject$1 = isObject_1;
1766
+ var objectCreate = Object.create;
1767
+ var baseCreate$1 = function() {
1768
+ function object() {
1769
+ }
1770
+ return function(proto) {
1771
+ if (!isObject$1(proto)) {
1772
+ return {};
1773
+ }
1774
+ if (objectCreate) {
1775
+ return objectCreate(proto);
1776
+ }
1777
+ object.prototype = proto;
1778
+ var result = new object();
1779
+ object.prototype = void 0;
1780
+ return result;
1781
+ };
1782
+ }();
1783
+ var _baseCreate = baseCreate$1;
1784
+ var baseCreate = _baseCreate, getPrototype$1 = _getPrototype, isPrototype = _isPrototype;
1785
+ function initCloneObject$1(object) {
1786
+ return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype$1(object)) : {};
1787
+ }
1788
+ var _initCloneObject = initCloneObject$1;
1789
+ var getTag$2 = _getTag, isObjectLike$3 = isObjectLike_1;
1790
+ var mapTag$1 = "[object Map]";
1791
+ function baseIsMap$1(value) {
1792
+ return isObjectLike$3(value) && getTag$2(value) == mapTag$1;
1793
+ }
1794
+ var _baseIsMap = baseIsMap$1;
1795
+ var baseIsMap = _baseIsMap, baseUnary$1 = _baseUnary, nodeUtil$1 = _nodeUtilExports;
1796
+ var nodeIsMap = nodeUtil$1 && nodeUtil$1.isMap;
1797
+ var isMap$1 = nodeIsMap ? baseUnary$1(nodeIsMap) : baseIsMap;
1798
+ var isMap_1 = isMap$1;
1799
+ var getTag$1 = _getTag, isObjectLike$2 = isObjectLike_1;
1800
+ var setTag$1 = "[object Set]";
1801
+ function baseIsSet$1(value) {
1802
+ return isObjectLike$2(value) && getTag$1(value) == setTag$1;
1803
+ }
1804
+ var _baseIsSet = baseIsSet$1;
1805
+ var baseIsSet = _baseIsSet, baseUnary = _baseUnary, nodeUtil = _nodeUtilExports;
1806
+ var nodeIsSet = nodeUtil && nodeUtil.isSet;
1807
+ var isSet$1 = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
1808
+ var isSet_1 = isSet$1;
1809
+ var Stack = _Stack, arrayEach = _arrayEach, assignValue = _assignValue, baseAssign = _baseAssign, baseAssignIn = _baseAssignIn, cloneBuffer = _cloneBufferExports, copyArray = _copyArray, copySymbols = _copySymbols, copySymbolsIn = _copySymbolsIn, getAllKeys = _getAllKeys, getAllKeysIn$1 = _getAllKeysIn, getTag = _getTag, initCloneArray = _initCloneArray, initCloneByTag = _initCloneByTag, initCloneObject = _initCloneObject, isArray$4 = isArray_1, isBuffer = isBufferExports, isMap = isMap_1, isObject = isObject_1, isSet = isSet_1, keys = keys_1, keysIn = keysIn_1;
1810
+ var CLONE_DEEP_FLAG$1 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$1 = 4;
1811
+ var argsTag = "[object Arguments]", arrayTag = "[object Array]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", objectTag$1 = "[object Object]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
1812
+ var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
1813
+ var cloneableTags = {};
1814
+ cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag$1] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
1815
+ cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
1816
+ function baseClone$1(value, bitmask, customizer, key, object, stack) {
1817
+ var result, isDeep = bitmask & CLONE_DEEP_FLAG$1, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
1818
+ if (customizer) {
1819
+ result = object ? customizer(value, key, object, stack) : customizer(value);
1820
+ }
1821
+ if (result !== void 0) {
1822
+ return result;
1823
+ }
1824
+ if (!isObject(value)) {
1825
+ return value;
1826
+ }
1827
+ var isArr = isArray$4(value);
1828
+ if (isArr) {
1829
+ result = initCloneArray(value);
1830
+ if (!isDeep) {
1831
+ return copyArray(value, result);
1832
+ }
1833
+ } else {
1834
+ var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
1835
+ if (isBuffer(value)) {
1836
+ return cloneBuffer(value, isDeep);
1837
+ }
1838
+ if (tag == objectTag$1 || tag == argsTag || isFunc && !object) {
1839
+ result = isFlat || isFunc ? {} : initCloneObject(value);
1840
+ if (!isDeep) {
1841
+ return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
1842
+ }
1843
+ } else {
1844
+ if (!cloneableTags[tag]) {
1845
+ return object ? value : {};
1846
+ }
1847
+ result = initCloneByTag(value, tag, isDeep);
1848
+ }
1849
+ }
1850
+ stack || (stack = new Stack());
1851
+ var stacked = stack.get(value);
1852
+ if (stacked) {
1853
+ return stacked;
1854
+ }
1855
+ stack.set(value, result);
1856
+ if (isSet(value)) {
1857
+ value.forEach(function(subValue) {
1858
+ result.add(baseClone$1(subValue, bitmask, customizer, subValue, value, stack));
1859
+ });
1860
+ } else if (isMap(value)) {
1861
+ value.forEach(function(subValue, key2) {
1862
+ result.set(key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
1863
+ });
1864
+ }
1865
+ var keysFunc = isFull ? isFlat ? getAllKeysIn$1 : getAllKeys : isFlat ? keysIn : keys;
1866
+ var props = isArr ? void 0 : keysFunc(value);
1867
+ arrayEach(props || value, function(subValue, key2) {
1868
+ if (props) {
1869
+ key2 = subValue;
1870
+ subValue = value[key2];
1871
+ }
1872
+ assignValue(result, key2, baseClone$1(subValue, bitmask, customizer, key2, value, stack));
1873
+ });
1874
+ return result;
1875
+ }
1876
+ var _baseClone = baseClone$1;
1877
+ var baseGetTag$1 = _baseGetTag, isObjectLike$1 = isObjectLike_1;
1878
+ var symbolTag = "[object Symbol]";
1879
+ function isSymbol$3(value) {
1880
+ return typeof value == "symbol" || isObjectLike$1(value) && baseGetTag$1(value) == symbolTag;
1881
+ }
1882
+ var isSymbol_1 = isSymbol$3;
1883
+ var isArray$3 = isArray_1, isSymbol$2 = isSymbol_1;
1884
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
1885
+ function isKey$1(value, object) {
1886
+ if (isArray$3(value)) {
1887
+ return false;
1888
+ }
1889
+ var type = typeof value;
1890
+ if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol$2(value)) {
1891
+ return true;
1892
+ }
1893
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
1894
+ }
1895
+ var _isKey = isKey$1;
1896
+ var MapCache = _MapCache;
1897
+ var FUNC_ERROR_TEXT = "Expected a function";
1898
+ function memoize$1(func, resolver) {
1899
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") {
1900
+ throw new TypeError(FUNC_ERROR_TEXT);
1901
+ }
1902
+ var memoized = function() {
1903
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
1904
+ if (cache.has(key)) {
1905
+ return cache.get(key);
1906
+ }
1907
+ var result = func.apply(this, args);
1908
+ memoized.cache = cache.set(key, result) || cache;
1909
+ return result;
1910
+ };
1911
+ memoized.cache = new (memoize$1.Cache || MapCache)();
1912
+ return memoized;
1913
+ }
1914
+ memoize$1.Cache = MapCache;
1915
+ var memoize_1 = memoize$1;
1916
+ var memoize = memoize_1;
1917
+ var MAX_MEMOIZE_SIZE = 500;
1918
+ function memoizeCapped$1(func) {
1919
+ var result = memoize(func, function(key) {
1920
+ if (cache.size === MAX_MEMOIZE_SIZE) {
1921
+ cache.clear();
1922
+ }
1923
+ return key;
1924
+ });
1925
+ var cache = result.cache;
1926
+ return result;
1927
+ }
1928
+ var _memoizeCapped = memoizeCapped$1;
1929
+ var memoizeCapped = _memoizeCapped;
1930
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1931
+ var reEscapeChar = /\\(\\)?/g;
1932
+ var stringToPath$1 = memoizeCapped(function(string) {
1933
+ var result = [];
1934
+ if (string.charCodeAt(0) === 46) {
1935
+ result.push("");
1936
+ }
1937
+ string.replace(rePropName, function(match, number, quote, subString) {
1938
+ result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
1939
+ });
1940
+ return result;
1941
+ });
1942
+ var _stringToPath = stringToPath$1;
1943
+ var Symbol$2 = _Symbol, arrayMap$1 = _arrayMap, isArray$2 = isArray_1, isSymbol$1 = isSymbol_1;
1944
+ var INFINITY$1 = 1 / 0;
1945
+ var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
1946
+ function baseToString$1(value) {
1947
+ if (typeof value == "string") {
1948
+ return value;
1949
+ }
1950
+ if (isArray$2(value)) {
1951
+ return arrayMap$1(value, baseToString$1) + "";
1952
+ }
1953
+ if (isSymbol$1(value)) {
1954
+ return symbolToString ? symbolToString.call(value) : "";
1955
+ }
1956
+ var result = value + "";
1957
+ return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
1958
+ }
1959
+ var _baseToString = baseToString$1;
1960
+ var baseToString = _baseToString;
1961
+ function toString$1(value) {
1962
+ return value == null ? "" : baseToString(value);
1963
+ }
1964
+ var toString_1 = toString$1;
1965
+ var isArray$1 = isArray_1, isKey = _isKey, stringToPath = _stringToPath, toString = toString_1;
1966
+ function castPath$3(value, object) {
1967
+ if (isArray$1(value)) {
1968
+ return value;
1969
+ }
1970
+ return isKey(value, object) ? [value] : stringToPath(toString(value));
1971
+ }
1972
+ var _castPath = castPath$3;
1973
+ function last$1(array) {
1974
+ var length = array == null ? 0 : array.length;
1975
+ return length ? array[length - 1] : void 0;
1976
+ }
1977
+ var last_1 = last$1;
1978
+ var isSymbol = isSymbol_1;
1979
+ var INFINITY = 1 / 0;
1980
+ function toKey$2(value) {
1981
+ if (typeof value == "string" || isSymbol(value)) {
1982
+ return value;
1983
+ }
1984
+ var result = value + "";
1985
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
1986
+ }
1987
+ var _toKey = toKey$2;
1988
+ var castPath$2 = _castPath, toKey$1 = _toKey;
1989
+ function baseGet$1(object, path) {
1990
+ path = castPath$2(path, object);
1991
+ var index = 0, length = path.length;
1992
+ while (object != null && index < length) {
1993
+ object = object[toKey$1(path[index++])];
1994
+ }
1995
+ return index && index == length ? object : void 0;
1996
+ }
1997
+ var _baseGet = baseGet$1;
1998
+ function baseSlice$1(array, start, end) {
1999
+ var index = -1, length = array.length;
2000
+ if (start < 0) {
2001
+ start = -start > length ? 0 : length + start;
2002
+ }
2003
+ end = end > length ? length : end;
2004
+ if (end < 0) {
2005
+ end += length;
2006
+ }
2007
+ length = start > end ? 0 : end - start >>> 0;
2008
+ start >>>= 0;
2009
+ var result = Array(length);
2010
+ while (++index < length) {
2011
+ result[index] = array[index + start];
2012
+ }
2013
+ return result;
2014
+ }
2015
+ var _baseSlice = baseSlice$1;
2016
+ var baseGet = _baseGet, baseSlice = _baseSlice;
2017
+ function parent$1(object, path) {
2018
+ return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
2019
+ }
2020
+ var _parent = parent$1;
2021
+ var castPath$1 = _castPath, last = last_1, parent = _parent, toKey = _toKey;
2022
+ function baseUnset$1(object, path) {
2023
+ path = castPath$1(path, object);
2024
+ object = parent(object, path);
2025
+ return object == null || delete object[toKey(last(path))];
2026
+ }
2027
+ var _baseUnset = baseUnset$1;
2028
+ var baseGetTag = _baseGetTag, getPrototype = _getPrototype, isObjectLike = isObjectLike_1;
2029
+ var objectTag = "[object Object]";
2030
+ var funcProto = Function.prototype, objectProto = Object.prototype;
2031
+ var funcToString = funcProto.toString;
2032
+ var hasOwnProperty = objectProto.hasOwnProperty;
2033
+ var objectCtorString = funcToString.call(Object);
2034
+ function isPlainObject$1(value) {
2035
+ if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
2036
+ return false;
2037
+ }
2038
+ var proto = getPrototype(value);
2039
+ if (proto === null) {
2040
+ return true;
2041
+ }
2042
+ var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
2043
+ return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
2044
+ }
2045
+ var isPlainObject_1 = isPlainObject$1;
2046
+ var isPlainObject = isPlainObject_1;
2047
+ function customOmitClone$1(value) {
2048
+ return isPlainObject(value) ? void 0 : value;
2049
+ }
2050
+ var _customOmitClone = customOmitClone$1;
2051
+ var Symbol$1 = _Symbol, isArguments = isArguments_1, isArray = isArray_1;
2052
+ var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
2053
+ function isFlattenable$1(value) {
2054
+ return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
2055
+ }
2056
+ var _isFlattenable = isFlattenable$1;
2057
+ var arrayPush = _arrayPush, isFlattenable = _isFlattenable;
2058
+ function baseFlatten$1(array, depth, predicate, isStrict, result) {
2059
+ var index = -1, length = array.length;
2060
+ predicate || (predicate = isFlattenable);
2061
+ result || (result = []);
2062
+ while (++index < length) {
2063
+ var value = array[index];
2064
+ if (depth > 0 && predicate(value)) {
2065
+ if (depth > 1) {
2066
+ baseFlatten$1(value, depth - 1, predicate, isStrict, result);
2067
+ } else {
2068
+ arrayPush(result, value);
2069
+ }
2070
+ } else if (!isStrict) {
2071
+ result[result.length] = value;
2072
+ }
2073
+ }
2074
+ return result;
2075
+ }
2076
+ var _baseFlatten = baseFlatten$1;
2077
+ var baseFlatten = _baseFlatten;
2078
+ function flatten$1(array) {
2079
+ var length = array == null ? 0 : array.length;
2080
+ return length ? baseFlatten(array, 1) : [];
2081
+ }
2082
+ var flatten_1 = flatten$1;
2083
+ function apply$1(func, thisArg, args) {
2084
+ switch (args.length) {
2085
+ case 0:
2086
+ return func.call(thisArg);
2087
+ case 1:
2088
+ return func.call(thisArg, args[0]);
2089
+ case 2:
2090
+ return func.call(thisArg, args[0], args[1]);
2091
+ case 3:
2092
+ return func.call(thisArg, args[0], args[1], args[2]);
2093
+ }
2094
+ return func.apply(thisArg, args);
2095
+ }
2096
+ var _apply = apply$1;
2097
+ var apply = _apply;
2098
+ var nativeMax = Math.max;
2099
+ function overRest$1(func, start, transform) {
2100
+ start = nativeMax(start === void 0 ? func.length - 1 : start, 0);
2101
+ return function() {
2102
+ var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length);
2103
+ while (++index < length) {
2104
+ array[index] = args[start + index];
2105
+ }
2106
+ index = -1;
2107
+ var otherArgs = Array(start + 1);
2108
+ while (++index < start) {
2109
+ otherArgs[index] = args[index];
2110
+ }
2111
+ otherArgs[start] = transform(array);
2112
+ return apply(func, this, otherArgs);
2113
+ };
2114
+ }
2115
+ var _overRest = overRest$1;
2116
+ function constant$1(value) {
2117
+ return function() {
2118
+ return value;
2119
+ };
2120
+ }
2121
+ var constant_1 = constant$1;
2122
+ function identity$1(value) {
2123
+ return value;
2124
+ }
2125
+ var identity_1 = identity$1;
2126
+ var constant = constant_1, defineProperty = _defineProperty, identity = identity_1;
2127
+ var baseSetToString$1 = !defineProperty ? identity : function(func, string) {
2128
+ return defineProperty(func, "toString", {
2129
+ "configurable": true,
2130
+ "enumerable": false,
2131
+ "value": constant(string),
2132
+ "writable": true
2133
+ });
2134
+ };
2135
+ var _baseSetToString = baseSetToString$1;
2136
+ var HOT_COUNT = 800, HOT_SPAN = 16;
2137
+ var nativeNow = Date.now;
2138
+ function shortOut$1(func) {
2139
+ var count = 0, lastCalled = 0;
2140
+ return function() {
2141
+ var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
2142
+ lastCalled = stamp;
2143
+ if (remaining > 0) {
2144
+ if (++count >= HOT_COUNT) {
2145
+ return arguments[0];
2146
+ }
2147
+ } else {
2148
+ count = 0;
2149
+ }
2150
+ return func.apply(void 0, arguments);
2151
+ };
2152
+ }
2153
+ var _shortOut = shortOut$1;
2154
+ var baseSetToString = _baseSetToString, shortOut = _shortOut;
2155
+ var setToString$1 = shortOut(baseSetToString);
2156
+ var _setToString = setToString$1;
2157
+ var flatten = flatten_1, overRest = _overRest, setToString = _setToString;
2158
+ function flatRest$1(func) {
2159
+ return setToString(overRest(func, void 0, flatten), func + "");
2160
+ }
2161
+ var _flatRest = flatRest$1;
2162
+ var arrayMap = _arrayMap, baseClone = _baseClone, baseUnset = _baseUnset, castPath = _castPath, copyObject = _copyObject, customOmitClone = _customOmitClone, flatRest = _flatRest, getAllKeysIn = _getAllKeysIn;
2163
+ var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
2164
+ var omit = flatRest(function(object, paths) {
2165
+ var result = {};
2166
+ if (object == null) {
2167
+ return result;
2168
+ }
2169
+ var isDeep = false;
2170
+ paths = arrayMap(paths, function(path) {
2171
+ path = castPath(path, object);
2172
+ isDeep || (isDeep = path.length > 1);
2173
+ return path;
2174
+ });
2175
+ copyObject(object, getAllKeysIn(object), result);
2176
+ if (isDeep) {
2177
+ result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
2178
+ }
2179
+ var length = paths.length;
2180
+ while (length--) {
2181
+ baseUnset(result, paths[length]);
2182
+ }
2183
+ return result;
2184
+ });
2185
+ var omit_1 = omit;
2186
+ const omit$1 = /* @__PURE__ */ getDefaultExportFromCjs(omit_1);
2187
+ const formTrigger = {
2188
+ title: `{{t("Form event", { ns: "${NAMESPACE}" })}}`,
2189
+ type: "form",
2190
+ description: `{{t("Event triggers when submitted a workflow bound form action.", { ns: "${NAMESPACE}" })}}`,
2191
+ fieldset: {
2192
+ collection: {
2193
+ ...collection$2,
2194
+ title: `{{t("Form data model", { ns: "${NAMESPACE}" })}}`,
2195
+ description: `{{t("Use a collection to match form data.", { ns: "${NAMESPACE}" })}}`,
2196
+ ["x-reactions"]: [
2197
+ ...collection$2["x-reactions"],
2198
+ {
2199
+ target: "appends",
2200
+ effects: ["onFieldValueChange"],
2201
+ fulfill: {
2202
+ state: {
2203
+ value: []
774
2204
  }
775
2205
  }
776
2206
  }
@@ -778,25 +2208,13 @@
778
2208
  },
779
2209
  appends: {
780
2210
  ...appends,
781
- "x-reactions": [
782
- ...appends["x-reactions"],
783
- {
784
- dependencies: ["mode"],
785
- fulfill: {
786
- state: {
787
- visible: `{{!($deps[0] & ${COLLECTION_TRIGGER_MODE.DELETED})}}`
788
- }
789
- }
790
- }
791
- ]
2211
+ title: `{{t("Associations to use", { ns: "${NAMESPACE}" })}}`
792
2212
  }
793
2213
  },
794
2214
  scope: {
795
2215
  useCollectionDataSource: client.useCollectionDataSource
796
2216
  },
797
- components: {
798
- FieldsSelect
799
- },
2217
+ components: {},
800
2218
  useVariables(config, options) {
801
2219
  var _a;
802
2220
  const compile = client.useCompile();
@@ -810,13 +2228,22 @@
810
2228
  uiSchema: {
811
2229
  title: lang("Trigger data")
812
2230
  }
2231
+ },
2232
+ {
2233
+ collectionName: "users",
2234
+ name: "user",
2235
+ type: "hasOne",
2236
+ target: "users",
2237
+ uiSchema: {
2238
+ title: lang("User submitted form")
2239
+ }
813
2240
  }
814
2241
  ];
815
2242
  const result = getCollectionFieldOptions({
816
2243
  // depth,
817
2244
  ...options,
818
2245
  fields: rootFields,
819
- appends: ["data", ...((_a = config.appends) == null ? void 0 : _a.map((item) => `data.${item}`)) || []],
2246
+ appends: ["data", "user", ...((_a = config.appends) == null ? void 0 : _a.map((item) => `data.${item}`)) || []],
820
2247
  compile,
821
2248
  getCollectionFields
822
2249
  });
@@ -837,6 +2264,102 @@
837
2264
  },
838
2265
  initializers: {}
839
2266
  };
2267
+ function getFormValues(filterByTk, field, form, fieldNames, getField, resource) {
2268
+ var _a;
2269
+ if (filterByTk) {
2270
+ const actionFields = (_a = field == null ? void 0 : field.data) == null ? void 0 : _a.activeFields;
2271
+ if (actionFields) {
2272
+ const keys2 = Object.keys(form.values).filter((key) => {
2273
+ const f2 = getField(key);
2274
+ return !actionFields.has(key) && ["hasOne", "hasMany", "belongsTo", "belongsToMany"].includes(f2 == null ? void 0 : f2.type);
2275
+ });
2276
+ return omit$1({ ...form.values }, keys2);
2277
+ }
2278
+ }
2279
+ return form.values;
2280
+ }
2281
+ function useTriggerWorkflowsActionProps() {
2282
+ var _a;
2283
+ const api = client.useAPIClient();
2284
+ const form = react.useForm();
2285
+ const { field, resource, __parent } = client.useBlockRequestContext();
2286
+ const { setVisible, fieldSchema } = client.useActionContext();
2287
+ const navigate = reactRouterDom.useNavigate();
2288
+ const actionSchema = react.useFieldSchema();
2289
+ const actionField = react.useField();
2290
+ const { fields, getField, getTreeParentField } = client.useCollection();
2291
+ const compile = client.useCompile();
2292
+ const filterByTk = client.useFilterByTk();
2293
+ const currentRecord = client.useRecord();
2294
+ const currentUserContext = client.useCurrentUserContext();
2295
+ const { modal } = antd.App.useApp();
2296
+ const currentUser = (_a = currentUserContext == null ? void 0 : currentUserContext.data) == null ? void 0 : _a.data;
2297
+ const filterKeys = actionField.componentProps.filterKeys || [];
2298
+ return {
2299
+ async onClick() {
2300
+ var _a2, _b, _c;
2301
+ const fieldNames = fields.map((field2) => field2.name);
2302
+ const {
2303
+ assignedValues: originalAssignedValues = {},
2304
+ onSuccess,
2305
+ overwriteValues,
2306
+ skipValidator,
2307
+ triggerWorkflows
2308
+ } = (actionSchema == null ? void 0 : actionSchema["x-action-settings"]) ?? {};
2309
+ const addChild = (_a2 = fieldSchema == null ? void 0 : fieldSchema["x-component-props"]) == null ? void 0 : _a2.addChild;
2310
+ const assignedValues = client$1.parse(originalAssignedValues)({ currentTime: /* @__PURE__ */ new Date(), currentRecord, currentUser });
2311
+ if (!skipValidator) {
2312
+ await form.submit();
2313
+ }
2314
+ const values2 = getFormValues(filterByTk, field, form, fieldNames, getField);
2315
+ if (addChild) {
2316
+ const treeParentField = getTreeParentField();
2317
+ values2[(treeParentField == null ? void 0 : treeParentField.name) ?? "parent"] = currentRecord;
2318
+ values2[(treeParentField == null ? void 0 : treeParentField.foreignKey) ?? "parentId"] = currentRecord.id;
2319
+ }
2320
+ actionField.data = field.data || {};
2321
+ actionField.data.loading = true;
2322
+ try {
2323
+ const data = await api.resource("workflows").trigger({
2324
+ values: {
2325
+ ...values2,
2326
+ ...overwriteValues,
2327
+ ...assignedValues
2328
+ },
2329
+ filterKeys,
2330
+ // TODO(refactor): should change to inject by plugin
2331
+ triggerWorkflows: (triggerWorkflows == null ? void 0 : triggerWorkflows.length) ? triggerWorkflows.map((row) => [row.workflowKey, row.context].filter(Boolean).join("!")).join(",") : void 0
2332
+ });
2333
+ actionField.data.loading = false;
2334
+ actionField.data.data = data;
2335
+ (_c = (_b = __parent == null ? void 0 : __parent.service) == null ? void 0 : _b.refresh) == null ? void 0 : _c.call(_b);
2336
+ setVisible == null ? void 0 : setVisible(false);
2337
+ if (!(onSuccess == null ? void 0 : onSuccess.successMessage)) {
2338
+ return;
2339
+ }
2340
+ if (onSuccess == null ? void 0 : onSuccess.manualClose) {
2341
+ modal.success({
2342
+ title: compile(onSuccess == null ? void 0 : onSuccess.successMessage),
2343
+ onOk: async () => {
2344
+ await form.reset();
2345
+ if ((onSuccess == null ? void 0 : onSuccess.redirecting) && (onSuccess == null ? void 0 : onSuccess.redirectTo)) {
2346
+ if (client$1.isURL(onSuccess.redirectTo)) {
2347
+ window.location.href = onSuccess.redirectTo;
2348
+ } else {
2349
+ navigate(onSuccess.redirectTo);
2350
+ }
2351
+ }
2352
+ }
2353
+ });
2354
+ } else {
2355
+ antd.message.success(compile(onSuccess == null ? void 0 : onSuccess.successMessage));
2356
+ }
2357
+ } catch (error) {
2358
+ actionField.data.loading = false;
2359
+ }
2360
+ }
2361
+ };
2362
+ }
840
2363
  const SCHEDULE_MODE = {
841
2364
  STATIC: 0,
842
2365
  COLLECTION_FIELD: 1
@@ -1435,9 +2958,10 @@
1435
2958
  return opts.find((item) => !(v2 % item.value));
1436
2959
  }
1437
2960
  function getRepeatTypeValue(v2) {
2961
+ let option;
1438
2962
  switch (typeof v2) {
1439
2963
  case "number":
1440
- const option = getNumberOption$1(v2);
2964
+ option = getNumberOption$1(v2);
1441
2965
  return option ? option.value : "none";
1442
2966
  case "string":
1443
2967
  return "cron";
@@ -1454,7 +2978,8 @@
1454
2978
  onChange: (v2) => onChange(v2 * option.value),
1455
2979
  min: 1,
1456
2980
  addonBefore: t("Every"),
1457
- addonAfter: t(option.unitText)
2981
+ addonAfter: t(option.unitText),
2982
+ className: "auto-width"
1458
2983
  }
1459
2984
  );
1460
2985
  }
@@ -1483,6 +3008,7 @@
1483
3008
  gap: 0.5em;
1484
3009
 
1485
3010
  .react-js-cron {
3011
+ width: 100%;
1486
3012
  padding: 0.5em 0.5em 0 0.5em;
1487
3013
  border: 1px dashed #ccc;
1488
3014
 
@@ -1497,10 +3023,16 @@
1497
3023
  margin: 0 0.5em 0 0;
1498
3024
  }
1499
3025
  }
3026
+
3027
+ .react-js-cron-week-days {
3028
+ > span {
3029
+ min-width: 2em;
3030
+ }
3031
+ }
1500
3032
  }
1501
3033
  `,
1502
3034
  children: [
1503
- /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select, { value: typeValue, onChange: onTypeChange, children: RepeatOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { value: item.value, children: t(item.text) }, item.value)) }),
3035
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select, { value: typeValue, onChange: onTypeChange, className: "auto-width", children: RepeatOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { value: item.value, children: t(item.text) }, item.value)) }),
1504
3036
  typeof typeValue === "number" ? /* @__PURE__ */ jsxRuntimeExports.jsx(CommonRepeatField, { value, onChange }) : null,
1505
3037
  typeValue === "cron" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
1506
3038
  J,
@@ -1709,7 +3241,8 @@
1709
3241
  "x-component-props": {
1710
3242
  className: client.css`
1711
3243
  .ant-input-number {
1712
- width: 4em;
3244
+ width: auto;
3245
+ min-width: 6em;
1713
3246
  }
1714
3247
 
1715
3248
  .ant-picker {
@@ -1733,6 +3266,7 @@
1733
3266
  const schedule = {
1734
3267
  title: `{{t("Schedule event", { ns: "${NAMESPACE}" })}}`,
1735
3268
  type: "schedule",
3269
+ description: `{{t("Event will be scheduled and triggered base on time conditions.", { ns: "${NAMESPACE}" })}}`,
1736
3270
  fieldset: {
1737
3271
  config: {
1738
3272
  type: "void",
@@ -1819,12 +3353,13 @@
1819
3353
  };
1820
3354
  }
1821
3355
  const triggers = new client$1.Registry();
3356
+ triggers.register(formTrigger.type, formTrigger);
1822
3357
  triggers.register(collection$1.type, collection$1);
1823
3358
  triggers.register(schedule.type, schedule);
1824
3359
  function TriggerExecution() {
1825
3360
  const compile = client.useCompile();
1826
3361
  const { workflow, execution } = useFlowContext();
1827
- const { styles } = useStyles();
3362
+ const { styles } = useStyles$1();
1828
3363
  if (!execution) {
1829
3364
  return null;
1830
3365
  }
@@ -1892,11 +3427,11 @@
1892
3427
  }
1893
3428
  const TriggerConfig = () => {
1894
3429
  const api = client.useAPIClient();
1895
- const compile = client.useCompile();
3430
+ client.useCompile();
1896
3431
  const { workflow, refresh } = useFlowContext();
1897
3432
  const [editingTitle, setEditingTitle] = React.useState("");
1898
3433
  const [editingConfig, setEditingConfig] = React.useState(false);
1899
- const { styles } = useStyles();
3434
+ const { styles } = useStyles$1();
1900
3435
  let typeTitle = "";
1901
3436
  React.useEffect(() => {
1902
3437
  if (workflow) {
@@ -1919,7 +3454,7 @@
1919
3454
  const { fieldset, scope, components } = trigger;
1920
3455
  typeTitle = trigger.title;
1921
3456
  const detailText = executed ? '{{t("View")}}' : '{{t("Configure")}}';
1922
- const titleText = `${lang("Trigger")}: ${compile(typeTitle)}`;
3457
+ const titleText = lang("Trigger");
1923
3458
  async function onChangeTitle(next) {
1924
3459
  var _a, _b;
1925
3460
  const t = next || typeTitle;
@@ -2000,6 +3535,16 @@
2000
3535
  `
2001
3536
  }
2002
3537
  }
3538
+ } : trigger.description ? {
3539
+ description: {
3540
+ type: "void",
3541
+ "x-component": DrawerDescription,
3542
+ "x-component-props": {
3543
+ label: lang("Trigger type"),
3544
+ title: trigger.title,
3545
+ description: trigger.description
3546
+ }
3547
+ }
2003
3548
  } : {},
2004
3549
  fieldset: {
2005
3550
  type: "void",
@@ -2257,11 +3802,11 @@
2257
3802
  return otherFields.filter((field) => field.interface && !field.hidden);
2258
3803
  }
2259
3804
  async function loadChildren(option) {
2260
- var _a;
3805
+ const appends2 = getNextAppends(option.field, option.appends);
2261
3806
  const result = getCollectionFieldOptions({
2262
3807
  collection: option.field.target,
2263
3808
  types: option.types,
2264
- appends: getNextAppends(option.field, option.appends),
3809
+ appends: appends2,
2265
3810
  ...this
2266
3811
  });
2267
3812
  option.loadChildren = null;
@@ -2269,14 +3814,22 @@
2269
3814
  option.children = result;
2270
3815
  } else {
2271
3816
  option.isLeaf = true;
2272
- const matchingType = (_a = option.types) == null ? void 0 : _a.some((type) => matchFieldType(option.field, type, 0));
3817
+ const matchingType = option.types ? option.types.some((type) => matchFieldType(option.field, type, appends2)) : true;
2273
3818
  if (!matchingType) {
2274
3819
  option.disabled = true;
2275
3820
  }
2276
3821
  }
2277
3822
  }
2278
3823
  function getCollectionFieldOptions(options) {
2279
- const { fields, collection: collection2, types, appends: appends2 = [], compile, getCollectionFields, fieldNames = defaultFieldNames } = options;
3824
+ const {
3825
+ fields,
3826
+ collection: collection2,
3827
+ types,
3828
+ appends: appends2 = [],
3829
+ compile,
3830
+ getCollectionFields,
3831
+ fieldNames = defaultFieldNames
3832
+ } = options;
2280
3833
  const normalizedFields = getNormalizedFields(collection2, { compile, getCollectionFields });
2281
3834
  const computedFields = fields ?? normalizedFields;
2282
3835
  const boundLoadChildren = loadChildren.bind({ compile, getCollectionFields, fieldNames });
@@ -2367,13 +3920,11 @@
2367
3920
  ValueBlock.Result = Result$1;
2368
3921
  function matchToManyField(field, appends2) {
2369
3922
  const fieldPrefix = `${field.name}.`;
2370
- return ["hasMany", "belongsToMany"].includes(field.type) && (appends2.includes(field.name) || appends2.some((item) => item.startsWith(fieldPrefix)));
3923
+ return ["hasMany", "belongsToMany"].includes(field.type) && (appends2 ? appends2.includes(field.name) || appends2.some((item) => item.startsWith(fieldPrefix)) : true);
2371
3924
  }
2372
- function AssociatedConfig({ value, onChange, ...props }) {
2373
- const { setValuesIn } = react.useForm();
3925
+ function useAssociatedFields() {
2374
3926
  const compile = client.useCompile();
2375
- const { getCollection } = client.useCollectionManager();
2376
- const options = [nodesOptions, triggerOptions].map((item) => {
3927
+ return [nodesOptions, triggerOptions].map((item) => {
2377
3928
  var _a;
2378
3929
  const children = (_a = item.useOptions({ types: [matchToManyField] })) == null ? void 0 : _a.filter(Boolean);
2379
3930
  return {
@@ -2384,12 +3935,52 @@
2384
3935
  disabled: children && !children.length
2385
3936
  };
2386
3937
  });
3938
+ }
3939
+ function AssociatedConfig({ value, onChange, ...props }) {
3940
+ const { setValuesIn } = react.useForm();
3941
+ const { getCollection } = client.useCollectionManager();
3942
+ const baseOptions = useAssociatedFields();
3943
+ const [options, setOptions] = React.useState(baseOptions);
2387
3944
  const { associatedKey = "", name: fieldName } = value ?? {};
2388
3945
  let p2 = [];
2389
3946
  const matched = associatedKey.match(/^{{(.*)}}$/);
2390
3947
  if (matched) {
2391
3948
  p2 = [...matched[1].trim().split(".").slice(0, -1), fieldName];
2392
3949
  }
3950
+ const loadData = async (selectedOptions) => {
3951
+ var _a;
3952
+ const option = selectedOptions[selectedOptions.length - 1];
3953
+ if (!((_a = option.children) == null ? void 0 : _a.length) && !option.isLeaf && option.loadChildren) {
3954
+ await option.loadChildren(option);
3955
+ setOptions((prev) => [...prev]);
3956
+ }
3957
+ };
3958
+ React.useEffect(() => {
3959
+ const run = async () => {
3960
+ var _a;
3961
+ if (!p2 || options.length <= 1) {
3962
+ return;
3963
+ }
3964
+ let prevOption = null;
3965
+ for (let i = 0; i < p2.length; i++) {
3966
+ const key = p2[i];
3967
+ try {
3968
+ if (i === 0) {
3969
+ prevOption = options.find((item) => item.value === key);
3970
+ } else {
3971
+ if (prevOption.loadChildren && !((_a = prevOption.children) == null ? void 0 : _a.length)) {
3972
+ await prevOption.loadChildren(prevOption);
3973
+ }
3974
+ prevOption = prevOption.children.find((item) => item.value === key);
3975
+ }
3976
+ } catch (err) {
3977
+ console.error(err);
3978
+ }
3979
+ }
3980
+ setOptions([...options]);
3981
+ };
3982
+ run();
3983
+ }, [value, options.length]);
2393
3984
  const onSelectChange = React.useCallback(
2394
3985
  (path, option) => {
2395
3986
  if (!(path == null ? void 0 : path.length)) {
@@ -2412,7 +4003,7 @@
2412
4003
  },
2413
4004
  [onChange]
2414
4005
  );
2415
- return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Cascader, { ...props, value: p2, options, onChange: onSelectChange });
4006
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Cascader, { ...props, value: p2, options, onChange: onSelectChange, loadData });
2416
4007
  }
2417
4008
  const aggregate = {
2418
4009
  title: `{{t("Aggregate", { ns: "${NAMESPACE}" })}}`,
@@ -3249,7 +4840,7 @@
3249
4840
  component: function Component({ data }) {
3250
4841
  const { t } = reactI18next.useTranslation();
3251
4842
  const { nodes } = useFlowContext();
3252
- const { styles } = useStyles();
4843
+ const { styles } = useStyles$1();
3253
4844
  const {
3254
4845
  id,
3255
4846
  config: { rejectOnFalse }
@@ -3319,7 +4910,7 @@
3319
4910
  const scope = useWorkflowVariableOptions();
3320
4911
  const { values: config } = form;
3321
4912
  const collectionName = config == null ? void 0 : config.collection;
3322
- const collectionFields = getCollectionFields(collectionName);
4913
+ const collectionFields = getCollectionFields(collectionName).filter((field) => field.uiSchema);
3323
4914
  const fields = filter2 ? collectionFields.filter(filter2.bind(config)) : collectionFields;
3324
4915
  const unassignedFields = React.useMemo(() => fields.filter((field) => !value || !(field.name in value)), [fields, value]);
3325
4916
  const mergedDisabled = disabled || form.disabled;
@@ -3535,6 +5126,122 @@
3535
5126
  }
3536
5127
  );
3537
5128
  }
5129
+ const EXECUTION_STATUS = {
5130
+ QUEUEING: null,
5131
+ STARTED: 0,
5132
+ RESOLVED: 1,
5133
+ FAILED: -1,
5134
+ ERROR: -2,
5135
+ ABORTED: -3,
5136
+ CANCELED: -4,
5137
+ REJECTED: -5
5138
+ };
5139
+ const ExecutionStatusOptions = [
5140
+ {
5141
+ value: EXECUTION_STATUS.QUEUEING,
5142
+ label: `{{t("Queueing", { ns: "${NAMESPACE}" })}}`,
5143
+ color: "blue",
5144
+ description: `{{t("Triggered but still waiting in queue to execute.", { ns: "${NAMESPACE}" })}}`
5145
+ },
5146
+ {
5147
+ value: EXECUTION_STATUS.STARTED,
5148
+ label: `{{t("On going", { ns: "${NAMESPACE}" })}}`,
5149
+ color: "gold",
5150
+ description: `{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${NAMESPACE}" })}}`
5151
+ },
5152
+ {
5153
+ value: EXECUTION_STATUS.RESOLVED,
5154
+ label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
5155
+ color: "green",
5156
+ description: `{{t("Successfully finished.", { ns: "${NAMESPACE}" })}}`
5157
+ },
5158
+ {
5159
+ value: EXECUTION_STATUS.FAILED,
5160
+ label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
5161
+ color: "red",
5162
+ description: `{{t("Failed to satisfy node configurations.", { ns: "${NAMESPACE}" })}}`
5163
+ },
5164
+ {
5165
+ value: EXECUTION_STATUS.ERROR,
5166
+ label: `{{t("Error", { ns: "${NAMESPACE}" })}}`,
5167
+ color: "red",
5168
+ description: `{{t("Some node meets error.", { ns: "${NAMESPACE}" })}}`
5169
+ },
5170
+ {
5171
+ value: EXECUTION_STATUS.ABORTED,
5172
+ label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
5173
+ color: "red",
5174
+ description: `{{t("Running of some node was aborted by program flow.", { ns: "${NAMESPACE}" })}}`
5175
+ },
5176
+ {
5177
+ value: EXECUTION_STATUS.CANCELED,
5178
+ label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
5179
+ color: "volcano",
5180
+ description: `{{t("Manually canceled whole execution when waiting.", { ns: "${NAMESPACE}" })}}`
5181
+ },
5182
+ {
5183
+ value: EXECUTION_STATUS.REJECTED,
5184
+ label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
5185
+ color: "volcano",
5186
+ description: `{{t("Rejected from a manual node.", { ns: "${NAMESPACE}" })}}`
5187
+ }
5188
+ ];
5189
+ const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce(
5190
+ (map, option) => Object.assign(map, { [option.value]: option }),
5191
+ {}
5192
+ );
5193
+ const JOB_STATUS = {
5194
+ PENDING: 0,
5195
+ RESOLVED: 1,
5196
+ FAILED: -1,
5197
+ ERROR: -2,
5198
+ ABORTED: -3,
5199
+ CANCELED: -4,
5200
+ REJECTED: -5
5201
+ };
5202
+ const JobStatusOptions = [
5203
+ {
5204
+ value: JOB_STATUS.PENDING,
5205
+ label: `{{t("Pending", { ns: "${NAMESPACE}" })}}`,
5206
+ color: "gold",
5207
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ClockCircleOutlined, {})
5208
+ },
5209
+ {
5210
+ value: JOB_STATUS.RESOLVED,
5211
+ label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
5212
+ color: "green",
5213
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CheckOutlined, {})
5214
+ },
5215
+ {
5216
+ value: JOB_STATUS.FAILED,
5217
+ label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
5218
+ color: "red",
5219
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ExclamationOutlined, {})
5220
+ },
5221
+ { value: JOB_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: "red", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CloseOutlined, {}) },
5222
+ {
5223
+ value: JOB_STATUS.ABORTED,
5224
+ label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
5225
+ color: "red",
5226
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 90 })
5227
+ },
5228
+ {
5229
+ value: JOB_STATUS.CANCELED,
5230
+ label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
5231
+ color: "volcano",
5232
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 45 })
5233
+ },
5234
+ {
5235
+ value: JOB_STATUS.REJECTED,
5236
+ label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
5237
+ color: "volcano",
5238
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, {})
5239
+ }
5240
+ ];
5241
+ const JobStatusOptionsMap = JobStatusOptions.reduce(
5242
+ (map, option) => Object.assign(map, { [option.value]: option }),
5243
+ {}
5244
+ );
3538
5245
  const delay = {
3539
5246
  title: `{{t("Delay", { ns: "${NAMESPACE}" })}}`,
3540
5247
  type: "delay",
@@ -3677,7 +5384,7 @@
3677
5384
  view: {},
3678
5385
  component: function Component({ data }) {
3679
5386
  const { nodes } = useFlowContext();
3680
- const { styles } = useStyles();
5387
+ const { styles } = useStyles$1();
3681
5388
  const entry = nodes.find((node) => node.upstreamId === data.id && node.branchIndex != null);
3682
5389
  return /* @__PURE__ */ jsxRuntimeExports.jsx(NodeDefaultView, { data, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.nodeSubtreeClass, children: [
3683
5390
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -3940,10 +5647,10 @@
3940
5647
  components: {
3941
5648
  CreateFormDesigner
3942
5649
  },
3943
- parseFormOptions(root) {
5650
+ parseFormOptions(root2) {
3944
5651
  const forms = {};
3945
5652
  const formBlocks = findSchema(
3946
- root,
5653
+ root2,
3947
5654
  (item) => item["x-decorator"] === "FormBlockProvider" && item["x-decorator-props"].formType === "create"
3948
5655
  );
3949
5656
  formBlocks.forEach((formBlock) => {
@@ -4292,9 +5999,9 @@
4292
5999
  components: {
4293
6000
  CustomFormBlockProvider
4294
6001
  },
4295
- parseFormOptions(root) {
6002
+ parseFormOptions(root2) {
4296
6003
  const forms = {};
4297
- const formBlocks = findSchema(root, (item) => item["x-decorator"] === "CustomFormBlockProvider");
6004
+ const formBlocks = findSchema(root2, (item) => item["x-decorator"] === "CustomFormBlockProvider");
4298
6005
  formBlocks.forEach((formBlock) => {
4299
6006
  var _a;
4300
6007
  const [formKey] = Object.keys(formBlock.properties);
@@ -4420,10 +6127,10 @@
4420
6127
  FilterDynamicComponent,
4421
6128
  UpdateFormDesigner
4422
6129
  },
4423
- parseFormOptions(root) {
6130
+ parseFormOptions(root2) {
4424
6131
  const forms = {};
4425
6132
  const formBlocks = findSchema(
4426
- root,
6133
+ root2,
4427
6134
  (item) => item["x-decorator"] === "FormBlockProvider" && item["x-decorator-props"].formType === "update"
4428
6135
  );
4429
6136
  formBlocks.forEach((formBlock) => {
@@ -4909,8 +6616,14 @@
4909
6616
  }
4910
6617
  );
4911
6618
  }
6619
+ function isUserKeyField(field) {
6620
+ if (field.isForeignKey) {
6621
+ return field.target === "users";
6622
+ }
6623
+ return field.collectionName === "users" && field.name === "id";
6624
+ }
4912
6625
  function AssigneesSelect({ multiple = false, value = [], onChange }) {
4913
- const scope = useWorkflowVariableOptions({ types: [{ type: "reference", options: { collection: "users" } }] });
6626
+ const scope = useWorkflowVariableOptions({ types: [isUserKeyField] });
4914
6627
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
4915
6628
  client.Variable.Input,
4916
6629
  {
@@ -5101,7 +6814,7 @@
5101
6814
  },
5102
6815
  view: {},
5103
6816
  component: function Component({ data }) {
5104
- const { styles } = useStyles();
6817
+ const { styles } = useStyles$1();
5105
6818
  const {
5106
6819
  id,
5107
6820
  config: { mode }
@@ -5201,31 +6914,69 @@
5201
6914
  collection: collection$2,
5202
6915
  multiple: {
5203
6916
  type: "boolean",
5204
- title: `{{t("Allow multiple records as result", { ns: "${NAMESPACE}" })}}`,
5205
6917
  "x-decorator": "FormItem",
5206
6918
  "x-component": "Checkbox",
6919
+ "x-content": `{{t("Allow multiple records as result", { ns: "${NAMESPACE}" })}}`,
5207
6920
  description: `{{t("If checked, when there are multiple records in the query result, an array will be returned as the result, which can be operated on one by one using a loop node. Otherwise, only one record will be returned.", { ns: "${NAMESPACE}" })}}`
5208
6921
  },
5209
6922
  params: {
5210
6923
  type: "object",
6924
+ "x-component": "fieldset",
5211
6925
  properties: {
5212
6926
  filter,
6927
+ sort,
6928
+ pagination,
5213
6929
  appends
5214
- }
6930
+ },
6931
+ "x-reactions": [
6932
+ {
6933
+ dependencies: ["collection"],
6934
+ fulfill: {
6935
+ state: {
6936
+ visible: "{{$deps[0] != null}}"
6937
+ }
6938
+ }
6939
+ }
6940
+ ]
5215
6941
  },
5216
6942
  failOnEmpty: {
5217
6943
  type: "boolean",
5218
- title: `{{t("Exit when query result is null", { ns: "${NAMESPACE}" })}}`,
5219
6944
  "x-decorator": "FormItem",
5220
- "x-component": "Checkbox"
6945
+ "x-component": "Checkbox",
6946
+ "x-content": `{{t("Exit when query result is null", { ns: "${NAMESPACE}" })}}`
5221
6947
  }
5222
6948
  },
5223
6949
  view: {},
5224
6950
  scope: {
5225
- useCollectionDataSource: client.useCollectionDataSource
6951
+ useCollectionDataSource: client.useCollectionDataSource,
6952
+ useWorkflowVariableOptions,
6953
+ useSortableFields() {
6954
+ const compile = client.useCompile();
6955
+ const { getCollectionFields, getInterface } = client.useCollectionManager();
6956
+ const { values: values2 } = react.useForm();
6957
+ const fields = getCollectionFields(values2.collection);
6958
+ return fields.filter((field) => {
6959
+ if (!field.interface) {
6960
+ return false;
6961
+ }
6962
+ const fieldInterface = getInterface(field.interface);
6963
+ if (fieldInterface == null ? void 0 : fieldInterface.sortable) {
6964
+ return true;
6965
+ }
6966
+ return false;
6967
+ }).map((field) => {
6968
+ var _a, _b;
6969
+ return {
6970
+ value: field.name,
6971
+ label: ((_a = field == null ? void 0 : field.uiSchema) == null ? void 0 : _a.title) ? compile((_b = field == null ? void 0 : field.uiSchema) == null ? void 0 : _b.title) : field.name
6972
+ };
6973
+ });
6974
+ }
5226
6975
  },
5227
6976
  components: {
5228
- FilterDynamicComponent
6977
+ ArrayItems: antdV5.ArrayItems,
6978
+ FilterDynamicComponent,
6979
+ SchemaComponentContext: client.SchemaComponentContext
5229
6980
  },
5230
6981
  useVariables({ id, title, config }, options) {
5231
6982
  var _a, _b;
@@ -5533,29 +7284,94 @@
5533
7284
  ["x-validator"](value) {
5534
7285
  return isValidFilter(value) ? "" : lang("Please add at least one condition");
5535
7286
  }
5536
- },
5537
- values: {
5538
- ...values,
5539
- "x-component-props": {
5540
- filter(field) {
5541
- var _a;
5542
- return ((_a = this.params) == null ? void 0 : _a.individualHooks) || !["hasOne", "hasMany", "belongsToMany"].includes(field.type);
7287
+ },
7288
+ values: {
7289
+ ...values,
7290
+ "x-component-props": {
7291
+ filter(field) {
7292
+ var _a;
7293
+ return ((_a = this.params) == null ? void 0 : _a.individualHooks) || !["hasOne", "hasMany", "belongsToMany"].includes(field.type);
7294
+ }
7295
+ }
7296
+ }
7297
+ }
7298
+ }
7299
+ },
7300
+ view: {},
7301
+ scope: {
7302
+ useCollectionDataSource: client.useCollectionDataSource
7303
+ },
7304
+ components: {
7305
+ FilterDynamicComponent,
7306
+ CollectionFieldset: CollectionFieldSet,
7307
+ IndividualHooksRadioWithTooltip
7308
+ }
7309
+ };
7310
+ var classnames$1 = { exports: {} };
7311
+ /*!
7312
+ Copyright (c) 2018 Jed Watson.
7313
+ Licensed under the MIT License (MIT), see
7314
+ http://jedwatson.github.io/classnames
7315
+ */
7316
+ (function(module2) {
7317
+ (function() {
7318
+ var hasOwn = {}.hasOwnProperty;
7319
+ function classNames() {
7320
+ var classes = [];
7321
+ for (var i = 0; i < arguments.length; i++) {
7322
+ var arg = arguments[i];
7323
+ if (!arg)
7324
+ continue;
7325
+ var argType = typeof arg;
7326
+ if (argType === "string" || argType === "number") {
7327
+ classes.push(arg);
7328
+ } else if (Array.isArray(arg)) {
7329
+ if (arg.length) {
7330
+ var inner = classNames.apply(null, arg);
7331
+ if (inner) {
7332
+ classes.push(inner);
7333
+ }
7334
+ }
7335
+ } else if (argType === "object") {
7336
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
7337
+ classes.push(arg.toString());
7338
+ continue;
7339
+ }
7340
+ for (var key in arg) {
7341
+ if (hasOwn.call(arg, key) && arg[key]) {
7342
+ classes.push(key);
5543
7343
  }
5544
7344
  }
5545
7345
  }
5546
7346
  }
7347
+ return classes.join(" ");
5547
7348
  }
5548
- },
5549
- view: {},
5550
- scope: {
5551
- useCollectionDataSource: client.useCollectionDataSource
5552
- },
5553
- components: {
5554
- FilterDynamicComponent,
5555
- CollectionFieldset: CollectionFieldSet,
5556
- IndividualHooksRadioWithTooltip
5557
- }
5558
- };
7349
+ if (module2.exports) {
7350
+ classNames.default = classNames;
7351
+ module2.exports = classNames;
7352
+ } else {
7353
+ window.classNames = classNames;
7354
+ }
7355
+ })();
7356
+ })(classnames$1);
7357
+ var classnamesExports = classnames$1.exports;
7358
+ const classnames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
7359
+ const useStyles = client.createStyles(({ css: css2, token }) => ({
7360
+ statusIconClass: css2`
7361
+ padding: 0;
7362
+ width: ${token.sizeLG}px;
7363
+ height: ${token.sizeLG}px;
7364
+ line-height: ${token.sizeLG}px;
7365
+ margin-right: 0;
7366
+ border-radius: 50%;
7367
+ text-align: center;
7368
+ `
7369
+ }));
7370
+ function StatusIcon(props) {
7371
+ const { icon, color } = JobStatusOptionsMap[props.status];
7372
+ const { styles } = useStyles();
7373
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, className: classnames(styles.statusIconClass, props.className), children: icon });
7374
+ }
5559
7375
  const instructions = new client$1.Registry();
5560
7376
  instructions.register("calculation", calculation);
5561
7377
  instructions.register("condition", condition);
@@ -5623,7 +7439,7 @@
5623
7439
  return stack;
5624
7440
  }
5625
7441
  function Node({ data }) {
5626
- const { styles } = useStyles();
7442
+ const { styles } = useStyles$1();
5627
7443
  const { component: Component = NodeDefaultView, endding } = instructions.get(data.type);
5628
7444
  return /* @__PURE__ */ jsxRuntimeExports.jsx(NodeContext.Provider, { value: data, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: client.cx(styles.nodeBlockClass), children: [
5629
7445
  /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { data }),
@@ -5709,14 +7525,13 @@
5709
7525
  );
5710
7526
  }
5711
7527
  function InnerJobButton({ job, ...props }) {
5712
- const { styles } = useStyles();
5713
- const { icon, color } = JobStatusOptionsMap[job.status];
5714
- return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { ...props, shape: "circle", size: "small", className: client.cx(styles.nodeJobButtonClass, props.className), children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, children: icon }) });
7528
+ const { styles } = useStyles$1();
7529
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Button, { ...props, shape: "circle", size: "small", className: client.cx(styles.nodeJobButtonClass, props.className), children: /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: job.status }) });
5715
7530
  }
5716
7531
  function JobButton() {
5717
7532
  const { execution, setViewJob } = useFlowContext();
5718
7533
  const { jobs } = useNodeContext() ?? {};
5719
- const { styles } = useStyles();
7534
+ const { styles } = useStyles$1();
5720
7535
  if (!execution) {
5721
7536
  return null;
5722
7537
  }
@@ -5744,7 +7559,6 @@
5744
7559
  {
5745
7560
  menu: {
5746
7561
  items: jobs.map((job) => {
5747
- const { icon, color } = JobStatusOptionsMap[job.status];
5748
7562
  return {
5749
7563
  key: job.id,
5750
7564
  label: /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -5761,7 +7575,7 @@
5761
7575
  }
5762
7576
  `,
5763
7577
  children: [
5764
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: client.cx(styles.nodeJobButtonClass, "inner"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, children: icon }) }),
7578
+ /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: job.status }),
5765
7579
  /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(job.updatedAt).format("YYYY-MM-DD HH:mm:ss") })
5766
7580
  ]
5767
7581
  }
@@ -5779,7 +7593,7 @@
5779
7593
  const compile = client.useCompile();
5780
7594
  const api = client.useAPIClient();
5781
7595
  const { workflow, refresh } = useFlowContext() ?? {};
5782
- const { styles } = useStyles();
7596
+ const { styles } = useStyles$1();
5783
7597
  const instruction = instructions.get(data.type);
5784
7598
  const detailText = workflow.executed ? '{{t("View")}}' : '{{t("Configure")}}';
5785
7599
  const typeTitle = compile(instruction.title);
@@ -5883,9 +7697,11 @@
5883
7697
  } : instruction.description ? {
5884
7698
  description: {
5885
7699
  type: "void",
5886
- "x-component": NodeDescription,
7700
+ "x-component": DrawerDescription,
5887
7701
  "x-component-props": {
5888
- instruction
7702
+ label: lang("Node type"),
7703
+ title: instruction.title,
7704
+ description: instruction.description
5889
7705
  }
5890
7706
  }
5891
7707
  } : {},
@@ -5945,7 +7761,7 @@
5945
7761
  const api = client.useAPIClient();
5946
7762
  const { workflow, refresh } = useFlowContext() ?? {};
5947
7763
  const instructionList = Array.from(instructions.getValues());
5948
- const { styles } = useStyles();
7764
+ const { styles } = useStyles$1();
5949
7765
  const groups = React.useMemo(() => {
5950
7766
  return [
5951
7767
  { key: "control", label: `{{t("Control", { ns: "${NAMESPACE}" })}}` },
@@ -6032,7 +7848,7 @@
6032
7848
  branchIndex = null,
6033
7849
  controller = null
6034
7850
  }) {
6035
- const { styles } = useStyles();
7851
+ const { styles } = useStyles$1();
6036
7852
  const list = [];
6037
7853
  for (let node = entry; node; node = node.downstream) {
6038
7854
  list.push(node);
@@ -6045,7 +7861,7 @@
6045
7861
  ] });
6046
7862
  }
6047
7863
  function CanvasContent({ entry }) {
6048
- const { styles } = useStyles();
7864
+ const { styles } = useStyles$1();
6049
7865
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "workflow-canvas", children: [
6050
7866
  /* @__PURE__ */ jsxRuntimeExports.jsx(TriggerConfig, {}),
6051
7867
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.branchBlockClass, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Branch, { entry }) }),
@@ -6074,7 +7890,7 @@
6074
7890
  function JobModal() {
6075
7891
  const compile = client.useCompile();
6076
7892
  const { viewJob: job, setViewJob } = useFlowContext();
6077
- const { styles } = useStyles();
7893
+ const { styles } = useStyles$1();
6078
7894
  const { node = {} } = job ?? {};
6079
7895
  const instruction = instructions.get(node.type);
6080
7896
  return /* @__PURE__ */ jsxRuntimeExports.jsx(client.ActionContextProvider, { value: { visible: Boolean(job), setVisible: setViewJob }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6123,10 +7939,7 @@
6123
7939
  "x-decorator": "FormItem",
6124
7940
  "x-component": "Input.JSON",
6125
7941
  "x-component-props": {
6126
- className: client.css`
6127
- padding: 1em;
6128
- background-color: #eee;
6129
- `
7942
+ className: styles.nodeJobResultClass
6130
7943
  },
6131
7944
  "x-read-pretty": true
6132
7945
  }
@@ -6137,6 +7950,83 @@
6137
7950
  }
6138
7951
  ) });
6139
7952
  }
7953
+ function ExecutionsDropdown(props) {
7954
+ const { execution } = useFlowContext();
7955
+ const apiClient = client.useAPIClient();
7956
+ const navigate = reactRouterDom.useNavigate();
7957
+ const { styles } = useStyles$1();
7958
+ const [executionsBefore, setExecutionsBefore] = React.useState([]);
7959
+ const [executionsAfter, setExecutionsAfter] = React.useState([]);
7960
+ React.useEffect(() => {
7961
+ if (!execution) {
7962
+ return;
7963
+ }
7964
+ apiClient.resource("executions").list({
7965
+ filter: {
7966
+ key: execution.key,
7967
+ id: {
7968
+ $lt: execution.id
7969
+ }
7970
+ },
7971
+ sort: "-createdAt",
7972
+ pageSize: 10,
7973
+ fields: ["id", "status", "createdAt"]
7974
+ }).then(({ data }) => {
7975
+ setExecutionsBefore(data.data);
7976
+ }).catch(() => {
7977
+ });
7978
+ }, [execution]);
7979
+ React.useEffect(() => {
7980
+ if (!execution) {
7981
+ return;
7982
+ }
7983
+ apiClient.resource("executions").list({
7984
+ filter: {
7985
+ key: execution.key,
7986
+ id: {
7987
+ $gt: execution.id
7988
+ }
7989
+ },
7990
+ sort: "createdAt",
7991
+ pageSize: 10,
7992
+ fields: ["id", "status", "createdAt"]
7993
+ }).then(({ data }) => {
7994
+ setExecutionsAfter(data.data.reverse());
7995
+ }).catch(() => {
7996
+ });
7997
+ }, [execution]);
7998
+ const onClick = React.useCallback(
7999
+ ({ key }) => {
8000
+ if (key != execution.id) {
8001
+ navigate(`/admin/settings/workflow/executions/${key}`);
8002
+ }
8003
+ },
8004
+ [execution]
8005
+ );
8006
+ return execution ? /* @__PURE__ */ jsxRuntimeExports.jsx(
8007
+ antd.Dropdown,
8008
+ {
8009
+ menu: {
8010
+ className: styles.executionsDropdownRowClass,
8011
+ onClick,
8012
+ items: [...executionsAfter, execution, ...executionsBefore].map((item) => {
8013
+ return {
8014
+ key: item.id,
8015
+ label: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: classnames("row", { current: item.id === execution.id }), children: [
8016
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "id", children: `#${item.id}` }),
8017
+ /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(item.createdAt).format("YYYY-MM-DD HH:mm:ss") })
8018
+ ] }),
8019
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: item.status })
8020
+ };
8021
+ })
8022
+ },
8023
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Space, { children: [
8024
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: `#${execution.id}` }),
8025
+ /* @__PURE__ */ jsxRuntimeExports.jsx(icons.DownOutlined, {})
8026
+ ] })
8027
+ }
8028
+ ) : null;
8029
+ }
6140
8030
  function ExecutionCanvas() {
6141
8031
  const compile = client.useCompile();
6142
8032
  const { data, loading } = client.useResourceActionContext();
@@ -6176,7 +8066,7 @@
6176
8066
  items: [
6177
8067
  { title: /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Link, { to: `/admin/settings/workflow/workflows`, children: lang("Workflow") }) },
6178
8068
  { title: /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Link, { to: `/admin/settings/workflow/workflows/${workflow.id}`, children: workflow.title }) },
6179
- { title: /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: `#${execution.id}` }) }
8069
+ { title: /* @__PURE__ */ jsxRuntimeExports.jsx(ExecutionsDropdown, {}) }
6180
8070
  ]
6181
8071
  }
6182
8072
  ) }),
@@ -6193,7 +8083,7 @@
6193
8083
  }
6194
8084
  const ExecutionPage = () => {
6195
8085
  const params = reactRouterDom.useParams();
6196
- const { styles } = useStyles();
8086
+ const { styles } = useStyles$1();
6197
8087
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: client.cx(styles.workflowPageClass), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6198
8088
  client.SchemaComponent,
6199
8089
  {
@@ -6228,55 +8118,6 @@
6228
8118
  }
6229
8119
  ) });
6230
8120
  };
6231
- var classnames$1 = { exports: {} };
6232
- /*!
6233
- Copyright (c) 2018 Jed Watson.
6234
- Licensed under the MIT License (MIT), see
6235
- http://jedwatson.github.io/classnames
6236
- */
6237
- (function(module2) {
6238
- (function() {
6239
- var hasOwn = {}.hasOwnProperty;
6240
- function classNames() {
6241
- var classes = [];
6242
- for (var i = 0; i < arguments.length; i++) {
6243
- var arg = arguments[i];
6244
- if (!arg)
6245
- continue;
6246
- var argType = typeof arg;
6247
- if (argType === "string" || argType === "number") {
6248
- classes.push(arg);
6249
- } else if (Array.isArray(arg)) {
6250
- if (arg.length) {
6251
- var inner = classNames.apply(null, arg);
6252
- if (inner) {
6253
- classes.push(inner);
6254
- }
6255
- }
6256
- } else if (argType === "object") {
6257
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
6258
- classes.push(arg.toString());
6259
- continue;
6260
- }
6261
- for (var key in arg) {
6262
- if (hasOwn.call(arg, key) && arg[key]) {
6263
- classes.push(key);
6264
- }
6265
- }
6266
- }
6267
- }
6268
- return classes.join(" ");
6269
- }
6270
- if (module2.exports) {
6271
- classNames.default = classNames;
6272
- module2.exports = classNames;
6273
- } else {
6274
- window.classNames = classNames;
6275
- }
6276
- })();
6277
- })(classnames$1);
6278
- var classnamesExports = classnames$1.exports;
6279
- const classnames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
6280
8121
  const ExecutionLink = () => {
6281
8122
  const { t } = reactI18next.useTranslation();
6282
8123
  const { id } = client.useRecord();
@@ -6366,10 +8207,32 @@
6366
8207
  }
6367
8208
  },
6368
8209
  properties: {
6369
- // filter: {
6370
- // type: 'object',
6371
- // 'x-component': 'Filter',
6372
- // }
8210
+ clear: {
8211
+ type: "void",
8212
+ title: '{{t("Clear")}}',
8213
+ "x-component": "Action",
8214
+ "x-component-props": {
8215
+ useAction() {
8216
+ const { t } = reactI18next.useTranslation();
8217
+ const { refresh, defaultRequest } = client.useResourceActionContext();
8218
+ const { resource } = client.useResourceContext();
8219
+ const { setVisible } = client.useActionContext();
8220
+ return {
8221
+ async run() {
8222
+ var _a;
8223
+ await resource.destroy({ filter: (_a = defaultRequest.params) == null ? void 0 : _a.filter });
8224
+ antd.message.success(t("Operation succeeded"));
8225
+ refresh();
8226
+ setVisible(false);
8227
+ }
8228
+ };
8229
+ },
8230
+ confirm: {
8231
+ title: `{{t("Clear all executions", { ns: "${NAMESPACE}" })}}`,
8232
+ content: `{{t("Clear executions will not reset executed count, and started executions will not be deleted, are you sure you want to delete them all?", { ns: "${NAMESPACE}" })}}`
8233
+ }
8234
+ }
8235
+ }
6373
8236
  }
6374
8237
  },
6375
8238
  table: {
@@ -6431,7 +8294,7 @@
6431
8294
  split: "|"
6432
8295
  },
6433
8296
  properties: {
6434
- config: {
8297
+ link: {
6435
8298
  type: "void",
6436
8299
  title: `{{t("Details", { ns: "${NAMESPACE}" })}}`,
6437
8300
  "x-component": "ExecutionLink"
@@ -6471,7 +8334,7 @@
6471
8334
  const { resource } = client.useResourceContext();
6472
8335
  const { setTitle } = client.useDocumentTitle();
6473
8336
  const [visible, setVisible] = React.useState(false);
6474
- const { styles } = useStyles();
8337
+ const { styles } = useStyles$1();
6475
8338
  const { modal } = antd.App.useApp();
6476
8339
  React.useEffect(() => {
6477
8340
  const { title } = (data == null ? void 0 : data.data) ?? {};
@@ -6569,20 +8432,15 @@
6569
8432
  items: revisions.sort((a, b2) => b2.id - a.id).map((item, index) => ({
6570
8433
  key: `${item.id}`,
6571
8434
  icon: item.current ? /* @__PURE__ */ jsxRuntimeExports.jsx(icons.RightOutlined, {}) : null,
6572
- label: /* @__PURE__ */ jsxRuntimeExports.jsxs(
6573
- "span",
6574
- {
6575
- className: classnames({
6576
- executed: item.executed,
6577
- unexecuted: !item.executed,
6578
- enabled: item.enabled
6579
- }),
6580
- children: [
6581
- /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: `#${item.id}` }),
6582
- /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: new Date(item.createdAt).toLocaleString() })
6583
- ]
6584
- }
6585
- )
8435
+ className: client.cx({
8436
+ executed: item.executed,
8437
+ unexecuted: !item.executed,
8438
+ enabled: item.enabled
8439
+ }),
8440
+ label: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
8441
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: `#${item.id}` }),
8442
+ /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(item.createdAt).format("YYYY-MM-DD HH:mm:ss") })
8443
+ ] })
6586
8444
  }))
6587
8445
  },
6588
8446
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Button, { type: "text", children: [
@@ -6634,7 +8492,7 @@
6634
8492
  }
6635
8493
  const WorkflowPage = () => {
6636
8494
  const params = reactRouterDom.useParams();
6637
- const { styles } = useStyles();
8495
+ const { styles } = useStyles$1();
6638
8496
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: client.cx(styles.workflowPageClass), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6639
8497
  client.SchemaComponent,
6640
8498
  {
@@ -6804,9 +8662,54 @@
6804
8662
  "x-component": "InputNumber",
6805
8663
  "x-decorator": "FormItem"
6806
8664
  }
8665
+ },
8666
+ {
8667
+ type: "object",
8668
+ name: "options"
6807
8669
  }
6808
8670
  ]
6809
8671
  };
8672
+ const workflowFieldset = {
8673
+ title: {
8674
+ "x-component": "CollectionField",
8675
+ "x-decorator": "FormItem"
8676
+ },
8677
+ type: {
8678
+ "x-component": "CollectionField",
8679
+ "x-decorator": "FormItem"
8680
+ },
8681
+ enabled: {
8682
+ "x-component": "CollectionField",
8683
+ "x-decorator": "FormItem"
8684
+ },
8685
+ description: {
8686
+ "x-component": "CollectionField",
8687
+ "x-decorator": "FormItem"
8688
+ },
8689
+ options: {
8690
+ type: "object",
8691
+ "x-component": "fieldset",
8692
+ properties: {
8693
+ // NOTE: not to expose this option for now, because hard to track errors
8694
+ // useTransaction: {
8695
+ // type: 'boolean',
8696
+ // title: `{{ t("Use transaction", { ns: "${NAMESPACE}" }) }}`,
8697
+ // description: `{{ t("Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.", { ns: "${NAMESPACE}" }) }}`,
8698
+ // 'x-decorator': 'FormItem',
8699
+ // 'x-component': 'Checkbox',
8700
+ // },
8701
+ deleteExecutionOnStatus: {
8702
+ type: "array",
8703
+ title: `{{ t("Auto delete history when execution is on end status", { ns: "${NAMESPACE}" }) }}`,
8704
+ "x-decorator": "FormItem",
8705
+ "x-component": "ExecutionStatusSelect",
8706
+ "x-component-props": {
8707
+ multiple: true
8708
+ }
8709
+ }
8710
+ }
8711
+ }
8712
+ };
6810
8713
  const workflowSchema = {
6811
8714
  type: "void",
6812
8715
  properties: {
@@ -6843,18 +8746,6 @@
6843
8746
  }
6844
8747
  },
6845
8748
  properties: {
6846
- delete: {
6847
- type: "void",
6848
- title: '{{t("Delete")}}',
6849
- "x-component": "Action",
6850
- "x-component-props": {
6851
- useAction: "{{ cm.useBulkDestroyAction }}",
6852
- confirm: {
6853
- title: "{{t('Delete record')}}",
6854
- content: "{{t('Are you sure you want to delete it?')}}"
6855
- }
6856
- }
6857
- },
6858
8749
  create: {
6859
8750
  type: "void",
6860
8751
  title: '{{t("Add new")}}',
@@ -6874,18 +8765,10 @@
6874
8765
  },
6875
8766
  title: '{{t("Add new")}}',
6876
8767
  properties: {
6877
- title: {
6878
- "x-component": "CollectionField",
6879
- "x-decorator": "FormItem"
6880
- },
6881
- type: {
6882
- "x-component": "CollectionField",
6883
- "x-decorator": "FormItem"
6884
- },
6885
- description: {
6886
- "x-component": "CollectionField",
6887
- "x-decorator": "FormItem"
6888
- },
8768
+ title: workflowFieldset.title,
8769
+ type: workflowFieldset.type,
8770
+ description: workflowFieldset.description,
8771
+ options: workflowFieldset.options,
6889
8772
  footer: {
6890
8773
  type: "void",
6891
8774
  "x-component": "Action.Drawer.Footer",
@@ -6910,6 +8793,39 @@
6910
8793
  }
6911
8794
  }
6912
8795
  }
8796
+ },
8797
+ sync: {
8798
+ type: "void",
8799
+ title: `{{t("Sync", { ns: "${NAMESPACE}" })}}`,
8800
+ "x-decorator": "Tooltip",
8801
+ "x-decorator-props": {
8802
+ title: `{{ t("Sync enabled status of all workflows from database", { ns: "${NAMESPACE}" }) }}`
8803
+ },
8804
+ "x-component": "Action",
8805
+ "x-component-props": {
8806
+ useAction() {
8807
+ const { t } = reactI18next.useTranslation();
8808
+ const { resource } = client.useResourceContext();
8809
+ return {
8810
+ async run() {
8811
+ await resource.sync();
8812
+ antd.message.success(t("Operation succeeded"));
8813
+ }
8814
+ };
8815
+ }
8816
+ }
8817
+ },
8818
+ delete: {
8819
+ type: "void",
8820
+ title: '{{t("Delete")}}',
8821
+ "x-component": "Action",
8822
+ "x-component-props": {
8823
+ useAction: "{{ cm.useBulkDestroyAction }}",
8824
+ confirm: {
8825
+ title: "{{t('Delete record')}}",
8826
+ content: "{{t('Are you sure you want to delete it?')}}"
8827
+ }
8828
+ }
6913
8829
  }
6914
8830
  }
6915
8831
  },
@@ -6992,7 +8908,7 @@
6992
8908
  split: "|"
6993
8909
  },
6994
8910
  properties: {
6995
- config: {
8911
+ view: {
6996
8912
  type: "void",
6997
8913
  "x-component": "WorkflowLink"
6998
8914
  },
@@ -7013,18 +8929,10 @@
7013
8929
  },
7014
8930
  title: '{{ t("Edit") }}',
7015
8931
  properties: {
7016
- title: {
7017
- "x-component": "CollectionField",
7018
- "x-decorator": "FormItem"
7019
- },
7020
- enabled: {
7021
- "x-component": "CollectionField",
7022
- "x-decorator": "FormItem"
7023
- },
7024
- description: {
7025
- "x-component": "CollectionField",
7026
- "x-decorator": "FormItem"
7027
- },
8932
+ title: workflowFieldset.title,
8933
+ enabled: workflowFieldset.enabled,
8934
+ description: workflowFieldset.description,
8935
+ options: workflowFieldset.options,
7028
8936
  footer: {
7029
8937
  type: "void",
7030
8938
  "x-component": "Action.Drawer.Footer",
@@ -7055,33 +8963,75 @@
7055
8963
  title: `{{t("Duplicate", { ns: "${NAMESPACE}" })}}`,
7056
8964
  "x-component": "Action.Link",
7057
8965
  "x-component-props": {
7058
- useAction() {
7059
- const { t } = reactI18next.useTranslation();
7060
- const { refresh } = client.useResourceActionContext();
7061
- const { resource, targetKey } = client.useResourceContext();
7062
- const { [targetKey]: filterByTk } = client.useRecord();
7063
- return {
7064
- async run() {
7065
- await resource.revision({ filterByTk });
7066
- antd.message.success(t("Operation succeeded"));
7067
- refresh();
8966
+ openSize: "small"
8967
+ },
8968
+ properties: {
8969
+ modal: {
8970
+ type: "void",
8971
+ title: `{{t("Duplicate to new workflow", { ns: "${NAMESPACE}" })}}`,
8972
+ "x-decorator": "FormV2",
8973
+ "x-component": "Action.Modal",
8974
+ properties: {
8975
+ title: {
8976
+ type: "string",
8977
+ title: '{{t("Title")}}',
8978
+ "x-decorator": "FormItem",
8979
+ "x-component": "Input"
8980
+ },
8981
+ footer: {
8982
+ type: "void",
8983
+ "x-component": "Action.Modal.Footer",
8984
+ properties: {
8985
+ submit: {
8986
+ type: "void",
8987
+ title: '{{t("Submit")}}',
8988
+ "x-component": "Action",
8989
+ "x-component-props": {
8990
+ type: "primary",
8991
+ useAction() {
8992
+ const { t } = reactI18next.useTranslation();
8993
+ const { refresh } = client.useResourceActionContext();
8994
+ const { resource, targetKey } = client.useResourceContext();
8995
+ const { setVisible } = client.useActionContext();
8996
+ const { [targetKey]: filterByTk } = client.useRecord();
8997
+ const { values: values2 } = react.useForm();
8998
+ return {
8999
+ async run() {
9000
+ await resource.revision({ filterByTk, values: values2 });
9001
+ antd.message.success(t("Operation succeeded"));
9002
+ refresh();
9003
+ setVisible(false);
9004
+ }
9005
+ };
9006
+ }
9007
+ }
9008
+ },
9009
+ cancel: {
9010
+ type: "void",
9011
+ title: '{{t("Cancel")}}',
9012
+ "x-component": "Action",
9013
+ "x-component-props": {
9014
+ useAction: "{{ cm.useCancelAction }}"
9015
+ }
9016
+ }
9017
+ }
7068
9018
  }
7069
- };
9019
+ }
7070
9020
  }
7071
9021
  }
9022
+ },
9023
+ delete: {
9024
+ type: "void",
9025
+ title: '{{ t("Delete") }}',
9026
+ "x-component": "Action.Link",
9027
+ "x-component-props": {
9028
+ confirm: {
9029
+ title: "{{t('Delete record')}}",
9030
+ content: "{{t('Are you sure you want to delete it?')}}"
9031
+ },
9032
+ useAction: "{{ cm.useDestroyActionAndRefreshCM }}"
9033
+ }
7072
9034
  }
7073
- // delete: {
7074
- // type: 'void',
7075
- // title: '{{ t("Delete") }}',
7076
- // 'x-component': 'Action.Link',
7077
- // 'x-component-props': {
7078
- // confirm: {
7079
- // title: "{{t('Delete record')}}",
7080
- // content: "{{t('Are you sure you want to delete it?')}}",
7081
- // },
7082
- // useAction: '{{ cm.useDestroyActionAndRefreshCM }}',
7083
- // },
7084
- // },
7085
9035
  }
7086
9036
  }
7087
9037
  }
@@ -7092,6 +9042,28 @@
7092
9042
  }
7093
9043
  }
7094
9044
  };
9045
+ function LabelTag(props) {
9046
+ const compile = client.useCompile();
9047
+ const label = compile(props.label);
9048
+ const onPreventMouseDown = React.useCallback((event) => {
9049
+ event.preventDefault();
9050
+ event.stopPropagation();
9051
+ }, []);
9052
+ const { color } = ExecutionStatusOptionsMap[props.value] ?? {};
9053
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, onMouseDown: onPreventMouseDown, closable: props.closable, onClose: props.onClose, children: label });
9054
+ }
9055
+ function ExecutionStatusOption(props) {
9056
+ const compile = client.useCompile();
9057
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9058
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LabelTag, { ...props }),
9059
+ props.description ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: compile(props.description) }) : null
9060
+ ] });
9061
+ }
9062
+ function ExecutionStatusSelect({ ...props }) {
9063
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select, { ...props, mode: props.multiple ? "multiple" : null, optionLabelProp: "label", tagRender: LabelTag, children: ExecutionStatusOptions.filter((item) => Boolean(item.value) && item.value !== EXECUTION_STATUS.ABORTED).map(
9064
+ (option) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { ...option, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ExecutionStatusOption, { ...option }) }, option.value)
9065
+ ) });
9066
+ }
7095
9067
  const WorkflowContext = React.createContext({});
7096
9068
  function WorkflowPane() {
7097
9069
  return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { bordered: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -7099,10 +9071,12 @@
7099
9071
  {
7100
9072
  schema: workflowSchema,
7101
9073
  components: {
9074
+ Tooltip: antd.Tooltip,
7102
9075
  WorkflowLink,
7103
9076
  ExecutionResourceProvider,
7104
9077
  ExecutionLink,
7105
- OpenDrawer
9078
+ OpenDrawer,
9079
+ ExecutionStatusSelect
7106
9080
  }
7107
9081
  }
7108
9082
  ) });
@@ -7754,12 +9728,13 @@
7754
9728
  class WorkflowPlugin extends client.Plugin {
7755
9729
  async load() {
7756
9730
  this.addRoutes();
9731
+ this.addScopes();
7757
9732
  this.addComponents();
7758
9733
  this.app.use(WorkflowProvider);
7759
9734
  }
7760
9735
  addScopes() {
7761
9736
  this.app.addScopes({
7762
- useCollectionDataSource: client.useCollectionDataSource
9737
+ useTriggerWorkflowsActionProps
7763
9738
  });
7764
9739
  }
7765
9740
  addComponents() {