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

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 +2268 -319
  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 +33 -0
  16. package/dist/locale/zh-CN.js +33 -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 +89 -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,
@@ -767,10 +827,1380 @@
767
827
  },
768
828
  "x-reactions": [
769
829
  {
770
- dependencies: ["collection"],
830
+ dependencies: ["collection"],
831
+ fulfill: {
832
+ state: {
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"],
771
2201
  fulfill: {
772
2202
  state: {
773
- visible: "{{!!$deps[0]}}"
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();
@@ -837,6 +2255,102 @@
837
2255
  },
838
2256
  initializers: {}
839
2257
  };
2258
+ function getFormValues(filterByTk, field, form, fieldNames, getField, resource) {
2259
+ var _a;
2260
+ if (filterByTk) {
2261
+ const actionFields = (_a = field == null ? void 0 : field.data) == null ? void 0 : _a.activeFields;
2262
+ if (actionFields) {
2263
+ const keys2 = Object.keys(form.values).filter((key) => {
2264
+ const f2 = getField(key);
2265
+ return !actionFields.has(key) && ["hasOne", "hasMany", "belongsTo", "belongsToMany"].includes(f2 == null ? void 0 : f2.type);
2266
+ });
2267
+ return omit$1({ ...form.values }, keys2);
2268
+ }
2269
+ }
2270
+ return form.values;
2271
+ }
2272
+ function useTriggerWorkflowsActionProps() {
2273
+ var _a;
2274
+ const api = client.useAPIClient();
2275
+ const form = react.useForm();
2276
+ const { field, resource, __parent } = client.useBlockRequestContext();
2277
+ const { setVisible, fieldSchema } = client.useActionContext();
2278
+ const navigate = reactRouterDom.useNavigate();
2279
+ const actionSchema = react.useFieldSchema();
2280
+ const actionField = react.useField();
2281
+ const { fields, getField, getTreeParentField } = client.useCollection();
2282
+ const compile = client.useCompile();
2283
+ const filterByTk = client.useFilterByTk();
2284
+ const currentRecord = client.useRecord();
2285
+ const currentUserContext = client.useCurrentUserContext();
2286
+ const { modal } = antd.App.useApp();
2287
+ const currentUser = (_a = currentUserContext == null ? void 0 : currentUserContext.data) == null ? void 0 : _a.data;
2288
+ const filterKeys = actionField.componentProps.filterKeys || [];
2289
+ return {
2290
+ async onClick() {
2291
+ var _a2, _b, _c;
2292
+ const fieldNames = fields.map((field2) => field2.name);
2293
+ const {
2294
+ assignedValues: originalAssignedValues = {},
2295
+ onSuccess,
2296
+ overwriteValues,
2297
+ skipValidator,
2298
+ triggerWorkflows
2299
+ } = (actionSchema == null ? void 0 : actionSchema["x-action-settings"]) ?? {};
2300
+ const addChild = (_a2 = fieldSchema == null ? void 0 : fieldSchema["x-component-props"]) == null ? void 0 : _a2.addChild;
2301
+ const assignedValues = client$1.parse(originalAssignedValues)({ currentTime: /* @__PURE__ */ new Date(), currentRecord, currentUser });
2302
+ if (!skipValidator) {
2303
+ await form.submit();
2304
+ }
2305
+ const values2 = getFormValues(filterByTk, field, form, fieldNames, getField);
2306
+ if (addChild) {
2307
+ const treeParentField = getTreeParentField();
2308
+ values2[(treeParentField == null ? void 0 : treeParentField.name) ?? "parent"] = currentRecord;
2309
+ values2[(treeParentField == null ? void 0 : treeParentField.foreignKey) ?? "parentId"] = currentRecord.id;
2310
+ }
2311
+ actionField.data = field.data || {};
2312
+ actionField.data.loading = true;
2313
+ try {
2314
+ const data = await api.resource("workflows").trigger({
2315
+ values: {
2316
+ ...values2,
2317
+ ...overwriteValues,
2318
+ ...assignedValues
2319
+ },
2320
+ filterKeys,
2321
+ // TODO(refactor): should change to inject by plugin
2322
+ triggerWorkflows: (triggerWorkflows == null ? void 0 : triggerWorkflows.length) ? triggerWorkflows.map((row) => [row.workflowKey, row.context].filter(Boolean).join("!")).join(",") : void 0
2323
+ });
2324
+ actionField.data.loading = false;
2325
+ actionField.data.data = data;
2326
+ (_c = (_b = __parent == null ? void 0 : __parent.service) == null ? void 0 : _b.refresh) == null ? void 0 : _c.call(_b);
2327
+ setVisible == null ? void 0 : setVisible(false);
2328
+ if (!(onSuccess == null ? void 0 : onSuccess.successMessage)) {
2329
+ return;
2330
+ }
2331
+ if (onSuccess == null ? void 0 : onSuccess.manualClose) {
2332
+ modal.success({
2333
+ title: compile(onSuccess == null ? void 0 : onSuccess.successMessage),
2334
+ onOk: async () => {
2335
+ await form.reset();
2336
+ if ((onSuccess == null ? void 0 : onSuccess.redirecting) && (onSuccess == null ? void 0 : onSuccess.redirectTo)) {
2337
+ if (client$1.isURL(onSuccess.redirectTo)) {
2338
+ window.location.href = onSuccess.redirectTo;
2339
+ } else {
2340
+ navigate(onSuccess.redirectTo);
2341
+ }
2342
+ }
2343
+ }
2344
+ });
2345
+ } else {
2346
+ antd.message.success(compile(onSuccess == null ? void 0 : onSuccess.successMessage));
2347
+ }
2348
+ } catch (error) {
2349
+ actionField.data.loading = false;
2350
+ }
2351
+ }
2352
+ };
2353
+ }
840
2354
  const SCHEDULE_MODE = {
841
2355
  STATIC: 0,
842
2356
  COLLECTION_FIELD: 1
@@ -1733,6 +3247,7 @@
1733
3247
  const schedule = {
1734
3248
  title: `{{t("Schedule event", { ns: "${NAMESPACE}" })}}`,
1735
3249
  type: "schedule",
3250
+ description: `{{t("Event will be scheduled and triggered base on time conditions.", { ns: "${NAMESPACE}" })}}`,
1736
3251
  fieldset: {
1737
3252
  config: {
1738
3253
  type: "void",
@@ -1819,12 +3334,13 @@
1819
3334
  };
1820
3335
  }
1821
3336
  const triggers = new client$1.Registry();
3337
+ triggers.register(formTrigger.type, formTrigger);
1822
3338
  triggers.register(collection$1.type, collection$1);
1823
3339
  triggers.register(schedule.type, schedule);
1824
3340
  function TriggerExecution() {
1825
3341
  const compile = client.useCompile();
1826
3342
  const { workflow, execution } = useFlowContext();
1827
- const { styles } = useStyles();
3343
+ const { styles } = useStyles$1();
1828
3344
  if (!execution) {
1829
3345
  return null;
1830
3346
  }
@@ -1892,11 +3408,11 @@
1892
3408
  }
1893
3409
  const TriggerConfig = () => {
1894
3410
  const api = client.useAPIClient();
1895
- const compile = client.useCompile();
3411
+ client.useCompile();
1896
3412
  const { workflow, refresh } = useFlowContext();
1897
3413
  const [editingTitle, setEditingTitle] = React.useState("");
1898
3414
  const [editingConfig, setEditingConfig] = React.useState(false);
1899
- const { styles } = useStyles();
3415
+ const { styles } = useStyles$1();
1900
3416
  let typeTitle = "";
1901
3417
  React.useEffect(() => {
1902
3418
  if (workflow) {
@@ -1919,7 +3435,7 @@
1919
3435
  const { fieldset, scope, components } = trigger;
1920
3436
  typeTitle = trigger.title;
1921
3437
  const detailText = executed ? '{{t("View")}}' : '{{t("Configure")}}';
1922
- const titleText = `${lang("Trigger")}: ${compile(typeTitle)}`;
3438
+ const titleText = lang("Trigger");
1923
3439
  async function onChangeTitle(next) {
1924
3440
  var _a, _b;
1925
3441
  const t = next || typeTitle;
@@ -2000,6 +3516,16 @@
2000
3516
  `
2001
3517
  }
2002
3518
  }
3519
+ } : trigger.description ? {
3520
+ description: {
3521
+ type: "void",
3522
+ "x-component": DrawerDescription,
3523
+ "x-component-props": {
3524
+ label: lang("Trigger type"),
3525
+ title: trigger.title,
3526
+ description: trigger.description
3527
+ }
3528
+ }
2003
3529
  } : {},
2004
3530
  fieldset: {
2005
3531
  type: "void",
@@ -2257,11 +3783,11 @@
2257
3783
  return otherFields.filter((field) => field.interface && !field.hidden);
2258
3784
  }
2259
3785
  async function loadChildren(option) {
2260
- var _a;
3786
+ const appends2 = getNextAppends(option.field, option.appends);
2261
3787
  const result = getCollectionFieldOptions({
2262
3788
  collection: option.field.target,
2263
3789
  types: option.types,
2264
- appends: getNextAppends(option.field, option.appends),
3790
+ appends: appends2,
2265
3791
  ...this
2266
3792
  });
2267
3793
  option.loadChildren = null;
@@ -2269,14 +3795,22 @@
2269
3795
  option.children = result;
2270
3796
  } else {
2271
3797
  option.isLeaf = true;
2272
- const matchingType = (_a = option.types) == null ? void 0 : _a.some((type) => matchFieldType(option.field, type, 0));
3798
+ const matchingType = option.types ? option.types.some((type) => matchFieldType(option.field, type, appends2)) : true;
2273
3799
  if (!matchingType) {
2274
3800
  option.disabled = true;
2275
3801
  }
2276
3802
  }
2277
3803
  }
2278
3804
  function getCollectionFieldOptions(options) {
2279
- const { fields, collection: collection2, types, appends: appends2 = [], compile, getCollectionFields, fieldNames = defaultFieldNames } = options;
3805
+ const {
3806
+ fields,
3807
+ collection: collection2,
3808
+ types,
3809
+ appends: appends2 = [],
3810
+ compile,
3811
+ getCollectionFields,
3812
+ fieldNames = defaultFieldNames
3813
+ } = options;
2280
3814
  const normalizedFields = getNormalizedFields(collection2, { compile, getCollectionFields });
2281
3815
  const computedFields = fields ?? normalizedFields;
2282
3816
  const boundLoadChildren = loadChildren.bind({ compile, getCollectionFields, fieldNames });
@@ -2367,13 +3901,11 @@
2367
3901
  ValueBlock.Result = Result$1;
2368
3902
  function matchToManyField(field, appends2) {
2369
3903
  const fieldPrefix = `${field.name}.`;
2370
- return ["hasMany", "belongsToMany"].includes(field.type) && (appends2.includes(field.name) || appends2.some((item) => item.startsWith(fieldPrefix)));
3904
+ return ["hasMany", "belongsToMany"].includes(field.type) && (appends2 ? appends2.includes(field.name) || appends2.some((item) => item.startsWith(fieldPrefix)) : true);
2371
3905
  }
2372
- function AssociatedConfig({ value, onChange, ...props }) {
2373
- const { setValuesIn } = react.useForm();
3906
+ function useAssociatedFields() {
2374
3907
  const compile = client.useCompile();
2375
- const { getCollection } = client.useCollectionManager();
2376
- const options = [nodesOptions, triggerOptions].map((item) => {
3908
+ return [nodesOptions, triggerOptions].map((item) => {
2377
3909
  var _a;
2378
3910
  const children = (_a = item.useOptions({ types: [matchToManyField] })) == null ? void 0 : _a.filter(Boolean);
2379
3911
  return {
@@ -2384,12 +3916,52 @@
2384
3916
  disabled: children && !children.length
2385
3917
  };
2386
3918
  });
3919
+ }
3920
+ function AssociatedConfig({ value, onChange, ...props }) {
3921
+ const { setValuesIn } = react.useForm();
3922
+ const { getCollection } = client.useCollectionManager();
3923
+ const baseOptions = useAssociatedFields();
3924
+ const [options, setOptions] = React.useState(baseOptions);
2387
3925
  const { associatedKey = "", name: fieldName } = value ?? {};
2388
3926
  let p2 = [];
2389
3927
  const matched = associatedKey.match(/^{{(.*)}}$/);
2390
3928
  if (matched) {
2391
3929
  p2 = [...matched[1].trim().split(".").slice(0, -1), fieldName];
2392
3930
  }
3931
+ const loadData = async (selectedOptions) => {
3932
+ var _a;
3933
+ const option = selectedOptions[selectedOptions.length - 1];
3934
+ if (!((_a = option.children) == null ? void 0 : _a.length) && !option.isLeaf && option.loadChildren) {
3935
+ await option.loadChildren(option);
3936
+ setOptions((prev) => [...prev]);
3937
+ }
3938
+ };
3939
+ React.useEffect(() => {
3940
+ const run = async () => {
3941
+ var _a;
3942
+ if (!p2 || options.length <= 1) {
3943
+ return;
3944
+ }
3945
+ let prevOption = null;
3946
+ for (let i = 0; i < p2.length; i++) {
3947
+ const key = p2[i];
3948
+ try {
3949
+ if (i === 0) {
3950
+ prevOption = options.find((item) => item.value === key);
3951
+ } else {
3952
+ if (prevOption.loadChildren && !((_a = prevOption.children) == null ? void 0 : _a.length)) {
3953
+ await prevOption.loadChildren(prevOption);
3954
+ }
3955
+ prevOption = prevOption.children.find((item) => item.value === key);
3956
+ }
3957
+ } catch (err) {
3958
+ console.error(err);
3959
+ }
3960
+ }
3961
+ setOptions([...options]);
3962
+ };
3963
+ run();
3964
+ }, [value, options.length]);
2393
3965
  const onSelectChange = React.useCallback(
2394
3966
  (path, option) => {
2395
3967
  if (!(path == null ? void 0 : path.length)) {
@@ -2412,7 +3984,7 @@
2412
3984
  },
2413
3985
  [onChange]
2414
3986
  );
2415
- return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Cascader, { ...props, value: p2, options, onChange: onSelectChange });
3987
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Cascader, { ...props, value: p2, options, onChange: onSelectChange, loadData });
2416
3988
  }
2417
3989
  const aggregate = {
2418
3990
  title: `{{t("Aggregate", { ns: "${NAMESPACE}" })}}`,
@@ -3249,7 +4821,7 @@
3249
4821
  component: function Component({ data }) {
3250
4822
  const { t } = reactI18next.useTranslation();
3251
4823
  const { nodes } = useFlowContext();
3252
- const { styles } = useStyles();
4824
+ const { styles } = useStyles$1();
3253
4825
  const {
3254
4826
  id,
3255
4827
  config: { rejectOnFalse }
@@ -3535,6 +5107,122 @@
3535
5107
  }
3536
5108
  );
3537
5109
  }
5110
+ const EXECUTION_STATUS = {
5111
+ QUEUEING: null,
5112
+ STARTED: 0,
5113
+ RESOLVED: 1,
5114
+ FAILED: -1,
5115
+ ERROR: -2,
5116
+ ABORTED: -3,
5117
+ CANCELED: -4,
5118
+ REJECTED: -5
5119
+ };
5120
+ const ExecutionStatusOptions = [
5121
+ {
5122
+ value: EXECUTION_STATUS.QUEUEING,
5123
+ label: `{{t("Queueing", { ns: "${NAMESPACE}" })}}`,
5124
+ color: "blue",
5125
+ description: `{{t("Triggered but still waiting in queue to execute.", { ns: "${NAMESPACE}" })}}`
5126
+ },
5127
+ {
5128
+ value: EXECUTION_STATUS.STARTED,
5129
+ label: `{{t("On going", { ns: "${NAMESPACE}" })}}`,
5130
+ color: "gold",
5131
+ description: `{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${NAMESPACE}" })}}`
5132
+ },
5133
+ {
5134
+ value: EXECUTION_STATUS.RESOLVED,
5135
+ label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
5136
+ color: "green",
5137
+ description: `{{t("Successfully finished.", { ns: "${NAMESPACE}" })}}`
5138
+ },
5139
+ {
5140
+ value: EXECUTION_STATUS.FAILED,
5141
+ label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
5142
+ color: "red",
5143
+ description: `{{t("Failed to satisfy node configurations.", { ns: "${NAMESPACE}" })}}`
5144
+ },
5145
+ {
5146
+ value: EXECUTION_STATUS.ERROR,
5147
+ label: `{{t("Error", { ns: "${NAMESPACE}" })}}`,
5148
+ color: "red",
5149
+ description: `{{t("Some node meets error.", { ns: "${NAMESPACE}" })}}`
5150
+ },
5151
+ {
5152
+ value: EXECUTION_STATUS.ABORTED,
5153
+ label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
5154
+ color: "red",
5155
+ description: `{{t("Running of some node was aborted by program flow.", { ns: "${NAMESPACE}" })}}`
5156
+ },
5157
+ {
5158
+ value: EXECUTION_STATUS.CANCELED,
5159
+ label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
5160
+ color: "volcano",
5161
+ description: `{{t("Manually canceled whole execution when waiting.", { ns: "${NAMESPACE}" })}}`
5162
+ },
5163
+ {
5164
+ value: EXECUTION_STATUS.REJECTED,
5165
+ label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
5166
+ color: "volcano",
5167
+ description: `{{t("Rejected from a manual node.", { ns: "${NAMESPACE}" })}}`
5168
+ }
5169
+ ];
5170
+ const ExecutionStatusOptionsMap = ExecutionStatusOptions.reduce(
5171
+ (map, option) => Object.assign(map, { [option.value]: option }),
5172
+ {}
5173
+ );
5174
+ const JOB_STATUS = {
5175
+ PENDING: 0,
5176
+ RESOLVED: 1,
5177
+ FAILED: -1,
5178
+ ERROR: -2,
5179
+ ABORTED: -3,
5180
+ CANCELED: -4,
5181
+ REJECTED: -5
5182
+ };
5183
+ const JobStatusOptions = [
5184
+ {
5185
+ value: JOB_STATUS.PENDING,
5186
+ label: `{{t("Pending", { ns: "${NAMESPACE}" })}}`,
5187
+ color: "gold",
5188
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ClockCircleOutlined, {})
5189
+ },
5190
+ {
5191
+ value: JOB_STATUS.RESOLVED,
5192
+ label: `{{t("Resolved", { ns: "${NAMESPACE}" })}}`,
5193
+ color: "green",
5194
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CheckOutlined, {})
5195
+ },
5196
+ {
5197
+ value: JOB_STATUS.FAILED,
5198
+ label: `{{t("Failed", { ns: "${NAMESPACE}" })}}`,
5199
+ color: "red",
5200
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.ExclamationOutlined, {})
5201
+ },
5202
+ { value: JOB_STATUS.ERROR, label: `{{t("Error", { ns: "${NAMESPACE}" })}}`, color: "red", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.CloseOutlined, {}) },
5203
+ {
5204
+ value: JOB_STATUS.ABORTED,
5205
+ label: `{{t("Aborted", { ns: "${NAMESPACE}" })}}`,
5206
+ color: "red",
5207
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 90 })
5208
+ },
5209
+ {
5210
+ value: JOB_STATUS.CANCELED,
5211
+ label: `{{t("Canceled", { ns: "${NAMESPACE}" })}}`,
5212
+ color: "volcano",
5213
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, { rotate: 45 })
5214
+ },
5215
+ {
5216
+ value: JOB_STATUS.REJECTED,
5217
+ label: `{{t("Rejected", { ns: "${NAMESPACE}" })}}`,
5218
+ color: "volcano",
5219
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(icons.MinusOutlined, {})
5220
+ }
5221
+ ];
5222
+ const JobStatusOptionsMap = JobStatusOptions.reduce(
5223
+ (map, option) => Object.assign(map, { [option.value]: option }),
5224
+ {}
5225
+ );
3538
5226
  const delay = {
3539
5227
  title: `{{t("Delay", { ns: "${NAMESPACE}" })}}`,
3540
5228
  type: "delay",
@@ -3677,7 +5365,7 @@
3677
5365
  view: {},
3678
5366
  component: function Component({ data }) {
3679
5367
  const { nodes } = useFlowContext();
3680
- const { styles } = useStyles();
5368
+ const { styles } = useStyles$1();
3681
5369
  const entry = nodes.find((node) => node.upstreamId === data.id && node.branchIndex != null);
3682
5370
  return /* @__PURE__ */ jsxRuntimeExports.jsx(NodeDefaultView, { data, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.nodeSubtreeClass, children: [
3683
5371
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -3940,10 +5628,10 @@
3940
5628
  components: {
3941
5629
  CreateFormDesigner
3942
5630
  },
3943
- parseFormOptions(root) {
5631
+ parseFormOptions(root2) {
3944
5632
  const forms = {};
3945
5633
  const formBlocks = findSchema(
3946
- root,
5634
+ root2,
3947
5635
  (item) => item["x-decorator"] === "FormBlockProvider" && item["x-decorator-props"].formType === "create"
3948
5636
  );
3949
5637
  formBlocks.forEach((formBlock) => {
@@ -4292,9 +5980,9 @@
4292
5980
  components: {
4293
5981
  CustomFormBlockProvider
4294
5982
  },
4295
- parseFormOptions(root) {
5983
+ parseFormOptions(root2) {
4296
5984
  const forms = {};
4297
- const formBlocks = findSchema(root, (item) => item["x-decorator"] === "CustomFormBlockProvider");
5985
+ const formBlocks = findSchema(root2, (item) => item["x-decorator"] === "CustomFormBlockProvider");
4298
5986
  formBlocks.forEach((formBlock) => {
4299
5987
  var _a;
4300
5988
  const [formKey] = Object.keys(formBlock.properties);
@@ -4420,10 +6108,10 @@
4420
6108
  FilterDynamicComponent,
4421
6109
  UpdateFormDesigner
4422
6110
  },
4423
- parseFormOptions(root) {
6111
+ parseFormOptions(root2) {
4424
6112
  const forms = {};
4425
6113
  const formBlocks = findSchema(
4426
- root,
6114
+ root2,
4427
6115
  (item) => item["x-decorator"] === "FormBlockProvider" && item["x-decorator-props"].formType === "update"
4428
6116
  );
4429
6117
  formBlocks.forEach((formBlock) => {
@@ -4909,8 +6597,14 @@
4909
6597
  }
4910
6598
  );
4911
6599
  }
6600
+ function isUserKeyField(field) {
6601
+ if (field.isForeignKey) {
6602
+ return field.target === "users";
6603
+ }
6604
+ return field.collectionName === "users" && field.name === "id";
6605
+ }
4912
6606
  function AssigneesSelect({ multiple = false, value = [], onChange }) {
4913
- const scope = useWorkflowVariableOptions({ types: [{ type: "reference", options: { collection: "users" } }] });
6607
+ const scope = useWorkflowVariableOptions({ types: [isUserKeyField] });
4914
6608
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
4915
6609
  client.Variable.Input,
4916
6610
  {
@@ -5101,7 +6795,7 @@
5101
6795
  },
5102
6796
  view: {},
5103
6797
  component: function Component({ data }) {
5104
- const { styles } = useStyles();
6798
+ const { styles } = useStyles$1();
5105
6799
  const {
5106
6800
  id,
5107
6801
  config: { mode }
@@ -5201,31 +6895,69 @@
5201
6895
  collection: collection$2,
5202
6896
  multiple: {
5203
6897
  type: "boolean",
5204
- title: `{{t("Allow multiple records as result", { ns: "${NAMESPACE}" })}}`,
5205
6898
  "x-decorator": "FormItem",
5206
6899
  "x-component": "Checkbox",
6900
+ "x-content": `{{t("Allow multiple records as result", { ns: "${NAMESPACE}" })}}`,
5207
6901
  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
6902
  },
5209
6903
  params: {
5210
6904
  type: "object",
6905
+ "x-component": "fieldset",
5211
6906
  properties: {
5212
6907
  filter,
6908
+ sort,
6909
+ pagination,
5213
6910
  appends
5214
- }
6911
+ },
6912
+ "x-reactions": [
6913
+ {
6914
+ dependencies: ["collection"],
6915
+ fulfill: {
6916
+ state: {
6917
+ visible: "{{$deps[0] != null}}"
6918
+ }
6919
+ }
6920
+ }
6921
+ ]
5215
6922
  },
5216
6923
  failOnEmpty: {
5217
6924
  type: "boolean",
5218
- title: `{{t("Exit when query result is null", { ns: "${NAMESPACE}" })}}`,
5219
6925
  "x-decorator": "FormItem",
5220
- "x-component": "Checkbox"
6926
+ "x-component": "Checkbox",
6927
+ "x-content": `{{t("Exit when query result is null", { ns: "${NAMESPACE}" })}}`
5221
6928
  }
5222
6929
  },
5223
6930
  view: {},
5224
6931
  scope: {
5225
- useCollectionDataSource: client.useCollectionDataSource
6932
+ useCollectionDataSource: client.useCollectionDataSource,
6933
+ useWorkflowVariableOptions,
6934
+ useSortableFields() {
6935
+ const compile = client.useCompile();
6936
+ const { getCollectionFields, getInterface } = client.useCollectionManager();
6937
+ const { values: values2 } = react.useForm();
6938
+ const fields = getCollectionFields(values2.collection);
6939
+ return fields.filter((field) => {
6940
+ if (!field.interface) {
6941
+ return false;
6942
+ }
6943
+ const fieldInterface = getInterface(field.interface);
6944
+ if (fieldInterface == null ? void 0 : fieldInterface.sortable) {
6945
+ return true;
6946
+ }
6947
+ return false;
6948
+ }).map((field) => {
6949
+ var _a, _b;
6950
+ return {
6951
+ value: field.name,
6952
+ 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
6953
+ };
6954
+ });
6955
+ }
5226
6956
  },
5227
6957
  components: {
5228
- FilterDynamicComponent
6958
+ ArrayItems: antdV5.ArrayItems,
6959
+ FilterDynamicComponent,
6960
+ SchemaComponentContext: client.SchemaComponentContext
5229
6961
  },
5230
6962
  useVariables({ id, title, config }, options) {
5231
6963
  var _a, _b;
@@ -5533,29 +7265,94 @@
5533
7265
  ["x-validator"](value) {
5534
7266
  return isValidFilter(value) ? "" : lang("Please add at least one condition");
5535
7267
  }
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);
7268
+ },
7269
+ values: {
7270
+ ...values,
7271
+ "x-component-props": {
7272
+ filter(field) {
7273
+ var _a;
7274
+ return ((_a = this.params) == null ? void 0 : _a.individualHooks) || !["hasOne", "hasMany", "belongsToMany"].includes(field.type);
7275
+ }
7276
+ }
7277
+ }
7278
+ }
7279
+ }
7280
+ },
7281
+ view: {},
7282
+ scope: {
7283
+ useCollectionDataSource: client.useCollectionDataSource
7284
+ },
7285
+ components: {
7286
+ FilterDynamicComponent,
7287
+ CollectionFieldset: CollectionFieldSet,
7288
+ IndividualHooksRadioWithTooltip
7289
+ }
7290
+ };
7291
+ var classnames$1 = { exports: {} };
7292
+ /*!
7293
+ Copyright (c) 2018 Jed Watson.
7294
+ Licensed under the MIT License (MIT), see
7295
+ http://jedwatson.github.io/classnames
7296
+ */
7297
+ (function(module2) {
7298
+ (function() {
7299
+ var hasOwn = {}.hasOwnProperty;
7300
+ function classNames() {
7301
+ var classes = [];
7302
+ for (var i = 0; i < arguments.length; i++) {
7303
+ var arg = arguments[i];
7304
+ if (!arg)
7305
+ continue;
7306
+ var argType = typeof arg;
7307
+ if (argType === "string" || argType === "number") {
7308
+ classes.push(arg);
7309
+ } else if (Array.isArray(arg)) {
7310
+ if (arg.length) {
7311
+ var inner = classNames.apply(null, arg);
7312
+ if (inner) {
7313
+ classes.push(inner);
7314
+ }
7315
+ }
7316
+ } else if (argType === "object") {
7317
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
7318
+ classes.push(arg.toString());
7319
+ continue;
7320
+ }
7321
+ for (var key in arg) {
7322
+ if (hasOwn.call(arg, key) && arg[key]) {
7323
+ classes.push(key);
5543
7324
  }
5544
7325
  }
5545
7326
  }
5546
7327
  }
7328
+ return classes.join(" ");
5547
7329
  }
5548
- },
5549
- view: {},
5550
- scope: {
5551
- useCollectionDataSource: client.useCollectionDataSource
5552
- },
5553
- components: {
5554
- FilterDynamicComponent,
5555
- CollectionFieldset: CollectionFieldSet,
5556
- IndividualHooksRadioWithTooltip
5557
- }
5558
- };
7330
+ if (module2.exports) {
7331
+ classNames.default = classNames;
7332
+ module2.exports = classNames;
7333
+ } else {
7334
+ window.classNames = classNames;
7335
+ }
7336
+ })();
7337
+ })(classnames$1);
7338
+ var classnamesExports = classnames$1.exports;
7339
+ const classnames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
7340
+ const useStyles = client.createStyles(({ css: css2, token }) => ({
7341
+ statusIconClass: css2`
7342
+ padding: 0;
7343
+ width: ${token.sizeLG}px;
7344
+ height: ${token.sizeLG}px;
7345
+ line-height: ${token.sizeLG}px;
7346
+ margin-right: 0;
7347
+ border-radius: 50%;
7348
+ text-align: center;
7349
+ `
7350
+ }));
7351
+ function StatusIcon(props) {
7352
+ const { icon, color } = JobStatusOptionsMap[props.status];
7353
+ const { styles } = useStyles();
7354
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, className: classnames(styles.statusIconClass, props.className), children: icon });
7355
+ }
5559
7356
  const instructions = new client$1.Registry();
5560
7357
  instructions.register("calculation", calculation);
5561
7358
  instructions.register("condition", condition);
@@ -5623,7 +7420,7 @@
5623
7420
  return stack;
5624
7421
  }
5625
7422
  function Node({ data }) {
5626
- const { styles } = useStyles();
7423
+ const { styles } = useStyles$1();
5627
7424
  const { component: Component = NodeDefaultView, endding } = instructions.get(data.type);
5628
7425
  return /* @__PURE__ */ jsxRuntimeExports.jsx(NodeContext.Provider, { value: data, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: client.cx(styles.nodeBlockClass), children: [
5629
7426
  /* @__PURE__ */ jsxRuntimeExports.jsx(Component, { data }),
@@ -5709,14 +7506,13 @@
5709
7506
  );
5710
7507
  }
5711
7508
  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 }) });
7509
+ const { styles } = useStyles$1();
7510
+ 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
7511
  }
5716
7512
  function JobButton() {
5717
7513
  const { execution, setViewJob } = useFlowContext();
5718
7514
  const { jobs } = useNodeContext() ?? {};
5719
- const { styles } = useStyles();
7515
+ const { styles } = useStyles$1();
5720
7516
  if (!execution) {
5721
7517
  return null;
5722
7518
  }
@@ -5744,7 +7540,6 @@
5744
7540
  {
5745
7541
  menu: {
5746
7542
  items: jobs.map((job) => {
5747
- const { icon, color } = JobStatusOptionsMap[job.status];
5748
7543
  return {
5749
7544
  key: job.id,
5750
7545
  label: /* @__PURE__ */ jsxRuntimeExports.jsxs(
@@ -5761,7 +7556,7 @@
5761
7556
  }
5762
7557
  `,
5763
7558
  children: [
5764
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: client.cx(styles.nodeJobButtonClass, "inner"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, children: icon }) }),
7559
+ /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: job.status }),
5765
7560
  /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(job.updatedAt).format("YYYY-MM-DD HH:mm:ss") })
5766
7561
  ]
5767
7562
  }
@@ -5779,7 +7574,7 @@
5779
7574
  const compile = client.useCompile();
5780
7575
  const api = client.useAPIClient();
5781
7576
  const { workflow, refresh } = useFlowContext() ?? {};
5782
- const { styles } = useStyles();
7577
+ const { styles } = useStyles$1();
5783
7578
  const instruction = instructions.get(data.type);
5784
7579
  const detailText = workflow.executed ? '{{t("View")}}' : '{{t("Configure")}}';
5785
7580
  const typeTitle = compile(instruction.title);
@@ -5883,9 +7678,11 @@
5883
7678
  } : instruction.description ? {
5884
7679
  description: {
5885
7680
  type: "void",
5886
- "x-component": NodeDescription,
7681
+ "x-component": DrawerDescription,
5887
7682
  "x-component-props": {
5888
- instruction
7683
+ label: lang("Node type"),
7684
+ title: instruction.title,
7685
+ description: instruction.description
5889
7686
  }
5890
7687
  }
5891
7688
  } : {},
@@ -5945,7 +7742,7 @@
5945
7742
  const api = client.useAPIClient();
5946
7743
  const { workflow, refresh } = useFlowContext() ?? {};
5947
7744
  const instructionList = Array.from(instructions.getValues());
5948
- const { styles } = useStyles();
7745
+ const { styles } = useStyles$1();
5949
7746
  const groups = React.useMemo(() => {
5950
7747
  return [
5951
7748
  { key: "control", label: `{{t("Control", { ns: "${NAMESPACE}" })}}` },
@@ -6032,7 +7829,7 @@
6032
7829
  branchIndex = null,
6033
7830
  controller = null
6034
7831
  }) {
6035
- const { styles } = useStyles();
7832
+ const { styles } = useStyles$1();
6036
7833
  const list = [];
6037
7834
  for (let node = entry; node; node = node.downstream) {
6038
7835
  list.push(node);
@@ -6045,7 +7842,7 @@
6045
7842
  ] });
6046
7843
  }
6047
7844
  function CanvasContent({ entry }) {
6048
- const { styles } = useStyles();
7845
+ const { styles } = useStyles$1();
6049
7846
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "workflow-canvas", children: [
6050
7847
  /* @__PURE__ */ jsxRuntimeExports.jsx(TriggerConfig, {}),
6051
7848
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles.branchBlockClass, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Branch, { entry }) }),
@@ -6074,7 +7871,7 @@
6074
7871
  function JobModal() {
6075
7872
  const compile = client.useCompile();
6076
7873
  const { viewJob: job, setViewJob } = useFlowContext();
6077
- const { styles } = useStyles();
7874
+ const { styles } = useStyles$1();
6078
7875
  const { node = {} } = job ?? {};
6079
7876
  const instruction = instructions.get(node.type);
6080
7877
  return /* @__PURE__ */ jsxRuntimeExports.jsx(client.ActionContextProvider, { value: { visible: Boolean(job), setVisible: setViewJob }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -6123,10 +7920,7 @@
6123
7920
  "x-decorator": "FormItem",
6124
7921
  "x-component": "Input.JSON",
6125
7922
  "x-component-props": {
6126
- className: client.css`
6127
- padding: 1em;
6128
- background-color: #eee;
6129
- `
7923
+ className: styles.nodeJobResultClass
6130
7924
  },
6131
7925
  "x-read-pretty": true
6132
7926
  }
@@ -6137,6 +7931,83 @@
6137
7931
  }
6138
7932
  ) });
6139
7933
  }
7934
+ function ExecutionsDropdown(props) {
7935
+ const { execution } = useFlowContext();
7936
+ const apiClient = client.useAPIClient();
7937
+ const navigate = reactRouterDom.useNavigate();
7938
+ const { styles } = useStyles$1();
7939
+ const [executionsBefore, setExecutionsBefore] = React.useState([]);
7940
+ const [executionsAfter, setExecutionsAfter] = React.useState([]);
7941
+ React.useEffect(() => {
7942
+ if (!execution) {
7943
+ return;
7944
+ }
7945
+ apiClient.resource("executions").list({
7946
+ filter: {
7947
+ key: execution.key,
7948
+ id: {
7949
+ $lt: execution.id
7950
+ }
7951
+ },
7952
+ sort: "-createdAt",
7953
+ pageSize: 10,
7954
+ fields: ["id", "status", "createdAt"]
7955
+ }).then(({ data }) => {
7956
+ setExecutionsBefore(data.data);
7957
+ }).catch(() => {
7958
+ });
7959
+ }, [execution]);
7960
+ React.useEffect(() => {
7961
+ if (!execution) {
7962
+ return;
7963
+ }
7964
+ apiClient.resource("executions").list({
7965
+ filter: {
7966
+ key: execution.key,
7967
+ id: {
7968
+ $gt: execution.id
7969
+ }
7970
+ },
7971
+ sort: "createdAt",
7972
+ pageSize: 10,
7973
+ fields: ["id", "status", "createdAt"]
7974
+ }).then(({ data }) => {
7975
+ setExecutionsAfter(data.data.reverse());
7976
+ }).catch(() => {
7977
+ });
7978
+ }, [execution]);
7979
+ const onClick = React.useCallback(
7980
+ ({ key }) => {
7981
+ if (key != execution.id) {
7982
+ navigate(`/admin/settings/workflow/executions/${key}`);
7983
+ }
7984
+ },
7985
+ [execution]
7986
+ );
7987
+ return execution ? /* @__PURE__ */ jsxRuntimeExports.jsx(
7988
+ antd.Dropdown,
7989
+ {
7990
+ menu: {
7991
+ className: styles.executionsDropdownRowClass,
7992
+ onClick,
7993
+ items: [...executionsAfter, execution, ...executionsBefore].map((item) => {
7994
+ return {
7995
+ key: item.id,
7996
+ label: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: classnames("row", { current: item.id === execution.id }), children: [
7997
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "id", children: `#${item.id}` }),
7998
+ /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(item.createdAt).format("YYYY-MM-DD HH:mm:ss") })
7999
+ ] }),
8000
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx(StatusIcon, { status: item.status })
8001
+ };
8002
+ })
8003
+ },
8004
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Space, { children: [
8005
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: `#${execution.id}` }),
8006
+ /* @__PURE__ */ jsxRuntimeExports.jsx(icons.DownOutlined, {})
8007
+ ] })
8008
+ }
8009
+ ) : null;
8010
+ }
6140
8011
  function ExecutionCanvas() {
6141
8012
  const compile = client.useCompile();
6142
8013
  const { data, loading } = client.useResourceActionContext();
@@ -6176,7 +8047,7 @@
6176
8047
  items: [
6177
8048
  { title: /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Link, { to: `/admin/settings/workflow/workflows`, children: lang("Workflow") }) },
6178
8049
  { 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}` }) }
8050
+ { title: /* @__PURE__ */ jsxRuntimeExports.jsx(ExecutionsDropdown, {}) }
6180
8051
  ]
6181
8052
  }
6182
8053
  ) }),
@@ -6193,7 +8064,7 @@
6193
8064
  }
6194
8065
  const ExecutionPage = () => {
6195
8066
  const params = reactRouterDom.useParams();
6196
- const { styles } = useStyles();
8067
+ const { styles } = useStyles$1();
6197
8068
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: client.cx(styles.workflowPageClass), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6198
8069
  client.SchemaComponent,
6199
8070
  {
@@ -6228,55 +8099,6 @@
6228
8099
  }
6229
8100
  ) });
6230
8101
  };
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
8102
  const ExecutionLink = () => {
6281
8103
  const { t } = reactI18next.useTranslation();
6282
8104
  const { id } = client.useRecord();
@@ -6366,10 +8188,32 @@
6366
8188
  }
6367
8189
  },
6368
8190
  properties: {
6369
- // filter: {
6370
- // type: 'object',
6371
- // 'x-component': 'Filter',
6372
- // }
8191
+ clear: {
8192
+ type: "void",
8193
+ title: '{{t("Clear")}}',
8194
+ "x-component": "Action",
8195
+ "x-component-props": {
8196
+ useAction() {
8197
+ const { t } = reactI18next.useTranslation();
8198
+ const { refresh, defaultRequest } = client.useResourceActionContext();
8199
+ const { resource } = client.useResourceContext();
8200
+ const { setVisible } = client.useActionContext();
8201
+ return {
8202
+ async run() {
8203
+ var _a;
8204
+ await resource.destroy({ filter: (_a = defaultRequest.params) == null ? void 0 : _a.filter });
8205
+ antd.message.success(t("Operation succeeded"));
8206
+ refresh();
8207
+ setVisible(false);
8208
+ }
8209
+ };
8210
+ },
8211
+ confirm: {
8212
+ title: `{{t("Clear all executions", { ns: "${NAMESPACE}" })}}`,
8213
+ 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}" })}}`
8214
+ }
8215
+ }
8216
+ }
6373
8217
  }
6374
8218
  },
6375
8219
  table: {
@@ -6431,7 +8275,7 @@
6431
8275
  split: "|"
6432
8276
  },
6433
8277
  properties: {
6434
- config: {
8278
+ link: {
6435
8279
  type: "void",
6436
8280
  title: `{{t("Details", { ns: "${NAMESPACE}" })}}`,
6437
8281
  "x-component": "ExecutionLink"
@@ -6471,7 +8315,7 @@
6471
8315
  const { resource } = client.useResourceContext();
6472
8316
  const { setTitle } = client.useDocumentTitle();
6473
8317
  const [visible, setVisible] = React.useState(false);
6474
- const { styles } = useStyles();
8318
+ const { styles } = useStyles$1();
6475
8319
  const { modal } = antd.App.useApp();
6476
8320
  React.useEffect(() => {
6477
8321
  const { title } = (data == null ? void 0 : data.data) ?? {};
@@ -6569,20 +8413,15 @@
6569
8413
  items: revisions.sort((a, b2) => b2.id - a.id).map((item, index) => ({
6570
8414
  key: `${item.id}`,
6571
8415
  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
- )
8416
+ className: client.cx({
8417
+ executed: item.executed,
8418
+ unexecuted: !item.executed,
8419
+ enabled: item.enabled
8420
+ }),
8421
+ label: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
8422
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: `#${item.id}` }),
8423
+ /* @__PURE__ */ jsxRuntimeExports.jsx("time", { children: client$1.str2moment(item.createdAt).format("YYYY-MM-DD HH:mm:ss") })
8424
+ ] })
6586
8425
  }))
6587
8426
  },
6588
8427
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(antd.Button, { type: "text", children: [
@@ -6634,7 +8473,7 @@
6634
8473
  }
6635
8474
  const WorkflowPage = () => {
6636
8475
  const params = reactRouterDom.useParams();
6637
- const { styles } = useStyles();
8476
+ const { styles } = useStyles$1();
6638
8477
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: client.cx(styles.workflowPageClass), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
6639
8478
  client.SchemaComponent,
6640
8479
  {
@@ -6804,9 +8643,53 @@
6804
8643
  "x-component": "InputNumber",
6805
8644
  "x-decorator": "FormItem"
6806
8645
  }
8646
+ },
8647
+ {
8648
+ type: "object",
8649
+ name: "options"
6807
8650
  }
6808
8651
  ]
6809
8652
  };
8653
+ const workflowFieldset = {
8654
+ title: {
8655
+ "x-component": "CollectionField",
8656
+ "x-decorator": "FormItem"
8657
+ },
8658
+ type: {
8659
+ "x-component": "CollectionField",
8660
+ "x-decorator": "FormItem"
8661
+ },
8662
+ enabled: {
8663
+ "x-component": "CollectionField",
8664
+ "x-decorator": "FormItem"
8665
+ },
8666
+ description: {
8667
+ "x-component": "CollectionField",
8668
+ "x-decorator": "FormItem"
8669
+ },
8670
+ options: {
8671
+ type: "object",
8672
+ "x-component": "fieldset",
8673
+ properties: {
8674
+ useTransaction: {
8675
+ type: "boolean",
8676
+ title: `{{ t("Use transaction", { ns: "${NAMESPACE}" }) }}`,
8677
+ 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}" }) }}`,
8678
+ "x-decorator": "FormItem",
8679
+ "x-component": "Checkbox"
8680
+ },
8681
+ deleteExecutionOnStatus: {
8682
+ type: "array",
8683
+ title: `{{ t("Auto delete history when execution is on end status", { ns: "${NAMESPACE}" }) }}`,
8684
+ "x-decorator": "FormItem",
8685
+ "x-component": "ExecutionStatusSelect",
8686
+ "x-component-props": {
8687
+ multiple: true
8688
+ }
8689
+ }
8690
+ }
8691
+ }
8692
+ };
6810
8693
  const workflowSchema = {
6811
8694
  type: "void",
6812
8695
  properties: {
@@ -6843,18 +8726,6 @@
6843
8726
  }
6844
8727
  },
6845
8728
  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
8729
  create: {
6859
8730
  type: "void",
6860
8731
  title: '{{t("Add new")}}',
@@ -6874,18 +8745,7 @@
6874
8745
  },
6875
8746
  title: '{{t("Add new")}}',
6876
8747
  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
- },
8748
+ ...workflowFieldset,
6889
8749
  footer: {
6890
8750
  type: "void",
6891
8751
  "x-component": "Action.Drawer.Footer",
@@ -6910,6 +8770,39 @@
6910
8770
  }
6911
8771
  }
6912
8772
  }
8773
+ },
8774
+ sync: {
8775
+ type: "void",
8776
+ title: `{{t("Sync", { ns: "${NAMESPACE}" })}}`,
8777
+ "x-decorator": "Tooltip",
8778
+ "x-decorator-props": {
8779
+ title: `{{ t("Sync enabled status of all workflows from database", { ns: "${NAMESPACE}" }) }}`
8780
+ },
8781
+ "x-component": "Action",
8782
+ "x-component-props": {
8783
+ useAction() {
8784
+ const { t } = reactI18next.useTranslation();
8785
+ const { resource } = client.useResourceContext();
8786
+ return {
8787
+ async run() {
8788
+ await resource.sync();
8789
+ antd.message.success(t("Operation succeeded"));
8790
+ }
8791
+ };
8792
+ }
8793
+ }
8794
+ },
8795
+ delete: {
8796
+ type: "void",
8797
+ title: '{{t("Delete")}}',
8798
+ "x-component": "Action",
8799
+ "x-component-props": {
8800
+ useAction: "{{ cm.useBulkDestroyAction }}",
8801
+ confirm: {
8802
+ title: "{{t('Delete record')}}",
8803
+ content: "{{t('Are you sure you want to delete it?')}}"
8804
+ }
8805
+ }
6913
8806
  }
6914
8807
  }
6915
8808
  },
@@ -6992,7 +8885,7 @@
6992
8885
  split: "|"
6993
8886
  },
6994
8887
  properties: {
6995
- config: {
8888
+ view: {
6996
8889
  type: "void",
6997
8890
  "x-component": "WorkflowLink"
6998
8891
  },
@@ -7013,18 +8906,7 @@
7013
8906
  },
7014
8907
  title: '{{ t("Edit") }}',
7015
8908
  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
- },
8909
+ ...workflowFieldset,
7028
8910
  footer: {
7029
8911
  type: "void",
7030
8912
  "x-component": "Action.Drawer.Footer",
@@ -7055,33 +8937,75 @@
7055
8937
  title: `{{t("Duplicate", { ns: "${NAMESPACE}" })}}`,
7056
8938
  "x-component": "Action.Link",
7057
8939
  "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();
8940
+ openSize: "small"
8941
+ },
8942
+ properties: {
8943
+ modal: {
8944
+ type: "void",
8945
+ title: `{{t("Duplicate to new workflow", { ns: "${NAMESPACE}" })}}`,
8946
+ "x-decorator": "FormV2",
8947
+ "x-component": "Action.Modal",
8948
+ properties: {
8949
+ title: {
8950
+ type: "string",
8951
+ title: '{{t("Title")}}',
8952
+ "x-decorator": "FormItem",
8953
+ "x-component": "Input"
8954
+ },
8955
+ footer: {
8956
+ type: "void",
8957
+ "x-component": "Action.Modal.Footer",
8958
+ properties: {
8959
+ submit: {
8960
+ type: "void",
8961
+ title: '{{t("Submit")}}',
8962
+ "x-component": "Action",
8963
+ "x-component-props": {
8964
+ type: "primary",
8965
+ useAction() {
8966
+ const { t } = reactI18next.useTranslation();
8967
+ const { refresh } = client.useResourceActionContext();
8968
+ const { resource, targetKey } = client.useResourceContext();
8969
+ const { setVisible } = client.useActionContext();
8970
+ const { [targetKey]: filterByTk } = client.useRecord();
8971
+ const { values: values2 } = react.useForm();
8972
+ return {
8973
+ async run() {
8974
+ await resource.revision({ filterByTk, values: values2 });
8975
+ antd.message.success(t("Operation succeeded"));
8976
+ refresh();
8977
+ setVisible(false);
8978
+ }
8979
+ };
8980
+ }
8981
+ }
8982
+ },
8983
+ cancel: {
8984
+ type: "void",
8985
+ title: '{{t("Cancel")}}',
8986
+ "x-component": "Action",
8987
+ "x-component-props": {
8988
+ useAction: "{{ cm.useCancelAction }}"
8989
+ }
8990
+ }
8991
+ }
7068
8992
  }
7069
- };
8993
+ }
7070
8994
  }
7071
8995
  }
8996
+ },
8997
+ delete: {
8998
+ type: "void",
8999
+ title: '{{ t("Delete") }}',
9000
+ "x-component": "Action.Link",
9001
+ "x-component-props": {
9002
+ confirm: {
9003
+ title: "{{t('Delete record')}}",
9004
+ content: "{{t('Are you sure you want to delete it?')}}"
9005
+ },
9006
+ useAction: "{{ cm.useDestroyActionAndRefreshCM }}"
9007
+ }
7072
9008
  }
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
9009
  }
7086
9010
  }
7087
9011
  }
@@ -7092,6 +9016,28 @@
7092
9016
  }
7093
9017
  }
7094
9018
  };
9019
+ function LabelTag(props) {
9020
+ const compile = client.useCompile();
9021
+ const label = compile(props.label);
9022
+ const onPreventMouseDown = React.useCallback((event) => {
9023
+ event.preventDefault();
9024
+ event.stopPropagation();
9025
+ }, []);
9026
+ const { color } = ExecutionStatusOptionsMap[props.value] ?? {};
9027
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Tag, { color, onMouseDown: onPreventMouseDown, closable: props.closable, onClose: props.onClose, children: label });
9028
+ }
9029
+ function ExecutionStatusOption(props) {
9030
+ const compile = client.useCompile();
9031
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9032
+ /* @__PURE__ */ jsxRuntimeExports.jsx(LabelTag, { ...props }),
9033
+ props.description ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: compile(props.description) }) : null
9034
+ ] });
9035
+ }
9036
+ function ExecutionStatusSelect({ ...props }) {
9037
+ 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(
9038
+ (option) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { ...option, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ExecutionStatusOption, { ...option }) }, option.value)
9039
+ ) });
9040
+ }
7095
9041
  const WorkflowContext = React.createContext({});
7096
9042
  function WorkflowPane() {
7097
9043
  return /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Card, { bordered: false, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -7099,10 +9045,12 @@
7099
9045
  {
7100
9046
  schema: workflowSchema,
7101
9047
  components: {
9048
+ Tooltip: antd.Tooltip,
7102
9049
  WorkflowLink,
7103
9050
  ExecutionResourceProvider,
7104
9051
  ExecutionLink,
7105
- OpenDrawer
9052
+ OpenDrawer,
9053
+ ExecutionStatusSelect
7106
9054
  }
7107
9055
  }
7108
9056
  ) });
@@ -7754,12 +9702,13 @@
7754
9702
  class WorkflowPlugin extends client.Plugin {
7755
9703
  async load() {
7756
9704
  this.addRoutes();
9705
+ this.addScopes();
7757
9706
  this.addComponents();
7758
9707
  this.app.use(WorkflowProvider);
7759
9708
  }
7760
9709
  addScopes() {
7761
9710
  this.app.addScopes({
7762
- useCollectionDataSource: client.useCollectionDataSource
9711
+ useTriggerWorkflowsActionProps
7763
9712
  });
7764
9713
  }
7765
9714
  addComponents() {