@nocobase/plugin-workflow 1.5.0-beta.2 → 1.5.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/5ed8ff0f70ed5911.js +10 -0
- package/dist/client/739d458621edf81f.js +10 -0
- package/dist/client/92877729dbcede8f.js +10 -0
- package/dist/client/components/TriggerCollectionRecordSelect.d.ts +10 -0
- package/dist/client/components/index.d.ts +1 -0
- package/dist/client/constants.d.ts +1 -0
- package/dist/client/e7b9d67c6a964bec.js +10 -0
- package/dist/client/index.js +1 -566
- package/dist/client/triggers/collection.d.ts +14 -0
- package/dist/client/triggers/index.d.ts +3 -3
- package/dist/client/triggers/schedule/ScheduleModes.d.ts +167 -0
- package/dist/client/triggers/schedule/TriggerScheduleConfig.d.ts +10 -0
- package/dist/client/triggers/schedule/index.d.ts +11 -0
- package/dist/externalVersion.js +10 -10
- package/dist/locale/zh-CN.json +14 -0
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/server/Plugin.d.ts +6 -2
- package/dist/server/Plugin.js +70 -46
- package/dist/server/Processor.d.ts +4 -0
- package/dist/server/Processor.js +13 -5
- package/dist/server/actions/workflows.d.ts +5 -0
- package/dist/server/actions/workflows.js +56 -61
- package/dist/server/collections/workflows.js +2 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +2 -0
- package/dist/server/repositories/WorkflowRepository.d.ts +12 -0
- package/dist/server/repositories/WorkflowRepository.js +112 -0
- package/dist/server/triggers/CollectionTrigger.d.ts +9 -1
- package/dist/server/triggers/CollectionTrigger.js +76 -57
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.d.ts +1 -1
- package/dist/server/triggers/ScheduleTrigger/DateFieldScheduleTrigger.js +8 -5
- package/dist/server/triggers/ScheduleTrigger/index.d.ts +2 -0
- package/dist/server/triggers/ScheduleTrigger/index.js +4 -0
- package/dist/server/triggers/index.d.ts +4 -2
- package/dist/server/triggers/index.js +4 -0
- package/package.json +3 -3
package/dist/client/index.js
CHANGED
|
@@ -7,569 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
(function(x,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("react/jsx-runtime"),require("@formily/react"),require("@formily/shared"),require("@nocobase/client"),require("@nocobase/utils/client"),require("react-router-dom"),require("react"),require("antd"),require("react-i18next"),require("@ant-design/icons"),require("@formily/core"),require("lodash"),require("@formily/reactive"),require("@nocobase/evaluators/client"),require("@formily/antd-v5"),require("dayjs")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","@formily/react","@formily/shared","@nocobase/client","@nocobase/utils/client","react-router-dom","react","antd","react-i18next","@ant-design/icons","@formily/core","lodash","@formily/reactive","@nocobase/evaluators/client","@formily/antd-v5","dayjs"],n):(x=typeof globalThis!="undefined"?globalThis:x||self,n(x["@nocobase/plugin-workflow"]={},x.jsxRuntime,x["@formily/react"],x["@formily/shared"],x["@nocobase/client"],x["@nocobase/utils"],x["react-router-dom"],x.react,x.antd,x["react-i18next"],x["@ant-design/icons"],x["@formily/core"],x.lodash,x["@formily/reactive"],x["@nocobase/evaluators"],x["@formily/antd-v5"],x.dayjs))})(this,function(x,n,T,oe,l,Q,se,y,g,X,V,fe,we,Ge,De,gt,en){"use strict";var Hr=Object.defineProperty,Gr=Object.defineProperties;var qr=Object.getOwnPropertyDescriptors;var yt=Object.getOwnPropertySymbols;var Qo=Object.prototype.hasOwnProperty,Xo=Object.prototype.propertyIsEnumerable;var Lt=(x,n,T)=>n in x?Hr(x,n,{enumerable:!0,configurable:!0,writable:!0,value:T}):x[n]=T,C=(x,n)=>{for(var T in n||(n={}))Qo.call(n,T)&&Lt(x,T,n[T]);if(yt)for(var T of yt(n))Xo.call(n,T)&&Lt(x,T,n[T]);return x},A=(x,n)=>Gr(x,qr(n));var Ro=x=>typeof x=="symbol"?x:x+"",Z=(x,n)=>{var T={};for(var oe in x)Qo.call(x,oe)&&n.indexOf(oe)<0&&(T[oe]=x[oe]);if(x!=null&&yt)for(var oe of yt(x))n.indexOf(oe)<0&&Xo.call(x,oe)&&(T[oe]=x[oe]);return T};var w=(x,n,T)=>(Lt(x,typeof n!="symbol"?n+"":n,T),T);var J=(x,n,T)=>new Promise((oe,l)=>{var Q=g=>{try{y(T.next(g))}catch(X){l(X)}},se=g=>{try{y(T.throw(g))}catch(X){l(X)}},y=g=>g.done?oe(g.value):Promise.resolve(g.value).then(Q,se);y((T=T.apply(x,n)).next())});const tn=y.createContext(null),bt={didCatch:!1,error:null};class on extends y.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=bt}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var o,r,s=arguments.length,a=new Array(s),i=0;i<s;i++)a[i]=arguments[i];(o=(r=this.props).onReset)===null||o===void 0||o.call(r,{args:a,reason:"imperative-api"}),this.setState(bt)}}componentDidCatch(t,o){var r,s;(r=(s=this.props).onError)===null||r===void 0||r.call(s,t,o)}componentDidUpdate(t,o){const{didCatch:r}=this.state,{resetKeys:s}=this.props;if(r&&o.error!==null&&nn(t.resetKeys,s)){var a,i;(a=(i=this.props).onReset)===null||a===void 0||a.call(i,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(bt)}}render(){const{children:t,fallbackRender:o,FallbackComponent:r,fallback:s}=this.props,{didCatch:a,error:i}=this.state;let c=t;if(a){const p={error:i,resetErrorBoundary:this.resetErrorBoundary};if(y.isValidElement(s))c=s;else if(typeof o=="function")c=o(p);else if(r)c=y.createElement(r,p);else throw i}return y.createElement(tn.Provider,{value:{didCatch:a,error:i,resetErrorBoundary:this.resetErrorBoundary}},c)}}function nn(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((o,r)=>!Object.is(o,t[r]))}const Ie=y.createContext({});function H(){return y.useContext(Ie)}const u="workflow";function O(e,t={}){return l.i18n.t(e,A(C({},t),{ns:u}))}function xt(){return X.useTranslation(u)}function vt(e){const t=new Map;e.forEach(o=>t.set(o.id,o));for(const o of t.values())o.upstreamId&&(o.upstream=t.get(o.upstreamId)),o.downstreamId&&(o.downstream=t.get(o.downstreamId))}function wt(e,t){t(e),e.properties&&Object.keys(e.properties).forEach(o=>{wt(e.properties[o],t)})}function Ce(e){return`/admin/workflow/workflows/${e}`}function qe(e){return`/admin/workflow/executions/${e}`}function rn(r){var s=r,{collection:e,dataPath:t}=s,o=Z(s,["collection","dataPath"]);const{insert:a}=l.useSchemaInitializer(),{getTemplateSchemaByMode:i}=l.useSchemaTemplateManager(),{getCollection:c}=l.useCollectionManager_deprecated(),p=l.useRecordCollectionDataSourceItems("FormItem");let d;if(typeof e=="string"){const[h,v]=l.parseCollectionName(e);d=c(v,h)}else d=e;function m(v){return J(this,arguments,function*({item:h}){const b=h.template?yield i(h):null,f={type:"void",name:oe.uid(),title:d.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:e,dataPath:t},"x-component":"CardItem","x-component-props":{title:o.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:b||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}};wt(f,k=>{k["x-uid"]&&delete k["x-uid"]}),a(f)})}return n.jsx(l.SchemaInitializerItem,A(C({},o),{onClick:m,items:p}))}function Pe(e){var a;const t=l.useSchemaInitializerItem(),o=(a=e==null?void 0:e.collection)!=null?a:t.collection;let r,s;if(typeof o=="string"){const i=l.parseCollectionName(o);r=i[0],s=i[1]}else s=o;return n.jsx(l.CollectionProvider_deprecated,{dataSource:r,collection:s,children:n.jsx(rn,C(C({},t),e))})}function sn(e){const{execution:t,nodes:o}=H(),r=y.useMemo(()=>o.reduce((i,c)=>Object.assign(i,{[c.id]:c.key}),{}),[o]),s=y.useMemo(()=>{var i;return{$context:t==null?void 0:t.context,$jobsMapByNodeKey:((i=t==null?void 0:t.jobs)!=null?i:[]).reduce((c,p)=>Object.assign(c,{[r[p.nodeId]]:p.result}),{})}},[t==null?void 0:t.context,t==null?void 0:t.jobs,r]);return y.useMemo(()=>we.get(s,e),[s,e])}function ln({collection:e,dataPath:t,children:o}){const r=T.useField(),s=y.useRef(null),{getAssociationAppends:a}=l.useAssociationNames(),{appends:i,updateAssociationValues:c}=a(),p=sn(t);let d,m;if(typeof e=="string"){const M=l.parseCollectionName(e);d=M[0],m=M[1]}else m=e;const h=y.useMemo(()=>fe.createForm({values:p,readPretty:!0}),[p]),v={appends:i},b={loading:!1,data:{data:p}},k=l.useAPIClient().resource(m),F=l.useBlockRequestContext();return n.jsx(l.CollectionProvider_deprecated,{dataSource:d,collection:m,children:n.jsx(l.RecordProvider,{record:p,parent:null,children:n.jsx(l.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:r,service:b,resource:k,__parent:F},children:n.jsx(l.FormBlockContext.Provider,{value:{params:v,form:h,field:r,service:b,updateAssociationValues:c,formBlockRef:s},children:o})})})})}function an(){return!0}const Ct=T.observer(e=>{const d=e,{filter:t=an}=d,o=Z(d,["filter"]),r=l.useCompile(),{getCollectionFields:s}=l.useCollectionManager_deprecated(),{values:a}=T.useForm(),[i,c]=l.parseCollectionName(a==null?void 0:a.collection),p=s(c,i);return n.jsx(g.Select,A(C({popupMatchSelectWidth:!1},o),{options:p.filter(t).map(m=>{var h;return{label:r((h=m.uiSchema)==null?void 0:h.title),value:m.name}})}))},{displayName:"FieldsSelect"}),cn=l.createStyles(({css:e,token:t})=>({container:e`
|
|
11
|
-
margin-bottom: 1.5em;
|
|
12
|
-
padding: 1em;
|
|
13
|
-
background-color: ${t.colorFillAlter};
|
|
14
|
-
|
|
15
|
-
> *:last-child {
|
|
16
|
-
margin-bottom: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
dl {
|
|
20
|
-
display: flex;
|
|
21
|
-
align-items: baseline;
|
|
22
|
-
|
|
23
|
-
dt {
|
|
24
|
-
color: ${t.colorText};
|
|
25
|
-
&:after {
|
|
26
|
-
content: ':';
|
|
27
|
-
margin-right: 0.5em;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
p {
|
|
33
|
-
color: ${t.colorTextDescription};
|
|
34
|
-
}
|
|
35
|
-
`}));function zt(e){const{label:t,title:o,description:r}=e,{styles:s}=cn();return n.jsxs("div",{className:l.cx(s.container,e.className),children:[n.jsxs("dl",{children:[n.jsx("dt",{children:t}),n.jsx("dd",{children:n.jsx(g.Tag,{style:{background:"none"},children:o})})]}),r?n.jsx("p",{children:r}):null]})}function dn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jt={exports:{}};/*!
|
|
36
|
-
Copyright (c) 2018 Jed Watson.
|
|
37
|
-
Licensed under the MIT License (MIT), see
|
|
38
|
-
http://jedwatson.github.io/classnames
|
|
39
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function o(){for(var a="",i=0;i<arguments.length;i++){var c=arguments[i];c&&(a=s(a,r(c)))}return a}function r(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return o.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var c in a)t.call(a,c)&&a[c]&&(i=s(i,c));return i}function s(a,i){return i?a?a+" "+i:a+i:a}e.exports?(o.default=o,e.exports=o):window.classNames=o})()})(Jt);var un=Jt.exports;const pn=dn(un),mn=l.createStyles(({css:e,token:t})=>({statusButtonClass:e`
|
|
40
|
-
border: none;
|
|
41
|
-
.ant-tag {
|
|
42
|
-
width: 100%;
|
|
43
|
-
height: 100%;
|
|
44
|
-
padding: 0;
|
|
45
|
-
margin-right: 0;
|
|
46
|
-
border-radius: 50%;
|
|
47
|
-
text-align: center;
|
|
48
|
-
}
|
|
49
|
-
`,noStatusButtonClass:e`
|
|
50
|
-
border-width: 2px;
|
|
51
|
-
`}));function Me(e){const i=e,{status:t,statusMap:o}=i,r=Z(i,["status","statusMap"]),{styles:s}=mn();let a=null;if(typeof t!="undefined"&&(o!=null&&o[t])){const{icon:c,color:p}=o[t];a=n.jsx(g.Tag,{color:p,children:c})}return n.jsx(g.Button,A(C({},r),{shape:"circle",size:"small",className:pn(a?s.statusButtonClass:s.noStatusButtonClass,e.className),children:a}))}const ie={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},Ye=[{value:ie.QUEUEING,label:`{{t("Queueing", { ns: "${u}" })}}`,color:"blue",icon:n.jsx(V.HourglassOutlined,{}),description:`{{t("Triggered but still waiting in queue to execute.", { ns: "${u}" })}}`},{value:ie.STARTED,label:`{{t("On going", { ns: "${u}" })}}`,color:"gold",icon:n.jsx(V.LoadingOutlined,{}),description:`{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "${u}" })}}`},{value:ie.RESOLVED,label:`{{t("Resolved", { ns: "${u}" })}}`,color:"green",icon:n.jsx(V.CheckOutlined,{}),description:`{{t("Successfully finished.", { ns: "${u}" })}}`},{value:ie.FAILED,label:`{{t("Failed", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.ExclamationOutlined,{}),description:`{{t("Failed to satisfy node configurations.", { ns: "${u}" })}}`},{value:ie.ERROR,label:`{{t("Error", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.CloseOutlined,{}),description:`{{t("Some node meets error.", { ns: "${u}" })}}`},{value:ie.ABORTED,label:`{{t("Aborted", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.MinusOutlined,{rotate:90}),description:`{{t("Running of some node was aborted by program flow.", { ns: "${u}" })}}`},{value:ie.CANCELED,label:`{{t("Canceled", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{rotate:45}),description:`{{t("Manually canceled whole execution when waiting.", { ns: "${u}" })}}`},{value:ie.REJECTED,label:`{{t("Rejected", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{}),description:`{{t("Rejected from a manual node.", { ns: "${u}" })}}`},{value:ie.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.RedoOutlined,{}),description:`{{t("General failed but should do another try.", { ns: "${u}" })}}`}],_e=Ye.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{}),ce={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},kt=[{value:ce.PENDING,label:`{{t("Pending", { ns: "${u}" })}}`,color:"gold",icon:n.jsx(V.ClockCircleOutlined,{})},{value:ce.RESOLVED,label:`{{t("Resolved", { ns: "${u}" })}}`,color:"green",icon:n.jsx(V.CheckOutlined,{})},{value:ce.FAILED,label:`{{t("Failed", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.ExclamationOutlined,{})},{value:ce.ERROR,label:`{{t("Error", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.CloseOutlined,{})},{value:ce.ABORTED,label:`{{t("Aborted", { ns: "${u}" })}}`,color:"red",icon:n.jsx(V.MinusOutlined,{rotate:90})},{value:ce.CANCELED,label:`{{t("Canceled", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{rotate:45})},{value:ce.REJECTED,label:`{{t("Rejected", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.MinusOutlined,{})},{value:ce.RETRY_NEEDED,label:`{{t("Retry needed", { ns: "${u}" })}}`,color:"volcano",icon:n.jsx(V.RedoOutlined,{})}],Ke=kt.reduce((e,t)=>Object.assign(e,{[t.value]:t}),{}),St=(e,t)=>({getAriaLabel:y.useCallback(r=>["add-button",e==null?void 0:e.type,e==null?void 0:e.title,t!=null?String(t):"",r].filter(Boolean).join("-"),[t,e==null?void 0:e.title,e==null?void 0:e.type])}),ne=l.createStyles(({css:e,token:t})=>({workflowPageClass:e`
|
|
52
|
-
flex-grow: 1;
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
display: flex;
|
|
55
|
-
flex-direction: column;
|
|
56
|
-
|
|
57
|
-
.workflow-toolbar {
|
|
58
|
-
display: flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: space-between;
|
|
61
|
-
position: relative;
|
|
62
|
-
padding: 0.5rem 1rem;
|
|
63
|
-
background: ${t.colorBgContainer};
|
|
64
|
-
border-bottom: 1px solid ${t.colorBorderSecondary};
|
|
65
|
-
|
|
66
|
-
header {
|
|
67
|
-
display: flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
aside {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 0.5em;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.workflow-versions {
|
|
78
|
-
label {
|
|
79
|
-
margin-right: 0.5em;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.workflow-canvas-wrapper {
|
|
85
|
-
flex-grow: 1;
|
|
86
|
-
overflow: hidden;
|
|
87
|
-
position: relative;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.workflow-canvas-zoomer {
|
|
91
|
-
display: flex;
|
|
92
|
-
align-items: center;
|
|
93
|
-
position: absolute;
|
|
94
|
-
top: 2em;
|
|
95
|
-
right: 2em;
|
|
96
|
-
height: 10em;
|
|
97
|
-
padding: 1em 0;
|
|
98
|
-
border-radius: 0.5em;
|
|
99
|
-
background: ${t.colorBgContainer};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.workflow-canvas {
|
|
103
|
-
overflow: auto;
|
|
104
|
-
height: 100%;
|
|
105
|
-
width: 100%;
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
align-items: center;
|
|
109
|
-
padding: 2em;
|
|
110
|
-
|
|
111
|
-
> .ant-alert {
|
|
112
|
-
margin-bottom: 2em;
|
|
113
|
-
font-size: 85%;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
`,dropdownClass:e`
|
|
117
|
-
.ant-dropdown-menu-item {
|
|
118
|
-
justify-content: flex-end;
|
|
119
|
-
.ant-dropdown-menu-title-content {
|
|
120
|
-
display: flex;
|
|
121
|
-
align-items: baseline;
|
|
122
|
-
justify-content: flex-end;
|
|
123
|
-
text-align: right;
|
|
124
|
-
|
|
125
|
-
time {
|
|
126
|
-
width: 14em;
|
|
127
|
-
font-size: 80%;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`,workflowVersionDropdownClass:e`
|
|
132
|
-
max-height: 80vh;
|
|
133
|
-
overflow-y: auto;
|
|
134
|
-
|
|
135
|
-
.ant-dropdown-menu-item {
|
|
136
|
-
.ant-dropdown-menu-title-content {
|
|
137
|
-
strong {
|
|
138
|
-
font-weight: normal;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
> .enabled {
|
|
142
|
-
strong {
|
|
143
|
-
font-weight: bold;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
> .unexecuted {
|
|
148
|
-
strong {
|
|
149
|
-
font-style: italic;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
`,executionsDropdownRowClass:e`
|
|
155
|
-
.ant-dropdown-menu-item {
|
|
156
|
-
.id {
|
|
157
|
-
flex-grow: 1;
|
|
158
|
-
text-align: right;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
`,branchBlockClass:e`
|
|
162
|
-
display: flex;
|
|
163
|
-
position: relative;
|
|
164
|
-
margin: 2em auto auto auto;
|
|
165
|
-
|
|
166
|
-
:before {
|
|
167
|
-
content: '';
|
|
168
|
-
position: absolute;
|
|
169
|
-
top: 0;
|
|
170
|
-
bottom: 0;
|
|
171
|
-
left: calc(50% - 0.5px);
|
|
172
|
-
width: 1px;
|
|
173
|
-
background-color: ${t.colorBgLayout};
|
|
174
|
-
}
|
|
175
|
-
`,branchClass:e`
|
|
176
|
-
display: flex;
|
|
177
|
-
flex-direction: column;
|
|
178
|
-
align-items: center;
|
|
179
|
-
position: relative;
|
|
180
|
-
min-width: 20em;
|
|
181
|
-
padding: 0 2em;
|
|
182
|
-
|
|
183
|
-
.workflow-node-list {
|
|
184
|
-
flex-grow: 1;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.workflow-branch-lines {
|
|
188
|
-
position: absolute;
|
|
189
|
-
top: 0;
|
|
190
|
-
bottom: 0;
|
|
191
|
-
width: 1px;
|
|
192
|
-
background-color: ${t.colorBorder};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
:before,
|
|
196
|
-
:after {
|
|
197
|
-
content: '';
|
|
198
|
-
position: absolute;
|
|
199
|
-
height: 1px;
|
|
200
|
-
background-color: ${t.colorBorder};
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
:before {
|
|
204
|
-
top: 0;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
:after {
|
|
208
|
-
bottom: 0;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
:not(:first-child):not(:last-child) {
|
|
212
|
-
:before,
|
|
213
|
-
:after {
|
|
214
|
-
left: 0;
|
|
215
|
-
width: 100%;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
:last-child:not(:first-child) {
|
|
220
|
-
:before,
|
|
221
|
-
:after {
|
|
222
|
-
right: 50%;
|
|
223
|
-
width: 50%;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
:first-child:not(:last-child) {
|
|
228
|
-
:before,
|
|
229
|
-
:after {
|
|
230
|
-
left: 50%;
|
|
231
|
-
width: 50%;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.end-sign {
|
|
236
|
-
position: relative;
|
|
237
|
-
display: flex;
|
|
238
|
-
flex-direction: column;
|
|
239
|
-
align-items: center;
|
|
240
|
-
justify-content: center;
|
|
241
|
-
width: 0;
|
|
242
|
-
height: 6em;
|
|
243
|
-
border-left: 1px dashed ${t.colorBgLayout};
|
|
244
|
-
|
|
245
|
-
.anticon {
|
|
246
|
-
font-size: 1.5em;
|
|
247
|
-
line-height: 100%;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
`,nodeBlockClass:e`
|
|
251
|
-
flex-grow: 1;
|
|
252
|
-
flex-shrink: 0;
|
|
253
|
-
display: flex;
|
|
254
|
-
flex-direction: column;
|
|
255
|
-
align-items: center;
|
|
256
|
-
position: relative;
|
|
257
|
-
`,nodeClass:e`
|
|
258
|
-
flex-shrink: 0;
|
|
259
|
-
display: flex;
|
|
260
|
-
flex-direction: column;
|
|
261
|
-
align-items: center;
|
|
262
|
-
`,nodeCardClass:e`
|
|
263
|
-
position: relative;
|
|
264
|
-
width: 20em;
|
|
265
|
-
background: ${t.colorBgContainer};
|
|
266
|
-
padding: 1em;
|
|
267
|
-
box-shadow: ${t.boxShadowTertiary};
|
|
268
|
-
border-radius: ${t.borderRadiusLG}px;
|
|
269
|
-
cursor: pointer;
|
|
270
|
-
transition: box-shadow 0.3s ease;
|
|
271
|
-
|
|
272
|
-
&:hover {
|
|
273
|
-
box-shadow: ${t.boxShadow};
|
|
274
|
-
|
|
275
|
-
.workflow-node-remove-button {
|
|
276
|
-
display: block;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
&.configuring {
|
|
281
|
-
box-shadow: ${t.boxShadow};
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
.workflow-node-remove-button {
|
|
285
|
-
display: none;
|
|
286
|
-
position: absolute;
|
|
287
|
-
right: 0;
|
|
288
|
-
top: 0;
|
|
289
|
-
color: ${t.colorText};
|
|
290
|
-
|
|
291
|
-
&[disabled] {
|
|
292
|
-
display: none;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
&:hover {
|
|
296
|
-
color: ${t.colorErrorHover};
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
.ant-input {
|
|
301
|
-
font-weight: bold;
|
|
302
|
-
|
|
303
|
-
&:not(:focus) {
|
|
304
|
-
transition:
|
|
305
|
-
background-color 0.3s ease,
|
|
306
|
-
border-color 0.3s ease;
|
|
307
|
-
border-color: ${t.colorBorderBg};
|
|
308
|
-
background-color: ${t.colorBgContainerDisabled};
|
|
309
|
-
|
|
310
|
-
&:not(:disabled):hover {
|
|
311
|
-
border-color: ${t.colorPrimaryBorderHover};
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
&:disabled:hover {
|
|
315
|
-
border-color: ${t.colorBorderBg};
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
.workflow-node-config-button {
|
|
321
|
-
padding: 0;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
&:hover {
|
|
325
|
-
box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.25);
|
|
326
|
-
|
|
327
|
-
.workflow-node-remove-button {
|
|
328
|
-
display: block;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
`,nodeJobButtonClass:e`
|
|
332
|
-
display: flex;
|
|
333
|
-
position: absolute;
|
|
334
|
-
top: 0;
|
|
335
|
-
right: 0;
|
|
336
|
-
justify-content: center;
|
|
337
|
-
align-items: center;
|
|
338
|
-
color: ${t.colorTextLightSolid};
|
|
339
|
-
`,nodeHeaderClass:e`
|
|
340
|
-
display: flex;
|
|
341
|
-
margin-bottom: 0.5em;
|
|
342
|
-
|
|
343
|
-
.workflow-node-actions {
|
|
344
|
-
position: relative;
|
|
345
|
-
}
|
|
346
|
-
`,nodeMetaClass:e`
|
|
347
|
-
flex-grow: 1;
|
|
348
|
-
|
|
349
|
-
.workflow-node-id {
|
|
350
|
-
color: ${t.colorTextDescription};
|
|
351
|
-
|
|
352
|
-
&:before {
|
|
353
|
-
content: '#';
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
`,nodeTitleClass:e`
|
|
357
|
-
display: flex;
|
|
358
|
-
align-items: center;
|
|
359
|
-
font-weight: normal;
|
|
360
|
-
.workflow-node-id {
|
|
361
|
-
color: ${t.colorTextDescription};
|
|
362
|
-
}
|
|
363
|
-
`,nodeSubtreeClass:e`
|
|
364
|
-
display: flex;
|
|
365
|
-
flex-direction: column-reverse;
|
|
366
|
-
align-items: center;
|
|
367
|
-
margin: auto;
|
|
368
|
-
`,nodeJobResultClass:e`
|
|
369
|
-
background-color: #f3f3f3;
|
|
370
|
-
`,addButtonClass:e`
|
|
371
|
-
flex-shrink: 0;
|
|
372
|
-
padding: 2em 0;
|
|
373
|
-
|
|
374
|
-
> .ant-btn {
|
|
375
|
-
&:disabled {
|
|
376
|
-
visibility: hidden;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
`,conditionClass:e`
|
|
380
|
-
position: relative;
|
|
381
|
-
overflow: visible;
|
|
382
|
-
|
|
383
|
-
> span {
|
|
384
|
-
position: absolute;
|
|
385
|
-
top: calc(1.5em - 1px);
|
|
386
|
-
line-height: 1em;
|
|
387
|
-
color: ${t.colorTextSecondary};
|
|
388
|
-
background-color: ${t.colorBgLayout};
|
|
389
|
-
padding: 1px;
|
|
390
|
-
}
|
|
391
|
-
`,loopLineClass:e`
|
|
392
|
-
display: flex;
|
|
393
|
-
justify-content: center;
|
|
394
|
-
align-items: center;
|
|
395
|
-
position: absolute;
|
|
396
|
-
top: 50%;
|
|
397
|
-
transform: translateY(-50%);
|
|
398
|
-
width: 2em;
|
|
399
|
-
height: 6em;
|
|
400
|
-
`,terminalClass:e`
|
|
401
|
-
display: flex;
|
|
402
|
-
align-items: center;
|
|
403
|
-
justify-content: center;
|
|
404
|
-
flex-shrink: 0;
|
|
405
|
-
width: 4em;
|
|
406
|
-
height: 4em;
|
|
407
|
-
border-radius: 50%;
|
|
408
|
-
background-color: ${t.colorText};
|
|
409
|
-
color: ${t.colorBgContainer};
|
|
410
|
-
`}));class be{constructor(){w(this,"title");w(this,"type");w(this,"group");w(this,"description");w(this,"options");w(this,"fieldset");w(this,"presetFieldset");w(this,"branching");w(this,"view");w(this,"scope");w(this,"components");w(this,"end");w(this,"testable")}createDefaultConfig(){return{}}}function fn(){const e=T.useForm(),t=l.useAPIClient(),o=l.useActionContext(),{refresh:r}=l.useResourceActionContext(),s=xe(),{workflow:a}=H();return{run(){return J(this,null,function*(){var c,p;if(a.executed){g.message.error(O("Node in executed workflow cannot be modified"));return}yield e.submit(),yield(p=(c=t.resource("flow_nodes")).update)==null?void 0:p.call(c,{filterByTk:s.id,values:{config:e.values}}),e.setInitialValues(Ge.toJS(e.values)),o.setFormValueChanged(!1),o.setVisible(!1),r()})}}}const Ze=y.createContext({});function xe(){return y.useContext(Ze)}function Be(e=[]){const t=xe();return e.some(o=>we.get(t.config,o)!=null)}function Ut(e,t){const o=[];if(!e)return[];for(let r=e.upstream;r;r=r.upstream)(typeof t!="function"||t(r))&&o.push(r);return o}function Ht(e){const t=[];for(let o=e;o;o=o.upstream)o.upstream&&o.branchIndex!=null&&t.push(o.upstream);return t}function Gt({data:e}){var i;const{styles:t}=ne(),{getAriaLabel:o}=St(e),r=l.usePlugin(le),{Component:s=Tt,end:a}=(i=r.instructions.get(e.type))!=null?i:{};return n.jsx(Ze.Provider,{value:e,children:n.jsxs("div",{className:l.cx(t.nodeBlockClass),children:[n.jsx(s,{data:e}),!a||typeof a=="function"&&!a(e)?n.jsx(no,{"aria-label":o(),upstream:e}):n.jsx("div",{className:"end-sign",children:n.jsx(V.CloseOutlined,{})})]})})}function At(){var m;const{t:e}=X.useTranslation(),t=l.useAPIClient(),{workflow:o,nodes:r,refresh:s}=(m=H())!=null?m:{},a=xe(),{modal:i}=g.App.useApp(),c=t.resource("flow_nodes"),p=y.useCallback(()=>J(this,null,function*(){var h;yield(h=c.destroy)==null?void 0:h.call(c,{filterByTk:a.id}),s()}),[a.id,s,c]),d=y.useCallback(()=>J(this,null,function*(){const h=r.filter(f=>f===a?!1:Q.parse(f.config).parameters.filter(({key:M})=>M.startsWith(`$jobsMapByNodeKey.${a.key}.`)||M===`$jobsMapByNodeKey.${a.key}`).length);if(h.length){i.error({title:O("Can not delete"),content:O("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:h.map(f=>`#${f.id}`).join(", ")})});return}const b=!r.find(f=>f.upstream===a&&f.branchIndex!=null)?e("Are you sure you want to delete it?"):O("This node contains branches, deleting will also be preformed to them, are you sure?");i.confirm({title:e("Delete"),content:b,onOk:p})}),[a,i,r,p,e]);return o?o.executed?null:n.jsx(g.Button,{type:"text",shape:"circle",icon:n.jsx(V.DeleteOutlined,{}),onClick:d,className:"workflow-node-remove-button",size:"small"}):null}function Ft(){var a;const{execution:e,setViewJob:t}=H(),{jobs:o}=(a=xe())!=null?a:{},{styles:r}=ne();if(!e)return null;if(!o.length)return n.jsx(Me,{className:r.nodeJobButtonClass,disabled:!0});function s({key:i}){const c=o.find(p=>p.id==i);t(c)}return n.jsx(g.Tooltip,{title:O("View result"),children:o.length>1?n.jsx(g.Dropdown,{menu:{items:o.map(i=>({key:i.id,label:n.jsxs(n.Fragment,{children:[n.jsx(Me,{statusMap:Ke,status:i.status}),n.jsx("time",{children:Q.str2moment(i.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})})),onClick:s,className:r.dropdownClass},children:n.jsx(Me,{statusMap:Ke,status:o[o.length-1].status,className:r.nodeJobButtonClass})}):n.jsx(Me,{statusMap:Ke,status:o[0].status,onClick:()=>t(o[0]),className:r.nodeJobButtonClass})})}function hn(){return{form:T.useForm()}}const yn=()=>{const{values:e,query:t}=T.useForm(),o=xe(),r=l.useAPIClient(),s=l.useActionContext(),a=T.useField();return{run(){return J(this,null,function*(){const p=Q.parse(o.config)(Ge.toJS(e.config)),d=t("result").take();d.setValue(null),d.setFeedback({}),a.data=a.data||{},a.data.loading=!0;try{const{data:{data:m}}=yield r.resource("flow_nodes").test({values:{config:p,type:o.type}});d.setFeedback({type:m.status>0?"success":"error",messages:m.status>0?[O("Resolved")]:[O("Failed")]}),d.setValue(m.result)}catch(m){d.setFeedback({type:"error",messages:m.message})}a.data.loading=!1,s.setFormValueChanged(!1)})}}},qt=y.createContext([]);function gn({name:e,value:t,onChange:o}){return n.jsxs(g.Space,{children:[n.jsx(Dt,{variableOptions:{},value:`{{${e}}}`,disabled:!0}),n.jsx(l.Variable.Input,{useTypedConstant:["string","number","boolean","date"],value:t,onChange:o})]})}function bn({value:e,onChange:t}){const o=y.useContext(qt);return o.length?n.jsx(n.Fragment,{children:o.map(r=>n.jsx(gn,{name:r,value:we.get(e,r),onChange:s=>{we.set(e,r,s),t(e)}},r))}):n.jsx(g.Empty,{image:g.Empty.PRESENTED_IMAGE_SIMPLE,description:O("No variable"),style:{margin:"1em"}})}function xn(){const e=xe(),{values:t}=T.useForm(),r=Q.parse(t).parameters.map(a=>a.key),s=y.useMemo(()=>fe.createForm(),[]);return n.jsx(Ze.Provider,{value:A(C({},e),{config:t}),children:n.jsx(qt.Provider,{value:r,children:n.jsx(l.SchemaComponent,{components:{Alert:g.Alert,TestFormFieldset:bn},scope:{useCancelAction:l.useCancelAction,useRunAction:yn},schema:{type:"void",name:"testButton",title:'{{t("Test run")}}',"x-component":"Action","x-component-props":{icon:"CaretRightOutlined"},properties:{modal:{type:"void","x-decorator":"FormV2","x-decorator-props":{form:s},"x-component":"Action.Modal",title:'{{t("Test run", { ns: "workflow" })}}',properties:{alert:{type:"void","x-component":"Alert","x-component-props":{message:'{{t("Test run will do the actual data manipulating or API calling, please use with caution.", { ns: "workflow" })}}',type:"warning",showIcon:!0,className:l.css`
|
|
411
|
-
margin-bottom: 1em;
|
|
412
|
-
`}},config:{type:"object",title:'{{t("Replace variables", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TestFormFieldset"},actions:{type:"void","x-component":"ActionBar",properties:{submit:{type:"void",title:'{{t("Run")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useRunAction }}"}}}},result:{type:"string",title:'{{t("Result", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5,maxRows:20},style:{whiteSpace:"pre",cursor:"text"}},"x-pattern":"disabled"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Close")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}}}}}}}}})})})}function Tt(e){var I;const{data:t,children:o}=e,r=l.useCompile(),s=l.useAPIClient(),{workflow:a,refresh:i}=(I=H())!=null?I:{},{styles:c}=ne(),d=l.usePlugin(le).instructions.get(t.type),m=a.executed?'{{t("View")}}':'{{t("Configure")}}',[h,v]=y.useState(t.title),[b,f]=y.useState(!1),[k,F]=y.useState(!1),M=y.useMemo(()=>{const D=we.cloneDeep(t.config);return fe.createForm({initialValues:D,disabled:a.executed})},[t,a]),S=y.useCallback(D=>{f(D),D||M.reset()},[M]),E=y.useCallback(function(D){return J(this,null,function*(){var B,G;const N=D||r(d==null?void 0:d.title);v(N),N!==t.title&&(yield(G=(B=s.resource("flow_nodes")).update)==null?void 0:G.call(B,{filterByTk:t.id,values:{title:N}}),i())})},[t,d]),L=y.useCallback(function(D){if(D.target===D.currentTarget){f(!0);return}const N=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let B=D.target;B&&B!==D.currentTarget&&B!==document.documentElement;B=B.parentNode)if(Array.from(B.classList).some(G=>N.has(G))){f(!0),D.stopPropagation();return}},[]);if(!d)return n.jsx("div",{className:l.cx(c.nodeClass,`workflow-node-type-${t.type}`),children:n.jsx(g.Tooltip,{title:O("Node with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`_untyped-${h}`,className:l.cx(c.nodeCardClass,"invalid"),children:[n.jsxs("div",{className:c.nodeHeaderClass,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(g.Tag,{color:"error",children:O("Unknown node")}),n.jsx("span",{className:"workflow-node-id",children:t.id})]}),n.jsxs("div",{className:"workflow-node-actions",children:[n.jsx(At,{}),n.jsx(Ft,{})]})]}),n.jsx(g.Input.TextArea,{value:h,disabled:!0,autoSize:!0})]})})});const $=r(d.title);return n.jsxs("div",{className:l.cx(c.nodeClass,`workflow-node-type-${t.type}`),children:[n.jsxs("div",{role:"button","aria-label":`${$}-${h}`,className:l.cx(c.nodeCardClass,{configuring:b}),onClick:L,children:[n.jsxs("div",{className:c.nodeHeaderClass,children:[n.jsxs("div",{className:l.cx(c.nodeMetaClass,"workflow-node-meta"),children:[n.jsx(g.Tag,{children:$}),n.jsx("span",{className:"workflow-node-id",children:t.id})]}),n.jsxs("div",{className:"workflow-node-actions",children:[n.jsx(At,{}),n.jsx(Ft,{})]})]}),n.jsx(g.Input.TextArea,{disabled:a.executed,value:h,onChange:D=>v(D.target.value),onBlur:D=>E(D.target.value),autoSize:!0}),n.jsx(l.ActionContextProvider,{value:{visible:b,setVisible:S,formValueChanged:k,setFormValueChanged:F},children:n.jsx(l.FormProvider,{form:M,children:n.jsx(l.SchemaComponent,{distributed:!1,scope:A(C({},d.scope),{useFormProviderProps:hn,useUpdateAction:fn}),components:d.components,schema:{type:"void",properties:A(C({},d.view?{view:d.view}:{}),{button:{type:"void","x-content":m,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},[t.id]:{type:"void",title:n.jsxs("div",{className:l.css`
|
|
413
|
-
display: flex;
|
|
414
|
-
justify-content: space-between;
|
|
415
|
-
|
|
416
|
-
strong {
|
|
417
|
-
font-weight: bold;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
.ant-tag {
|
|
421
|
-
margin-inline-end: 0;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
code {
|
|
425
|
-
font-weight: normal;
|
|
426
|
-
}
|
|
427
|
-
`,children:[n.jsx("strong",{children:t.title}),n.jsx(g.Tooltip,{title:O("Variable key of node"),children:n.jsx(g.Tag,{children:n.jsx("code",{children:t.key})})})]}),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:A(C({},d.description?{description:{type:"void","x-component":zt,"x-component-props":{label:O("Node type"),title:d.title,description:d.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
428
|
-
.ant-input,
|
|
429
|
-
.ant-select,
|
|
430
|
-
.ant-cascader-picker,
|
|
431
|
-
.ant-picker,
|
|
432
|
-
.ant-input-number,
|
|
433
|
-
.ant-input-affix-wrapper {
|
|
434
|
-
&.auto-width {
|
|
435
|
-
width: auto;
|
|
436
|
-
min-width: 6em;
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
`},properties:d.fieldset},footer:a.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{flexGrow:1}},properties:A(C({},d.testable?{test:{type:"void","x-component":T.observer(xn),"x-align":"left"}}:{}),{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}})}}}})}})}})})})]}),o]})}const Ve={label:"label",value:"value",children:"children"},Yt={label:`{{t("Node result", { ns: "${u}" })}}`,value:"$jobsMapByNodeKey",useOptions(e){const{instructions:t}=l.usePlugin(le),o=xe(),r=Ut(o),s=[];return r.forEach(a=>{var p;const i=t.get(a.type),c=(p=i.useVariables)==null?void 0:p.call(i,a,e);c&&s.push(c)}),s}},_t={label:`{{t("Trigger variables", { ns: "${u}" })}}`,value:"$context",useOptions(e){var s,a;const{triggers:t}=l.usePlugin(le),{workflow:o}=H(),r=t.get(o.type);return(a=(s=r==null?void 0:r.useVariables)==null?void 0:s.call(r,o.config,e))!=null?a:null}},Kt={label:`{{t("Scope variables", { ns: "${u}" })}}`,value:"$scopes",useOptions(e){const{fieldNames:t=Ve,current:o}=e,{instructions:r}=l.usePlugin(le),s=xe(),a=o!=null?o:s,i=Ht(a),c=[];return i.forEach(p=>{var h,v;const d=r.get(p.type),m=(h=d.useScopeVariables)==null?void 0:h.call(d,p,e);m&&c.push({key:p.key,[t.value]:p.key,[t.label]:(v=p.title)!=null?v:`#${p.id}`,[t.children]:m})}),c}},Zt={label:`{{t("System variables", { ns: "${u}" })}}`,value:"$system",useOptions(e){const{systemVariables:t}=l.usePlugin(le);return l.useCompile()(Array.from(t.getValues()))}},Qe={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function Qt(e,t){var o,r,s,a,i,c;return typeof t=="string"?(o=Qe[t])==null?void 0:o.has(e.interface):typeof t=="object"&&t.type==="reference"?Nt(e)?((r=t.options)==null?void 0:r.entity)&&(e.collectionName===((s=t.options)==null?void 0:s.collection)||((a=t.options)==null?void 0:a.collection)==="*"):e.isForeignKey?e.collectionName===((i=t.options)==null?void 0:i.collection)&&e.name==="id"||e.target===((c=t.options)==null?void 0:c.collection):!1:typeof t=="function"?t(e):!1}function Nt(e){return["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"].includes(e.type)}function Ot(e,t){if(t==null)return null;const o=`${e.name}.`;return t.filter(r=>r.startsWith(o)).map(r=>r.replace(o,""))}function $t({fields:e,types:t,appends:o,depth:r=1,compile:s,getCollectionFields:a}){return e.filter(i=>{const c=t!=null&&t.length?t.some(p=>Qt(i,p)):!0;if(Nt(i)){if(o===null)return r?c||$t({fields:Et(i.target,{compile:s,getCollectionFields:a}),types:t,depth:r-1,appends:o,compile:s,getCollectionFields:a}):!1;const p=Ot(i,o),d=o.includes(i.name);return c?d:((p==null?void 0:p.length)||d)&&$t({fields:Et(i.target,{compile:s,getCollectionFields:a}),types:t,appends:p,compile:s,getCollectionFields:a}).length}else return c})}function Xe(e,t){var a,i;const o=l.useCompile(),r=(i=(a=e.useOptions)==null?void 0:a.call(e,t))==null?void 0:i.filter(Boolean),{fieldNames:s}=t;return{[s.label]:o(e.label),[s.value]:e.value,key:e[s.value],[s.children]:r,disabled:!r||!r.length}}function me(e={}){var s;const t=Object.assign({},Ve,(s=e.fieldNames)!=null?s:{}),o=Object.assign(e,{fieldNames:t});return[Xe(Kt,o),Xe(Yt,o),Xe(_t,o),Xe(Zt,o)]}function Et(e,{compile:t,getCollectionFields:o}){var d,m,h,v;const[r,s]=l.parseCollectionName(e),a=o(s,r),i=[],c=[];a.forEach(b=>{if(b.isForeignKey&&!b.primaryKey)i.push(b);else{const f=a.find(k=>k.name===b.foreignKey);f&&i.push(f),c.push(b)}});const p=we.uniqBy(i,"name");for(let b=c.length-1;b>=0;b--){const f=c[b];if(f.type==="belongsTo"){const k=p.findIndex(F=>F.name===f.foreignKey);if(k>-1){const F=p[k];c.splice(b,0,A(C(C({},f),F),{uiSchema:A(C({},f.uiSchema),{title:(d=F.uiSchema)!=null&&d.title?t((m=F.uiSchema)==null?void 0:m.title):F.name})})),p.splice(k,1)}else c.splice(b,0,A(C({},f),{name:f.foreignKey,type:"bigInt",isForeignKey:!0,interface:f.interface,uiSchema:A(C({},f.uiSchema),{title:(h=f.uiSchema)!=null&&h.title?`${t((v=f.uiSchema)==null?void 0:v.title)} ID`:f.name})}))}else f.type==="context"&&f.collectionName==="users"&&c.splice(b,1)}return c.push(...p),we.uniqBy(c,"name").filter(b=>b.interface&&!b.hidden)}function vn(e){const t=Ot(e.field,e.appends),o=Te(C({collection:`${e.field.dataSourceKey&&e.field.dataSourceKey!=="main"?`${e.field.dataSourceKey}:`:""}${e.field.target}`,types:e.types,appends:t,depth:e.depth-1},this));e.loadChildren=null,o.length?e.children=o:(e.isLeaf=!0,!e.types||e.types.some(s=>Qt(e.field,s))||(e.disabled=!0))}function Te(e){const{fields:t,collection:o,types:r,appends:s=[],depth:a=1,compile:i,getCollectionFields:c,fieldNames:p=Ve}=e,d=t!=null?t:Et(o,{compile:i,getCollectionFields:c}),m=vn.bind({compile:i,getCollectionFields:c,fieldNames:p});return $t({fields:d,types:r,depth:a,appends:s,compile:i,getCollectionFields:c}).map(v=>{var F;const b=i(((F=v.uiSchema)==null?void 0:F.title)||v.name),f=Ot(v,s),k=!Nt(v)||f&&!f.length&&!s.includes(v.name)||!1;return{[p.label]:b,key:v.name,[p.value]:v.name,isLeaf:k,loadChildren:k?null:m,field:v,depth:a,appends:s,types:r}})}function je(e){const t=l.useApp(),{collectionManager:o}=t.dataSourceManager.getDataSource(e);return y.useCallback(r=>o.getCollectionAllFields(r),[o])}function Dt(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.Input,C({scope:s},t))}function It(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.TextArea,C({scope:s},t))}function wn(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.RawTextArea,C({scope:s},t))}function Cn(o){var r=o,{variableOptions:e}=r,t=Z(r,["variableOptions"]);const s=me(e);return n.jsx(l.Variable.JSON,C({scope:s},t))}function Re({value:e,onChange:t,renderSchemaComponent:o}){const r=me();return n.jsx(l.Variable.Input,{value:e,onChange:t,scope:r,children:o()})}function ke(e){const a=e,{options:t=[],direction:o}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(g.Radio.Group,A(C({},r),{children:n.jsx(g.Space,{direction:o,children:t.map(i=>n.jsxs(g.Radio,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
440
|
-
& + .anticon {
|
|
441
|
-
margin-left: 0.25em;
|
|
442
|
-
}
|
|
443
|
-
`,children:s(i.label)}),i.tooltip&&n.jsx(g.Tooltip,{title:s(i.tooltip),children:n.jsx(V.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function kn(e){const a=e,{options:t=[],direction:o}=a,r=Z(a,["options","direction"]),s=l.useCompile();return n.jsx(g.Checkbox.Group,A(C({},r),{children:n.jsx(g.Space,{direction:o,children:t.map(i=>n.jsxs(g.Checkbox,{value:i.value,children:[n.jsx("span",{className:l.css`
|
|
444
|
-
& + .anticon {
|
|
445
|
-
margin-left: 0.25em;
|
|
446
|
-
}
|
|
447
|
-
`,children:s(i.label)}),i.tooltip&&n.jsx(g.Tooltip,{title:s(i.tooltip),children:n.jsx(V.QuestionCircleOutlined,{style:{color:"#666"}})})]},i.value))})}))}function Xt(){const e=T.useFieldSchema(),t=l.useCompile();return n.jsxs(l.GeneralSchemaDesigner,{title:t(e.title),children:[n.jsx(l.SchemaSettingsBlockTitleItem,{}),n.jsx(l.SchemaSettingsDivider,{}),n.jsx(l.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}})]})}const Ne=()=>null;function Sn(){const a=l.useSchemaInitializerItem(),{node:t,resultTitle:o}=a,r=Z(a,["node","resultTitle"]),{insert:s}=l.useSchemaInitializer();return n.jsx(l.SchemaInitializerItem,A(C({},r),{onClick:()=>{var i;s({type:"void",name:t.id,title:t.title,"x-component":"CardItem","x-component-props":{title:(i=t.title)!=null?i:`#${t.id}`},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:o,"x-component":"ValueBlock.Result","x-component-props":{dataSource:`{{$jobsMapByNodeKey.${t.key}}}`}}}})}}))}function An({dataSource:e}){var s;const t=T.useFieldSchema(),{execution:o}=H();if(!o)return t.title;const r=Q.parse(e)({$jobsMapByNodeKey:((s=o.jobs)!=null?s:[]).reduce((a,i)=>Object.assign(a,{[i.nodeKey]:i.result}),{})});return n.jsx("pre",{className:l.css`
|
|
448
|
-
margin: 0;
|
|
449
|
-
`,children:JSON.stringify(r,null,2)})}Ne.Initializer=Sn,Ne.Result=An,Ne.Designer=Xt;const Pt=e=>{const t=De.evaluators.get(e);return t&&t.link?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:l.css`
|
|
450
|
-
&:after {
|
|
451
|
-
content: ':';
|
|
452
|
-
}
|
|
453
|
-
& + a {
|
|
454
|
-
margin-left: 0.25em;
|
|
455
|
-
}
|
|
456
|
-
`,children:l.i18n.t("Syntax references")}),n.jsx("a",{href:t.link,target:"_blank",rel:"noreferrer",children:t.label})]}):null},Y=new Q.Registry;Y.register("equal",{name:"=",type:"boolean",group:"boolean"}),Y.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),Y.register("gt",{name:">",type:"boolean",group:"boolean"}),Y.register("gte",{name:"≥",type:"boolean",group:"boolean"}),Y.register("lt",{name:"<",type:"boolean",group:"boolean"}),Y.register("lte",{name:"≤",type:"boolean",group:"boolean"}),Y.register("add",{name:"+",type:"number",group:"number"}),Y.register("minus",{name:"-",type:"number",group:"number"}),Y.register("multiple",{name:"*",type:"number",group:"number"}),Y.register("divide",{name:"/",type:"number",group:"number"}),Y.register("mod",{name:"%",type:"number",group:"number"}),Y.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),Y.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),Y.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),Y.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),Y.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),Y.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),Y.register("concat",{name:`{{t("concat", { ns: "${u}" })}}`,type:"string",group:"string"});const Fn=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:`{{t("Arithmetic calculation", { ns: "${u}" })}}`},{value:"string",title:`{{t("String operation", { ns: "${u}" })}}`},{value:"date",title:`{{t("Date", { ns: "${u}" })}}`}];function Rt(e){return Array.from(Y.getEntities()).filter(([t,o])=>o.group===e)}function Tn({calculator:e,operands:t=[],onChange:o}){const r=l.useCompile(),s=y.useContext(to),a=s(),i=s(),c=y.useCallback(m=>o({calculator:e,operands:[m,t[1]]}),[e,o,t]),p=y.useCallback(m=>o({calculator:e,operands:[t[0],m]}),[e,o,t]),d=y.useCallback(m=>o({operands:t,calculator:m}),[o,t]);return n.jsxs("fieldset",{className:l.css`
|
|
457
|
-
display: flex;
|
|
458
|
-
gap: 0.5em;
|
|
459
|
-
align-items: center;
|
|
460
|
-
flex-wrap: wrap;
|
|
461
|
-
`,children:[n.jsx(l.Variable.Input,{changeOnSelect:!0,value:t[0],onChange:c,scope:a,useTypedConstant:!0}),n.jsx(g.Select,{role:"button","aria-label":"select-operator-calc",value:e,onChange:d,placeholder:O("Operator"),popupMatchSelectWidth:!1,className:"auto-width",children:Fn.filter(m=>!!Rt(m.value).length).map(m=>n.jsx(g.Select.OptGroup,{label:r(m.title),children:Rt(m.value).map(([h,{name:v}])=>n.jsx(g.Select.Option,{value:h,children:r(v)},h))},m.value))}),n.jsx(l.Variable.Input,{changeOnSelect:!0,value:t[1],onChange:p,scope:i,useTypedConstant:!0})]})}function Nn({value:e,onChange:t,onRemove:o}){if(!e)return null;const{calculator:r,operands:s=[]}=e;return n.jsxs("div",{className:l.css`
|
|
462
|
-
display: flex;
|
|
463
|
-
position: relative;
|
|
464
|
-
margin: 0.5em 0;
|
|
465
|
-
`,children:[e.group?n.jsx(eo,{value:e.group,onChange:a=>t(A(C({},e),{group:a}))}):n.jsx(Tn,{operands:s,calculator:r,onChange:t}),n.jsx(g.Button,{"aria-label":"icon-close",onClick:o,type:"link",icon:n.jsx(V.CloseCircleOutlined,{})})]})}function eo({value:e,onChange:t}){const{t:o}=X.useTranslation(),{type:r="and",calculations:s=[]}=e,a=y.useCallback(()=>{t(A(C({},e),{calculations:[...s,{not:!1,calculator:"equal"}]}))},[e,s,t]),i=y.useCallback(()=>{t(A(C({},e),{calculations:[...s,{not:!1,group:{type:"and",calculations:[]}}]}))},[e,s,t]),c=y.useCallback(d=>{s.splice(d,1),t(A(C({},e),{calculations:[...s]}))},[e,s,t]),p=y.useCallback((d,m)=>{s.splice(d,1,m),t(A(C({},e),{calculations:[...s]}))},[e,s,t]);return n.jsxs("div",{className:l.cx("node-type-condition-group",l.css`
|
|
466
|
-
position: relative;
|
|
467
|
-
width: 100%;
|
|
468
|
-
.node-type-condition-group {
|
|
469
|
-
padding: 0.5em 1em;
|
|
470
|
-
border: 1px dashed #ddd;
|
|
471
|
-
}
|
|
472
|
-
+ button {
|
|
473
|
-
position: absolute;
|
|
474
|
-
right: 0;
|
|
475
|
-
}
|
|
476
|
-
`),children:[n.jsx("div",{className:l.css`
|
|
477
|
-
display: flex;
|
|
478
|
-
align-items: center;
|
|
479
|
-
gap: 0.5em;
|
|
480
|
-
.ant-select {
|
|
481
|
-
width: auto;
|
|
482
|
-
min-width: 6em;
|
|
483
|
-
}
|
|
484
|
-
`,children:n.jsxs(X.Trans,{children:["Meet ",n.jsxs(g.Select,{role:"button","data-testid":"filter-select-all-or-any",value:r,onChange:d=>t(A(C({},e),{type:d})),children:[n.jsx(g.Select.Option,{value:"and",children:"All"}),n.jsx(g.Select.Option,{value:"or",children:"Any"})]})," conditions in the group"]})}),n.jsx("div",{className:"calculation-items",children:s.map((d,m)=>n.jsx(Nn,{value:d,onChange:p.bind(this,m),onRemove:()=>c(m)},`${d.calculator}_${m}`))}),n.jsxs("div",{className:l.css`
|
|
485
|
-
button {
|
|
486
|
-
padding: 0;
|
|
487
|
-
&:not(:last-child) {
|
|
488
|
-
margin-right: 1em;
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
`,children:[n.jsx(g.Button,{type:"link",onClick:a,children:o("Add condition")}),n.jsx(g.Button,{type:"link",onClick:i,children:o("Add condition group")})]})]})}const to=y.createContext(me);function oo({value:e,onChange:t,useVariableHook:o=me}){const r=e&&Object.keys(e).length?e:{group:{type:"and",calculations:[]}};return n.jsx(to.Provider,{value:o,children:n.jsx(eo,{value:r.group,onChange:s=>t(A(C({},r),{group:s}))})})}function On(e){return n.jsx(g.Card,{children:n.jsx(gt.FormLayout,{layout:e.layout||"vertical",children:e.children})})}function no(e){var v;const{upstream:t,branchIndex:o=null}=e,r=l.usePlugin(le),s=l.useCompile(),{workflow:a}=(v=H())!=null?v:{},i=Array.from(r.instructions.getValues()),{styles:c}=ne(),{onCreate:p,creating:d}=et(),m=y.useMemo(()=>{const b=[{key:"control",label:`{{t("Control", { ns: "${u}" })}}`},{key:"calculation",label:`{{t("Calculation", { ns: "${u}" })}}`},{key:"collection",label:`{{t("Collection operations", { ns: "${u}" })}}`},{key:"manual",label:`{{t("Manual", { ns: "${u}" })}}`},{key:"extended",label:`{{t("Extended types", { ns: "${u}" })}}`}].map(f=>{const k=i.filter(F=>F.group===f.key&&(F.isAvailable?F.isAvailable({engine:r,workflow:a,upstream:t,branchIndex:o}):!0));return A(C({},f),{type:"group",children:k.map(F=>({role:"button","aria-label":F.type,key:F.type,label:F.title}))})}).filter(f=>f.children.length);return s(b)},[o,s,r,i,t,a]),h=y.useCallback(f=>J(this,[f],function*({keyPath:b}){const[k]=b;p({type:k,upstream:t,branchIndex:o})}),[o,p,t]);return a?n.jsx("div",{className:c.addButtonClass,children:n.jsx(g.Dropdown,{menu:{items:m,onClick:h},disabled:a.executed,overlayClassName:l.css`
|
|
492
|
-
.ant-dropdown-menu-root {
|
|
493
|
-
max-height: 30em;
|
|
494
|
-
overflow-y: auto;
|
|
495
|
-
}
|
|
496
|
-
`,children:n.jsx(g.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:n.jsx(V.PlusOutlined,{}),loading:(d==null?void 0:d.upstreamId)==(t==null?void 0:t.id)&&(d==null?void 0:d.branchIndex)===o,size:"small"})})}):null}function $n(){const e=T.useForm(),t=l.useAPIClient(),{workflow:o,refresh:r}=H(),{presetting:s,setPresetting:a,setCreating:i}=et(),c=l.useActionContext();return{run(){return J(this,null,function*(){if(s){yield e.submit(),i(s.data);try{const{data:{data:d}}=yield t.resource("workflows.nodes",o.id).create({values:A(C({},s.data),{config:C(C({},s.data.config),e.values.config)})});typeof e.values.downstreamBranchIndex=="number"&&d.downstreamId&&(yield t.resource("flow_nodes").update({filterByTk:d.downstreamId,values:{branchIndex:e.values.downstreamBranchIndex,upstream:{id:d.id,downstreamId:null}},updateAssociationValues:["upstream"]})),c.setVisible(!1),a(null),r()}catch(d){console.error(d)}finally{i(null)}}})}}}const ro=y.createContext(null);function et(){return y.useContext(ro)}const En=[{label:`{{t('After end of branches', { ns: "${u}" })}}`,value:!1},{label:`{{t('Inside of branch', { ns: "${u}" })}}`,value:0}],Dn=T.observer(e=>{var i,c;const{presetting:t}=et(),{nodes:o}=H(),{values:r}=T.useForm(),s=y.useMemo(()=>{var v;if(!(t!=null&&t.instruction))return[];const{instruction:p,data:d}=t;if(!(d.upstreamId?o.find(b=>b.upstreamId===d.upstreamId&&b.branchIndex===d.branchIndex):o.find(b=>b.upstreamId===null)))return[];const h=typeof p.branching=="function"?p.branching((v=r.config)!=null?v:{}):p.branching;return h?h===!0?En:h:[]},[t,o,r.config]);if(!s.length)return null;const{data:a}=t;return n.jsx(l.SchemaComponent,{components:{RadioWithTooltip:ke},schema:{name:`${(i=a.type)!=null?i:"unknown"}-${(c=a.upstreamId)!=null?c:"root"}-${a.branchIndex}`,type:"void",properties:{downstreamBranchIndex:{type:"number",title:O("Move all downstream nodes to",{ns:u}),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:s,direction:"vertical"},default:!1,required:!0}}}})});function In(){const{presetting:e}=et();return e!=null&&e.instruction.presetFieldset?n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{config:{type:"object",properties:e.instruction.presetFieldset}}}}):null}function Pn(e){var M;const t=l.useAPIClient(),o=l.useCompile(),r=l.usePlugin(le),[s,a]=y.useState(null),[i,c]=y.useState(null),[p,d]=y.useState(!1),{workflow:m,nodes:h,refresh:v}=(M=H())!=null?M:{},b=y.useMemo(()=>fe.createForm(),[]),f=y.useCallback(S=>{S||(b.reset(),b.clearFormGraph("*"),c(null))},[b]),k=y.useCallback(S=>J(this,null,function*(){a(S);try{yield t.resource("workflows.nodes",m.id).create({values:S}),v()}catch(E){console.error(E)}finally{a(null)}}),[t,v,m.id]),F=y.useCallback(({type:S,upstream:E,branchIndex:L})=>{var N,B,G;const $=r.instructions.get(S);if(!$){console.error(`Instruction "${S}" not found`);return}const I={key:Q.uid(),type:S,upstreamId:(N=E==null?void 0:E.id)!=null?N:null,branchIndex:L,title:o($.title),config:(G=(B=$.createDefaultConfig)==null?void 0:B.call($))!=null?G:{}},D=E!=null&&E.id?h.find(U=>U.upstreamId===I.upstreamId&&U.branchIndex===I.branchIndex):h.find(U=>U.upstreamId===null);if($.presetFieldset||(typeof $.branching=="function"?$.branching(I.config):$.branching)&&D){c({data:I,instruction:$});return}k(I)},[o,k,r.instructions]);return n.jsxs(ro.Provider,{value:{presetting:i,setPresetting:c,onCreate:F,creating:s,setCreating:a},children:[e.children,n.jsx(l.ActionContextProvider,{value:{visible:!!i,setVisible:f,formValueChanged:p,setFormValueChanged:d,openSize:"small"},children:n.jsx(l.SchemaComponent,{components:{DownstreamBranchIndex:Dn,PresetFieldset:In},scope:{useCancelAction:l.useCancelAction,useAddNodeSubmitAction:$n},schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:b},"x-component":"Action.Modal",title:`{{ t("Add node", { ns: "${u}" }) }}`,properties:{config:{type:"void","x-component":"PresetFieldset"},downstreamBranchIndex:{type:"void","x-component":"DownstreamBranchIndex"},footer:{"x-component":"Action.Modal.Footer",properties:{actions:{type:"void","x-component":"ActionBar",properties:{cancel:{type:"void",title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},submit:{type:"void",title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit",useAction:"{{ useAddNodeSubmitAction }}"}}}}}}}}})})]})}function tt({from:e=null,entry:t=null,branchIndex:o=null,controller:r=null,className:s,end:a}){const{styles:i}=ne(),{getAriaLabel:c}=St(e,o),p=[];for(let d=t;d;d=d.downstream)p.push(d);return n.jsxs("div",{className:l.cx("workflow-branch",i.branchClass,s),children:[n.jsx("div",{className:"workflow-branch-lines"}),r,n.jsx(no,{"aria-label":c(),upstream:e,branchIndex:o}),n.jsx("div",{className:"workflow-node-list",children:p.map(d=>n.jsx(Gt,{data:d},d.id))}),a?n.jsx("div",{className:"end-sign",children:n.jsx(V.CloseOutlined,{})}):null]})}function Mn(){var a;const e=T.useForm(),t=l.useAPIClient(),{workflow:o}=(a=H())!=null?a:{},r=l.useActionContext(),{refresh:s}=l.useResourceActionContext();return{run(){return J(this,null,function*(){if(o.executed){g.message.error(O("Trigger in executed workflow cannot be modified"));return}yield e.submit(),yield t.resource("workflows").update({filterByTk:o.id,values:{config:e.values}}),r.setFormValueChanged(!1),r.setVisible(!1),s()})}}}class Mt{constructor(){w(this,"sync");w(this,"title");w(this,"description");w(this,"fieldset");w(this,"view");w(this,"scope");w(this,"components");w(this,"initializers");w(this,"isActionTriggerable")}}function Bn(){const e=l.useCompile(),{workflow:t,execution:o}=H(),{styles:r}=ne(),s=Bt();return o?n.jsx(l.SchemaComponent,{components:{Tooltip:g.Tooltip},schema:{type:"void",name:"execution","x-decorator":"Tooltip","x-decorator-props":{title:O("View result")},"x-component":"Action","x-component-props":{title:n.jsx(V.InfoOutlined,{}),shape:"circle",size:"small",className:r.nodeJobButtonClass,type:"primary"},properties:{[o.id]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:n.jsxs("div",{className:l.cx(r.nodeTitleClass),children:[n.jsx(g.Tag,{children:e(s.title)}),n.jsx("strong",{children:t.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",o.id]})]}),properties:{createdAt:{type:"string",title:`{{t("Triggered at", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:`{{t("Trigger variables", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:l.css`
|
|
497
|
-
padding: 1em;
|
|
498
|
-
background-color: #f3f3f3;
|
|
499
|
-
`},"x-read-pretty":!0}}}}}}):null}function Vn(){return{form:T.useForm()}}const jn=()=>{const e=l.useAPIClient(),{workflow:t,refresh:o}=H(),[r,s]=y.useState(""),[a,i]=y.useState(!1),[c,p]=y.useState(!1),{styles:d}=ne(),m=l.useCompile(),h=Bt();y.useEffect(()=>{var $,I;t&&s((I=($=t.triggerTitle)!=null?$:t.title)!=null?I:m(h==null?void 0:h.title))},[t,h]);const v=y.useMemo(()=>{const $=we.cloneDeep(t.config);return fe.createForm({initialValues:$,disabled:t.executed})},[t]),b=y.useCallback($=>{i($),$||v.reset()},[v]),f=y.useCallback(function($){return J(this,null,function*(){const I=$||m(h==null?void 0:h.title);s(I),I!==t.triggerTitle&&(yield e.resource("workflows").update({filterByTk:t.id,values:{triggerTitle:I}}),o())})},[t,h]),k=y.useCallback(function($){var D;if($.target===$.currentTarget){i(!0);return}const I=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]);for(let N=$.target;N&&N!==$.currentTarget;N=N.parentNode)if(Array.from((D=N.classList)!=null?D:[]).some(B=>I.has(B))){i(!0),$.stopPropagation();return}},[]),F=t.executed?'{{t("View")}}':'{{t("Configure")}}',M=O("Trigger");if(!h)return n.jsx(g.Tooltip,{title:O("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type."),children:n.jsxs("div",{role:"button","aria-label":`${M}-${r}`,className:l.cx(d.nodeCardClass,"invalid"),onClick:k,children:[n.jsx("div",{className:d.nodeHeaderClass,children:n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsx(g.Tag,{color:"error",children:O("Unknown trigger")})})}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(g.Input.TextArea,{value:r,disabled:!0,autoSize:!0})})]})});const{fieldset:S,scope:E,components:L}=h;return n.jsxs("div",{role:"button","aria-label":`${M}-${r}`,className:l.cx(d.nodeCardClass),onClick:k,children:[n.jsxs("div",{className:d.nodeHeaderClass,children:[n.jsx("div",{className:l.cx(d.nodeMetaClass,"workflow-node-meta"),children:n.jsxs(g.Tag,{color:"gold",children:[n.jsx(V.ThunderboltOutlined,{}),n.jsx("span",{className:"type",children:m(h.title)})]})}),n.jsx("div",{className:"workflow-node-actions",children:n.jsx(Bn,{})})]}),n.jsx("div",{className:"workflow-node-title",children:n.jsx(g.Input.TextArea,{value:r,onChange:$=>s($.target.value),onBlur:$=>f($.target.value),autoSize:!0,disabled:t.executed})}),n.jsx(l.ActionContextProvider,{value:{visible:a,setVisible:b,formValueChanged:c,setFormValueChanged:p},children:n.jsx(l.FormProvider,{form:v,children:n.jsx(l.SchemaComponent,{scope:A(C({},E),{useFormProviderProps:Vn}),components:L,schema:{name:`workflow-trigger-${t.id}`,type:"void",properties:{config:{type:"void","x-content":F,"x-component":g.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:M,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:A(C({},h.description?{description:{type:"void","x-component":zt,"x-component-props":{label:O("Trigger type"),title:h.title,description:h.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
500
|
-
.ant-select.auto-width {
|
|
501
|
-
width: auto;
|
|
502
|
-
min-width: 6em;
|
|
503
|
-
}
|
|
504
|
-
`},properties:S},actions:C({},t.executed?{}:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:Mn}}}})})}}}})})})]})};function Bt(){const e=l.usePlugin(le),{workflow:t}=H();return e.triggers.get(t.type)}function so({entry:e}){const{styles:t}=ne(),{workflow:o}=H(),[r,s]=y.useState(100);return n.jsxs("div",{className:"workflow-canvas-wrapper",children:[n.jsx(on,{FallbackComponent:l.ErrorFallback,onError:console.error,children:n.jsx(Pn,{children:n.jsx("div",{className:"workflow-canvas",style:{zoom:r/100},children:n.jsx("div",{className:l.cx(t.branchBlockClass,l.css`
|
|
505
|
-
margin-top: 0 !important;
|
|
506
|
-
`),children:n.jsxs("div",{className:t.branchClass,children:[o!=null&&o.executed?n.jsx(g.Alert,{type:"warning",message:O("Executed workflow cannot be modified. Could be copied to a new version to modify."),showIcon:!0,className:l.css`
|
|
507
|
-
margin-bottom: 1em;
|
|
508
|
-
`}):null,n.jsx(jn,{}),n.jsx("div",{className:l.cx(t.branchBlockClass,l.css`
|
|
509
|
-
margin-top: 0 !important;
|
|
510
|
-
`),children:n.jsx(tt,{entry:e})}),n.jsx("div",{className:t.terminalClass,children:O("End")})]})})})})}),n.jsx("div",{className:"workflow-canvas-zoomer",children:n.jsx(g.Slider,{vertical:!0,reverse:!0,defaultValue:100,step:10,min:10,value:r,onChange:s})})]})}function Wn(e,t=[]){const o=new Map;e.forEach(r=>{r.jobs=[],o.set(r.id,r)}),t.forEach(r=>{const s=o.get(r.nodeId);s.jobs.push(r),r.node={id:s.id,key:s.key,title:s.title,type:s.type}}),e.forEach(r=>{r.jobs=r.jobs.sort((s,a)=>s.id-a.id)})}function Ln(){const{instructions:e}=l.usePlugin(le),t=l.useCompile(),{viewJob:o,setViewJob:r}=H(),{styles:s}=ne(),{node:a={}}=o!=null?o:{},i=e.get(a.type);return n.jsx(l.ActionContextProvider,{value:{visible:!!o,setVisible:r},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`${o==null?void 0:o.id}-${o==null?void 0:o.updatedAt}-modal`]:{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:o},"x-component":"Action.Modal",title:n.jsxs("div",{className:s.nodeTitleClass,children:[n.jsx(g.Tag,{children:t(i==null?void 0:i.title)}),n.jsx("strong",{children:a.title}),n.jsxs("span",{className:"workflow-node-id",children:["#",a.id]})]}),properties:{status:{type:"number",title:`{{t("Status", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Select",enum:kt,"x-read-pretty":!0},updatedAt:{type:"string",title:`{{t("Executed at", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},result:{type:"object",title:`{{t("Node result", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:s.nodeJobResultClass},"x-read-pretty":!0}}}}}})})}function zn(e){const{execution:t}=H(),o=l.useAPIClient(),r=se.useNavigate(),{styles:s}=ne(),[a,i]=y.useState([]),[c,p]=y.useState([]);y.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$lt:t.id}},sort:"-createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:m})=>{i(m.data)}).catch(()=>{})},[t]),y.useEffect(()=>{t&&o.resource("executions").list({filter:{key:t.key,id:{$gt:t.id}},sort:"createdAt",pageSize:10,fields:["id","status","createdAt"]}).then(({data:m})=>{p(m.data.reverse())}).catch(()=>{})},[t]);const d=y.useCallback(({key:m})=>{m!=t.id&&r(qe(m))},[t]);return t?n.jsx(g.Dropdown,{menu:{onClick:d,defaultSelectedKeys:[`${t.id}`],className:l.cx(s.dropdownClass,s.executionsDropdownRowClass),items:[...c,t,...a].map(m=>({key:m.id,label:n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"id",children:`#${m.id}`}),n.jsx("time",{children:Q.str2moment(m.createdAt).format("YYYY-MM-DD HH:mm:ss")})]}),icon:n.jsx("span",{children:n.jsx(Me,{statusMap:_e,status:m.status})})}))},children:n.jsxs(g.Space,{children:[n.jsx("strong",{children:`#${t.id}`}),n.jsx(V.DownOutlined,{})]})}):null}function Jn(){var S;const{t:e}=X.useTranslation(),t=l.useCompile(),{data:o,loading:r,refresh:s}=l.useResourceActionContext(),{setTitle:a}=l.useDocumentTitle(),[i,c]=y.useState(null),p=l.useApp(),d=l.useAPIClient();y.useEffect(()=>{var D;const{workflow:I}=(D=o==null?void 0:o.data)!=null?D:{};a==null||a(`${I!=null&&I.title?`${I.title} - `:""}${O("Execution history")}`)},[o==null?void 0:o.data]);const m=y.useCallback(()=>{g.Modal.confirm({title:O("Cancel the execution"),icon:n.jsx(V.ExclamationCircleFilled,{}),content:O("Are you sure you want to cancel the execution?"),onOk:()=>{d.resource("executions").cancel({filterByTk:o==null?void 0:o.data.id}).then(()=>{g.message.success(e("Operation succeeded")),s()}).catch(I=>{console.error(I.data.error)})}})},[o==null?void 0:o.data]);if(!(o!=null&&o.data))return r?n.jsx(g.Spin,{}):n.jsx(g.Result,{status:"404",title:"Not found"});const E=(S=o==null?void 0:o.data)!=null?S:{},{jobs:h=[],workflow:L={}}=E,$=L,{nodes:v=[],revisions:b=[]}=$,f=Z($,["nodes","revisions"]),k=Z(E,["jobs","workflow"]);vt(v),Wn(v,h);const F=v.find(I=>!I.upstream),M=_e[k.status];return n.jsxs(Ie.Provider,{value:{workflow:f.type?f:null,nodes:v,execution:k,viewJob:i,setViewJob:c},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(g.Breadcrumb,{items:[{title:n.jsx(se.Link,{to:p.pluginSettingsManager.getRoutePath("workflow"),children:O("Workflow")})},{title:n.jsx(g.Tooltip,{title:`Key: ${f.key}`,children:n.jsx(se.Link,{to:Ce(f.id),children:f.title})})},{title:n.jsx(zn,{})}]})}),n.jsxs("aside",{children:[n.jsx(g.Tag,{color:M.color,children:t(M.label)}),k.status?null:n.jsx(g.Tooltip,{title:O("Cancel the execution"),children:n.jsx(g.Button,{type:"link",danger:!0,onClick:m,shape:"circle",size:"small",icon:n.jsx(V.StopOutlined,{})})}),n.jsx("time",{children:Q.str2moment(k.updatedAt).format("YYYY-MM-DD HH:mm:ss")})]})]}),n.jsx(so,{entry:F}),n.jsx(Ln,{})]})}const lo=()=>{const e=se.useParams(),{styles:t}=ne();return n.jsx("div",{className:l.cx(t.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`execution_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"executions",fields:[]},resourceName:"executions",request:{resource:"executions",action:"get",params:{filter:e,appends:["jobs","workflow","workflow.nodes"]}}},"x-component":"ExecutionCanvas"}}},components:{ExecutionCanvas:Jn}})})},ao=()=>{const{t:e}=X.useTranslation(),{id:t}=l.useRecord(),{setVisible:o}=l.useActionContext();return n.jsx(se.Link,{to:qe(t),onClick:()=>o(!1),children:e("View")})},Un={name:"execution-executions",fields:[{interface:"id",type:"bigInt",name:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"Input","x-component-props":{},"x-read-pretty":!0}},{interface:"createdAt",type:"datetime",name:"createdAt",uiSchema:{type:"datetime",title:`{{t("Triggered at", { ns: "${u}" })}}`,"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{interface:"m2o",type:"belongsTo",name:"workflowId",uiSchema:{type:"number",title:`{{t("Version", { ns: "${u}" })}}`,"x-component"({value:e}){const{setVisible:t}=l.useActionContext();return n.jsx(se.Link,{to:Ce(e),onClick:()=>t(!1),children:`#${e}`})}}},{type:"number",name:"status",interface:"select",uiSchema:{title:`{{t("Status", { ns: "${u}" })}}`,type:"string","x-component":"Select","x-decorator":"FormItem",enum:Ye}}]},io={type:"void",name:"executionHistoryDrawer",title:`{{t("Execution history", { ns: "${u}" })}}`,"x-component":"Action.Drawer",properties:{content:{type:"void","x-decorator":"ExecutionResourceProvider","x-decorator-props":{collection:Un,resourceName:"executions",request:{resource:"executions",action:"list",params:{appends:["workflow.id","workflow.title"],pageSize:20,sort:["-createdAt"],filter:{}}}},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},clear:{type:"void",title:'{{t("Clear")}}',"x-component":"Action","x-component-props":{useAction(){const{t:e}=X.useTranslation(),{refresh:t,defaultRequest:o}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext();return{run(){return J(this,null,function*(){var i;yield r.destroy({filter:(i=o.params)==null?void 0:i.filter}),g.message.success(e("Operation succeeded")),t(),s(!1)})}}},confirm:{title:`{{t("Clear all executions", { ns: "${u}" })}}`,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: "${u}" })}}`}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{id:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{id:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},createdAt:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{createdAt:{type:"datetime","x-component":"CollectionField","x-component-props":{showTime:!0},"x-read-pretty":!0}}},workflowId:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{workflowId:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:`{{t("Status", { ns: "${u}" })}}`,properties:{status:{type:"number","x-decorator":"ExecutionStatusColumn","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{link:{type:"void","x-component":"ExecutionLink"},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"},"x-reactions":[{dependencies:["..status"],fulfill:{state:{visible:`{{ $deps[0] !== ${ie.STARTED} }}`}}}]}}}}}}}}}}};function co(e){var a;const o=l.useCompile()(e.label),r=y.useCallback(i=>{i.preventDefault(),i.stopPropagation()},[]),{color:s}=(a=_e[e.value])!=null?a:{};return n.jsx(g.Tag,{color:s,onMouseDown:r,closable:e.closable,onClose:e.onClose,children:o})}function Hn(e){const t=l.useCompile();return n.jsxs(n.Fragment,{children:[n.jsx(co,C({},e)),e.description?n.jsx("span",{children:t(e.description)}):null]})}function Gn(t){var e=Z(t,[]);const o=e.multiple?"multiple":null;return n.jsx(g.Select,A(C({role:"button","data-testid":`select-${o||"single"}`},e),{mode:o,optionLabelProp:"label",tagRender:co,children:Ye.filter(r=>!!r.value&&r.value!==ie.ABORTED).map(r=>n.jsx(g.Select.Option,A(C({},r),{children:n.jsx(Hn,C({},r))}),r.value))}))}function uo(e){const{t}=X.useTranslation(),{refresh:o}=l.useResourceActionContext(),{resource:r}=l.useResourceContext(),s=l.useRecord(),a=y.useCallback(()=>{g.Modal.confirm({title:O("Cancel the execution"),icon:n.jsx(V.ExclamationCircleFilled,{}),content:O("Are you sure you want to cancel the execution?"),onOk:()=>{r.cancel({filterByTk:s.id}).then(()=>{g.message.success(t("Operation succeeded")),o()}).catch(i=>{console.error(i.data.error)})}})},[s]);return n.jsxs("div",{className:l.css`
|
|
511
|
-
display: flex;
|
|
512
|
-
`,children:[e.children,s.status?null:n.jsx(g.Tooltip,{title:O("Cancel the execution"),children:n.jsx(g.Button,{type:"link",danger:!0,onClick:a,shape:"circle",size:"small",icon:n.jsx(V.StopOutlined,{})})})]})}function po(){const e=l.useResourceActionContext();return{onClick(){return J(this,null,function*(){var o;(o=e==null?void 0:e.refresh)==null||o.call(e)})}}}function qn(r){var s=r,{request:e,filter:t={}}=s,o=Z(s,["request","filter"]);var c;const{workflow:a}=H(),i=A(C({},o),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))}function Yn(){var I;const e=se.useNavigate(),{t}=X.useTranslation(),o=l.useApp(),{data:r,refresh:s,loading:a}=l.useResourceActionContext(),{resource:i}=l.useResourceContext(),{setTitle:c}=l.useDocumentTitle(),[p,d]=y.useState(!1),{styles:m}=ne(),{modal:h}=g.App.useApp();if(y.useEffect(()=>{var B;const{title:N}=(B=r==null?void 0:r.data)!=null?B:{};c==null||c(`${O("Workflow")}${N?`: ${N}`:""}`)},[r==null?void 0:r.data]),!(r!=null&&r.data))return a?n.jsx(g.Spin,{}):n.jsx(g.Result,{status:"404",title:"Not found",extra:n.jsx(g.Button,{onClick:()=>e(-1),children:O("Go back")})});const D=(I=r==null?void 0:r.data)!=null?I:{},{nodes:v=[],revisions:b=[]}=D,f=Z(D,["nodes","revisions"]);vt(v);const k=v.find(N=>!N.upstream);function F({key:N}){N!=f.id&&e(Ce(N))}function M(N){return J(this,null,function*(){yield i.update({filterByTk:f.id,values:{enabled:N}}),s()})}function S(){return J(this,null,function*(){const{data:{data:N}}=yield i.revision({filterByTk:f.id,filter:{key:f.key}});g.message.success(t("Operation succeeded")),e(`/admin/workflow/workflows/${N.id}`)})}function E(){return J(this,null,function*(){const N=f.current?O("Delete a main version will cause all other revisions to be deleted too."):"";h.confirm({title:t("Are you sure you want to delete it?"),content:N,onOk(){return J(this,null,function*(){var G;yield i.destroy({filterByTk:f.id}),g.message.success(t("Operation succeeded")),e(f.current?o.pluginSettingsManager.getRoutePath("workflow"):Ce((G=b.find(U=>U.current))==null?void 0:G.id))})}})})}function L(B){return J(this,arguments,function*({key:N}){switch(N){case"history":d(!0);return;case"revision":return S();case"delete":return E()}})}const $=f.executed&&!b.find(N=>!N.executed&&new Date(N.createdAt)>new Date(f.createdAt));return n.jsxs(Ie.Provider,{value:{workflow:f,nodes:v,refresh:s},children:[n.jsxs("div",{className:"workflow-toolbar",children:[n.jsx("header",{children:n.jsx(g.Breadcrumb,{items:[{title:n.jsx(se.Link,{to:o.pluginSettingsManager.getRoutePath("workflow"),children:O("Workflow")})},{title:n.jsx(g.Tooltip,{title:`Key: ${f.key}`,children:n.jsx("strong",{children:f.title})})}]})}),n.jsxs("aside",{children:[f.sync?n.jsx(g.Tag,{color:"orange",children:O("Synchronously")}):n.jsx(g.Tag,{color:"cyan",children:O("Asynchronously")}),n.jsx(g.Dropdown,{className:"workflow-versions",trigger:["click"],menu:{onClick:F,defaultSelectedKeys:[`${f.id}`],className:l.cx(m.dropdownClass,m.workflowVersionDropdownClass),items:b.sort((N,B)=>B.id-N.id).map((N,B)=>({role:"button","aria-label":`version-${B}`,key:`${N.id}`,icon:N.current?n.jsx(V.RightOutlined,{}):null,className:l.cx({executed:N.executed,unexecuted:!N.executed,enabled:N.enabled}),label:n.jsxs(n.Fragment,{children:[n.jsx("strong",{children:`#${N.id}`}),n.jsx("time",{children:Q.str2moment(N.createdAt).format("YYYY-MM-DD HH:mm:ss")})]})}))},children:n.jsxs(g.Button,{type:"text","aria-label":"version",children:[n.jsx("label",{children:O("Version")}),n.jsx("span",{children:f!=null&&f.id?`#${f.id}`:null}),n.jsx(V.DownOutlined,{})]})}),n.jsx(g.Switch,{checked:f.enabled,onChange:M,checkedChildren:O("On"),unCheckedChildren:O("Off")}),n.jsx(g.Dropdown,{menu:{items:[{key:"key",label:`Key: ${f.key}`,disabled:!0},{type:"divider"},{role:"button","aria-label":"history",key:"history",label:O("Execution history"),disabled:!f.allExecuted},{role:"button","aria-label":"revision",key:"revision",label:O("Copy to new version"),disabled:!$},{type:"divider"},{role:"button","aria-label":"delete",danger:!0,key:"delete",label:t("Delete")}],onClick:L},children:n.jsx(g.Button,{"aria-label":"more",type:"text",icon:n.jsx(V.EllipsisOutlined,{})})}),n.jsx(l.ActionContextProvider,{value:{visible:p,setVisible:d},children:n.jsx(l.SchemaComponent,{schema:io,components:{ExecutionResourceProvider:qn,ExecutionLink:ao,ExecutionStatusColumn:uo},scope:{useRefreshActionProps:po}})})]})]}),n.jsx(so,{entry:k})]})}const mo=()=>{const e=se.useParams(),{styles:t}=ne();return n.jsx("div",{className:l.cx(t.workflowPageClass),children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`provider_${e.id}`]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:{name:"workflows",fields:[]},resourceName:"workflows",request:{resource:"workflows",action:"get",params:{filter:{id:e.id},appends:["nodes","revisions.id","revisions.createdAt","revisions.current","revisions.executed","revisions.enabled"]}}},"x-component":"WorkflowCanvas"}}},components:{WorkflowCanvas:Yn}})})},_n=r=>{var s=r,{request:e,filter:t={}}=s,o=Z(s,["request","filter"]);var c;const a=l.useRecord(),i=A(C({},o),{request:A(C({},e),{params:A(C({},e==null?void 0:e.params),{filter:A(C({},(c=e==null?void 0:e.params)==null?void 0:c.filter),{key:a.key})})})});return n.jsx(l.ResourceActionProvider,C({},i))},Kn=()=>{const{t:e}=X.useTranslation(),{id:t}=l.useRecord(),{setVisible:o}=l.useActionContext(),{getAriaLabel:r}=l.useGetAriaLabelOfAction("Configure");return n.jsx(se.Link,{"aria-label":r(),to:Ce(t),onClick:()=>o(!1),children:e("Configure")})};function Zn(r){var s=r,{component:e="div",children:t}=s,o=Z(s,["component","children"]);const[a,i]=y.useState(!1),c=T.useFieldSchema();return n.jsxs(l.ActionContextProvider,{value:{visible:a,setVisible:i,fieldSchema:c},children:[y.createElement(e,A(C({},o),{onClick(){i(!0)}}),t),n.jsx(l.SchemaComponent,{schema:c,onlyRenderProperties:!0})]})}function Qn({data:e}){const{label:t,color:o,options:r}=e,s=l.useCompile();return n.jsxs(g.Space,{direction:"vertical",children:[n.jsx(g.Tag,{color:o,children:s(t)}),n.jsx(g.Typography.Text,{type:"secondary",style:{whiteSpace:"normal"},children:s(r.description)})]})}const fo={name:"workflows",fields:[{type:"string",name:"title",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Trigger type", { ns: "${u}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Select",enum:"{{useTriggersOptions()}}","x-component-props":{optionRender:Qn,popupMatchSelectWidth:!0,listHeight:300},required:!0}},{type:"boolean",name:"sync",interface:"radioGroup",uiSchema:{title:`{{t("Mode", { ns: "${u}" })}}`,type:"boolean","x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{ t("Asynchronously", { ns: "${u}" }) }}`,value:!1,color:"cyan"},{label:`{{ t("Synchronously", { ns: "${u}" }) }}`,value:!0,color:"orange"}],required:!0}},{type:"string",name:"description",interface:"textarea",uiSchema:{title:'{{t("Description")}}',type:"string","x-component":"Input.TextArea"}},{type:"boolean",name:"enabled",interface:"radioGroup",uiSchema:{title:`{{t("Status", { ns: "${u}" })}}`,type:"string",enum:[{label:`{{t("On", { ns: "${u}" })}}`,value:!0,color:"#52c41a"},{label:`{{t("Off", { ns: "${u}" })}}`,value:!1}],"x-component":"Radio.Group","x-decorator":"FormItem",default:!1}},{type:"number",name:"allExecuted",interface:"integer",uiSchema:{title:`{{t("Executed", { ns: "${u}" })}}`,type:"number","x-component":"InputNumber","x-decorator":"FormItem"}},{type:"object",name:"options"}]},he={title:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},sync:{type:"boolean",title:`{{ t("Execute mode", { ns: "${u}" }) }}`,description:`{{ t("Execute workflow asynchronously or synchronously based on trigger type, and could not be changed after created.", { ns: "${u}" }) }}`,"x-decorator":"FormItem","x-component":"SyncOptionSelect","x-component-props":{options:[{label:`{{ t("Asynchronously", { ns: "${u}" }) }}`,value:!1,tooltip:`{{ t("Will be executed in the background as a queued task.", { ns: "${u}" }) }}`},{label:`{{ t("Synchronously", { ns: "${u}" }) }}`,value:!0,tooltip:`{{ t("For user actions that require immediate feedback. Can not use asynchronous nodes in such mode, and it is not recommended to perform time-consuming operations under synchronous mode.", { ns: "${u}" }) }}`}]}},enabled:{"x-component":"CollectionField","x-decorator":"FormItem"},description:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"fieldset",properties:{deleteExecutionOnStatus:{type:"array",title:`{{ t("Auto delete history when execution is on end status", { ns: "${u}" }) }}`,"x-decorator":"FormItem","x-component":"ExecutionStatusSelect","x-component-props":{multiple:!0}}}}},Xn={name:"workflow",type:"void",properties:{provider:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:fo,resourceName:"workflows",request:{resource:"workflows",action:"list",params:{filter:{current:!0},sort:["-createdAt"],except:["config"]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:fo},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"},refresher:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},sync:{type:"void",title:`{{t("Sync", { ns: "${u}" })}}`,"x-decorator":"Tooltip","x-decorator-props":{title:`{{ t("Sync enabled status of all workflows from database", { ns: "${u}" }) }}`},"x-component":"Action","x-component-props":{icon:"SyncOutlined",useAction(){const{t:e}=X.useTranslation(),{resource:t}=l.useResourceContext(),o=l.useResourceActionContext();return{run(){return J(this,null,function*(){yield t.sync(),yield o==null?void 0:o.refresh(),g.message.success(e("Operation succeeded"))})}}}},"x-reactions":["{{useWorkflowSyncAction}}"]},delete:{type:"void",title:'{{t("Delete")}}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"Action","x-component-props":{type:"primary",icon:"PlusOutlined"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{current:!0}},title:'{{t("Add new")}}',properties:{title:he.title,type:he.type,sync:he.sync,description:he.description,options:he.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}}}}}}},table:{type:"void","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},sync:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{sync:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"boolean","x-component":"CollectionField","x-read-pretty":!0,default:!1}}},allExecuted:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{allExecuted:{type:"number","x-decorator":"OpenDrawer","x-decorator-props":{component:function(t){const o=l.useRecord();return y.createElement("a",C({"aria-label":`executed-${o.title}`},t))}},"x-component":"CollectionField","x-read-pretty":!0,properties:{drawer:io}}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void","x-component":"WorkflowLink"},update:{type:"void",title:'{{ t("Edit") }}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{ t("Edit") }}',properties:{title:he.title,enabled:he.enabled,sync:he.sync,description:he.description,options:he.options,footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}}}}},revision:{type:"void",title:`{{t("Duplicate", { ns: "${u}" })}}`,"x-component":"Action.Link","x-component-props":{openSize:"small"},properties:{modal:{type:"void",title:`{{t("Duplicate to new workflow", { ns: "${u}" })}}`,"x-decorator":"FormV2","x-component":"Action.Modal",properties:{title:{type:"string",title:'{{t("Title")}}',"x-decorator":"FormItem","x-component":"Input"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{submit:{type:"void",title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction(){const{t:e}=X.useTranslation(),{refresh:t}=l.useResourceActionContext(),{resource:o,targetKey:r}=l.useResourceContext(),{setVisible:s}=l.useActionContext(),{[r]:a}=l.useRecord(),{values:i}=T.useForm();return{run(){return J(this,null,function*(){yield o.revision({filterByTk:a,values:i}),g.message.success(e("Operation succeeded")),t(),s(!1)})}}}}},cancel:{type:"void",title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}}}}}}}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"},useAction:"{{ cm.useDestroyActionAndRefreshCM }}"}}}}}}}}}}}};function Rn(e){const t=T.useField(),o=l.useRecord(),r=l.usePlugin(le);return T.useFormEffects(s=>{fe.onFieldChange("type",a=>{let i=o.id||!a.value;if(a.value){const c=r.triggers.get(a.value);c.sync!=null?(i=!0,t.setValue(c.sync)):t.setInitialValue(!1)}t.setPattern(i?"disabled":"editable")})}),y.useEffect(()=>{if(o.id){t.setPattern("disabled");const s=r.triggers.get(o.type);s.sync!=null?t.setValue(s.sync):t.setInitialValue(!1)}},[o.id,t,r.triggers]),n.jsx(ke,C({},e))}function er(e){const t=l.useApp();e.visible=!!(l.usePlugin("multi-app-share-collection")||t.name!=="main")}function tr(){const e=y.useContext(l.SchemaComponentContext),{useTriggersOptions:t}=l.usePlugin(le);return n.jsx(g.Card,{bordered:!1,children:n.jsx(l.SchemaComponentContext.Provider,{value:A(C({},e),{designable:!1}),children:n.jsx(l.SchemaComponent,{schema:Xn,components:{WorkflowLink:Kn,ExecutionResourceProvider:_n,ExecutionLink:ao,OpenDrawer:Zn,ExecutionStatusSelect:Gn,SyncOptionSelect:Rn,ExecutionStatusColumn:uo,Tooltip:g.Tooltip},scope:{useTriggersOptions:t,useWorkflowSyncAction:er,useRefreshActionProps:po}})})})}const de={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},ho={type:"object",title:'{{t("Fields values")}}',description:`{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:l.css`
|
|
513
|
-
flex-direction: column;
|
|
514
|
-
`},"x-component":"CollectionFieldset"},ot={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":()=>{const{values:e}=T.useForm(),[t,o]=l.parseCollectionName(e==null?void 0:e.collection);return{options:l.useCollectionFilterOptions(o,t),className:l.css`
|
|
515
|
-
position: relative;
|
|
516
|
-
width: 100%;
|
|
517
|
-
`}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},or={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},nr={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1},default:20}}}}}}},We={type:"array",title:`{{t("Preload associations", { ns: "${u}" })}}`,description:`{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection(){const{values:e}=T.useForm();return e==null?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]};function rr(){const e=l.useAPIClient(),t=T.useForm(),{field:o,__parent:r}=l.useBlockRequestContext(),{setVisible:s}=l.useActionContext(),a=se.useNavigate(),i=T.useFieldSchema(),c=T.useField(),p=l.useCompile(),{modal:d}=g.App.useApp(),m=l.useCollectValuesToSubmit(),h=c.componentProps.filterKeys||[];return{onClick(){return J(this,null,function*(){var M,S,E;const{onSuccess:b,skipValidator:f,triggerWorkflows:k}=(M=i==null?void 0:i["x-action-settings"])!=null?M:{};f||(yield t.submit());const F=yield m();c.data=o.data||{},c.data.loading=!0;try{const L=yield e.resource("workflows").trigger({values:F,filterKeys:h,triggerWorkflows:k!=null&&k.length?k.map($=>[$.workflowKey,$.context].filter(Boolean).join("!")).join(","):void 0});if(c.data.loading=!1,c.data.data=L,(E=(S=r==null?void 0:r.service)==null?void 0:S.refresh)==null||E.call(S),s==null||s(!1),!(b!=null&&b.successMessage))return;b!=null&&b.manualClose?d.success({title:p(b==null?void 0:b.successMessage),onOk:()=>J(this,null,function*(){yield t.reset(),b!=null&&b.redirecting&&(b!=null&&b.redirectTo)&&(Q.isURL(b.redirectTo)?window.location.href=b.redirectTo:a(b.redirectTo))})}):g.message.success(p(b==null?void 0:b.successMessage))}catch(L){c.data.loading=!1}})}}}function sr(){var b;const e=l.useCompile(),t=l.useAPIClient(),o=l.useRecord(),r=T.useField(),s=T.useFieldSchema(),{field:a,__parent:i}=l.useBlockRequestContext(),{setVisible:c,setSubmitted:p}=l.useActionContext(),{modal:d}=g.App.useApp(),m=se.useNavigate(),{onSuccess:h,triggerWorkflows:v}=(b=s==null?void 0:s["x-action-settings"])!=null?b:{};return{onClick(k,F){return J(this,null,function*(){r.data=a.data||{},r.data.loading=!0;try{if(yield t.resource("workflows").trigger({values:o,triggerWorkflows:v!=null&&v.length?v.map(M=>[M.workflowKey,M.context].filter(Boolean).join("!")).join(","):void 0}),F&&F(),c==null||c(!1),p==null||p(!0),!(h!=null&&h.successMessage))return;if(h!=null&&h.manualClose){let M;d.success({title:e(h==null?void 0:h.successMessage),onOk(){return J(this,null,function*(){h!=null&&h.redirecting&&(h!=null&&h.redirectTo)&&(Q.isURL(h.redirectTo)?window.location.href=h.redirectTo:m(h.redirectTo))})}})}else g.message.success(e(h==null?void 0:h.successMessage))}catch(M){console.error(M)}finally{r.data.loading=!1}})}}}function lr(){const{workflow:e}=H();return!!(e!=null&&e.executed)}function yo(){const{workflow:e}=H();return!!(e!=null&&e.allExecuted)}const Se={CREATED:1,UPDATED:2,SAVED:3,DELETED:4},ar=[{label:`{{t("After record added", { ns: "${u}" })}}`,value:Se.CREATED},{label:`{{t("After record updated", { ns: "${u}" })}}`,value:Se.UPDATED},{label:`{{t("After record added or updated", { ns: "${u}" })}}`,value:Se.SAVED},{label:`{{t("After record deleted", { ns: "${u}" })}}`,value:Se.DELETED}];function ir(e,t){var p;const[o,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(o),i=[{collectionName:r,name:"data",type:"hasOne",target:r,uiSchema:{title:O("Trigger data")}}];return Te(A(C({appends:["data",...((p=e.appends)==null?void 0:p.map(d=>`data.${d}`))||[]]},t),{fields:i,compile:s,getCollectionFields:a}))}class cr extends Mt{constructor(){super(...arguments);w(this,"title",`{{t("Collection event", { ns: "${u}" })}}`);w(this,"description",`{{t('Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".', { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter(o){return o.options.key==="main"||o.options.isDBInstance}},"x-reactions":[...de["x-reactions"],{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]}),mode:{type:"number",title:`{{t("Trigger on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:`{{t("Trigger on", { ns: "${u}" })}}`,className:"auto-width"},enum:ar,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:`{{t("Changed fields", { ns: "${u}" })}}`,description:`{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter(o){return!o.hidden&&(o.uiSchema?!o.uiSchema["x-read-pretty"]:!0)&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(o.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && ($deps[1] & ${Se.UPDATED})}}`}}}]},condition:A(C({},ot),{title:`{{t("Only triggers when match conditions", { ns: "${u}" })}}`,"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:`{{!!$deps[0] && !($deps[1] & ${Se.DELETED})}}`}}}]}),appends:A(C({},We),{"x-reactions":[...We["x-reactions"],{dependencies:["mode"],fulfill:{state:{visible:`{{!($deps[0] & ${Se.DELETED})}}`}}}]})});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useWorkflowAnyExecuted:yo});w(this,"components",{FieldsSelect:Ct});w(this,"useVariables",ir)}useInitializers(o){return o.collection?{name:"triggerData",type:"item",key:"triggerData",title:`{{t("Trigger data", { ns: "${u}" })}}`,Component:Pe,collection:o.collection,dataPath:"$context.data"}:null}}const Ae={STATIC:0,DATE_FIELD:1};function dr(e){return!e.hidden&&(e.uiSchema?e.type==="date":!1)}function go({value:e,onChange:t}){const o=e!=null?e:{},{t:r}=X.useTranslation(),[s,a]=y.useState(o.offset?o.offset/Math.abs(o.offset):0);return n.jsxs("fieldset",{className:l.css`
|
|
518
|
-
display: flex;
|
|
519
|
-
gap: 0.5em;
|
|
520
|
-
`,children:[n.jsx(Ct,{value:o.field,onChange:i=>t(A(C({},o),{field:i})),filter:dr,placeholder:r("Select field"),className:"auto-width"}),o.field?n.jsx(g.Select,{value:s,onChange:i=>{a(i),t(A(C({},o),{offset:Math.abs(o.offset)*i}))},options:[{value:0,label:O("Exactly at")},{value:-1,label:r("Before")},{value:1,label:r("After")}],className:"auto-width"}):null,s?n.jsxs(n.Fragment,{children:[n.jsx(g.InputNumber,{value:Math.abs(o.offset),onChange:i=>t(A(C({},o),{offset:(i!=null?i:0)*s}))}),n.jsx(g.Select,{value:o.unit||864e5,onChange:i=>t(A(C({},o),{unit:i})),options:[{value:864e5,label:O("Days")},{value:36e5,label:O("Hours")},{value:6e4,label:O("Minutes")},{value:1e3,label:O("Seconds")}],className:"auto-width"})]}):null]})}function ur({value:e,onChange:t}){const{t:o}=xt(),r=e!=null?typeof e=="object"&&!(e instanceof Date)?"field":"date":null;return n.jsxs("fieldset",{className:l.css`
|
|
521
|
-
display: flex;
|
|
522
|
-
gap: 0.5em;
|
|
523
|
-
`,children:[n.jsxs(g.Select,{value:r,onChange:s=>{t(s?s==="field"?{}:new Date:null)},className:"auto-width",children:[n.jsx(g.Select.Option,{value:null,children:o("No end")}),n.jsx(g.Select.Option,{value:"field",children:o("By field")}),n.jsx(g.Select.Option,{value:"date",children:o("By custom date")})]}),r==="field"?n.jsx(go,{value:e,onChange:t}):null,r==="date"?n.jsx(g.DatePicker,{showTime:!0,value:en(e),onChange:s=>{t(s?s.toDate():null)}}):null]})}var re=function(){return re=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var s in t=arguments[o])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},re.apply(this,arguments)};function bo(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function"){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(o[r[s]]=e[r[s]])}return o}function nt(e,t,o){if(o||arguments.length===2)for(var r,s=0,a=t.length;s<a;s++)!r&&s in t||(r||(r=Array.prototype.slice.call(t,0,s)),r[s]=t[s]);return e.concat(r||Array.prototype.slice.call(t))}var pr=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],Fe=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],j={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function xo(e,t){for(var o=[],r=e;r<=t;r++)o.push(r);return o}function rt(e){return e.sort(function(t,o){return t-o}),e}function vo(e){var t=[];return e.forEach(function(o){t.indexOf(o)<0&&t.push(o)}),t}function ue(e){return Object.entries(e).filter(function(t){var o=t[0],r=t[1];return o&&r}).map(function(t){return t[0]}).join(" ")}function wo(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||j.errorInvalidCron})}function st(e){var t=parseInt(e,10),o=Number(e);return t===o?o:NaN}function Co(e,t,o,r,s,a,i,c,p,d,m,h,v,b){o&&o(void 0),t(!1);var f=!1;if(!e){if(r==="always"||a&&r==="for-default-value")return;f=!0}if(!f){if(c&&(c===!0||c.includes(e))){if(e==="@reboot")return void b("reboot");var k=pr.find(function(S){return S.name===e});k&&(e=k.value)}try{var F=function(S){if(typeof S!="string")throw new Error("Invalid cron string");var E=S.replace(/\s+/g," ").trim().split(" ");if(E.length===5)return E.map(function(L,$){return function(I,D){if(I==="*"||I==="*/1")return[];var N=rt(vo(Fo(function(G,U,pe){if(pe){G=G.toUpperCase();for(var P=0;P<pe.length;P++)G=G.replace(pe[P],"".concat(P+U))}return G}(I,D.min,D.alt).split(",").map(function(G){var U,pe=G.split("/");if(pe.length>2)throw new Error('Invalid value "'.concat(I,' for "').concat(D.type,'"'));var P=pe[0],W=pe[1];U=P==="*"?xo(D.min,D.max):function(q,_,R){var ee=q.split("-");if(ee.length===1){var ze=st(ee[0]);if(isNaN(ze))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));return[ze]}if(ee.length===2){var ye=st(ee[0]),$e=st(ee[1]);if(isNaN(ye)||isNaN($e))throw new Error('Invalid value "'.concat(_,'" for ').concat(R.type));if($e<ye)throw new Error('Max range is less than min range in "'.concat(q,'" for ').concat(R.type));return xo(ye,$e)}throw new Error('Invalid value "'.concat(q,'" for ').concat(R.type))}(P,I,D);var z=function(q,_){if(q!==void 0){var R=st(q);if(isNaN(R)||R<1)throw new Error('Invalid interval step value "'.concat(q,'" for ').concat(_.type));return R}}(W,D),ae=function(q,_){if(_){var R=q[0];q=q.filter(function(ee){return ee%_==R%_||ee===R})}return q}(U,z);return ae}).flat(),D))),B=To(N,D);if(B!==void 0)throw new Error('Value "'.concat(B,'" out of range for ').concat(D.type));return N.length===D.total?[]:N}(L,Fe[$])});throw new Error("Invalid cron string format")}(e),M=function(S){return S[3].length>0?"year":S[2].length>0?"month":S[4].length>0?"week":S[1].length>0?"day":S[0].length>0?"hour":"minute"}(F);b(M),p(F[0]),d(F[1]),m(F[2]),h(F[3]),v(F[4])}catch(S){f=!0}}f&&(s.current=e,t(!0),wo(o,i))}function ko(e,t,o,r,s,a,i){if(e==="reboot")return"@reboot";var c=function(p,d){return p.map(function(m,h){var v=Fe[h];return So(Ao(m,v),v,d)})}([e!=="minute"&&a?a:[],e!=="minute"&&e!=="hour"&&s?s:[],e!=="year"&&e!=="month"||!o?[]:o,e==="year"&&t?t:[],e!=="year"&&e!=="month"&&e!=="week"||!r?[]:r],i);return c.join(" ")}function So(e,t,o,r,s){var a="";if(function(c,p){return c.length===p.max-p.min+1}(e,t)||e.length===0)a="*";else{var i=function(c){if(c.length>2){var p=c[1]-c[0];if(p>1)return p}}(e);a=i&&function(c,p){for(var d=1;d<c.length;d++){var m=c[d-1];if(c[d]-m!==p)return!1}return!0}(e,i)?function(c,p,d){var m=No(c),h=Oo(c),v=c.length===(h-m)/d+1;return!!(m===p.min&&h+d>p.max&&v)}(e,t,i)?"*/".concat(i):"".concat(Oe(No(e),t,o,r,s),"-").concat(Oe(Oo(e),t,o,r,s),"/").concat(i):function(c){var p=[],d=null;return c.forEach(function(m,h,v){m!==v[h+1]-1?d!==null?(p.push([d,m]),d=null):p.push(m):d===null&&(d=m)}),p}(e).map(function(c){return Array.isArray(c)?"".concat(Oe(c[0],t,o,r,s),"-").concat(Oe(c[1],t,o,r,s)):Oe(c,t,o,r,s)}).join(",")}return a}function Oe(e,t,o,r,s){var a=e.toString(),i=t.type,c=t.alt,p=t.min,d=r&&(r===!0||r.includes(i)),m=s==="24-hour-clock"&&(i==="hours"||i==="minutes");if(o&&i==="week-days"||o&&i==="months"?a=c[e-p]:e<10&&(d||m)&&(a=a.padStart(2,"0")),i==="hours"&&s==="12-hour-clock"){var h=e>=12?"PM":"AM",v=e%12||12;v<10&&d&&(v=v.toString().padStart(2,"0")),a="".concat(v).concat(h)}return a}function Ao(e,t){var o=rt(vo(Fo(e,t)));if(o.length===0)return o;var r=To(o,t);if(r!==void 0)throw new Error('Value "'.concat(r,'" out of range for ').concat(t.type));return o}function Fo(e,t){return t.type==="week-days"&&(e=e.map(function(o){return o===7?0:o})),e}function To(e,t){var o=e[0],r=e[e.length-1];return o<t.min?o:r>t.max?r:void 0}function No(e){return e[0]}function Oo(e){return e[e.length-1]}function Le(e){var t=e.value,o=e.grid,r=o===void 0||o,s=e.optionsList,a=e.setValue,i=e.locale,c=e.className,p=e.humanizeLabels,d=e.disabled,m=e.readOnly,h=e.leadingZero,v=e.clockFormat,b=e.period,f=e.unit,k=e.periodicityOnDoubleClick,F=e.mode,M=bo(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),S=y.useMemo(function(){if(t&&Array.isArray(t))return t.map(function(P){return P.toString()})},[t]),E=y.useMemo(function(){return s?s.map(function(P,W){return{value:(f.min===0?W:W+1).toString(),label:P}}):nt([],Array(f.total),!0).map(function(P,W){var z=f.min===0?W:W+1;return{value:z.toString(),label:Oe(z,f,p,h,v)}})},[s,h,p,v]),L=JSON.stringify(i),$=y.useCallback(function(P){var W=P.value;if(!t||t[0]!==Number(W))return n.jsx(n.Fragment,{});var z=So(Ao(t,f),f,p,h,v),ae=z.match(/^\*\/([0-9]+),?/)||[];return n.jsx("div",{children:ae[1]?"".concat(i.everyText||j.everyText," ").concat(ae[1]):z})},[t,L,p,h,v]),I=y.useCallback(function(P){var W=Array.isArray(P)?rt(P):[P],z=W;t&&(z=F==="single"?[]:nt([],t,!0),W.forEach(function(ae){var q=Number(ae);z=t.some(function(_){return _===q})?z.filter(function(_){return _!==q}):rt(nt(nt([],z,!0),[q],!1))})),z.length===f.total?a([]):a(z)},[a,t]),D=y.useCallback(function(P){if(P!==0&&P!==1){for(var W=f.total+f.min,z=[],ae=f.min;ae<W;ae++)ae%P==0&&z.push(ae);var q=t&&z&&t.length===z.length&&t.every(function(R,ee){return R===z[ee]}),_=z.length===E.length;a(_||q?[]:z)}else a([])},[t,E,a]),N=y.useRef([]),B=y.useCallback(function(P){if(!m){var W=N.current;W.push({time:new Date().getTime(),value:Number(P)});var z=window.setTimeout(function(){k&&W.length>1&&W[W.length-1].time-W[W.length-2].time<300?W[W.length-1].value===W[W.length-2].value?D(Number(P)):I([W[W.length-2].value,W[W.length-1].value]):I(Number(P)),N.current=[]},300);return function(){window.clearTimeout(z)}}},[N,I,D,m,k]),G=y.useCallback(function(){m||a([])},[a,m]),U=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,P))},[c]),pe=y.useMemo(function(){var P;return ue(((P={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown"]=!0,P["react-js-cron-custom-select-dropdown-".concat(f.type)]=!0,P["react-js-cron-custom-select-dropdown-minutes-large"]=f.type==="minutes"&&b!=="hour"&&b!=="day",P["react-js-cron-custom-select-dropdown-minutes-medium"]=f.type==="minutes"&&(b==="day"||b==="hour"),P["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]=f.type==="hours"&&v==="12-hour-clock",P["react-js-cron-custom-select-dropdown-grid"]=!!r,P["".concat(c,"-select-dropdown")]=!!c,P["".concat(c,"-select-dropdown-").concat(f.type)]=!!c,P))},[c,r,v,b]);return n.jsx(g.Select,re({mode:F!=="single"||k?"multiple":void 0,allowClear:!m,virtual:!1,open:!m&&void 0,value:S,onClear:G,tagRender:$,className:U,popupClassName:pe,options:E,showSearch:!1,showArrow:!m,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:B,onDeselect:B,disabled:d,dropdownAlign:f.type!=="minutes"&&f.type!=="hours"||b==="day"||b==="hour"?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(f.type)},M))}function mr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,p=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-hours")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixHours!==""&&n.jsx("span",{children:r.prefixHours||j.prefixHours}),n.jsx(Le,{placeholder:r.emptyHours||j.emptyHours,value:t,unit:Fe[1],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:p,period:d,periodicityOnDoubleClick:m,mode:h})]}))}function fr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.leadingZero,p=e.clockFormat,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-minutes")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[d==="hour"?r.prefixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.prefixMinutesForHourPeriod||j.prefixMinutesForHourPeriod}):r.prefixMinutes!==""&&n.jsx("span",{children:r.prefixMinutes||j.prefixMinutes}),n.jsx(Le,{placeholder:d==="hour"?r.emptyMinutesForHourPeriod||j.emptyMinutesForHourPeriod:r.emptyMinutes||j.emptyMinutes,value:t,unit:Fe[0],setValue:o,locale:r,className:s,disabled:a,readOnly:i,leadingZero:c,clockFormat:p,period:d,periodicityOnDoubleClick:m,mode:h}),d==="hour"&&r.suffixMinutesForHourPeriod!==""&&n.jsx("span",{children:r.suffixMinutesForHourPeriod||j.suffixMinutesForHourPeriod})]}))}function hr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.weekDays,i=e.disabled,c=e.readOnly,p=e.leadingZero,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=!a||a.length===0,b=y.useMemo(function(){var F;return ue(((F={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!v})["".concat(s,"-field")]=!!s,F["".concat(s,"-month-days")]=!!s,F))},[s,v]),f=JSON.stringify(r),k=y.useMemo(function(){return v?r.emptyMonthDays||j.emptyMonthDays:r.emptyMonthDaysShort||j.emptyMonthDaysShort},[v,f]);return!c||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?n.jsxs("div",re({className:b},{children:[r.prefixMonthDays!==""&&n.jsx("span",{children:r.prefixMonthDays||j.prefixMonthDays}),n.jsx(Le,{placeholder:k,value:t,setValue:o,unit:Fe[2],locale:r,className:s,disabled:i,readOnly:c,leadingZero:p,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function yr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.disabled,c=e.readOnly,p=e.period,d=e.periodicityOnDoubleClick,m=e.mode,h=r.months||j.months,v=y.useMemo(function(){var b;return ue(((b={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(s,"-field")]=!!s,b["".concat(s,"-months")]=!!s,b))},[s]);return n.jsxs("div",re({className:v},{children:[r.prefixMonths!==""&&n.jsx("span",{children:r.prefixMonths||j.prefixMonths}),n.jsx(Le,{placeholder:r.emptyMonths||j.emptyMonths,optionsList:h,grid:!1,value:t,unit:re(re({},Fe[3]),{alt:r.altMonths||j.altMonths}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:i,readOnly:c,period:p,periodicityOnDoubleClick:d,mode:m})]}))}function gr(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.disabled,i=e.readOnly,c=e.shortcuts,p=e.allowedPeriods,d=[];p.includes("year")&&d.push({value:"year",label:r.yearOption||j.yearOption}),p.includes("month")&&d.push({value:"month",label:r.monthOption||j.monthOption}),p.includes("week")&&d.push({value:"week",label:r.weekOption||j.weekOption}),p.includes("day")&&d.push({value:"day",label:r.dayOption||j.dayOption}),p.includes("hour")&&d.push({value:"hour",label:r.hourOption||j.hourOption}),p.includes("minute")&&d.push({value:"minute",label:r.minuteOption||j.minuteOption}),p.includes("reboot")&&c&&(c===!0||c.includes("@reboot"))&&d.push({value:"reboot",label:r.rebootOption||j.rebootOption});var m=y.useCallback(function(f){i||o(f)},[o,i]),h=y.useMemo(function(){var f;return ue(((f={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(s,"-field")]=!!s,f["".concat(s,"-period")]=!!s,f))},[s]),v=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===""})["".concat(s,"-select")]=!!s,f))},[s,r.prefixPeriod]),b=y.useMemo(function(){var f;return ue(((f={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(s,"-select-dropdown")]=!!s,f["".concat(s,"-select-dropdown-period")]=!!s,f))},[s]);return n.jsxs("div",re({className:h},{children:[r.prefixPeriod!==""&&n.jsx("span",{children:r.prefixPeriod||j.prefixPeriod}),n.jsx(g.Select,{defaultValue:t,value:t,onChange:m,options:d,className:v,popupClassName:b,disabled:a,showArrow:!i,open:!i&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function br(e){var t=e.value,o=e.setValue,r=e.locale,s=e.className,a=e.humanizeLabels,i=e.monthDays,c=e.disabled,p=e.readOnly,d=e.period,m=e.periodicityOnDoubleClick,h=e.mode,v=r.weekDays||j.weekDays,b=d==="week"||!i||i.length===0,f=y.useMemo(function(){var E;return ue(((E={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!b})["".concat(s,"-field")]=!!s,E["".concat(s,"-week-days")]=!!s,E))},[s,b]),k=JSON.stringify(r),F=y.useMemo(function(){return b?r.emptyWeekDays||j.emptyWeekDays:r.emptyWeekDaysShort||j.emptyWeekDaysShort},[b,k]),M=d==="week"||!p||t&&t.length>0||(!t||t.length===0)&&(!i||i.length===0),S=!p||i&&i.length>0||(!i||i.length===0)&&(!t||t.length===0);return M?n.jsxs("div",re({className:f},{children:[r.prefixWeekDays!==""&&(d==="week"||!S)&&n.jsx("span",{children:r.prefixWeekDays||j.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==""&&d!=="week"&&S&&n.jsx("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||j.prefixWeekDaysForMonthAndYearPeriod}),n.jsx(Le,{placeholder:F,optionsList:v,grid:!1,value:t,unit:re(re({},Fe[4]),{alt:r.altWeekDays||j.altWeekDays}),setValue:o,locale:r,className:s,humanizeLabels:a,disabled:c,readOnly:p,period:d,periodicityOnDoubleClick:m,mode:h})]})):null}function xr(e){var t=e.clearButton,o=t===void 0||t,r=e.clearButtonProps,s=r===void 0?{}:r,a=e.clearButtonAction,i=a===void 0?"fill-with-every":a,c=e.locale,p=c===void 0?j:c,d=e.value,m=d===void 0?"":d,h=e.setValue,v=e.displayError,b=v===void 0||v,f=e.onError,k=e.className,F=e.defaultPeriod,M=F===void 0?"day":F,S=e.allowEmpty,E=S===void 0?"for-default-value":S,L=e.humanizeLabels,$=L===void 0||L,I=e.humanizeValue,D=I!==void 0&&I,N=e.disabled,B=N!==void 0&&N,G=e.readOnly,U=G!==void 0&&G,pe=e.leadingZero,P=pe!==void 0&&pe,W=e.shortcuts,z=W===void 0?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:W,ae=e.clockFormat,q=e.periodicityOnDoubleClick,_=q===void 0||q,R=e.mode,ee=R===void 0?"multiple":R,ze=e.allowedDropdowns,ye=ze===void 0?["period","months","month-days","week-days","hours","minutes"]:ze,$e=e.allowedPeriods,Lr=$e===void 0?["year","month","week","day","hour","minute","reboot"]:$e,Ee=y.useRef(m),Vt=y.useRef(M),Vo=y.useState(),ve=Vo[0],lt=Vo[1],jo=y.useState(),Je=jo[0],at=jo[1],Wo=y.useState(),it=Wo[0],ct=Wo[1],Lo=y.useState(),Ue=Lo[0],dt=Lo[1],zo=y.useState(),ut=zo[0],pt=zo[1],Jo=y.useState(),mt=Jo[0],ft=Jo[1],Uo=y.useState(!1),jt=Uo[0],He=Uo[1],Ho=y.useState(!1),ht=Ho[0],Go=Ho[1],zr=function(K){var ge=y.useRef(K);return y.useEffect(function(){ge.current=K},[K]),ge.current}(ht),qo=JSON.stringify(p);y.useEffect(function(){Co(m,He,f,E,Ee,!0,p,z,ft,pt,at,ct,dt,lt)},[]),y.useEffect(function(){m!==Ee.current&&Co(m,He,f,E,Ee,!1,p,z,ft,pt,at,ct,dt,lt)},[m,Ee,qo,E,z]),y.useEffect(function(){if(!(ve||mt||it||Je||Ue||ut)||ht||zr)ht&&Go(!1);else{var K=ve||Vt.current,ge=ko(K,it,Je,Ue,ut,mt,D);h(ge,{selectedPeriod:K}),Ee.current=ge,f&&f(void 0),He(!1)}},[ve,Je,it,Ue,ut,mt,D,ht]);var Yo=y.useCallback(function(){at(void 0),ct(void 0),dt(void 0),pt(void 0),ft(void 0);var K="",ge=ve!=="reboot"&&ve?ve:Vt.current;ge!==ve&<(ge),i==="fill-with-every"&&(K=ko(ge,void 0,void 0,void 0,void 0,void 0)),h(K,{selectedPeriod:ge}),Ee.current=K,Go(!0),E==="never"&&i==="empty"?(He(!0),wo(f,p)):(f&&f(void 0),He(!1))},[ve,h,f,i]),Jr=y.useMemo(function(){var K;return ue(((K={"react-js-cron":!0,"react-js-cron-error":jt&&b,"react-js-cron-disabled":B,"react-js-cron-read-only":U})["".concat(k)]=!!k,K["".concat(k,"-error")]=jt&&b&&!!k,K["".concat(k,"-disabled")]=B&&!!k,K["".concat(k,"-read-only")]=U&&!!k,K))},[k,jt,b,B,U]),Wt=s.className,_o=bo(s,["className"]),Ko=y.useMemo(function(){var K;return ue(((K={"react-js-cron-clear-button":!0})["".concat(k,"-clear-button")]=!!k,K["".concat(Wt)]=!!Wt,K))},[k,Wt]),Ur=JSON.stringify(_o),Zo=y.useMemo(function(){return o&&!U?n.jsx(g.Button,re({className:Ko,danger:!0,type:"primary",disabled:B},_o,{onClick:Yo},{children:p.clearButtonText||j.clearButtonText})):null},[o,U,qo,Ko,B,Ur,Yo]),te=ve||Vt.current;return n.jsxs("div",re({className:Jr},{children:[ye.includes("period")&&n.jsx(gr,{value:te,setValue:lt,locale:p,className:k,disabled:B,readOnly:U,shortcuts:z,allowedPeriods:Lr}),te==="reboot"?Zo:n.jsxs(n.Fragment,{children:[te==="year"&&ye.includes("months")&&n.jsx(yr,{value:it,setValue:ct,locale:p,className:k,humanizeLabels:$,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month")&&ye.includes("month-days")&&n.jsx(hr,{value:Je,setValue:at,locale:p,className:k,weekDays:Ue,disabled:B,readOnly:U,leadingZero:P,period:te,periodicityOnDoubleClick:_,mode:ee}),(te==="year"||te==="month"||te==="week")&&ye.includes("week-days")&&n.jsx(br,{value:Ue,setValue:dt,locale:p,className:k,humanizeLabels:$,monthDays:Je,disabled:B,readOnly:U,period:te,periodicityOnDoubleClick:_,mode:ee}),n.jsxs("div",{children:[te!=="minute"&&te!=="hour"&&ye.includes("hours")&&n.jsx(mr,{value:ut,setValue:pt,locale:p,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,period:te,periodicityOnDoubleClick:_,mode:ee}),te!=="minute"&&ye.includes("minutes")&&n.jsx(fr,{value:mt,setValue:ft,locale:p,period:te,className:k,disabled:B,readOnly:U,leadingZero:P,clockFormat:ae,periodicityOnDoubleClick:_,mode:ee}),Zo]})]})]}))}const $o=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function Eo(e){return $o.filter(o=>typeof o.value=="number").reverse().find(o=>!(e%o.value))}function vr(e){let t;switch(typeof e){case"number":return t=Eo(e),t?t.value:"none";case"string":return"cron"}return"none"}function wr({value:e,onChange:t}){const{t:o}=xt(),r=Eo(e);return n.jsx(g.InputNumber,{value:e/r.value,onChange:s=>t(s*r.value),min:1,addonBefore:o("Every"),addonAfter:o(r.unitText),className:"auto-width"})}function Cr({value:e=null,onChange:t}){const{t:o}=xt(),r=vr(e),s=y.useCallback(a=>{if(a==="none"){t(null);return}if(a==="cron"){t("0 * * * * *");return}t(a)},[t]);return n.jsxs("fieldset",{className:l.css`
|
|
524
|
-
display: flex;
|
|
525
|
-
flex-direction: ${r==="cron"?"column":"row"};
|
|
526
|
-
align-items: flex-start;
|
|
527
|
-
gap: 0.5em;
|
|
528
|
-
|
|
529
|
-
.react-js-cron {
|
|
530
|
-
width: 100%;
|
|
531
|
-
padding: 0.5em 0.5em 0 0.5em;
|
|
532
|
-
border: 1px dashed #ccc;
|
|
533
|
-
|
|
534
|
-
.react-js-cron-field {
|
|
535
|
-
margin-bottom: 0.5em;
|
|
536
|
-
|
|
537
|
-
> span {
|
|
538
|
-
margin: 0 0.5em 0 0;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
> .react-js-cron-select {
|
|
542
|
-
margin: 0 0.5em 0 0;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.react-js-cron-week-days {
|
|
547
|
-
> span {
|
|
548
|
-
min-width: 2em;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
`,children:[n.jsx(g.Select,{value:r,onChange:s,className:"auto-width",children:$o.map(a=>n.jsx(g.Select.Option,{value:a.value,children:o(a.text)},a.value))}),typeof r=="number"?n.jsx(wr,{value:e,onChange:t}):null,r==="cron"?n.jsx(xr,{value:e.trim().split(/\s+/).slice(1).join(" "),setValue:a=>t(`0 ${a}`),clearButton:!1,locale:window.cronLocale}):null]})}const kr={[Ae.STATIC]:{startsOn:{type:"datetime",title:`{{t("Starts on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:`{{t("Ends on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${u}" })}}`,min:0}}},[Ae.DATE_FIELD]:{collection:A(C({},de),{"x-component-props":{dataSourceFilter(e){return e.options.key==="main"||e.options.isDBInstance}},"x-reactions":[...de["x-reactions"],{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),startsOn:{type:"object",title:`{{t("Starts on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:`{{t("Repeat mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:`{{t("Ends on", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:`{{t("Repeat limit", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:`{{t("No limit", { ns: "${u}" })}}`,min:0}},appends:A(C({},We),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:`{{$deps[0] === ${Ae.DATE_FIELD} && $deps[1]}}`}}}]})}},Sr=[{value:Ae.STATIC,label:`{{t("Based on certain date", { ns: "${u}" })}}`},{value:Ae.DATE_FIELD,label:`{{t("Based on date field of collection", { ns: "${u}" })}}`}],Ar=()=>{const{values:e={},clearFormGraph:t}=T.useForm(),[o,r]=y.useState(e.mode);return T.useFormEffects(()=>{fe.onFieldValueChange("mode",s=>{r(s.value),t("collection"),t("startsOn"),t("repeat"),t("endsOn"),t("limit")})}),n.jsxs(n.Fragment,{children:[n.jsx(l.SchemaComponent,{schema:{type:"number",title:`{{t("Trigger mode", { ns: "${u}" })}}`,name:"mode","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{options:Sr},required:!0,default:Ae.STATIC}}),n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[`mode-${o}`]:{type:"void","x-component":"fieldset","x-component-props":{className:l.css`
|
|
553
|
-
.ant-input-number {
|
|
554
|
-
width: auto;
|
|
555
|
-
min-width: 6em;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
.ant-picker {
|
|
559
|
-
width: auto;
|
|
560
|
-
}
|
|
561
|
-
`},properties:kr[o]}}},components:{OnField:go,RepeatField:Cr,EndsByField:ur}})]})};function Fr(e,t){var c;const[o,r]=l.parseCollectionName(e.collection),s=l.useCompile(),a=je(o),i=[];if((!(t!=null&&t.types)||t.types.includes("date"))&&i.push({key:"date",value:"date",label:O("Trigger time")}),e.mode===Ae.DATE_FIELD){const[p]=Te(A(C({appends:["data",...((c=e.appends)==null?void 0:c.map(d=>`data.${d}`))||[]]},t),{fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:O("Trigger data")}}],compile:s,getCollectionFields:a}));p&&i.push(p)}return i}class Tr extends Mt{constructor(){super(...arguments);w(this,"sync",!1);w(this,"title",`{{t("Schedule event", { ns: "${u}" })}}`);w(this,"description",`{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "${u}" })}}`);w(this,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{ScheduleConfig:Ar});w(this,"useVariables",Fr)}useInitializers(o){return o.collection?{name:"triggerData",type:"item",title:`{{t("Trigger data", { ns: "${u}" })}}`,Component:Pe,collection:o.collection,dataPath:"$context.data"}:null}}class Nr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Calculation", { ns: "${u}" })}}`);w(this,"type","calculation");w(this,"group","calculation");w(this,"description",`{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${u}" })}}`);w(this,"fieldset",{engine:{type:"string",title:`{{t("Calculation engine", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:De.getOptions()},required:!0,default:"formula.js"},expression:{type:"string",title:`{{t("Calculation expression", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(o,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=o.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return i(c),""}catch(p){return O("Expression syntax error")}},"x-reactions":[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}],required:!0}});w(this,"scope",{renderEngineReference:Pt});w(this,"components",{WorkflowVariableTextArea:It,RadioWithTooltip:ke,ValueBlock:Ne})}useVariables({key:o,title:r},{types:s,fieldNames:a=Ve}){return s&&!s.some(i=>i in Qe||Object.values(Qe).some(c=>c.has(i)))?null:{value:o,label:r}}useInitializers(o){var r,s;return{name:(r=o.title)!=null?r:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Ne.Initializer,node:o,resultTitle:O("Calculation result")}}}const Do={DEFAULT:null,ON_TRUE:1,ON_FALSE:0};class Or extends be{constructor(){super(...arguments);w(this,"title",`{{t("Condition", { ns: "${u}" })}}`);w(this,"type","condition");w(this,"group","control");w(this,"description",`{{t('Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".', { ns: "${u}" })}}`);w(this,"fieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:`{{t('Continue when "Yes"', { ns: "${u}" })}}`},{value:!1,label:`{{t('Branch into "Yes" and "No"', { ns: "${u}" })}}`}]},engine:{type:"string",title:`{{t("Calculation engine", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:`{{t("Basic", { ns: "${u}" })}}`}],...Array.from(De.evaluators.getEntities()).filter(([o])=>["math.js","formula.js"].includes(o))].reduce((o,[r,s])=>o.concat(C({value:r},s)),[])},required:!0,default:"basic"},calculation:{type:"object",title:`{{t("Condition", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:{type:"string",title:`{{t("Condition expression", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0},"x-validator"(o,r,{form:s}){const{values:a}=s,{evaluate:i}=De.evaluators.get(a.engine),c=o.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return i(c),""}catch(p){return O("Expression syntax error")}},"x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}},required:!0}});w(this,"presetFieldset",{rejectOnFalse:{type:"boolean",title:`{{t("Mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t('Continue when "Yes"', { ns: "${u}" })}}`,value:!0},{label:`{{t('Branch into "Yes" and "No"', { ns: "${u}" })}}`,value:!1}],default:!0}});w(this,"branching",({rejectOnFalse:o=!0}={})=>o?!1:[{label:`{{t('After end of branches', { ns: "${u}" })}}`,value:!1},{label:`{{t('Inside of "Yes" branch', { ns: "${u}" })}}`,value:Do.ON_TRUE},{label:`{{t('Inside of "No" branch', { ns: "${u}" })}}`,value:Do.ON_FALSE}]);w(this,"scope",{renderEngineReference:Pt,useWorkflowVariableOptions:me});w(this,"components",{CalculationConfig:oo,WorkflowVariableTextArea:It,RadioWithTooltip:ke})}Component({data:o}){const{t:r}=X.useTranslation(),{nodes:s}=H(),{styles:a}=ne(),{id:i,config:{rejectOnFalse:c}}=o,p=s.find(m=>m.upstreamId===i&&m.branchIndex===1),d=s.find(m=>m.upstreamId===i&&m.branchIndex===0);return n.jsx(Tt,{data:o,children:c?null:n.jsxs("div",{className:a.nodeSubtreeClass,children:[n.jsxs("div",{className:a.branchBlockClass,children:[n.jsx(tt,{from:o,entry:d,branchIndex:0}),n.jsx(tt,{from:o,entry:p,branchIndex:1})]}),n.jsxs("div",{className:a.conditionClass,children:[n.jsx("span",{style:{right:"4em"},children:r("No")}),n.jsx("span",{style:{left:"4em"},children:r("Yes")})]})]})})}}class $r extends be{constructor(){super(...arguments);w(this,"title",`{{t("End process", { ns: "${u}" })}}`);w(this,"type","end");w(this,"group","control");w(this,"description",`{{t("End the process immediately, with set status.", { ns: "${u}" })}}`);w(this,"fieldset",{endStatus:{type:"number",title:`{{t("End status", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:`{{t("Succeeded", { ns: "${u}" })}}`,value:ce.RESOLVED},{label:`{{t("Failed", { ns: "${u}" })}}`,value:ce.FAILED}],required:!0,default:ce.RESOLVED}});w(this,"end",!0)}}function Er({key:e,title:t,config:o},r){var d,m;const[s,a]=l.parseCollectionName(o.collection),i=l.useCompile(),c=je(s),[p]=Te(A(C({appends:[e,...((m=(d=o.params)==null?void 0:d.appends)==null?void 0:m.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:t}}],compile:i,getCollectionFields:c}));return p}class Dr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Query record", { ns: "${u}" })}}`);w(this,"type","query");w(this,"group","collection");w(this,"description",`{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}]}),multiple:{type:"boolean",title:`{{t("Result type", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Single record", { ns: "${u}" })}}`,value:!1,tooltip:`{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "${u}" })}}`},{label:`{{t("Multiple records", { ns: "${u}" })}}`,value:!0,tooltip:`{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "${u}" })}}`}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:ot,sort:or,pagination:nr,appends:We},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":`{{t("Exit when query result is null", { ns: "${u}" })}}`}});w(this,"scope",{useNodeSavedConfig:Be,useCollectionDataSource:l.useCollectionDataSource,useSortableFields(){const o=l.useCompile(),{values:r}=T.useForm(),[s,a]=l.parseCollectionName(r.collection),i=l.useApp(),{collectionManager:c}=i.dataSourceManager.getDataSource(s);return c.getCollectionFields(a).filter(d=>{if(!d.interface)return!1;const m=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(d.interface);return!!(m!=null&&m.sortable)}).map(d=>{var m,h;return{value:d.name,label:(m=d==null?void 0:d.uiSchema)!=null&&m.title?o((h=d==null?void 0:d.uiSchema)==null?void 0:h.title):d.name}})}});w(this,"components",{ArrayItems:gt.ArrayItems,FilterDynamicComponent:Re,SchemaComponentContext:l.SchemaComponentContext,WorkflowVariableInput:Dt,RadioWithTooltip:ke});w(this,"useVariables",Er)}useInitializers(o){var r,s;return!o.config.collection||o.config.multiple?null:{name:(r=o.title)!=null?r:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Pe,collection:o.config.collection,dataPath:`$jobsMapByNodeKey.${o.key}`}}}function Ir(e){const{getCollectionFields:t}=l.useCollectionManager_deprecated(),{path:o}=T.useField(),r=o.segments[o.segments.length-1],{values:s}=T.useForm(),[a,i]=l.parseCollectionName(s==null?void 0:s.collection),c=t(i,a),{type:p}=c.find(h=>h.name===r),d=Array.isArray(e.value)?e.value.join(","):e.value,m=y.useCallback(h=>{const v=h.target.value.trim(),b=["belongsTo","hasOne"].includes(p)?v||null:v.split(",").map(f=>f.trim()).filter(f=>f!=="");e.onChange(b)},[e.onChange,p]);return n.jsx(g.Input,A(C({},e),{value:d,onChange:m}))}const Io=T.observer(({value:e,disabled:t,onChange:o,filter:r})=>{const{token:s}=l.useToken(),{t:a}=X.useTranslation(),i=l.useCompile(),c=T.useForm(),{getCollectionFields:p}=l.useCollectionManager_deprecated(),d=me(),{values:m}=c,[h,v]=l.parseCollectionName(m==null?void 0:m.collection),b=p(v,h).filter(S=>S.uiSchema),f=r?b.filter(r.bind(m)):b,k=y.useMemo(()=>f.filter(S=>!e||!(S.name in e)),[f,e]),F=t||c.disabled,M=y.useMemo(()=>({onClick:({key:S})=>{o(A(C({},e),{[S]:null}))},style:{maxHeight:300,overflowY:"auto"},items:k.map(S=>{var E,L;return{key:S.name,label:i((L=(E=S.uiSchema)==null?void 0:E.title)!=null?L:S.name)}})}),[o,k,e]);return n.jsx("fieldset",{className:l.css`
|
|
562
|
-
margin-top: 0.5em;
|
|
563
|
-
|
|
564
|
-
> .ant-formily-item {
|
|
565
|
-
flex-direction: column;
|
|
566
|
-
|
|
567
|
-
> .ant-formily-item-label {
|
|
568
|
-
line-height: 32px;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
`,children:f.length?n.jsxs(l.CollectionProvider_deprecated,{name:v,dataSource:h,children:[f.filter(S=>e&&S.name in e).map(S=>{var L,$;const E=["belongsTo","hasOne","hasMany","belongsToMany"].includes(S.type)?Ir:l.CollectionField;return n.jsxs(g.Form.Item,{label:i(($=(L=S.uiSchema)==null?void 0:L.title)!=null?$:S.name),labelAlign:"left",className:l.css`
|
|
572
|
-
.ant-form-item-control-input-content {
|
|
573
|
-
display: flex;
|
|
574
|
-
}
|
|
575
|
-
`,children:[n.jsx(l.Variable.Input,{scope:d,value:e[S.name],changeOnSelect:!0,onChange:I=>{o(A(C({},e),{[S.name]:I}))},children:n.jsx(l.SchemaComponent,{schema:{type:"void",properties:{[S.name]:{"x-component":E,"x-validator"(){return""}}}}})}),F?null:n.jsx(g.Button,{"aria-label":"icon-close",type:"link",icon:n.jsx(V.CloseCircleOutlined,{}),onClick:()=>{var N;const B=e,{[N=S.name]:I}=B,D=Z(B,[Ro(N)]);o(D)}})]},S.name)}),k.length?n.jsx(g.Dropdown,{menu:M,children:n.jsx(g.Button,{icon:n.jsx(V.PlusOutlined,{}),children:a("Add field")})}):null]}):n.jsx("p",{style:{color:s.colorText},children:O("Please select collection first")})})},{displayName:"CollectionFieldSet"});function Po(e,t){t(e),e!=null&&e.properties&&Object.values(e.properties).forEach(o=>{Po(o,t)})}function Mo(){return{name:oe.uid(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function Bo(e){const{workflow:t}=H(),{setFormValueChanged:o}=l.useActionContext();l.useAPIClient();const r=me(),{values:s,setValuesIn:a,disabled:i}=T.useForm(),c=Ge.toJS(s.params),[p,d]=l.parseCollectionName(s.collection),m=l.useSchemaOptionsContext(),[h,v]=y.useState(e.value&&Object.keys(e.value).length?e.value:Mo()),b=y.useMemo(()=>fe.createForm({initialValues:c.values,disabled:t.executed,effects(){fe.onFormValuesChange(k=>{a("params.values",Ge.toJS(k.values)),o(!0)})}}),[t.executed]);T.useFormEffects(()=>{fe.onFieldValueChange("collection",k=>J(this,null,function*(){b.clearFormGraph("*");const F=Mo();a("params.values",{}),v(F)}))});const f=y.useCallback(k=>{const[F]=Object.values(k.toJSON().properties);e.onChange(F);const M=new Set;Po(F,E=>{var L;if(E["x-component"]==="AssignedField"&&(L=E["x-collection-field"])!=null&&L.startsWith(`${d}.`)){const[,$]=E["x-collection-field"].split(".");M.add($)}});const S={};Array.from(M).forEach(E=>{E in b.values&&(S[E]=b.values[E])}),a("params.values",S)},[d,e.onChange]);return n.jsx(g.Card,{children:n.jsx(l.CollectionManagerProvider,{dataSource:p,children:n.jsx(l.CollectionProvider,{name:d,children:n.jsx(l.RerenderDataBlockProvider,{children:n.jsx(l.FormProvider,{form:b,children:n.jsx(gt.FormLayout,{layout:"vertical",children:n.jsx(l.VariableScopeProvider,{scope:r,children:n.jsx(l.SchemaComponentProvider,{form:b,designable:!i,children:n.jsx(l.SchemaComponentOptions,A(C({},m),{children:n.jsx(l.SchemaComponent,{schema:h,onChange:f})}))})})})})})})})})}function Pr({key:e,title:t,config:o},r){var d,m;const[s,a]=l.parseCollectionName(o.collection),i=l.useCompile(),c=je(s),[p]=Te(A(C({appends:[e,...((m=(d=o.params)==null?void 0:d.appends)==null?void 0:m.map(h=>`${e}.${h}`))||[]]},r),{fields:[{collectionName:a,name:e,type:"hasOne",target:a,uiSchema:{title:t}}],compile:i,getCollectionFields:c}));return p}class Mr extends be{constructor(){super(...arguments);w(this,"title",`{{t("Create record", { ns: "${u}" })}}`);w(this,"type","create");w(this,"group","collection");w(this,"description",`{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:A(C({},ho),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:We}}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Be});w(this,"components",{CollectionFieldset:Io,AssignedFieldsFormSchemaConfig:Bo});w(this,"useVariables",Pr)}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}useInitializers(o){var r,s;return o.config.collection?{name:(r=o.title)!=null?r:`#${o.id}`,type:"item",title:(s=o.title)!=null?s:`#${o.id}`,Component:Pe,collection:o.config.collection,dataPath:`$jobsMapByNodeKey.${o.key}`}:null}}class Br extends be{constructor(){super(...arguments);w(this,"title",`{{t("Update record", { ns: "${u}" })}}`);w(this,"type","update");w(this,"group","collection");w(this,"description",`{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:`{{t("Update mode", { ns: "${u}" })}}`,"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:`{{t("Update in a batch", { ns: "${u}" })}}`,value:!1,tooltip:`{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But association fields are not supported (unless foreign key in current collection), and the updated data will not trigger other workflows.", { ns: "${u}" })}}`},{label:`{{t("Update one by one", { ns: "${u}" })}}`,value:!0,tooltip:`{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "${u}" })}}`}]},default:!1},filter:A(C({},ot),{title:`{{t("Only update records matching conditions", { ns: "${u}" })}}`,"x-validator"(o){return Q.isValidFilter(o)?"":O("Please add at least one condition")}}),values:A(C({},ho),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}});w(this,"scope",{useCollectionDataSource:l.useCollectionDataSource,useNodeSavedConfig:Be});w(this,"components",{FilterDynamicComponent:Re,CollectionFieldset:Io,AssignedFieldsFormSchemaConfig:Bo,RadioWithTooltip:ke})}createDefaultConfig(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}class Vr extends be{constructor(){super(...arguments);w(this,"title",'{{t("Delete record")}}');w(this,"type","destroy");w(this,"group","collection");w(this,"description",`{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "${u}" })}}`);w(this,"fieldset",{collection:A(C({},de),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":[...de["x-reactions"],{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}]}),params:{type:"object",properties:{filter:A(C({},ot),{"x-validator"(o){return Q.isValidFilter(o)?"":O("Please add at least one condition")}})}}});w(this,"scope",{useNodeSavedConfig:Be,useCollectionDataSource:l.useCollectionDataSource});w(this,"components",{FilterDynamicComponent:Re})}}const jr=new l.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:l.ButtonEditor,useComponentProps(){const{buttonEditorProps:e}=l.useSchemaToolbar();return e}},{name:"secondConfirmation",Component:l.SecondConFirm},{name:"assignFieldValues",Component:l.AssignedFieldValues},{name:"skipRequiredValidation",Component:l.SkipValidation},{name:"afterSuccessfulSubmission",Component:l.AfterSuccess},{name:"bindWorkflow",Component:l.WorkflowConfig},{name:"delete",sort:100,Component:l.RemoveButton,useComponentProps(){const{removeButtonProps:e}=l.useSchemaToolbar();return e}}]});function Wr({children:e,workflow:t,execution:o,nodes:r}){const s=l.usePlugin(le),a=s.triggers.get(t.type).components,i=r.reduce((c,{type:p})=>Object.assign(c,s.instructions.get(p).components),{});return n.jsx(Ie.Provider,{value:{workflow:t,nodes:r,execution:o},children:n.jsx(l.SchemaComponentOptions,{components:C(C({},a),i),children:e})})}class le extends l.Plugin{constructor(){super(...arguments);w(this,"triggers",new Q.Registry);w(this,"instructions",new Q.Registry);w(this,"systemVariables",new Q.Registry);w(this,"useTriggersOptions",()=>{const o=l.useCompile();return Array.from(this.triggers.getEntities()).map(i=>{var[r,c]=i,p=c,{title:s}=p,a=Z(p,["title"]);return{value:r,label:o(s),color:"gold",options:a}})})}isWorkflowSync(o){var r,s;return(s=(r=this.triggers.get(o.type))==null?void 0:r.sync)!=null?s:o.sync}registerTrigger(o,r){if(typeof r=="function")this.triggers.register(o,new r);else if(r)this.triggers.register(o,r);else throw new TypeError("invalid trigger type to register")}registerInstruction(o,r){if(typeof r=="function")this.instructions.register(o,new r);else if(r instanceof be)this.instructions.register(o,r);else throw new TypeError("invalid instruction type to register")}registerSystemVariable(o){this.systemVariables.register(o.key,o)}load(){return J(this,null,function*(){this.app.router.add("admin.workflow.workflows.id",{path:Ce(":id"),element:n.jsx(mo,{})}),this.app.router.add("admin.workflow.executions.id",{path:qe(":id"),element:n.jsx(lo,{})}),this.app.addComponents({WorkflowPage:mo,ExecutionPage:lo}),this.app.pluginSettingsManager.add(u,{icon:"PartitionOutlined",title:`{{t("Workflow", { ns: "${u}" })}}`,Component:tr,aclSnippet:"pm.workflow.workflows"}),this.app.schemaSettingsManager.add(jr),this.app.schemaSettingsManager.addItem("actionSettings:delete","workflowConfig",{Component:l.WorkflowConfig,useVisible(){var r;const o=T.useFieldSchema();return oe.isValid((r=o==null?void 0:o["x-action-settings"])==null?void 0:r.triggerWorkflows)}}),this.registerTrigger("collection",cr),this.registerTrigger("schedule",Tr),this.registerInstruction("calculation",Nr),this.registerInstruction("condition",Or),this.registerInstruction("end",$r),this.registerInstruction("query",Dr),this.registerInstruction("create",Mr),this.registerInstruction("update",Br),this.registerInstruction("destroy",Vr),this.registerSystemVariable({key:"now",label:`{{t("System time", { ns: "${u}" })}}`,value:"now"}),this.registerSystemVariable({key:"dateRange",label:`{{t("Date range", { ns: "${u}" })}}`,value:"dateRange",children:[{key:"yesterday",value:"yesterday",label:`{{t("Yesterday", { ns: "${u}" })}}`},{key:"today",value:"today",label:`{{t("Today", { ns: "${u}" })}}`},{key:"tomorrow",value:"tomorrow",label:`{{t("Tomorrow", { ns: "${u}" })}}`},{key:"lastWeek",value:"lastWeek",label:`{{t("Last week", { ns: "${u}" })}}`},{key:"thisWeek",value:"thisWeek",label:`{{t("This week", { ns: "${u}" })}}`},{key:"nextWeek",value:"nextWeek",label:`{{t("Next week", { ns: "${u}" })}}`},{key:"lastMonth",value:"lastMonth",label:`{{t("Last month", { ns: "${u}" })}}`},{key:"thisMonth",value:"thisMonth",label:`{{t("This month", { ns: "${u}" })}}`},{key:"nextMonth",value:"nextMonth",label:`{{t("Next month", { ns: "${u}" })}}`},{key:"lastQuarter",value:"lastQuarter",label:`{{t("Last quarter", { ns: "${u}" })}}`},{key:"thisQuarter",value:"thisQuarter",label:`{{t("This quarter", { ns: "${u}" })}}`},{key:"nextQuarter",value:"nextQuarter",label:`{{t("Next quarter", { ns: "${u}" })}}`},{key:"lastYear",value:"lastYear",label:`{{t("Last year", { ns: "${u}" })}}`},{key:"thisYear",value:"thisYear",label:`{{t("This year", { ns: "${u}" })}}`},{key:"nextYear",value:"nextYear",label:`{{t("Next year", { ns: "${u}" })}}`},{key:"last7Days",value:"last7Days",label:`{{t("Last 7 days", { ns: "${u}" })}}`},{key:"next7Days",value:"next7Days",label:`{{t("Next 7 days", { ns: "${u}" })}}`},{key:"last30Days",value:"last30Days",label:`{{t("Last 30 days", { ns: "${u}" })}}`},{key:"next30Days",value:"next30Days",label:`{{t("Next 30 days", { ns: "${u}" })}}`},{key:"last90Days",value:"last90Days",label:`{{t("Last 90 days", { ns: "${u}" })}}`},{key:"next90Days",value:"next90Days",label:`{{t("Next 90 days", { ns: "${u}" })}}`}]})})}}x.BaseTypeSets=Qe,x.Branch=tt,x.CalculationConfig=oo,x.CheckboxGroupWithTooltip=kn,x.CollectionBlockInitializer=Pe,x.DetailsBlockProvider=ln,x.EXECUTION_STATUS=ie,x.ExecutionContextProvider=Wr,x.ExecutionStatusOptions=Ye,x.ExecutionStatusOptionsMap=_e,x.FieldsSelect=Ct,x.Fieldset=On,x.FilterDynamicComponent=Re,x.FlowContext=Ie,x.Instruction=be,x.JOB_STATUS=ce,x.JobButton=Ft,x.JobStatusOptions=kt,x.JobStatusOptionsMap=Ke,x.Node=Gt,x.NodeContext=Ze,x.NodeDefaultView=Tt,x.RadioWithTooltip=ke,x.RemoveButton=At,x.SimpleDesigner=Xt,x.Trigger=Mt,x.ValueBlock=Ne,x.WorkflowVariableInput=Dt,x.WorkflowVariableJSON=Cn,x.WorkflowVariableRawTextArea=wn,x.WorkflowVariableTextArea=It,x.calculators=Y,x.default=le,x.defaultFieldNames=Ve,x.getCollectionFieldOptions=Te,x.getWorkflowDetailPath=Ce,x.getWorkflowExecutionsPath=qe,x.linkNodes=vt,x.nodesOptions=Yt,x.renderEngineReference=Pt,x.scopeOptions=Kt,x.systemOptions=Zt,x.traverseSchema=wt,x.triggerOptions=_t,x.useAvailableUpstreams=Ut,x.useFlowContext=H,x.useGetAriaLabelOfAddButton=St,x.useGetCollectionFields=je,x.useNodeContext=xe,x.useNodeSavedConfig=Be,x.useRecordTriggerWorkflowsActionProps=sr,x.useStyles=ne,x.useTrigger=Bt,x.useTriggerWorkflowsActionProps=rr,x.useUpstreamScopes=Ht,x.useWorkflowAnyExecuted=yo,x.useWorkflowExecuted=lr,x.useWorkflowVariableOptions=me,Object.defineProperties(x,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client"),require("@formily/react"),require("react"),require("react-i18next"),require("@nocobase/evaluators/client"),require("antd"),require("dayjs"),require("react-router-dom"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("@formily/reactive")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow",["@nocobase/client","@formily/react","react","react-i18next","@nocobase/evaluators/client","antd","dayjs","react-router-dom","@ant-design/icons","@formily/antd-v5","@formily/shared","@nocobase/utils/client","@formily/core","lodash","@formily/reactive"],t):"object"==typeof exports?exports["@nocobase/plugin-workflow"]=t(require("@nocobase/client"),require("@formily/react"),require("react"),require("react-i18next"),require("@nocobase/evaluators/client"),require("antd"),require("dayjs"),require("react-router-dom"),require("@ant-design/icons"),require("@formily/antd-v5"),require("@formily/shared"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("@formily/reactive")):e["@nocobase/plugin-workflow"]=t(e["@nocobase/client"],e["@formily/react"],e.react,e["react-i18next"],e["@nocobase/evaluators/client"],e.antd,e.dayjs,e["react-router-dom"],e["@ant-design/icons"],e["@formily/antd-v5"],e["@formily/shared"],e["@nocobase/utils/client"],e["@formily/core"],e.lodash,e["@formily/reactive"])}(self,function(e,t,n,r,o,i,a,l,c,u,s,f,d,p,m){return function(){var y,b,v,h,g,O,w={5071:function(e,t,n){"use strict";n.d(t,{E1:function(){return I},HS:function(){return j}});var r=n(8156),o=n.n(r),i=n(8563),a=n(3505),l=n(3772),c=n(5019),u=n(8018),s=n(573),f=n(7380),d=n(7584),p=n(2721),m=n(482);function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function v(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){b(i,r,o,a,l,"next",e)}function l(e){b(i,r,o,a,l,"throw",e)}a(void 0)})}}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function g(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return y(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function w(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function x(){var e,t,n=(e=["\n .ant-dropdown-menu-root {\n max-height: 30em;\n overflow-y: auto;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return x=function(){return n},n}function j(e){var t,n,i=e.upstream,a=e.branchIndex,f=void 0===a?null:a,d=(0,l.usePlugin)(c.default),y=(0,l.useCompile)(),b=(null!==(n=(0,u.G)())&&void 0!==n?n:{}).workflow,j=Array.from(d.instructions.getValues()),S=(0,c.useStyles)().styles,k=C(),E=k.onCreate,A=k.creating,P=(0,r.useMemo)(function(){return y([{key:"control",label:'{{t("Control", { ns: "'.concat(s.A7,'" })}}')},{key:"calculation",label:'{{t("Calculation", { ns: "'.concat(s.A7,'" })}}')},{key:"collection",label:'{{t("Collection operations", { ns: "'.concat(s.A7,'" })}}')},{key:"manual",label:'{{t("Manual", { ns: "'.concat(s.A7,'" })}}')},{key:"extended",label:'{{t("Extended types", { ns: "'.concat(s.A7,'" })}}')}].map(function(e){var t=j.filter(function(t){return t.group===e.key&&(!t.isAvailable||t.isAvailable({engine:d,workflow:b,upstream:i,branchIndex:f}))});return g(h({},e),{type:"group",children:t.map(function(e){return{role:"button","aria-label":e.type,key:e.type,label:e.title}})})}).filter(function(e){return e.children.length}))},[f,y,d,j,i,b]);var I=(0,r.useCallback)((t=v(function(e){return w(this,function(t){return E({type:O(e.keyPath,1)[0],upstream:i,branchIndex:f}),[2]})}),function(e){return t.apply(this,arguments)}),[f,E,i]);return b?o().createElement("div",{className:S.addButtonClass},o().createElement(p.Dropdown,{menu:{items:P,onClick:I},disabled:b.executed,overlayClassName:(0,l.css)(x())},o().createElement(p.Button,{"aria-label":e["aria-label"]||"add-button",shape:"circle",icon:o().createElement(m.PlusOutlined,null),loading:(null==A?void 0:A.upstreamId)==(null==i?void 0:i.id)&&(null==A?void 0:A.branchIndex)===f,size:"small"}))):null}function S(){var e=(0,a.useForm)(),t=(0,l.useAPIClient)(),n=(0,u.G)(),r=n.workflow,o=n.refresh,i=C(),c=i.presetting,s=i.setPresetting,f=i.setCreating,d=(0,l.useActionContext)();return{run:function(){return v(function(){var n;return w(this,function(i){switch(i.label){case 0:if(!c)return[2];return[4,e.submit()];case 1:i.sent(),f(c.data),i.label=2;case 2:return i.trys.push([2,6,7,8]),[4,t.resource("workflows.nodes",r.id).create({values:g(h({},c.data),{config:h({},c.data.config,e.values.config)})})];case 3:if(n=i.sent().data.data,!("number"==typeof e.values.downstreamBranchIndex&&n.downstreamId))return[3,5];return[4,t.resource("flow_nodes").update({filterByTk:n.downstreamId,values:{branchIndex:e.values.downstreamBranchIndex,upstream:{id:n.id,downstreamId:null}},updateAssociationValues:["upstream"]})];case 4:i.sent(),i.label=5;case 5:return d.setVisible(!1),s(null),o(),[3,8];case 6:return console.error(i.sent()),[3,8];case 7:return f(null),[7];case 8:return[2]}})})()}}}var k=(0,r.createContext)(null);function C(){return(0,r.useContext)(k)}var E=[{label:"{{t('After end of branches', { ns: \"".concat(s.A7,'" })}}'),value:!1},{label:"{{t('Inside of branch', { ns: \"".concat(s.A7,'" })}}'),value:0}],A=(0,a.observer)(function(e){var t,n,i=C().presetting,c=(0,u.G)().nodes,d=(0,a.useForm)().values,p=(0,r.useMemo)(function(){if(!(null==i?void 0:i.instruction))return[];var e,t=i.instruction,n=i.data;if(!(n.upstreamId?c.find(function(e){return e.upstreamId===n.upstreamId&&e.branchIndex===n.branchIndex}):c.find(function(e){return null===e.upstreamId})))return[];var r="function"==typeof t.branching?t.branching(null!==(e=d.config)&&void 0!==e?e:{}):t.branching;return r?!0===r?E:r:[]},[i,c,d.config]);if(!p.length)return null;var m=i.data;return o().createElement(l.SchemaComponent,{components:{RadioWithTooltip:f.W5},schema:{name:"".concat(null!==(t=m.type)&&void 0!==t?t:"unknown","-").concat(null!==(n=m.upstreamId)&&void 0!==n?n:"root","-").concat(m.branchIndex),type:"void",properties:{downstreamBranchIndex:{type:"number",title:(0,s.KQ)("Move all downstream nodes to",{ns:s.A7}),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:p,direction:"vertical"},default:!1,required:!0}}}})});function P(){var e=C().presetting;return(null==e?void 0:e.instruction.presetFieldset)?o().createElement(l.SchemaComponent,{schema:{type:"void",properties:{config:{type:"object",properties:e.instruction.presetFieldset}}}}):null}function I(e){var t,n,a=(0,l.useAPIClient)(),f=(0,l.useCompile)(),p=(0,l.usePlugin)(c.default),m=O((0,r.useState)(null),2),y=m[0],b=m[1],h=O((0,r.useState)(null),2),g=h[0],x=h[1],j=O((0,r.useState)(!1),2),C=j[0],E=j[1],I=null!==(n=(0,u.G)())&&void 0!==n?n:{},T=I.workflow,F=I.nodes,D=I.refresh,N=(0,r.useMemo)(function(){return(0,i.createForm)()},[]),M=(0,r.useCallback)(function(e){!e&&(N.reset(),N.clearFormGraph("*"),x(null))},[N]);var R=(0,r.useCallback)((t=v(function(e){return w(this,function(t){switch(t.label){case 0:b(e),t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,a.resource("workflows.nodes",T.id).create({values:e})];case 2:return t.sent(),D(),[3,5];case 3:return console.error(t.sent()),[3,5];case 4:return b(null),[7];case 5:return[2]}})}),function(e){return t.apply(this,arguments)}),[a,D,T.id]),_=(0,r.useCallback)(function(e){var t,n,r,o=e.type,i=e.upstream,a=e.branchIndex,l=p.instructions.get(o);if(!l){console.error('Instruction "'.concat(o,'" not found'));return}var c={key:(0,d.uid)(),type:o,upstreamId:null!==(n=null==i?void 0:i.id)&&void 0!==n?n:null,branchIndex:a,title:f(l.title),config:null!==(r=null===(t=l.createDefaultConfig)||void 0===t?void 0:t.call(l))&&void 0!==r?r:{}},u=(null==i?void 0:i.id)?F.find(function(e){return e.upstreamId===c.upstreamId&&e.branchIndex===c.branchIndex}):F.find(function(e){return null===e.upstreamId});if(l.presetFieldset||("function"==typeof l.branching?l.branching(c.config):l.branching)&&u){x({data:c,instruction:l});return}R(c)},[f,R,p.instructions]);return o().createElement(k.Provider,{value:{presetting:g,setPresetting:x,onCreate:_,creating:y,setCreating:b}},e.children,o().createElement(l.ActionContextProvider,{value:{visible:!!g,setVisible:M,formValueChanged:C,setFormValueChanged:E,openSize:"small"}},o().createElement(l.SchemaComponent,{components:{DownstreamBranchIndex:A,PresetFieldset:P},scope:{useCancelAction:l.useCancelAction,useAddNodeSubmitAction:S},schema:{name:"modal",type:"void","x-decorator":"FormV2","x-decorator-props":{form:N},"x-component":"Action.Modal",title:'{{ t("Add node", { ns: "'.concat(s.A7,'" }) }}'),properties:{config:{type:"void","x-component":"PresetFieldset"},downstreamBranchIndex:{type:"void","x-component":"DownstreamBranchIndex"},footer:{"x-component":"Action.Modal.Footer",properties:{actions:{type:"void","x-component":"ActionBar",properties:{cancel:{type:"void",title:'{{ t("Cancel") }}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},submit:{type:"void",title:'{{ t("Submit") }}',"x-component":"Action","x-component-props":{type:"primary",htmlType:"submit",useAction:"{{ useAddNodeSubmitAction }}"}}}}}}}}})))}},2708:function(e,t,n){"use strict";n.d(t,{I:function(){return f}});var r=n(8156),o=n.n(r),i=n(482),a=n(3772),l=n(5071),c=n(6279),u=n(3461),s=n(8378);function f(e){for(var t=e.from,n=void 0===t?null:t,r=e.entry,f=void 0===r?null:r,d=e.branchIndex,p=void 0===d?null:d,m=e.controller,y=e.className,b=e.end,v=(0,s.Z)().styles,h=(0,c.C)(n,p).getAriaLabel,g=[],O=f;O;O=O.downstream)g.push(O);return o().createElement("div",{className:(0,a.cx)("workflow-branch",v.branchClass,y)},o().createElement("div",{className:"workflow-branch-lines"}),void 0===m?null:m,o().createElement(l.HS,{"aria-label":h(),upstream:n,branchIndex:p}),o().createElement("div",{className:"workflow-node-list"},g.map(function(e){return o().createElement(u.NB,{data:e,key:e.id})})),b?o().createElement("div",{className:"end-sign"},o().createElement(i.CloseOutlined,null)):null)}},8018:function(e,t,n){"use strict";n.d(t,{G:function(){return i},i:function(){return o}});var r=n(8156),o=n.n(r)().createContext({});function i(){return(0,r.useContext)(o)}},3430:function(e,t,n){"use strict";n.d(t,{G:function(){return T},n:function(){return S}});var r=n(7584),o=n(8156),i=n.n(o),a=n(573),l=n(3772),c=n(6805),u=n(2721),s=n(3238),f=n(482);function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||h(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function v(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}function g(){var e=b(["\n display: flex;\n gap: 0.5em;\n align-items: center;\n flex-wrap: wrap;\n "]);return g=function(){return e},e}function O(){var e=b(["\n display: flex;\n position: relative;\n margin: 0.5em 0;\n "]);return O=function(){return e},e}function w(){var e=b(["\n position: relative;\n width: 100%;\n .node-type-condition-group {\n padding: 0.5em 1em;\n border: 1px dashed #ddd;\n }\n + button {\n position: absolute;\n right: 0;\n }\n "]);return w=function(){return e},e}function x(){var e=b(["\n display: flex;\n align-items: center;\n gap: 0.5em;\n .ant-select {\n width: auto;\n min-width: 6em;\n }\n "]);return x=function(){return e},e}function j(){var e=b(["\n button {\n padding: 0;\n &:not(:last-child) {\n margin-right: 1em;\n }\n }\n "]);return j=function(){return e},e}var S=new r.Registry;S.register("equal",{name:"=",type:"boolean",group:"boolean"}),S.register("notEqual",{name:"≠",type:"boolean",group:"boolean"}),S.register("gt",{name:">",type:"boolean",group:"boolean"}),S.register("gte",{name:"≥",type:"boolean",group:"boolean"}),S.register("lt",{name:"<",type:"boolean",group:"boolean"}),S.register("lte",{name:"≤",type:"boolean",group:"boolean"}),S.register("add",{name:"+",type:"number",group:"number"}),S.register("minus",{name:"-",type:"number",group:"number"}),S.register("multiple",{name:"*",type:"number",group:"number"}),S.register("divide",{name:"/",type:"number",group:"number"}),S.register("mod",{name:"%",type:"number",group:"number"}),S.register("includes",{name:'{{t("contains")}}',type:"boolean",group:"string"}),S.register("notIncludes",{name:'{{t("does not contain")}}',type:"boolean",group:"string"}),S.register("startsWith",{name:'{{t("starts with")}}',type:"boolean",group:"string"}),S.register("notStartsWith",{name:'{{t("not starts with")}}',type:"boolean",group:"string"}),S.register("endsWith",{name:'{{t("ends with")}}',type:"boolean",group:"string"}),S.register("notEndsWith",{name:'{{t("not ends with")}}',type:"boolean",group:"string"}),S.register("concat",{name:'{{t("concat", { ns: "'.concat(a.A7,'" })}}'),type:"string",group:"string"});var k=[{value:"boolean",title:'{{t("Comparision")}}'},{value:"number",title:'{{t("Arithmetic calculation", { ns: "'.concat(a.A7,'" })}}')},{value:"string",title:'{{t("String operation", { ns: "'.concat(a.A7,'" })}}')},{value:"date",title:'{{t("Date", { ns: "'.concat(a.A7,'" })}}')}];function C(e){return Array.from(S.getEntities()).filter(function(t){var n=y(t,2);return(n[0],n[1]).group===e})}function E(e){var t=e.calculator,n=e.operands,r=void 0===n?[]:n,c=e.onChange,s=(0,l.useCompile)(),f=(0,o.useContext)(I),d=f(),p=f(),m=(0,o.useCallback)(function(e){return c({calculator:t,operands:[e,r[1]]})},[t,c,r]),b=(0,o.useCallback)(function(e){return c({calculator:t,operands:[r[0],e]})},[t,c,r]),v=(0,o.useCallback)(function(e){return c({operands:r,calculator:e})},[c,r]);return i().createElement("fieldset",{className:(0,l.css)(g())},i().createElement(l.Variable.Input,{changeOnSelect:!0,value:r[0],onChange:m,scope:d,useTypedConstant:!0}),i().createElement(u.Select,{role:"button","aria-label":"select-operator-calc",value:t,onChange:v,placeholder:(0,a.KQ)("Operator"),popupMatchSelectWidth:!1,className:"auto-width"},k.filter(function(e){return!!C(e.value).length}).map(function(e){return i().createElement(u.Select.OptGroup,{key:e.value,label:s(e.title)},C(e.value).map(function(e){var t=y(e,2),n=t[0],r=t[1].name;return i().createElement(u.Select.Option,{key:n,value:n},s(r))}))})),i().createElement(l.Variable.Input,{changeOnSelect:!0,value:r[1],onChange:b,scope:p,useTypedConstant:!0}))}function A(e){var t=e.value,n=e.onChange,r=e.onRemove;if(!t)return null;var o=t.calculator,a=t.operands;return i().createElement("div",{className:(0,l.css)(O())},t.group?i().createElement(P,{value:t.group,onChange:function(e){return n(m(p({},t),{group:e}))}}):i().createElement(E,{operands:void 0===a?[]:a,calculator:o,onChange:n}),i().createElement(u.Button,{"aria-label":"icon-close",onClick:r,type:"link",icon:i().createElement(f.CloseCircleOutlined,null)}))}function P(e){var t=this,n=e.value,r=e.onChange,a=(0,s.useTranslation)().t,c=n.type,f=n.calculations,d=void 0===f?[]:f,y=(0,o.useCallback)(function(){r(m(p({},n),{calculations:v(d).concat([{not:!1,calculator:"equal"}])}))},[n,d,r]),b=(0,o.useCallback)(function(){r(m(p({},n),{calculations:v(d).concat([{not:!1,group:{type:"and",calculations:[]}}])}))},[n,d,r]),h=(0,o.useCallback)(function(e){d.splice(e,1),r(m(p({},n),{calculations:v(d)}))},[n,d,r]),g=(0,o.useCallback)(function(e,t){d.splice(e,1,t),r(m(p({},n),{calculations:v(d)}))},[n,d,r]);return i().createElement("div",{className:(0,l.cx)("node-type-condition-group",(0,l.css)(w()))},i().createElement("div",{className:(0,l.css)(x())},i().createElement(s.Trans,null,"Meet ",i().createElement(u.Select,{role:"button","data-testid":"filter-select-all-or-any",value:void 0===c?"and":c,onChange:function(e){return r(m(p({},n),{type:e}))}},i().createElement(u.Select.Option,{value:"and"},"All"),i().createElement(u.Select.Option,{value:"or"},"Any"))," conditions in the group")),i().createElement("div",{className:"calculation-items"},d.map(function(e,n){return i().createElement(A,{key:"".concat(e.calculator,"_").concat(n),value:e,onChange:g.bind(t,n),onRemove:function(){return h(n)}})})),i().createElement("div",{className:(0,l.css)(j())},i().createElement(u.Button,{type:"link",onClick:y},a("Add condition")),i().createElement(u.Button,{type:"link",onClick:b},a("Add condition group"))))}var I=(0,o.createContext)(c.rX);function T(e){var t=e.value,n=e.onChange,r=e.useVariableHook,o=void 0===r?c.rX:r,a=t&&Object.keys(t).length?t:{group:{type:"and",calculations:[]}};return i().createElement(I.Provider,{value:o},i().createElement(P,{value:a.group,onChange:function(e){return n(m(p({},a),{group:e}))}}))}},8500:function(e,t,n){"use strict";n.d(t,{P:function(){return d}});var r=n(8156),o=n.n(r),i=n(8875),a=n(3772),l=n(7893);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function f(e){var t,n,r,f=e.collection,d=e.dataPath,p=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["collection","dataPath"]),m=(0,a.useSchemaInitializer)().insert,y=(0,a.useSchemaTemplateManager)().getTemplateSchemaByMode,b=(0,a.useCollectionManager_deprecated)().getCollection,v=(0,a.useRecordCollectionDataSourceItems)("FormItem");if("string"==typeof f){var h,g,O=(h=(0,a.parseCollectionName)(f),g=2,function(e){if(Array.isArray(e))return e}(h)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(h,2)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(h,g)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=O[0];r=b(O[1],w)}else r=f;function x(){var e;return e=function(e){var t,n,o,a;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(c){switch(c.label){case 0:if(!(t=e.item).template)return[3,2];return[4,y(t)];case 1:return o=c.sent(),[3,3];case 2:o=null,c.label=3;case 3:return n=o,a={type:"void",name:(0,i.uid)(),title:r.title,"x-decorator":"DetailsBlockProvider","x-decorator-props":{collection:f,dataPath:d},"x-component":"CardItem","x-component-props":{title:p.title},"x-designer":"SimpleDesigner",properties:{grid:{type:"void","x-component":"FormV2","x-use-component-props":"useDetailsBlockProps","x-read-pretty":!0,properties:{grid:n||{type:"void","x-component":"Grid","x-initializer":"details:configureFields",properties:{}}}}}},(0,l.dF)(a,function(e){e["x-uid"]&&delete e["x-uid"]}),m(a),[2]}})},(x=function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){u(i,r,o,a,l,"next",e)}function l(e){u(i,r,o,a,l,"throw",e)}a(void 0)})}).apply(this,arguments)}return o().createElement(a.SchemaInitializerItem,(t=s({},p),n=(n={onClick:function(e){return x.apply(this,arguments)},items:v},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function d(e){var t,n,r,i=(0,a.useSchemaInitializerItem)(),l=null!==(t=null==e?void 0:e.collection)&&void 0!==t?t:i.collection;if("string"==typeof l){var c=(0,a.parseCollectionName)(l);n=c[0],r=c[1]}else r=l;return o().createElement(a.CollectionProvider_deprecated,{dataSource:n,collection:r},o().createElement(f,s({},i,e)))}},1220:function(e,t,n){"use strict";n.d(t,{u:function(){return u}});var r=n(3772),o=n(2721),i=n(8156),a=n.n(i);function l(){var e,t,n=(e=["\n margin-bottom: 1.5em;\n padding: 1em;\n background-color: ",";\n\n > *:last-child {\n margin-bottom: 0;\n }\n\n dl {\n display: flex;\n align-items: baseline;\n\n dt {\n color: ",";\n &:after {\n content: ':';\n margin-right: 0.5em;\n }\n }\n }\n\n p {\n color: ",";\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return l=function(){return n},n}var c=(0,r.createStyles)(function(e){var t=e.css,n=e.token;return{container:t(l(),n.colorFillAlter,n.colorText,n.colorTextDescription)}});function u(e){var t=e.label,n=e.title,i=e.description,l=c().styles;return a().createElement("div",{className:(0,r.cx)(l.container,e.className)},a().createElement("dl",null,a().createElement("dt",null,t),a().createElement("dd",null,a().createElement(o.Tag,{style:{background:"none"}},n))),i?a().createElement("p",null,i):null)}},4514:function(e,t,n){"use strict";n.d(t,{x:function(){return s}});var r=n(3505),o=n(2721),i=n(8156),a=n.n(i),l=n(3772);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(){return!0}var s=(0,r.observer)(function(e){var t,n,i,s,f=e.filter,d=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["filter"]),p=(0,l.useCompile)(),m=(0,l.useCollectionManager_deprecated)().getCollectionFields,y=(0,r.useForm)().values;var b=(t=(0,l.parseCollectionName)(null==y?void 0:y.collection),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),v=b[0],h=m(b[1],v);return a().createElement(o.Select,(i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({popupMatchSelectWidth:!1},d),s=(s={options:h.filter(void 0===f?u:f).map(function(e){var t;return{label:p(null===(t=e.uiSchema)||void 0===t?void 0:t.title),value:e.name}})},s),Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(s)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(s)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(s,e))}),i))},{displayName:"FieldsSelect"})},1188:function(e,t,n){"use strict";n.d(t,{p:function(){return l}});var r=n(8156),o=n.n(r),i=n(4632),a=n(2721);function l(e){return o().createElement(a.Card,null,o().createElement(i.FormLayout,{layout:e.layout||"vertical"},e.children))}},4339:function(e,t,n){"use strict";n.d(t,{V:function(){return u}});var r=n(8156),o=n.n(r),i=n(3772),a=n(6805),l=n(573),c={key:"dateRange",label:"{{t('Date range', { ns: '".concat(l.A7,"' })}}"),value:"dateRange",children:[{key:"yesterday",value:"yesterday",label:'{{t("Yesterday")}}'},{key:"today",value:"today",label:'{{t("Today")}}'},{key:"tomorrow",value:"tomorrow",label:'{{t("Tomorrow")}}'},{key:"lastWeek",value:"lastWeek",label:'{{t("Last week")}}'},{key:"thisWeek",value:"thisWeek",label:'{{t("This week")}}'},{key:"nextWeek",value:"nextWeek",label:'{{t("Next week")}}'},{key:"lastMonth",value:"lastMonth",label:'{{t("Last month")}}'},{key:"thisMonth",value:"thisMonth",label:'{{t("This month")}}'},{key:"nextMonth",value:"nextMonth",label:'{{t("Next month")}}'},{key:"lastQuarter",value:"lastQuarter",label:'{{t("Last quarter")}}'},{key:"thisQuarter",value:"thisQuarter",label:'{{t("This quarter")}}'},{key:"nextQuarter",value:"nextQuarter",label:'{{t("Next quarter")}}'},{key:"lastYear",value:"lastYear",label:'{{t("Last year")}}'},{key:"thisYear",value:"thisYear",label:'{{t("This year")}}'},{key:"nextYear",value:"nextYear",label:'{{t("Next year")}}'},{key:"last7Days",value:"last7Days",label:'{{t("Last 7 days")}}'},{key:"next7Days",value:"next7Days",label:'{{t("Next 7 days")}}'},{key:"last30Days",value:"last30Days",label:'{{t("Last 30 days")}}'},{key:"next30Days",value:"next30Days",label:'{{t("Next 30 days")}}'},{key:"last90Days",value:"last90Days",label:'{{t("Last 90 days")}}'},{key:"next90Days",value:"next90Days",label:'{{t("Next 90 days")}}'}]};function u(e){var t=e.value,n=e.onChange,r=e.renderSchemaComponent,l=(0,i.useCompile)(),u=(0,a.rX)(),s=u.findIndex(function(e){return"$system"===e.key});return u[s].children.push(l(c)),o().createElement(i.Variable.Input,{value:t,onChange:n,scope:u},r())}},799:function(e,t,n){"use strict";n.d(t,{W:function(){return u}});var r=n(482),o=n(3772),i=n(2721),a=n(8156),l=n.n(a);function c(){var e,t,n=(e=["\n & + .anticon {\n margin-left: 0.25em;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return c=function(){return n},n}function u(e){var t=e.options,n=e.direction,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["options","direction"]),u=(0,o.useCompile)();return l().createElement(i.Radio.Group,a,l().createElement(i.Space,{direction:n},(void 0===t?[]:t).map(function(e){return l().createElement(i.Radio,{key:e.value,value:e.value},l().createElement("span",{className:(0,o.css)(c())},u(e.label)),e.tooltip&&l().createElement(i.Tooltip,{title:u(e.tooltip)},l().createElement(r.QuestionCircleOutlined,{style:{color:"#666"}})))})))}},5676:function(e,t,n){"use strict";n.d(t,{D:function(){return l}});var r=n(8156),o=n.n(r),i=n(3505),a=n(3772);function l(){var e=(0,i.useFieldSchema)(),t=(0,a.useCompile)();return o().createElement(a.GeneralSchemaDesigner,{title:t(e.title)},o().createElement(a.SchemaSettingsBlockTitleItem,null),o().createElement(a.SchemaSettingsDivider,null),o().createElement(a.SchemaSettingsRemove,{removeParentsIfNoChildren:!0,breakRemoveOn:{"x-component":"Grid"}}))}},6594:function(e,t,n){"use strict";n.d(t,{Y:function(){return p}});var r=n(8156),o=n.n(r),i=n(2721),a=n(9527),l=n.n(a),c=n(3772);function u(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function s(){var e=u(["\n border: none;\n .ant-tag {\n width: 100%;\n height: 100%;\n padding: 0;\n margin-right: 0;\n border-radius: 50%;\n text-align: center;\n }\n "]);return s=function(){return e},e}function f(){var e=u(["\n border-width: 2px;\n "]);return f=function(){return e},e}var d=(0,c.createStyles)(function(e){var t=e.css;return e.token,{statusButtonClass:t(s()),noStatusButtonClass:t(f())}});function p(e){var t,n,r=e.status,a=e.statusMap,c=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["status","statusMap"]),u=d().styles,s=null;if(void 0!==r&&(null==a?void 0:a[r])){var f=a[r],p=f.icon,m=f.color;s=o().createElement(i.Tag,{color:m},p)}return o().createElement(i.Button,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},c),n=(n={shape:"circle",size:"small",className:l()(s?u.statusButtonClass:u.noStatusButtonClass,e.className)},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t),s)}},6922:function(e,t,n){"use strict";n.d(t,{P:function(){return c}});var r=n(8156),o=n.n(r),i=n(3772),a=n(8018);function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(e){var t,n,r=(0,a.G)().workflow,c=(0,i.useApp)();var u=(t=(0,i.parseCollectionName)(r.config.collection),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],f=u[1],d=c.dataSourceManager.getDataSource(s).collectionManager.getCollection(f);return o().createElement(i.RemoteSelect,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({objectValue:!0,dataSource:s,fieldNames:{label:d.titleField,value:"id"},service:{resource:f},manual:!1},e))}},8060:function(e,t,n){"use strict";n.d(t,{X:function(){return d}});var r=n(3505),o=n(3772),i=n(7584),a=n(8156),l=n.n(a),c=n(8018),u=n(5676);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(){var e,t,n=(e=["\n margin: 0;\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return f=function(){return n},n}var d=function(){return null};d.Initializer=function(){var e,t,n=(0,o.useSchemaInitializerItem)(),r=n.node,i=n.resultTitle,a=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(n,["node","resultTitle"]),c=(0,o.useSchemaInitializer)().insert;return l().createElement(o.SchemaInitializerItem,(e=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){s(e,t,n[t])})}return e}({},a),t=(t={onClick:function(){var e;c({type:"void",name:r.id,title:r.title,"x-component":"CardItem","x-component-props":{title:null!==(e=r.title)&&void 0!==e?e:"#".concat(r.id)},"x-designer":"ValueBlock.Designer",properties:{result:{type:"void",title:i,"x-component":"ValueBlock.Result","x-component-props":{dataSource:"{{$jobsMapByNodeKey.".concat(r.key,"}}")}}}})}},t),Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e))},d.Result=function(e){var t,n=e.dataSource,a=(0,r.useFieldSchema)(),u=(0,c.G)().execution;if(!u)return a.title;var d=(0,i.parse)(n)({$jobsMapByNodeKey:(null!==(t=u.jobs)&&void 0!==t?t:[]).reduce(function(e,t){return Object.assign(e,s({},t.nodeKey,t.result))},{})});return l().createElement("pre",{className:(0,o.css)(f())},JSON.stringify(d,null,2))},d.Designer=u.D},3048:function(e,t,n){"use strict";n.d(t,{$:function(){return c}});var r=n(3772),o=n(47),i=n(8156),a=n.n(i);function l(){var e,t,n=(e=["\n &:after {\n content: ':';\n }\n & + a {\n margin-left: 0.25em;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return l=function(){return n},n}var c=function(e){var t=o.evaluators.get(e);return t?t.link?a().createElement(a().Fragment,null,a().createElement("span",{className:(0,r.css)(l())},r.i18n.t("Syntax references")),a().createElement("a",{href:t.link,target:"_blank",rel:"noreferrer"},t.label)):null:null}},9144:function(e,t,n){"use strict";n.d(t,{C6:function(){return u},Vh:function(){return d},jf:function(){return f},ke:function(){return p},r9:function(){return c},uy:function(){return s}});var r=n(8156),o=n.n(r),i=n(482),a=n(573);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c={QUEUEING:null,STARTED:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},u=[{value:c.QUEUEING,label:'{{t("Queueing", { ns: "'.concat(a.A7,'" })}}'),color:"blue",icon:o().createElement(i.HourglassOutlined,null),statusType:"info",description:'{{t("Triggered but still waiting in queue to execute.", { ns: "'.concat(a.A7,'" })}}')},{value:c.STARTED,label:'{{t("On going", { ns: "'.concat(a.A7,'" })}}'),color:"gold",icon:o().createElement(i.LoadingOutlined,null),statusType:"warning",description:'{{t("Started and executing, maybe waiting for an async callback (manual, delay etc.).", { ns: "'.concat(a.A7,'" })}}')},{value:c.RESOLVED,label:'{{t("Resolved", { ns: "'.concat(a.A7,'" })}}'),color:"green",icon:o().createElement(i.CheckOutlined,null),statusType:"success",description:'{{t("Successfully finished.", { ns: "'.concat(a.A7,'" })}}')},{value:c.FAILED,label:'{{t("Failed", { ns: "'.concat(a.A7,'" })}}'),color:"red",icon:o().createElement(i.ExclamationOutlined,null),statusType:"error",description:'{{t("Failed to satisfy node configurations.", { ns: "'.concat(a.A7,'" })}}')},{value:c.ERROR,label:'{{t("Error", { ns: "'.concat(a.A7,'" })}}'),color:"red",icon:o().createElement(i.CloseOutlined,null),statusType:"error",description:'{{t("Some node meets error.", { ns: "'.concat(a.A7,'" })}}')},{value:c.ABORTED,label:'{{t("Aborted", { ns: "'.concat(a.A7,'" })}}'),color:"red",icon:o().createElement(i.MinusOutlined,{rotate:90}),statusType:"error",description:'{{t("Running of some node was aborted by program flow.", { ns: "'.concat(a.A7,'" })}}')},{value:c.CANCELED,label:'{{t("Canceled", { ns: "'.concat(a.A7,'" })}}'),color:"volcano",icon:o().createElement(i.MinusOutlined,{rotate:45}),statusType:"error",description:'{{t("Manually canceled whole execution when waiting.", { ns: "'.concat(a.A7,'" })}}')},{value:c.REJECTED,label:'{{t("Rejected", { ns: "'.concat(a.A7,'" })}}'),color:"volcano",icon:o().createElement(i.MinusOutlined,null),statusType:"error",description:'{{t("Rejected from a manual node.", { ns: "'.concat(a.A7,'" })}}')},{value:c.RETRY_NEEDED,label:'{{t("Retry needed", { ns: "'.concat(a.A7,'" })}}'),color:"volcano",icon:o().createElement(i.RedoOutlined,null),statusType:"error",description:'{{t("General failed but should do another try.", { ns: "'.concat(a.A7,'" })}}')}],s=u.reduce(function(e,t){return Object.assign(e,l({},t.value,t))},{}),f={PENDING:0,RESOLVED:1,FAILED:-1,ERROR:-2,ABORTED:-3,CANCELED:-4,REJECTED:-5,RETRY_NEEDED:-6},d=[{value:f.PENDING,label:'{{t("Pending", { ns: "'.concat(a.A7,'" })}}'),color:"gold",icon:o().createElement(i.ClockCircleOutlined,null)},{value:f.RESOLVED,label:'{{t("Resolved", { ns: "'.concat(a.A7,'" })}}'),color:"green",icon:o().createElement(i.CheckOutlined,null)},{value:f.FAILED,label:'{{t("Failed", { ns: "'.concat(a.A7,'" })}}'),color:"red",icon:o().createElement(i.ExclamationOutlined,null)},{value:f.ERROR,label:'{{t("Error", { ns: "'.concat(a.A7,'" })}}'),color:"red",icon:o().createElement(i.CloseOutlined,null)},{value:f.ABORTED,label:'{{t("Aborted", { ns: "'.concat(a.A7,'" })}}'),color:"red",icon:o().createElement(i.MinusOutlined,{rotate:90})},{value:f.CANCELED,label:'{{t("Canceled", { ns: "'.concat(a.A7,'" })}}'),color:"volcano",icon:o().createElement(i.MinusOutlined,{rotate:45})},{value:f.REJECTED,label:'{{t("Rejected", { ns: "'.concat(a.A7,'" })}}'),color:"volcano",icon:o().createElement(i.MinusOutlined,null)},{value:f.RETRY_NEEDED,label:'{{t("Retry needed", { ns: "'.concat(a.A7,'" })}}'),color:"volcano",icon:o().createElement(i.RedoOutlined,null)}],p=d.reduce(function(e,t){return Object.assign(e,l({},t.value,t))},{})},5019:function(e,t,n){"use strict";n.r(t),n.d(t,{JobStatusOptionsMap:function(){return tI.ke},WorkflowVariableJSON:function(){return S.RU},useWorkflowAnyExecuted:function(){return M},systemOptions:function(){return S.PL},useRecordTriggerWorkflowsActionProps:function(){return F},Trigger:function(){return R.xz},JobStatusOptions:function(){return tI.Vh},ValueBlock:function(){return tB.XB},WorkflowVariableInput:function(){return S.kw},useWorkflowVariableOptions:function(){return S.rX},Fieldset:function(){return tB.pg},CollectionBlockInitializer:function(){return tB.PW},ExecutionStatusOptions:function(){return tI.C6},nodesOptions:function(){return S.h9},FilterDynamicComponent:function(){return tB.VT},useNodeSavedConfig:function(){return ta.WH},Instruction:function(){return ta.vr},NodeDefaultView:function(){return ta.v9},getWorkflowDetailPath:function(){return n_.SI},useWorkflowExecuted:function(){return N},scopeOptions:function(){return S.UE},traverseSchema:function(){return n_.dF},CalculationConfig:function(){return tB.Gs},defaultFieldNames:function(){return S.Ox},WorkflowVariableRawTextArea:function(){return S.gz},useGetAriaLabelOfAddButton:function(){return k.C},SimpleDesigner:function(){return tB.D4},TriggerCollectionRecordSelect:function(){return tB.PO},DetailsBlockProvider:function(){return tB.nw},useStyles:function(){return th.Z},FlowContext:function(){return D.i},JobButton:function(){return ta.E9},NodeContext:function(){return ta.sy},useTrigger:function(){return R.cC},useUpstreamScopes:function(){return ta.Kd},Node:function(){return ta.NB},useTriggerWorkflowsActionProps:function(){return T},BaseTypeSets:function(){return S.VW},triggerOptions:function(){return S.DU},RadioWithTooltip:function(){return tB.W5},useGetCollectionFields:function(){return S.G$},RemoveButton:function(){return ta.xZ},default:function(){return nX},EXECUTION_STATUS:function(){return tI.r9},useNodeContext:function(){return ta.h6},ExecutionStatusOptionsMap:function(){return tI.uy},JOB_STATUS:function(){return tI.jf},ExecutionContextProvider:function(){return nV},getWorkflowExecutionsPath:function(){return n_.s_},linkNodes:function(){return n_.Yc},WorkflowVariableTextArea:function(){return S.r$},CheckboxGroupWithTooltip:function(){return tB.JF},calculators:function(){return tB.nF},Branch:function(){return tv.I},useFlowContext:function(){return D.G},renderEngineReference:function(){return tB.$W},FieldsSelect:function(){return tB.xH},useAvailableUpstreams:function(){return ta.Lu},getCollectionFieldOptions:function(){return S._5}});var r,o,i=n("8156"),a=n.n(i),l=n("3505"),c=n("8875"),u=n("3772"),s=n("7584"),f=n("8500"),d=n("4514"),p=n("573");function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function b(){var e=y(["\n flex-direction: column;\n "]);return b=function(){return e},e}function v(){var e=y(["\n position: relative;\n width: 100%;\n "]);return v=function(){return e},e}var h={type:"string",title:'{{t("Collection")}}',required:!0,"x-reactions":[],"x-decorator":"FormItem","x-component":"DataSourceCollectionCascader"},g={type:"object",title:'{{t("Fields values")}}',description:'{{t("Unassigned fields will be set to default values, and those without default values will be set to null.", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-decorator-props":{labelAlign:"left",className:(0,u.css)(b())},"x-component":"CollectionFieldset"},O={type:"object",title:'{{t("Filter")}}',"x-decorator":"FormItem","x-component":"Filter","x-use-component-props":function(){var e,t,n=(0,l.useForm)().values;var r=(e=(0,u.parseCollectionName)(null==n?void 0:n.collection),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=r[0],i=r[1];return{options:(0,u.useCollectionFilterOptions)(i,o),className:(0,u.css)(v())}},"x-component-props":{dynamicComponent:"FilterDynamicComponent"}},w={type:"array",title:'{{t("Sort")}}',"x-decorator":"FormItem","x-component":"ArrayItems",items:{type:"object",properties:{space:{type:"void","x-component":"Space",properties:{sort:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.SortHandle"},field:{type:"string",enum:"{{useSortableFields()}}",required:!0,"x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:260}}},direction:{type:"string","x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{optionType:"button"},enum:[{label:'{{t("ASC")}}',value:"asc"},{label:'{{t("DESC")}}',value:"desc"}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}}}},properties:{add:{type:"void",title:'{{t("Add sort field")}}',"x-component":"ArrayItems.Addition"}}},x={type:"void",title:'{{t("Pagination")}}',"x-decorator":"SchemaComponentContext.Provider","x-decorator-props":{value:{designable:!1}},"x-component":"Grid",properties:{row:{type:"void","x-component":"Grid.Row",properties:{page:{type:"void","x-component":"Grid.Col",properties:{page:{type:"number",title:'{{t("Page number")}}',"x-decorator":"FormItem","x-component":"WorkflowVariableInput","x-component-props":{useTypedConstant:["number","null"]},default:1}}},pageSize:{type:"void","x-component":"Grid.Col",properties:{pageSize:{type:"number",title:'{{t("Page size")}}',"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{min:1},default:20}}}}}}},j={type:"array",title:'{{t("Preload associations", { ns: "'.concat(p.A7,'" })}}'),description:'{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"AppendsTreeSelect","x-component-props":{title:"Preload associations",multiple:!0,useCollection:function(){var e=(0,l.useForm)().values;return null==e?void 0:e.collection}},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},S=n("6805"),k=n("6279"),C=n("6128"),E=n("2721");function A(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function P(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){A(i,r,o,a,l,"next",e)}function l(e){A(i,r,o,a,l,"throw",e)}a(void 0)})}}function I(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function T(){var e=(0,u.useAPIClient)(),t=(0,l.useForm)(),n=(0,u.useBlockRequestContext)(),r=n.field,o=n.__parent,i=(0,u.useActionContext)().setVisible,a=(0,C.useNavigate)(),c=(0,l.useFieldSchema)(),f=(0,l.useField)(),d=(0,u.useCompile)(),p=E.App.useApp().modal,m=(0,u.useCollectValuesToSubmit)(),y=f.componentProps.filterKeys||[];return{onClick:function(){return P(function(){var n,l,u,b,v,h,g,O,w,x;return I(this,function(x){switch(x.label){case 0:if(u=(l=null!==(n=null==c?void 0:c["x-action-settings"])&&void 0!==n?n:{}).onSuccess,b=l.skipValidator,v=l.triggerWorkflows,b)return[3,2];return[4,t.submit()];case 1:x.sent(),x.label=2;case 2:return[4,m()];case 3:h=x.sent(),f.data=r.data||{},f.data.loading=!0,x.label=4;case 4:return x.trys.push([4,6,,7]),[4,e.resource("workflows").trigger({values:h,filterKeys:y,triggerWorkflows:(null==v?void 0:v.length)?v.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 5:if(w=x.sent(),f.data.loading=!1,f.data.data=w,null==o||null===(O=o.service)||void 0===O||null===(g=O.refresh)||void 0===g||g.call(O),null==i||i(!1),!(null==u?void 0:u.successMessage))return[2];return(null==u?void 0:u.manualClose)?p.success({title:d(null==u?void 0:u.successMessage),onOk:P(function(){return I(this,function(e){switch(e.label){case 0:return[4,t.reset()];case 1:return e.sent(),(null==u?void 0:u.redirecting)&&(null==u?void 0:u.redirectTo)&&((0,s.isURL)(u.redirectTo)?window.location.href=u.redirectTo:a(u.redirectTo)),[2]}})})}):E.message.success(d(null==u?void 0:u.successMessage)),[3,7];case 6:return x.sent(),f.data.loading=!1,[3,7];case 7:return[2]}})})()}}}function F(){var e,t=(0,u.useCompile)(),n=(0,u.useAPIClient)(),r=(0,u.useRecord)(),o=(0,l.useField)(),i=(0,l.useFieldSchema)(),a=(0,u.useBlockRequestContext)(),c=a.field;a.__parent;var f=(0,u.useActionContext)(),d=f.setVisible,p=f.setSubmitted,m=E.App.useApp().modal,y=(0,C.useNavigate)(),b=null!==(e=null==i?void 0:i["x-action-settings"])&&void 0!==e?e:{},v=b.onSuccess,h=b.triggerWorkflows;return{onClick:function(e,i){return P(function(){return I(this,function(e){switch(e.label){case 0:o.data=c.data||{},o.data.loading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,n.resource("workflows").trigger({values:r,triggerWorkflows:(null==h?void 0:h.length)?h.map(function(e){return[e.workflowKey,e.context].filter(Boolean).join("!")}).join(","):void 0})];case 2:if(e.sent(),i&&i(),null==d||d(!1),null==p||p(!0),!(null==v?void 0:v.successMessage))return[2];return(null==v?void 0:v.manualClose)?m.success({title:t(null==v?void 0:v.successMessage),onOk:function(){return P(function(){return I(this,function(e){return(null==v?void 0:v.redirecting)&&(null==v?void 0:v.redirectTo)&&((0,s.isURL)(v.redirectTo)?window.location.href=v.redirectTo:y(v.redirectTo)),[2]})})()}}):E.message.success(t(null==v?void 0:v.successMessage)),[3,5];case 3:return console.error(e.sent()),[3,5];case 4:return o.data.loading=!1,[7];case 5:return[2]}})})()}}}var D=n("8018");function N(){var e=(0,D.G)().workflow;return!!(null==e?void 0:e.executed)}function M(){var e=(0,D.G)().workflow;return!!(null==e?void 0:e.allExecuted)}var R=n("336"),_=n("6922");function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){W(e,t,n[t])})}return e}function G(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function q(e,t){return(q=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||U(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function U(e,t){if(e){if("string"==typeof e)return B(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return B(e,t)}}function K(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(K=function(){return!!e})()}var H=1,Q=2,J=3,Y=4,Z=[{label:'{{t("After record added", { ns: "'.concat(p.A7,'" })}}'),value:H},{label:'{{t("After record updated", { ns: "'.concat(p.A7,'" })}}'),value:Q},{label:'{{t("After record added or updated", { ns: "'.concat(p.A7,'" })}}'),value:J},{label:'{{t("After record deleted", { ns: "'.concat(p.A7,'" })}}'),value:Y}];function X(e,t){var n,r,o,i=(n=(0,u.parseCollectionName)(e.collection),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(n,2)||U(n,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=i[0],l=i[1],c=(0,u.useCompile)(),s=(0,S.G$)(a),f=[{collectionName:l,name:"data",type:"hasOne",target:l,uiSchema:{title:(0,p.KQ)("Trigger data")}}];return(0,S._5)(G($({appends:["data"].concat(L((null===(o=e.appends)||void 0===o?void 0:o.map(function(e){return"data.".concat(e)}))||[]))},t),{fields:f,compile:c,getCollectionFields:s}))}var ee=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=z(n),W(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,K()?Reflect.construct(n,r||[],z(t).constructor):n.apply(t,r)),"title",'{{t("Collection event", { ns: "'.concat(p.A7,'" })}}')),W(e,"description",'{{t(\'Triggered when data changes in the collection, such as after adding, updating, or deleting a record. Unlike "Post-action event", Collection event listens for data changes rather than HTTP requests. Unless you understand the exact meaning, it is recommended to use "Post-action event".\', { ns: "'.concat(p.A7,'" })}}')),W(e,"fieldset",{collection:G($({},h),W({"x-disabled":"{{ useWorkflowAnyExecuted() }}","x-component-props":{dataSourceFilter:function(e){return"main"===e.options.key||e.options.isDBInstance}}},"x-reactions",L(h["x-reactions"]).concat([{target:"changed",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}},{target:"condition",effects:["onFieldValueChange"],fulfill:{state:{value:null}}},{target:"appends",effects:["onFieldValueChange"],fulfill:{state:{value:[]}}}]))),mode:{type:"number",title:'{{t("Trigger on", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"Select","x-component-props":{popupMatchSelectWidth:!1,placeholder:'{{t("Trigger on", { ns: "'.concat(p.A7,'" })}}'),className:"auto-width"},enum:Z,required:!0,"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{!!$deps[0]}}"}}}]},changed:{type:"array",title:'{{t("Changed fields", { ns: "'.concat(p.A7,'" })}}'),description:'{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"FieldsSelect","x-component-props":{mode:"multiple",placeholder:'{{t("Select field")}}',filter:function(e){return!e.hidden&&(!e.uiSchema||!e.uiSchema["x-read-pretty"])&&!["linkTo","hasOne","hasMany","belongsToMany"].includes(e.type)}},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:"{{!!$deps[0] && ($deps[1] & ".concat(Q,")}}")}}}]},condition:G($({},O),{title:'{{t("Only triggers when match conditions", { ns: "'.concat(p.A7,'" })}}'),"x-component-props":{},"x-reactions":[{dependencies:["collection","mode"],fulfill:{state:{visible:"{{!!$deps[0] && !($deps[1] & ".concat(Y,")}}")}}}]}),appends:G($({},j),{"x-reactions":L(j["x-reactions"]).concat([{dependencies:["mode"],fulfill:{state:{visible:"{{!($deps[0] & ".concat(Y,")}}")}}}])})}),W(e,"scope",{useCollectionDataSource:u.useCollectionDataSource,useWorkflowAnyExecuted:M}),W(e,"components",{FieldsSelect:d.x,TriggerCollectionRecordSelect:_.P}),W(e,"triggerFieldset",{data:{type:"object",title:'{{t("Trigger data", { ns: "'.concat(p.A7,'" })}}'),description:'{{t("Choose a record of the collection to trigger.", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0}}),W(e,"useVariables",X),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&q(e,t)}(o,e),t=o,n=[{key:"validate",value:function(e){return e.collection&&e.mode}},{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",key:"triggerData",title:'{{t("Trigger data", { ns: "'.concat(p.A7,'" })}}'),Component:f.P,collection:e.collection,dataPath:"$context.data"}:null}}],V(t.prototype,n),o}(R.xz),et=n("8563"),en=0,er=1,eo=n("5760"),ei=n.n(eo),ea=n("3238");function el(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ec(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}function eu(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function es(){var e,t,n=(e=["\n display: flex;\n gap: 0.5em;\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return es=function(){return n},n}function ef(e){return!e.hidden&&!!e.uiSchema&&["date","datetimeTz","datetimeNoTz"].includes(e.type)}function ed(e){var t,n,r=e.value,o=e.onChange,l=null!=r?r:{},c=(0,ea.useTranslation)().t;var s=(t=(0,i.useState)(l.offset?l.offset/Math.abs(l.offset):0),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(t,2)||function(e,t){if(e){if("string"==typeof e)return el(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return el(e,t)}}(t,n)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f=s[0],m=s[1];return a().createElement("fieldset",{className:(0,u.css)(es())},a().createElement(d.x,{value:l.field,onChange:function(e){return o(eu(ec({},l),{field:e}))},filter:ef,placeholder:c("Select field"),className:"auto-width"}),l.field?a().createElement(E.Select,{value:f,onChange:function(e){m(e),o(eu(ec({},l),{offset:Math.abs(l.offset)*e}))},options:[{value:0,label:(0,p.KQ)("Exactly at")},{value:-1,label:c("Before")},{value:1,label:c("After")}],className:"auto-width"}):null,f?a().createElement(a().Fragment,null,a().createElement(E.InputNumber,{value:Math.abs(l.offset),onChange:function(e){return o(eu(ec({},l),{offset:(null!=e?e:0)*f}))}}),a().createElement(E.Select,{value:l.unit||864e5,onChange:function(e){return o(eu(ec({},l),{unit:e}))},options:[{value:864e5,label:(0,p.KQ)("Days")},{value:36e5,label:(0,p.KQ)("Hours")},{value:6e4,label:(0,p.KQ)("Minutes")},{value:1e3,label:(0,p.KQ)("Seconds")}],className:"auto-width"})):null)}function ep(){var e,t,n=(e=["\n display: flex;\n gap: 0.5em;\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return ep=function(){return n},n}function em(e){var t,n,r,o=e.value,i=e.onChange,l=(0,p.cC)().t;var c=null!=o?(void 0===o?"undefined":(t=o)&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)!="object"||(n=o,null!=(r=Date)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](n):n instanceof r)?"date":"field":null;return a().createElement("fieldset",{className:(0,u.css)(ep())},a().createElement(E.Select,{value:c,onChange:function(e){i(e?"field"===e?{}:new Date:null)},className:"auto-width"},a().createElement(E.Select.Option,{value:null},l("No end")),a().createElement(E.Select.Option,{value:"field"},l("By field")),a().createElement(E.Select.Option,{value:"date"},l("By custom date"))),"field"===c?a().createElement(ed,{value:o,onChange:i}):null,"date"===c?a().createElement(E.DatePicker,{showTime:!0,value:ei()(o),onChange:function(e){i(e?e.toDate():null)}}):null)}var ey=n("3704"),eb=function(){return(eb=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function ev(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)0>t.indexOf(r[o])&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function eh(e,t,n){if(n||2==arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}var eg=[{name:"@yearly",value:"0 0 1 1 *"},{name:"@annually",value:"0 0 1 1 *"},{name:"@monthly",value:"0 0 1 * *"},{name:"@weekly",value:"0 0 * * 0"},{name:"@daily",value:"0 0 * * *"},{name:"@midnight",value:"0 0 * * *"},{name:"@hourly",value:"0 * * * *"}],eO=[{type:"minutes",min:0,max:59,total:60},{type:"hours",min:0,max:23,total:24},{type:"month-days",min:1,max:31,total:31},{type:"months",min:1,max:12,total:12,alt:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]},{type:"week-days",min:0,max:6,total:7,alt:["SUN","MON","TUE","WED","THU","FRI","SAT"]}],ew={everyText:"every",emptyMonths:"every month",emptyMonthDays:"every day of the month",emptyMonthDaysShort:"day of the month",emptyWeekDays:"every day of the week",emptyWeekDaysShort:"day of the week",emptyHours:"every hour",emptyMinutes:"every minute",emptyMinutesForHourPeriod:"every",yearOption:"year",monthOption:"month",weekOption:"week",dayOption:"day",hourOption:"hour",minuteOption:"minute",rebootOption:"reboot",prefixPeriod:"Every",prefixMonths:"in",prefixMonthDays:"on",prefixWeekDays:"on",prefixWeekDaysForMonthAndYearPeriod:"and",prefixHours:"at",prefixMinutes:":",prefixMinutesForHourPeriod:"at",suffixMinutesForHourPeriod:"minute(s)",errorInvalidCron:"Invalid cron expression",clearButtonText:"Clear",weekDays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],altWeekDays:["SUN","MON","TUE","WED","THU","FRI","SAT"],altMonths:["JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]};function ex(e,t){for(var n=[],r=e;r<=t;r++)n.push(r);return n}function ej(e){return e.sort(function(e,t){return e-t}),e}function eS(e){var t=[];return e.forEach(function(e){0>t.indexOf(e)&&t.push(e)}),t}function ek(e){return Object.entries(e).filter(function(e){var t=e[0],n=e[1];return t&&n}).map(function(e){return e[0]}).join(" ")}function eC(e,t){e&&e({type:"invalid_cron",description:t.errorInvalidCron||ew.errorInvalidCron})}function eE(e){var t=parseInt(e,10),n=Number(e);return t===n?n:NaN}function eA(e,t,n,r,o,i,a,l,c,u,s,f,d,p){n&&n(void 0),t(!1);var m=!1;if(!e){if("always"===r||i&&"for-default-value"===r)return;m=!0}if(!m){if(l&&(!0===l||l.includes(e))){if("@reboot"===e)return void p("reboot");var y=eg.find(function(t){return t.name===e});y&&(e=y.value)}try{var b,v=function(e){if("string"!=typeof e)throw Error("Invalid cron string");var t=e.replace(/\s+/g," ").trim().split(" ");if(5===t.length)return t.map(function(e,t){return function(e,t){if("*"===e||"*/1"===e)return[];var n=ej(eS(eD((function(e,t,n){if(n){e=e.toUpperCase();for(var r=0;r<n.length;r++)e=e.replace(n[r],"".concat(r+t))}return e})(e,t.min,t.alt).split(",").map(function(n){var r,o=n.split("/");if(o.length>2)throw Error('Invalid value "'.concat(e,' for "').concat(t.type,'"'));var i=o[0],a=o[1];r="*"===i?ex(t.min,t.max):function(e,t,n){var r=e.split("-");if(1===r.length){var o=eE(r[0]);if(isNaN(o))throw Error('Invalid value "'.concat(t,'" for ').concat(n.type));return[o]}if(2===r.length){var i=eE(r[0]),a=eE(r[1]);if(isNaN(i)||isNaN(a))throw Error('Invalid value "'.concat(t,'" for ').concat(n.type));if(a<i)throw Error('Max range is less than min range in "'.concat(e,'" for ').concat(n.type));return ex(i,a)}throw Error('Invalid value "'.concat(e,'" for ').concat(n.type))}(i,e,t);var l=function(e,t){if(void 0!==e){var n=eE(e);if(isNaN(n)||n<1)throw Error('Invalid interval step value "'.concat(e,'" for ').concat(t.type));return n}}(a,t);return function(e,t){if(t){var n=e[0];e=e.filter(function(e){return e%t==n%t||e===n})}return e}(r,l)}).flat(),t))),r=eN(n,t);if(void 0!==r)throw Error('Value "'.concat(r,'" out of range for ').concat(t.type));return n.length===t.total?[]:n}(e,eO[t])});throw Error("Invalid cron string format")}(e),h=(b=v)[3].length>0?"year":b[2].length>0?"month":b[4].length>0?"week":b[1].length>0?"day":b[0].length>0?"hour":"minute";p(h),c(v[0]),u(v[1]),s(v[2]),f(v[3]),d(v[4])}catch(e){m=!0}}m&&(o.current=e,t(!0),eC(n,a))}function eP(e,t,n,r,o,i,a){var l,c;if("reboot"===e)return"@reboot";return(l=["minute"!==e&&i?i:[],"minute"!==e&&"hour"!==e&&o?o:[],("year"===e||"month"===e)&&n?n:[],"year"===e&&t?t:[],("year"===e||"month"===e||"week"===e)&&r?r:[]],c=a,l.map(function(e,t){var n=eO[t];return eI(eF(e,n),n,c)})).join(" ")}function eI(e,t,n,r,o){var i="";if(a=e,l=t,a.length===l.max-l.min+1||0===e.length)i="*";else{var a,l,c,u,s,f,d,p,m,y,b=function(e){if(e.length>2){var t=e[1]-e[0];if(t>1)return t}}(e);i=b&&function(e,t){for(var n=1;n<e.length;n++){var r=e[n-1];if(e[n]-r!==t)return!1}return!0}(e,b)?(c=e,u=t,s=b,f=function(e){return e[0]}(c),d=eR(c),p=c.length===(d-f)/s+1,f===u.min&&d+s>u.max&&p)?"*/".concat(b):"".concat(eT(function(e){return e[0]}(e),t,n,r,o),"-").concat(eT(eR(e),t,n,r,o),"/").concat(b):(m=[],y=null,e.forEach(function(e,t,n){e!==n[t+1]-1?null!==y?(m.push([y,e]),y=null):m.push(e):null===y&&(y=e)}),m).map(function(e){return Array.isArray(e)?"".concat(eT(e[0],t,n,r,o),"-").concat(eT(e[1],t,n,r,o)):eT(e,t,n,r,o)}).join(",")}return i}function eT(e,t,n,r,o){var i=e.toString(),a=t.type,l=t.alt,c=t.min,u=r&&(!0===r||r.includes(a)),s="24-hour-clock"===o&&("hours"===a||"minutes"===a);if(n&&"week-days"===a||n&&"months"===a?i=l[e-c]:e<10&&(u||s)&&(i=i.padStart(2,"0")),"hours"===a&&"12-hour-clock"===o){var f=e>=12?"PM":"AM",d=e%12||12;d<10&&u&&(d=d.toString().padStart(2,"0")),i="".concat(d).concat(f)}return i}function eF(e,t){var n=ej(eS(eD(e,t)));if(0===n.length)return n;var r=eN(n,t);if(void 0!==r)throw Error('Value "'.concat(r,'" out of range for ').concat(t.type));return n}function eD(e,t){return"week-days"===t.type&&(e=e.map(function(e){return 7===e?0:e})),e}function eN(e,t){var n=e[0],r=e[e.length-1];return n<t.min?n:r>t.max?r:void 0}function eM(e){return e[0]}function eR(e){return e[e.length-1]}function e_(e){var t=e.value,n=e.grid,r=void 0===n||n,o=e.optionsList,a=e.setValue,l=e.locale,c=e.className,u=e.humanizeLabels,s=e.disabled,f=e.readOnly,d=e.leadingZero,p=e.clockFormat,m=e.period,y=e.unit,b=e.periodicityOnDoubleClick,v=e.mode,h=ev(e,["value","grid","optionsList","setValue","locale","className","humanizeLabels","disabled","readOnly","leadingZero","clockFormat","period","unit","periodicityOnDoubleClick","mode"]),g=(0,i.useMemo)(function(){if(t&&Array.isArray(t))return t.map(function(e){return e.toString()})},[t]),O=(0,i.useMemo)(function(){return o?o.map(function(e,t){return{value:(0===y.min?t:t+1).toString(),label:e}}):eh([],Array(y.total),!0).map(function(e,t){var n=0===y.min?t:t+1;return{value:n.toString(),label:eT(n,y,u,d,p)}})},[o,d,u,p]),w=JSON.stringify(l),x=(0,i.useCallback)(function(e){var n=e.value;if(!t||t[0]!==Number(n))return(0,ey.jsx)(ey.Fragment,{});var r=eI(eF(t,y),y,u,d,p),o=r.match(/^\*\/([0-9]+),?/)||[];return(0,ey.jsx)("div",{children:o[1]?"".concat(l.everyText||ew.everyText," ").concat(o[1]):r})},[t,w,u,d,p]),j=(0,i.useCallback)(function(e){var n=Array.isArray(e)?ej(e):[e],r=n;t&&(r="single"===v?[]:eh([],t,!0),n.forEach(function(e){var n=Number(e);r=t.some(function(e){return e===n})?r.filter(function(e){return e!==n}):ej(eh(eh([],r,!0),[n],!1))})),r.length===y.total?a([]):a(r)},[a,t]),S=(0,i.useCallback)(function(e){if(0!==e&&1!==e){for(var n=y.total+y.min,r=[],o=y.min;o<n;o++)o%e==0&&r.push(o);var i=t&&r&&t.length===r.length&&t.every(function(e,t){return e===r[t]});a(r.length===O.length||i?[]:r)}else a([])},[t,O,a]),k=(0,i.useRef)([]),C=(0,i.useCallback)(function(e){if(!f){var t=k.current;t.push({time:(new Date).getTime(),value:Number(e)});var n=window.setTimeout(function(){b&&t.length>1&&t[t.length-1].time-t[t.length-2].time<300?t[t.length-1].value===t[t.length-2].value?S(Number(e)):j([t[t.length-2].value,t[t.length-1].value]):j(Number(e)),k.current=[]},300);return function(){window.clearTimeout(n)}}},[k,j,S,f,b]),A=(0,i.useCallback)(function(){f||a([])},[a,f]),P=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})["".concat(c,"-select")]=!!c,e))},[c]),I=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-select-dropdown":!0})["react-js-cron-select-dropdown-".concat(y.type)]=!0,e["react-js-cron-custom-select-dropdown"]=!0,e["react-js-cron-custom-select-dropdown-".concat(y.type)]=!0,e["react-js-cron-custom-select-dropdown-minutes-large"]="minutes"===y.type&&"hour"!==m&&"day"!==m,e["react-js-cron-custom-select-dropdown-minutes-medium"]="minutes"===y.type&&("day"===m||"hour"===m),e["react-js-cron-custom-select-dropdown-hours-twelve-hour-clock"]="hours"===y.type&&"12-hour-clock"===p,e["react-js-cron-custom-select-dropdown-grid"]=!!r,e["".concat(c,"-select-dropdown")]=!!c,e["".concat(c,"-select-dropdown-").concat(y.type)]=!!c,e))},[c,r,p,m]);return(0,ey.jsx)(E.Select,eb({mode:"single"!==v||b?"multiple":void 0,allowClear:!f,virtual:!1,open:!f&&void 0,value:g,onClear:A,tagRender:x,className:P,popupClassName:I,options:O,showSearch:!1,showArrow:!f,menuItemSelectedIcon:null,dropdownMatchSelectWidth:!1,onSelect:C,onDeselect:C,disabled:s,dropdownAlign:"minutes"!==y.type&&"hours"!==y.type||"day"===m||"hour"===m?void 0:{points:["tr","br"]},"data-testid":"custom-select-".concat(y.type)},h))}function eB(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,a=e.disabled,l=e.readOnly,c=e.leadingZero,u=e.clockFormat,s=e.period,f=e.periodicityOnDoubleClick,d=e.mode,p=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-field":!0,"react-js-cron-hours":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-hours")]=!!o,e))},[o]);return(0,ey.jsxs)("div",eb({className:p},{children:[""!==r.prefixHours&&(0,ey.jsx)("span",{children:r.prefixHours||ew.prefixHours}),(0,ey.jsx)(e_,{placeholder:r.emptyHours||ew.emptyHours,value:t,unit:eO[1],setValue:n,locale:r,className:o,disabled:a,readOnly:l,leadingZero:c,clockFormat:u,period:s,periodicityOnDoubleClick:f,mode:d})]}))}function eV(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,a=e.disabled,l=e.readOnly,c=e.leadingZero,u=e.clockFormat,s=e.period,f=e.periodicityOnDoubleClick,d=e.mode,p=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-field":!0,"react-js-cron-minutes":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-minutes")]=!!o,e))},[o]);return(0,ey.jsxs)("div",eb({className:p},{children:["hour"===s?""!==r.prefixMinutesForHourPeriod&&(0,ey.jsx)("span",{children:r.prefixMinutesForHourPeriod||ew.prefixMinutesForHourPeriod}):""!==r.prefixMinutes&&(0,ey.jsx)("span",{children:r.prefixMinutes||ew.prefixMinutes}),(0,ey.jsx)(e_,{placeholder:"hour"===s?r.emptyMinutesForHourPeriod||ew.emptyMinutesForHourPeriod:r.emptyMinutes||ew.emptyMinutes,value:t,unit:eO[0],setValue:n,locale:r,className:o,disabled:a,readOnly:l,leadingZero:c,clockFormat:u,period:s,periodicityOnDoubleClick:f,mode:d}),"hour"===s&&""!==r.suffixMinutesForHourPeriod&&(0,ey.jsx)("span",{children:r.suffixMinutesForHourPeriod||ew.suffixMinutesForHourPeriod})]}))}function eW(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,a=e.weekDays,l=e.disabled,c=e.readOnly,u=e.leadingZero,s=e.period,f=e.periodicityOnDoubleClick,d=e.mode,p=!a||0===a.length,m=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!p})["".concat(o,"-field")]=!!o,e["".concat(o,"-month-days")]=!!o,e))},[o,p]),y=JSON.stringify(r),b=(0,i.useMemo)(function(){return p?r.emptyMonthDays||ew.emptyMonthDays:r.emptyMonthDaysShort||ew.emptyMonthDaysShort},[p,y]);return c&&(!t||!(t.length>0))&&(t&&0!==t.length||a&&0!==a.length)?null:(0,ey.jsxs)("div",eb({className:m},{children:[""!==r.prefixMonthDays&&(0,ey.jsx)("span",{children:r.prefixMonthDays||ew.prefixMonthDays}),(0,ey.jsx)(e_,{placeholder:b,value:t,setValue:n,unit:eO[2],locale:r,className:o,disabled:l,readOnly:c,leadingZero:u,period:s,periodicityOnDoubleClick:f,mode:d})]}))}function ez(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,a=e.humanizeLabels,l=e.disabled,c=e.readOnly,u=e.period,s=e.periodicityOnDoubleClick,f=e.mode,d=r.months||ew.months,p=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-field":!0,"react-js-cron-months":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-months")]=!!o,e))},[o]);return(0,ey.jsxs)("div",eb({className:p},{children:[""!==r.prefixMonths&&(0,ey.jsx)("span",{children:r.prefixMonths||ew.prefixMonths}),(0,ey.jsx)(e_,{placeholder:r.emptyMonths||ew.emptyMonths,optionsList:d,grid:!1,value:t,unit:eb(eb({},eO[3]),{alt:r.altMonths||ew.altMonths}),setValue:n,locale:r,className:o,humanizeLabels:a,disabled:l,readOnly:c,period:u,periodicityOnDoubleClick:s,mode:f})]}))}function e$(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,a=e.disabled,l=e.readOnly,c=e.shortcuts,u=e.allowedPeriods,s=[];u.includes("year")&&s.push({value:"year",label:r.yearOption||ew.yearOption}),u.includes("month")&&s.push({value:"month",label:r.monthOption||ew.monthOption}),u.includes("week")&&s.push({value:"week",label:r.weekOption||ew.weekOption}),u.includes("day")&&s.push({value:"day",label:r.dayOption||ew.dayOption}),u.includes("hour")&&s.push({value:"hour",label:r.hourOption||ew.hourOption}),u.includes("minute")&&s.push({value:"minute",label:r.minuteOption||ew.minuteOption}),u.includes("reboot")&&c&&(!0===c||c.includes("@reboot"))&&s.push({value:"reboot",label:r.rebootOption||ew.rebootOption});var f=(0,i.useCallback)(function(e){l||n(e)},[n,l]),d=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-field":!0,"react-js-cron-period":!0})["".concat(o,"-field")]=!!o,e["".concat(o,"-period")]=!!o,e))},[o]),p=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":""===r.prefixPeriod})["".concat(o,"-select")]=!!o,e))},[o,r.prefixPeriod]),m=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})["".concat(o,"-select-dropdown")]=!!o,e["".concat(o,"-select-dropdown-period")]=!!o,e))},[o]);return(0,ey.jsxs)("div",eb({className:d},{children:[""!==r.prefixPeriod&&(0,ey.jsx)("span",{children:r.prefixPeriod||ew.prefixPeriod}),(0,ey.jsx)(E.Select,{defaultValue:t,value:t,onChange:f,options:s,className:p,popupClassName:m,disabled:a,showArrow:!l,open:!l&&void 0,"data-testid":"select-period"},JSON.stringify(r))]}))}function eG(e){var t=e.value,n=e.setValue,r=e.locale,o=e.className,a=e.humanizeLabels,l=e.monthDays,c=e.disabled,u=e.readOnly,s=e.period,f=e.periodicityOnDoubleClick,d=e.mode,p=r.weekDays||ew.weekDays,m="week"===s||!l||0===l.length,y=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!m})["".concat(o,"-field")]=!!o,e["".concat(o,"-week-days")]=!!o,e))},[o,m]),b=JSON.stringify(r),v=(0,i.useMemo)(function(){return m?r.emptyWeekDays||ew.emptyWeekDays:r.emptyWeekDaysShort||ew.emptyWeekDaysShort},[m,b]),h="week"===s||!u||t&&t.length>0||(!t||0===t.length)&&(!l||0===l.length),g=!u||l&&l.length>0||(!l||0===l.length)&&(!t||0===t.length);return h?(0,ey.jsxs)("div",eb({className:y},{children:[""!==r.prefixWeekDays&&("week"===s||!g)&&(0,ey.jsx)("span",{children:r.prefixWeekDays||ew.prefixWeekDays}),""!==r.prefixWeekDaysForMonthAndYearPeriod&&"week"!==s&&g&&(0,ey.jsx)("span",{children:r.prefixWeekDaysForMonthAndYearPeriod||ew.prefixWeekDaysForMonthAndYearPeriod}),(0,ey.jsx)(e_,{placeholder:v,optionsList:p,grid:!1,value:t,unit:eb(eb({},eO[4]),{alt:r.altWeekDays||ew.altWeekDays}),setValue:n,locale:r,className:o,humanizeLabels:a,disabled:c,readOnly:u,period:s,periodicityOnDoubleClick:f,mode:d})]})):null}function eq(e){var t,n,r=e.clearButton,o=void 0===r||r,a=e.clearButtonProps,l=void 0===a?{}:a,c=e.clearButtonAction,u=void 0===c?"fill-with-every":c,s=e.locale,f=void 0===s?ew:s,d=e.value,p=void 0===d?"":d,m=e.setValue,y=e.displayError,b=void 0===y||y,v=e.onError,h=e.className,g=e.defaultPeriod,O=e.allowEmpty,w=void 0===O?"for-default-value":O,x=e.humanizeLabels,j=void 0===x||x,S=e.humanizeValue,k=void 0!==S&&S,C=e.disabled,A=void 0!==C&&C,P=e.readOnly,I=void 0!==P&&P,T=e.leadingZero,F=void 0!==T&&T,D=e.shortcuts,N=void 0===D?["@yearly","@annually","@monthly","@weekly","@daily","@midnight","@hourly"]:D,M=e.clockFormat,R=e.periodicityOnDoubleClick,_=void 0===R||R,B=e.mode,V=void 0===B?"multiple":B,W=e.allowedDropdowns,z=void 0===W?["period","months","month-days","week-days","hours","minutes"]:W,$=e.allowedPeriods,G=(0,i.useRef)(p),q=(0,i.useRef)(void 0===g?"day":g),L=(0,i.useState)(),U=L[0],K=L[1],H=(0,i.useState)(),Q=H[0],J=H[1],Y=(0,i.useState)(),Z=Y[0],X=Y[1],ee=(0,i.useState)(),et=ee[0],en=ee[1],er=(0,i.useState)(),eo=er[0],ei=er[1],ea=(0,i.useState)(),el=ea[0],ec=ea[1],eu=(0,i.useState)(!1),es=eu[0],ef=eu[1],ed=(0,i.useState)(!1),ep=ed[0],em=ed[1],eh=(t=ep,n=(0,i.useRef)(t),(0,i.useEffect)(function(){n.current=t},[t]),n.current),eg=JSON.stringify(f);(0,i.useEffect)(function(){eA(p,ef,v,w,G,!0,f,N,ec,ei,J,X,en,K)},[]),(0,i.useEffect)(function(){p!==G.current&&eA(p,ef,v,w,G,!1,f,N,ec,ei,J,X,en,K)},[p,G,eg,w,N]),(0,i.useEffect)(function(){if(!(U||el||Z||Q||et||eo)||ep||eh)ep&&em(!1);else{var e=U||q.current,t=eP(e,Z,Q,et,eo,el,k);m(t,{selectedPeriod:e}),G.current=t,v&&v(void 0),ef(!1)}},[U,Q,Z,et,eo,el,k,ep]);var eO=(0,i.useCallback)(function(){J(void 0),X(void 0),en(void 0),ei(void 0),ec(void 0);var e="",t="reboot"!==U&&U?U:q.current;t!==U&&K(t),"fill-with-every"===u&&(e=eP(t,void 0,void 0,void 0,void 0,void 0)),m(e,{selectedPeriod:t}),G.current=e,em(!0),"never"===w&&"empty"===u?(ef(!0),eC(v,f)):(v&&v(void 0),ef(!1))},[U,m,v,u]),ex=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron":!0,"react-js-cron-error":es&&b,"react-js-cron-disabled":A,"react-js-cron-read-only":I})["".concat(h)]=!!h,e["".concat(h,"-error")]=es&&b&&!!h,e["".concat(h,"-disabled")]=A&&!!h,e["".concat(h,"-read-only")]=I&&!!h,e))},[h,es,b,A,I]),ej=l.className,eS=ev(l,["className"]),eE=(0,i.useMemo)(function(){var e;return ek(((e={"react-js-cron-clear-button":!0})["".concat(h,"-clear-button")]=!!h,e["".concat(ej)]=!!ej,e))},[h,ej]),eI=JSON.stringify(eS),eT=(0,i.useMemo)(function(){return o&&!I?(0,ey.jsx)(E.Button,eb({className:eE,danger:!0,type:"primary",disabled:A},eS,{onClick:eO},{children:f.clearButtonText||ew.clearButtonText})):null},[o,I,eg,eE,A,eI,eO]),eF=U||q.current;return(0,ey.jsxs)("div",eb({className:ex},{children:[z.includes("period")&&(0,ey.jsx)(e$,{value:eF,setValue:K,locale:f,className:h,disabled:A,readOnly:I,shortcuts:N,allowedPeriods:void 0===$?["year","month","week","day","hour","minute","reboot"]:$}),"reboot"===eF?eT:(0,ey.jsxs)(ey.Fragment,{children:["year"===eF&&z.includes("months")&&(0,ey.jsx)(ez,{value:Z,setValue:X,locale:f,className:h,humanizeLabels:j,disabled:A,readOnly:I,period:eF,periodicityOnDoubleClick:_,mode:V}),("year"===eF||"month"===eF)&&z.includes("month-days")&&(0,ey.jsx)(eW,{value:Q,setValue:J,locale:f,className:h,weekDays:et,disabled:A,readOnly:I,leadingZero:F,period:eF,periodicityOnDoubleClick:_,mode:V}),("year"===eF||"month"===eF||"week"===eF)&&z.includes("week-days")&&(0,ey.jsx)(eG,{value:et,setValue:en,locale:f,className:h,humanizeLabels:j,monthDays:Q,disabled:A,readOnly:I,period:eF,periodicityOnDoubleClick:_,mode:V}),(0,ey.jsxs)("div",{children:["minute"!==eF&&"hour"!==eF&&z.includes("hours")&&(0,ey.jsx)(eB,{value:eo,setValue:ei,locale:f,className:h,disabled:A,readOnly:I,leadingZero:F,clockFormat:M,period:eF,periodicityOnDoubleClick:_,mode:V}),"minute"!==eF&&z.includes("minutes")&&(0,ey.jsx)(eV,{value:el,setValue:ec,locale:f,period:eF,className:h,disabled:A,readOnly:I,leadingZero:F,clockFormat:M,periodicityOnDoubleClick:_,mode:V}),eT]})]})]}))}Object.freeze({__proto__:null,setValuesFromCronString:eA,getCronStringFromValues:eP,partToString:eI,formatValue:eT,parsePartArray:eF});function eL(){var e,t,n=(e=["\n display: flex;\n flex-direction: ",";\n align-items: flex-start;\n gap: 0.5em;\n\n .react-js-cron {\n width: 100%;\n padding: 0.5em 0.5em 0 0.5em;\n border: 1px dashed #ccc;\n\n .react-js-cron-field {\n margin-bottom: 0.5em;\n\n > span {\n margin: 0 0.5em 0 0;\n }\n\n > .react-js-cron-select {\n margin: 0 0.5em 0 0;\n }\n }\n\n .react-js-cron-week-days {\n > span {\n min-width: 2em;\n }\n }\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return eL=function(){return n},n}var eU=[{value:"none",text:"No repeat"},{value:6e4,text:"By minute",unitText:"Minutes"},{value:36e5,text:"By hour",unitText:"Hours"},{value:864e5,text:"By day",unitText:"Days"},{value:6048e5,text:"By week",unitText:"Weeks"},{value:"cron",text:"Advanced"}];function eK(e){return eU.filter(function(e){return"number"==typeof e.value}).reverse().find(function(t){return!(e%t.value)})}function eH(e){var t=e.value,n=e.onChange,r=(0,p.cC)().t,o=eK(t);return a().createElement(E.InputNumber,{value:t/o.value,onChange:function(e){return n(e*o.value)},min:1,addonBefore:r("Every"),addonAfter:r(o.unitText),className:"auto-width"})}function eQ(e){var t=e.value,n=void 0===t?null:t,r=e.onChange,o=(0,p.cC)().t,l=function(e){var t,n;switch(void 0===e?"undefined":(n=e)&&"undefined"!=typeof Symbol&&n.constructor===Symbol?"symbol":typeof n){case"number":return(t=eK(e))?t.value:"none";case"string":return"cron"}return"none"}(n),c=(0,i.useCallback)(function(e){if("none"===e){r(null);return}if("cron"===e){r("0 * * * * *");return}r(e)},[r]);return a().createElement("fieldset",{className:(0,u.css)(eL(),"cron"===l?"column":"row")},a().createElement(E.Select,{value:l,onChange:c,className:"auto-width"},eU.map(function(e){return a().createElement(E.Select.Option,{key:e.value,value:e.value},o(e.text))})),"number"==typeof l?a().createElement(eH,{value:n,onChange:r}):null,"cron"===l?a().createElement(eq,{value:n.trim().split(/\s+/).slice(1).join(" "),setValue:function(e){return r("0 ".concat(e))},clearButton:!1,locale:window.cronLocale}):null)}function eJ(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function eY(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eZ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){eY(e,t,n[t])})}return e}function eX(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}var e0=(eY(o={},en,{fieldset:{startsOn:{type:"datetime",title:'{{t("Starts on", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},required:!0},repeat:{type:"string",title:'{{t("Repeat mode", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"datetime",title:'{{t("Ends on", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0}},limit:{type:"number",title:'{{t("Repeat limit", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:'{{t("No limit", { ns: "'.concat(p.A7,'" })}}'),min:0}}},triggerFieldset:{date:{type:"string",title:"{{t('Execute on', { ns: \"".concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0,placeholder:"{{t('Current time', { ns: \"".concat(p.A7,'" })}}')}}}}),eY(o,er,{fieldset:{collection:eX(eZ({},h),{"x-component-props":{dataSourceFilter:function(e){return"main"===e.options.key||e.options.isDBInstance}},"x-reactions":((function(e){if(Array.isArray(e))return eJ(e)})(r=h["x-reactions"])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(r)||function(e,t){if(e){if("string"==typeof e)return eJ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eJ(e,t)}}(r)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{target:"startsOn",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}])}),startsOn:{type:"object",title:'{{t("Starts on", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"OnField","x-reactions":[{target:"repeat",fulfill:{state:{visible:"{{!!$self.value}}"}}}],required:!0},repeat:{type:"string",title:'{{t("Repeat mode", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"RepeatField","x-reactions":[{target:"endsOn",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"limit",fulfill:{state:{visible:"{{!!$self.value}}"}}}]},endsOn:{type:"object",title:'{{t("Ends on", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"EndsByField"},limit:{type:"number",title:'{{t("Repeat limit", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"InputNumber","x-component-props":{placeholder:'{{t("No limit", { ns: "'.concat(p.A7,'" })}}'),min:0}},appends:eX(eZ({},j),{"x-reactions":[{dependencies:["mode","collection"],fulfill:{state:{visible:"{{$deps[0] === ".concat(er," && $deps[1]}}")}}}]})},triggerFieldset:{data:{type:"object",title:'{{t("Trigger data", { ns: "'.concat(p.A7,'" })}}'),description:'{{t("Choose a record of the collection to trigger.", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"TriggerCollectionRecordSelect",default:null,required:!0}},validate:function(e){return e.collection&&e.startsOn}}),o);function e1(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function e2(){var e,t,n=(e=["\n .ant-input-number {\n width: auto;\n min-width: 6em;\n }\n\n .ant-picker {\n width: auto;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return e2=function(){return n},n}var e7=[{value:en,label:'{{t("Based on certain date", { ns: "'.concat(p.A7,'" })}}')},{value:er,label:'{{t("Based on date field of collection", { ns: "'.concat(p.A7,'" })}}')}],e5=function(){var e,t,n,r,o,c,s=(0,l.useForm)(),f=s.values,d=s.clearFormGraph;var m=(e=(0,i.useState)((void 0===f?{}:f).mode),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,2)||function(e,t){if(e){if("string"==typeof e)return e1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e1(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),y=m[0],b=m[1];return(0,l.useFormEffects)(function(){(0,et.onFieldValueChange)("mode",function(e){b(e.value),d("collection"),d("startsOn"),d("repeat"),d("endsOn"),d("limit")})}),a().createElement(a().Fragment,null,a().createElement(u.SchemaComponent,{schema:{type:"number",title:'{{t("Trigger mode", { ns: "'.concat(p.A7,'" })}}'),name:"mode","x-decorator":"FormItem","x-component":"Radio.Group",enum:e7,required:!0,default:en}}),a().createElement(u.SchemaComponent,{schema:{type:"void",properties:(n={},r="mode-".concat(y),o={type:"void","x-component":"fieldset","x-component-props":{className:(0,u.css)(e2())},properties:null===(c=e0[y])||void 0===c?void 0:c.fieldset},r in n?Object.defineProperty(n,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[r]=o,n)},components:{OnField:ed,RepeatField:eQ,EndsByField:em}}))};function e3(){var e=(0,D.G)().workflow,t=(0,R.cC)();return a().createElement(u.SchemaComponent,{components:t.components,schema:{type:"void",properties:e0[e.config.mode].triggerFieldset}})}function e8(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function e6(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function e4(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function e9(e){return(e9=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function te(e,t){return(te=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||tn(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tn(e,t){if(e){if("string"==typeof e)return e8(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e8(e,t)}}function tr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tr=function(){return!!e})()}function to(e,t){var n=tt((0,u.parseCollectionName)(e.collection),2),r=n[0];n[1];var o=(0,u.useCompile)(),i=(0,S.G$)(r),a=[];if((!(null==t?void 0:t.types)||t.types.includes("date"))&&a.push({key:"date",value:"date",label:(0,p.KQ)("Trigger time")}),e.mode===er){var l,c,s,f,d=tt((0,S._5)((c=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){e4(e,t,n[t])})}return e}({appends:["data"].concat(function(e){if(Array.isArray(e))return e8(e)}(l=(null===(f=e.appends)||void 0===f?void 0:f.map(function(e){return"data.".concat(e)}))||[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(l)||tn(l)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())},t),s=(s={fields:[{collectionName:e.collection,name:"data",type:"hasOne",target:e.collection,uiSchema:{title:(0,p.KQ)("Trigger data")}}],compile:o,getCollectionFields:i},s),Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(s)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(s)).forEach(function(e){Object.defineProperty(c,e,Object.getOwnPropertyDescriptor(s,e))}),c)),1)[0];d&&a.push(d)}return a}var ti=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=e9(n),e4(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,tr()?Reflect.construct(n,r||[],e9(t).constructor):n.apply(t,r)),"sync",!1),e4(e,"title",'{{t("Schedule event", { ns: "'.concat(p.A7,'" })}}')),e4(e,"description",'{{t("Triggered according to preset time conditions. Suitable for one-time or periodic tasks, such as sending notifications and cleaning data on a schedule.", { ns: "'.concat(p.A7,'" })}}')),e4(e,"fieldset",{config:{type:"void","x-component":"ScheduleConfig","x-component-props":{}}}),e4(e,"triggerFieldset",{proxy:{type:"void","x-component":"TriggerScheduleConfig"}}),e4(e,"scope",{useCollectionDataSource:u.useCollectionDataSource}),e4(e,"components",{ScheduleConfig:e5,TriggerScheduleConfig:e3,TriggerCollectionRecordSelect:_.P}),e4(e,"useVariables",to),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&te(e,t)}(o,e),t=o,n=[{key:"validate",value:function(e){if(null==e.mode)return!1;var t=e0[e.mode].validate;return!t||t(e)}},{key:"useInitializers",value:function(e){return e.collection?{name:"triggerData",type:"item",title:'{{t("Trigger data", { ns: "'.concat(p.A7,'" })}}'),Component:f.P,collection:e.collection,dataPath:"$context.data"}:null}}],e6(t.prototype,n),o}(R.xz),ta=n("3461"),tl=n("47"),tc=n("799"),tu=n("8060"),ts=n("3048");function tf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function td(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tp(e){return(tp=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tm(e,t){return(tm=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ty(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ty=function(){return!!e})()}var tb=function(e){var t,n,r;function o(){var e,t,n,r,i;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),n=this,r=o,i=arguments,r=tp(r),td(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,ty()?Reflect.construct(r,i||[],tp(n).constructor):r.apply(n,i)),"title",'{{t("Calculation", { ns: "'.concat(p.A7,'" })}}')),td(e,"type","calculation"),td(e,"group","calculation"),td(e,"description",'{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "'.concat(p.A7,'" })}}')),td(e,"fieldset",{engine:{type:"string",title:'{{t("Calculation engine", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:(0,tl.getOptions)()},required:!0,default:"formula.js"},expression:(td(t={type:"string",title:'{{t("Calculation expression", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0}},"x-validator",function(e,t,n){var r=n.form.values,o=tl.evaluators.get(r.engine).evaluate,i=e.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return o(i),""}catch(e){return(0,p.KQ)("Expression syntax error")}}),td(t,"x-reactions",[{dependencies:["engine"],fulfill:{schema:{description:"{{renderEngineReference($deps[0])}}"}}}]),td(t,"required",!0),t)}),td(e,"scope",{renderEngineReference:ts.$}),td(e,"components",{WorkflowVariableTextArea:S.r$,RadioWithTooltip:tc.W,ValueBlock:tu.X}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tm(e,t)}(o,e),t=o,n=[{key:"useVariables",value:function(e,t){var n=e.key,r=e.title,o=t.types,i=t.fieldNames;return(void 0===i&&S.Ox,o&&!o.some(function(e){return e in S.VW||Object.values(S.VW).some(function(t){return t.has(e)})}))?null:{value:n,label:r}}},{key:"useInitializers",value:function(e){var t,n;return{name:null!==(t=e.title)&&void 0!==t?t:"#".concat(e.id),type:"item",title:null!==(n=e.title)&&void 0!==n?n:"#".concat(e.id),Component:tu.X.Initializer,node:e,resultTitle:(0,p.KQ)("Calculation result")}}}],tf(t.prototype,n),o}(ta.vr),tv=n("2708"),th=n("8378"),tg=n("3430");function tO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tx(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tj(e){return(tj=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tS(e,t){return(tS=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tk(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||tC(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tC(e,t){if(e){if("string"==typeof e)return tO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tO(e,t)}}function tE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tE=function(){return!!e})()}var tA={ON_TRUE:1,ON_FALSE:0},tP=function(e){var t,n,r;function o(){var e,t,n,r,i,a;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),n=this,r=o,i=arguments,r=tj(r),tx(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,tE()?Reflect.construct(r,i||[],tj(n).constructor):r.apply(n,i)),"title",'{{t("Condition", { ns: "'.concat(p.A7,'" })}}')),tx(e,"type","condition"),tx(e,"group","control"),tx(e,"description",'{{t(\'Based on boolean result of the calculation to determine whether to "continue" or "exit" the process, or continue on different branches of "yes" and "no".\', { ns: "'.concat(p.A7,'" })}}')),tx(e,"fieldset",{rejectOnFalse:{type:"boolean",title:'{{t("Mode", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group","x-component-props":{disabled:!0},enum:[{value:!0,label:'{{t(\'Continue when "Yes"\', { ns: "'.concat(p.A7,'" })}}')},{value:!1,label:'{{t(\'Branch into "Yes" and "No"\', { ns: "'.concat(p.A7,'" })}}')}]},engine:{type:"string",title:'{{t("Calculation engine", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[["basic",{label:'{{t("Basic", { ns: "'.concat(p.A7,'" })}}')}]].concat(function(e){if(Array.isArray(e))return tO(e)}(a=Array.from(tl.evaluators.getEntities()).filter(function(e){return["math.js","formula.js"].includes(tk(e,1)[0])}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(a)||tC(a)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).reduce(function(e,t){var n=tk(t,2),r=n[0],o=n[1];return e.concat(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){tx(e,t,n[t])})}return e}({value:r},o))},[])},required:!0,default:"basic"},calculation:{type:"object",title:'{{t("Condition", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"CalculationConfig","x-reactions":{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] === "basic"}}'}}},required:!0},expression:(tx(t={type:"string",title:'{{t("Condition expression", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"WorkflowVariableTextArea","x-component-props":{changeOnSelect:!0}},"x-validator",function(e,t,n){var r=n.form.values,o=tl.evaluators.get(r.engine).evaluate,i=e.trim().replace(/{{([^{}]+)}}/g,' "1" ');try{return o(i),""}catch(e){return(0,p.KQ)("Expression syntax error")}}),tx(t,"x-reactions",{dependencies:["engine"],fulfill:{state:{visible:'{{$deps[0] !== "basic"}}'},schema:{description:"{{renderEngineReference($deps[0])}}"}}}),tx(t,"required",!0),t)}),tx(e,"presetFieldset",{rejectOnFalse:{type:"boolean",title:'{{t("Mode", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t(\'Continue when "Yes"\', { ns: "'.concat(p.A7,'" })}}'),value:!0},{label:'{{t(\'Branch into "Yes" and "No"\', { ns: "'.concat(p.A7,'" })}}'),value:!1}],default:!0}}),tx(e,"branching",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.rejectOnFalse;return!(void 0===t||t)&&[{label:"{{t('After end of branches', { ns: \"".concat(p.A7,'" })}}'),value:!1},{label:'{{t(\'Inside of "Yes" branch\', { ns: "'.concat(p.A7,'" })}}'),value:tA.ON_TRUE},{label:'{{t(\'Inside of "No" branch\', { ns: "'.concat(p.A7,'" })}}'),value:tA.ON_FALSE}]}),tx(e,"scope",{renderEngineReference:ts.$,useWorkflowVariableOptions:S.rX}),tx(e,"components",{CalculationConfig:tg.G,WorkflowVariableTextArea:S.r$,RadioWithTooltip:tc.W}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tS(e,t)}(o,e),t=o,n=[{key:"Component",value:function(e){var t=e.data,n=(0,ea.useTranslation)().t,r=(0,D.G)().nodes,o=(0,th.Z)().styles,i=t.id,l=t.config.rejectOnFalse,c=r.find(function(e){return e.upstreamId===i&&1===e.branchIndex}),u=r.find(function(e){return e.upstreamId===i&&0===e.branchIndex});return a().createElement(ta.v9,{data:t},l?null:a().createElement("div",{className:o.nodeSubtreeClass},a().createElement("div",{className:o.branchBlockClass},a().createElement(tv.I,{from:t,entry:u,branchIndex:0}),a().createElement(tv.I,{from:t,entry:c,branchIndex:1})),a().createElement("div",{className:o.conditionClass},a().createElement("span",{style:{right:"4em"}},n("No")),a().createElement("span",{style:{left:"4em"}},n("Yes")))))}}],tw(t.prototype,n),o}(ta.vr),tI=n("9144");function tT(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tF(e){return(tF=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tD(e,t){return(tD=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tN(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tN=function(){return!!e})()}var tM=function(e){function t(){var e,n,r,o;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),n=this,r=t,o=arguments,r=tF(r),tT(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,tN()?Reflect.construct(r,o||[],tF(n).constructor):r.apply(n,o)),"title",'{{t("End process", { ns: "'.concat(p.A7,'" })}}')),tT(e,"type","end"),tT(e,"group","control"),tT(e,"description",'{{t("End the process immediately, with set status.", { ns: "'.concat(p.A7,'" })}}')),tT(e,"fieldset",{endStatus:{type:"number",title:'{{t("End status", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"Radio.Group",enum:[{label:'{{t("Succeeded", { ns: "'.concat(p.A7,'" })}}'),value:tI.jf.RESOLVED},{label:'{{t("Failed", { ns: "'.concat(p.A7,'" })}}'),value:tI.jf.FAILED}],required:!0,default:tI.jf.RESOLVED}}),tT(e,"end",!0),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tD(e,t)}(t,e),t}(ta.vr),tR=n("4632"),t_=n("4339"),tB=n("7380");function tV(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tW(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function tz(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t$(e){return(t$=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function tG(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){tz(e,t,n[t])})}return e}function tq(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function tL(e,t){return(tL=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function tU(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||tH(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tK(e){return function(e){if(Array.isArray(e))return tV(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||tH(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function tH(e,t){if(e){if("string"==typeof e)return tV(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tV(e,t)}}function tQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(tQ=function(){return!!e})()}function tJ(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=tU((0,u.parseCollectionName)(a.collection),2),c=l[0],s=l[1],f=(0,u.useCompile)(),d=(0,S.G$)(c);return tU((0,S._5)(tq(tG({appends:[o].concat(tK((null===(r=a.params)||void 0===r?void 0:null===(n=r.appends)||void 0===n?void 0:n.map(function(e){return"".concat(o,".").concat(e)}))||[]))},t),{fields:[{collectionName:s,name:o,type:"hasOne",target:s,uiSchema:{title:i}}],compile:f,getCollectionFields:d})),1)[0]}var tY=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=t$(n),tz(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,tQ()?Reflect.construct(n,r||[],t$(t).constructor):n.apply(t,r)),"title",'{{t("Query record", { ns: "'.concat(p.A7,'" })}}')),tz(e,"type","query"),tz(e,"group","collection"),tz(e,"description",'{{t("Query records from a collection. You can use variables from upstream nodes as query conditions.", { ns: "'.concat(p.A7,'" })}}')),tz(e,"fieldset",{collection:tq(tG({},h),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":tK(h["x-reactions"]).concat([{target:"params",effects:["onFieldValueChange"],fulfill:{state:{visible:"{{!!$self.value}}",value:"{{Object.create({})}}"}}}])}),multiple:{type:"boolean",title:'{{t("Result type", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:'{{t("Single record", { ns: "'.concat(p.A7,'" })}}'),value:!1,tooltip:'{{t("The result will be an object of the first matching record only, or null if no matched record.", { ns: "'.concat(p.A7,'" })}}')},{label:'{{t("Multiple records", { ns: "'.concat(p.A7,'" })}}'),value:!0,tooltip:'{{t("The result will be an array containing matched records, or an empty one if no matching records. This can be used to be processed in a loop node.", { ns: "'.concat(p.A7,'" })}}')}]},required:!0,default:!1},params:{type:"object","x-component":"fieldset",properties:{filter:O,sort:w,pagination:x,appends:j},"x-reactions":[{dependencies:["collection"],fulfill:{state:{visible:"{{$deps[0] != null}}"}}}]},failOnEmpty:{type:"boolean","x-decorator":"FormItem","x-component":"Checkbox","x-content":'{{t("Exit when query result is null", { ns: "'.concat(p.A7,'" })}}')}}),tz(e,"scope",{useNodeSavedConfig:ta.WH,useCollectionDataSource:u.useCollectionDataSource,useSortableFields:function(){var e=(0,u.useCompile)(),t=(0,l.useForm)().values,n=tU((0,u.parseCollectionName)(t.collection),2),r=n[0],o=n[1],i=(0,u.useApp)();return i.dataSourceManager.getDataSource(r).collectionManager.getCollectionFields(o).filter(function(e){if(!e.interface)return!1;var t=i.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface);return(null==t?!!void 0:!!t.sortable)||!1}).map(function(t){var n,r;return{value:t.name,label:(null==t?void 0:null===(n=t.uiSchema)||void 0===n?void 0:n.title)?e(null==t?void 0:null===(r=t.uiSchema)||void 0===r?void 0:r.title):t.name}})}}),tz(e,"components",{ArrayItems:tR.ArrayItems,FilterDynamicComponent:t_.V,SchemaComponentContext:u.SchemaComponentContext,WorkflowVariableInput:S.kw,RadioWithTooltip:tB.W5}),tz(e,"useVariables",tJ),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tL(e,t)}(o,e),t=o,n=[{key:"useInitializers",value:function(e){var t,n;return!e.config.collection||e.config.multiple?null:{name:null!==(t=e.title)&&void 0!==t?t:"#".concat(e.id),type:"item",title:null!==(n=e.title)&&void 0!==n?n:"#".concat(e.id),Component:f.P,collection:e.config.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key)}}}],tW(t.prototype,n),o}(ta.vr),tZ=n("482");function tX(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t0(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t1(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){t0(e,t,n[t])})}return e}function t2(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function t7(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tX(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tX(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t5(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function t3(e){var t=function(e,t){if("object"!==t8(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==t8(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===t8(t)?t:String(t)}function t8(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}function t6(){var e=t5(["\n margin-top: 0.5em;\n\n > .ant-formily-item {\n flex-direction: column;\n\n > .ant-formily-item-label {\n line-height: 32px;\n }\n }\n "]);return t6=function(){return e},e}function t4(){var e=t5(["\n .ant-form-item-control-input-content {\n display: flex;\n }\n "]);return t4=function(){return e},e}function t9(e){var t=(0,u.useCollectionManager_deprecated)().getCollectionFields,n=(0,l.useField)().path,r=n.segments[n.segments.length-1],o=(0,l.useForm)().values,c=t7((0,u.parseCollectionName)(null==o?void 0:o.collection),2),s=c[0],f=t(c[1],s).find(function(e){return e.name===r}).type,d=Array.isArray(e.value)?e.value.join(","):e.value,p=(0,i.useCallback)(function(t){var n=t.target.value.trim(),r=["belongsTo","hasOne"].includes(f)?n||null:n.split(",").map(function(e){return e.trim()}).filter(function(e){return""!==e});e.onChange(r)},[e.onChange,f]);return a().createElement(E.Input,t2(t1({},e),{value:d,onChange:p}))}var ne=(0,l.observer)(function(e){var t=e.value,n=e.disabled,r=e.onChange,o=e.filter,c=(0,u.useToken)().token,s=(0,ea.useTranslation)().t,f=(0,u.useCompile)(),d=(0,l.useForm)(),m=(0,u.useCollectionManager_deprecated)().getCollectionFields,y=(0,S.rX)(),b=d.values,v=t7((0,u.parseCollectionName)(null==b?void 0:b.collection),2),h=v[0],g=v[1],O=m(g,h).filter(function(e){return e.uiSchema}),w=o?O.filter(o.bind(b)):O,x=(0,i.useMemo)(function(){return w.filter(function(e){return!t||!(e.name in t)})},[w,t]),j=n||d.disabled,k=(0,i.useMemo)(function(){return{onClick:function(e){var n=e.key;r(t2(t1({},t),t0({},n,null)))},style:{maxHeight:300,overflowY:"auto"},items:x.map(function(e){var t,n;return{key:e.name,label:f(null!==(n=null===(t=e.uiSchema)||void 0===t?void 0:t.title)&&void 0!==n?n:e.name)}})}},[r,x,t]);return a().createElement("fieldset",{className:(0,u.css)(t6())},w.length?a().createElement(u.CollectionProvider_deprecated,{name:g,dataSource:h},w.filter(function(e){return t&&e.name in t}).map(function(e){var n,o,i=["belongsTo","hasOne","hasMany","belongsToMany"].includes(e.type)?t9:u.CollectionField;return a().createElement(E.Form.Item,{key:e.name,label:f(null!==(o=null===(n=e.uiSchema)||void 0===n?void 0:n.title)&&void 0!==o?o:e.name),labelAlign:"left",className:(0,u.css)(t4())},a().createElement(u.Variable.Input,{scope:y,value:t[e.name],changeOnSelect:!0,onChange:function(n){r(t2(t1({},t),t0({},e.name,n)))}},a().createElement(u.SchemaComponent,{schema:{type:"void",properties:t0({},e.name,t0({"x-component":i},"x-validator",function(){return""}))}})),j?null:a().createElement(E.Button,t0({"aria-label":"icon-close",type:"link",icon:a().createElement(tZ.CloseCircleOutlined,null)},"onClick",function(){var n=e.name;r((t[n],function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(t,[n].map(t3))))})))}),x.length?a().createElement(E.Dropdown,{menu:k},a().createElement(E.Button,{icon:a().createElement(tZ.PlusOutlined,null)},s("Add field"))):null):a().createElement("p",{style:{color:c.colorText}},(0,p.KQ)("Please select collection first")))},{displayName:"CollectionFieldSet"}),nt=n("5229");function nn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nr(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function no(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return nn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nn(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ni(){return{name:(0,c.uid)(),type:"void","x-component":"Grid","x-initializer":"assignFieldValuesForm:configureFields"}}function na(e){var t=(0,D.G)().workflow,n=(0,u.useActionContext)().setFormValueChanged;(0,u.useAPIClient)();var r=(0,S.rX)(),o=(0,l.useForm)(),c=o.values,s=o.setValuesIn,f=o.disabled,d=(0,nt.toJS)(c.params),p=no((0,u.parseCollectionName)(c.collection),2),m=p[0],y=p[1],b=(0,u.useSchemaOptionsContext)(),v=no((0,i.useState)(e.value&&Object.keys(e.value).length?e.value:ni()),2),h=v[0],g=v[1],O=(0,i.useMemo)(function(){return(0,et.createForm)({initialValues:d.values,disabled:t.executed,effects:function(){(0,et.onFormValuesChange)(function(e){s("params.values",(0,nt.toJS)(e.values)),n(!0)})}})},[t.executed]);(0,l.useFormEffects)(function(){var e,t;(0,et.onFieldValueChange)("collection",(t=(e=function(e){var t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(e){return O.clearFormGraph("*"),t=ni(),s("params.values",{}),g(t),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){nr(i,r,o,a,l,"next",e)}function l(e){nr(i,r,o,a,l,"throw",e)}a(void 0)})}),function(e){return t.apply(this,arguments)}))});var w=(0,i.useCallback)(function(t){var n=no(Object.values(t.toJSON().properties),1)[0];e.onChange(n);var r=new Set;!function e(t,n){n(t),(null==t?void 0:t.properties)&&Object.values(t.properties).forEach(function(t){e(t,n)})}(n,function(e){if("AssignedField"===e["x-component"]){var t;if(null===(t=e["x-collection-field"])||void 0===t?void 0:t.startsWith("".concat(y,"."))){var n=no(e["x-collection-field"].split("."),2)[1];r.add(n)}}});var o={};Array.from(r).forEach(function(e){e in O.values&&(o[e]=O.values[e])}),s("params.values",o)},[y,e.onChange]);return a().createElement(E.Card,null,a().createElement(u.CollectionManagerProvider,{dataSource:m},a().createElement(u.CollectionProvider,{name:y},a().createElement(u.RerenderDataBlockProvider,null,a().createElement(u.FormProvider,{form:O},a().createElement(tR.FormLayout,{layout:"vertical"},a().createElement(u.VariableScopeProvider,{scope:r},a().createElement(u.SchemaComponentProvider,{form:O,designable:!f},a().createElement(u.SchemaComponentOptions,b,a().createElement(u.SchemaComponent,{schema:h,onChange:w}))))))))))}function nl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nc(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ns(e){return(ns=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){nu(e,t,n[t])})}return e}function nd(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function np(e,t){return(np=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||nb(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ny(e){return function(e){if(Array.isArray(e))return nl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||nb(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function nb(e,t){if(e){if("string"==typeof e)return nl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nl(e,t)}}function nv(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(nv=function(){return!!e})()}function nh(e,t){var n,r,o=e.key,i=e.title,a=e.config,l=nm((0,u.parseCollectionName)(a.collection),2),c=l[0],s=l[1],f=(0,u.useCompile)(),d=(0,S.G$)(c);return nm((0,S._5)(nd(nf({appends:[o].concat(ny((null===(r=a.params)||void 0===r?void 0:null===(n=r.appends)||void 0===n?void 0:n.map(function(e){return"".concat(o,".").concat(e)}))||[]))},t),{fields:[{collectionName:s,name:o,type:"hasOne",target:s,uiSchema:{title:i}}],compile:f,getCollectionFields:d})),1)[0]}var ng=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=ns(n),nu(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,nv()?Reflect.construct(n,r||[],ns(t).constructor):n.apply(t,r)),"title",'{{t("Create record", { ns: "'.concat(p.A7,'" })}}')),nu(e,"type","create"),nu(e,"group","collection"),nu(e,"description",'{{t("Add new record to a collection. You can use variables from upstream nodes to assign values to fields.", { ns: "'.concat(p.A7,'" })}}')),nu(e,"fieldset",{collection:nd(nf({},h),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":ny(h["x-reactions"]).concat([{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}])}),usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]},params:{type:"object",properties:{values:nd(nf({},g),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]}),appends:j}}}),nu(e,"scope",{useCollectionDataSource:u.useCollectionDataSource,useNodeSavedConfig:ta.WH}),nu(e,"components",{CollectionFieldset:ne,AssignedFieldsFormSchemaConfig:na}),nu(e,"useVariables",nh),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&np(e,t)}(o,e),t=o,n=[{key:"createDefaultConfig",value:function(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}},{key:"useInitializers",value:function(e){var t,n;return e.config.collection?{name:null!==(t=e.title)&&void 0!==t?t:"#".concat(e.id),type:"item",title:null!==(n=e.title)&&void 0!==n?n:"#".concat(e.id),Component:f.P,collection:e.config.collection,dataPath:"$jobsMapByNodeKey.".concat(e.key)}:null}}],nc(t.prototype,n),o}(ta.vr);function nO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nw(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nx(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nj(e){return(nj=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nS(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){nx(e,t,n[t])})}return e}function nk(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function nC(e,t){return(nC=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nE(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(nE=function(){return!!e})()}var nA=function(e){var t,n,r;function o(){var e,t,n,r,i;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=nj(n),nx(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,nE()?Reflect.construct(n,r||[],nj(t).constructor):n.apply(t,r)),"title",'{{t("Update record", { ns: "'.concat(p.A7,'" })}}')),nx(e,"type","update"),nx(e,"group","collection"),nx(e,"description",'{{t("Update records of a collection. You can use variables from upstream nodes as query conditions and field values.", { ns: "'.concat(p.A7,'" })}}')),nx(e,"fieldset",{collection:nk(nS({},h),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":((function(e){if(Array.isArray(e))return nO(e)})(i=h["x-reactions"])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return nO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nO(e,t)}}(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params.filter",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}},{target:"params.values",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}])}),params:{type:"object",properties:{individualHooks:{type:"boolean",title:'{{t("Update mode", { ns: "'.concat(p.A7,'" })}}'),"x-decorator":"FormItem","x-component":"RadioWithTooltip","x-component-props":{options:[{label:'{{t("Update in a batch", { ns: "'.concat(p.A7,'" })}}'),value:!1,tooltip:'{{t("Update all eligible data at one time, which has better performance when the amount of data is large. But association fields are not supported (unless foreign key in current collection), and the updated data will not trigger other workflows.", { ns: "'.concat(p.A7,'" })}}')},{label:'{{t("Update one by one", { ns: "'.concat(p.A7,'" })}}'),value:!0,tooltip:'{{t("The updated data can trigger other workflows, and the audit log will also be recorded. But it is usually only applicable to several or dozens of pieces of data, otherwise there will be performance problems.", { ns: "'.concat(p.A7,'" })}}')}]},default:!1},filter:nk(nS({},O),nx({title:'{{t("Only update records matching conditions", { ns: "'.concat(p.A7,'" })}}')},"x-validator",function(e){return(0,s.isValidFilter)(e)?"":(0,p.KQ)("Please add at least one condition")})),values:nk(nS({},g),{"x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && !$deps[1]) ? "visible" : "hidden"}}'}}}]})}},usingAssignFormSchema:{type:"boolean"},assignFormSchema:{type:"object",title:'{{t("Fields values")}}',"x-decorator":"FormItem","x-component":"AssignedFieldsFormSchemaConfig","x-reactions":[{dependencies:["collection","usingAssignFormSchema"],fulfill:{state:{display:'{{($deps[0] && $deps[1]) ? "visible" : "hidden"}}'}}}]}}),nx(e,"scope",{useCollectionDataSource:u.useCollectionDataSource,useNodeSavedConfig:ta.WH}),nx(e,"components",{FilterDynamicComponent:t_.V,CollectionFieldset:ne,AssignedFieldsFormSchemaConfig:na,RadioWithTooltip:tc.W}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nC(e,t)}(o,e),t=o,n=[{key:"createDefaultConfig",value:function(){return{usingAssignFormSchema:!0,assignFormSchema:{}}}}],nw(t.prototype,n),o}(ta.vr);function nP(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function nI(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nT(e){return(nT=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nF(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){nI(e,t,n[t])})}return e}function nD(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function nN(e,t){return(nN=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(nM=function(){return!!e})()}var nR=function(e){function t(){var e,n,r,o,i;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,t),n=this,r=t,o=arguments,r=nT(r),nI(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,nM()?Reflect.construct(r,o||[],nT(n).constructor):r.apply(n,o)),"title",'{{t("Delete record")}}'),nI(e,"type","destroy"),nI(e,"group","collection"),nI(e,"description",'{{t("Delete records of a collection. Could use variables in workflow context as filter. All records match the filter will be deleted.", { ns: "'.concat(p.A7,'" })}}')),nI(e,"fieldset",{collection:nD(nF({},h),{"x-disabled":'{{ useNodeSavedConfig(["collection"]) }}',"x-reactions":((function(e){if(Array.isArray(e))return nP(e)})(i=h["x-reactions"])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return nP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nP(e,t)}}(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).concat([{target:"params",fulfill:{state:{visible:"{{!!$self.value}}"}}},{target:"params",effects:["onFieldValueChange"],fulfill:{state:{value:"{{Object.create({})}}"}}}])}),params:{type:"object",properties:{filter:nD(nF({},O),nI({},"x-validator",function(e){return(0,s.isValidFilter)(e)?"":(0,p.KQ)("Please add at least one condition")}))}}}),nI(e,"scope",{useNodeSavedConfig:ta.WH,useCollectionDataSource:u.useCollectionDataSource}),nI(e,"components",{FilterDynamicComponent:t_.V}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nN(e,t)}(t,e),t}(ta.vr),n_=n("7893"),nB=new u.SchemaSettings({name:"actionSettings:submitToWorkflow",items:[{name:"editButton",Component:u.ButtonEditor,useComponentProps:function(){return(0,u.useSchemaToolbar)().buttonEditorProps}},{name:"secondConfirmation",Component:u.SecondConFirm},{name:"assignFieldValues",Component:u.AssignedFieldValues},{name:"skipRequiredValidation",Component:u.SkipValidation},{name:"afterSuccessfulSubmission",Component:u.AfterSuccess},{name:"bindWorkflow",Component:u.WorkflowConfig},{name:"delete",sort:100,Component:u.RemoveButton,useComponentProps:function(){return(0,u.useSchemaToolbar)().removeButtonProps}}]});function nV(e){var t=e.children,n=e.workflow,r=e.execution,o=e.nodes,i=(0,u.usePlugin)(nX),l=i.triggers.get(n.type).components,c=o.reduce(function(e,t){var n=t.type;return Object.assign(e,i.instructions.get(n).components)},{});return a().createElement(D.i.Provider,{value:{workflow:n,nodes:o,execution:r}},a().createElement(u.SchemaComponentOptions,{components:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},l,c)},t))}var nW=n(3581);function nz(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n$(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function nG(e,t,n){return(nG=nQ()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&nK(o,n.prototype),o}).apply(null,arguments)}function nq(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nU(e){return(nU=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function nK(e,t){return(nK=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nH(e){var t="function"==typeof Map?new Map:void 0;return(nH=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return nG(e,arguments,nU(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),nK(r,e)})(e)}function nQ(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(nQ=function(){return!!e})()}var nJ=(0,u.lazy)(function(){return nW("imported_-1mcq5or_component",n.e("999").then(n.bind(n,5625)))},"ExecutionPage").ExecutionPage,nY=(0,u.lazy)(function(){return nW("imported_-1vg6s1k_component",Promise.all([n.e("383"),n.e("929")]).then(n.bind(n,5437)))},"WorkflowPage").WorkflowPage,nZ=(0,u.lazy)(function(){return nW("imported_18jsd45_component",Promise.all([n.e("383"),n.e("923")]).then(n.bind(n,1837)))},"WorkflowPane").WorkflowPane,nX=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=nU(n),nL(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,nQ()?Reflect.construct(n,r||[],nU(t).constructor):n.apply(t,r)),"triggers",new s.Registry),nL(e,"instructions",new s.Registry),nL(e,"systemVariables",new s.Registry),nL(e,"useTriggersOptions",function(){var t=(0,u.useCompile)();return Array.from(e.triggers.getEntities()).map(function(e){var n,r,o=(r=2,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(n,2)||function(e,t){if(e){if("string"==typeof e)return nz(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nz(e,t)}}(n,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],a=o[1].title,l=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e[1],["title"]);return{value:i,label:t(a),color:"gold",options:l}}).sort(function(e,t){return e.label.localeCompare(t.label)})}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&nK(e,t)}(o,e),t=o,n=[{key:"isWorkflowSync",value:function(e){var t,n;return null!==(n=null===(t=this.triggers.get(e.type))||void 0===t?void 0:t.sync)&&void 0!==n?n:e.sync}},{key:"registerTrigger",value:function(e,t){if("function"==typeof t)this.triggers.register(e,new t);else if(t)this.triggers.register(e,t);else throw TypeError("invalid trigger type to register")}},{key:"registerInstruction",value:function(e,t){if("function"==typeof t)this.instructions.register(e,new t);else{var n,r;if(n=t,null!=(r=ta.vr)&&"undefined"!=typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](n):n instanceof r)this.instructions.register(e,t);else throw TypeError("invalid instruction type to register")}}},{key:"registerSystemVariable",value:function(e){this.systemVariables.register(e.key,e)}},{key:"load",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}(this,function(e){return t.app.router.add("admin.workflow.workflows.id",{path:(0,n_.SI)(":id"),element:a().createElement(nY,null)}),t.app.router.add("admin.workflow.executions.id",{path:(0,n_.s_)(":id"),element:a().createElement(nJ,null)}),t.app.pluginSettingsManager.add(p.A7,{icon:"PartitionOutlined",title:'{{t("Workflow", { ns: "'.concat(p.A7,'" })}}'),Component:nZ,aclSnippet:"pm.workflow.workflows"}),t.app.schemaSettingsManager.add(nB),t.app.schemaSettingsManager.addItem("actionSettings:delete","workflowConfig",{Component:u.WorkflowConfig,useVisible:function(){var e,t=(0,l.useFieldSchema)();return(0,c.isValid)(null==t?void 0:null===(e=t["x-action-settings"])||void 0===e?void 0:e.triggerWorkflows)}}),t.registerTrigger("collection",ee),t.registerTrigger("schedule",ti),t.registerInstruction("calculation",tb),t.registerInstruction("condition",tP),t.registerInstruction("end",tM),t.registerInstruction("query",tY),t.registerInstruction("create",ng),t.registerInstruction("update",nA),t.registerInstruction("destroy",nR),t.registerSystemVariable({key:"now",label:'{{t("System time", { ns: "'.concat(p.A7,'" })}}'),value:"now"}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){n$(i,r,o,a,l,"next",e)}function l(e){n$(i,r,o,a,l,"throw",e)}a(void 0)})})()}}],nq(t.prototype,n),o}(nH(u.Plugin))},3461:function(e,t,n){"use strict";n.d(t,{E9:function(){return U},Kd:function(){return G},Lu:function(){return $},NB:function(){return q},WH:function(){return z},h6:function(){return W},sy:function(){return V},v9:function(){return X},vr:function(){return _},xZ:function(){return L}});var r=n(482),o=n(8563),i=n(5229),a=n(3505),l=n(2721),c=n(467),u=n(8156),s=n.n(u),f=n(3238),d=n(3772),p=n(7584),m=n(5019),y=n(5071),b=n(8018),v=n(1220),h=n(6594),g=n(9144),O=n(6279),w=n(573),x=n(8378),j=n(6805);function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function C(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){k(i,r,o,a,l,"next",e)}function l(e){k(i,r,o,a,l,"throw",e)}a(void 0)})}}function E(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function A(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){A(e,t,n[t])})}return e}function I(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function D(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function N(){var e=F(["\n margin-bottom: 1em;\n "]);return N=function(){return e},e}function M(){var e=F(["\n display: flex;\n justify-content: space-between;\n\n strong {\n font-weight: bold;\n }\n\n .ant-tag {\n margin-inline-end: 0;\n }\n\n code {\n font-weight: normal;\n }\n "]);return M=function(){return e},e}function R(){var e=F(["\n .ant-input,\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper {\n &.auto-width {\n width: auto;\n min-width: 6em;\n }\n }\n "]);return R=function(){return e},e}var _=function(){var e,t,n;function r(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),A(this,"title",void 0),A(this,"type",void 0),A(this,"group",void 0),A(this,"description",void 0),A(this,"options",void 0),A(this,"fieldset",void 0),A(this,"presetFieldset",void 0),A(this,"branching",void 0),A(this,"view",void 0),A(this,"scope",void 0),A(this,"components",void 0),A(this,"end",void 0),A(this,"testable",void 0)}return e=r,t=[{key:"createDefaultConfig",value:function(){return{}}}],E(e.prototype,t),r}();function B(){var e=(0,a.useForm)(),t=(0,d.useAPIClient)(),n=(0,d.useActionContext)(),r=(0,d.useResourceActionContext)().refresh,o=W(),c=(0,b.G)().workflow;return{run:function(){return C(function(){var a,u;return D(this,function(s){switch(s.label){case 0:if(c.executed)return l.message.error((0,w.KQ)("Node in executed workflow cannot be modified")),[2];return[4,e.submit()];case 1:return s.sent(),[4,null===(a=(u=t.resource("flow_nodes")).update)||void 0===a?void 0:a.call(u,{filterByTk:o.id,values:{config:e.values}})];case 2:return s.sent(),e.setInitialValues((0,i.toJS)(e.values)),n.setFormValueChanged(!1),n.setVisible(!1),r(),[2]}})})()}}}var V=s().createContext({});function W(){return(0,u.useContext)(V)}function z(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=W();return e.some(function(e){return null!=(0,c.get)(t.config,e)})}function $(e,t){var n=[];if(!e)return[];for(var r=e.upstream;r;r=r.upstream)("function"!=typeof t||t(r))&&n.push(r);return n}function G(e){for(var t=[],n=e;n;n=n.upstream)n.upstream&&null!=n.branchIndex&&t.push(n.upstream);return t}function q(e){var t,n=e.data,o=(0,x.Z)().styles,i=(0,O.C)(n).getAriaLabel,a=null!==(t=(0,d.usePlugin)(m.default).instructions.get(n.type))&&void 0!==t?t:{},l=a.Component,c=a.end;return s().createElement(V.Provider,{value:n},s().createElement("div",{className:(0,d.cx)(o.nodeBlockClass)},s().createElement(void 0===l?X:l,{data:n}),c&&("function"!=typeof c||c(n))?s().createElement("div",{className:"end-sign"},s().createElement(r.CloseOutlined,null)):s().createElement(y.HS,{"aria-label":i(),upstream:n})))}function L(){var e,t=(0,f.useTranslation)().t,n=(0,d.useAPIClient)(),o=null!==(e=(0,b.G)())&&void 0!==e?e:{},i=o.workflow,a=o.nodes,c=o.refresh,m=W(),y=l.App.useApp().modal,v=n.resource("flow_nodes"),h=(0,u.useCallback)(C(function(){var e;return D(this,function(t){switch(t.label){case 0:return[4,null===(e=v.destroy)||void 0===e?void 0:e.call(v,{filterByTk:m.id})];case 1:return t.sent(),c(),[2]}})}),[m.id,c,v]),g=(0,u.useCallback)(C(function(){var e,n;return D(this,function(r){return(e=a.filter(function(e){return e!==m&&(0,p.parse)(e.config).parameters.filter(function(e){var t=e.key;return t.startsWith("$jobsMapByNodeKey.".concat(m.key,"."))||t==="$jobsMapByNodeKey.".concat(m.key)}).length})).length?(y.error({title:(0,w.KQ)("Can not delete"),content:(0,w.KQ)("The result of this node has been referenced by other nodes ({{nodes}}), please remove the usage before deleting.",{nodes:e.map(function(e){return"#".concat(e.id)}).join(", ")})}),[2]):(n=a.find(function(e){return e.upstream===m&&null!=e.branchIndex})?(0,w.KQ)("This node contains branches, deleting will also be preformed to them, are you sure?"):t("Are you sure you want to delete it?"),y.confirm({title:t("Delete"),content:n,onOk:h}),[2])})}),[m,y,a,h,t]);return i?i.executed?null:s().createElement(l.Button,{type:"text",shape:"circle",icon:s().createElement(r.DeleteOutlined,null),onClick:g,className:"workflow-node-remove-button",size:"small"}):null}function U(){var e,t=(0,b.G)(),n=t.execution,r=t.setViewJob,o=(null!==(e=W())&&void 0!==e?e:{}).jobs,i=(0,x.Z)().styles;return n?o.length?s().createElement(l.Tooltip,{title:(0,w.KQ)("View result")},o.length>1?s().createElement(l.Dropdown,{menu:{items:o.map(function(e){return{key:e.id,label:s().createElement(s().Fragment,null,s().createElement(h.Y,{statusMap:g.ke,status:e.status}),s().createElement("time",null,(0,p.str2moment)(e.updatedAt).format("YYYY-MM-DD HH:mm:ss")))}}),onClick:function(e){var t=e.key;r(o.find(function(e){return e.id==t}))},className:i.dropdownClass}},s().createElement(h.Y,{statusMap:g.ke,status:o[o.length-1].status,className:i.nodeJobButtonClass})):s().createElement(h.Y,{statusMap:g.ke,status:o[0].status,onClick:function(){return r(o[0])},className:i.nodeJobButtonClass})):s().createElement(h.Y,{className:i.nodeJobButtonClass,disabled:!0}):null}function K(){return{form:(0,a.useForm)()}}var H=function(){var e=(0,a.useForm)(),t=e.values,n=e.query,r=W(),o=(0,d.useAPIClient)(),l=(0,d.useActionContext)(),c=(0,a.useField)();return{run:function(){return C(function(){var e,a,u,s;return D(this,function(f){switch(f.label){case 0:e=(0,p.parse)(r.config)((0,i.toJS)(t.config)),(a=n("result").take()).setValue(null),a.setFeedback({}),c.data=c.data||{},c.data.loading=!0,f.label=1;case 1:return f.trys.push([1,3,,4]),[4,o.resource("flow_nodes").test({values:{config:e,type:r.type}})];case 2:return u=f.sent().data.data,a.setFeedback({type:u.status>0?"success":"error",messages:u.status>0?[(0,w.KQ)("Resolved")]:[(0,w.KQ)("Failed")]}),a.setValue(u.result),[3,4];case 3:return s=f.sent(),a.setFeedback({type:"error",messages:s.message}),[3,4];case 4:return c.data.loading=!1,l.setFormValueChanged(!1),[2]}})})()}}},Q=(0,u.createContext)([]);function J(e){var t=e.name,n=e.value,r=e.onChange;return s().createElement(l.Space,null,s().createElement(j.kw,{variableOptions:{},value:"{{".concat(t,"}}"),disabled:!0}),s().createElement(d.Variable.Input,{useTypedConstant:["string","number","boolean","date"],value:n,onChange:r}))}function Y(e){var t=e.value,n=e.onChange,r=(0,u.useContext)(Q);return r.length?s().createElement(s().Fragment,null,r.map(function(e){return s().createElement(J,{key:e,name:e,value:(0,c.get)(t,e),onChange:function(r){(0,c.set)(t,e,r),n((0,i.toJS)(t))}})})):s().createElement(l.Empty,{image:l.Empty.PRESENTED_IMAGE_SIMPLE,description:(0,w.KQ)("No variable"),style:{margin:"1em"}})}function Z(){var e=W(),t=(0,a.useForm)().values,n=(0,p.parse)(t).parameters.map(function(e){return e.key}),r=(0,u.useMemo)(function(){return(0,o.createForm)()},[]);return s().createElement(V.Provider,{value:I(P({},e),{config:t})},s().createElement(Q.Provider,{value:n},s().createElement(d.SchemaComponent,{components:{Alert:l.Alert,TestFormFieldset:Y},scope:{useCancelAction:d.useCancelAction,useRunAction:H},schema:{type:"void",name:"testButton",title:'{{t("Test run")}}',"x-component":"Action","x-component-props":{icon:"CaretRightOutlined"},properties:{modal:{type:"void","x-decorator":"FormV2","x-decorator-props":{form:r},"x-component":"Action.Modal",title:'{{t("Test run", { ns: "workflow" })}}',properties:{alert:{type:"void","x-component":"Alert","x-component-props":{message:'{{t("Test run will do the actual data manipulating or API calling, please use with caution.", { ns: "workflow" })}}',type:"warning",showIcon:!0,className:(0,d.css)(N())}},config:{type:"object",title:'{{t("Replace variables", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"TestFormFieldset"},actions:{type:"void","x-component":"ActionBar",properties:{submit:{type:"void",title:'{{t("Run")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useRunAction }}"}}}},result:{type:"string",title:'{{t("Result", { ns: "workflow" })}}',"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{autoSize:{minRows:5,maxRows:20},style:{whiteSpace:"pre",cursor:"text"}},"x-pattern":"disabled"},footer:{type:"void","x-component":"Action.Modal.Footer",properties:{cancel:{type:"void",title:'{{t("Close")}}',"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}}}}}}}}})))}function X(e){var t,n,r=e.data,i=e.children,f=(0,d.useCompile)(),p=(0,d.useAPIClient)(),y=null!==(n=(0,b.G)())&&void 0!==n?n:{},h=y.workflow,g=y.refresh,O=(0,x.Z)().styles,j=(0,d.usePlugin)(m.default).instructions.get(r.type),S=h.executed?'{{t("View")}}':'{{t("Configure")}}',k=T((0,u.useState)(r.title),2),E=k[0],F=k[1],N=T((0,u.useState)(!1),2),_=N[0],V=N[1],W=T((0,u.useState)(!1),2),z=W[0],$=W[1],G=(0,u.useMemo)(function(){var e=(0,c.cloneDeep)(r.config);return(0,o.createForm)({initialValues:e,disabled:h.executed})},[r,h]),q=(0,u.useCallback)(function(e){V(e),!e&&G.reset()},[G]);var H=(0,u.useCallback)((t=C(function(e){var t,n,o;return D(this,function(i){switch(i.label){case 0:if(F(o=e||f(null==j?void 0:j.title)),o===r.title)return[2];return[4,null===(t=(n=p.resource("flow_nodes")).update)||void 0===t?void 0:t.call(n,{filterByTk:r.id,values:{title:o}})];case 1:return i.sent(),g(),[2]}})}),function(e){return t.apply(this,arguments)}),[r,j]),Q=(0,u.useCallback)(function(e){if(e.target===e.currentTarget){V(!0);return}for(var t=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]),n=e.target;n&&n!==e.currentTarget&&n!==document.documentElement;n=n.parentNode)if(Array.from(n.classList).some(function(e){return t.has(e)})){V(!0),e.stopPropagation();return}},[]);if(!j)return s().createElement("div",{className:(0,d.cx)(O.nodeClass,"workflow-node-type-".concat(r.type))},s().createElement(l.Tooltip,{title:(0,w.KQ)("Node with unknown type will cause error. Please delete it or check plugin which provide this type.")},s().createElement("div",{role:"button","aria-label":"_untyped-".concat(E),className:(0,d.cx)(O.nodeCardClass,"invalid")},s().createElement("div",{className:O.nodeHeaderClass},s().createElement("div",{className:(0,d.cx)(O.nodeMetaClass,"workflow-node-meta")},s().createElement(l.Tag,{color:"error"},(0,w.KQ)("Unknown node")),s().createElement("span",{className:"workflow-node-id"},r.id)),s().createElement("div",{className:"workflow-node-actions"},s().createElement(L,null),s().createElement(U,null))),s().createElement(l.Input.TextArea,{value:E,disabled:!0,autoSize:!0}))));var J=f(j.title);return s().createElement("div",{className:(0,d.cx)(O.nodeClass,"workflow-node-type-".concat(r.type))},s().createElement("div",{role:"button","aria-label":"".concat(J,"-").concat(E),className:(0,d.cx)(O.nodeCardClass,{configuring:_}),onClick:Q},s().createElement("div",{className:O.nodeHeaderClass},s().createElement("div",{className:(0,d.cx)(O.nodeMetaClass,"workflow-node-meta")},s().createElement(l.Tag,null,J),s().createElement("span",{className:"workflow-node-id"},r.id)),s().createElement("div",{className:"workflow-node-actions"},s().createElement(L,null),s().createElement(U,null))),s().createElement(l.Input.TextArea,{disabled:h.executed,value:E,onChange:function(e){return F(e.target.value)},onBlur:function(e){return H(e.target.value)},autoSize:!0}),s().createElement(d.ActionContextProvider,{value:{visible:_,setVisible:q,formValueChanged:z,setFormValueChanged:$}},s().createElement(d.FormProvider,{form:G},s().createElement(d.SchemaComponent,{distributed:!1,scope:I(P({},j.scope),{useFormProviderProps:K,useUpdateAction:B}),components:j.components,schema:{type:"void",properties:I(P({},j.view?{view:j.view}:{}),A({button:{type:"void","x-content":S,"x-component":l.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}}},r.id,{type:"void",title:s().createElement("div",{className:(0,d.css)(M())},s().createElement("strong",null,r.title),s().createElement(l.Tooltip,{title:(0,w.KQ)("Variable key of node")},s().createElement(l.Tag,null,s().createElement("code",null,r.key)))),"x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps","x-component":"Action.Drawer",properties:I(P({},j.description?{description:{type:"void","x-component":v.u,"x-component-props":{label:(0,w.KQ)("Node type"),title:j.title,description:j.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:(0,d.css)(R())},properties:j.fieldset},footer:h.executed?null:{type:"void","x-component":"Action.Drawer.Footer",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{flexGrow:1}},properties:I(P({},j.testable?{test:{type:"void","x-component":(0,a.observer)(Z),"x-align":"left"}}:{}),{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}})}}}})}))}})))),i)}},8378:function(e,t,n){"use strict";function r(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function o(){var e=r(["\n flex-grow: 1;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n\n .workflow-toolbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n position: relative;\n padding: 0.5rem 1rem;\n background: ",";\n border-bottom: 1px solid ",";\n\n header {\n display: flex;\n align-items: center;\n gap: 1em;\n }\n\n aside {\n display: flex;\n align-items: center;\n gap: 0.5em;\n }\n\n .workflow-versions {\n label {\n margin-right: 0.5em;\n }\n }\n }\n\n .workflow-canvas-wrapper {\n flex-grow: 1;\n overflow: hidden;\n position: relative;\n }\n\n .workflow-canvas-zoomer {\n display: flex;\n align-items: center;\n position: absolute;\n top: 2em;\n right: 2em;\n height: 10em;\n padding: 1em 0;\n border-radius: 0.5em;\n background: ",";\n }\n\n .workflow-canvas {\n overflow: auto;\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 2em;\n\n > .ant-alert {\n margin-bottom: 2em;\n font-size: 85%;\n }\n }\n "]);return o=function(){return e},e}function i(){var e=r(["\n .ant-dropdown-menu-item {\n justify-content: flex-end;\n .ant-dropdown-menu-title-content {\n display: flex;\n align-items: baseline;\n justify-content: flex-end;\n text-align: right;\n\n time {\n width: 14em;\n font-size: 80%;\n }\n }\n }\n "]);return i=function(){return e},e}function a(){var e=r(["\n max-height: 80vh;\n overflow-y: auto;\n\n .ant-dropdown-menu-item {\n .ant-dropdown-menu-title-content {\n strong {\n font-weight: normal;\n }\n }\n\n &.enabled {\n strong {\n font-weight: bold;\n }\n }\n\n &.unexecuted {\n strong {\n font-style: italic;\n opacity: 0.75;\n }\n }\n }\n "]);return a=function(){return e},e}function l(){var e=r(["\n .ant-dropdown-menu-item {\n .id {\n flex-grow: 1;\n text-align: right;\n }\n }\n "]);return l=function(){return e},e}function c(){var e=r(["\n display: flex;\n position: relative;\n margin: 2em auto auto auto;\n\n :before {\n content: '';\n position: absolute;\n top: 0;\n bottom: 0;\n left: calc(50% - 0.5px);\n width: 1px;\n background-color: ",";\n }\n "]);return c=function(){return e},e}function u(){var e=r(["\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n min-width: 20em;\n padding: 0 2em;\n\n .workflow-node-list {\n flex-grow: 1;\n }\n\n .workflow-branch-lines {\n position: absolute;\n top: 0;\n bottom: 0;\n width: 1px;\n background-color: ",";\n }\n\n :before,\n :after {\n content: '';\n position: absolute;\n height: 1px;\n background-color: ",";\n }\n\n :before {\n top: 0;\n }\n\n :after {\n bottom: 0;\n }\n\n :not(:first-child):not(:last-child) {\n :before,\n :after {\n left: 0;\n width: 100%;\n }\n }\n\n :last-child:not(:first-child) {\n :before,\n :after {\n right: 50%;\n width: 50%;\n }\n }\n\n :first-child:not(:last-child) {\n :before,\n :after {\n left: 50%;\n width: 50%;\n }\n }\n\n .end-sign {\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 0;\n height: 6em;\n border-left: 1px dashed ",";\n\n .anticon {\n font-size: 1.5em;\n line-height: 100%;\n }\n }\n "]);return u=function(){return e},e}function s(){var e=r(["\n flex-grow: 1;\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n position: relative;\n "]);return s=function(){return e},e}function f(){var e=r(["\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n "]);return f=function(){return e},e}function d(){var e=r(["\n position: relative;\n width: 20em;\n background: ",";\n padding: 1em;\n box-shadow: ",";\n border-radius: ","px;\n cursor: pointer;\n transition: box-shadow 0.3s ease;\n\n &:hover {\n box-shadow: ",";\n\n .workflow-node-remove-button {\n display: block;\n }\n }\n\n &.configuring {\n box-shadow: ",";\n }\n\n .workflow-node-remove-button {\n display: none;\n position: absolute;\n right: 0;\n top: 0;\n color: ",";\n\n &[disabled] {\n display: none;\n }\n\n &:hover {\n color: ",";\n }\n }\n\n .ant-input {\n font-weight: bold;\n\n &:not(:focus) {\n transition:\n background-color 0.3s ease,\n border-color 0.3s ease;\n border-color: ",";\n background-color: ",";\n\n &:not(:disabled):hover {\n border-color: ",";\n }\n\n &:disabled:hover {\n border-color: ",";\n }\n }\n }\n\n .workflow-node-config-button {\n padding: 0;\n }\n\n &:hover {\n box-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.25);\n\n .workflow-node-remove-button {\n display: block;\n }\n }\n "]);return d=function(){return e},e}function p(){var e=r(["\n display: flex;\n position: absolute;\n top: 0;\n right: 0;\n justify-content: center;\n align-items: center;\n color: ",";\n "]);return p=function(){return e},e}function m(){var e=r(["\n display: flex;\n margin-bottom: 0.5em;\n\n .workflow-node-actions {\n position: relative;\n }\n "]);return m=function(){return e},e}function y(){var e=r(["\n flex-grow: 1;\n\n .workflow-node-id {\n color: ",";\n\n &:before {\n content: '#';\n }\n }\n "]);return y=function(){return e},e}function b(){var e=r(["\n display: flex;\n align-items: center;\n font-weight: normal;\n .workflow-node-id {\n color: ",";\n }\n "]);return b=function(){return e},e}function v(){var e=r(["\n display: flex;\n flex-direction: column-reverse;\n align-items: center;\n margin: auto;\n "]);return v=function(){return e},e}function h(){var e=r(["\n background-color: #f3f3f3;\n "]);return h=function(){return e},e}function g(){var e=r(["\n flex-shrink: 0;\n padding: 2em 0;\n\n > .ant-btn {\n &:disabled {\n visibility: hidden;\n }\n }\n "]);return g=function(){return e},e}function O(){var e=r(["\n position: relative;\n overflow: visible;\n\n > span {\n position: absolute;\n top: calc(1.5em - 1px);\n line-height: 1em;\n color: ",";\n background-color: ",";\n padding: 1px;\n }\n "]);return O=function(){return e},e}function w(){var e=r(["\n display: flex;\n justify-content: center;\n align-items: center;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n width: 2em;\n height: 6em;\n "]);return w=function(){return e},e}function x(){var e=r(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: 4em;\n height: 4em;\n border-radius: 50%;\n background-color: ",";\n color: ",";\n "]);return x=function(){return e},e}var j=(0,n(3772).createStyles)(function(e){var t=e.css,n=e.token;return{workflowPageClass:t(o(),n.colorBgContainer,n.colorBorderSecondary,n.colorBgContainer),dropdownClass:t(i()),workflowVersionDropdownClass:t(a()),executionsDropdownRowClass:t(l()),branchBlockClass:t(c(),n.colorBgLayout),branchClass:t(u(),n.colorBorder,n.colorBorder,n.colorBgLayout),nodeBlockClass:t(s()),nodeClass:t(f()),nodeCardClass:t(d(),n.colorBgContainer,n.boxShadowTertiary,n.borderRadiusLG,n.boxShadow,n.boxShadow,n.colorText,n.colorErrorHover,n.colorBorderBg,n.colorBgContainerDisabled,n.colorPrimaryBorderHover,n.colorBorderBg),nodeJobButtonClass:t(p(),n.colorTextLightSolid),nodeHeaderClass:t(m()),nodeMetaClass:t(y(),n.colorTextDescription),nodeTitleClass:t(b(),n.colorTextDescription),nodeSubtreeClass:t(v()),nodeJobResultClass:t(h()),addButtonClass:t(g()),conditionClass:t(O(),n.colorTextSecondary,n.colorBgLayout),loopLineClass:t(w()),terminalClass:t(x(),n.colorText,n.colorBgContainer)}});t.Z=j},336:function(e,t,n){"use strict";n.d(t,{Gk:function(){return I},cC:function(){return T},xz:function(){return E}});var r=n(8156),o=n.n(r),i=n(2721),a=n(467),l=n(482),c=n(8563),u=n(3505),s=n(3772),f=n(5019),d=n(8018),p=n(1220),m=n(573),y=n(8378);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function v(e,t,n,r,o,i,a){try{var l=e[i](a),c=l.value}catch(e){n(e);return}l.done?t(c):Promise.resolve(c).then(r,o)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){v(i,r,o,a,l,"next",e)}function l(e){v(i,r,o,a,l,"throw",e)}a(void 0)})}}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){O(e,t,n[t])})}return e}function x(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function j(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}function k(){var e,t,n=(e=["\n .ant-select.auto-width {\n width: auto;\n min-width: 6em;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return k=function(){return n},n}function C(){var e,t=(0,u.useForm)(),n=(0,s.useAPIClient)(),r=(null!==(e=(0,d.G)())&&void 0!==e?e:{}).workflow,o=(0,s.useActionContext)(),a=(0,s.useResourceActionContext)().refresh;return{run:function(){return h(function(){return S(this,function(e){switch(e.label){case 0:if(r.executed)return i.message.error((0,m.KQ)("Trigger in executed workflow cannot be modified")),[2];return[4,t.submit()];case 1:return e.sent(),[4,n.resource("workflows").update({filterByTk:r.id,values:{config:t.values}})];case 2:return e.sent(),o.setFormValueChanged(!1),o.setVisible(!1),a(),[2]}})})()}}}var E=function(){var e,t,n;function r(){!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,r),O(this,"sync",void 0),O(this,"title",void 0),O(this,"description",void 0),O(this,"fieldset",void 0),O(this,"triggerFieldset",void 0),O(this,"view",void 0),O(this,"scope",void 0),O(this,"components",void 0),O(this,"initializers",void 0),O(this,"isActionTriggerable",void 0)}return e=r,t=[{key:"validate",value:function(e){return!0}}],g(e.prototype,t),r}();function A(){var e=(0,s.useCompile)(),t=(0,d.G)(),n=t.workflow,r=t.execution,a=(0,y.Z)().styles,c=T();return r?o().createElement(s.SchemaComponent,{components:{Tooltip:i.Tooltip},schema:{type:"void",name:"execution","x-decorator":"Tooltip","x-decorator-props":{title:(0,m.KQ)("View result")},"x-component":"Action","x-component-props":{title:o().createElement(l.InfoOutlined,null),shape:"circle",size:"small",className:a.nodeJobButtonClass,type:"primary"},properties:O({},r.id,{type:"void","x-decorator":"Form","x-decorator-props":{initialValue:r},"x-component":"Action.Modal",title:o().createElement("div",{className:(0,s.cx)(a.nodeTitleClass)},o().createElement(i.Tag,null,e(c.title)),o().createElement("strong",null,n.title),o().createElement("span",{className:"workflow-node-id"},"#",r.id)),properties:{createdAt:{type:"string",title:'{{t("Triggered at", { ns: "'.concat(m.A7,'" })}}'),"x-decorator":"FormItem","x-component":"DatePicker","x-component-props":{showTime:!0},"x-read-pretty":!0},context:{type:"object",title:'{{t("Trigger variables", { ns: "'.concat(m.A7,'" })}}'),"x-decorator":"FormItem","x-component":"Input.JSON","x-component-props":{className:a.nodeJobResultClass,autoSize:{minRows:4,maxRows:32}},"x-disabled":!0}}})}}):null}function P(){return{form:(0,u.useForm)()}}var I=function(){var e,t=(0,s.useAPIClient)(),n=(0,d.G)(),u=n.workflow,f=n.refresh,b=j((0,r.useState)(""),2),v=b[0],g=b[1],O=j((0,r.useState)(!1),2),E=O[0],I=O[1],F=j((0,r.useState)(!1),2),D=F[0],N=F[1],M=(0,y.Z)().styles,R=(0,s.useCompile)(),_=T();(0,r.useEffect)(function(){if(u){var e,t;g(null!==(t=null!==(e=u.triggerTitle)&&void 0!==e?e:u.title)&&void 0!==t?t:R(null==_?void 0:_.title))}},[u,_]);var B=(0,r.useMemo)(function(){var e=(0,a.cloneDeep)(u.config);return(0,c.createForm)({initialValues:e,disabled:u.executed})},[u]),V=(0,r.useCallback)(function(e){I(e),!e&&B.reset()},[B]);var W=(0,r.useCallback)((e=h(function(e){var n;return S(this,function(r){switch(r.label){case 0:if(g(n=e||R(null==_?void 0:_.title)),n===u.triggerTitle)return[2];return[4,t.resource("workflows").update({filterByTk:u.id,values:{triggerTitle:n}})];case 1:return r.sent(),f(),[2]}})}),function(t){return e.apply(this,arguments)}),[u,_]),z=(0,r.useCallback)(function(e){if(e.target===e.currentTarget){I(!0);return}for(var t,n=new Set(["workflow-node-meta","workflow-node-config-button","ant-input-disabled"]),r=e.target;r&&r!==e.currentTarget;r=r.parentNode)if(Array.from(null!==(t=r.classList)&&void 0!==t?t:[]).some(function(e){return n.has(e)})){I(!0),e.stopPropagation();return}},[]),$=u.executed?'{{t("View")}}':'{{t("Configure")}}',G=(0,m.KQ)("Trigger");if(!_)return o().createElement(i.Tooltip,{title:(0,m.KQ)("Workflow with unknown type will cause error. Please delete it or check plugin which provide this type.")},o().createElement("div",{role:"button","aria-label":"".concat(G,"-").concat(v),className:(0,s.cx)(M.nodeCardClass,"invalid"),onClick:z},o().createElement("div",{className:M.nodeHeaderClass},o().createElement("div",{className:(0,s.cx)(M.nodeMetaClass,"workflow-node-meta")},o().createElement(i.Tag,{color:"error"},(0,m.KQ)("Unknown trigger")))),o().createElement("div",{className:"workflow-node-title"},o().createElement(i.Input.TextArea,{value:v,disabled:!0,autoSize:!0}))));var q=_.fieldset,L=_.scope,U=_.components;return o().createElement("div",{role:"button","aria-label":"".concat(G,"-").concat(v),className:(0,s.cx)(M.nodeCardClass),onClick:z},o().createElement("div",{className:M.nodeHeaderClass},o().createElement("div",{className:(0,s.cx)(M.nodeMetaClass,"workflow-node-meta")},o().createElement(i.Tag,{color:"gold"},o().createElement(l.ThunderboltOutlined,null),o().createElement("span",{className:"type"},R(_.title)))),o().createElement("div",{className:"workflow-node-actions"},o().createElement(A,null))),o().createElement("div",{className:"workflow-node-title"},o().createElement(i.Input.TextArea,{value:v,onChange:function(e){return g(e.target.value)},onBlur:function(e){return W(e.target.value)},autoSize:!0,disabled:u.executed})),o().createElement(s.ActionContextProvider,{value:{visible:E,setVisible:V,formValueChanged:D,setFormValueChanged:N}},o().createElement(s.FormProvider,{form:B},o().createElement(s.SchemaComponent,{scope:x(w({},L),{useFormProviderProps:P}),components:U,schema:{name:"workflow-trigger-".concat(u.id),type:"void",properties:{config:{type:"void","x-content":$,"x-component":i.Button,"x-component-props":{type:"link",className:"workflow-node-config-button"}},drawer:{type:"void",title:G,"x-component":"Action.Drawer","x-decorator":"FormV2","x-use-decorator-props":"useFormProviderProps",properties:x(w({},_.description?{description:{type:"void","x-component":p.u,"x-component-props":{label:(0,m.KQ)("Trigger type"),title:_.title,description:_.description}}}:{}),{fieldset:{type:"void","x-component":"fieldset","x-component-props":{className:(0,s.css)(k())},properties:q},actions:w({},u.executed?{}:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:C}}}})})}}}}))))};function T(){var e=(0,s.usePlugin)(f.default),t=(0,d.G)().workflow;return e.triggers.get(t.type)}},6805:function(e,t,n){"use strict";n.d(t,{DU:function(){return g},G$:function(){return T},Ox:function(){return v},PL:function(){return w},RU:function(){return M},UE:function(){return O},VW:function(){return x},_5:function(){return I},gz:function(){return N},h9:function(){return h},kw:function(){return F},r$:function(){return D},rX:function(){return E}});var r=n(8156),o=n.n(r),i=n(467),a=n(3772),l=n(8018),c=n(573),u=n(3461),s=n(5019);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function p(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){d(e,t,n[t])})}return e}function m(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function y(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}function b(e,t){if(e){if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}}var v={label:"label",value:"value",children:"children"},h={label:'{{t("Node result", { ns: "'.concat(c.A7,'" })}}'),value:"$jobsMapByNodeKey",useOptions:function(e){var t=(0,a.usePlugin)(s.default).instructions,n=(0,u.h6)(),r=(0,u.Lu)(n),o=[];return r.forEach(function(n){var r,i=t.get(n.type),a=null===(r=i.useVariables)||void 0===r?void 0:r.call(i,n,e);a&&o.push(a)}),o}},g={label:'{{t("Trigger variables", { ns: "'.concat(c.A7,'" })}}'),value:"$context",useOptions:function(e){var t,n,r=(0,a.usePlugin)(s.default).triggers,o=(0,l.G)().workflow,i=r.get(o.type);return null!==(n=null==i?void 0:null===(t=i.useVariables)||void 0===t?void 0:t.call(i,o.config,e))&&void 0!==n?n:null}},O={label:'{{t("Scope variables", { ns: "'.concat(c.A7,'" })}}'),value:"$scopes",useOptions:function(e){var t=e.fieldNames,n=void 0===t?v:t,r=e.current,o=(0,a.usePlugin)(s.default).instructions,i=(0,u.h6)(),l=(0,u.Kd)(null!=r?r:i),c=[];return l.forEach(function(t){var r,i,a,l=o.get(t.type),u=null===(r=l.useScopeVariables)||void 0===r?void 0:r.call(l,t,e);u&&c.push((d(a={key:t.key},n.value,t.key),d(a,n.label,null!==(i=t.title)&&void 0!==i?i:"#".concat(t.id)),d(a,n.children,u),a))}),c}},w={label:'{{t("System variables", { ns: "'.concat(c.A7,'" })}}'),value:"$system",useOptions:function(e){var t=(0,a.usePlugin)(s.default).systemVariables;return(0,a.useCompile)()(Array.from(t.getValues()))}},x={boolean:new Set(["checkbox"]),number:new Set(["integer","number","percent"]),string:new Set(["input","password","email","phone","select","radioGroup","text","markdown","richText","expression","time"]),date:new Set(["date","createdAt","updatedAt"])};function j(e,t){var n,r,o,i,a,l,c;if("string"==typeof t)return null===(n=x[t])||void 0===n?void 0:n.has(e.interface);if((void 0===t?"undefined":(c=t)&&"undefined"!=typeof Symbol&&c.constructor===Symbol?"symbol":typeof c)=="object"&&"reference"===t.type)return S(e)?(null===(r=t.options)||void 0===r?void 0:r.entity)&&(e.collectionName===(null===(o=t.options)||void 0===o?void 0:o.collection)||(null===(i=t.options)||void 0===i?void 0:i.collection)==="*"):!!e.isForeignKey&&(e.collectionName===(null===(a=t.options)||void 0===a?void 0:a.collection)&&"id"===e.name||e.target===(null===(l=t.options)||void 0===l?void 0:l.collection));return"function"==typeof t&&t(e)}function S(e){return["belongsTo","hasOne","hasMany","belongsToMany","belongsToArray"].includes(e.type)}function k(e,t){if(null==t)return null;var n="".concat(e.name,".");return t.filter(function(e){return e.startsWith(n)}).map(function(e){return e.replace(n,"")})}function C(e,t){var n,r,o,i=(0,a.useCompile)(),l=null===(r=e.useOptions)||void 0===r?void 0:null===(n=r.call(e,t))||void 0===n?void 0:n.filter(Boolean),c=t.fieldNames;return d(o={},c.label,i(e.label)),d(o,c.value,e.value),d(o,"key",e[c.value]),d(o,c.children,l),d(o,"disabled",!l||!l.length),o}function E(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign({},v,null!==(e=t.fieldNames)&&void 0!==e?e:{}),r=Object.assign(t,{fieldNames:n});return[C(O,r),C(h,r),C(g,r),C(w,r)]}function A(e,t){var n,r,o,l=t.compile,c=t.getCollectionFields;var u=(n=(0,a.parseCollectionName)(e),r=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);a=!0);}catch(e){l=!0,r=e}finally{try{!a&&null!=o.return&&o.return()}finally{if(l)throw r}}return i}}(n,2)||b(n,r)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),s=u[0],d=c(u[1],s),y=[],v=[];d.forEach(function(e){if(e.isForeignKey&&!e.primaryKey)y.push(e);else{var t=d.find(function(t){return t.name===e.foreignKey});t&&y.push(t),v.push(e)}});for(var h=(0,i.uniqBy)(y,"name"),g=v.length-1;g>=0;g--)!function(e){var t=v[e];if("belongsTo"===t.type){var n,r,o=h.findIndex(function(e){return e.name===t.foreignKey});if(o>-1){var i,a,c=h[o];v.splice(e,0,m(p({},t,c),{uiSchema:m(p({},t.uiSchema),{title:(null===(i=c.uiSchema)||void 0===i?void 0:i.title)?l(null===(a=c.uiSchema)||void 0===a?void 0:a.title):c.name})})),h.splice(o,1)}else v.splice(e,0,m(p({},t),{name:t.foreignKey,type:"bigInt",isForeignKey:!0,interface:t.interface,uiSchema:m(p({},t.uiSchema),{title:(null===(n=t.uiSchema)||void 0===n?void 0:n.title)?"".concat(l(null===(r=t.uiSchema)||void 0===r?void 0:r.title)," ID"):t.name})}))}else"context"===t.type&&"users"===t.collectionName&&v.splice(e,1)}(g);return v.push.apply(v,function(e){if(Array.isArray(e))return f(e)}(o=h)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||b(o)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),(0,i.uniqBy)(v,"name").filter(function(e){return e.interface&&!e.hidden})}function P(e){var t=k(e.field,e.appends),n=I(p({collection:"".concat(e.field.dataSourceKey&&"main"!==e.field.dataSourceKey?"".concat(e.field.dataSourceKey,":"):"").concat(e.field.target),types:e.types,appends:t,depth:e.depth-1},this));e.loadChildren=null,n.length?e.children=n:(e.isLeaf=!0,!(!e.types||e.types.some(function(t){return j(e.field,t)}))&&(e.disabled=!0))}function I(e){var t=e.fields,n=e.collection,r=e.types,o=e.appends,i=void 0===o?[]:o,a=e.depth,l=void 0===a?1:a,c=e.compile,u=e.getCollectionFields,s=e.fieldNames,f=void 0===s?v:s,p=null!=t?t:A(n,{compile:c,getCollectionFields:u}),m=P.bind({compile:c,getCollectionFields:u,fieldNames:f});return(function e(t){var n=t.fields,r=t.types,o=t.appends,i=t.depth,a=void 0===i?1:i,l=t.compile,c=t.getCollectionFields;return n.filter(function(t){var n=null==r||!r.length||r.some(function(e){return j(t,e)});if(!S(t))return n;if(null===o)return!!a&&(n||e({fields:A(t.target,{compile:l,getCollectionFields:c}),types:r,depth:a-1,appends:o,compile:l,getCollectionFields:c}));var i=k(t,o),u=o.includes(t.name);return n?u:((null==i?void 0:i.length)||u)&&e({fields:A(t.target,{compile:l,getCollectionFields:c}),types:r,appends:i,compile:l,getCollectionFields:c}).length})})({fields:p,types:r,depth:l,appends:i,compile:c,getCollectionFields:u}).map(function(e){var t,n,o=c((null===(t=e.uiSchema)||void 0===t?void 0:t.title)||e.name),a=k(e,i),u=!S(e)||a&&!a.length&&!i.includes(e.name)||!1;return d(n={},f.label,o),d(n,"key",e.name),d(n,f.value,e.name),d(n,"isLeaf",u),d(n,"loadChildren",u?null:m),d(n,"field",e),d(n,"depth",l),d(n,"appends",i),d(n,"types",r),n})}function T(e){var t=(0,a.useApp)().dataSourceManager.getDataSource(e).collectionManager;return(0,r.useCallback)(function(e){return t.getCollectionAllFields(e)},[t])}function F(e){var t=e.variableOptions,n=y(e,["variableOptions"]),r=E(t);return o().createElement(a.Variable.Input,p({scope:r},n))}function D(e){var t=e.variableOptions,n=y(e,["variableOptions"]),r=E(t);return o().createElement(a.Variable.TextArea,p({scope:r},n))}function N(e){var t=e.variableOptions,n=y(e,["variableOptions"]),r=E(t);return o().createElement(a.Variable.RawTextArea,p({scope:r},n))}function M(e){var t=e.variableOptions,n=y(e,["variableOptions"]),r=E(t);return o().createElement(a.Variable.JSON,p({scope:r},n))}},7380:function(e,t,n){"use strict";n.d(t,{nF:function(){return j.n},$W:function(){return x.$},nw:function(){return d},xH:function(){return p.x},pg:function(){return S.p},VT:function(){return m.V},Gs:function(){return j.G},JF:function(){return g},PW:function(){return r.P},W5:function(){return y.W},D4:function(){return w.D},PO:function(){return k.P},XB:function(){return O.X}});var r=n("8500"),o=n("8156"),i=n.n(o),a=n("8563"),l=n("3505"),c=n("467"),u=n("3772"),s=n("8018");function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){var t,n,r,d,p,m,y,b,v=e.collection,h=e.dataPath,g=e.children,O=(0,l.useField)(),w=(0,o.useRef)(null),x=(0,(0,u.useAssociationNames)().getAssociationAppends)(),j=x.appends,S=x.updateAssociationValues;var k=(t=h,r=(n=(0,s.G)()).execution,d=n.nodes,p=(0,o.useMemo)(function(){return d.reduce(function(e,t){return Object.assign(e,f({},t.id,t.key))},{})},[d]),m=(0,o.useMemo)(function(){var e;return{$context:null==r?void 0:r.context,$jobsMapByNodeKey:(null!==(e=null==r?void 0:r.jobs)&&void 0!==e?e:[]).reduce(function(e,t){return Object.assign(e,f({},p[t.nodeId],t.result))},{})}},[null==r?void 0:r.context,null==r?void 0:r.jobs,p]),(0,o.useMemo)(function(){return(0,c.get)(m,t)},[m,t]));if("string"==typeof v){var C=(0,u.parseCollectionName)(v);y=C[0],b=C[1]}else b=v;var E=(0,o.useMemo)(function(){return(0,a.createForm)({values:k,readPretty:!0})},[k]),A={loading:!1,data:{data:k}},P=(0,u.useAPIClient)().resource(b),I=(0,u.useBlockRequestContext)();return i().createElement(u.CollectionProvider_deprecated,{dataSource:y,collection:b},i().createElement(u.RecordProvider,{record:k,parent:null},i().createElement(u.RerenderDataBlockProvider,null,i().createElement(u.BlockRequestContext_deprecated.Provider,{value:{block:"form",field:O,service:A,resource:P,__parent:I}},i().createElement(u.FormBlockContext.Provider,{value:{params:{appends:j},form:E,field:O,service:A,updateAssociationValues:S,formBlockRef:w}},g)))))}var p=n("4514"),m=n("4339"),y=n("799"),b=n("482"),v=n("2721");function h(){var e,t,n=(e=["\n & + .anticon {\n margin-left: 0.25em;\n }\n "],!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return h=function(){return n},n}function g(e){var t=e.options,n=e.direction,r=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],!(t.indexOf(n)>=0)&&(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++){if(n=i[r],!(t.indexOf(n)>=0))Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}}return o}(e,["options","direction"]),o=(0,u.useCompile)();return i().createElement(v.Checkbox.Group,r,i().createElement(v.Space,{direction:n},(void 0===t?[]:t).map(function(e){return i().createElement(v.Checkbox,{key:e.value,value:e.value},i().createElement("span",{className:(0,u.css)(h())},o(e.label)),e.tooltip&&i().createElement(v.Tooltip,{title:o(e.tooltip)},i().createElement(b.QuestionCircleOutlined,{style:{color:"#666"}})))})))}var O=n("8060"),w=n("5676"),x=n("3048"),j=n("3430"),S=n("1188"),k=n("6922")},6279:function(e,t,n){"use strict";n.d(t,{C:function(){return o}});var r=n(8156),o=function(e,t){return{getAriaLabel:(0,r.useCallback)(function(n){return["add-button",null==e?void 0:e.type,null==e?void 0:e.title,null!=t?String(t):"",n].filter(Boolean).join("-")},[t,null==e?void 0:e.title,null==e?void 0:e.type])}}},573:function(e,t,n){"use strict";n.d(t,{A7:function(){return i},KQ:function(){return a},cC:function(){return l}});var r=n(3772),o=n(3238),i="workflow";function a(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},o),n=(n={ns:i},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function l(){return(0,o.useTranslation)(i)}},7893:function(e,t,n){"use strict";function r(e){var t=new Map;e.forEach(function(e){return t.set(e.id,e)});var n=!0,r=!1,o=void 0;try{for(var i,a=t.values()[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var l=i.value;l.upstreamId&&(l.upstream=t.get(l.upstreamId)),l.downstreamId&&(l.downstream=t.get(l.downstreamId))}}catch(e){r=!0,o=e}finally{try{!n&&null!=a.return&&a.return()}finally{if(r)throw o}}}n.d(t,{SI:function(){return o},Yc:function(){return r},dF:function(){return function e(t,n){n(t),t.properties&&Object.keys(t.properties).forEach(function(r){e(t.properties[r],n)})}},s_:function(){return i}});function o(e){return"/admin/workflow/workflows/".concat(e)}function i(e){return"/admin/workflow/executions/".concat(e)}},3581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},1801:function(e,t,n){"use strict";var r=n(8156),o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,l=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(e,t,n){var r,i={},u=null,s=null;for(r in void 0!==n&&(u=""+n),void 0!==t.key&&(u=""+t.key),void 0!==t.ref&&(s=t.ref),t)a.call(t,r)&&!c.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===i[r]&&(i[r]=t[r]);return{$$typeof:o,type:e,key:u,ref:s,props:i,_owner:l.current}}t.Fragment=i,t.jsx=u,t.jsxs=u},3704:function(e,t,n){"use strict";e.exports=n(1801)},482:function(e){"use strict";e.exports=c},4632:function(e){"use strict";e.exports=u},8563:function(e){"use strict";e.exports=d},3505:function(e){"use strict";e.exports=t},5229:function(e){"use strict";e.exports=m},8875:function(e){"use strict";e.exports=s},3772:function(t){"use strict";t.exports=e},47:function(e){"use strict";e.exports=o},7584:function(e){"use strict";e.exports=f},2721:function(e){"use strict";e.exports=i},5760:function(e){"use strict";e.exports=a},467:function(e){"use strict";e.exports=p},8156:function(e){"use strict";e.exports=n},3238:function(e){"use strict";e.exports=r},6128:function(e){"use strict";e.exports=l},9527:function(e){!function(){"use strict";var t={}.hasOwnProperty;function n(){for(var e="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(e=r(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var o="";for(var i in e)t.call(e,i)&&e[i]&&(o=r(o,i));return o}(i)))}return e}function r(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return n}):window.classNames=n}()}},x={};function j(e){var t=x[e];if(void 0!==t)return t.exports;var n=x[e]={exports:{}};return w[e](n,n.exports,j),n.exports}return j.m=w,j.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return j.d(t,{a:t}),t},j.d=function(e,t){for(var n in t)j.o(t,n)&&!j.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},j.f={},j.e=function(e){return Promise.all(Object.keys(j.f).reduce(function(t,n){return j.f[n](e,t),t},[]))},j.u=function(e){return""+({383:"739d458621edf81f",923:"e7b9d67c6a964bec",929:"5ed8ff0f70ed5911",999:"92877729dbcede8f"})[e]+".js"},j.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),j.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},y={},b="@nocobase/plugin-workflow:",j.l=function(e,t,n,r){if(y[e]){y[e].push(t);return}if(void 0!==n){for(var o,i,a=document.getElementsByTagName("script"),l=0;l<a.length;l++){var c=a[l];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")==b+n){o=c;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,j.nc&&o.setAttribute("nonce",j.nc),o.setAttribute("data-webpack",b+n),o.src=e),y[e]=[t];var u=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=y[e];if(delete y[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=u.bind(null,o.onerror),o.onload=u.bind(null,o.onload),i&&document.head.appendChild(o)},j.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},j.p=(!(v=window.__nocobase_public_path__||"/").endsWith("/")&&(v+="/"),v+"static/plugins/@nocobase/plugin-workflow/dist/client/"),h={909:0},j.f.j=function(e,t){var n=j.o(h,e)?h[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=h[e]=[t,r]});t.push(n[2]=r);var o=j.p+j.u(e),i=Error();j.l(o,function(t){if(j.o(h,e)&&(0!==(n=h[e])&&(h[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}}},g=function(e,t){var n=t[0],r=t[1],o=t[2],i,a,l=0;if(n.some(function(e){return 0!==h[e]})){for(i in r)j.o(r,i)&&(j.m[i]=r[i]);o&&o(j)}for(e&&e(t);l<n.length;l++)a=n[l],j.o(h,a)&&h[a]&&h[a][0](),h[a]=0},(O=self.webpackChunk_nocobase_plugin_workflow=self.webpackChunk_nocobase_plugin_workflow||[]).forEach(g.bind(null,0)),O.push=g.bind(null,O.push.bind(O)),j("5019")}()});
|