@digitalsee-ai/rcs 2.0.0-beta11 → 2.0.0-beta12

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.
@@ -9047,7 +9047,7 @@ const Rc = {
9047
9047
  ] }, c))
9048
9048
  }
9049
9049
  ) });
9050
- }, M4 = GR(() => import("./index-6UR19hpE.mjs")), C_ = (t) => {
9050
+ }, M4 = GR(() => import("./index-rOPtHLZf.mjs")), C_ = (t) => {
9051
9051
  const e = Mr({
9052
9052
  editorVisible: !1
9053
9053
  }), n = () => {
@@ -41518,6 +41518,7 @@ const IY = Ce.Item, { Option: RY } = ut, { Text: FY, Title: iae } = Rn, fs = "[w
41518
41518
  layout: "vertical",
41519
41519
  required: !0,
41520
41520
  name: g,
41521
+ initialValue: t,
41521
41522
  rules: [
41522
41523
  {
41523
41524
  validator: () => t ? Promise.resolve() : Promise.reject(new Error(s || "请选择账号"))
@@ -56292,10 +56293,7 @@ const vI = /^[1-9]\d*$/, Wm = (t) => {
56292
56293
  const n = Number(e);
56293
56294
  return Number.isSafeInteger(n) ? n : void 0;
56294
56295
  }, Ere = (t) => {
56295
- const e = t.scene.trim();
56296
- if (!e)
56297
- return null;
56298
- const n = Kr(t.categoryName), r = Kr(t.flowId), o = HE(t.page), i = HE(t.size);
56296
+ const e = t.scene.trim(), n = Kr(t.categoryName), r = Kr(t.flowId), o = HE(t.page), i = HE(t.size);
56299
56297
  return {
56300
56298
  scene: e,
56301
56299
  trigger: t.trigger,
@@ -56308,8 +56306,6 @@ const vI = /^[1-9]\d*$/, Wm = (t) => {
56308
56306
  };
56309
56307
  }, Sre = (t, e) => {
56310
56308
  const n = Ere(e);
56311
- if (!n)
56312
- return null;
56313
56309
  switch (t.mode) {
56314
56310
  case "independent":
56315
56311
  return { ...n, mode: "independent" };
@@ -61617,4 +61613,4 @@ export {
61617
61613
  gv as y,
61618
61614
  pae as z
61619
61615
  };
61620
- //# sourceMappingURL=index-DvM_eQdC.mjs.map
61616
+ //# sourceMappingURL=index-DHj4kcT2.mjs.map
@@ -1,5 +1,5 @@
1
1
  import { jsx as t, jsxs as v } from "react/jsx-runtime";
2
- import { D as T, V as L, e as V, i as P, t as l, f as R, d as O } from "./index-DvM_eQdC.mjs";
2
+ import { D as T, V as L, e as V, i as P, t as l, f as R, d as O } from "./index-DHj4kcT2.mjs";
3
3
  import { useEventEmitter as B, useReactive as W, useSize as H } from "ahooks";
4
4
  import { FormattedMessage as $ } from "react-intl";
5
5
  import { CloseCircleFilled as A, CheckCircleFilled as K } from "@ant-design/icons";
@@ -279,4 +279,4 @@ function $e(e) {
279
279
  export {
280
280
  $e as default
281
281
  };
282
- //# sourceMappingURL=index-6UR19hpE.mjs.map
282
+ //# sourceMappingURL=index-rOPtHLZf.mjs.map
package/dist/rcs.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as s, a as o, b as l, N as i, c as r, g as t, h as n, j as d, k as u, l as F, m as c, n as y, E as g, F as S, o as m, H as p, p as C, q as V, r as f, s as w, u as A, v as b, w as R, x as v, W as T, y as W, z as P, B as k, C as D, G as I, I as M, J as N, K as h, L as E, M as L, O, P as _, Q as x, R as B, S as G, T as U, U as j, X as q, Y as H, Z as Y, _ as z, $ as J, a0 as K, a1 as Q, a2 as X, a3 as Z, a4 as $, a5 as aa, a6 as ea, a7 as sa, a8 as oa, a9 as la, aa as ia, ab as ra, ac as ta, ad as na, ae as da, af as ua, ag as Fa, ah as ca, ai as ya } from "./index-DvM_eQdC.mjs";
1
+ import { A as s, a as o, b as l, N as i, c as r, g as t, h as n, j as d, k as u, l as F, m as c, n as y, E as g, F as S, o as m, H as p, p as C, q as V, r as f, s as w, u as A, v as b, w as R, x as v, W as T, y as W, z as P, B as k, C as D, G as I, I as M, J as N, K as h, L as E, M as L, O, P as _, Q as x, R as B, S as G, T as U, U as j, X as q, Y as H, Z as Y, _ as z, $ as J, a0 as K, a1 as Q, a2 as X, a3 as Z, a4 as $, a5 as aa, a6 as ea, a7 as sa, a8 as oa, a9 as la, aa as ia, ab as ra, ac as ta, ad as na, ae as da, af as ua, ag as Fa, ah as ca, ai as ya } from "./index-DHj4kcT2.mjs";
2
2
  export {
3
3
  s as AIFieldWrapper,
4
4
  o as AI_FILL_VALUE,
package/dist/rcs.umd.js CHANGED
@@ -109,7 +109,7 @@ The error may be correlated with this previous error:
109
109
  *
110
110
  * This source code is licensed under the ISC license.
111
111
  * See the LICENSE file in the root directory of this source tree.
112
- */const vW=Io("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),yW=/\{\{.*\}\}/;function U_(t){return typeof t=="string"&&yW.test(t)?"expression":"normal"}const q_=({field:t,disabled:e,readOnly:n,context:r})=>{const{renderVariableTag:o,renderVariableTooltip:i,validateVariable:s}=r,a=CW(t),l=t.keyPlaceholder||"Key",c=t.valuePlaceholder||"Value",u=0;return h.jsx(_.Form.List,{name:t.name,rules:a,children:(d,{add:f,remove:p},{errors:m})=>h.jsxs(_.Space,{direction:"vertical",style:{width:"100%"},children:[d.map(b=>h.jsx(G_,{field:t,listField:b,disabled:e,readOnly:n,canRemove:!(e||t.minItems!==void 0&&d.length<=t.minItems),keyPlaceholder:l,valuePlaceholder:c,valueModeSwitchOffset:u,onRemove:p,validateVariable:s,renderVariableTag:o,renderVariableTooltip:i},b.key)),h.jsx(_.Button,{block:!0,icon:h.jsx(br,{size:16}),onClick:()=>f(),disabled:e||t.maxItems!==void 0&&d.length>=t.maxItems,children:h.jsx(Te.FormattedMessage,{id:"app.common.word.add-field"})}),h.jsx(_.Form.ErrorList,{errors:m})]})})};q_.displayName="KeyValueFieldControl";const G_=({field:t,listField:e,disabled:n,readOnly:r,canRemove:o,keyPlaceholder:i,valuePlaceholder:s,valueModeSwitchOffset:a,onRemove:l,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})=>{const f=t.valueModePolicy,p=_.Form.useFormInstance(),[m,b]=y.useState(()=>{if(f){if(f==="BOTH"||f==="EXPRESSION")return"expression";if(f==="TEXT")return"normal"}const w=p.getFieldValue([t.name,e.name]),g=U_(w==null?void 0:w.key);return g==="expression"?g:U_(w==null?void 0:w.value)}),v=f==="TEXT"?["normal"]:["normal","expression"];return h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[h.jsx(_.Form.Item,{style:{flex:1,marginBottom:0,marginTop:a},name:[e.name,"key"],rules:[{required:!0,message:"请输入Key"}],children:h.jsx(Ci,{availableModes:v,mode:m,hideModeSwitch:!0,disabled:n,readOnly:r,placeholder:i,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})}),h.jsx(_.Form.Item,{style:{flex:1,marginBottom:0},name:[e.name,"value"],children:h.jsx(Ci,{availableModes:v,mode:m,onModeChange:b,disabled:n,readOnly:r,placeholder:s,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d,modeSwitchPosition:"top-right",compact:!0})}),h.jsx(_.Button,{icon:h.jsx(xi,{size:16}),onClick:()=>l(e.name),disabled:!o})]})};G_.displayName="KeyValueRow";function CW(t){var n;const e=[];if((n=t.rules)!=null&&n.some(r=>r.type==="required")){const r=t.rules.find(o=>o.type==="required");e.push({validator:async(o,i)=>{if(!i||i.length===0)throw new Error((r==null?void 0:r.message)||"此项为必填")}})}if(t.minItems!==void 0){const r=t.minItems;e.push({validator:async(o,i)=>{if(!i||i.length<r)throw new Error(`至少需要 ${r} 项`)}})}if(t.maxItems!==void 0){const r=t.maxItems;e.push({validator:async(o,i)=>{if(i&&i.length>r)throw new Error(`最多允许 ${r} 项`)}})}return e}const kW=Mo(q_,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});function SW(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.name=="string"&&e.name.trim()!==""&&typeof e.type=="string"}function EW(t){return!t||typeof t!="object"||Array.isArray(t)?[]:Object.values(t).filter(SW)}const R_=({field:t,disabled:e,readOnly:n,context:r})=>{const o=_.Form.useFormInstance(),s=xW(t.name),[a,l]=vt.useState(null);vt.useEffect(()=>{Promise.resolve().then(()=>_U).then(g=>{l(()=>g.FieldRenderer)})},[]);const{renderVariableTag:c,renderVariableTooltip:u,validateVariable:d,values:f,optionsLoader:p}=r,m=vt.useMemo(()=>EW(t.properties),[t.properties]),b=o.getFieldValue(s)??qn(f,s.join("."))??{},v=h.jsx(_.Space,{direction:"vertical",style:{width:"100%"},children:m.map(g=>{const C=jg(g,t.valueModePolicy),S=[...s,g.name];return yl(C,b)&&a?h.jsx(a,{field:{...C,name:S},values:f,optionsLoader:p,disabled:e,renderVariableTag:c,renderVariableTooltip:u,validateVariable:d},S.join(".")):null})}),w=h.jsx(Wg,{policy:t.valueModePolicy,disabled:e,readOnly:n,children:v});return t.collapsible?h.jsx(_.Collapse,{defaultActiveKey:t.defaultCollapsed?[]:["main"],items:[{key:"main",label:t.label||t.name,children:w}]}):h.jsx(_.Card,{size:"small",title:t.label,children:w})};R_.displayName="ObjectFieldControl";function xW(t){return Array.isArray(t)?t:[t]}const DW=Mo(R_,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});var Od={exports:{}},_W=Od.exports,K_;function AW(){return K_||(K_=1,(function(t,e){(function(n,r){t.exports=r()})(_W,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",s="second",a="minute",l="hour",c="day",u="week",d="month",f="quarter",p="year",m="date",b="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(F){var N=["th","st","nd","rd"],P=F%100;return"["+F+(N[(P-20)%10]||N[P]||N[0])+"]"}},C=function(F,N,P){var I=String(F);return!I||I.length>=N?F:""+Array(N+1-I.length).join(P)+F},S={s:C,z:function(F){var N=-F.utcOffset(),P=Math.abs(N),I=Math.floor(P/60),z=P%60;return(N<=0?"+":"-")+C(I,2,"0")+":"+C(z,2,"0")},m:function F(N,P){if(N.date()<P.date())return-F(P,N);var I=12*(P.year()-N.year())+(P.month()-N.month()),z=N.clone().add(I,d),H=P-z<0,J=N.clone().add(I+(H?-1:1),d);return+(-(I+(P-z)/(H?z-J:J-z))||0)},a:function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},p:function(F){return{M:d,y:p,w:u,d:c,D:m,h:l,m:a,s,ms:i,Q:f}[F]||String(F||"").toLowerCase().replace(/s$/,"")},u:function(F){return F===void 0}},k="en",x={};x[k]=g;var D="$isDayjsObject",E=function(F){return F instanceof B||!(!F||!F[D])},O=function F(N,P,I){var z;if(!N)return k;if(typeof N=="string"){var H=N.toLowerCase();x[H]&&(z=H),P&&(x[H]=P,z=H);var J=N.split("-");if(!z&&J.length>1)return F(J[0])}else{var K=N.name;x[K]=N,z=K}return!I&&z&&(k=z),z||!I&&k},A=function(F,N){if(E(F))return F.clone();var P=typeof N=="object"?N:{};return P.date=F,P.args=arguments,new B(P)},T=S;T.l=O,T.i=E,T.w=function(F,N){return A(F,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var B=(function(){function F(P){this.$L=O(P.locale,null,!0),this.parse(P),this.$x=this.$x||P.x||{},this[D]=!0}var N=F.prototype;return N.parse=function(P){this.$d=(function(I){var z=I.date,H=I.utc;if(z===null)return new Date(NaN);if(T.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var J=z.match(v);if(J){var K=J[2]-1||0,ee=(J[7]||"0").substring(0,3);return H?new Date(Date.UTC(J[1],K,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)):new Date(J[1],K,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)}}return new Date(z)})(P),this.init()},N.init=function(){var P=this.$d;this.$y=P.getFullYear(),this.$M=P.getMonth(),this.$D=P.getDate(),this.$W=P.getDay(),this.$H=P.getHours(),this.$m=P.getMinutes(),this.$s=P.getSeconds(),this.$ms=P.getMilliseconds()},N.$utils=function(){return T},N.isValid=function(){return this.$d.toString()!==b},N.isSame=function(P,I){var z=A(P);return this.startOf(I)<=z&&z<=this.endOf(I)},N.isAfter=function(P,I){return A(P)<this.startOf(I)},N.isBefore=function(P,I){return this.endOf(I)<A(P)},N.$g=function(P,I,z){return T.u(P)?this[I]:this.set(z,P)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(P,I){var z=this,H=!!T.u(I)||I,J=T.p(P),K=function(j,Y){var W=T.w(z.$u?Date.UTC(z.$y,Y,j):new Date(z.$y,Y,j),z);return H?W:W.endOf(c)},ee=function(j,Y){return T.w(z.toDate()[j].apply(z.toDate("s"),(H?[0,0,0,0]:[23,59,59,999]).slice(Y)),z)},$=this.$W,U=this.$M,R=this.$D,te="set"+(this.$u?"UTC":"");switch(J){case p:return H?K(1,0):K(31,11);case d:return H?K(1,U):K(0,U+1);case u:var se=this.$locale().weekStart||0,be=($<se?$+7:$)-se;return K(H?R-be:R+(6-be),U);case c:case m:return ee(te+"Hours",0);case l:return ee(te+"Minutes",1);case a:return ee(te+"Seconds",2);case s:return ee(te+"Milliseconds",3);default:return this.clone()}},N.endOf=function(P){return this.startOf(P,!1)},N.$set=function(P,I){var z,H=T.p(P),J="set"+(this.$u?"UTC":""),K=(z={},z[c]=J+"Date",z[m]=J+"Date",z[d]=J+"Month",z[p]=J+"FullYear",z[l]=J+"Hours",z[a]=J+"Minutes",z[s]=J+"Seconds",z[i]=J+"Milliseconds",z)[H],ee=H===c?this.$D+(I-this.$W):I;if(H===d||H===p){var $=this.clone().set(m,1);$.$d[K](ee),$.init(),this.$d=$.set(m,Math.min(this.$D,$.daysInMonth())).$d}else K&&this.$d[K](ee);return this.init(),this},N.set=function(P,I){return this.clone().$set(P,I)},N.get=function(P){return this[T.p(P)]()},N.add=function(P,I){var z,H=this;P=Number(P);var J=T.p(I),K=function(U){var R=A(H);return T.w(R.date(R.date()+Math.round(U*P)),H)};if(J===d)return this.set(d,this.$M+P);if(J===p)return this.set(p,this.$y+P);if(J===c)return K(1);if(J===u)return K(7);var ee=(z={},z[a]=r,z[l]=o,z[s]=n,z)[J]||1,$=this.$d.getTime()+P*ee;return T.w($,this)},N.subtract=function(P,I){return this.add(-1*P,I)},N.format=function(P){var I=this,z=this.$locale();if(!this.isValid())return z.invalidDate||b;var H=P||"YYYY-MM-DDTHH:mm:ssZ",J=T.z(this),K=this.$H,ee=this.$m,$=this.$M,U=z.weekdays,R=z.months,te=z.meridiem,se=function(Y,W,X,re){return Y&&(Y[W]||Y(I,H))||X[W].slice(0,re)},be=function(Y){return T.s(K%12||12,Y,"0")},j=te||function(Y,W,X){var re=Y<12?"AM":"PM";return X?re.toLowerCase():re};return H.replace(w,(function(Y,W){return W||(function(X){switch(X){case"YY":return String(I.$y).slice(-2);case"YYYY":return T.s(I.$y,4,"0");case"M":return $+1;case"MM":return T.s($+1,2,"0");case"MMM":return se(z.monthsShort,$,R,3);case"MMMM":return se(R,$);case"D":return I.$D;case"DD":return T.s(I.$D,2,"0");case"d":return String(I.$W);case"dd":return se(z.weekdaysMin,I.$W,U,2);case"ddd":return se(z.weekdaysShort,I.$W,U,3);case"dddd":return U[I.$W];case"H":return String(K);case"HH":return T.s(K,2,"0");case"h":return be(1);case"hh":return be(2);case"a":return j(K,ee,!0);case"A":return j(K,ee,!1);case"m":return String(ee);case"mm":return T.s(ee,2,"0");case"s":return String(I.$s);case"ss":return T.s(I.$s,2,"0");case"SSS":return T.s(I.$ms,3,"0");case"Z":return J}return null})(Y)||J.replace(":","")}))},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(P,I,z){var H,J=this,K=T.p(I),ee=A(P),$=(ee.utcOffset()-this.utcOffset())*r,U=this-ee,R=function(){return T.m(J,ee)};switch(K){case p:H=R()/12;break;case d:H=R();break;case f:H=R()/3;break;case u:H=(U-$)/6048e5;break;case c:H=(U-$)/864e5;break;case l:H=U/o;break;case a:H=U/r;break;case s:H=U/n;break;default:H=U}return z?H:T.a(H)},N.daysInMonth=function(){return this.endOf(d).$D},N.$locale=function(){return x[this.$L]},N.locale=function(P,I){if(!P)return this.$L;var z=this.clone(),H=O(P,I,!0);return H&&(z.$L=H),z},N.clone=function(){return T.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},F})(),M=B.prototype;return A.prototype=M,[["$ms",i],["$s",s],["$m",a],["$H",l],["$W",c],["$M",d],["$y",p],["$D",m]].forEach((function(F){M[F[1]]=function(N){return this.$g(N,F[0],F[1])}})),A.extend=function(F,N){return F.$i||(F(N,B,A),F.$i=!0),A},A.locale=O,A.isDayjs=E,A.unix=function(F){return A(1e3*F)},A.en=x[k],A.Ls=x,A.p={},A}))})(Od)),Od.exports}var OW=AW();const Ht=Un(OW);var Td={exports:{}},TW=Td.exports,Y_;function NW(){return Y_||(Y_=1,(function(t,e){(function(n,r){t.exports=r()})(TW,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(s){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(s);var c=this.$utils(),u=(s||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(d){switch(d){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),d==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return d}}));return i.bind(this)(u)}}}))})(Td)),Td.exports}var BW=NW();const FW=Un(BW);var Nd={exports:{}},MW=Nd.exports,X_;function IW(){return X_||(X_=1,(function(t,e){(function(n,r){t.exports=r()})(MW,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,o=/\d/,i=/\d\d/,s=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(w){this[v]=+w}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(w){if(!w||w==="Z")return 0;var g=w.match(/([+-]|\d\d)/g),C=60*g[1]+(+g[2]||0);return C===0?0:g[0]==="+"?-C:C})(v)}],f=function(v){var w=l[v];return w&&(w.indexOf?w:w.s.concat(w.f))},p=function(v,w){var g,C=l.meridiem;if(C){for(var S=1;S<=24;S+=1)if(v.indexOf(C(S,0,w))>-1){g=S>12;break}}else g=v===(w?"pm":"PM");return g},m={A:[a,function(v){this.afternoon=p(v,!1)}],a:[a,function(v){this.afternoon=p(v,!0)}],Q:[o,function(v){this.month=3*(v-1)+1}],S:[o,function(v){this.milliseconds=100*+v}],SS:[i,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[s,u("seconds")],ss:[s,u("seconds")],m:[s,u("minutes")],mm:[s,u("minutes")],H:[s,u("hours")],h:[s,u("hours")],HH:[s,u("hours")],hh:[s,u("hours")],D:[s,u("day")],DD:[i,u("day")],Do:[a,function(v){var w=l.ordinal,g=v.match(/\d+/);if(this.day=g[0],w)for(var C=1;C<=31;C+=1)w(C).replace(/\[|\]/g,"")===v&&(this.day=C)}],w:[s,u("week")],ww:[i,u("week")],M:[s,u("month")],MM:[i,u("month")],MMM:[a,function(v){var w=f("months"),g=(f("monthsShort")||w.map((function(C){return C.slice(0,3)}))).indexOf(v)+1;if(g<1)throw new Error;this.month=g%12||g}],MMMM:[a,function(v){var w=f("months").indexOf(v)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(v){this.year=c(v)}],YYYY:[/\d{4}/,u("year")],Z:d,ZZ:d};function b(v){var w,g;w=v,g=l&&l.formats;for(var C=(v=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(A,T,B){var M=B&&B.toUpperCase();return T||g[B]||n[B]||g[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(F,N,P){return N||P.slice(1)}))}))).match(r),S=C.length,k=0;k<S;k+=1){var x=C[k],D=m[x],E=D&&D[0],O=D&&D[1];C[k]=O?{regex:E,parser:O}:x.replace(/^\[|\]$/g,"")}return function(A){for(var T={},B=0,M=0;B<S;B+=1){var F=C[B];if(typeof F=="string")M+=F.length;else{var N=F.regex,P=F.parser,I=A.slice(M),z=N.exec(I)[0];P.call(T,z),A=A.replace(z,"")}}return(function(H){var J=H.afternoon;if(J!==void 0){var K=H.hours;J?K<12&&(H.hours+=12):K===12&&(H.hours=0),delete H.afternoon}})(T),T}}return function(v,w,g){g.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(c=v.parseTwoDigitYear);var C=w.prototype,S=C.parse;C.parse=function(k){var x=k.date,D=k.utc,E=k.args;this.$u=D;var O=E[1];if(typeof O=="string"){var A=E[2]===!0,T=E[3]===!0,B=A||T,M=E[2];T&&(M=E[2]),l=this.$locale(),!A&&M&&(l=g.Ls[M]),this.$d=(function(I,z,H,J){try{if(["x","X"].indexOf(z)>-1)return new Date((z==="X"?1e3:1)*I);var K=b(z)(I),ee=K.year,$=K.month,U=K.day,R=K.hours,te=K.minutes,se=K.seconds,be=K.milliseconds,j=K.zone,Y=K.week,W=new Date,X=U||(ee||$?1:W.getDate()),re=ee||W.getFullYear(),Z=0;ee&&!$||(Z=$>0?$-1:W.getMonth());var de,ve=R||0,we=te||0,fe=se||0,le=be||0;return j?new Date(Date.UTC(re,Z,X,ve,we,fe,le+60*j.offset*1e3)):H?new Date(Date.UTC(re,Z,X,ve,we,fe,le)):(de=new Date(re,Z,X,ve,we,fe,le),Y&&(de=J(de).week(Y).toDate()),de)}catch{return new Date("")}})(x,O,D,g),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),B&&x!=this.format(O)&&(this.$d=new Date("")),l={}}else if(O instanceof Array)for(var F=O.length,N=1;N<=F;N+=1){E[1]=O[N-1];var P=g.apply(this,E);if(P.isValid()){this.$d=P.$d,this.$L=P.$L,this.init();break}N===F&&(this.$d=new Date(""))}else S.call(this,k)}}}))})(Nd)),Nd.exports}var PW=IW();const LW=Un(PW);var Bd={exports:{}},$W=Bd.exports,J_;function zW(){return J_||(J_=1,(function(t,e){(function(n,r){t.exports=r()})($W,(function(){return function(n,r,o){var i=r.prototype,s=function(d){return d&&(d.indexOf?d:d.s)},a=function(d,f,p,m,b){var v=d.name?d:d.$locale(),w=s(v[f]),g=s(v[p]),C=w||g.map((function(k){return k.slice(0,m)}));if(!b)return C;var S=v.weekStart;return C.map((function(k,x){return C[(x+(S||0))%7]}))},l=function(){return o.Ls[o.locale()]},c=function(d,f){return d.formats[f]||(function(p){return p.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,b,v){return b||v.slice(1)}))})(d.formats[f.toUpperCase()])},u=function(){var d=this;return{months:function(f){return f?f.format("MMMM"):a(d,"months")},monthsShort:function(f){return f?f.format("MMM"):a(d,"monthsShort","months",3)},firstDayOfWeek:function(){return d.$locale().weekStart||0},weekdays:function(f){return f?f.format("dddd"):a(d,"weekdays")},weekdaysMin:function(f){return f?f.format("dd"):a(d,"weekdaysMin","weekdays",2)},weekdaysShort:function(f){return f?f.format("ddd"):a(d,"weekdaysShort","weekdays",3)},longDateFormat:function(f){return c(d.$locale(),f)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},o.localeData=function(){var d=l();return{firstDayOfWeek:function(){return d.weekStart||0},weekdays:function(){return o.weekdays()},weekdaysShort:function(){return o.weekdaysShort()},weekdaysMin:function(){return o.weekdaysMin()},months:function(){return o.months()},monthsShort:function(){return o.monthsShort()},longDateFormat:function(f){return c(d,f)},meridiem:d.meridiem,ordinal:d.ordinal}},o.months=function(){return a(l(),"months")},o.monthsShort=function(){return a(l(),"monthsShort","months",3)},o.weekdays=function(d){return a(l(),"weekdays",null,null,d)},o.weekdaysShort=function(d){return a(l(),"weekdaysShort","weekdays",3,d)},o.weekdaysMin=function(d){return a(l(),"weekdaysMin","weekdays",2,d)}}}))})(Bd)),Bd.exports}var HW=zW();const VW=Un(HW);var Fd={exports:{}},jW=Fd.exports,Q_;function WW(){return Q_||(Q_=1,(function(t,e){(function(n,r){t.exports=r()})(jW,(function(){return function(n,r){r.prototype.weekday=function(o){var i=this.$locale().weekStart||0,s=this.$W,a=(s<i?s+7:s)-i;return this.$utils().u(o)?a:this.subtract(a,"day").add(o,"day")}}}))})(Fd)),Fd.exports}var UW=WW();const qW=Un(UW);var Md={exports:{}},GW=Md.exports,Z_;function RW(){return Z_||(Z_=1,(function(t,e){(function(n,r){t.exports=r()})(GW,(function(){var n="week",r="year";return function(o,i,s){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=s(this).startOf(r).add(1,r).date(c),d=s(this).endOf(n);if(u.isBefore(d))return 1}var f=s(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),p=this.diff(f,n,!0);return p<0?s(this).startOf("week").week():Math.ceil(p)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Md)),Md.exports}var KW=RW();const YW=Un(KW);var Id={exports:{}},XW=Id.exports,eA;function JW(){return eA||(eA=1,(function(t,e){(function(n,r){t.exports=r()})(XW,(function(){return function(n,r){r.prototype.weekYear=function(){var o=this.month(),i=this.week(),s=this.year();return i===1&&o===11?s+1:o===0&&i>=52?s-1:s}}}))})(Id)),Id.exports}var QW=JW();const ZW=Un(QW);Ht.extend(LW),Ht.extend(FW),Ht.extend(qW),Ht.extend(VW),Ht.extend(YW),Ht.extend(ZW);function Cl(t,e){if(t==null||t==="")return null;if(Ht.isDayjs(t))return t.isValid()?t:null;const n=e?Ht(t,e):Ht(t);if(n.isValid())return n;const r=Ht(t);return r.isValid()?r:null}function tA(t,e){if(!Array.isArray(t))return null;const n=Cl(t[0],e),r=Cl(t[1],e);return n||r?[n,r]:null}function kl(t,e,n){if(t)return e==="timestamp"?t.valueOf():e==="string"?t.format(n):t}function nA(t,e,n){if(t)return[kl(t[0],e,n),kl(t[1],e,n)]}const eU="YYYY-MM-DD",rA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||eU,s=Cl(n,i);return h.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,picker:t.picker,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(kl(a,t.outputFormat,i)),id:o})};rA.displayName="DateFieldControl";const tU=ft(rA,{needsFormItemName:!0}),nU="YYYY-MM-DD",oA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||nU,s=tA(n,i);return h.jsx(_.DatePicker.RangePicker,{disabled:e,picker:t.picker,showTime:t.showTime,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(nA(a,t.outputFormat,i)),id:o})};oA.displayName="DateRangeFieldControl";const rU=ft(oA,{needsFormItemName:!0}),oU="YYYY-MM-DD HH:mm:ss",iA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||oU,s=Cl(n,i);return h.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,showTime:t.showTime??!0,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(kl(a,t.outputFormat,i)),id:o})};iA.displayName="DateTimeFieldControl";const iU=ft(iA,{needsFormItemName:!0}),sU="HH:mm:ss",sA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||sU,s=Cl(n,i);return h.jsx(_.TimePicker,{disabled:e,placeholder:t.placeholder,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(kl(a,t.outputFormat,i)),id:o})};sA.displayName="TimeFieldControl";const aU=ft(sA,{needsFormItemName:!0}),lU="HH:mm:ss",aA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||lU,s=tA(n,i);return h.jsx(_.TimePicker.RangePicker,{disabled:e,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(nA(a,t.outputFormat,i)),id:o})};aA.displayName="TimeRangeFieldControl";const cU=ft(aA,{needsFormItemName:!0}),lA=({field:t})=>h.jsx(_.Divider,{children:t.label});lA.displayName="DividerFieldControl";const uU=Mo(lA,{isDisplayOnly:!0,needsFormItemName:!1}),cA=({value:t,onChange:e,id:n})=>h.jsx(_.Input,{type:"hidden",value:t,onChange:r=>e==null?void 0:e(r.target.value),id:n});cA.displayName="HiddenFieldControl";const dU=Mo(cA,{needsFormItemName:!0,isHidden:!0}),uA=({field:t})=>h.jsx(_.Alert,{message:t.label,description:t.description||t.placeholder,type:t.status||"info",showIcon:t.showIcon,closable:t.closable});uA.displayName="InfoCardFieldControl";const fU=Mo(uA,{isDisplayOnly:!0,needsFormItemName:!1}),dA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Input.TextArea,{disabled:e,placeholder:t.placeholder,rows:6,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});dA.displayName="JsonFieldControl";const hU=ft(dA,{needsFormItemName:!0}),fA=({field:t,value:e})=>h.jsx("span",{children:e||t.placeholder||t.defaultValue});fA.displayName="LabelFieldControl";const pU=ft(fA,{needsFormItemName:!0}),hA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Cascader,{disabled:e,placeholder:t.placeholder,options:t.options,changeOnSelect:t.changeOnSelect,multiple:t.multiple||void 0,showSearch:t.showSearch,value:n,onChange:(i,s)=>r==null?void 0:r(i),id:o});hA.displayName="CascaderFieldControl";const mU=ft(hA,{needsFormItemName:!0}),pA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Checkbox,{disabled:e,checked:n,onChange:i=>r==null?void 0:r(i.target.checked),id:o,children:t.placeholder});pA.displayName="CheckboxFieldControl";const gU=ft(pA,{needsFormItemName:!0,valuePropName:"checked"}),mA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Checkbox.Group,{disabled:e,options:t.options,value:n,onChange:i=>r==null?void 0:r(i)});mA.displayName="CheckboxGroupFieldControl";const wU=ft(mA,{needsFormItemName:!0}),gA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Radio.Group,{disabled:e,options:t.options,optionType:t.optionType,buttonStyle:t.buttonStyle,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});gA.displayName="RadioFieldControl";const bU=ft(gA,{needsFormItemName:!0}),wA=({field:t,disabled:e,context:n,value:r,onChange:o,id:i})=>{const{values:s,optionsLoader:a}=n,[l,c]=y.useState(bA(t)),[u,d]=y.useState(!1),f=t.type===ge.MULTI_SELECT||t.mode==="multiple",p=w=>!w||w.kind==="static"?[]:w.deps||[],m=y.useMemo(()=>{const g=p(t.optionsSource).map(C=>qn(s,C));return JSON.stringify(g)},[t.optionsSource,s]);y.useEffect(()=>{if(!t.optionsSource||t.optionsSource.kind==="static"){c(bA(t));return}const w=t.optionsSource;if(!a){c(w.fallbackOptions||t.options||[]);return}const C=p(w).reduce((x,D)=>(x[D]=qn(s,D),x),{}),S={...w.params||{},deps:C};d(!0);let k=!1;return a(w.action,S,{values:s}).then(x=>{k||c(x)}).catch(()=>{k||c(w.fallbackOptions||t.options||[])}).finally(()=>{k||d(!1)}),()=>{k=!0}},[m,t.optionsSource,t.options]);const b=()=>{var w;(w=n.eventHandlers)==null||w.onBlur(t.name)},v=()=>{var w;(w=n.eventHandlers)==null||w.onFocus(t.name)};return h.jsx(_.Select,{disabled:e,placeholder:t.placeholder,options:l,mode:f?"multiple":t.mode,showSearch:t.showSearch,allowClear:t.allowClear,maxTagCount:t.maxTagCount,loading:u,value:r,onChange:o,onBlur:b,onFocus:v,id:i})};wA.displayName="SelectFieldControl";function bA(t){var n;if((n=t.options)!=null&&n.length)return t.options;const e=t.optionsSource;return e?e.kind==="static"?e.items||[]:e.fallbackOptions||[]:[]}const vA=ft(wA,{supportsVariableInsert:!1,needsFormItemName:!0}),yA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Switch,{disabled:e,checkedChildren:t.checkedChildren,unCheckedChildren:t.unCheckedChildren,checked:n,onChange:r,id:o});yA.displayName="SwitchFieldControl";const vU=ft(yA,{needsFormItemName:!0,valuePropName:"checked"}),CA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.TreeSelect,{disabled:e,placeholder:t.placeholder,treeData:t.options,multiple:t.multiple,showSearch:t.showSearch,allowClear:t.allowClear,treeCheckable:t.treeCheckable,value:n,onChange:r,id:o});CA.displayName="TreeSelectFieldControl";const yU=ft(CA,{needsFormItemName:!0}),kA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.AutoComplete,{disabled:e,placeholder:t.placeholder,options:t.options,allowClear:t.allowClear,value:n,onChange:r,id:o});kA.displayName="AutoCompleteFieldControl";const CU=ft(kA,{needsFormItemName:!0}),SA=({disabled:t,value:e,onChange:n})=>h.jsx(_.ColorPicker,{disabled:t,value:e,onChange:(r,o)=>n==null?void 0:n(o)});SA.displayName="ColorPickerFieldControl";const kU=ft(SA,{needsFormItemName:!0}),EA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Mentions,{disabled:e,placeholder:t.placeholder,value:n,onChange:r,id:o});EA.displayName="MentionsFieldControl";const SU=ft(EA,{needsFormItemName:!0}),xA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Rate,{disabled:e,count:t.count,allowHalf:t.allowHalf,value:n,onChange:r,id:o});xA.displayName="RateFieldControl";const EU=ft(xA,{needsFormItemName:!0}),DA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Slider,{disabled:e,min:t.min,max:t.max,step:t.step,marks:t.marks,range:t.range,value:n,onChange:i=>r==null?void 0:r(i),id:o});DA.displayName="SliderFieldControl";const xU=ft(DA,{needsFormItemName:!0}),_A=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Upload,{disabled:e,accept:t.accept,maxCount:t.maxCount,listType:t.listType||"text",action:t.action,multiple:t.multiple,fileList:n,onChange:r,id:o,children:h.jsx(_.Button,{icon:h.jsx(ie.UploadOutlined,{}),disabled:e,children:"上传文件"})});_A.displayName="UploadFieldControl";const DU=ft(_A,{needsFormItemName:!0});function AA(t=Mc){t.register(ge.TEXT,q7),t.register(ge.TEXTAREA,U7),t.register(ge.NUMBER,j7),t.register(ge.PASSWORD,W7),t.register(ge.SELECT,vA),t.register(ge.MULTI_SELECT,vA),t.register(ge.RADIO,bU),t.register(ge.CHECKBOX,gU),t.register(ge.CHECKBOX_GROUP,wU),t.register(ge.SWITCH,vU),t.register(ge.CASCADER,mU),t.register(ge.TREE_SELECT,yU),t.register(ge.DATE,tU),t.register(ge.DATETIME,iU),t.register(ge.DATE_RANGE,rU),t.register(ge.TIME,aU),t.register(ge.TIME_RANGE,cU),t.register(ge.UPLOAD,DU),t.register(ge.RATE,EU),t.register(ge.SLIDER,xU),t.register(ge.COLOR_PICKER,kU),t.register(ge.MENTIONS,SU),t.register(ge.AUTO_COMPLETE,CU),t.register(ge.LABEL,pU),t.register(ge.HIDDEN,dU),t.register(ge.JSON,hU),t.register(ge.DIVIDER,uU),t.register(ge.INFO_CARD,fU),t.register(ge.ARRAY,R7),t.register(ge.OBJECT,DW),t.register(ge.KEY_VALUE,kW),t.register(ge.ARRAY_OBJECT,lW)}AA();const Gg=({field:t,disabled:e,required:n,readOnly:r,rules:o,values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u})=>{const d=Ic(),f=e??As(t.disabled,i,!1),p=n??As(t.required,i,!1),m=r??As(t.readOnly,i,!1),b=o??Ei(t.rules||[],i,t.type),v={values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u},w=d.get(t.type);if(!w)return h.jsxs("span",{children:["不支持的字段类型: ",t.type]});const{component:g,meta:C}=w;return C.isDisplayOnly?h.jsx(g,{field:t,disabled:f,readOnly:m,context:v}):C.isComplexField?h.jsx(_.Form.Item,{label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:p,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,children:h.jsx(g,{field:t,disabled:f,readOnly:m,context:v})}):C.isHidden?h.jsx(_.Form.Item,{name:C.needsFormItemName!==!1?t.name:void 0,hidden:!0,rules:b,valuePropName:C.valuePropName,validateTrigger:t.validateTrigger,children:h.jsx(g,{field:t,disabled:f,readOnly:m,context:v})}):h.jsx(_.Form.Item,{name:C.needsFormItemName!==!1?t.name:void 0,label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:p,rules:b,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,valuePropName:C.valuePropName,validateTrigger:t.validateTrigger,children:h.jsx(g,{field:t,disabled:f,readOnly:m,context:v})})},_U=Object.freeze(Object.defineProperty({__proto__:null,FieldRenderer:Gg},Symbol.toStringTag,{value:"Module"})),AU={meta:{name:"antd-5x-apple-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#007AFF",colorInfo:"#007AFF",colorSuccess:"#34C759",colorWarning:"#FF9F0A",colorError:"#FF3B30",colorTextBase:"#0B0B0F",colorBgBase:"#FFFFFF",colorBorder:"#D1D1D6",colorBorderSecondary:"#E5E5EA",colorPrimaryBorder:"#007AFF",colorPrimaryBorderHover:"#007AFF",colorPrimaryHover:"#0066D6",colorPrimaryActive:"#0056B3",controlOutlineWidth:2,controlOutline:"rgba(0, 122, 255, 0.25)",fontFamily:'"SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:10,borderRadiusSM:8,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:52,sizeUnit:4,sizeStep:4,padding:16,paddingXS:10,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:10,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)",boxShadowSecondary:"0 6px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06)",boxShadowTertiary:"0 2px 8px rgba(0,0,0,0.08)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:18,paddingInlineLG:20,paddingInlineSM:14,contentFontSize:14,contentFontSizeLG:16,contentFontSizeSM:14,primaryShadow:"0 2px 0 rgba(0,122,255,0.14)",dangerShadow:"0 2px 0 rgba(255,59,48,0.12)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:14},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:44,controlHeightLG:52,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:44,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:14,paddingInlineSM:12,paddingInlineLG:14,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:12,borderRadius:10,hoverBorderColor:"#C7C7CC",activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Layout:{headerBg:"#FFFFFF",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F2F2F7",siderBg:"#FFFFFF",triggerBg:"#F2F2F7"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Menu:{itemHeight:44,iconSize:16,collapsedIconSize:18,horizontalItemBorderRadius:10,itemBorderRadius:10},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:14},Notification:{},Pagination:{itemSize:44,itemSizeSM:36},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#007AFF"},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F2F2F7",headerSortActiveBg:"#EDEDF2",headerSortHoverBg:"#F2F2F7",rowHoverBg:"#F2F2F7",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:36,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},OU={meta:{name:"antd-5x-google-material3-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#1A73E8",colorInfo:"#1A73E8",colorSuccess:"#34A853",colorWarning:"#FBBC04",colorError:"#EA4335",colorTextBase:"#202124",colorBgBase:"#FFFFFF",colorBorder:"#DADCE0",colorBorderSecondary:"#E0E3E7",colorPrimaryBorder:"#1A73E8",colorPrimaryBorderHover:"#1A73E8",colorPrimaryHover:"#1967D2",colorPrimaryActive:"#174EA6",controlOutlineWidth:2,controlOutline:"rgba(26, 115, 232, 0.24)",fontFamily:'"Google Sans", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.5714285714285714,borderRadius:8,borderRadiusSM:4,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:56,controlHeightSM:40,controlHeightLG:64,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(60,64,67,0.16), 0 2px 6px rgba(60,64,67,0.12)",boxShadowSecondary:"0 2px 8px rgba(60,64,67,0.14)",boxShadowTertiary:"0 1px 3px rgba(60,64,67,0.12)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:40,controlHeightSM:32,controlHeightLG:48,paddingInline:24,paddingInlineLG:24,paddingInlineSM:16,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(26,115,232,0.20)",dangerShadow:"0 1px 0 rgba(234,67,53,0.18)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:4},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:40,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:14,paddingBlockSM:8,paddingBlockLG:16,borderRadius:4,hoverBorderColor:"#BDC1C6",activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},InputNumber:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Layout:{headerBg:"#202124",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8F9FA",siderBg:"#202124",triggerBg:"#303134"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:12,itemBorderRadius:12},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:16},Notification:{},Pagination:{itemSize:40,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#1A73E8"},Rate:{},Result:{},Segmented:{controlHeight:40},Select:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F8F9FA",headerSortActiveBg:"#F1F3F4",headerSortHoverBg:"#F3F5F6",rowHoverBg:"#F8F9FA",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 18px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},TU={meta:{name:"antd-5x-preline-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#2563EB",colorInfo:"#2563EB",colorSuccess:"#16A34A",colorWarning:"#F59E0B",colorError:"#EF4444",colorTextBase:"#0F172A",colorBgBase:"#FFFFFF",colorBorder:"#E5E7EB",colorBorderSecondary:"#E5E7EB",colorPrimaryBorder:"#3B82F6",colorPrimaryBorderHover:"#3B82F6",colorPrimaryHover:"#1D4ED8",colorPrimaryActive:"#1E40AF",controlOutlineWidth:1,controlOutline:"rgba(59, 130, 246, 0.45)",fontFamily:'Graphik, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:8,borderRadiusSM:6,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:48,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(15,23,42,0.06), 0 6px 18px rgba(15,23,42,0.08)",boxShadowSecondary:"0 1px 2px rgba(15,23,42,0.05), 0 10px 24px rgba(15,23,42,0.10)",boxShadowTertiary:"0 1px 2px rgba(15,23,42,0.06)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:8,borderRadiusSM:8,borderRadiusLG:10,controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineLG:18,paddingInlineSM:12,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(37,99,235,0.18)",dangerShadow:"0 1px 0 rgba(239,68,68,0.16)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:36,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:10,borderRadius:8,hoverBorderColor:"#D1D5DB",activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Layout:{headerBg:"#0B1220",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8FAFC",siderBg:"#0B1220",triggerBg:"#0F1A2E"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:8,itemBorderRadius:8},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:12},Notification:{},Pagination:{itemSize:36,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:22,trackMinWidth:44,handleSize:18},Table:{headerBg:"#F8FAFC",headerSortActiveBg:"#F1F5F9",headerSortHoverBg:"#F3F6FB",rowHoverBg:"#F8FAFC",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:6,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:6},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}};function NU(t){return"optionsSource"in t&&t.optionsSource&&t.optionsSource.kind!=="static"?t.optionsSource.deps||[]:[]}function BU(t){const e=[];for(const n of t.fields){const r=NU(n);if(r.length>0)for(const o of r)e.push({id:`auto-clear-${n.name}-on-${o}-change`,trigger:{type:"fieldChange",field:o},actions:[{type:"clearFields",targets:[n.name]}]})}return e}function FU(t,e,n=!0){return[...n?BU(t):[],...e||[]]}const MU={default:Bh,apple:AU,google:OU,preline:TU};function Rg({schema:t,disabled:e=!1,initialValues:n,onSubmit:r,onChange:o,onValuesObserved:i,submitLabel:s="提交",showReset:a=!1,resetLabel:l="重置",onReset:c,form:u,showSubmit:d=!0,optionsLoader:f,nodeId:p,mcpMode:m,validateVariable:b,renderVariableTag:v,renderVariableTooltip:w,availableVariables:g,theme:C,customTheme:S,locale:k,prefixCls:x,events:D,customHandlers:E,maxExecutionDepth:O,debugEvents:A,preRender:T}){var Y;const[B]=_.Form.useForm(),M=u||B,F=vt.useMemo(()=>{const W={};for(const X of t.fields)X.defaultValue!==void 0&&(W[X.name]=X.defaultValue);return{...W,...n||{}}},[t.fields,n]),N=vt.useMemo(()=>{const W=t.enableAutoEvents!==!1,X=t.events||[],re=D||[];return FU(t,[...X,...re],W)},[t,D]),P=h2({events:N,form:M,optionsLoader:f,customHandlers:E,maxExecutionDepth:O,debug:A}),I=vt.useRef({}),z=vt.useMemo(()=>{if(S)return S;if(C)return MU[C]},[S,C]),H=_.Form.useWatch([],M),J=vt.useMemo(()=>JSON.stringify({...F||{},...H||{}}),[F,H]),K=vt.useMemo(()=>({...F||{},...H||{}}),[J]),ee=vt.useRef(J);vt.useEffect(()=>{!i||ee.current===J||(ee.current=J,i(K))},[i,K,J]);const[$,U]=vt.useState({}),R=vt.useRef({});vt.useEffect(()=>{var X;const W={};for(const re of t.fields){const Z=yl(re,K);if(W[re.name]=Z,R.current[re.name]===!0&&Z===!1){const ve=$7(re),we=((X=re.visibleWhen)==null?void 0:X.clearOnHide)??!0;ve==="unregister"&&M.setFieldValue(re.name,we?void 0:M.getFieldValue(re.name))}}R.current=W,U(re=>{const Z=Object.keys(re),de=Object.keys(W);return Z.length===de.length&&de.every(ve=>re[ve]===W[ve])?re:W})},[t.fields,M,K]);const te=async W=>{const X=t.pruneInvisibleOnSubmit===!1?W:H7(t,W,$);await(r==null?void 0:r(X))},se=(W,X)=>{if(o==null||o(W,X),P.triggerFieldChange&&W){const re=I.current;for(const Z in W){const de=qn(re,Z),ve=W[Z];P.triggerFieldChange(Z,ve,de)}}I.current={...X}},be=d||a,j=vt.useMemo(()=>({nodeId:p,mcpMode:m,validateVariable:b,renderVariableTag:v,renderVariableTooltip:w,availableVariables:g}),[p,m,b,v,w,g]);return h.jsx(oC,{customTheme:z,locale:k,prefixCls:x,children:h.jsx(lC,{value:j,children:h.jsxs(_.Form,{form:M,disabled:e,autoComplete:"off",layout:t.layout||"vertical",labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,size:t.size,initialValues:F,onFinish:te,onValuesChange:se,className:"workflow-config-form",children:[T&&T,t.fields.map(W=>{if(!yl(W,K))return null;const re=e||As(W.disabled,K,!1),Z=As(W.required,K,!1),de=Ei(W.rules||[],K,W.type),ve=(W.rules||[]).some(fe=>fe.type==="required"),we=Z&&!ve?[qg(`${W.label||W.name}为必填项`),...de]:de;return h.jsx(Gg,{field:W,disabled:re,required:Z,rules:we,values:K,optionsLoader:f,validateVariable:b,renderVariableTag:v,renderVariableTooltip:w,eventHandlers:P.fieldEventHandlers},W.name)}),be&&h.jsx(_.Form.Item,{wrapperCol:{offset:((Y=t.labelCol)==null?void 0:Y.span)||0},children:h.jsxs(_.Space,{children:[a&&h.jsx(_.Button,{disabled:e,onClick:()=>{M.resetFields(),c==null||c()},children:l}),d&&h.jsx(_.Button,{type:"primary",htmlType:"submit",children:s})]})})]})})})}const Sl=()=>{const t=Pt();return y.useCallback((e,n=!1)=>{if(/^https?:\/\//i.test(e)){window.open(e,"_blank");return}if(t.onNavigate){t.onNavigate(e,n);return}n?window.open(e,"_blank"):ac.push(e)},[t.onNavigate])},Kg=y.forwardRef((t,e)=>{const n=Sl(),[r,o]=y.useState([]),[i,s]=y.useState("");y.useEffect(()=>{s(t.proxyId)},[t.proxyId]),y.useEffect(()=>{qf().then(c=>{o(c??[])})},[]);const a=()=>i;y.useImperativeHandle(e,()=>({getProxyId:a}));const l=c=>{s(c)};return h.jsxs(WB,{label:G("link.flow.use_proxy_gateway"),children:[h.jsxs(_.Select,{className:"proxy_id_select",value:i,dropdownStyle:{zIndex:Bc.nestedPopover},onChange:l,style:{width:"100%"},children:[h.jsx(_.Select.Option,{value:"0",children:h.jsx(Te.FormattedMessage,{id:"link.flow.do_not_use"})}),r.map(c=>h.jsx(_.Select.Option,{value:c.id,children:c.group_name},c.id))]}),h.jsxs("p",{className:"field-desc",children:[h.jsx(Te.FormattedMessage,{id:"link.flow.private_network_deployment"}),h.jsx("span",{style:{margin:"0 2px"},onClick:()=>{n("/setting/gateway")},children:h.jsx(Te.FormattedMessage,{id:"link.flow.proxy_gateway"})}),h.jsx(Te.FormattedMessage,{id:"link.flow.secure_connection"})]})]})}),IU="RDBMS_ACCOUNT",PU=t=>t===IU,OA=({formSchema:t,initialValues:e,connector:n,proxy_id:r,authType:o,onCancel:i,onSubmit:s})=>{const[a]=_.Form.useForm(),l=y.useRef(null),c=(n==null?void 0:n.deployment_type)!=="SaasApp",u=PU(o);y.useEffect(()=>{e&&a.setFieldsValue(e)},[a,e]);const d=async f=>{var m;const p=await a.validateFields();c&&(p.proxy_id=(m=l.current)==null?void 0:m.getProxyId()),s(p,f)};return h.jsxs("div",{className:Gr.formLayout,children:[h.jsxs("div",{className:Gr.formContent,children:[h.jsx(Rg,{schema:t,form:a,initialValues:e,showSubmit:!1,showReset:!1,customTheme:sc}),c?h.jsx(Kg,{proxyId:r||"0",ref:l}):null]}),h.jsx("div",{className:Gr.formActions,children:h.jsxs(_.Space,{children:[h.jsx(_.Button,{onClick:i,children:"取消"}),u?h.jsx(_.Button,{onClick:()=>d(!0),children:"测试连接"}):null,h.jsx(_.Button,{type:"primary",onClick:()=>d(!1),children:"保存"})]})})]})},LU=t=>h.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",value:Ht(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD")))}}),$U=t=>h.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",showTime:!0,value:Ht(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD hh:mm:ss")))}}),zU=({value:t=[],onChange:e,valueType:n})=>{const r=a=>{const l=[...t];l.splice(a,1),e==null||e(l)},o=()=>{e==null||e([...t,{key:"",value:""}])},i=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,key:l}:c))},s=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,value:l}:c))};return h.jsxs("div",{children:[t.map((a,l)=>h.jsxs(_.Space,{size:"small",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[h.jsx(_.Input,{value:a.key,onChange:c=>i(l,c.target.value),placeholder:"Key"}),h.jsx(_.Input,{placeholder:"Value",style:{width:300},value:a.value,onChange:c=>s(l,c.target.value)}),h.jsx(_.Button,{icon:h.jsx(xi,{size:16}),onClick:()=>{r(l)}})]},a.key)),h.jsxs(_.Button,{type:"default",onClick:o,block:!0,children:[h.jsx(br,{size:16})," ",h.jsx(Te.FormattedMessage,{id:"app.common.word.add-field"})]})]})},HU=t=>null;class Pd{constructor(e,n,r,o,i,s,a,l,c,u=0,d){this.p=e,this.stack=n,this.state=r,this.reducePos=o,this.pos=i,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let o=e.parser.context;return new Pd(e,[],n,r,r,0,[],0,o?new TA(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,o=e&65535,{parser:i}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(o);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,o,!0),this.reducePos),o<i.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(o,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[o])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-d;if(o<i.minRepeatTerm||e&131072){let p=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=i.getGoto(p,o,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(o,c)}storeNode(e,n,r,o=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,o);else{let s=this.buffer.length;if(s>0&&(this.buffer[s-4]!=0||this.buffer[s-1]<0)){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,o>4&&(o-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=o}}shift(e,n,r,o){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:s}=this.p;this.pos=o,!s.stateFlag(i,1)&&(o>r||n<=s.maxNode)&&(this.reducePos=o),this.pushState(i,Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=s.maxNode&&this.buffer.push(n,r,o,4)}else this.pos=o,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,o,4)}apply(e,n,r,o){e&65536?this.reduce(e):this.shift(e,n,r,o)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(n,o),this.buffer.push(r,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),o=e.bufferBase+n;for(;e&&o==e.bufferBase;)e=e.parent;return new Pd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new VU(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let o=[];for(let i=0,s;i<n.length;i+=2)(s=n[i+1])!=this.state&&this.p.parser.hasAction(s,e)&&o.push(n[i],s);if(this.stack.length<120)for(let i=0;o.length<8&&i<n.length;i+=2){let s=n[i+1];o.some((a,l)=>l&1&&a==s)||o.push(n[i],s)}n=o}let r=[];for(let o=0;o<n.length&&r.length<4;o+=2){let i=n[o+1];if(i==this.state)continue;let s=this.split();s.pushState(i,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[o],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,o=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],o,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(o,i)=>{if(!n.includes(o))return n.push(o),e.allActions(o,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-i;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new TA(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class TA{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class VU{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=o}}class Ld{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new Ld(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Ld(this.stack,this.pos,this.index)}}function $d(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,o=0;r<t.length;){let i=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){i=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[o++]=i:n=new e(i)}return n}class zd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const NA=new zd;class jU{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=NA,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,o=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!o)return null;let s=this.ranges[--o];i-=r.from-s.to,r=s}for(;n<0?i>r.to:i>=r.to;){if(o==this.ranges.length-1)return null;let s=this.ranges[++o];i+=s.from-r.to,r=s}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,o;if(n>=0&&n<this.chunk.length)r=this.pos+e,o=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),o=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),o}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=NA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let o of this.ranges){if(o.from>=n)break;o.to>e&&(r+=this.input.read(Math.max(o.from,e),Math.min(o.to,n)))}return r}}class Os{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;WU(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Os.prototype.contextual=Os.prototype.fallback=Os.prototype.extend=!1,Os.prototype.fallback=Os.prototype.extend=!1;function WU(t,e,n,r,o,i){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let p=s+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||UU(m,e.token.value,o,i))){e.acceptToken(m);break}}let u=e.next,d=0,f=t[s+2];if(e.next<0&&f>d&&t[c+f*3-3]==65535){s=t[c+f*3-1];continue e}for(;d<f;){let p=d+f>>1,m=c+p+(p<<1),b=t[m],v=t[m+1]||65536;if(u<b)f=p;else if(u>=v)d=p+1;else{s=t[m+2],e.advance();continue e}}break}}function BA(t,e,n){for(let r=e,o;(o=t[r])!=65535;r++)if(o==n)return r-e;return-1}function UU(t,e,n,r){let o=BA(n,r,e);return o<0||BA(n,r,t)<o}const Pn=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let Yg=null;function FA(t,e,n){let r=t.cursor(Ct.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class qU{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?FA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?FA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],o=this.index[n];if(o==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[o],s=this.start[n]+r.positions[o];if(s>e)return this.nextStart=s,null;if(i instanceof xt){if(s==e){if(s<this.safeFrom)return null;let a=s+i.length;if(a<=this.safeTo){let l=i.prop(Qe.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[n]++,s+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+i.length}}}class GU{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new zd)}getActions(e){let n=0,r=null,{parser:o}=e.p,{tokenizers:i}=o,s=o.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<i.length;c++){if((1<<c&s)==0)continue;let u=i[c],d=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||d.start!=e.pos||d.mask!=s||d.context!=a)&&(this.updateCachedToken(d,u,e),d.mask=s,d.context=a),d.lookAhead>d.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let f=n;if(d.extended>-1&&(n=this.addActions(e,d.extended,d.end,n)),n=this.addActions(e,d.value,d.end,n),!u.extend&&(r=d,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new zd,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new zd,{pos:r,p:o}=e;return n.start=r,n.end=Math.min(r+1,o.stream.end),n.value=r==o.stream.end?o.parser.eofTerm:0,n}updateCachedToken(e,n,r){let o=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(o,e),r),e.value>-1){let{parser:i}=r.p;for(let s=0;s<i.specialized.length;s++)if(i.specialized[s]==e.value){let a=i.specializers[s](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,n,r,o){for(let i=0;i<o;i+=3)if(this.actions[i]==e)return o;return this.actions[o++]=e,this.actions[o++]=n,this.actions[o++]=r,o}addActions(e,n,r,o){let{state:i}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(i,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=ro(a,c+2);else{o==0&&a[c+1]==2&&(o=this.putAction(ro(a,c+2),n,r,o));break}a[c]==n&&(o=this.putAction(ro(a,c+1),n,r,o))}return o}}class RU{constructor(e,n,r,o){this.parser=e,this.input=n,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new jU(n,o),this.tokens=new GU(e,this.stream),this.topTerm=e.top[1];let{from:i}=o[0];this.stacks=[Pd.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new qU(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],o,i;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{o||(o=[],i=[]),o.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!r.length){let s=o&&YU(o);if(s)return Pn&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Pn&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&o){let s=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,i,r);if(s)return Pn&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,l)=>l.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let s=0;s<r.length-1;s++){let a=r[s];for(let l=s+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(s--,1);continue e}}}r.length>12&&(r.sort((s,a)=>a.score-s.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let s=1;s<r.length;s++)r[s].pos<this.minStackPos&&(this.minStackPos=r[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let o=e.pos,{parser:i}=this,s=Pn?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(o);d;){let f=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(e.state,d.type.id):-1;if(f>-1&&d.length&&(!c||(d.prop(Qe.contextHash)||0)==u))return e.useNode(d,f),Pn&&console.log(s+this.stackID(e)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof xt)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof xt&&d.positions[0]==0)d=p;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),Pn&&console.log(s+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],d=l[c++],f=l[c++],p=c==l.length||!r,m=p?e:e.split(),b=this.tokens.mainToken;if(m.apply(u,d,b?b.start:m.pos,f),Pn&&console.log(s+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${i.getName(u&65535)}`} for ${i.getName(d)} @ ${o}${m==e?"":", split"})`),p)return!0;m.pos>o?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return MA(e,n),!0}}runRecovery(e,n,r){let o=null,i=!1;for(let s=0;s<e.length;s++){let a=e[s],l=n[s<<1],c=n[(s<<1)+1],u=Pn?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),Pn&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let d=a.split(),f=u;for(let p=0;p<10&&d.forceReduce()&&(Pn&&console.log(f+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,r));p++)Pn&&(f=this.stackID(d)+" -> ");for(let p of a.recoverByInsert(l))Pn&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Pn&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),MA(a,r)):(!o||o.score<d.score)&&(o=d)}return o}stackToTree(e){return e.close(),xt.build({buffer:Ld.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(Yg||(Yg=new WeakMap)).get(e);return n||Yg.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function MA(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class KU{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class Hd extends EC{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),o=[];for(let a=0;a<n.length;a++)o.push([]);function i(a,l,c){o[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Qe[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)i(u,l,a[c++]);else{let d=a[c+-u];for(let f=-u;f>0;f--)i(a[c++],l,d);c++}}}this.nodeSet=new Lh(n.map((a,l)=>vn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:o[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=wC;let s=$d(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(IA),this.states=$d(e.states,Uint32Array),this.data=$d(e.stateData),this.goto=$d(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Os(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let o=new RU(this,e,n,r);for(let i of this.wrappers)o=i(o,e,n,r);return o}getGoto(e,n,r=!1){let o=this.goto;if(n>=o[0])return-1;for(let i=o[n+1];;){let s=o[i++],a=s&1,l=o[i++];if(a&&r)return l;for(let c=i+(s>>1);i<c;i++)if(o[i]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let o=0;o<2;o++)for(let i=this.stateSlot(e,o?2:1),s;;i+=3){if((s=r[i])==65535)if(r[i+1]==1)s=r[i=ro(r,i+2)];else{if(r[i+1]==2)return ro(r,i+2);break}if(s==n||s==0)return ro(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),o=r?n(r):void 0;for(let i=this.stateSlot(e,1);o==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ro(this.data,i+2);else break;o=n(ro(this.data,i+1))}return o}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=ro(this.data,r+2);else break;if((this.data[r+2]&1)==0){let o=this.data[r+1];n.some((i,s)=>s&1&&i==o)||n.push(this.data[r],o)}}return n}configure(e){let n=Object.assign(Object.create(Hd.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let o=e.tokenizers.find(i=>i.from==r);return o?o.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,o)=>{let i=e.specializers.find(a=>a.from==r.external);if(!i)return r;let s=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[o]=IA(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let s=n.indexOf(i);s>=0&&(r[s]=!0)}let o=null;for(let i=0;i<n.length;i++)if(!r[i])for(let s=this.dialects[n[i]],a;(a=this.data[s++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[a]=1;return new KU(e,r,o)}static deserialize(e){return new Hd(e)}}function ro(t,e){return t[e]|t[e+1]<<16}function YU(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function IA(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const XU=xC({String:V.string,Number:V.number,"True False":V.bool,PropertyName:V.propertyName,Null:V.null,", :":V.separator,"[ ]":V.squareBracket,"{ }":V.brace}),JU=Hd.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[XU],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),QU=Au.define({name:"json",parser:JU.configure({props:[rS.add({Object:iS({except:/^\s*\}/}),Array:iS({except:/^\s*\]/})}),sS.add({"Object Array":o8})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function PA(){return new G3(QU)}const ZU=t=>h.jsx(td,{height:"300px",style:{borderRadius:4,overflow:"hidden"},theme:bm,extensions:[PA()],...t}),{Text:eq}=_.Typography,tq=t=>h.jsx("div",{style:{padding:6,paddingRight:0,border:"1px solid #b0b5cb",borderRadius:4},children:h.jsx(_.Tooltip,{title:t.value,color:"cyan",placement:"topLeft",styles:{body:{width:500}},children:h.jsx(eq,{style:{color:"#b0b5cb"},ellipsis:!0,copyable:{text:t.value},children:t.value})})}),nq=t=>h.jsx(_.Input.Password,{addonBefore:G("link.flow.cipherText"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),rq=t=>{var r;const{multiple:e,...n}=t;return h.jsx(_.Select,{style:{borderRadius:6},mode:e?"multiple":void 0,...n,getPopupContainer:o=>o.parentNode,children:(r=t==null?void 0:t.options)==null?void 0:r.map(o=>h.jsx(_.Select.Option,{label:o.label,value:o.value,children:o.label},o.value))})},{TextArea:oq}=_.Input,iq=t=>h.jsx(oq,{value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),sq=t=>h.jsx(_.Input,{addonBefore:G("link.flow.text"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),aq=t=>h.jsx(_.TimePicker,{style:{width:"100%"},value:Ht(t.value??"00:00:00","HH:mm:ss"),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("HH:mm:ss")))}}),lq={configFormContainer:"_configFormContainer_s061b_1"},cq=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],Xg=t=>Array.isArray(t)?t.map(e=>{if(typeof e=="string"){const s=e.trim();return s?{label:s,value:s}:null}const n=(e==null?void 0:e.value)??(e==null?void 0:e.label)??"",r=n==null?"":String(n).trim();if(!r)return null;const o=(e==null?void 0:e.label)??"";return{label:o==null?r:String(o).trim()||r,value:r}}).filter(Boolean):[],uq=t=>{const e=t.display_name;switch(t.page_control){case Ee.SELECT:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_select")+t.display_name}],label:e,name:t.name,children:h.jsx(rq,{options:Xg(t.option_value_objects??t.option_values),multiple:t.multi_valued})},t.ui_id);case Ee.EXTEND_OBJ:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(zU,{valueType:t.value_type})},t.ui_id);case Ee.HIDDEN:return h.jsx(_.Form.Item,{style:{display:"none"},required:t.required,label:e,name:t.name,children:h.jsx(HU,{})},t.ui_id);case Ee.TEXT:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(sq,{})},t.ui_id);case Ee.PASSWORD:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(nq,{})},t.ui_id);case Ee.LABEL:return h.jsx(_.Form.Item,{required:t.required,label:e,name:t.name,children:h.jsx(tq,{})},t.ui_id);case Ee.DATE:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(LU,{})},t.ui_id);case Ee.TIME:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(aq,{})},t.ui_id);case Ee.DATETIME:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx($U,{})},t.ui_id);case Ee.TEXTAREA:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(iq,{})},t.ui_id);case Ee.FIXED_OBJ:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(_.Input.TextArea,{})},t.ui_id);case Ee.JSON:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(ZU,{})},t.ui_id)}},dq=t=>{switch(t.page_control){case Ee.SELECT:return t.multi_valued?[]:null;case Ee.EXTEND_OBJ:return{};case Ee.HIDDEN:return"";case Ee.TEXT:return"";case Ee.PASSWORD:return"";case Ee.LABEL:return"";case Ee.DATE:return null;case Ee.TIME:return null;case Ee.DATETIME:return null;case Ee.TEXTAREA:return"";case Ee.FIXED_OBJ:return"";case Ee.JSON:return JSON.stringify({})}},LA=y.memo(t=>{var c;const{config:e,proxy_id:n,connector:r}=t,[o]=_.Form.useForm(),i=y.useRef(null),s=St.useReactive({proxyId:"0"});y.useEffect(()=>{var u;(u=e==null?void 0:e.sub_params)!=null&&u.length&&o.setFieldsValue({...e.sub_params.reduce((d,f)=>{let p=f.value;return f.page_control===Ee.EXTEND_OBJ&&(p=cq(p)),d[f.name]=p??dq(f),d},{})})},[e,o]),y.useEffect(()=>{n&&(s.proxyId=n)},[n]);const a=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u)})},l=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u,!0)})};return h.jsxs("div",{className:Gr.formLayout,style:{position:"relative"},onClick:u=>{u.stopPropagation(),u.preventDefault()},children:[h.jsx("div",{className:Gr.formContent,children:h.jsxs(_.Form,{form:o,layout:"vertical",className:`${lq.configFormContainer} workflow-credential-form`,children:[(c=e==null?void 0:e.sub_params)==null?void 0:c.map(u=>h.jsxs("div",{children:[uq(u),u.page_control!==Ee.HIDDEN&&h.jsx("p",{className:"field-desc",children:u.description})]},u.ui_id)),r.deployment_type!=="SaasApp"?h.jsx(Kg,{proxyId:s.proxyId,ref:i}):null]})}),t.auth_type==="RDBMS_ACCOUNT"&&h.jsx("div",{className:Gr.rdbmsTestAction,children:h.jsx(_.Button,{type:"primary",style:{width:"100%"},onClick:l,children:h.jsx(Te.FormattedMessage,{id:"app.common.word.connection-test"})})}),h.jsxs("div",{className:Gr.formActions,children:[h.jsx(_.Button,{icon:h.jsx(ie.RollbackOutlined,{}),style:{width:90,borderRadius:4,marginRight:10},onClick:t.onCancel,children:h.jsx(Te.FormattedMessage,{id:"app.common.word.cancel"})}),h.jsx(_.Button,{type:"primary",icon:h.jsx(ie.CloudUploadOutlined,{}),style:{width:90,borderRadius:4},onClick:()=>a(),children:h.jsx(Te.FormattedMessage,{id:"app.common.word.save"})})]})]})}),fq={overflow:"hidden"},hq=72,pq=16,mq=t=>{const{visible:e,connector:n,config:r,formSchema:o,onCancel:i,onSubmit:s,auth_type:a,inAI:l}=t;return h.jsx(_.Modal,{title:h.jsx(Te.FormattedMessage,{id:"app.common.word.add-account"}),style:{marginTop:0,paddingBottom:0,position:"absolute",top:hq,bottom:pq,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Gr.accountModal,mask:!1,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:Bc.nestedModal,width:560,styles:{body:fq},footer:null,maskClosable:!l,open:e,onCancel:i,children:o?h.jsx(OA,{formSchema:o,connector:n,authType:a,onCancel:i,onSubmit:s}):h.jsx(LA,{config:r,connector:n,nodeId:"",auth_type:a,onCancel:i,onSubmit:s})})},gq={overflow:"hidden"},wq=72,bq=16,vq=t=>{const{visible:e,connector:n,config:r,formSchema:o,initialValues:i,onCancel:s,onSubmit:a,auth_type:l,proxy_id:c,inAI:u}=t;return h.jsx(_.Modal,{title:G("link.flow.edit_account"),mask:!1,style:{marginTop:0,paddingBottom:0,position:"absolute",top:wq,bottom:bq,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Gr.accountModal,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:Bc.nestedModal,width:560,footer:null,styles:{body:gq},open:e,maskClosable:!u,onCancel:s,children:o?h.jsx(OA,{formSchema:o,initialValues:i,connector:n,proxy_id:c,authType:l,onCancel:s,onSubmit:a}):h.jsx(LA,{config:r,proxy_id:c,connector:n,nodeId:"",auth_type:l,onCancel:s,onSubmit:a})})},Di={accountOption:"_accountOption_4vdjt_14",accountName:"_accountName_4vdjt_21",nameEditIcon:"_nameEditIcon_4vdjt_34",editInputWrapper:"_editInputWrapper_4vdjt_44",nameEditInput:"_nameEditInput_4vdjt_48",accountActions:"_accountActions_4vdjt_53",updateTime:"_updateTime_4vdjt_58"},yq=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],Jg=(t=[])=>{const e={};return t.forEach(n=>{e[n.key]=n.value}),e},Cq={eq:"EQ",ne:"NOT",in:"IN",notin:"NOT_IN",not_in:"NOT_IN",gt:"GT",lt:"LT",gte:"GE",lte:"LE"};function kq(t){if(!(t!=null&&t.field)||!t.operator)return;const e=Cq[String(t.operator).toLowerCase()];if(e)return{deps:[t.field],conditions:{key:t.field,keyword:e,value:t.value}}}function Sq(t){return an(t.visible_when)??kq(t.display_condition)}const $A={STRING:ge.TEXT,TEXTAREA:ge.TEXTAREA,PASSWORD:ge.PASSWORD,HIDDEN:ge.HIDDEN,NUMBER:ge.NUMBER,BOOLEAN:ge.SWITCH,SELECT:ge.SELECT,DATETIME:ge.DATETIME,CODE:ge.CODE,PROXY:ge.PROXY,OBJECT:ge.OBJECT,ARRAY:ge.ARRAY,DYNAMIC_ARRAY:ge.ARRAY,KEYVALUE:ge.KEY_VALUE},zA=t=>String(t.type??"").toUpperCase(),Eq=t=>t.item_schema??[],HA=t=>String(t.item_type??"").toUpperCase(),an=t=>t??void 0,xq=t=>Object.fromEntries((t??[]).map(e=>[e.key,Zg(e)])),Dq=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?ge.DATE:e==="TIME"?ge.TIME:ge.DATETIME},Qg=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?"YYYY-MM-DD":e==="TIME"?"HH:mm:ss":"YYYY-MM-DD HH:mm:ss"},_q=t=>({type:$A[HA(t)]||ge.TEXT,name:"item",label:t.item_label||"项"}),Aq=t=>t.some(e=>e.name==="name")?"name":void 0;function Oq(t){if(!t)return[];const e=[],n=t.minLength??t.min_length,r=t.maxLength??t.max_length;return n!=null&&e.push({type:"min",value:n,message:`最少 ${n} 个字符`}),r!=null&&e.push({type:"max",value:r,message:`最多 ${r} 个字符`}),t.pattern&&e.push({type:"pattern",value:t.pattern,message:"格式不正确"}),t.min!=null&&e.push({type:"min",value:t.min,message:`最小值 ${t.min}`}),t.max!=null&&e.push({type:"max",value:t.max,message:`最大值 ${t.max}`}),e}function Zg(t){var r,o,i;const e=zA(t)==="DATETIME"?Dq(t):$A[zA(t)]||ge.TEXT,n={type:e,name:t.key,label:t.label||t.key,placeholder:an(t.placeholder),helpText:an(t.help_text),defaultValue:an(t.default_value),required:an(t.required),disabled:an(t.disabled),visibleWhen:Sq(t),rules:Oq(t.validation),valueModePolicy:an(t.value_mode_policy)};switch(e){case ge.SELECT:return{...n,type:ge.SELECT,options:(r=t.options)==null?void 0:r.map(s=>({label:s.label,value:s.value})),showSearch:!0,allowClear:!0};case ge.NUMBER:return{...n,type:ge.NUMBER,min:an((o=t.validation)==null?void 0:o.min),max:an((i=t.validation)==null?void 0:i.max)};case ge.DATETIME:return{...n,type:ge.DATETIME,showTime:!0,format:Qg(t),outputFormat:"string"};case ge.DATE:return{...n,type:ge.DATE,format:Qg(t),outputFormat:"string"};case ge.TIME:return{...n,type:ge.TIME,format:Qg(t),outputFormat:"string"};case ge.OBJECT:return{...n,type:ge.OBJECT,properties:xq(t.properties)};case ge.ARRAY:if(HA(t)==="OBJECT"){const s=Eq(t).map(Zg);return{...n,type:ge.ARRAY_OBJECT,columns:s,minItems:an(t.min_items),maxItems:an(t.max_items),columnLayout:s.length>1?"grid":"vertical",titleFieldName:Aq(s)}}return{...n,type:ge.ARRAY,itemSchema:_q(t),minItems:an(t.min_items),maxItems:an(t.max_items),itemLabel:an(t.item_label)};case ge.KEY_VALUE:return{...n,type:ge.KEY_VALUE,keyPlaceholder:an(t.key_placeholder),valuePlaceholder:an(t.value_placeholder)};default:return n}}function VA(t){return{fields:t.map(Zg),layout:"vertical"}}const jA=(...t)=>{for(const e of t)if(typeof e=="string"&&e.trim())return e.trim()};function Tq(t){if(!t)return null;const e=jA(t.key,t.credentialKey,t.name);return e?{key:e,label:jA(t.displayName,t.label,t.name,e)??e,required:t.required===!0}:null}function ew(t){if(!Array.isArray(t))return[];const e=[],n=new Set;for(const r of t){const o=Tq(r);!o||n.has(o.key)||(n.add(o.key),e.push(o))}return e}function Nq(t){var n,r;const e=ew(t);return((n=e.find(o=>o.required))==null?void 0:n.key)??((r=e[0])==null?void 0:r.key)}const Bq=_.Form.Item,{Option:Fq}=_.Select,{Text:Mq,Title:dre}=_.Typography,Ts="[workflow:account-debug]",Iq=t=>!!(t&&/^\d+$/.test(t)),_i=t=>t&&typeof t=="object"&&!Array.isArray(t)?Object.keys(t):[],Pq=t=>Array.isArray(t)?t.map(e=>e==null?void 0:e.key).filter(Boolean):[],Lq=t=>!!(t&&typeof t=="object"&&Array.isArray(t.sub_params)),$q=t=>[t==null?void 0:t.auth_schema,t==null?void 0:t.config_schema,t==null?void 0:t.schema,t].find(Lq)??{},WA=t=>{var o,i,s,a,l;const e=(o=t==null?void 0:t.credential_schema)==null?void 0:o.fields,n=(i=t==null?void 0:t.auth_schema)==null?void 0:i.sub_params,r=((s=t==null?void 0:t.config_schema)==null?void 0:s.sub_params)??(t==null?void 0:t.sub_params);return{type:Array.isArray(t)?"array":t===null?"null":typeof t,keys:_i(t),id:t==null?void 0:t.id,auth_type:t==null?void 0:t.auth_type,account_key:(t==null?void 0:t.account_key)??((a=t==null?void 0:t.credential_schema)==null?void 0:a.key),account_ver:(t==null?void 0:t.account_ver)??((l=t==null?void 0:t.credential_schema)==null?void 0:l.version),credentialSchemaKeys:_i(t==null?void 0:t.credential_schema),credentialFieldCount:Array.isArray(e)?e.length:void 0,credentialFieldKeys:Pq(e),authSchemaKeys:_i(t==null?void 0:t.auth_schema),authSchemaSubParamCount:Array.isArray(n)?n.length:void 0,authSchemaSubParamNames:Array.isArray(n)?n.map(c=>c==null?void 0:c.name).filter(Boolean):void 0,configSchemaKeys:_i(t==null?void 0:t.config_schema),configSubParamCount:Array.isArray(r)?r.length:void 0}},tw=t=>({keys:_i(t),subParamCount:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.length:0,subParamNames:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.name).filter(Boolean):[],subParamControls:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.page_control).filter(Boolean):[]}),Vd=(t,e)=>{var n,r;return{account_key:(t==null?void 0:t.account_key)??((n=t==null?void 0:t.credential_schema)==null?void 0:n.key)??e??null,account_ver:(t==null?void 0:t.account_ver)??((r=t==null?void 0:t.credential_schema)==null?void 0:r.version)??null}},UA=t=>{const e=t==null?void 0:t.credential_schema,n=e==null?void 0:e.fields;return(!Array.isArray(n)||!n.length)&&console.warn(`${Ts} credential_schema.fields missing or empty`,{model:WA(t)}),Array.isArray(n)&&n.length?VA(n):null},zq=({value:t,onChange:e,linkApp:n,actionAccountSchemaId:r,selectTitle:o="授权配置",disabled:i=!1,placeholder:s="请选择账号"})=>{const[a,l]=y.useState([]),[c,u]=y.useState(!1),[d,f]=y.useState(!1),[p,m]=y.useState(!1),b=y.useRef(null),v=y.useRef(null),w=_.Form.useFormInstance(),g=y.useMemo(()=>r?`_account_${r}`:"_account",[r]);y.useEffect(()=>{w&&w.validateFields([g]).catch(()=>{})},[t,w,g]);const C=St.useReactive({createModalVisible:!1,modifyModalVisible:!1,configModel:{},credentialFormSchema:null,credentialInitialValues:{},schemaMeta:{},account_scheme_id:"",name:"",auth_type:"",modifyId:"",proxy_id:"",editId:"",editValue:"",createLoading:!1,createRequestLock:!1,isEditing:!1}),S=r==null?void 0:String(r),k=async()=>{if(!(!(n!=null&&n.id)&&!S)){u(!0);try{const I=Iq(S)?n==null?void 0:n.id:void 0,z=await Gy(I,S);z?l(z.items||[]):_.message.error("获取账号列表失败")}catch(I){console.error(`${Ts} 获取账号列表失败:`,I),_.message.error("获取账号列表失败")}finally{u(!1)}}};y.useEffect(()=>{k()},[n==null?void 0:n.id,S]),y.useEffect(()=>{C.editId&&b.current&&setTimeout(()=>{var I;(I=b.current)==null||I.focus()},100)},[C.editId]);const x=I=>{if(p){f(!0);return}f(I)},D=()=>{if(!C.editId||!C.editValue){C.editId="",C.isEditing=!1,m(!1);return}Hy(C.editId,C.editValue).then(()=>{k(),C.editId="",C.editValue="",C.isEditing=!1,m(!1),_.message.success(G("link.flow.modification_success"))}).catch(()=>{C.editId="",C.isEditing=!1,m(!1)})},E=(I,z,H)=>{I.stopPropagation(),I.preventDefault(),C.isEditing=!0,m(!0),f(!0),C.editId=z,C.editValue=H,setTimeout(()=>{v.current&&v.current.focus()},0)},O=I=>{I.stopPropagation(),I.preventDefault(),m(!0)},A=I=>{C.isEditing||e&&e(I)},T=()=>{if(!S){_.message.error("未配置账号模式");return}C.createLoading=!0,Kf(S).then(I=>{var K;const z=UA(I),H=Vd(I,S),J=z?{}:$q(I);z||console.warn(`${Ts} create modal will use legacy DynamicAccountForm`,{reason:"credentialFormSchema is null",model:WA(I),configModel:tw(J)}),C.credentialFormSchema=z,C.credentialInitialValues={},C.schemaMeta=H,C.configModel=J,C.account_scheme_id=I.id,C.name=I.name,C.auth_type=I.auth_type??((K=I.credential_schema)==null?void 0:K.type),C.createModalVisible=!0}).catch(I=>{console.error(`${Ts} account model load failed for create`,{schemaId:S,error:I})}).finally(()=>{C.createLoading=!1})},B=I=>{Ly(I).then(async z=>{var R;const H=z.account_schema_id,J=z.account_key,K=z.account_ver,ee=J??H??S;let $=null;if(ee)try{$=await Kf(String(ee),K)}catch(te){console.error("获取账号模型失败:",te)}const U=UA($);C.credentialFormSchema=U,C.credentialInitialValues=U?z.config??{}:{},C.schemaMeta={...Vd($,J??S),account_key:J??Vd($,S).account_key,account_ver:K??Vd($).account_ver},C.configModel=U?{}:z.config,C.account_scheme_id=H??($==null?void 0:$.id)??z.id,C.name=z.name,C.proxy_id=z.proxy_id,C.auth_type=z.auth_type??($==null?void 0:$.auth_type)??((R=$==null?void 0:$.credential_schema)==null?void 0:R.type)??"",C.modifyId=I,C.modifyModalVisible=!0})},M=y.useCallback((I,z)=>{if(C.createRequestLock)return;let H=I;if(!C.credentialFormSchema){if(H=Mt.cloneDeep(C.configModel),!Array.isArray(H==null?void 0:H.sub_params)){console.error(`${Ts} create account legacy config has no sub_params`,{configModel:tw(C.configModel),valueKeys:_i(I)}),_.message.error("账号模型配置为空,无法保存");return}H.sub_params.forEach(K=>{let ee=I[K.name];K.page_control===Ee.EXTEND_OBJ&&(ee=Jg(ee)),K.value=ee})}const J=I.proxy_id;delete I.proxy_id,C.createRequestLock=!0,z?Xf((n==null?void 0:n.id)??null,C.account_scheme_id,C.auth_type,C.name,H,C.modifyId,J,C.schemaMeta).then(K=>{K&&_.message.success("测试连接成功!")}).finally(()=>{C.createRequestLock=!1}):$y((n==null?void 0:n.id)??null,C.account_scheme_id,C.auth_type,C.name,H,J,C.schemaMeta).then(()=>{_.message.success(G("link.flow.creation_success")),k(),C.createModalVisible=!1}).finally(()=>{C.createRequestLock=!1})},[]),F=y.useCallback(()=>{C.createModalVisible=!1},[]),N=(I,z)=>{let H=I;if(!C.credentialFormSchema){if(H=Mt.cloneDeep(C.configModel),!Array.isArray(H==null?void 0:H.sub_params)){console.error(`${Ts} modify account legacy config has no sub_params`,{configModel:tw(C.configModel),valueKeys:_i(I)}),_.message.error("账号模型配置为空,无法保存");return}H.sub_params.forEach(K=>{let ee=I[K.name];K.page_control===Ee.EXTEND_OBJ&&(ee=Jg(ee)),K.value=ee})}const J=I.proxy_id;delete I.proxy_id,z?Xf((n==null?void 0:n.id)??null,C.account_scheme_id,C.auth_type,C.name,H,C.modifyId,J,C.schemaMeta).then(K=>{K&&_.message.success("测试连接成功!")}):zy(C.modifyId,null,null,null,null,H,J,C.schemaMeta).then(()=>{_.message.success(G("link.flow.modification_success")),k(),C.modifyModalVisible=!1,C.modifyId=""})},P=I=>h.jsxs("div",{children:[I,h.jsx(_.Divider,{style:{margin:"4px 0"}}),h.jsx("div",{style:{padding:"4px",textAlign:"center"},children:h.jsx(_.Button,{icon:h.jsx(ie.UserAddOutlined,{}),onClick:T,loading:C.createLoading,type:"link",block:!0,children:"创建新账号"})})]});return h.jsxs(h.Fragment,{children:[h.jsx(Bq,{label:o,layout:"vertical",required:!0,name:g,rules:[{validator:()=>t?Promise.resolve():Promise.reject(new Error(s||"请选择账号"))}],children:h.jsx(_.Select,{ref:v,value:t,onChange:A,style:{width:"100%"},placeholder:s,disabled:i,loading:c,allowClear:!0,popupRender:P,classNames:{popup:{root:"workflow-account-select__popup"}},listHeight:320,open:d,onOpenChange:x,children:a.map(I=>h.jsx(Fq,{value:I.id,children:h.jsxs("div",{className:Di.accountOption,onClick:z=>{C.isEditing&&z.stopPropagation()},children:[h.jsx("div",{className:`${Di.accountName} workflow-account-select__name`,children:C.editId!==I.id?h.jsxs(y.Fragment,{children:[h.jsx("span",{children:I.name}),h.jsx(ie.EditOutlined,{className:`${Di.nameEditIcon} workflow-account-select__edit`,onClick:z=>E(z,I.id,I.name)})]}):h.jsx("div",{className:Di.editInputWrapper,onClick:O,children:h.jsx(_.Input,{ref:b,defaultValue:I.name,className:Di.nameEditInput,onClick:O,onMouseDown:z=>{z.stopPropagation(),z.preventDefault()},onFocus:z=>{z.stopPropagation(),m(!0)},onPressEnter:z=>{z.stopPropagation(),z.preventDefault(),D()},onBlur:()=>{D()},onChange:z=>{C.editValue=z.target.value}})})}),h.jsxs("div",{className:Di.accountActions,children:[h.jsx(Mq,{type:"secondary",className:Di.updateTime,children:Ht(Number(I.update_time)*1e3).format("YYYY-MM-DD HH:mm:ss")}),h.jsx(_.Button,{type:"link",icon:h.jsx(ie.FileSearchOutlined,{}),size:"small",onClick:z=>{z.stopPropagation(),B(I.id)},children:"编辑"})]})]})},I.id))})}),h.jsx(mq,{onSubmit:M,onCancel:F,inAI:!0,auth_type:C.auth_type,config:C.configModel,formSchema:C.credentialFormSchema,visible:C.createModalVisible,connector:n}),h.jsx(vq,{onSubmit:N,inAI:!0,onCancel:()=>{C.modifyModalVisible=!1},proxy_id:C.proxy_id,auth_type:C.auth_type,config:C.configModel,formSchema:C.credentialFormSchema,initialValues:C.credentialInitialValues,visible:C.modifyModalVisible,connector:n})]})},qA=({credentialRequirements:t,actionAccountSchemaId:e,value:n,onChange:r,...o})=>{var l;const i=y.useMemo(()=>{const c=e?[{key:String(e)}]:[];return ew(t!=null&&t.length?t:c)},[e,t]),[s,a]=y.useState(n?(l=i[0])==null?void 0:l.key:void 0);return y.useEffect(()=>{var c;if(!n){a(void 0);return}!s&&((c=i[0])!=null&&c.key)&&a(i[0].key)},[s,i,n]),i.length===0?null:h.jsx(y.Fragment,{children:i.map(c=>h.jsx(zq,{...o,actionAccountSchemaId:c.key,selectTitle:i.length>1?c.label:"授权配置",value:s===c.key?n:void 0,onChange:u=>{a(u?c.key:void 0),r==null||r(u)}},c.key))})},Hq=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Vq=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=y.useState(e||""),[s,a]=y.useState(!1);y.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const f=Hq();i(f),a(!0),n==null||n(f)},c=()=>{l()},u=async()=>{if(!o){_.message.warning(G("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(G("components.authTokenField.copySuccess"))}catch{_.message.error(G("components.authTokenField.copyFailed"))}},d=()=>{a(f=>!f)};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:G("components.authTokenField.placeholder")}),h.jsx(_.Tooltip,{title:G("components.authTokenField.copy"),children:h.jsx(_.Button,{icon:h.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:h.jsx(_.Button,{icon:s?h.jsx(ie.EyeInvisibleOutlined,{}):h.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:h.jsx(_.Button,{icon:h.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},jq=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Wq=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=y.useState(e||""),[s,a]=y.useState(!1);y.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const f=jq();i(f),a(!0),n==null||n(f)},c=()=>{if(!o){l();return}_.Modal.confirm({title:G("common.info"),content:G("components.authTokenField.regenerateConfirm"),okText:G("app.common.word.confirm"),cancelText:G("app.common.word.cancel"),onOk:l})},u=async()=>{if(!o){_.message.warning(G("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(G("components.authTokenField.copySuccess"))}catch{_.message.error(G("components.authTokenField.copyFailed"))}},d=()=>{a(f=>!f)};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:G("components.authTokenField.placeholder")}),h.jsx(_.Tooltip,{title:G("components.authTokenField.copy"),children:h.jsx(_.Button,{icon:h.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:h.jsx(_.Button,{icon:s?h.jsx(ie.EyeInvisibleOutlined,{}):h.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:h.jsx(_.Button,{icon:h.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},GA=10,Uq=["OAUTH","OAUTH2","OIDC"],qq=t=>{const e=new Set([...t.support_protocol??[],...t.auth_protocol?[t.auth_protocol]:[]]);return Array.from(e).some(n=>Uq.includes(n))},Gq=t=>{const{value:e,onChange:n,disabled:r}=t,o=Sl(),[i,s]=y.useState([]),[a,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(""),[p,m]=y.useState(1),[b,v]=y.useState(!1),w=y.useRef(0),g=y.useMemo(()=>`${window.location.origin}/iam/token`,[]),C=async(O=1,A=!1,T="")=>{const B=w.current+1;w.current=B,A?u(!0):l(!0);try{const M=await Ry({current:O,pageSize:GA},{filter:T});if(w.current!==B)return;const F=(M.items??[]).filter(qq),P=(A?[...i,...F]:F).filter((I,z,H)=>H.findIndex(J=>J.client_id===I.client_id)===z);s(P),m(O),v((M.total??0)>O*GA)}catch{w.current===B&&_.message.error(G("components.selectOAuth2ClientField.fetchFailed"))}finally{w.current===B&&(l(!1),u(!1))}};let S=null;y.useEffect(()=>{S&&(clearTimeout(S),S=null),S=window.setTimeout(()=>{C(1,!1,d.trim())},300)},[d]);const k=async()=>{!b||a||c||await C(p+1,!0,d.trim())},x=async()=>{try{await navigator.clipboard.writeText(g),_.message.success(G("components.selectOAuth2ClientField.copySuccess"))}catch{_.message.error(G("components.selectOAuth2ClientField.copyFailed"))}},D=()=>{o("/apps/manage",!0)},E=()=>{o("https://1in15q85qd.apifox.cn/8698545m0",!0)};return h.jsxs(_.Space,{direction:"vertical",size:12,style:{width:"100%"},children:[h.jsxs("div",{children:[h.jsx(_.Select,{value:e,onChange:n,disabled:r,loading:a,showSearch:!0,filterOption:!1,optionLabelProp:"label",placeholder:G("components.selectOAuth2ClientField.placeholder"),onSearch:f,notFoundContent:a?h.jsx(_.Spin,{size:"small"}):null,getPopupContainer:O=>O.parentNode,popupRender:O=>h.jsxs("div",{children:[O,!a&&i.length===0?h.jsx("div",{style:{padding:"16px 12px"},children:h.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:h.jsxs(_.Space,{direction:"vertical",size:4,children:[h.jsx(_.Typography.Text,{type:"secondary",children:G("components.selectOAuth2ClientField.emptyTitle")}),h.jsx(_.Typography.Text,{type:"secondary",style:{fontSize:12},children:G("components.selectOAuth2ClientField.emptyDescription")})]}),children:h.jsx(_.Button,{type:"primary",ghost:!0,icon:h.jsx(ie.LinkOutlined,{}),onClick:D,children:G("components.selectOAuth2ClientField.goToAppManage")})})}):null,i.length>0?h.jsx("div",{style:{padding:"8px 12px",textAlign:"center",borderTop:"1px solid #f0f0f0"},children:h.jsx(_.Button,{type:"link",icon:h.jsx(ie.ReloadOutlined,{}),onClick:k,loading:c,disabled:!b,children:G(b?"components.selectOAuth2ClientField.loadMore":"components.selectOAuth2ClientField.loadedAll")})}):null]}),options:i.map(O=>({label:O.client_name,value:O.client_id}))}),h.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[G("components.selectOAuth2ClientField.selectDescriptionPrefix"),h.jsx(_.Button,{style:{padding:0},type:"link",onClick:D,children:G("components.selectOAuth2ClientField.goToAppManage")}),G("components.selectOAuth2ClientField.selectDescriptionSuffix")]})]}),h.jsxs("div",{children:[h.jsx(_.Typography.Text,{strong:!0,style:{display:"block",marginBottom:8},children:G("components.selectOAuth2ClientField.tokenEndpoint")}),h.jsxs(_.Space.Compact,{block:!0,className:"workflow-oauth-token-endpoint",children:[h.jsx(_.Input,{value:g,readOnly:!0}),h.jsx(_.Button,{icon:h.jsx(ie.CopyOutlined,{}),onClick:x,disabled:r,children:G("components.selectOAuth2ClientField.copy")})]}),h.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[G("components.selectOAuth2ClientField.tokenDescriptionPrefix"),h.jsx(_.Button,{style:{padding:0},type:"link",onClick:E,children:G("components.selectOAuth2ClientField.documentation")})]})]})]})},Rq=({children:t,value:e,onChange:n})=>{const[r,o]=y.useState(e==="{{$fromAI}}"),i=()=>{const a=!r;o(a),a?n==null||n("{{$fromAI}}"):n==null||n("")},s=()=>r?h.jsxs("div",{style:{position:"relative"},children:[h.jsx(_.Input,{value:"由AI生成 ",readOnly:!0,style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",border:"1px solid transparent",borderImage:"linear-gradient(45deg, #00d4ff, #9b59b6, #e74c3c) 1",color:"#ffffff",fontWeight:"500",textShadow:"0 1px 2px rgba(0,0,0,0.3)",borderRadius:"6px",fontSize:"13px",paddingLeft:"32px",paddingRight:"28px",height:"32px",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)"},prefix:h.jsx("div",{style:{background:"linear-gradient(45deg, #00d4ff, #1e3c72)",borderRadius:"50%",width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"4px",animation:"pulse 2s ease-in-out infinite alternate"},children:h.jsx("span",{style:{color:"#fff",fontSize:"8px"},children:"AI"})}),suffix:h.jsx(_.Button,{type:"text",size:"small",onClick:i,style:{color:"#ffffff",border:"none",background:"rgba(255,255,255,0.2)",borderRadius:"50%",width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minWidth:"18px",padding:0},onMouseEnter:a=>{a.currentTarget.style.background="rgba(255,255,255,0.3)",a.currentTarget.style.transform="scale(1.1)"},onMouseLeave:a=>{a.currentTarget.style.background="rgba(255,255,255,0.2)",a.currentTarget.style.transform="scale(1)"},children:h.jsx(ie.CloseOutlined,{style:{fontSize:"10px"}})})}),h.jsx("style",{children:`
112
+ */const vW=Io("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),yW=/\{\{.*\}\}/;function U_(t){return typeof t=="string"&&yW.test(t)?"expression":"normal"}const q_=({field:t,disabled:e,readOnly:n,context:r})=>{const{renderVariableTag:o,renderVariableTooltip:i,validateVariable:s}=r,a=CW(t),l=t.keyPlaceholder||"Key",c=t.valuePlaceholder||"Value",u=0;return h.jsx(_.Form.List,{name:t.name,rules:a,children:(d,{add:f,remove:p},{errors:m})=>h.jsxs(_.Space,{direction:"vertical",style:{width:"100%"},children:[d.map(b=>h.jsx(G_,{field:t,listField:b,disabled:e,readOnly:n,canRemove:!(e||t.minItems!==void 0&&d.length<=t.minItems),keyPlaceholder:l,valuePlaceholder:c,valueModeSwitchOffset:u,onRemove:p,validateVariable:s,renderVariableTag:o,renderVariableTooltip:i},b.key)),h.jsx(_.Button,{block:!0,icon:h.jsx(br,{size:16}),onClick:()=>f(),disabled:e||t.maxItems!==void 0&&d.length>=t.maxItems,children:h.jsx(Te.FormattedMessage,{id:"app.common.word.add-field"})}),h.jsx(_.Form.ErrorList,{errors:m})]})})};q_.displayName="KeyValueFieldControl";const G_=({field:t,listField:e,disabled:n,readOnly:r,canRemove:o,keyPlaceholder:i,valuePlaceholder:s,valueModeSwitchOffset:a,onRemove:l,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})=>{const f=t.valueModePolicy,p=_.Form.useFormInstance(),[m,b]=y.useState(()=>{if(f){if(f==="BOTH"||f==="EXPRESSION")return"expression";if(f==="TEXT")return"normal"}const w=p.getFieldValue([t.name,e.name]),g=U_(w==null?void 0:w.key);return g==="expression"?g:U_(w==null?void 0:w.value)}),v=f==="TEXT"?["normal"]:["normal","expression"];return h.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[h.jsx(_.Form.Item,{style:{flex:1,marginBottom:0,marginTop:a},name:[e.name,"key"],rules:[{required:!0,message:"请输入Key"}],children:h.jsx(Ci,{availableModes:v,mode:m,hideModeSwitch:!0,disabled:n,readOnly:r,placeholder:i,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d})}),h.jsx(_.Form.Item,{style:{flex:1,marginBottom:0},name:[e.name,"value"],children:h.jsx(Ci,{availableModes:v,mode:m,onModeChange:b,disabled:n,readOnly:r,placeholder:s,validateVariable:c,renderVariableTag:u,renderVariableTooltip:d,modeSwitchPosition:"top-right",compact:!0})}),h.jsx(_.Button,{icon:h.jsx(xi,{size:16}),onClick:()=>l(e.name),disabled:!o})]})};G_.displayName="KeyValueRow";function CW(t){var n;const e=[];if((n=t.rules)!=null&&n.some(r=>r.type==="required")){const r=t.rules.find(o=>o.type==="required");e.push({validator:async(o,i)=>{if(!i||i.length===0)throw new Error((r==null?void 0:r.message)||"此项为必填")}})}if(t.minItems!==void 0){const r=t.minItems;e.push({validator:async(o,i)=>{if(!i||i.length<r)throw new Error(`至少需要 ${r} 项`)}})}if(t.maxItems!==void 0){const r=t.maxItems;e.push({validator:async(o,i)=>{if(i&&i.length>r)throw new Error(`最多允许 ${r} 项`)}})}return e}const kW=Mo(q_,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});function SW(t){if(!t||typeof t!="object")return!1;const e=t;return typeof e.name=="string"&&e.name.trim()!==""&&typeof e.type=="string"}function EW(t){return!t||typeof t!="object"||Array.isArray(t)?[]:Object.values(t).filter(SW)}const R_=({field:t,disabled:e,readOnly:n,context:r})=>{const o=_.Form.useFormInstance(),s=xW(t.name),[a,l]=vt.useState(null);vt.useEffect(()=>{Promise.resolve().then(()=>_U).then(g=>{l(()=>g.FieldRenderer)})},[]);const{renderVariableTag:c,renderVariableTooltip:u,validateVariable:d,values:f,optionsLoader:p}=r,m=vt.useMemo(()=>EW(t.properties),[t.properties]),b=o.getFieldValue(s)??qn(f,s.join("."))??{},v=h.jsx(_.Space,{direction:"vertical",style:{width:"100%"},children:m.map(g=>{const C=jg(g,t.valueModePolicy),S=[...s,g.name];return yl(C,b)&&a?h.jsx(a,{field:{...C,name:S},values:f,optionsLoader:p,disabled:e,renderVariableTag:c,renderVariableTooltip:u,validateVariable:d},S.join(".")):null})}),w=h.jsx(Wg,{policy:t.valueModePolicy,disabled:e,readOnly:n,children:v});return t.collapsible?h.jsx(_.Collapse,{defaultActiveKey:t.defaultCollapsed?[]:["main"],items:[{key:"main",label:t.label||t.name,children:w}]}):h.jsx(_.Card,{size:"small",title:t.label,children:w})};R_.displayName="ObjectFieldControl";function xW(t){return Array.isArray(t)?t:[t]}const DW=Mo(R_,{isComplexField:!0,supportsVariableInsert:!0,needsFormItemName:!1});var Od={exports:{}},_W=Od.exports,K_;function AW(){return K_||(K_=1,(function(t,e){(function(n,r){t.exports=r()})(_W,(function(){var n=1e3,r=6e4,o=36e5,i="millisecond",s="second",a="minute",l="hour",c="day",u="week",d="month",f="quarter",p="year",m="date",b="Invalid Date",v=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(F){var N=["th","st","nd","rd"],P=F%100;return"["+F+(N[(P-20)%10]||N[P]||N[0])+"]"}},C=function(F,N,P){var I=String(F);return!I||I.length>=N?F:""+Array(N+1-I.length).join(P)+F},S={s:C,z:function(F){var N=-F.utcOffset(),P=Math.abs(N),I=Math.floor(P/60),z=P%60;return(N<=0?"+":"-")+C(I,2,"0")+":"+C(z,2,"0")},m:function F(N,P){if(N.date()<P.date())return-F(P,N);var I=12*(P.year()-N.year())+(P.month()-N.month()),z=N.clone().add(I,d),H=P-z<0,J=N.clone().add(I+(H?-1:1),d);return+(-(I+(P-z)/(H?z-J:J-z))||0)},a:function(F){return F<0?Math.ceil(F)||0:Math.floor(F)},p:function(F){return{M:d,y:p,w:u,d:c,D:m,h:l,m:a,s,ms:i,Q:f}[F]||String(F||"").toLowerCase().replace(/s$/,"")},u:function(F){return F===void 0}},k="en",x={};x[k]=g;var D="$isDayjsObject",E=function(F){return F instanceof B||!(!F||!F[D])},O=function F(N,P,I){var z;if(!N)return k;if(typeof N=="string"){var H=N.toLowerCase();x[H]&&(z=H),P&&(x[H]=P,z=H);var J=N.split("-");if(!z&&J.length>1)return F(J[0])}else{var K=N.name;x[K]=N,z=K}return!I&&z&&(k=z),z||!I&&k},A=function(F,N){if(E(F))return F.clone();var P=typeof N=="object"?N:{};return P.date=F,P.args=arguments,new B(P)},T=S;T.l=O,T.i=E,T.w=function(F,N){return A(F,{locale:N.$L,utc:N.$u,x:N.$x,$offset:N.$offset})};var B=(function(){function F(P){this.$L=O(P.locale,null,!0),this.parse(P),this.$x=this.$x||P.x||{},this[D]=!0}var N=F.prototype;return N.parse=function(P){this.$d=(function(I){var z=I.date,H=I.utc;if(z===null)return new Date(NaN);if(T.u(z))return new Date;if(z instanceof Date)return new Date(z);if(typeof z=="string"&&!/Z$/i.test(z)){var J=z.match(v);if(J){var K=J[2]-1||0,ee=(J[7]||"0").substring(0,3);return H?new Date(Date.UTC(J[1],K,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)):new Date(J[1],K,J[3]||1,J[4]||0,J[5]||0,J[6]||0,ee)}}return new Date(z)})(P),this.init()},N.init=function(){var P=this.$d;this.$y=P.getFullYear(),this.$M=P.getMonth(),this.$D=P.getDate(),this.$W=P.getDay(),this.$H=P.getHours(),this.$m=P.getMinutes(),this.$s=P.getSeconds(),this.$ms=P.getMilliseconds()},N.$utils=function(){return T},N.isValid=function(){return this.$d.toString()!==b},N.isSame=function(P,I){var z=A(P);return this.startOf(I)<=z&&z<=this.endOf(I)},N.isAfter=function(P,I){return A(P)<this.startOf(I)},N.isBefore=function(P,I){return this.endOf(I)<A(P)},N.$g=function(P,I,z){return T.u(P)?this[I]:this.set(z,P)},N.unix=function(){return Math.floor(this.valueOf()/1e3)},N.valueOf=function(){return this.$d.getTime()},N.startOf=function(P,I){var z=this,H=!!T.u(I)||I,J=T.p(P),K=function(j,Y){var W=T.w(z.$u?Date.UTC(z.$y,Y,j):new Date(z.$y,Y,j),z);return H?W:W.endOf(c)},ee=function(j,Y){return T.w(z.toDate()[j].apply(z.toDate("s"),(H?[0,0,0,0]:[23,59,59,999]).slice(Y)),z)},$=this.$W,U=this.$M,R=this.$D,te="set"+(this.$u?"UTC":"");switch(J){case p:return H?K(1,0):K(31,11);case d:return H?K(1,U):K(0,U+1);case u:var se=this.$locale().weekStart||0,be=($<se?$+7:$)-se;return K(H?R-be:R+(6-be),U);case c:case m:return ee(te+"Hours",0);case l:return ee(te+"Minutes",1);case a:return ee(te+"Seconds",2);case s:return ee(te+"Milliseconds",3);default:return this.clone()}},N.endOf=function(P){return this.startOf(P,!1)},N.$set=function(P,I){var z,H=T.p(P),J="set"+(this.$u?"UTC":""),K=(z={},z[c]=J+"Date",z[m]=J+"Date",z[d]=J+"Month",z[p]=J+"FullYear",z[l]=J+"Hours",z[a]=J+"Minutes",z[s]=J+"Seconds",z[i]=J+"Milliseconds",z)[H],ee=H===c?this.$D+(I-this.$W):I;if(H===d||H===p){var $=this.clone().set(m,1);$.$d[K](ee),$.init(),this.$d=$.set(m,Math.min(this.$D,$.daysInMonth())).$d}else K&&this.$d[K](ee);return this.init(),this},N.set=function(P,I){return this.clone().$set(P,I)},N.get=function(P){return this[T.p(P)]()},N.add=function(P,I){var z,H=this;P=Number(P);var J=T.p(I),K=function(U){var R=A(H);return T.w(R.date(R.date()+Math.round(U*P)),H)};if(J===d)return this.set(d,this.$M+P);if(J===p)return this.set(p,this.$y+P);if(J===c)return K(1);if(J===u)return K(7);var ee=(z={},z[a]=r,z[l]=o,z[s]=n,z)[J]||1,$=this.$d.getTime()+P*ee;return T.w($,this)},N.subtract=function(P,I){return this.add(-1*P,I)},N.format=function(P){var I=this,z=this.$locale();if(!this.isValid())return z.invalidDate||b;var H=P||"YYYY-MM-DDTHH:mm:ssZ",J=T.z(this),K=this.$H,ee=this.$m,$=this.$M,U=z.weekdays,R=z.months,te=z.meridiem,se=function(Y,W,X,re){return Y&&(Y[W]||Y(I,H))||X[W].slice(0,re)},be=function(Y){return T.s(K%12||12,Y,"0")},j=te||function(Y,W,X){var re=Y<12?"AM":"PM";return X?re.toLowerCase():re};return H.replace(w,(function(Y,W){return W||(function(X){switch(X){case"YY":return String(I.$y).slice(-2);case"YYYY":return T.s(I.$y,4,"0");case"M":return $+1;case"MM":return T.s($+1,2,"0");case"MMM":return se(z.monthsShort,$,R,3);case"MMMM":return se(R,$);case"D":return I.$D;case"DD":return T.s(I.$D,2,"0");case"d":return String(I.$W);case"dd":return se(z.weekdaysMin,I.$W,U,2);case"ddd":return se(z.weekdaysShort,I.$W,U,3);case"dddd":return U[I.$W];case"H":return String(K);case"HH":return T.s(K,2,"0");case"h":return be(1);case"hh":return be(2);case"a":return j(K,ee,!0);case"A":return j(K,ee,!1);case"m":return String(ee);case"mm":return T.s(ee,2,"0");case"s":return String(I.$s);case"ss":return T.s(I.$s,2,"0");case"SSS":return T.s(I.$ms,3,"0");case"Z":return J}return null})(Y)||J.replace(":","")}))},N.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},N.diff=function(P,I,z){var H,J=this,K=T.p(I),ee=A(P),$=(ee.utcOffset()-this.utcOffset())*r,U=this-ee,R=function(){return T.m(J,ee)};switch(K){case p:H=R()/12;break;case d:H=R();break;case f:H=R()/3;break;case u:H=(U-$)/6048e5;break;case c:H=(U-$)/864e5;break;case l:H=U/o;break;case a:H=U/r;break;case s:H=U/n;break;default:H=U}return z?H:T.a(H)},N.daysInMonth=function(){return this.endOf(d).$D},N.$locale=function(){return x[this.$L]},N.locale=function(P,I){if(!P)return this.$L;var z=this.clone(),H=O(P,I,!0);return H&&(z.$L=H),z},N.clone=function(){return T.w(this.$d,this)},N.toDate=function(){return new Date(this.valueOf())},N.toJSON=function(){return this.isValid()?this.toISOString():null},N.toISOString=function(){return this.$d.toISOString()},N.toString=function(){return this.$d.toUTCString()},F})(),M=B.prototype;return A.prototype=M,[["$ms",i],["$s",s],["$m",a],["$H",l],["$W",c],["$M",d],["$y",p],["$D",m]].forEach((function(F){M[F[1]]=function(N){return this.$g(N,F[0],F[1])}})),A.extend=function(F,N){return F.$i||(F(N,B,A),F.$i=!0),A},A.locale=O,A.isDayjs=E,A.unix=function(F){return A(1e3*F)},A.en=x[k],A.Ls=x,A.p={},A}))})(Od)),Od.exports}var OW=AW();const Ht=Un(OW);var Td={exports:{}},TW=Td.exports,Y_;function NW(){return Y_||(Y_=1,(function(t,e){(function(n,r){t.exports=r()})(TW,(function(){return function(n,r){var o=r.prototype,i=o.format;o.format=function(s){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(s);var c=this.$utils(),u=(s||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(d){switch(d){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),d==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),d==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),d==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return d}}));return i.bind(this)(u)}}}))})(Td)),Td.exports}var BW=NW();const FW=Un(BW);var Nd={exports:{}},MW=Nd.exports,X_;function IW(){return X_||(X_=1,(function(t,e){(function(n,r){t.exports=r()})(MW,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,o=/\d/,i=/\d\d/,s=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(v){return(v=+v)+(v>68?1900:2e3)},u=function(v){return function(w){this[v]=+w}},d=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(w){if(!w||w==="Z")return 0;var g=w.match(/([+-]|\d\d)/g),C=60*g[1]+(+g[2]||0);return C===0?0:g[0]==="+"?-C:C})(v)}],f=function(v){var w=l[v];return w&&(w.indexOf?w:w.s.concat(w.f))},p=function(v,w){var g,C=l.meridiem;if(C){for(var S=1;S<=24;S+=1)if(v.indexOf(C(S,0,w))>-1){g=S>12;break}}else g=v===(w?"pm":"PM");return g},m={A:[a,function(v){this.afternoon=p(v,!1)}],a:[a,function(v){this.afternoon=p(v,!0)}],Q:[o,function(v){this.month=3*(v-1)+1}],S:[o,function(v){this.milliseconds=100*+v}],SS:[i,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[s,u("seconds")],ss:[s,u("seconds")],m:[s,u("minutes")],mm:[s,u("minutes")],H:[s,u("hours")],h:[s,u("hours")],HH:[s,u("hours")],hh:[s,u("hours")],D:[s,u("day")],DD:[i,u("day")],Do:[a,function(v){var w=l.ordinal,g=v.match(/\d+/);if(this.day=g[0],w)for(var C=1;C<=31;C+=1)w(C).replace(/\[|\]/g,"")===v&&(this.day=C)}],w:[s,u("week")],ww:[i,u("week")],M:[s,u("month")],MM:[i,u("month")],MMM:[a,function(v){var w=f("months"),g=(f("monthsShort")||w.map((function(C){return C.slice(0,3)}))).indexOf(v)+1;if(g<1)throw new Error;this.month=g%12||g}],MMMM:[a,function(v){var w=f("months").indexOf(v)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(v){this.year=c(v)}],YYYY:[/\d{4}/,u("year")],Z:d,ZZ:d};function b(v){var w,g;w=v,g=l&&l.formats;for(var C=(v=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(A,T,B){var M=B&&B.toUpperCase();return T||g[B]||n[B]||g[M].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(F,N,P){return N||P.slice(1)}))}))).match(r),S=C.length,k=0;k<S;k+=1){var x=C[k],D=m[x],E=D&&D[0],O=D&&D[1];C[k]=O?{regex:E,parser:O}:x.replace(/^\[|\]$/g,"")}return function(A){for(var T={},B=0,M=0;B<S;B+=1){var F=C[B];if(typeof F=="string")M+=F.length;else{var N=F.regex,P=F.parser,I=A.slice(M),z=N.exec(I)[0];P.call(T,z),A=A.replace(z,"")}}return(function(H){var J=H.afternoon;if(J!==void 0){var K=H.hours;J?K<12&&(H.hours+=12):K===12&&(H.hours=0),delete H.afternoon}})(T),T}}return function(v,w,g){g.p.customParseFormat=!0,v&&v.parseTwoDigitYear&&(c=v.parseTwoDigitYear);var C=w.prototype,S=C.parse;C.parse=function(k){var x=k.date,D=k.utc,E=k.args;this.$u=D;var O=E[1];if(typeof O=="string"){var A=E[2]===!0,T=E[3]===!0,B=A||T,M=E[2];T&&(M=E[2]),l=this.$locale(),!A&&M&&(l=g.Ls[M]),this.$d=(function(I,z,H,J){try{if(["x","X"].indexOf(z)>-1)return new Date((z==="X"?1e3:1)*I);var K=b(z)(I),ee=K.year,$=K.month,U=K.day,R=K.hours,te=K.minutes,se=K.seconds,be=K.milliseconds,j=K.zone,Y=K.week,W=new Date,X=U||(ee||$?1:W.getDate()),re=ee||W.getFullYear(),Z=0;ee&&!$||(Z=$>0?$-1:W.getMonth());var de,ve=R||0,we=te||0,fe=se||0,le=be||0;return j?new Date(Date.UTC(re,Z,X,ve,we,fe,le+60*j.offset*1e3)):H?new Date(Date.UTC(re,Z,X,ve,we,fe,le)):(de=new Date(re,Z,X,ve,we,fe,le),Y&&(de=J(de).week(Y).toDate()),de)}catch{return new Date("")}})(x,O,D,g),this.init(),M&&M!==!0&&(this.$L=this.locale(M).$L),B&&x!=this.format(O)&&(this.$d=new Date("")),l={}}else if(O instanceof Array)for(var F=O.length,N=1;N<=F;N+=1){E[1]=O[N-1];var P=g.apply(this,E);if(P.isValid()){this.$d=P.$d,this.$L=P.$L,this.init();break}N===F&&(this.$d=new Date(""))}else S.call(this,k)}}}))})(Nd)),Nd.exports}var PW=IW();const LW=Un(PW);var Bd={exports:{}},$W=Bd.exports,J_;function zW(){return J_||(J_=1,(function(t,e){(function(n,r){t.exports=r()})($W,(function(){return function(n,r,o){var i=r.prototype,s=function(d){return d&&(d.indexOf?d:d.s)},a=function(d,f,p,m,b){var v=d.name?d:d.$locale(),w=s(v[f]),g=s(v[p]),C=w||g.map((function(k){return k.slice(0,m)}));if(!b)return C;var S=v.weekStart;return C.map((function(k,x){return C[(x+(S||0))%7]}))},l=function(){return o.Ls[o.locale()]},c=function(d,f){return d.formats[f]||(function(p){return p.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(m,b,v){return b||v.slice(1)}))})(d.formats[f.toUpperCase()])},u=function(){var d=this;return{months:function(f){return f?f.format("MMMM"):a(d,"months")},monthsShort:function(f){return f?f.format("MMM"):a(d,"monthsShort","months",3)},firstDayOfWeek:function(){return d.$locale().weekStart||0},weekdays:function(f){return f?f.format("dddd"):a(d,"weekdays")},weekdaysMin:function(f){return f?f.format("dd"):a(d,"weekdaysMin","weekdays",2)},weekdaysShort:function(f){return f?f.format("ddd"):a(d,"weekdaysShort","weekdays",3)},longDateFormat:function(f){return c(d.$locale(),f)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},o.localeData=function(){var d=l();return{firstDayOfWeek:function(){return d.weekStart||0},weekdays:function(){return o.weekdays()},weekdaysShort:function(){return o.weekdaysShort()},weekdaysMin:function(){return o.weekdaysMin()},months:function(){return o.months()},monthsShort:function(){return o.monthsShort()},longDateFormat:function(f){return c(d,f)},meridiem:d.meridiem,ordinal:d.ordinal}},o.months=function(){return a(l(),"months")},o.monthsShort=function(){return a(l(),"monthsShort","months",3)},o.weekdays=function(d){return a(l(),"weekdays",null,null,d)},o.weekdaysShort=function(d){return a(l(),"weekdaysShort","weekdays",3,d)},o.weekdaysMin=function(d){return a(l(),"weekdaysMin","weekdays",2,d)}}}))})(Bd)),Bd.exports}var HW=zW();const VW=Un(HW);var Fd={exports:{}},jW=Fd.exports,Q_;function WW(){return Q_||(Q_=1,(function(t,e){(function(n,r){t.exports=r()})(jW,(function(){return function(n,r){r.prototype.weekday=function(o){var i=this.$locale().weekStart||0,s=this.$W,a=(s<i?s+7:s)-i;return this.$utils().u(o)?a:this.subtract(a,"day").add(o,"day")}}}))})(Fd)),Fd.exports}var UW=WW();const qW=Un(UW);var Md={exports:{}},GW=Md.exports,Z_;function RW(){return Z_||(Z_=1,(function(t,e){(function(n,r){t.exports=r()})(GW,(function(){var n="week",r="year";return function(o,i,s){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=s(this).startOf(r).add(1,r).date(c),d=s(this).endOf(n);if(u.isBefore(d))return 1}var f=s(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),p=this.diff(f,n,!0);return p<0?s(this).startOf("week").week():Math.ceil(p)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Md)),Md.exports}var KW=RW();const YW=Un(KW);var Id={exports:{}},XW=Id.exports,eA;function JW(){return eA||(eA=1,(function(t,e){(function(n,r){t.exports=r()})(XW,(function(){return function(n,r){r.prototype.weekYear=function(){var o=this.month(),i=this.week(),s=this.year();return i===1&&o===11?s+1:o===0&&i>=52?s-1:s}}}))})(Id)),Id.exports}var QW=JW();const ZW=Un(QW);Ht.extend(LW),Ht.extend(FW),Ht.extend(qW),Ht.extend(VW),Ht.extend(YW),Ht.extend(ZW);function Cl(t,e){if(t==null||t==="")return null;if(Ht.isDayjs(t))return t.isValid()?t:null;const n=e?Ht(t,e):Ht(t);if(n.isValid())return n;const r=Ht(t);return r.isValid()?r:null}function tA(t,e){if(!Array.isArray(t))return null;const n=Cl(t[0],e),r=Cl(t[1],e);return n||r?[n,r]:null}function kl(t,e,n){if(t)return e==="timestamp"?t.valueOf():e==="string"?t.format(n):t}function nA(t,e,n){if(t)return[kl(t[0],e,n),kl(t[1],e,n)]}const eU="YYYY-MM-DD",rA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||eU,s=Cl(n,i);return h.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,picker:t.picker,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(kl(a,t.outputFormat,i)),id:o})};rA.displayName="DateFieldControl";const tU=ft(rA,{needsFormItemName:!0}),nU="YYYY-MM-DD",oA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||nU,s=tA(n,i);return h.jsx(_.DatePicker.RangePicker,{disabled:e,picker:t.picker,showTime:t.showTime,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(nA(a,t.outputFormat,i)),id:o})};oA.displayName="DateRangeFieldControl";const rU=ft(oA,{needsFormItemName:!0}),oU="YYYY-MM-DD HH:mm:ss",iA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||oU,s=Cl(n,i);return h.jsx(_.DatePicker,{disabled:e,placeholder:t.placeholder,showTime:t.showTime??!0,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(kl(a,t.outputFormat,i)),id:o})};iA.displayName="DateTimeFieldControl";const iU=ft(iA,{needsFormItemName:!0}),sU="HH:mm:ss",sA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||sU,s=Cl(n,i);return h.jsx(_.TimePicker,{disabled:e,placeholder:t.placeholder,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(kl(a,t.outputFormat,i)),id:o})};sA.displayName="TimeFieldControl";const aU=ft(sA,{needsFormItemName:!0}),lU="HH:mm:ss",aA=({field:t,disabled:e,value:n,onChange:r,id:o})=>{const i=t.format||lU,s=tA(n,i);return h.jsx(_.TimePicker.RangePicker,{disabled:e,format:i,style:{width:"100%"},value:s,onChange:a=>r==null?void 0:r(nA(a,t.outputFormat,i)),id:o})};aA.displayName="TimeRangeFieldControl";const cU=ft(aA,{needsFormItemName:!0}),lA=({field:t})=>h.jsx(_.Divider,{children:t.label});lA.displayName="DividerFieldControl";const uU=Mo(lA,{isDisplayOnly:!0,needsFormItemName:!1}),cA=({value:t,onChange:e,id:n})=>h.jsx(_.Input,{type:"hidden",value:t,onChange:r=>e==null?void 0:e(r.target.value),id:n});cA.displayName="HiddenFieldControl";const dU=Mo(cA,{needsFormItemName:!0,isHidden:!0}),uA=({field:t})=>h.jsx(_.Alert,{message:t.label,description:t.description||t.placeholder,type:t.status||"info",showIcon:t.showIcon,closable:t.closable});uA.displayName="InfoCardFieldControl";const fU=Mo(uA,{isDisplayOnly:!0,needsFormItemName:!1}),dA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Input.TextArea,{disabled:e,placeholder:t.placeholder,rows:6,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});dA.displayName="JsonFieldControl";const hU=ft(dA,{needsFormItemName:!0}),fA=({field:t,value:e})=>h.jsx("span",{children:e||t.placeholder||t.defaultValue});fA.displayName="LabelFieldControl";const pU=ft(fA,{needsFormItemName:!0}),hA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Cascader,{disabled:e,placeholder:t.placeholder,options:t.options,changeOnSelect:t.changeOnSelect,multiple:t.multiple||void 0,showSearch:t.showSearch,value:n,onChange:(i,s)=>r==null?void 0:r(i),id:o});hA.displayName="CascaderFieldControl";const mU=ft(hA,{needsFormItemName:!0}),pA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Checkbox,{disabled:e,checked:n,onChange:i=>r==null?void 0:r(i.target.checked),id:o,children:t.placeholder});pA.displayName="CheckboxFieldControl";const gU=ft(pA,{needsFormItemName:!0,valuePropName:"checked"}),mA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Checkbox.Group,{disabled:e,options:t.options,value:n,onChange:i=>r==null?void 0:r(i)});mA.displayName="CheckboxGroupFieldControl";const wU=ft(mA,{needsFormItemName:!0}),gA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Radio.Group,{disabled:e,options:t.options,optionType:t.optionType,buttonStyle:t.buttonStyle,value:n,onChange:i=>r==null?void 0:r(i.target.value),id:o});gA.displayName="RadioFieldControl";const bU=ft(gA,{needsFormItemName:!0}),wA=({field:t,disabled:e,context:n,value:r,onChange:o,id:i})=>{const{values:s,optionsLoader:a}=n,[l,c]=y.useState(bA(t)),[u,d]=y.useState(!1),f=t.type===ge.MULTI_SELECT||t.mode==="multiple",p=w=>!w||w.kind==="static"?[]:w.deps||[],m=y.useMemo(()=>{const g=p(t.optionsSource).map(C=>qn(s,C));return JSON.stringify(g)},[t.optionsSource,s]);y.useEffect(()=>{if(!t.optionsSource||t.optionsSource.kind==="static"){c(bA(t));return}const w=t.optionsSource;if(!a){c(w.fallbackOptions||t.options||[]);return}const C=p(w).reduce((x,D)=>(x[D]=qn(s,D),x),{}),S={...w.params||{},deps:C};d(!0);let k=!1;return a(w.action,S,{values:s}).then(x=>{k||c(x)}).catch(()=>{k||c(w.fallbackOptions||t.options||[])}).finally(()=>{k||d(!1)}),()=>{k=!0}},[m,t.optionsSource,t.options]);const b=()=>{var w;(w=n.eventHandlers)==null||w.onBlur(t.name)},v=()=>{var w;(w=n.eventHandlers)==null||w.onFocus(t.name)};return h.jsx(_.Select,{disabled:e,placeholder:t.placeholder,options:l,mode:f?"multiple":t.mode,showSearch:t.showSearch,allowClear:t.allowClear,maxTagCount:t.maxTagCount,loading:u,value:r,onChange:o,onBlur:b,onFocus:v,id:i})};wA.displayName="SelectFieldControl";function bA(t){var n;if((n=t.options)!=null&&n.length)return t.options;const e=t.optionsSource;return e?e.kind==="static"?e.items||[]:e.fallbackOptions||[]:[]}const vA=ft(wA,{supportsVariableInsert:!1,needsFormItemName:!0}),yA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Switch,{disabled:e,checkedChildren:t.checkedChildren,unCheckedChildren:t.unCheckedChildren,checked:n,onChange:r,id:o});yA.displayName="SwitchFieldControl";const vU=ft(yA,{needsFormItemName:!0,valuePropName:"checked"}),CA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.TreeSelect,{disabled:e,placeholder:t.placeholder,treeData:t.options,multiple:t.multiple,showSearch:t.showSearch,allowClear:t.allowClear,treeCheckable:t.treeCheckable,value:n,onChange:r,id:o});CA.displayName="TreeSelectFieldControl";const yU=ft(CA,{needsFormItemName:!0}),kA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.AutoComplete,{disabled:e,placeholder:t.placeholder,options:t.options,allowClear:t.allowClear,value:n,onChange:r,id:o});kA.displayName="AutoCompleteFieldControl";const CU=ft(kA,{needsFormItemName:!0}),SA=({disabled:t,value:e,onChange:n})=>h.jsx(_.ColorPicker,{disabled:t,value:e,onChange:(r,o)=>n==null?void 0:n(o)});SA.displayName="ColorPickerFieldControl";const kU=ft(SA,{needsFormItemName:!0}),EA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Mentions,{disabled:e,placeholder:t.placeholder,value:n,onChange:r,id:o});EA.displayName="MentionsFieldControl";const SU=ft(EA,{needsFormItemName:!0}),xA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Rate,{disabled:e,count:t.count,allowHalf:t.allowHalf,value:n,onChange:r,id:o});xA.displayName="RateFieldControl";const EU=ft(xA,{needsFormItemName:!0}),DA=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Slider,{disabled:e,min:t.min,max:t.max,step:t.step,marks:t.marks,range:t.range,value:n,onChange:i=>r==null?void 0:r(i),id:o});DA.displayName="SliderFieldControl";const xU=ft(DA,{needsFormItemName:!0}),_A=({field:t,disabled:e,value:n,onChange:r,id:o})=>h.jsx(_.Upload,{disabled:e,accept:t.accept,maxCount:t.maxCount,listType:t.listType||"text",action:t.action,multiple:t.multiple,fileList:n,onChange:r,id:o,children:h.jsx(_.Button,{icon:h.jsx(ie.UploadOutlined,{}),disabled:e,children:"上传文件"})});_A.displayName="UploadFieldControl";const DU=ft(_A,{needsFormItemName:!0});function AA(t=Mc){t.register(ge.TEXT,q7),t.register(ge.TEXTAREA,U7),t.register(ge.NUMBER,j7),t.register(ge.PASSWORD,W7),t.register(ge.SELECT,vA),t.register(ge.MULTI_SELECT,vA),t.register(ge.RADIO,bU),t.register(ge.CHECKBOX,gU),t.register(ge.CHECKBOX_GROUP,wU),t.register(ge.SWITCH,vU),t.register(ge.CASCADER,mU),t.register(ge.TREE_SELECT,yU),t.register(ge.DATE,tU),t.register(ge.DATETIME,iU),t.register(ge.DATE_RANGE,rU),t.register(ge.TIME,aU),t.register(ge.TIME_RANGE,cU),t.register(ge.UPLOAD,DU),t.register(ge.RATE,EU),t.register(ge.SLIDER,xU),t.register(ge.COLOR_PICKER,kU),t.register(ge.MENTIONS,SU),t.register(ge.AUTO_COMPLETE,CU),t.register(ge.LABEL,pU),t.register(ge.HIDDEN,dU),t.register(ge.JSON,hU),t.register(ge.DIVIDER,uU),t.register(ge.INFO_CARD,fU),t.register(ge.ARRAY,R7),t.register(ge.OBJECT,DW),t.register(ge.KEY_VALUE,kW),t.register(ge.ARRAY_OBJECT,lW)}AA();const Gg=({field:t,disabled:e,required:n,readOnly:r,rules:o,values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u})=>{const d=Ic(),f=e??As(t.disabled,i,!1),p=n??As(t.required,i,!1),m=r??As(t.readOnly,i,!1),b=o??Ei(t.rules||[],i,t.type),v={values:i,optionsLoader:s,validateVariable:a,renderVariableTag:l,renderVariableTooltip:c,eventHandlers:u},w=d.get(t.type);if(!w)return h.jsxs("span",{children:["不支持的字段类型: ",t.type]});const{component:g,meta:C}=w;return C.isDisplayOnly?h.jsx(g,{field:t,disabled:f,readOnly:m,context:v}):C.isComplexField?h.jsx(_.Form.Item,{label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:p,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,children:h.jsx(g,{field:t,disabled:f,readOnly:m,context:v})}):C.isHidden?h.jsx(_.Form.Item,{name:C.needsFormItemName!==!1?t.name:void 0,hidden:!0,rules:b,valuePropName:C.valuePropName,validateTrigger:t.validateTrigger,children:h.jsx(g,{field:t,disabled:f,readOnly:m,context:v})}):h.jsx(_.Form.Item,{name:C.needsFormItemName!==!1?t.name:void 0,label:t.label,tooltip:t.tooltip,extra:t.helpText||t.extra||t.description,required:p,rules:b,labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,valuePropName:C.valuePropName,validateTrigger:t.validateTrigger,children:h.jsx(g,{field:t,disabled:f,readOnly:m,context:v})})},_U=Object.freeze(Object.defineProperty({__proto__:null,FieldRenderer:Gg},Symbol.toStringTag,{value:"Module"})),AU={meta:{name:"antd-5x-apple-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#007AFF",colorInfo:"#007AFF",colorSuccess:"#34C759",colorWarning:"#FF9F0A",colorError:"#FF3B30",colorTextBase:"#0B0B0F",colorBgBase:"#FFFFFF",colorBorder:"#D1D1D6",colorBorderSecondary:"#E5E5EA",colorPrimaryBorder:"#007AFF",colorPrimaryBorderHover:"#007AFF",colorPrimaryHover:"#0066D6",colorPrimaryActive:"#0056B3",controlOutlineWidth:2,controlOutline:"rgba(0, 122, 255, 0.25)",fontFamily:'"SF Pro Text", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:10,borderRadiusSM:8,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:52,sizeUnit:4,sizeStep:4,padding:16,paddingXS:10,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:10,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 10px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)",boxShadowSecondary:"0 6px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06)",boxShadowTertiary:"0 2px 8px rgba(0,0,0,0.08)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:18,paddingInlineLG:20,paddingInlineSM:14,contentFontSize:14,contentFontSizeLG:16,contentFontSizeSM:14,primaryShadow:"0 2px 0 rgba(0,122,255,0.14)",dangerShadow:"0 2px 0 rgba(255,59,48,0.12)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:14},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:44,controlHeightLG:52,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:44,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,paddingInline:14,paddingInlineSM:12,paddingInlineLG:14,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:12,borderRadius:10,hoverBorderColor:"#C7C7CC",activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Layout:{headerBg:"#FFFFFF",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F2F2F7",siderBg:"#FFFFFF",triggerBg:"#F2F2F7"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:52},Menu:{itemHeight:44,iconSize:16,collapsedIconSize:18,horizontalItemBorderRadius:10,itemBorderRadius:10},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:14},Notification:{},Pagination:{itemSize:44,itemSizeSM:36},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#007AFF"},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:52,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F2F2F7",headerSortActiveBg:"#EDEDF2",headerSortHoverBg:"#F2F2F7",rowHoverBg:"#F2F2F7",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:52,activeBorderColor:"#007AFF",activeShadow:"0 0 0 2px rgba(0, 122, 255, 0.25)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:36,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},OU={meta:{name:"antd-5x-google-material3-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#1A73E8",colorInfo:"#1A73E8",colorSuccess:"#34A853",colorWarning:"#FBBC04",colorError:"#EA4335",colorTextBase:"#202124",colorBgBase:"#FFFFFF",colorBorder:"#DADCE0",colorBorderSecondary:"#E0E3E7",colorPrimaryBorder:"#1A73E8",colorPrimaryBorderHover:"#1A73E8",colorPrimaryHover:"#1967D2",colorPrimaryActive:"#174EA6",controlOutlineWidth:2,controlOutline:"rgba(26, 115, 232, 0.24)",fontFamily:'"Google Sans", Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.5714285714285714,borderRadius:8,borderRadiusSM:4,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:56,controlHeightSM:40,controlHeightLG:64,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(60,64,67,0.16), 0 2px 6px rgba(60,64,67,0.12)",boxShadowSecondary:"0 2px 8px rgba(60,64,67,0.14)",boxShadowTertiary:"0 1px 3px rgba(60,64,67,0.12)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:999,borderRadiusSM:999,borderRadiusLG:999,controlHeight:40,controlHeightSM:32,controlHeightLG:48,paddingInline:24,paddingInlineLG:24,paddingInlineSM:16,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(26,115,232,0.20)",dangerShadow:"0 1px 0 rgba(234,67,53,0.18)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:4},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:40,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:14,paddingBlockSM:8,paddingBlockLG:16,borderRadius:4,hoverBorderColor:"#BDC1C6",activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},InputNumber:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Layout:{headerBg:"#202124",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8F9FA",siderBg:"#202124",triggerBg:"#303134"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:56,controlHeightSM:40,controlHeightLG:64},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:12,itemBorderRadius:12},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:16},Notification:{},Pagination:{itemSize:40,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{buttonSolidCheckedBg:"#1A73E8"},Rate:{},Result:{},Segmented:{controlHeight:40},Select:{controlHeight:56,controlHeightSM:40,controlHeightLG:64,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:24,trackMinWidth:44,handleSize:20},Table:{headerBg:"#F8F9FA",headerSortActiveBg:"#F1F3F4",headerSortHoverBg:"#F3F5F6",rowHoverBg:"#F8F9FA",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:4,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 18px"},Tag:{borderRadiusSM:8},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:56,controlHeightSM:40,controlHeightLG:64,activeBorderColor:"#1A73E8",activeShadow:"0 0 0 2px rgba(26, 115, 232, 0.24)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}},TU={meta:{name:"antd-5x-preline-pixel-aligned-full",algorithm:"defaultAlgorithm"},token:{colorPrimary:"#2563EB",colorInfo:"#2563EB",colorSuccess:"#16A34A",colorWarning:"#F59E0B",colorError:"#EF4444",colorTextBase:"#0F172A",colorBgBase:"#FFFFFF",colorBorder:"#E5E7EB",colorBorderSecondary:"#E5E7EB",colorPrimaryBorder:"#3B82F6",colorPrimaryBorderHover:"#3B82F6",colorPrimaryHover:"#1D4ED8",colorPrimaryActive:"#1E40AF",controlOutlineWidth:1,controlOutline:"rgba(59, 130, 246, 0.45)",fontFamily:'Graphik, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,lineHeight:1.6,borderRadius:8,borderRadiusSM:6,borderRadiusLG:12,lineWidth:1,lineType:"solid",controlHeight:44,controlHeightSM:36,controlHeightLG:48,sizeUnit:4,sizeStep:4,padding:16,paddingXS:8,paddingSM:12,paddingLG:24,paddingXL:32,margin:16,marginXS:8,marginSM:12,marginLG:24,marginXL:32,wireframe:!1,motion:!0,motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInOutBack:"cubic-bezier(0.71, -0.46, 0.29, 1.46)",opacityImage:1,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",boxShadow:"0 1px 2px rgba(15,23,42,0.06), 0 6px 18px rgba(15,23,42,0.08)",boxShadowSecondary:"0 1px 2px rgba(15,23,42,0.05), 0 10px 24px rgba(15,23,42,0.10)",boxShadowTertiary:"0 1px 2px rgba(15,23,42,0.06)",screenXS:480,screenXSMin:480,screenXSMax:575,screenSM:576,screenSMMin:576,screenSMMax:767,screenMD:768,screenMDMin:768,screenMDMax:991,screenLG:992,screenLGMin:992,screenLGMax:1199,screenXL:1200,screenXLMin:1200,screenXLMax:1599,screenXXL:1600,screenXXLMin:1600},components:{Alert:{borderRadiusLG:12},Anchor:{linkPaddingInlineStart:16},AutoComplete:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Avatar:{containerSize:32,containerSizeLG:40,containerSizeSM:24,textFontSize:14,textFontSizeLG:16,textFontSizeSM:12},BackTop:{},Badge:{indicatorHeight:16},Breadcrumb:{separatorMargin:8},Button:{borderRadius:8,borderRadiusSM:8,borderRadiusLG:10,controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineLG:18,paddingInlineSM:12,contentFontSize:14,contentFontSizeLG:14,contentFontSizeSM:14,primaryShadow:"0 1px 0 rgba(37,99,235,0.18)",dangerShadow:"0 1px 0 rgba(239,68,68,0.16)"},Calendar:{fullBg:"#ffffff"},Card:{headerBg:"transparent",headerFontSize:16,headerHeight:56,paddingLG:24,borderRadiusLG:12},Carousel:{},Cascader:{},Checkbox:{borderRadiusSM:6},Collapse:{headerPadding:"12px 16px",contentPadding:"16px 16px"},ColorPicker:{},ConfigProvider:{},DatePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Descriptions:{titleMarginBottom:16,itemPaddingBottom:16},Divider:{textPaddingInline:12},Drawer:{paddingLG:24},Dropdown:{},Empty:{},FloatButton:{controlHeight:40,controlHeightLG:48,borderRadius:999},Form:{itemMarginBottom:24,labelHeight:36,labelColonMarginInlineStart:2,labelColonMarginInlineEnd:8},Grid:{},Image:{},Input:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,paddingInline:16,paddingInlineSM:12,paddingInlineLG:16,paddingBlock:10,paddingBlockSM:8,paddingBlockLG:10,borderRadius:8,hoverBorderColor:"#D1D5DB",activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},InputNumber:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Layout:{headerBg:"#0B1220",headerHeight:64,headerPadding:"0 50px",bodyBg:"#F8FAFC",siderBg:"#0B1220",triggerBg:"#0F1A2E"},List:{itemPadding:"12px 0"},Mentions:{controlHeight:44,controlHeightSM:36,controlHeightLG:48},Menu:{itemHeight:40,iconSize:14,collapsedIconSize:16,horizontalItemBorderRadius:8,itemBorderRadius:8},Message:{},Modal:{headerBg:"transparent",titleFontSize:16,paddingMD:20,paddingContentHorizontalLG:24,paddingContentVerticalLG:16,borderRadiusLG:12},Notification:{},Pagination:{itemSize:36,itemSizeSM:32},Popconfirm:{},Popover:{},Progress:{},QRCode:{},Radio:{},Rate:{},Result:{},Segmented:{controlHeight:36},Select:{controlHeight:44,controlHeightSM:36,controlHeightLG:48,multipleItemHeight:28,showArrowPaddingInlineEnd:18},Skeleton:{},Slider:{},Space:{},Spin:{},Statistic:{},Steps:{iconSize:32,iconFontSize:16},Switch:{trackHeight:22,trackMinWidth:44,handleSize:18},Table:{headerBg:"#F8FAFC",headerSortActiveBg:"#F1F5F9",headerSortHoverBg:"#F3F6FB",rowHoverBg:"#F8FAFC",cellPaddingBlock:12,cellPaddingInline:16},Tabs:{cardGutter:6,horizontalMargin:"0 0 16px 0",horizontalItemPadding:"12px 16px"},Tag:{borderRadiusSM:6},Timeline:{},TimePicker:{cellHeight:24,timeColumnWidth:56,controlHeight:44,controlHeightSM:36,controlHeightLG:48,activeBorderColor:"#3B82F6",activeShadow:"0 0 0 1px rgba(59, 130, 246, 0.45)"},Tooltip:{},Tour:{},Transfer:{},Tree:{nodeHeight:32,titleHeight:24},TreeSelect:{},Typography:{titleMarginTop:0,titleMarginBottom:8},Upload:{},Watermark:{}}};function NU(t){return"optionsSource"in t&&t.optionsSource&&t.optionsSource.kind!=="static"?t.optionsSource.deps||[]:[]}function BU(t){const e=[];for(const n of t.fields){const r=NU(n);if(r.length>0)for(const o of r)e.push({id:`auto-clear-${n.name}-on-${o}-change`,trigger:{type:"fieldChange",field:o},actions:[{type:"clearFields",targets:[n.name]}]})}return e}function FU(t,e,n=!0){return[...n?BU(t):[],...e||[]]}const MU={default:Bh,apple:AU,google:OU,preline:TU};function Rg({schema:t,disabled:e=!1,initialValues:n,onSubmit:r,onChange:o,onValuesObserved:i,submitLabel:s="提交",showReset:a=!1,resetLabel:l="重置",onReset:c,form:u,showSubmit:d=!0,optionsLoader:f,nodeId:p,mcpMode:m,validateVariable:b,renderVariableTag:v,renderVariableTooltip:w,availableVariables:g,theme:C,customTheme:S,locale:k,prefixCls:x,events:D,customHandlers:E,maxExecutionDepth:O,debugEvents:A,preRender:T}){var Y;const[B]=_.Form.useForm(),M=u||B,F=vt.useMemo(()=>{const W={};for(const X of t.fields)X.defaultValue!==void 0&&(W[X.name]=X.defaultValue);return{...W,...n||{}}},[t.fields,n]),N=vt.useMemo(()=>{const W=t.enableAutoEvents!==!1,X=t.events||[],re=D||[];return FU(t,[...X,...re],W)},[t,D]),P=h2({events:N,form:M,optionsLoader:f,customHandlers:E,maxExecutionDepth:O,debug:A}),I=vt.useRef({}),z=vt.useMemo(()=>{if(S)return S;if(C)return MU[C]},[S,C]),H=_.Form.useWatch([],M),J=vt.useMemo(()=>JSON.stringify({...F||{},...H||{}}),[F,H]),K=vt.useMemo(()=>({...F||{},...H||{}}),[J]),ee=vt.useRef(J);vt.useEffect(()=>{!i||ee.current===J||(ee.current=J,i(K))},[i,K,J]);const[$,U]=vt.useState({}),R=vt.useRef({});vt.useEffect(()=>{var X;const W={};for(const re of t.fields){const Z=yl(re,K);if(W[re.name]=Z,R.current[re.name]===!0&&Z===!1){const ve=$7(re),we=((X=re.visibleWhen)==null?void 0:X.clearOnHide)??!0;ve==="unregister"&&M.setFieldValue(re.name,we?void 0:M.getFieldValue(re.name))}}R.current=W,U(re=>{const Z=Object.keys(re),de=Object.keys(W);return Z.length===de.length&&de.every(ve=>re[ve]===W[ve])?re:W})},[t.fields,M,K]);const te=async W=>{const X=t.pruneInvisibleOnSubmit===!1?W:H7(t,W,$);await(r==null?void 0:r(X))},se=(W,X)=>{if(o==null||o(W,X),P.triggerFieldChange&&W){const re=I.current;for(const Z in W){const de=qn(re,Z),ve=W[Z];P.triggerFieldChange(Z,ve,de)}}I.current={...X}},be=d||a,j=vt.useMemo(()=>({nodeId:p,mcpMode:m,validateVariable:b,renderVariableTag:v,renderVariableTooltip:w,availableVariables:g}),[p,m,b,v,w,g]);return h.jsx(oC,{customTheme:z,locale:k,prefixCls:x,children:h.jsx(lC,{value:j,children:h.jsxs(_.Form,{form:M,disabled:e,autoComplete:"off",layout:t.layout||"vertical",labelCol:t.labelCol,wrapperCol:t.wrapperCol,colon:t.colon,size:t.size,initialValues:F,onFinish:te,onValuesChange:se,className:"workflow-config-form",children:[T&&T,t.fields.map(W=>{if(!yl(W,K))return null;const re=e||As(W.disabled,K,!1),Z=As(W.required,K,!1),de=Ei(W.rules||[],K,W.type),ve=(W.rules||[]).some(fe=>fe.type==="required"),we=Z&&!ve?[qg(`${W.label||W.name}为必填项`),...de]:de;return h.jsx(Gg,{field:W,disabled:re,required:Z,rules:we,values:K,optionsLoader:f,validateVariable:b,renderVariableTag:v,renderVariableTooltip:w,eventHandlers:P.fieldEventHandlers},W.name)}),be&&h.jsx(_.Form.Item,{wrapperCol:{offset:((Y=t.labelCol)==null?void 0:Y.span)||0},children:h.jsxs(_.Space,{children:[a&&h.jsx(_.Button,{disabled:e,onClick:()=>{M.resetFields(),c==null||c()},children:l}),d&&h.jsx(_.Button,{type:"primary",htmlType:"submit",children:s})]})})]})})})}const Sl=()=>{const t=Pt();return y.useCallback((e,n=!1)=>{if(/^https?:\/\//i.test(e)){window.open(e,"_blank");return}if(t.onNavigate){t.onNavigate(e,n);return}n?window.open(e,"_blank"):ac.push(e)},[t.onNavigate])},Kg=y.forwardRef((t,e)=>{const n=Sl(),[r,o]=y.useState([]),[i,s]=y.useState("");y.useEffect(()=>{s(t.proxyId)},[t.proxyId]),y.useEffect(()=>{qf().then(c=>{o(c??[])})},[]);const a=()=>i;y.useImperativeHandle(e,()=>({getProxyId:a}));const l=c=>{s(c)};return h.jsxs(WB,{label:G("link.flow.use_proxy_gateway"),children:[h.jsxs(_.Select,{className:"proxy_id_select",value:i,dropdownStyle:{zIndex:Bc.nestedPopover},onChange:l,style:{width:"100%"},children:[h.jsx(_.Select.Option,{value:"0",children:h.jsx(Te.FormattedMessage,{id:"link.flow.do_not_use"})}),r.map(c=>h.jsx(_.Select.Option,{value:c.id,children:c.group_name},c.id))]}),h.jsxs("p",{className:"field-desc",children:[h.jsx(Te.FormattedMessage,{id:"link.flow.private_network_deployment"}),h.jsx("span",{style:{margin:"0 2px"},onClick:()=>{n("/setting/gateway")},children:h.jsx(Te.FormattedMessage,{id:"link.flow.proxy_gateway"})}),h.jsx(Te.FormattedMessage,{id:"link.flow.secure_connection"})]})]})}),IU="RDBMS_ACCOUNT",PU=t=>t===IU,OA=({formSchema:t,initialValues:e,connector:n,proxy_id:r,authType:o,onCancel:i,onSubmit:s})=>{const[a]=_.Form.useForm(),l=y.useRef(null),c=(n==null?void 0:n.deployment_type)!=="SaasApp",u=PU(o);y.useEffect(()=>{e&&a.setFieldsValue(e)},[a,e]);const d=async f=>{var m;const p=await a.validateFields();c&&(p.proxy_id=(m=l.current)==null?void 0:m.getProxyId()),s(p,f)};return h.jsxs("div",{className:Gr.formLayout,children:[h.jsxs("div",{className:Gr.formContent,children:[h.jsx(Rg,{schema:t,form:a,initialValues:e,showSubmit:!1,showReset:!1,customTheme:sc}),c?h.jsx(Kg,{proxyId:r||"0",ref:l}):null]}),h.jsx("div",{className:Gr.formActions,children:h.jsxs(_.Space,{children:[h.jsx(_.Button,{onClick:i,children:"取消"}),u?h.jsx(_.Button,{onClick:()=>d(!0),children:"测试连接"}):null,h.jsx(_.Button,{type:"primary",onClick:()=>d(!1),children:"保存"})]})})]})},LU=t=>h.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",value:Ht(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD")))}}),$U=t=>h.jsx(_.DatePicker,{style:{width:"100%"},picker:"date",showTime:!0,value:Ht(t.value?t.value:new Date),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("YYYY-MM-DD hh:mm:ss")))}}),zU=({value:t=[],onChange:e,valueType:n})=>{const r=a=>{const l=[...t];l.splice(a,1),e==null||e(l)},o=()=>{e==null||e([...t,{key:"",value:""}])},i=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,key:l}:c))},s=(a,l)=>{e==null||e(t.map((c,u)=>u===a?{...c,value:l}:c))};return h.jsxs("div",{children:[t.map((a,l)=>h.jsxs(_.Space,{size:"small",style:{display:"flex",marginBottom:8,width:"100%"},align:"center",children:[h.jsx(_.Input,{value:a.key,onChange:c=>i(l,c.target.value),placeholder:"Key"}),h.jsx(_.Input,{placeholder:"Value",style:{width:300},value:a.value,onChange:c=>s(l,c.target.value)}),h.jsx(_.Button,{icon:h.jsx(xi,{size:16}),onClick:()=>{r(l)}})]},a.key)),h.jsxs(_.Button,{type:"default",onClick:o,block:!0,children:[h.jsx(br,{size:16})," ",h.jsx(Te.FormattedMessage,{id:"app.common.word.add-field"})]})]})},HU=t=>null;class Pd{constructor(e,n,r,o,i,s,a,l,c,u=0,d){this.p=e,this.stack=n,this.state=r,this.reducePos=o,this.pos=i,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let o=e.parser.context;return new Pd(e,[],n,r,r,0,[],0,o?new TA(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,o=e&65535,{parser:i}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(o);if(a&&(this.score+=a),r==0){this.pushState(i.getGoto(this.state,o,!0),this.reducePos),o<i.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(o,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[o])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-d;if(o<i.minRepeatTerm||e&131072){let p=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=i.getGoto(p,o,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(o,c)}storeNode(e,n,r,o=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==r)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,o);else{let s=this.buffer.length;if(s>0&&(this.buffer[s-4]!=0||this.buffer[s-1]<0)){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>r;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,o>4&&(o-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=r,this.buffer[s+3]=o}}shift(e,n,r,o){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:s}=this.p;this.pos=o,!s.stateFlag(i,1)&&(o>r||n<=s.maxNode)&&(this.reducePos=o),this.pushState(i,Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=s.maxNode&&this.buffer.push(n,r,o,4)}else this.pos=o,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,o,4)}apply(e,n,r,o){e&65536?this.reduce(e):this.shift(e,n,r,o)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(n,o),this.buffer.push(r,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),o=e.bufferBase+n;for(;e&&o==e.bufferBase;)e=e.parent;return new Pd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new VU(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let o=[];for(let i=0,s;i<n.length;i+=2)(s=n[i+1])!=this.state&&this.p.parser.hasAction(s,e)&&o.push(n[i],s);if(this.stack.length<120)for(let i=0;o.length<8&&i<n.length;i+=2){let s=n[i+1];o.some((a,l)=>l&1&&a==s)||o.push(n[i],s)}n=o}let r=[];for(let o=0;o<n.length&&r.length<4;o+=2){let i=n[o+1];if(i==this.state)continue;let s=this.split();s.pushState(i,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[o],this.pos),s.reducePos=this.pos,s.score-=200,r.push(s)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,o=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],o,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(o,i)=>{if(!n.includes(o))return n.push(o),e.allActions(o,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-i;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(s,i+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new TA(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class TA{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class VU{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=o}}class Ld{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new Ld(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Ld(this.stack,this.pos,this.index)}}function $d(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,o=0;r<t.length;){let i=0;for(;;){let s=t.charCodeAt(r++),a=!1;if(s==126){i=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[o++]=i:n=new e(i)}return n}class zd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const NA=new zd;class jU{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=NA,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,o=this.rangeIndex,i=this.pos+e;for(;i<r.from;){if(!o)return null;let s=this.ranges[--o];i-=r.from-s.to,r=s}for(;n<0?i>r.to:i>=r.to;){if(o==this.ranges.length-1)return null;let s=this.ranges[++o];i+=s.from-r.to,r=s}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,o;if(n>=0&&n<this.chunk.length)r=this.pos+e,o=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(r=i,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),o=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),o}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=NA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let o of this.ranges){if(o.from>=n)break;o.to>e&&(r+=this.input.read(Math.max(o.from,e),Math.min(o.to,n)))}return r}}class Os{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;WU(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}Os.prototype.contextual=Os.prototype.fallback=Os.prototype.extend=!1,Os.prototype.fallback=Os.prototype.extend=!1;function WU(t,e,n,r,o,i){let s=0,a=1<<r,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let p=s+3;p<c;p+=2)if((t[p+1]&a)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||UU(m,e.token.value,o,i))){e.acceptToken(m);break}}let u=e.next,d=0,f=t[s+2];if(e.next<0&&f>d&&t[c+f*3-3]==65535){s=t[c+f*3-1];continue e}for(;d<f;){let p=d+f>>1,m=c+p+(p<<1),b=t[m],v=t[m+1]||65536;if(u<b)f=p;else if(u>=v)d=p+1;else{s=t[m+2],e.advance();continue e}}break}}function BA(t,e,n){for(let r=e,o;(o=t[r])!=65535;r++)if(o==n)return r-e;return-1}function UU(t,e,n,r){let o=BA(n,r,e);return o<0||BA(n,r,t)<o}const Pn=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG);let Yg=null;function FA(t,e,n){let r=t.cursor(Ct.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class qU{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?FA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?FA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],o=this.index[n];if(o==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=r.children[o],s=this.start[n]+r.positions[o];if(s>e)return this.nextStart=s,null;if(i instanceof xt){if(s==e){if(s<this.safeFrom)return null;let a=s+i.length;if(a<=this.safeTo){let l=i.prop(Qe.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[n]++,s+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+i.length}}}class GU{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new zd)}getActions(e){let n=0,r=null,{parser:o}=e.p,{tokenizers:i}=o,s=o.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<i.length;c++){if((1<<c&s)==0)continue;let u=i[c],d=this.tokens[c];if(!(r&&!u.fallback)&&((u.contextual||d.start!=e.pos||d.mask!=s||d.context!=a)&&(this.updateCachedToken(d,u,e),d.mask=s,d.context=a),d.lookAhead>d.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let f=n;if(d.extended>-1&&(n=this.addActions(e,d.extended,d.end,n)),n=this.addActions(e,d.value,d.end,n),!u.extend&&(r=d,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new zd,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new zd,{pos:r,p:o}=e;return n.start=r,n.end=Math.min(r+1,o.stream.end),n.value=r==o.stream.end?o.parser.eofTerm:0,n}updateCachedToken(e,n,r){let o=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(o,e),r),e.value>-1){let{parser:i}=r.p;for(let s=0;s<i.specialized.length;s++)if(i.specialized[s]==e.value){let a=i.specializers[s](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,n,r,o){for(let i=0;i<o;i+=3)if(this.actions[i]==e)return o;return this.actions[o++]=e,this.actions[o++]=n,this.actions[o++]=r,o}addActions(e,n,r,o){let{state:i}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(i,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=ro(a,c+2);else{o==0&&a[c+1]==2&&(o=this.putAction(ro(a,c+2),n,r,o));break}a[c]==n&&(o=this.putAction(ro(a,c+1),n,r,o))}return o}}class RU{constructor(e,n,r,o){this.parser=e,this.input=n,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new jU(n,o),this.tokens=new GU(e,this.stream),this.topTerm=e.top[1];let{from:i}=o[0];this.stacks=[Pd.start(this,e.top[0],i)],this.fragments=r.length&&this.stream.end-i>e.bufferLength*4?new qU(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],o,i;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>n)r.push(a);else{if(this.advanceStack(a,r,e))continue;{o||(o=[],i=[]),o.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!r.length){let s=o&&YU(o);if(s)return Pn&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw Pn&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&o){let s=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,i,r);if(s)return Pn&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(r.length>s)for(r.sort((a,l)=>l.score-a.score);r.length>s;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let s=0;s<r.length-1;s++){let a=r[s];for(let l=s+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(s--,1);continue e}}}r.length>12&&(r.sort((s,a)=>a.score-s.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let s=1;s<r.length;s++)r[s].pos<this.minStackPos&&(this.minStackPos=r[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let o=e.pos,{parser:i}=this,s=Pn?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(o);d;){let f=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(e.state,d.type.id):-1;if(f>-1&&d.length&&(!c||(d.prop(Qe.contextHash)||0)==u))return e.useNode(d,f),Pn&&console.log(s+this.stackID(e)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof xt)||d.children.length==0||d.positions[0]>0)break;let p=d.children[0];if(p instanceof xt&&d.positions[0]==0)d=p;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),Pn&&console.log(s+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],d=l[c++],f=l[c++],p=c==l.length||!r,m=p?e:e.split(),b=this.tokens.mainToken;if(m.apply(u,d,b?b.start:m.pos,f),Pn&&console.log(s+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${i.getName(u&65535)}`} for ${i.getName(d)} @ ${o}${m==e?"":", split"})`),p)return!0;m.pos>o?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return MA(e,n),!0}}runRecovery(e,n,r){let o=null,i=!1;for(let s=0;s<e.length;s++){let a=e[s],l=n[s<<1],c=n[(s<<1)+1],u=Pn?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),Pn&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let d=a.split(),f=u;for(let p=0;p<10&&d.forceReduce()&&(Pn&&console.log(f+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,r));p++)Pn&&(f=this.stackID(d)+" -> ");for(let p of a.recoverByInsert(l))Pn&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Pn&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),MA(a,r)):(!o||o.score<d.score)&&(o=d)}return o}stackToTree(e){return e.close(),xt.build({buffer:Ld.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(Yg||(Yg=new WeakMap)).get(e);return n||Yg.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function MA(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class KU{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}}class Hd extends EC{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;a<e.repeatNodeCount;a++)n.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),o=[];for(let a=0;a<n.length;a++)o.push([]);function i(a,l,c){o[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Qe[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)i(u,l,a[c++]);else{let d=a[c+-u];for(let f=-u;f>0;f--)i(a[c++],l,d);c++}}}this.nodeSet=new Lh(n.map((a,l)=>vn.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:o[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=wC;let s=$d(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(IA),this.states=$d(e.states,Uint32Array),this.data=$d(e.stateData),this.goto=$d(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Os(s,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let o=new RU(this,e,n,r);for(let i of this.wrappers)o=i(o,e,n,r);return o}getGoto(e,n,r=!1){let o=this.goto;if(n>=o[0])return-1;for(let i=o[n+1];;){let s=o[i++],a=s&1,l=o[i++];if(a&&r)return l;for(let c=i+(s>>1);i<c;i++)if(o[i]==e)return l;if(a)return-1}}hasAction(e,n){let r=this.data;for(let o=0;o<2;o++)for(let i=this.stateSlot(e,o?2:1),s;;i+=3){if((s=r[i])==65535)if(r[i+1]==1)s=r[i=ro(r,i+2)];else{if(r[i+1]==2)return ro(r,i+2);break}if(s==n||s==0)return ro(r,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),o=r?n(r):void 0;for(let i=this.stateSlot(e,1);o==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ro(this.data,i+2);else break;o=n(ro(this.data,i+1))}return o}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=ro(this.data,r+2);else break;if((this.data[r+2]&1)==0){let o=this.data[r+1];n.some((i,s)=>s&1&&i==o)||n.push(this.data[r],o)}}return n}configure(e){let n=Object.assign(Object.create(Hd.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let o=e.tokenizers.find(i=>i.from==r);return o?o.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,o)=>{let i=e.specializers.find(a=>a.from==r.external);if(!i)return r;let s=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[o]=IA(s),s})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let s=n.indexOf(i);s>=0&&(r[s]=!0)}let o=null;for(let i=0;i<n.length;i++)if(!r[i])for(let s=this.dialects[n[i]],a;(a=this.data[s++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[a]=1;return new KU(e,r,o)}static deserialize(e){return new Hd(e)}}function ro(t,e){return t[e]|t[e+1]<<16}function YU(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function IA(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}const XU=xC({String:V.string,Number:V.number,"True False":V.bool,PropertyName:V.propertyName,Null:V.null,", :":V.separator,"[ ]":V.squareBracket,"{ }":V.brace}),JU=Hd.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[XU],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),QU=Au.define({name:"json",parser:JU.configure({props:[rS.add({Object:iS({except:/^\s*\}/}),Array:iS({except:/^\s*\]/})}),sS.add({"Object Array":o8})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function PA(){return new G3(QU)}const ZU=t=>h.jsx(td,{height:"300px",style:{borderRadius:4,overflow:"hidden"},theme:bm,extensions:[PA()],...t}),{Text:eq}=_.Typography,tq=t=>h.jsx("div",{style:{padding:6,paddingRight:0,border:"1px solid #b0b5cb",borderRadius:4},children:h.jsx(_.Tooltip,{title:t.value,color:"cyan",placement:"topLeft",styles:{body:{width:500}},children:h.jsx(eq,{style:{color:"#b0b5cb"},ellipsis:!0,copyable:{text:t.value},children:t.value})})}),nq=t=>h.jsx(_.Input.Password,{addonBefore:G("link.flow.cipherText"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),rq=t=>{var r;const{multiple:e,...n}=t;return h.jsx(_.Select,{style:{borderRadius:6},mode:e?"multiple":void 0,...n,getPopupContainer:o=>o.parentNode,children:(r=t==null?void 0:t.options)==null?void 0:r.map(o=>h.jsx(_.Select.Option,{label:o.label,value:o.value,children:o.label},o.value))})},{TextArea:oq}=_.Input,iq=t=>h.jsx(oq,{value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),sq=t=>h.jsx(_.Input,{addonBefore:G("link.flow.text"),value:t.value,onChange:e=>{var n;return(n=t.onChange)==null?void 0:n.call(t,e.target.value)}}),aq=t=>h.jsx(_.TimePicker,{style:{width:"100%"},value:Ht(t.value??"00:00:00","HH:mm:ss"),onChange:e=>{t.onChange&&(t==null||t.onChange(e==null?void 0:e.format("HH:mm:ss")))}}),lq={configFormContainer:"_configFormContainer_s061b_1"},cq=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],Xg=t=>Array.isArray(t)?t.map(e=>{if(typeof e=="string"){const s=e.trim();return s?{label:s,value:s}:null}const n=(e==null?void 0:e.value)??(e==null?void 0:e.label)??"",r=n==null?"":String(n).trim();if(!r)return null;const o=(e==null?void 0:e.label)??"";return{label:o==null?r:String(o).trim()||r,value:r}}).filter(Boolean):[],uq=t=>{const e=t.display_name;switch(t.page_control){case Ee.SELECT:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_select")+t.display_name}],label:e,name:t.name,children:h.jsx(rq,{options:Xg(t.option_value_objects??t.option_values),multiple:t.multi_valued})},t.ui_id);case Ee.EXTEND_OBJ:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(zU,{valueType:t.value_type})},t.ui_id);case Ee.HIDDEN:return h.jsx(_.Form.Item,{style:{display:"none"},required:t.required,label:e,name:t.name,children:h.jsx(HU,{})},t.ui_id);case Ee.TEXT:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(sq,{})},t.ui_id);case Ee.PASSWORD:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(nq,{})},t.ui_id);case Ee.LABEL:return h.jsx(_.Form.Item,{required:t.required,label:e,name:t.name,children:h.jsx(tq,{})},t.ui_id);case Ee.DATE:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(LU,{})},t.ui_id);case Ee.TIME:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(aq,{})},t.ui_id);case Ee.DATETIME:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx($U,{})},t.ui_id);case Ee.TEXTAREA:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(iq,{})},t.ui_id);case Ee.FIXED_OBJ:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(_.Input.TextArea,{})},t.ui_id);case Ee.JSON:return h.jsx(_.Form.Item,{required:t.required,rules:[{required:t.required,message:G("link.flow.please_enter")+t.display_name}],label:e,name:t.name,children:h.jsx(ZU,{})},t.ui_id)}},dq=t=>{switch(t.page_control){case Ee.SELECT:return t.multi_valued?[]:null;case Ee.EXTEND_OBJ:return{};case Ee.HIDDEN:return"";case Ee.TEXT:return"";case Ee.PASSWORD:return"";case Ee.LABEL:return"";case Ee.DATE:return null;case Ee.TIME:return null;case Ee.DATETIME:return null;case Ee.TEXTAREA:return"";case Ee.FIXED_OBJ:return"";case Ee.JSON:return JSON.stringify({})}},LA=y.memo(t=>{var c;const{config:e,proxy_id:n,connector:r}=t,[o]=_.Form.useForm(),i=y.useRef(null),s=St.useReactive({proxyId:"0"});y.useEffect(()=>{var u;(u=e==null?void 0:e.sub_params)!=null&&u.length&&o.setFieldsValue({...e.sub_params.reduce((d,f)=>{let p=f.value;return f.page_control===Ee.EXTEND_OBJ&&(p=cq(p)),d[f.name]=p??dq(f),d},{})})},[e,o]),y.useEffect(()=>{n&&(s.proxyId=n)},[n]);const a=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u)})},l=()=>{o.validateFields().then(async u=>{var d;u.proxy_id=(d=i.current)==null?void 0:d.getProxyId(),t.onSubmit(u,!0)})};return h.jsxs("div",{className:Gr.formLayout,style:{position:"relative"},onClick:u=>{u.stopPropagation(),u.preventDefault()},children:[h.jsx("div",{className:Gr.formContent,children:h.jsxs(_.Form,{form:o,layout:"vertical",className:`${lq.configFormContainer} workflow-credential-form`,children:[(c=e==null?void 0:e.sub_params)==null?void 0:c.map(u=>h.jsxs("div",{children:[uq(u),u.page_control!==Ee.HIDDEN&&h.jsx("p",{className:"field-desc",children:u.description})]},u.ui_id)),r.deployment_type!=="SaasApp"?h.jsx(Kg,{proxyId:s.proxyId,ref:i}):null]})}),t.auth_type==="RDBMS_ACCOUNT"&&h.jsx("div",{className:Gr.rdbmsTestAction,children:h.jsx(_.Button,{type:"primary",style:{width:"100%"},onClick:l,children:h.jsx(Te.FormattedMessage,{id:"app.common.word.connection-test"})})}),h.jsxs("div",{className:Gr.formActions,children:[h.jsx(_.Button,{icon:h.jsx(ie.RollbackOutlined,{}),style:{width:90,borderRadius:4,marginRight:10},onClick:t.onCancel,children:h.jsx(Te.FormattedMessage,{id:"app.common.word.cancel"})}),h.jsx(_.Button,{type:"primary",icon:h.jsx(ie.CloudUploadOutlined,{}),style:{width:90,borderRadius:4},onClick:()=>a(),children:h.jsx(Te.FormattedMessage,{id:"app.common.word.save"})})]})]})}),fq={overflow:"hidden"},hq=72,pq=16,mq=t=>{const{visible:e,connector:n,config:r,formSchema:o,onCancel:i,onSubmit:s,auth_type:a,inAI:l}=t;return h.jsx(_.Modal,{title:h.jsx(Te.FormattedMessage,{id:"app.common.word.add-account"}),style:{marginTop:0,paddingBottom:0,position:"absolute",top:hq,bottom:pq,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Gr.accountModal,mask:!1,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:Bc.nestedModal,width:560,styles:{body:fq},footer:null,maskClosable:!l,open:e,onCancel:i,children:o?h.jsx(OA,{formSchema:o,connector:n,authType:a,onCancel:i,onSubmit:s}):h.jsx(LA,{config:r,connector:n,nodeId:"",auth_type:a,onCancel:i,onSubmit:s})})},gq={overflow:"hidden"},wq=72,bq=16,vq=t=>{const{visible:e,connector:n,config:r,formSchema:o,initialValues:i,onCancel:s,onSubmit:a,auth_type:l,proxy_id:c,inAI:u}=t;return h.jsx(_.Modal,{title:G("link.flow.edit_account"),mask:!1,style:{marginTop:0,paddingBottom:0,position:"absolute",top:wq,bottom:bq,left:12,right:12,maxWidth:"calc(100% - 24px)",marginInline:"auto"},className:Gr.accountModal,getContainer:()=>document.getElementById("flow-designer-container"),zIndex:Bc.nestedModal,width:560,footer:null,styles:{body:gq},open:e,maskClosable:!u,onCancel:s,children:o?h.jsx(OA,{formSchema:o,initialValues:i,connector:n,proxy_id:c,authType:l,onCancel:s,onSubmit:a}):h.jsx(LA,{config:r,proxy_id:c,connector:n,nodeId:"",auth_type:l,onCancel:s,onSubmit:a})})},Di={accountOption:"_accountOption_4vdjt_14",accountName:"_accountName_4vdjt_21",nameEditIcon:"_nameEditIcon_4vdjt_34",editInputWrapper:"_editInputWrapper_4vdjt_44",nameEditInput:"_nameEditInput_4vdjt_48",accountActions:"_accountActions_4vdjt_53",updateTime:"_updateTime_4vdjt_58"},yq=t=>t?Object.keys(t).map(e=>({key:e,value:t[e]})):[],Jg=(t=[])=>{const e={};return t.forEach(n=>{e[n.key]=n.value}),e},Cq={eq:"EQ",ne:"NOT",in:"IN",notin:"NOT_IN",not_in:"NOT_IN",gt:"GT",lt:"LT",gte:"GE",lte:"LE"};function kq(t){if(!(t!=null&&t.field)||!t.operator)return;const e=Cq[String(t.operator).toLowerCase()];if(e)return{deps:[t.field],conditions:{key:t.field,keyword:e,value:t.value}}}function Sq(t){return an(t.visible_when)??kq(t.display_condition)}const $A={STRING:ge.TEXT,TEXTAREA:ge.TEXTAREA,PASSWORD:ge.PASSWORD,HIDDEN:ge.HIDDEN,NUMBER:ge.NUMBER,BOOLEAN:ge.SWITCH,SELECT:ge.SELECT,DATETIME:ge.DATETIME,CODE:ge.CODE,PROXY:ge.PROXY,OBJECT:ge.OBJECT,ARRAY:ge.ARRAY,DYNAMIC_ARRAY:ge.ARRAY,KEYVALUE:ge.KEY_VALUE},zA=t=>String(t.type??"").toUpperCase(),Eq=t=>t.item_schema??[],HA=t=>String(t.item_type??"").toUpperCase(),an=t=>t??void 0,xq=t=>Object.fromEntries((t??[]).map(e=>[e.key,Zg(e)])),Dq=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?ge.DATE:e==="TIME"?ge.TIME:ge.DATETIME},Qg=t=>{const e=String(t.picker_mode??"DATETIME").toUpperCase();return e==="DATE"?"YYYY-MM-DD":e==="TIME"?"HH:mm:ss":"YYYY-MM-DD HH:mm:ss"},_q=t=>({type:$A[HA(t)]||ge.TEXT,name:"item",label:t.item_label||"项"}),Aq=t=>t.some(e=>e.name==="name")?"name":void 0;function Oq(t){if(!t)return[];const e=[],n=t.minLength??t.min_length,r=t.maxLength??t.max_length;return n!=null&&e.push({type:"min",value:n,message:`最少 ${n} 个字符`}),r!=null&&e.push({type:"max",value:r,message:`最多 ${r} 个字符`}),t.pattern&&e.push({type:"pattern",value:t.pattern,message:"格式不正确"}),t.min!=null&&e.push({type:"min",value:t.min,message:`最小值 ${t.min}`}),t.max!=null&&e.push({type:"max",value:t.max,message:`最大值 ${t.max}`}),e}function Zg(t){var r,o,i;const e=zA(t)==="DATETIME"?Dq(t):$A[zA(t)]||ge.TEXT,n={type:e,name:t.key,label:t.label||t.key,placeholder:an(t.placeholder),helpText:an(t.help_text),defaultValue:an(t.default_value),required:an(t.required),disabled:an(t.disabled),visibleWhen:Sq(t),rules:Oq(t.validation),valueModePolicy:an(t.value_mode_policy)};switch(e){case ge.SELECT:return{...n,type:ge.SELECT,options:(r=t.options)==null?void 0:r.map(s=>({label:s.label,value:s.value})),showSearch:!0,allowClear:!0};case ge.NUMBER:return{...n,type:ge.NUMBER,min:an((o=t.validation)==null?void 0:o.min),max:an((i=t.validation)==null?void 0:i.max)};case ge.DATETIME:return{...n,type:ge.DATETIME,showTime:!0,format:Qg(t),outputFormat:"string"};case ge.DATE:return{...n,type:ge.DATE,format:Qg(t),outputFormat:"string"};case ge.TIME:return{...n,type:ge.TIME,format:Qg(t),outputFormat:"string"};case ge.OBJECT:return{...n,type:ge.OBJECT,properties:xq(t.properties)};case ge.ARRAY:if(HA(t)==="OBJECT"){const s=Eq(t).map(Zg);return{...n,type:ge.ARRAY_OBJECT,columns:s,minItems:an(t.min_items),maxItems:an(t.max_items),columnLayout:s.length>1?"grid":"vertical",titleFieldName:Aq(s)}}return{...n,type:ge.ARRAY,itemSchema:_q(t),minItems:an(t.min_items),maxItems:an(t.max_items),itemLabel:an(t.item_label)};case ge.KEY_VALUE:return{...n,type:ge.KEY_VALUE,keyPlaceholder:an(t.key_placeholder),valuePlaceholder:an(t.value_placeholder)};default:return n}}function VA(t){return{fields:t.map(Zg),layout:"vertical"}}const jA=(...t)=>{for(const e of t)if(typeof e=="string"&&e.trim())return e.trim()};function Tq(t){if(!t)return null;const e=jA(t.key,t.credentialKey,t.name);return e?{key:e,label:jA(t.displayName,t.label,t.name,e)??e,required:t.required===!0}:null}function ew(t){if(!Array.isArray(t))return[];const e=[],n=new Set;for(const r of t){const o=Tq(r);!o||n.has(o.key)||(n.add(o.key),e.push(o))}return e}function Nq(t){var n,r;const e=ew(t);return((n=e.find(o=>o.required))==null?void 0:n.key)??((r=e[0])==null?void 0:r.key)}const Bq=_.Form.Item,{Option:Fq}=_.Select,{Text:Mq,Title:dre}=_.Typography,Ts="[workflow:account-debug]",Iq=t=>!!(t&&/^\d+$/.test(t)),_i=t=>t&&typeof t=="object"&&!Array.isArray(t)?Object.keys(t):[],Pq=t=>Array.isArray(t)?t.map(e=>e==null?void 0:e.key).filter(Boolean):[],Lq=t=>!!(t&&typeof t=="object"&&Array.isArray(t.sub_params)),$q=t=>[t==null?void 0:t.auth_schema,t==null?void 0:t.config_schema,t==null?void 0:t.schema,t].find(Lq)??{},WA=t=>{var o,i,s,a,l;const e=(o=t==null?void 0:t.credential_schema)==null?void 0:o.fields,n=(i=t==null?void 0:t.auth_schema)==null?void 0:i.sub_params,r=((s=t==null?void 0:t.config_schema)==null?void 0:s.sub_params)??(t==null?void 0:t.sub_params);return{type:Array.isArray(t)?"array":t===null?"null":typeof t,keys:_i(t),id:t==null?void 0:t.id,auth_type:t==null?void 0:t.auth_type,account_key:(t==null?void 0:t.account_key)??((a=t==null?void 0:t.credential_schema)==null?void 0:a.key),account_ver:(t==null?void 0:t.account_ver)??((l=t==null?void 0:t.credential_schema)==null?void 0:l.version),credentialSchemaKeys:_i(t==null?void 0:t.credential_schema),credentialFieldCount:Array.isArray(e)?e.length:void 0,credentialFieldKeys:Pq(e),authSchemaKeys:_i(t==null?void 0:t.auth_schema),authSchemaSubParamCount:Array.isArray(n)?n.length:void 0,authSchemaSubParamNames:Array.isArray(n)?n.map(c=>c==null?void 0:c.name).filter(Boolean):void 0,configSchemaKeys:_i(t==null?void 0:t.config_schema),configSubParamCount:Array.isArray(r)?r.length:void 0}},tw=t=>({keys:_i(t),subParamCount:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.length:0,subParamNames:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.name).filter(Boolean):[],subParamControls:Array.isArray(t==null?void 0:t.sub_params)?t.sub_params.map(e=>e==null?void 0:e.page_control).filter(Boolean):[]}),Vd=(t,e)=>{var n,r;return{account_key:(t==null?void 0:t.account_key)??((n=t==null?void 0:t.credential_schema)==null?void 0:n.key)??e??null,account_ver:(t==null?void 0:t.account_ver)??((r=t==null?void 0:t.credential_schema)==null?void 0:r.version)??null}},UA=t=>{const e=t==null?void 0:t.credential_schema,n=e==null?void 0:e.fields;return(!Array.isArray(n)||!n.length)&&console.warn(`${Ts} credential_schema.fields missing or empty`,{model:WA(t)}),Array.isArray(n)&&n.length?VA(n):null},zq=({value:t,onChange:e,linkApp:n,actionAccountSchemaId:r,selectTitle:o="授权配置",disabled:i=!1,placeholder:s="请选择账号"})=>{const[a,l]=y.useState([]),[c,u]=y.useState(!1),[d,f]=y.useState(!1),[p,m]=y.useState(!1),b=y.useRef(null),v=y.useRef(null),w=_.Form.useFormInstance(),g=y.useMemo(()=>r?`_account_${r}`:"_account",[r]);y.useEffect(()=>{w&&w.validateFields([g]).catch(()=>{})},[t,w,g]);const C=St.useReactive({createModalVisible:!1,modifyModalVisible:!1,configModel:{},credentialFormSchema:null,credentialInitialValues:{},schemaMeta:{},account_scheme_id:"",name:"",auth_type:"",modifyId:"",proxy_id:"",editId:"",editValue:"",createLoading:!1,createRequestLock:!1,isEditing:!1}),S=r==null?void 0:String(r),k=async()=>{if(!(!(n!=null&&n.id)&&!S)){u(!0);try{const I=Iq(S)?n==null?void 0:n.id:void 0,z=await Gy(I,S);z?l(z.items||[]):_.message.error("获取账号列表失败")}catch(I){console.error(`${Ts} 获取账号列表失败:`,I),_.message.error("获取账号列表失败")}finally{u(!1)}}};y.useEffect(()=>{k()},[n==null?void 0:n.id,S]),y.useEffect(()=>{C.editId&&b.current&&setTimeout(()=>{var I;(I=b.current)==null||I.focus()},100)},[C.editId]);const x=I=>{if(p){f(!0);return}f(I)},D=()=>{if(!C.editId||!C.editValue){C.editId="",C.isEditing=!1,m(!1);return}Hy(C.editId,C.editValue).then(()=>{k(),C.editId="",C.editValue="",C.isEditing=!1,m(!1),_.message.success(G("link.flow.modification_success"))}).catch(()=>{C.editId="",C.isEditing=!1,m(!1)})},E=(I,z,H)=>{I.stopPropagation(),I.preventDefault(),C.isEditing=!0,m(!0),f(!0),C.editId=z,C.editValue=H,setTimeout(()=>{v.current&&v.current.focus()},0)},O=I=>{I.stopPropagation(),I.preventDefault(),m(!0)},A=I=>{C.isEditing||e&&e(I)},T=()=>{if(!S){_.message.error("未配置账号模式");return}C.createLoading=!0,Kf(S).then(I=>{var K;const z=UA(I),H=Vd(I,S),J=z?{}:$q(I);z||console.warn(`${Ts} create modal will use legacy DynamicAccountForm`,{reason:"credentialFormSchema is null",model:WA(I),configModel:tw(J)}),C.credentialFormSchema=z,C.credentialInitialValues={},C.schemaMeta=H,C.configModel=J,C.account_scheme_id=I.id,C.name=I.name,C.auth_type=I.auth_type??((K=I.credential_schema)==null?void 0:K.type),C.createModalVisible=!0}).catch(I=>{console.error(`${Ts} account model load failed for create`,{schemaId:S,error:I})}).finally(()=>{C.createLoading=!1})},B=I=>{Ly(I).then(async z=>{var R;const H=z.account_schema_id,J=z.account_key,K=z.account_ver,ee=J??H??S;let $=null;if(ee)try{$=await Kf(String(ee),K)}catch(te){console.error("获取账号模型失败:",te)}const U=UA($);C.credentialFormSchema=U,C.credentialInitialValues=U?z.config??{}:{},C.schemaMeta={...Vd($,J??S),account_key:J??Vd($,S).account_key,account_ver:K??Vd($).account_ver},C.configModel=U?{}:z.config,C.account_scheme_id=H??($==null?void 0:$.id)??z.id,C.name=z.name,C.proxy_id=z.proxy_id,C.auth_type=z.auth_type??($==null?void 0:$.auth_type)??((R=$==null?void 0:$.credential_schema)==null?void 0:R.type)??"",C.modifyId=I,C.modifyModalVisible=!0})},M=y.useCallback((I,z)=>{if(C.createRequestLock)return;let H=I;if(!C.credentialFormSchema){if(H=Mt.cloneDeep(C.configModel),!Array.isArray(H==null?void 0:H.sub_params)){console.error(`${Ts} create account legacy config has no sub_params`,{configModel:tw(C.configModel),valueKeys:_i(I)}),_.message.error("账号模型配置为空,无法保存");return}H.sub_params.forEach(K=>{let ee=I[K.name];K.page_control===Ee.EXTEND_OBJ&&(ee=Jg(ee)),K.value=ee})}const J=I.proxy_id;delete I.proxy_id,C.createRequestLock=!0,z?Xf((n==null?void 0:n.id)??null,C.account_scheme_id,C.auth_type,C.name,H,C.modifyId,J,C.schemaMeta).then(K=>{K&&_.message.success("测试连接成功!")}).finally(()=>{C.createRequestLock=!1}):$y((n==null?void 0:n.id)??null,C.account_scheme_id,C.auth_type,C.name,H,J,C.schemaMeta).then(()=>{_.message.success(G("link.flow.creation_success")),k(),C.createModalVisible=!1}).finally(()=>{C.createRequestLock=!1})},[]),F=y.useCallback(()=>{C.createModalVisible=!1},[]),N=(I,z)=>{let H=I;if(!C.credentialFormSchema){if(H=Mt.cloneDeep(C.configModel),!Array.isArray(H==null?void 0:H.sub_params)){console.error(`${Ts} modify account legacy config has no sub_params`,{configModel:tw(C.configModel),valueKeys:_i(I)}),_.message.error("账号模型配置为空,无法保存");return}H.sub_params.forEach(K=>{let ee=I[K.name];K.page_control===Ee.EXTEND_OBJ&&(ee=Jg(ee)),K.value=ee})}const J=I.proxy_id;delete I.proxy_id,z?Xf((n==null?void 0:n.id)??null,C.account_scheme_id,C.auth_type,C.name,H,C.modifyId,J,C.schemaMeta).then(K=>{K&&_.message.success("测试连接成功!")}):zy(C.modifyId,null,null,null,null,H,J,C.schemaMeta).then(()=>{_.message.success(G("link.flow.modification_success")),k(),C.modifyModalVisible=!1,C.modifyId=""})},P=I=>h.jsxs("div",{children:[I,h.jsx(_.Divider,{style:{margin:"4px 0"}}),h.jsx("div",{style:{padding:"4px",textAlign:"center"},children:h.jsx(_.Button,{icon:h.jsx(ie.UserAddOutlined,{}),onClick:T,loading:C.createLoading,type:"link",block:!0,children:"创建新账号"})})]});return h.jsxs(h.Fragment,{children:[h.jsx(Bq,{label:o,layout:"vertical",required:!0,name:g,initialValue:t,rules:[{validator:()=>t?Promise.resolve():Promise.reject(new Error(s||"请选择账号"))}],children:h.jsx(_.Select,{ref:v,value:t,onChange:A,style:{width:"100%"},placeholder:s,disabled:i,loading:c,allowClear:!0,popupRender:P,classNames:{popup:{root:"workflow-account-select__popup"}},listHeight:320,open:d,onOpenChange:x,children:a.map(I=>h.jsx(Fq,{value:I.id,children:h.jsxs("div",{className:Di.accountOption,onClick:z=>{C.isEditing&&z.stopPropagation()},children:[h.jsx("div",{className:`${Di.accountName} workflow-account-select__name`,children:C.editId!==I.id?h.jsxs(y.Fragment,{children:[h.jsx("span",{children:I.name}),h.jsx(ie.EditOutlined,{className:`${Di.nameEditIcon} workflow-account-select__edit`,onClick:z=>E(z,I.id,I.name)})]}):h.jsx("div",{className:Di.editInputWrapper,onClick:O,children:h.jsx(_.Input,{ref:b,defaultValue:I.name,className:Di.nameEditInput,onClick:O,onMouseDown:z=>{z.stopPropagation(),z.preventDefault()},onFocus:z=>{z.stopPropagation(),m(!0)},onPressEnter:z=>{z.stopPropagation(),z.preventDefault(),D()},onBlur:()=>{D()},onChange:z=>{C.editValue=z.target.value}})})}),h.jsxs("div",{className:Di.accountActions,children:[h.jsx(Mq,{type:"secondary",className:Di.updateTime,children:Ht(Number(I.update_time)*1e3).format("YYYY-MM-DD HH:mm:ss")}),h.jsx(_.Button,{type:"link",icon:h.jsx(ie.FileSearchOutlined,{}),size:"small",onClick:z=>{z.stopPropagation(),B(I.id)},children:"编辑"})]})]})},I.id))})}),h.jsx(mq,{onSubmit:M,onCancel:F,inAI:!0,auth_type:C.auth_type,config:C.configModel,formSchema:C.credentialFormSchema,visible:C.createModalVisible,connector:n}),h.jsx(vq,{onSubmit:N,inAI:!0,onCancel:()=>{C.modifyModalVisible=!1},proxy_id:C.proxy_id,auth_type:C.auth_type,config:C.configModel,formSchema:C.credentialFormSchema,initialValues:C.credentialInitialValues,visible:C.modifyModalVisible,connector:n})]})},qA=({credentialRequirements:t,actionAccountSchemaId:e,value:n,onChange:r,...o})=>{var l;const i=y.useMemo(()=>{const c=e?[{key:String(e)}]:[];return ew(t!=null&&t.length?t:c)},[e,t]),[s,a]=y.useState(n?(l=i[0])==null?void 0:l.key:void 0);return y.useEffect(()=>{var c;if(!n){a(void 0);return}!s&&((c=i[0])!=null&&c.key)&&a(i[0].key)},[s,i,n]),i.length===0?null:h.jsx(y.Fragment,{children:i.map(c=>h.jsx(zq,{...o,actionAccountSchemaId:c.key,selectTitle:i.length>1?c.label:"授权配置",value:s===c.key?n:void 0,onChange:u=>{a(u?c.key:void 0),r==null||r(u)}},c.key))})},Hq=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Vq=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=y.useState(e||""),[s,a]=y.useState(!1);y.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const f=Hq();i(f),a(!0),n==null||n(f)},c=()=>{l()},u=async()=>{if(!o){_.message.warning(G("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(G("components.authTokenField.copySuccess"))}catch{_.message.error(G("components.authTokenField.copyFailed"))}},d=()=>{a(f=>!f)};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:G("components.authTokenField.placeholder")}),h.jsx(_.Tooltip,{title:G("components.authTokenField.copy"),children:h.jsx(_.Button,{icon:h.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:h.jsx(_.Button,{icon:s?h.jsx(ie.EyeInvisibleOutlined,{}):h.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:h.jsx(_.Button,{icon:h.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},jq=(t=32)=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint8Array(t);return crypto.getRandomValues(n),Array.from(n,r=>e[r%e.length]).join("")},Wq=t=>{const{value:e,onChange:n,disabled:r}=t,[o,i]=y.useState(e||""),[s,a]=y.useState(!1);y.useEffect(()=>{e!==void 0&&e!==o&&i(e)},[e,o]);const l=()=>{const f=jq();i(f),a(!0),n==null||n(f)},c=()=>{if(!o){l();return}_.Modal.confirm({title:G("common.info"),content:G("components.authTokenField.regenerateConfirm"),okText:G("app.common.word.confirm"),cancelText:G("app.common.word.cancel"),onOk:l})},u=async()=>{if(!o){_.message.warning(G("components.authTokenField.emptyTokenWarning"));return}try{await navigator.clipboard.writeText(o),_.message.success(G("components.authTokenField.copySuccess"))}catch{_.message.error(G("components.authTokenField.copyFailed"))}},d=()=>{a(f=>!f)};return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[h.jsx(_.Input,{style:{flex:1},value:o,readOnly:!0,type:s?"text":"password",placeholder:G("components.authTokenField.placeholder")}),h.jsx(_.Tooltip,{title:G("components.authTokenField.copy"),children:h.jsx(_.Button,{icon:h.jsx(ie.CopyOutlined,{}),onClick:u,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(s?"components.authTokenField.hideToken":"components.authTokenField.showToken"),children:h.jsx(_.Button,{icon:s?h.jsx(ie.EyeInvisibleOutlined,{}):h.jsx(ie.EyeOutlined,{}),onClick:d,disabled:r||!o})}),h.jsx(_.Tooltip,{title:G(o?"components.authTokenField.regenerate":"components.authTokenField.generate"),children:h.jsx(_.Button,{icon:h.jsx(ie.SyncOutlined,{}),onClick:c,disabled:r,type:"primary",ghost:!0})})]})},GA=10,Uq=["OAUTH","OAUTH2","OIDC"],qq=t=>{const e=new Set([...t.support_protocol??[],...t.auth_protocol?[t.auth_protocol]:[]]);return Array.from(e).some(n=>Uq.includes(n))},Gq=t=>{const{value:e,onChange:n,disabled:r}=t,o=Sl(),[i,s]=y.useState([]),[a,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(""),[p,m]=y.useState(1),[b,v]=y.useState(!1),w=y.useRef(0),g=y.useMemo(()=>`${window.location.origin}/iam/token`,[]),C=async(O=1,A=!1,T="")=>{const B=w.current+1;w.current=B,A?u(!0):l(!0);try{const M=await Ry({current:O,pageSize:GA},{filter:T});if(w.current!==B)return;const F=(M.items??[]).filter(qq),P=(A?[...i,...F]:F).filter((I,z,H)=>H.findIndex(J=>J.client_id===I.client_id)===z);s(P),m(O),v((M.total??0)>O*GA)}catch{w.current===B&&_.message.error(G("components.selectOAuth2ClientField.fetchFailed"))}finally{w.current===B&&(l(!1),u(!1))}};let S=null;y.useEffect(()=>{S&&(clearTimeout(S),S=null),S=window.setTimeout(()=>{C(1,!1,d.trim())},300)},[d]);const k=async()=>{!b||a||c||await C(p+1,!0,d.trim())},x=async()=>{try{await navigator.clipboard.writeText(g),_.message.success(G("components.selectOAuth2ClientField.copySuccess"))}catch{_.message.error(G("components.selectOAuth2ClientField.copyFailed"))}},D=()=>{o("/apps/manage",!0)},E=()=>{o("https://1in15q85qd.apifox.cn/8698545m0",!0)};return h.jsxs(_.Space,{direction:"vertical",size:12,style:{width:"100%"},children:[h.jsxs("div",{children:[h.jsx(_.Select,{value:e,onChange:n,disabled:r,loading:a,showSearch:!0,filterOption:!1,optionLabelProp:"label",placeholder:G("components.selectOAuth2ClientField.placeholder"),onSearch:f,notFoundContent:a?h.jsx(_.Spin,{size:"small"}):null,getPopupContainer:O=>O.parentNode,popupRender:O=>h.jsxs("div",{children:[O,!a&&i.length===0?h.jsx("div",{style:{padding:"16px 12px"},children:h.jsx(_.Empty,{image:_.Empty.PRESENTED_IMAGE_SIMPLE,description:h.jsxs(_.Space,{direction:"vertical",size:4,children:[h.jsx(_.Typography.Text,{type:"secondary",children:G("components.selectOAuth2ClientField.emptyTitle")}),h.jsx(_.Typography.Text,{type:"secondary",style:{fontSize:12},children:G("components.selectOAuth2ClientField.emptyDescription")})]}),children:h.jsx(_.Button,{type:"primary",ghost:!0,icon:h.jsx(ie.LinkOutlined,{}),onClick:D,children:G("components.selectOAuth2ClientField.goToAppManage")})})}):null,i.length>0?h.jsx("div",{style:{padding:"8px 12px",textAlign:"center",borderTop:"1px solid #f0f0f0"},children:h.jsx(_.Button,{type:"link",icon:h.jsx(ie.ReloadOutlined,{}),onClick:k,loading:c,disabled:!b,children:G(b?"components.selectOAuth2ClientField.loadMore":"components.selectOAuth2ClientField.loadedAll")})}):null]}),options:i.map(O=>({label:O.client_name,value:O.client_id}))}),h.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[G("components.selectOAuth2ClientField.selectDescriptionPrefix"),h.jsx(_.Button,{style:{padding:0},type:"link",onClick:D,children:G("components.selectOAuth2ClientField.goToAppManage")}),G("components.selectOAuth2ClientField.selectDescriptionSuffix")]})]}),h.jsxs("div",{children:[h.jsx(_.Typography.Text,{strong:!0,style:{display:"block",marginBottom:8},children:G("components.selectOAuth2ClientField.tokenEndpoint")}),h.jsxs(_.Space.Compact,{block:!0,className:"workflow-oauth-token-endpoint",children:[h.jsx(_.Input,{value:g,readOnly:!0}),h.jsx(_.Button,{icon:h.jsx(ie.CopyOutlined,{}),onClick:x,disabled:r,children:G("components.selectOAuth2ClientField.copy")})]}),h.jsxs(_.Typography.Text,{type:"secondary",style:{display:"block",marginTop:8,fontSize:12},children:[G("components.selectOAuth2ClientField.tokenDescriptionPrefix"),h.jsx(_.Button,{style:{padding:0},type:"link",onClick:E,children:G("components.selectOAuth2ClientField.documentation")})]})]})]})},Rq=({children:t,value:e,onChange:n})=>{const[r,o]=y.useState(e==="{{$fromAI}}"),i=()=>{const a=!r;o(a),a?n==null||n("{{$fromAI}}"):n==null||n("")},s=()=>r?h.jsxs("div",{style:{position:"relative"},children:[h.jsx(_.Input,{value:"由AI生成 ",readOnly:!0,style:{background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",border:"1px solid transparent",borderImage:"linear-gradient(45deg, #00d4ff, #9b59b6, #e74c3c) 1",color:"#ffffff",fontWeight:"500",textShadow:"0 1px 2px rgba(0,0,0,0.3)",borderRadius:"6px",fontSize:"13px",paddingLeft:"32px",paddingRight:"28px",height:"32px",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)"},prefix:h.jsx("div",{style:{background:"linear-gradient(45deg, #00d4ff, #1e3c72)",borderRadius:"50%",width:"16px",height:"16px",display:"flex",alignItems:"center",justifyContent:"center",marginRight:"4px",animation:"pulse 2s ease-in-out infinite alternate"},children:h.jsx("span",{style:{color:"#fff",fontSize:"8px"},children:"AI"})}),suffix:h.jsx(_.Button,{type:"text",size:"small",onClick:i,style:{color:"#ffffff",border:"none",background:"rgba(255,255,255,0.2)",borderRadius:"50%",width:"18px",height:"18px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minWidth:"18px",padding:0},onMouseEnter:a=>{a.currentTarget.style.background="rgba(255,255,255,0.3)",a.currentTarget.style.transform="scale(1.1)"},onMouseLeave:a=>{a.currentTarget.style.background="rgba(255,255,255,0.2)",a.currentTarget.style.transform="scale(1)"},children:h.jsx(ie.CloseOutlined,{style:{fontSize:"10px"}})})}),h.jsx("style",{children:`
113
113
  @keyframes pulse {
114
114
  0% { box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.6); }
115
115
  100% { box-shadow: 0 0 0 6px rgba(0, 212, 255, 0); }
@@ -142,7 +142,7 @@ ${n}`:""}`}).join(`
142
142
  `):"暂无日志",rf=async t=>{var e;try{if((e=navigator==null?void 0:navigator.clipboard)!=null&&e.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const n=document.createElement("textarea");n.value=t,n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.focus(),n.select();const r=document.execCommand("copy");return document.body.removeChild(n),r}catch{return!1}},NN=(t,e,n)=>{const r=new Map(t.map(l=>[l.id,l])),o=new Map(e.map(l=>[l.id,l])),i=[],s=[],a=[];return o.forEach((l,c)=>{if(!r.has(c)){i.push(c);return}const u=DN(n(r.get(c))),d=DN(n(l));u!==d&&a.push(c)}),r.forEach((l,c)=>{o.has(c)||s.push(c)}),{added:i,removed:s,changed:a}},bQ=({visible:t,nodes:e,edges:n,onClose:r})=>{const[o,i]=y.useState([]),[s,a]=y.useState(!1),[l,c]=y.useState(!1),[u,d]=y.useState(),[f,p]=y.useState(),m=y.useRef({nodes:[],edges:[]});y.useEffect(()=>{const N=m.current;if(m.current={nodes:e,edges:n},!t)return;const P=NN(N.nodes,e,Ib),I=NN(N.edges,n,Pb),z=P.added.length+P.removed.length+P.changed.length>0,H=I.added.length+I.removed.length+I.changed.length>0;if(!z&&!H)return;const J=new Map(e.map(se=>[se.id,Ni(se)])),K=Object.fromEntries(J.entries()),ee=_N(n,J),$=AN(n,J),U={nodeDiff:P,edgeDiff:I,nodeCount:{prev:N.nodes.length,next:e.length},edgeCount:{prev:N.edges.length,next:n.length},edgeRelations:ee,nodeNameMap:K,duplicateEdges:$},R=[];z&&R.push(`节点 +${P.added.length} -${P.removed.length} ~${P.changed.length}`),H&&R.push(`连线 +${I.added.length} -${I.removed.length} ~${I.changed.length}`);const te={id:`${Date.now()}-${Math.random()}`,time:EN(),message:R.join(" | "),nodeSummary:z?{added:P.added.length,removed:P.removed.length,changed:P.changed.length}:void 0,edgeSummary:H?{added:I.added.length,removed:I.removed.length,changed:I.changed.length}:void 0,edgeRelations:ee,duplicateEdges:$,detail:U,expanded:!1};i(se=>[te,...se].slice(0,hQ)),console.log("[WorkflowDebugPanel]",te.message,U)},[n,e,t]);const b=y.useMemo(()=>e.map(N=>({label:`${N.id} (${Ni(N)})`,value:N.id})),[e]),v=y.useMemo(()=>n.map(N=>({label:`${N.id} (${N.source} -> ${N.target})`,value:N.id})),[n]),w=e.find(N=>N.id===u),g=n.find(N=>N.id===f),C=y.useMemo(()=>{const N=new Map;return e.forEach(P=>{N.set(P.id,Ni(P))}),N},[e]),S=y.useMemo(()=>AN(n,C),[n,C]),k=y.useMemo(()=>{const N=new Set;return S==null||S.forEach(P=>{P.edgeIds.forEach(I=>N.add(I))}),N},[S]),x=y.useMemo(()=>n.map(N=>{const P=C.get(N.source)||N.source,I=C.get(N.target)||N.target;return{id:N.id,text:`${N.source}(${P}) -> ${N.target}(${I})`,isDuplicate:k.has(N.id)}}),[k,n,C]),D=y.useMemo(()=>mQ(e,n,C,k),[k,n,C,e]),E=y.useMemo(()=>wQ(e,n),[n,e]),O=y.useMemo(()=>new Map(E.nodes.map(N=>[N.id,N])),[E.nodes]),A=Math.max(E.width,400),T=Math.max(E.height,180),B=y.useMemo(()=>{const{levels:N,unvisited:P}=ON(e,n),I=N.map(z=>{const H=z.nodes.map(J=>`${J.id}(${Ni(J)})`).join(" | ");return`L${z.level}: ${H}`});return P.length&&I.push(`循环/未连接: ${P.map(z=>`${z.id}(${Ni(z)})`).join(" | ")}`),I.length?I.join(`
143
143
  `):"暂无结构"},[n,e]),M=y.useMemo(()=>s&&l?o.filter(N=>N.nodeSummary||N.edgeSummary):s?o.filter(N=>N.nodeSummary):l?o.filter(N=>N.edgeSummary):o,[o,l,s]),F=y.useMemo(()=>{const N={nodes:e.map(Ib),edges:n.map(Pb),edgeRelations:_N(n,C),duplicateEdges:S,mermaidSource:D};return JSON.stringify(N,null,2)},[S,n,D,C,e]);return t?h.jsxs(ne.Panel,{position:"bottom-right",className:"workflow-debug-panel",children:[h.jsxs("div",{className:"workflow-debug-panel__header",children:[h.jsx("span",{children:"画布调试"}),h.jsx(_.Button,{size:"small",onClick:r,children:"关闭"})]}),h.jsxs("div",{className:"workflow-debug-panel__section",children:[h.jsxs("div",{className:"workflow-debug-panel__log-header",children:[h.jsx("span",{children:"变更日志"}),h.jsxs(_.Space,{size:6,children:[h.jsx(_.Button,{size:"small",onClick:async()=>{const N=TN(M);await rf(N)?_.message.success("日志已复制"):_.message.error("复制失败")},children:"复制日志"}),h.jsx(_.Button,{size:"small",onClick:async()=>{const N=M[0],P=N?TN([N]):"暂无日志";await rf(P)?_.message.success("最新日志已复制"):_.message.error("复制失败")},children:"复制最新"}),h.jsx(_.Button,{size:"small",onClick:async()=>{await rf(F)?_.message.success("快照已复制"):_.message.error("复制失败")},children:"复制快照"})]})]}),h.jsx("div",{className:"workflow-debug-panel__toolbar",children:h.jsxs(_.Space,{size:6,wrap:!0,children:[h.jsx(_.Button,{size:"small",onClick:()=>a(N=>!N),children:s?"显示全部":"仅节点"}),h.jsx(_.Button,{size:"small",onClick:()=>c(N=>!N),children:l?"显示全部":"仅连线"}),h.jsx(_.Button,{size:"small",onClick:()=>i(N=>N.map(P=>({...P,expanded:!0}))),children:"全部展开"}),h.jsx(_.Button,{size:"small",onClick:()=>i(N=>N.map(P=>({...P,expanded:!1}))),children:"全部收起"}),h.jsx(_.Button,{size:"small",onClick:()=>i([]),children:"清空"})]})}),h.jsxs("div",{className:"workflow-debug-panel__log-list",children:[M.length===0&&h.jsx("div",{className:"workflow-debug-panel__log-empty",children:"暂无日志"}),M.map(N=>h.jsxs("div",{className:"workflow-debug-panel__log-item",children:[h.jsxs("div",{className:"workflow-debug-panel__log-title",children:[h.jsx("span",{className:"workflow-debug-panel__log-time",children:N.time}),h.jsx("span",{children:N.message})]}),h.jsxs("div",{className:"workflow-debug-panel__log-tags",children:[N.nodeSummary&&h.jsxs("span",{className:"workflow-debug-panel__tag workflow-debug-panel__tag-node",children:["节点 +",N.nodeSummary.added," -",N.nodeSummary.removed," ~",N.nodeSummary.changed]}),N.edgeSummary&&h.jsxs("span",{className:"workflow-debug-panel__tag workflow-debug-panel__tag-edge",children:["连线 +",N.edgeSummary.added," -",N.edgeSummary.removed," ~",N.edgeSummary.changed]})]}),h.jsx("div",{className:"workflow-debug-panel__log-actions",children:h.jsx(_.Button,{size:"small",onClick:()=>i(P=>P.map(I=>I.id===N.id?{...I,expanded:!I.expanded}:I)),children:N.expanded?"收起详情":"展开详情"})}),N.expanded&&h.jsxs("div",{className:"workflow-debug-panel__log-detail",children:[N.edgeRelations&&h.jsxs("div",{className:"workflow-debug-panel__log-detail-block",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"连线关系"}),h.jsx("pre",{children:N.edgeRelations.join(`
144
144
  `)})]}),N.duplicateEdges&&N.duplicateEdges.length>0&&h.jsxs("div",{className:"workflow-debug-panel__log-detail-block",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"重复连线"}),h.jsx("pre",{children:N.duplicateEdges.map(P=>`${P.relation} [${P.edgeIds.join(", ")}]`).join(`
145
- `)})]}),N.detail&&h.jsxs("div",{className:"workflow-debug-panel__log-detail-block",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"详细信息"}),h.jsx("pre",{children:JSON.stringify(N.detail,null,2)})]})]})]},N.id))]})]}),h.jsxs("div",{className:"workflow-debug-panel__section",children:[h.jsxs("div",{className:"workflow-debug-panel__summary",children:[h.jsxs("span",{children:["节点数: ",e.length]}),h.jsxs("span",{children:["连线数: ",n.length]})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"结构图预览"}),h.jsx("div",{className:"workflow-debug-panel__graph",children:h.jsxs("svg",{className:"workflow-debug-panel__graph-canvas",width:"100%",height:T,viewBox:`0 0 ${A} ${T}`,preserveAspectRatio:"xMinYMin meet",children:[h.jsxs("defs",{children:[h.jsx("marker",{id:"workflow-debug-arrow",markerWidth:"10",markerHeight:"10",refX:"8",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:h.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#8c8c8c"})}),h.jsx("marker",{id:"workflow-debug-arrow-dup",markerWidth:"10",markerHeight:"10",refX:"8",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:h.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#cf1322"})})]}),E.edges.map(N=>{const P=O.get(N.source),I=O.get(N.target);if(!P||!I)return null;const z=k.has(N.id),H=P.x+nf,J=P.y+Bl/2,K=I.x,ee=I.y+Bl/2;return h.jsx("line",{x1:H,y1:J,x2:K,y2:ee,stroke:z?"#cf1322":"#8c8c8c",strokeWidth:z?2.2:1.4,markerEnd:z?"url(#workflow-debug-arrow-dup)":"url(#workflow-debug-arrow)"},N.id)}),E.nodes.map(N=>h.jsxs("g",{transform:`translate(${N.x}, ${N.y})`,children:[h.jsx("rect",{width:nf,height:Bl,rx:6,fill:"#ffffff",stroke:"#91caff",strokeWidth:1.4}),h.jsx("text",{x:nf/2,y:Bl/2+4,textAnchor:"middle",fontSize:"11",fill:"#1f1f1f",children:N.label})]},N.id))]})})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"Mermaid 图"}),h.jsx("div",{className:"workflow-debug-panel__mermaid-actions",children:h.jsx(_.Button,{size:"small",onClick:async()=>{await rf(D)?_.message.success("Mermaid 已复制"):_.message.error("复制失败")},children:"复制 Mermaid"})}),h.jsx("pre",{children:D})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"结构布局"}),h.jsx("pre",{children:B})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"连线关系"}),h.jsxs("div",{className:"workflow-debug-panel__edge-list",children:[x.length===0&&h.jsx("div",{className:"workflow-debug-panel__log-empty",children:"暂无连线"}),x.map(N=>h.jsxs("div",{className:`workflow-debug-panel__edge-line${N.isDuplicate?" workflow-debug-panel__edge-line--duplicate":""}`,children:[h.jsx("span",{children:N.text}),N.isDuplicate&&h.jsx("span",{className:"workflow-debug-panel__edge-flag",children:"重复"})]},N.id))]})]}),S&&S.length>0&&h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"重复连线"}),h.jsx("div",{className:"workflow-debug-panel__edge-list",children:S.map(N=>h.jsxs("div",{className:"workflow-debug-panel__edge-line--duplicate",children:[h.jsx("span",{children:N.relation}),h.jsx("span",{className:"workflow-debug-panel__edge-flag",children:N.edgeIds.join(", ")})]},N.key))})]}),h.jsxs(_.Space,{direction:"vertical",size:8,style:{width:"100%"},children:[h.jsx(_.Select,{value:u,placeholder:"选择节点查看详情",options:b,onChange:N=>d(N),allowClear:!0,size:"small"}),h.jsx(_.Select,{value:f,placeholder:"选择连线查看详情",options:v,onChange:N=>p(N),allowClear:!0,size:"small"})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"节点详情"}),h.jsx("pre",{children:w?JSON.stringify(Ib(w),null,2):"未选择节点"})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"连线详情"}),h.jsx("pre",{children:g?JSON.stringify({...Pb(g),sourceName:C.get(g.source),targetName:C.get(g.target),isDuplicate:k.has(g.id)},null,2):"未选择连线"})]})]})]}):null},BN=y.createContext(null),vQ=({api:t,children:e})=>h.jsx(BN.Provider,{value:t,children:e}),Lb=()=>{const t=y.useContext(BN);if(!t)throw new Error("useCanvasApi must be used within a CanvasApiProvider");return t},FN=y.createContext(null),yQ=({value:t,children:e})=>h.jsx(FN.Provider,{value:t,children:e}),MN=()=>y.useContext(FN)??{hasTriggerNode:!1,isMcpServerCanvas:!1};function CQ({nodes:t,edges:e}){const n=new Map(t.map(a=>[a.id,a])),r=new Map,o=[],i=[];for(const a of t){if(!Nl(a))continue;const l=Mb(a);if(!l){o.push(a.id),i.push({code:"SCHEMA_NOT_READY",reason:"节点端口 Schema 尚未就绪,保存时交由后端继续校验",blocking:!1,nodeId:a.id});continue}r.set(a.id,l);for(const c of l.inputs??[]){if(!c.required)continue;e.some(d=>d.target===a.id&&d.targetHandle===c.name)||i.push({code:"REQUIRED_INPUT_MISSING",reason:`必需输入端口 ${c.displayName||c.name} 尚未连接`,blocking:!0,nodeId:a.id,portName:c.name})}}for(const a of e){const l=n.get(a.source),c=n.get(a.target),u=Nl(l),d=Nl(c);if(!u&&!d||u&&!r.has(a.source)||d&&!r.has(a.target))continue;const f=e.filter(m=>m!==a&&(!a.id||m.id!==a.id)),p=xN({sourceNode:l,targetNode:c,sourceHandle:a.sourceHandle,targetHandle:a.targetHandle,edges:f});p.applicable&&!p.valid&&p.code!=="SCHEMA_NOT_READY"&&p.code!=="NOT_APPLICABLE"&&i.push({code:p.code,reason:p.reason,blocking:!0,edgeId:a.id,sourceNodeId:a.source,targetNodeId:a.target})}const s=i.filter(a=>a.blocking);return{valid:s.length===0,issues:i,blockingIssues:s,missingSchemaNodeIds:o}}const of={categoryUnavailable:"link.flow.connectable.category_unavailable",connectorUnavailable:"link.flow.connectable.connector_unavailable",actionUnavailable:"link.flow.connectable.action_unavailable",loadFailed:"link.flow.connectable.load_failed",noCompatibleNodes:"link.flow.connectable.no_compatible_nodes",noCompatibleInput:"link.flow.connectable.no_compatible_input",noCompatibleOutput:"link.flow.connectable.no_compatible_output",noBidirectionalCompatiblePort:"link.flow.connectable.no_bidirectional_compatible_port",schemaUnavailable:"link.flow.connectable.schema_unavailable",existingEdgeInvalid:"link.flow.connectable.existing_edge_invalid"},kQ=({onOpenNodeSelector:t})=>h.jsx(ne.Panel,{position:"top-center",style:{background:"transparent",boxShadow:"none",border:"0 none",width:"100%",height:"100%",display:"flex",flexFlow:"column",justifyContent:"center"},children:h.jsxs("div",{className:"setup-panel",children:[h.jsx("h4",{children:" 选择一个开始节点 "}),h.jsx("div",{className:"desc",children:"入口类型决定画布定义"}),h.jsx("div",{className:"start-node-placeholder",children:h.jsxs("div",{className:"start-node-select",children:[h.jsxs("button",{type:"button",onClick:()=>t(),className:"nodrag nopan start-node trigger","aria-label":"添加触发节点",children:[h.jsx("div",{className:"start-node-icon",children:"TR"}),h.jsxs("div",{className:"start-node-text",children:[h.jsx("h3",{className:"start-node-text-title",children:"自动化触发器"}),h.jsx("p",{className:"start-node-text-desc",children:"由触发器启动业务流程"})]}),h.jsx("div",{className:"node-footer",children:"选择触发方式 ›"})]}),h.jsxs("button",{type:"button",onClick:()=>{t({protocol:$e.MCP_SERVER})},className:"nodrag nopan start-node mcp","aria-label":"添加 MCP 节点",children:[h.jsx("div",{className:"start-node-icon",children:"MCP"}),h.jsxs("div",{className:"start-node-text",children:[h.jsx("h3",{className:"start-node-text-title",children:"MCP 网关"}),h.jsx("p",{className:"start-node-text-desc",children:"基于画布编排快速构建 MCP SERVER"})]}),h.jsx("div",{className:"node-footer",children:"开始配置 ›"})]})]})})]})}),SQ=t=>{var A,T,B;const{workflowId:e,strategy:n,onOffline:r,nodeTypes:o}=t,i=Pt(),s=Te.useIntl(),a=y.useRef(""),l=uQ(t,n.stickyNodeKey),{setUnSave:c,store:u,updateSaveStatus:d}=l,f=((T=(A=i.nodeSelector)==null?void 0:A.connectable)==null?void 0:T.enabled)===!0,p=At(),{hasTriggerNode:m,isMcpServerCanvas:b}=l,v=y.useCallback(()=>{if(!e||!n.buildFlowPayload)throw new Error("当前画布不支持生成 ACM 草稿数据");const{nodes:M,edges:F}=u.getState(),N=M.map(z=>z.id),P=F.filter(z=>N.includes(z.target)&&z.source&&z.sourceHandle&&z.targetHandle),I=Iw.getState().workflow;return n.buildFlowPayload({nodes:M,edges:P,workflowName:I.workflowName,workflowId:e,executionControl:I.executionControl,metadata:I.flowMetadata})},[u,n,e]),w=y.useCallback(async()=>{var M;if(!e)throw new Error("缺少工作流 ID");try{d(Ln.SAVING);const{nodes:F,edges:N}=u.getState();if(f){const K=CQ({nodes:F,edges:N});if(K.missingSchemaNodeIds.length>0){const ee=[...K.missingSchemaNodeIds].sort().join(",");a.current!==ee&&(a.current=ee,_.message.warning(s.formatMessage({id:of.schemaUnavailable}))),console.warn("[workflow:connectable] save with unavailable schemas",{nodeIds:K.missingSchemaNodeIds})}else a.current="";if(!K.valid){const ee=s.formatMessage({id:of.existingEdgeInvalid});_.message.error(ee),console.warn("[workflow:connectable] block save for invalid graph",{issueCount:K.blockingIssues.length,issues:K.blockingIssues.map($=>({code:$.code,nodeId:$.nodeId,portName:$.portName,edgeId:$.edgeId,sourceNodeId:$.sourceNodeId,targetNodeId:$.targetNodeId}))}),d(Ln.ERROR,new Error(ee));return}}const P=F.map(K=>K.id),I=N.filter(K=>P.includes(K.target)&&K.source&&K.sourceHandle&&K.targetHandle),z=Iw.getState().workflow,H=n.buildFlowPayload?v():void 0,J={...H,nodes:H.nodes.map(K=>K.saveType?{...K,node_type:K.saveType}:K)};return await n.saveFlow({nodes:J.nodes,edges:I,workflowName:z.workflowName,workflowId:e,executionControl:z.executionControl,metadata:z.flowMetadata,payload:J}),c(!1),d(Ln.SAVED),J&&await((M=t.onSave)==null?void 0:M.call(t,J)),J}catch(F){throw d(Ln.ERROR,F),F}},[f,v,s,t.onSave,c,u,n,d,e]);l.saveFlowRef.current=w;const g=hJ(w),{loadError:C,retry:S}=cJ({workflowId:e,strategy:n,setNodes:l.setNodes,setEdges:l.setEdges,fitView:l.reactFlow.fitView,setLoading:l.setLoading,dispatch:l.dispatch,setFlowOpStatusAction:l.setFlowOpStatusAction,refreshWorkFlowNum:l.refreshWorkFlowNum,onLoad:t.onLoad});dJ({workflowId:e,strategy:n,store:l.store,addNodes:l.addNodes,addEdges:l.addEdges,removeEdges:l.removeEdges,updateEdge:l.reactFlow.updateEdge,setNodeAddCallback:l.setNodeAddCallback,handleEdgeAddNode:l.handleEdgeAddNode,setNodeConfigVisible:l.setNodeConfigVisible,setNodeFitHumanView:l.setNodeFitHumanView,validateConnectionAgainstSnapshot:l.validateConnectionAgainstSnapshot,saveFlow:g});const k=n.HeaderComponent,x=n.PanelComponent,D=n.ConfigModalComponent,E=p&&!m&&!b,O=y.useMemo(()=>({hasTriggerNode:m,isMcpServerCanvas:b}),[m,b]);return h.jsx(vQ,{api:l.canvasApi,children:h.jsxs(yQ,{value:O,children:[h.jsxs("div",{className:l.isPreviewMode?"workflow-canvas-container workflow-canvas-container-preview":"workflow-canvas-container",style:{height:i.canvas.height?`${i.canvas.height}`:void 0},children:[l.showCanvasHeader&&h.jsx(k,{loading:l.loading||!!C,onSave:w,getFlowPayload:v,autoSaveStatus:l.autoSaveStatus,unSave:l.unSave,lastSavedTime:l.lastSavedTime,onOffline:r}),h.jsxs("div",{className:"workflow-canvas",children:[h.jsx(ZX,{loading:l.loading,error:C,onRetry:S}),h.jsx(eJ,{}),h.jsxs(ne.ReactFlow,{nodes:l.nodes,edges:l.edges,onNodesChange:l.onNodesChange,onEdgesChange:l.handleEdgesChange,onConnect:l.handleConnect,multiSelectionKeyCode:null,nodeTypes:o,edgeTypes:UX,connectionLineType:ne.ConnectionLineType.Bezier,connectionMode:ne.ConnectionMode.Loose,onNodeMouseEnter:l.onNodeMouseEnter,onNodeMouseLeave:l.onNodeMouseLeave,onEdgeMouseEnter:l.onEdgeMouseEnter,onEdgeMouseLeave:l.onEdgeMouseLeave,onNodeContextMenu:l.onNodeContextMenu,onPaneContextMenu:l.onPaneContextMenu,defaultEdgeOptions:KX,style:qX,defaultViewport:l.isPreviewMode?RX:GX,minZoom:.1,maxZoom:2,fitView:!1,snapToGrid:!0,snapGrid:[20,20],deleteKeyCode:null,nodesDraggable:!l.isInteractionDisabled,nodesConnectable:!l.isInteractionDisabled,elementsSelectable:!l.isInteractionDisabled,className:"react-flow-canvas-container",...l.restNativeProps,isValidConnection:l.isValidConnection,children:[l.showBackground&&h.jsx(ne.Background,{gap:(B=i.canvas.grid)==null?void 0:B.size,color:"#eee",variant:ne.BackgroundVariant.Lines}),l.showFastOperationButtons&&!E&&h.jsx(QX,{onOpenNodeSelector:l.handleOpenNodeSelector,onAddNoteNode:l.handleAddNoteNode,onTidyCanvas:l.handleTidy}),!l.loading&&!C&&E&&h.jsx(kQ,{onOpenNodeSelector:l.handleOpenNodeSelector}),l.showControls&&h.jsx(ne.Controls,{onInteractiveChange:M=>{l.setLocked(!M)}}),!l.loading&&l.showMiniMap&&h.jsx(fQ,{}),h.jsx(x,{}),h.jsx(oJ,{horizontal:l.helperLineHorizontal,vertical:l.helperLineVertical}),h.jsx(bQ,{visible:l.debugVisible,nodes:l.nodes,edges:l.edges,onClose:()=>l.setDebugVisible(!1)})]})]})]}),D&&h.jsx(D,{})]})})};var yr=(t=>(t.SECOND="second",t.MINUTE="minute",t.HOUR="hour",t))(yr||{});function EQ(t){return{[yr.SECOND]:"SECONDS",[yr.MINUTE]:"MINUTES",[yr.HOUR]:"HOURS"}[t]}function xQ(t){return{SECONDS:yr.SECOND,MINUTES:yr.MINUTE,HOURS:yr.HOUR}[t]}function DQ(){return{enableControl:!1,timeoutValue:30,timeoutUnit:yr.MINUTE,maxNodeExecutions:1e4,webhookUrl:""}}function _Q(t){return{enabled:t.enableControl,timeout_value:t.timeoutValue,timeout_unit:EQ(t.timeoutUnit),max_node_executions:t.maxNodeExecutions,webhook_url:t.webhookUrl||void 0}}function AQ(t){return{enableControl:t.enabled,timeoutValue:t.timeout_value,timeoutUnit:xQ(t.timeout_unit),maxNodeExecutions:t.max_node_executions,webhookUrl:t.webhook_url||""}}function OQ(t){if(!t)return!0;try{return new URL(t),!0}catch{return!1}}const{Text:$b}=_.Typography,TQ=y.forwardRef((t,e)=>{const[n,r]=y.useState(!1),[o,i]=y.useState(!1),[s]=_.Form.useForm(),a=_.Form.useWatch("enableControl",s),l=Ms(),c=Is(b=>b.workflow.executionControl),u=Lb(),d=()=>{r(!0),s.setFieldsValue(c?AQ(c):DQ())},f=()=>{r(!1)};y.useImperativeHandle(e,()=>({open:d,close:f}),[d,f]);const p=async()=>{try{const b=await s.validateFields();i(!0),l(mT(_Q(b))),await u.saveFlow(),_.message.success(G("common.save_success")),r(!1)}catch(b){_.message.error(G("common.save_failed")),console.error(b)}finally{i(!1)}},m=(b,v)=>!v||OQ(v)?Promise.resolve():Promise.reject(new Error(G("app.workflow.global_config.url_invalid")));return h.jsx(_.Drawer,{title:G("app.workflow.canvas.header.settings_label"),placement:"right",width:480,open:n,onClose:f,footer:h.jsxs(_.Space,{style:{float:"right"},children:[h.jsx(_.Button,{onClick:f,children:G("app.common.word.cancel")}),h.jsx(_.Button,{type:"primary",onClick:p,loading:o,children:G("app.common.word.save")})]}),children:h.jsxs(_.Form,{form:s,layout:"vertical",autoComplete:"off",children:[h.jsx(_.Form.Item,{label:G("app.workflow.global_config.enable_control"),name:"enableControl",valuePropName:"checked",children:h.jsx(_.Switch,{})}),a&&h.jsxs(h.Fragment,{children:[h.jsxs(_.Form.Item,{label:G("app.workflow.global_config.timeout_label"),required:!0,style:{marginBottom:8},children:[h.jsxs(_.Space.Compact,{style:{width:"100%"},children:[h.jsx(_.Form.Item,{name:"timeoutValue",noStyle:!0,rules:[{required:!0,message:G("app.workflow.global_config.timeout_required")},{type:"number",min:1,message:G("app.workflow.global_config.timeout_min")}],children:h.jsx(_.InputNumber,{style:{width:"70%"},placeholder:G("app.workflow.global_config.please_input"),min:1})}),h.jsx(_.Form.Item,{name:"timeoutUnit",noStyle:!0,rules:[{required:!0}],children:h.jsxs(_.Select,{style:{width:"30%"},children:[h.jsx(_.Select.Option,{value:yr.SECOND,children:G("app.workflow.global_config.unit_second")}),h.jsx(_.Select.Option,{value:yr.MINUTE,children:G("common.minute")}),h.jsx(_.Select.Option,{value:yr.HOUR,children:G("common.hour")})]})})]}),h.jsx($b,{type:"secondary",style:{fontSize:12},children:G("app.workflow.global_config.timeout_help")})]}),h.jsx(_.Form.Item,{label:G("app.workflow.global_config.max_node_label"),name:"maxNodeExecutions",rules:[{required:!0,message:G("app.workflow.global_config.max_node_required")},{type:"number",min:1,message:G("app.workflow.global_config.max_node_min")}],children:h.jsx(_.InputNumber,{style:{width:"100%"},placeholder:G("app.workflow.global_config.please_input"),min:1,precision:0})}),h.jsx($b,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-16,marginBottom:16},children:G("app.workflow.global_config.max_node_help")}),h.jsx(_.Form.Item,{label:G("app.workflow.global_config.webhook_label"),name:"webhookUrl",rules:[{validator:m}],children:h.jsx(_.Input,{placeholder:G("app.workflow.global_config.webhook_placeholder")})}),h.jsx($b,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-16},children:G("app.workflow.global_config.webhook_help")})]})]})})}),NQ=t=>t==="category"?"分类":"标签",IN=({value:t=[],onChange:e,placeholder:n,templateId:r,optionItems:o,type:i,onCreate:s,onUpdate:a,onDelete:l,onAddRelation:c,onRemoveRelation:u})=>{const[d,f]=y.useState(!1),[p,m]=y.useState(null),[b,v]=y.useState(""),[w,g]=y.useState(!1),[C,S]=y.useState(""),[k,x]=y.useState(!1),D=NQ(i),E=I=>{var z;return(z=o.find(H=>H.name===I))==null?void 0:z.id},O=async I=>{const z=E(I);if(!z)return;const H=t.includes(I);try{x(!0),H?(await u(r,z),e==null||e(t.filter(J=>J!==I))):(await c(r,z),e==null||e([...t,I]))}finally{x(!1)}},A=(I,z)=>{z.stopPropagation();const H=E(I);H&&u(r,H).then(()=>{e==null||e(t.filter(J=>J!==I))}).catch(()=>{_.message.error("移除失败")})},T=(I,z)=>{z.stopPropagation(),m(I),v(I)},B=async()=>{const I=b.trim();if(!I||!p)return;if(I.length>8){_.message.error("名称长度不能超过8个字符");return}const z=E(p);if(z)try{x(!0),await a(z,I),e==null||e(t.map(H=>H===p?I:H)),_.message.success("修改成功")}catch{_.message.error("修改失败")}finally{x(!1),m(null),v("")}},M=()=>{m(null),v("")},F=async I=>{const z=E(I);if(z)try{x(!0),await l(z),e==null||e(t.filter(H=>H!==I)),_.message.success("删除成功")}catch{_.message.error("删除失败")}finally{x(!1)}},N=async()=>{const I=C.trim();if(I){if(I.length>8){_.message.error("名称长度不能超过8个字符");return}try{x(!0),await s(I),g(!1),S(""),_.message.success("创建成功")}catch{_.message.error("创建失败")}finally{x(!1)}}},P=()=>{g(!1),S("")};return h.jsxs("div",{className:"template-editable-select",children:[h.jsxs("div",{className:"template-editable-select-input",role:"combobox",tabIndex:0,"aria-expanded":d,"aria-haspopup":"listbox","aria-label":`选择或管理${D}`,onClick:()=>f(!d),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),f(z=>!z)),I.key==="Escape"&&f(!1)},children:[h.jsx("div",{className:"template-editable-select-tags",children:t.length===0?h.jsx("span",{className:"template-editable-select-placeholder",children:n}):t.map(I=>h.jsx(_.Tag,{closable:!0,onClose:z=>A(I,z),style:{marginRight:4,marginBottom:4},children:I},I))}),h.jsx("div",{className:`template-editable-select-arrow ${d?"template-editable-select-arrow-open":""}`,children:h.jsx(ie.DownOutlined,{})})]}),d&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button","aria-label":`关闭${D}选择器`,className:"template-editable-select-dropdown-overlay",onClick:()=>f(!1)}),h.jsx("div",{className:"template-editable-select-dropdown-container",role:"listbox","aria-label":`${D}选项`,onClick:I=>I.stopPropagation(),children:h.jsxs("div",{className:"template-editable-select-dropdown",children:[o.map(I=>h.jsx("div",{className:"template-editable-select-dropdown-item",children:p===I.name?h.jsx("div",{className:"template-editable-select-edit-container",children:h.jsx(_.Input,{autoFocus:!0,className:"template-editable-select-edit-input",disabled:k,maxLength:8,onChange:z=>v(z.target.value),onPressEnter:B,placeholder:`输入新${D}名称(8个字符以内)`,size:"small",suffix:h.jsxs("div",{className:"template-editable-select-edit-actions",children:[h.jsx(_.Button,{className:"template-editable-select-confirm-btn",icon:h.jsx(ie.CheckOutlined,{}),loading:k,onClick:B,size:"small",type:"text"}),h.jsx(_.Button,{className:"template-editable-select-cancel-btn",disabled:k,icon:h.jsx(ie.CloseOutlined,{}),onClick:M,size:"small",type:"text"})]}),value:b})}):h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",role:"option","aria-selected":t.includes(I.name),className:"template-editable-select-item-content",onClick:()=>O(I.name),children:[h.jsx("div",{className:"template-editable-select-check",children:t.includes(I.name)&&h.jsx(ie.CheckOutlined,{style:{color:"#1890ff"}})}),h.jsx("span",{className:"template-editable-select-name",children:I.name})]}),h.jsxs("div",{className:"template-editable-select-actions",children:[h.jsx(_.Button,{className:"template-editable-select-action-btn",disabled:k,icon:h.jsx(ie.EditOutlined,{}),onClick:z=>T(I.name,z),size:"small",type:"text"}),h.jsx(_.Popconfirm,{cancelText:"取消",okText:"确定",onConfirm:()=>F(I.name),title:`确定删除${D}"${I.name}"吗?`,children:h.jsx(_.Button,{className:"template-editable-select-action-btn",danger:!0,disabled:k,icon:h.jsx(ie.DeleteOutlined,{}),onClick:z=>z.stopPropagation(),size:"small",type:"text"})})]})]})},I.id)),w?h.jsx("div",{className:"template-editable-select-dropdown-item",children:h.jsx("div",{className:"template-editable-select-edit-container",children:h.jsx(_.Input,{autoFocus:!0,className:"template-editable-select-edit-input",disabled:k,maxLength:8,onChange:I=>S(I.target.value),onPressEnter:N,placeholder:`输入新${D}名称(8个字符以内)`,size:"small",suffix:h.jsxs("div",{className:"template-editable-select-edit-actions",children:[h.jsx(_.Button,{className:"template-editable-select-confirm-btn",icon:h.jsx(ie.CheckOutlined,{}),loading:k,onClick:N,size:"small",type:"text"}),h.jsx(_.Button,{className:"template-editable-select-cancel-btn",disabled:k,icon:h.jsx(ie.CloseOutlined,{}),onClick:P,size:"small",type:"text"})]}),value:C})})}):h.jsxs("button",{type:"button",className:"template-editable-select-add-item",onClick:()=>g(!0),children:[h.jsx(ie.PlusOutlined,{style:{color:"#1890ff",marginRight:4}}),h.jsx("span",{children:"添加选项"})]})]})})]})]})},{TextArea:BQ}=_.Input,{Text:zb,Title:sf}=_.Typography,PN=t=>Array.isArray(t)?t.map(e=>e.name).filter(Boolean):[],FQ=({open:t,workflowId:e,workflowName:n,onOpenChange:r,onSuccess:o})=>{const[i]=_.Form.useForm(),s=Ms(),[a,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState([]),[p,m]=y.useState([]),[b,v]=y.useState([]),[w,g]=y.useState([]),C=y.useCallback(async()=>{const P=await yy();return f(P||[]),P},[]),S=y.useCallback(async()=>{const P=await Dy();return m(P||[]),P},[]),k=y.useCallback(async()=>{if(e){u(!0);try{let P;try{P=await by(e)}catch{P=await Gf(e)}const I=PN(P==null?void 0:P.categories),z=PN(P==null?void 0:P.tags);v(I),g(z),i.setFieldsValue({name:(P==null?void 0:P.name)||n||"",description:(P==null?void 0:P.description)||"",category:I,tags:z})}catch{_.message.error("获取模板设置失败"),v([]),g([]),i.setFieldsValue({name:n||"",description:"",category:[],tags:[]})}finally{u(!1)}}},[i,e,n]);y.useEffect(()=>{t&&(k(),C().catch(()=>{_.message.error("获取分类列表失败")}),S().catch(()=>{_.message.error("获取标签列表失败")}))},[C,S,k,t]);const x=async P=>{const I=await Cy({name:P});return await C(),I},D=async(P,I)=>{const z=await ky(P,{name:I});return await C(),z},E=async P=>{const I=await Sy(P);return await C(),I},O=async P=>{const I=await _y({name:P});return await S(),I},A=async(P,I)=>{const z=await Ay(P,{name:I});return await S(),z},T=async P=>{const I=await Oy(P);return await S(),I},B=async()=>{try{const P=await i.validateFields();l(!0);const I={description:P.description,ai_flow:1,id:e};P.name&&(I.name=P.name);try{await vy(e,I)}catch{await oc(e,I)}P.name&&s(Tl(P.name)),_.message.success("模板设置已保存"),r(!1),o==null||o()}catch(P){if(P!=null&&P.errorFields)return;_.message.error("保存失败,请重试")}finally{l(!1)}},M=()=>{r(!1)},F=P=>{v(P),i.setFieldValue("category",P)},N=P=>{g(P),i.setFieldValue("tags",P)};return h.jsx(_.Modal,{cancelText:"取消",confirmLoading:a,okText:"保存设置",onCancel:M,onOk:B,open:t,title:h.jsxs(_.Space,{children:[h.jsx(ie.SettingOutlined,{}),h.jsx("span",{children:"模板设置"})]}),width:600,children:c?h.jsx(_.Skeleton,{active:!0,paragraph:{rows:8}}):h.jsxs("div",{className:"workflow-template-settings-modal",children:[h.jsx("div",{className:"workflow-template-settings-hint",children:h.jsx(zb,{type:"secondary",children:"设置模板的基本信息,包括描述和分类标签,便于更好地组织和管理模板。"})}),h.jsxs(_.Form,{form:i,layout:"vertical",preserve:!1,requiredMark:!1,children:[h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.FileTextOutlined,{style:{color:"#1890ff"}}),h.jsx(sf,{level:5,children:"模板名称"})]}),h.jsx(_.Form.Item,{name:"name",rules:[{max:50,message:"最多50个字符"}],children:h.jsx(_.Input,{placeholder:"请输入模板名称",size:"large"})})]}),h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.FileTextOutlined,{style:{color:"#1890ff"}}),h.jsx(sf,{level:5,children:"模板描述"})]}),h.jsx(_.Form.Item,{name:"description",rules:[{max:500,message:"最多500个字符"}],children:h.jsx(BQ,{maxLength:500,placeholder:"请输入模板描述,描述该模板的功能和使用场景...",rows:4,showCount:!0})})]}),h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.TagsOutlined,{style:{color:"#1890ff"}}),h.jsx(sf,{level:5,children:"模板分类"}),h.jsx(zb,{className:"workflow-template-settings-subtitle",type:"secondary",children:"(可多选)"})]}),h.jsx(_.Form.Item,{name:"category",rules:[{required:!0,message:"请选择模板分类"}],children:h.jsx(IN,{onAddRelation:Ey,onChange:F,onCreate:x,onDelete:E,onRemoveRelation:xy,onUpdate:D,optionItems:d,placeholder:"请选择模板分类",templateId:e,type:"category",value:b})})]}),h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card workflow-template-settings-card-last",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.TagsOutlined,{style:{color:"#52c41a"}}),h.jsx(sf,{level:5,children:"模板标签"}),h.jsx(zb,{className:"workflow-template-settings-subtitle",type:"secondary",children:"(可多选)"})]}),h.jsx(_.Form.Item,{name:"tags",children:h.jsx(IN,{onAddRelation:Ty,onChange:N,onCreate:O,onDelete:T,onRemoveRelation:Ny,onUpdate:A,optionItems:p,placeholder:"请选择模板标签",templateId:e,type:"tag",value:w})})]})]})]})})},{Title:MQ}=_.Typography,Hb="[workflow:online-validation]",IQ=({metadata:t})=>{const e=Sl(),n=t.op_status,r=t.id,i=t&&t.effective_version_no!=null&&t.effective_version_no!==""?h.jsx("span",{style:{marginLeft:4},children:h.jsx(Te.FormattedMessage,{id:"app.workflow.version.tag",values:{version:t.effective_version_no}})}):null;return{[er.UNPUBLISHED]:h.jsxs(_.Tag,{bordered:!1,color:"orange",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.not-published"}),i]}),[er.ONLINE]:h.jsxs(_.Tag,{bordered:!1,color:"green",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.already-online"}),i]}),[er.OFFLINE]:h.jsxs(_.Tag,{bordered:!1,color:"default",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.already-offline"}),i]}),[er.ONLINE_ING]:h.jsxs(_.Tag,{bordered:!1,color:"processing",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.going-online"}),i]}),[er.ON_WARN]:h.jsxs(_.Tag,{bordered:!1,color:"#faad14",onClick:()=>{e(`/link/log?warnId=${r}`)},children:[h.jsx(Te.FormattedMessage,{id:"common.warning"}),i]}),[er.OFF_WARN]:h.jsxs(_.Tag,{bordered:!1,color:"#faad14",onClick:()=>{e(`/link/log?warnId=${r}`)},children:[h.jsx(Te.FormattedMessage,{id:"common.warning"}),i]})}[n??""]??null},PQ=({loading:t=!1,onSave:e,getFlowPayload:n,autoSaveStatus:r=Ln.IDLE,lastSavedTime:o,unSave:i,onOffline:s})=>{var X,re;const a=Lb(),l=Sl(),c=Ms(),u=At(),d=na(),f=Is(Z=>Z.workflow.workflowName),p=Is(Z=>{var de;return(de=Z.workflow.flowMetadata)==null?void 0:de.op_status}),[m,b]=y.useState(!1),[v,w]=y.useState(f),[g,C]=y.useState(!1),[S,k]=y.useState(!1),x=y.useRef(null),{getNodes:D}=ne.useReactFlow(),O=Pt().toolbar,A=O==null?void 0:O.versionManagement,T=!!(A!=null&&A.onShowHistory),B=!!(A!=null&&A.onConfirmPublish),M=O==null?void 0:O.templateSettings,{isMcpServerCanvas:F}=MN(),N=p===er.ONLINE||p===er.ON_WARN,P=y.useRef(null),I=PX(),z=I.id;y.useEffect(()=>{w(f)},[f]),y.useEffect(()=>{m&&x.current&&x.current.focus()},[m]),y.useCallback(()=>{const de=D().filter(ve=>ve.data.status!==me.SUCCESS&&ve.data.status!==me.RUNNABLE);return de.length&&console.warn(`${Hb} node status check failed`,{unhealthyNodes:de.map(ve=>({id:ve.id,name:ve.data.name,type:ve.type,status:ve.data.status}))}),de.length===0},[D]),y.useCallback(()=>{var ve,we;const Z=D(),de=(fe,le,Se)=>(console.warn(`${Hb} required config check failed`,{node:{id:fe.id,name:fe.data.name,type:fe.type,status:fe.data.status},reason:le,details:Se,configSchema:fe.data.config_schema}),!1);for(const fe of Z){const{data:le,type:Se}=fe,{config_schema:ce}=le;if(Se===pe.LOOP){if(!(ce!=null&&ce.asc))return de(fe,"loop config is missing asc");const Fe=Object.keys(ce??{});if(Fe.length===0)return de(fe,"loop config schema is empty");if(Fe.some(Ve=>typeof ce[Ve]>"u"))return de(fe,"loop config contains undefined values",{undefinedKeys:Fe.filter(Ve=>typeof ce[Ve]>"u")})}else if(Se===pe.CONDITION){if(!((ve=ce==null?void 0:ce.or_list)!=null&&ve.length))return de(fe,"condition config is missing or_list");if(!ce.or_list.every(Ve=>Ve.and_list.every(je=>je.query&&je.operator)))return de(fe,"condition config contains incomplete rules")}else if(Se===pe.SWITCH){if(!((we=ce==null?void 0:ce.branches)!=null&&we.length))return de(fe,"switch config is missing branches");if(!ce.branches.every(Ve=>Ve.or_list.every(je=>je.and_list.every(We=>We.query&&We.operator))))return de(fe,"switch config contains incomplete branch rules")}else if(Se!==pe.STICKY){if(!Ui(fe.type)){const Fe=ce==null?void 0:ce.sub_params;if(!Array.isArray(Fe))return de(fe,"config_schema.sub_params is missing or invalid");const Ve=Fe.every(We=>We.required&&!We.is_child?typeof We.value<"u"&&We.value!==null?!0:(console.warn(`${Hb} required param missing`,{key:We.key,name:We.name,displayName:We.display_name,item:We}),!1):!0);if(!Ve)return de(fe,"required parameters are missing",{missingParams:Fe.filter(We=>We.required&&!We.is_child&&(typeof We.value>"u"||We.value===null)).map(We=>({key:We.key,name:We.name,label:We.label}))});const je=ce!=null&&ce.account_schema_id?!!ce.account_id:!0;if(!Ve||!je)return de(fe,"account is required but account_id is missing",{accountSchemaId:ce==null?void 0:ce.account_schema_id,accountId:ce==null?void 0:ce.account_id})}}}return!0},[D]);const H=async()=>{try{await(e==null?void 0:e()),_.message.success(G("workflow.version.save_success"))}catch{_.message.error(G("workflow.version.save_failed"))}},J=Z=>{w(Z.target.value)};St.useUnmount(()=>{c(Mw()),Tl("")});const K=y.useCallback(()=>{const Z=f,de=v.trim(),ve=de||G("app.workflow.canvas.header.workflow_name_unnamed");c(Tl(ve)),oc(z,{name:ve}).then(()=>{}).catch(()=>{c(Tl(Z))}),b(!1)},[c,v,f,z]),ee=()=>{K()},$=()=>{K()},U=()=>{var Z;t||d==="edit"&&((Z=O==null?void 0:O.flowName)==null?void 0:Z.editable)!==!1&&b(!0)},R=()=>{if(!i)switch(r){case Ln.SAVING:return h.jsxs("div",{className:"save-state saving",children:[h.jsx("div",{className:"status-icon"}),"保存中"]});case Ln.SAVED:return h.jsx(_.Tooltip,{title:`已自动保存 (${o})`,children:h.jsx("div",{style:{display:"flex",alignItems:"center"},children:h.jsxs(_.Tag,{bordered:!1,color:"green",children:["已保存"," ",h.jsx("span",{style:{fontSize:10,marginLeft:4,color:"#999"},children:o})]})})});case Ln.ERROR:return h.jsx(_.Tooltip,{title:"自动保存失败",children:h.jsx(_.Badge,{status:"error",text:h.jsx("span",{children:"保存失败"})})});default:return null}},[te,se]=_.Modal.useModal(),be=async()=>{var de;const Z=()=>{var ve,we;if((ve=O==null?void 0:O.nav)!=null&&ve.onBack){O.nav.onBack();return}if((we=O==null?void 0:O.nav)!=null&&we.backTo){ac.push(O.nav.backTo);return}ac.back()};if(!N&&((de=O==null?void 0:O.nav)!=null&&de.confirmOnBackWhenOffline)&&i){await te.confirm({title:G("user.common.operation_title"),content:O.nav.backConfirmMessage||"当前流程未保存,是否确认返回?"})&&Z();return}Z()},j=()=>{var de;const Z=[];return I!=null&&I.id&&Z.push(h.jsxs(_.Space,{size:8,children:[h.jsx(_.Tag,{bordered:!1,color:"blue",icon:h.jsx(ie.EditOutlined,{}),children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.draft_editing_tag"})}),F&&h.jsx(_.Tag,{bordered:!1,color:"blue",children:"MCP Server"}),h.jsx("span",{style:(de=O==null?void 0:O.flowStatusTag)==null?void 0:de.style,children:h.jsx(IQ,{metadata:I})}),i&&h.jsx(_.Tag,{bordered:!1,color:"orange",icon:h.jsx(ie.WarningOutlined,{}),children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.unsaved_tag"})})]},"online-area")),Z},Y=y.useMemo(()=>{const Z=[];return T&&Z.push({size:"small",key:"history",icon:h.jsx(ie.HistoryOutlined,{}),label:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.history_versions"}),onClick:()=>{var de;(de=A==null?void 0:A.onShowHistory)==null||de.call(A)}}),Z.push({size:"small",key:"help",icon:h.jsx(ie.QuestionCircleOutlined,{}),label:(O==null?void 0:O.helpDocText)||h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.help_doc_default"}),onClick:()=>{l((O==null?void 0:O.helpDocUrl)||"https://1in15q85qd.apifox.cn/8698531m0",!0)}}),Z.push({size:"small",key:"settings",icon:h.jsx(ie.SettingOutlined,{}),label:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.settings_label"}),onClick:()=>{var de;(de=P.current)==null||de.open()}}),u&&(M!=null&&M.enabled)&&z&&Z.push({size:"small",key:"templateSettings",label:M.buttonText||h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.template_settings_default"}),icon:h.jsx(ie.FileDoneOutlined,{}),onClick:()=>k(!0)}),Z},[T,u,l,M==null?void 0:M.enabled,z,O==null?void 0:O.helpDocText,O==null?void 0:O.helpDocUrl,M.buttonText,A==null?void 0:A.onShowHistory]),W=d==="edit";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"workflow-canvas-header",children:[h.jsxs("div",{className:"workflow-header-left-area",children:[((X=O.nav)==null?void 0:X.showBack)&&h.jsx(_.Button,{type:"default",size:"small",icon:h.jsx(ie.LeftOutlined,{className:"workflow-back-icon"}),onClick:be,style:{width:29}},"back"),h.jsx("div",{className:"workflow-name-icon",children:`${f??""}`.length>2?f.substring(0,2):f}),m?h.jsx(_.Input,{size:"small",ref:x,value:v,onChange:J,onPressEnter:ee,onBlur:$,maxLength:30,className:"workflow-name-input",placeholder:"请输入工作流名称"},"name-input"):h.jsx("div",{className:"workflow-name",onClick:U,children:f?h.jsxs("div",{className:"workflow-name-container",children:[h.jsx(MQ,{level:4,className:"workflow-name-text",children:f}),W&&h.jsx("div",{className:"workflow-name-desc",children:"点击名称可编辑,最多 30 字"})]}):h.jsx(_.Skeleton.Input,{active:!0,size:"small"})},"name-display"),j()]}),h.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[u&&R(),h.jsxs(_.Space,{style:{marginLeft:16},children:[(re=O==null?void 0:O.buttons)==null?void 0:re.map(Z=>h.jsx(_.Button,{size:"small",style:Z.style,icon:Z.icon,type:Z.type??"default",disabled:t,onClick:()=>{Z.onClick&&a&&Z.onClick(a)},children:Z.label},Z.id)),h.jsx(_.Button,{size:"small",icon:h.jsx(ie.SaveOutlined,{}),loading:r===Ln.SAVING,disabled:t,onClick:H,children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.save_draft"})}),N&&s&&h.jsx(_.Button,{size:"small",icon:h.jsx(wW,{size:16}),loading:g,disabled:!z||t,onClick:async()=>{C(!0);try{await s(z)&&(_.message.success(G("workflow.version.offline_success")),await(a==null?void 0:a.refreshFlowVersionStatus()))}catch{console.error("call offline error")}finally{C(!1)}},children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.offline_flow"})}),h.jsx(_.Dropdown,{trigger:["click"],disabled:t,menu:{items:Y},overlayClassName:"small",children:h.jsx(_.Button,{icon:h.jsx(ie.DownOutlined,{}),iconPosition:"end",size:"small",children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.more"})})}),B&&h.jsx(_.Button,{size:"small",icon:h.jsx(ie.ToTopOutlined,{}),type:"primary",disabled:t,onClick:async()=>{var Z;i&&await H(),(Z=A==null?void 0:A.onConfirmPublish)==null||Z.call(A,n==null?void 0:n())},children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.publish_enable"})}),h.jsx(TQ,{ref:P})]})]})]}),se,(M==null?void 0:M.enabled)&&z&&h.jsx(FQ,{onOpenChange:k,open:S,workflowId:z,workflowName:f})]})},LQ=({categories:t,activeId:e,loading:n,onChange:r})=>{const o=Te.useIntl(),i=s=>{const a=s.currentTarget,l=a.scrollWidth-a.clientWidth;if(l<=0||Math.abs(s.deltaY)<=Math.abs(s.deltaX))return;const c=Math.min(Math.max(a.scrollLeft+s.deltaY,0),l);c!==a.scrollLeft&&(s.preventDefault(),a.scrollLeft=c)};return n?h.jsx("div",{className:"category-tabs-wrapper loading","aria-busy":"true","aria-live":"polite",children:h.jsx("div",{className:"category-tabs",children:[0,1,2,3,4].map(s=>h.jsx("div",{className:"category-tab-skeleton",style:{animationDelay:`${s*80}ms`}},`category-skeleton-${s}`))})}):h.jsxs("div",{className:"category-tabs-wrapper",children:[h.jsx("div",{className:"category-tabs",onWheel:i,children:t.map(s=>h.jsx("div",{className:ar("category-tab",{active:e===s.id,disabled:s.filterable===!1}),title:s.filterable===!1?o.formatMessage({id:of.categoryUnavailable}):void 0,onClick:()=>{if(s.filterable===!1){_.message.warning(o.formatMessage({id:of.categoryUnavailable}));return}r(s)},children:s.name},s.id))}),h.jsx("div",{className:"category-tabs-mask left"}),h.jsx("div",{className:"category-tabs-mask right"})]})},$Q=({action:t,parentNode:e,onSelect:n})=>{const r=t.status===0||t.disabled===!0,o=()=>{r||(parseInt(`${t.id}`,10)<1?n(e,{...t,type:`${t.action_key}@${t.action_ver}`,saveType:t.action_type}):n(e,t))};return h.jsxs("button",{type:"button",className:`action-item${r?" is-disabled":""}`,onClick:o,disabled:r,"aria-label":`选择动作 ${t.name}`,title:r?"后续版本支持":void 0,children:[h.jsx("div",{className:"item-icon","data-category":e.category.split("-")[0]||"action",children:t.icon?h.jsx("img",{src:t.icon,alt:t.name,style:{width:32,height:32}}):h.jsx("div",{children:t.name.charAt(0).toUpperCase()})}),h.jsxs("div",{className:"item-content",children:[h.jsx("div",{className:"item-title",children:t.name}),t.description&&h.jsx("div",{className:"item-description",children:t.description})]})]})},zQ=({node:t,expanded:e,actions:n,loading:r,hasPartialActions:o,onToggle:i,onActionSelect:s,onLoadAllActions:a})=>{const l=()=>{i(t)},c=u=>{u.stopPropagation(),a==null||a(t)};return h.jsxs("div",{className:ar("node-card",{expanded:e}),children:[h.jsxs("button",{type:"button",className:"node-card-header","aria-expanded":e,"aria-label":`${e?"收起":"展开"} ${t.name}`,onClick:l,children:[h.jsx("div",{className:"node-card-icon",children:t.icon?h.jsx("img",{src:t.icon,alt:t.name}):h.jsx("span",{children:t.name.charAt(0).toUpperCase()})}),h.jsxs("div",{className:"node-card-info",children:[h.jsx("div",{className:"node-card-title",children:t.name}),t.description&&h.jsx("div",{className:"node-card-desc",children:t.description})]}),h.jsx(ie.CaretDownOutlined,{className:ar("node-card-arrow",{expanded:e})})]}),e&&h.jsxs("div",{className:"node-card-body",children:[r?h.jsx("div",{className:"node-card-state",children:"动作加载中..."}):n.length===0?h.jsx("div",{className:"node-card-state",children:"暂无可用动作"}):h.jsx("div",{className:"node-card-actions",children:n.map(u=>h.jsx("div",{className:"node-card-action-wrapper",children:h.jsx($Q,{action:u,parentNode:t,onSelect:s})},u.id))}),o&&!r&&h.jsx("button",{type:"button",className:"node-card-more",onClick:c,children:"查看该节点全部动作"})]})]})},HQ=({currentCategory:t,categoryPath:e,selectedNode:n,onBack:r,onClose:o,title:i,subTitle:s,showBackButton:a})=>{const l=()=>n?n.name:t?t.name:"节点选择器",c=()=>n?"选择动作":e.length>0?e.slice(0,-1).map(p=>p.name).join(" / "):"",u=i||l(),d=s??c(),f=typeof a=="boolean"?a:!!(n||e.length>0);return h.jsxs("div",{className:"panel-header",children:[h.jsxs("div",{className:"header-left",children:[f&&r&&h.jsx("button",{type:"button",className:"back-button","aria-label":"返回上一级",onClick:r,children:h.jsx(ie.ArrowLeftOutlined,{})}),h.jsxs("div",{className:"title",children:[u,d&&h.jsx("div",{className:"category-path",children:d})]})]}),h.jsx("button",{type:"button",className:"close-button","aria-label":"关闭节点选择器",onClick:o,children:h.jsx(ie.CloseOutlined,{})})]})},VQ=[],jQ=new Set(Object.values(pe)),WQ=t=>{if(t)return jQ.has(t)?t:void 0},UQ=({nodeSelectorVisible:t,nodeAddInfo:e})=>{const[n,r]=y.useState(!1),o=El();return{isLoadingActions:n,fetchNodeActions:async(s,a)=>{a!=null&&a.suppressLoading||r(!0);try{const l=t&&e&&e.trigger===!0,c=(e==null?void 0:e.protocol)===$e.MCP_SERVER||(e==null?void 0:e.protocol)===$e.BUILTIN_MCP,u=e==null?void 0:e.protocol,d={linkId:s.id,flowId:o},f=WQ(s.type);f&&(d.actionType=f),c&&(d.page=(a==null?void 0:a.page)??1,d.size=(a==null?void 0:a.size)??iR),u&&(d.protocol=u),l&&(d.trigger=!0);const p=await py(d);return p&&p.items&&Array.isArray(p.items)?p.items.map(b=>{var w;const v=b.action_ver??((w=b.node_schema)==null?void 0:w.version);return b.action_key&&b.node_schema&&A0(b.action_key,v,b.node_schema),{...b,id:b.id,action_key:b.action_key,action_ver:v,nodeKey:b.action_key,nodeVersion:v,name:b.name||"未命名动作",description:b.description||"",connector_name:s.name,nodeId:s.id,nodeIcon:s.icon}}):[]}catch(l){return console.error("获取动作列表失败:",l),[]}finally{a!=null&&a.suppressLoading||r(!1)}}}},qQ=({onFetchCategories:t,restrictToCategory:e,nodeSelectorVisible:n,nodeAddInfo:r,fallbackCategories:o=[],requestContextKey:i,useConnectableDataSource:s=!1})=>{const[a,l]=y.useState(o),[c,u]=y.useState(!1),[d,f]=y.useState(null),p=y.useRef(0);return y.useEffect(()=>{if(!n){p.current+=1,u(!1),f(null);return}return(async()=>{const b=++p.current;u(!0),f(null);try{let v="action";const w=n&&r&&r.trigger,g=r==null?void 0:r.protocol;w?v="trigger":g===$e.MCP_SERVER||g===$e.BUILTIN_MCP?v=lO:g===$e.AI_TOOL?v="mcp":g===$e.AI_LANGUAGE_MODEL?v="model":g===$e.AI_MEMORY&&(v="memory");const C=await t(v);if(b!==p.current)return;const k=e?C.filter(D=>D.id===e):v===lO&&!s?C.filter(D=>D.id===sw):w?C:C.filter(D=>D.id!=="TRIGGER"),x=e?null:{id:"ALL",name:"全部",description:"全部分类",icon:void 0};l(x?[x,...k]:k),f(i)}catch(v){if(b!==p.current)return;console.error("Failed to fetch categories:",v),l(o),f(i)}finally{b===p.current&&u(!1)}})(),()=>{p.current+=1}},[o,r==null?void 0:r.protocol,r==null?void 0:r.trigger,n,t,i,e,s]),{categories:a,categoriesReady:n&&d===i,isLoadingCategories:c,setCategories:l}};async function GQ({node:t,query:e,fetchConnectablePage:n,filterPage:r=o=>o}){var s;if(!e)return[];const o=r(await n(e)),i=o.nodes.find(a=>a.id===t.id);return(i==null?void 0:i.matchedActions)??((s=o.nodes[0])==null?void 0:s.matchedActions)??[]}function RQ(t,e,n=!1){return n||e===$e.BUILTIN_MCP||e===$e.MCP_SERVER?"mcp":t}const LN=/^[1-9]\d*$/,Vb=t=>{if(typeof t=="number")return Number.isSafeInteger(t)&&t>0?t:void 0;const e=t.trim();if(LN.test(e))return e},Hr=t=>{const e=t==null?void 0:t.trim();return e||void 0},$N=t=>{if(t==null)return;if(typeof t=="number")return Number.isSafeInteger(t)&&t>0?t:void 0;const e=t.trim();if(!LN.test(e))return;const n=Number(e);return Number.isSafeInteger(n)?n:void 0},KQ=t=>{const e=t.scene.trim();if(!e)return null;const n=Hr(t.categoryName),r=Hr(t.flowId),o=$N(t.page),i=$N(t.size);return{scene:e,trigger:t.trigger,...n===void 0?{}:{categoryName:n},...Hr(t.linkId)===void 0?{}:{linkId:Hr(t.linkId)},...Hr(t.keyword)===void 0?{}:{keyword:Hr(t.keyword)},...r===void 0?{}:{flowId:r},...o===void 0?{}:{page:o},...i===void 0?{}:{size:i}}},YQ=(t,e)=>{const n=KQ(e);if(!n)return null;switch(t.mode){case"independent":return{...n,mode:"independent"};case"source":{const r=Vb(t.sourceId),o=Hr(t.sourceHandle);return r===void 0||o===void 0?null:{...n,mode:"source",sourceId:r,sourceHandle:o}}case"target":{const r=Vb(t.targetId),o=Hr(t.targetHandle);return r===void 0||o===void 0?null:{...n,mode:"target",targetId:r,targetHandle:o}}case"edge-insert":{const r=Vb(t.sourceId),o=Hr(t.sourceHandle),i=Hr(t.targetHandle);return r===void 0||o===void 0||i===void 0?null:{...n,mode:"source",sourceId:r,sourceHandle:o}}}},zN="[workflow:connectable]",Bi=t=>!!t&&typeof t=="object"&&!Array.isArray(t),jb=(t,e)=>Object.hasOwn(t,e),qt=(t,e)=>{for(const n of e)if(jb(t,n)&&t[n]!==void 0&&t[n]!==null)return t[n]},Bt=(t,e)=>{for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return r.trim()}},Fl=t=>{if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"&&t.trim()){const e=Number(t);return Number.isFinite(e)?e:void 0}},Wb=(t,e=!1)=>typeof t=="boolean"?t:t===1||t==="1"||t==="true"?!0:t===0||t==="0"||t==="false"?!1:e,XQ=t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):[],HN=t=>{let e=t,n=0;for(;n<4&&Bi(e)&&jb(e,"data")&&!jb(e,"items");)e=e.data,n+=1;return e},JQ=t=>{const e=HN(t);return Array.isArray(e)?e.filter(Bi).map(n=>{const r=Bt(n,["name","categoryName","category_name"]),o=Bt(n,["label","name"])??"";return r||console.warn(`${zN} category has no filter name`,{name:o,availableKeys:Object.keys(n).sort()}),{id:r||o,categoryName:r,name:o,description:Bt(n,["desc","description"])??"",icon:Bt(n,["icon"]),searchAction:Wb(qt(n,["searchAction","search_action"])),filterable:!!r}}):[]},VN=t=>{if(typeof t=="number")return Number.isSafeInteger(t)&&t>0?String(t):void 0;if(typeof t!="string")return;const e=t.trim();if(e){if(/^-?\d+$/.test(e)){const n=e.startsWith("-")?e.slice(1):e;if(e.startsWith("-")||/^0+$/.test(n))return}return e}},QQ=t=>{if(typeof t=="number")return Number.isSafeInteger(t)?String(t):void 0;if(typeof t!="string")return;const e=t.trim();return/^-?\d+$/.test(e)?e:void 0},jN=(t,e)=>{for(const n of e){const r=VN(t[n]);if(r!==void 0)return{value:r,source:n}}},WN=(t,e)=>{console.warn(`${zN} ${t} has no stable identifier`,{name:Bt(e,["name","label","actionName","action_name"]),availableKeys:Object.keys(e).sort()})},ZQ=t=>{const e=Bi(t)?t:{},n=jN(e,["id","linkId","link_id","appPackage","app_package","connectorId","connector_id"]);return n||WN("connector",e),{...e,id:(n==null?void 0:n.value)??"",selectable:!!n,identifierSource:n==null?void 0:n.source,name:Bt(e,["name","displayName","display_name"])??"",description:Bt(e,["description","desc"])??null,build_type:Bt(e,["buildType","build_type"]),app_domain_category:XQ(qt(e,["appDomainCategory","app_domain_category"])),app_action_category:qt(e,["appActionCategory","app_action_category"]),deployment_type:Bt(e,["deploymentType","deployment_type"]),app_package:Bt(e,["appPackage","app_package"]),ver_name:Bt(e,["verName","ver_name"]),ver_number:Fl(qt(e,["verNumber","ver_number"])),ver_type:Bt(e,["verType","ver_type"]),icon:Bt(e,["icon"])}},eZ=t=>{const e=Bi(t)?t:{},n=jN(e,["actionKey","action_key","nodeKey","node_key"]),r=qt(e,["nodeSchema","node_schema"]),o=Bi(r)?r:null,i=o?Bt(o,["key"]):void 0,s=o?Fl(qt(o,["version"])):void 0,a=QQ(qt(e,["id","actionId","action_id"]))??(i?"0":void 0),l=n??(i?{value:i,source:"nodeSchema.key"}:void 0);l||WN("action",e);const c=Bt(e,["actionKey","action_key","nodeKey","node_key"])??i,u=VN(qt(e,["connectorId","connector_id"]));return{...e,id:(l==null?void 0:l.value)??"",backendActionId:a,action_id:a,selectable:!!l,identifierSource:l==null?void 0:l.source,action_key:c,action_ver:Fl(qt(e,["actionVer","action_ver","nodeVersion","node_version","version"]))??s,is_trigger:Fl(qt(e,["isTrigger","is_trigger"]))??(Wb(qt(e,["isTrigger","is_trigger"]))?1:0),name:Bt(e,["name","actionName","action_name"])??"",description:Bt(e,["description","desc"])??null,connector_id:u??null,status:l?1:0,protocol:Bt(e,["protocol"])??"",config_schema:qt(e,["configSchema","config_schema"])??{},sample_output:qt(e,["sampleOutput","sample_output"]),node_struct:Bt(e,["nodeStruct","node_struct"])??"",action_type:Bt(e,["actionType","action_type"])??null}},tZ=t=>{if(typeof t!="string"||!t.trim())return;const e=t.trim().toUpperCase();switch(e){case"CONNECTOR_ONL":return"CONNECTOR_ONLY";case"ACTION_MATCHED":return"ACTION_ONLY";case"BOTH":return"BOTH_MATCHED";default:return e}},af=(t,e,n)=>Fl(qt(t,e))??n,nZ=t=>{const e=HN(t),n=Bi(e)?e:{},r=qt(n,["items","records"]),o=Array.isArray(r)?r.filter(Bi).map(i=>{const s=ZQ(i.connector),a=qt(i,["matchedActions","matched_actions"]),l=Array.isArray(a)?a.map(c=>eZ(c)):[];return{connector:s,matched_actions:l,default_expanded:Wb(qt(i,["defaultExpanded","default_expanded"])),match_type:tZ(qt(i,["matchType","match_type"]))}}):[];return{items:o,total:af(n,["total"],o.length),size:af(n,["size"],o.length),page:af(n,["page","current"],1),pages:af(n,["pages"],0)}},rZ=(t,e)=>{var a;const n=t.action_type||t.node_struct||pe.ACTION,r=t.action_ver??((a=t.node_schema)==null?void 0:a.version);t.action_key&&t.node_schema&&A0(t.action_key,r,t.node_schema);const{node_schema:o,nodeSchema:i,...s}=t;return{...s,id:t.id,type:n,action_type:n,action_key:t.action_key,action_ver:r,nodeKey:t.action_key,nodeVersion:r,action_name:t.name||e.name,name:t.name||e.name,description:t.description||e.description||"",connector_name:e.name,nodeId:e.id,nodeIcon:e.icon}},oZ=(t,e)=>{if(typeof e=="boolean")return e;if(!t)return!1;const n=t.toUpperCase();return n==="ACTION_ONLY"||n==="BOTH_MATCHED"},iZ=(t,e)=>{const{matchedActions:n,defaultExpanded:r,matchType:o}=e||{};return{id:t.id||t.name,selectable:"selectable"in t&&typeof t.selectable=="boolean"?t.selectable:!0,identifierSource:"identifierSource"in t&&typeof t.identifierSource=="string"?t.identifierSource:void 0,type:t.build_type||pe.ACTION,name:t.name,description:t.description||"",category:t.app_domain_category&&t.app_domain_category[0]||"unknown",icon:t.icon||void 0,app_domain_category:t.app_domain_category||[],actionCategories:t.app_action_category||[],deployment_type:t.deployment_type,build_type:t.build_type,matchedActions:n,defaultExpanded:oZ(o,r),matchType:o,connector:t}},sZ=t=>JQ(t).map(e=>({id:e.id,categoryName:e.categoryName,filterable:e.filterable,name:e.name,description:e.description,icon:e.icon,search_action:e.searchAction,nodes:[]})),aZ=t=>{const e=nZ(t);return{nodes:e.items.map(({connector:r,matched_actions:o,default_expanded:i,match_type:s})=>{const a=o.map(l=>rZ(l,r));return iZ(r,{matchedActions:a,defaultExpanded:i,matchType:s})}),total:e.total,page:e.page,size:e.size,pages:e.pages}},lZ=async t=>{const{apiQueryConnectableNodePackageCategories:e}=await Promise.resolve().then(()=>Yy),n=await e(t);return sZ(n)},UN=async t=>{const{apiQueryConnectableNodePackagePlugins:e}=await Promise.resolve().then(()=>Yy),n=await e(t);return aZ(n)},lf=t=>(t==null?void 0:t.trim())||void 0,cZ=t=>{const e=t==null?void 0:t.edge;if(e){const s=lf(e.sourceHandle??e.sourceHandleId),a=lf(e.targetHandle??e.targetHandleId);return e.source===void 0||e.target===void 0||!s||!a?null:String(e.source)===String(e.target)&&s===He.LOOP?{mode:"source",sourceId:e.source,sourceHandle:s}:{mode:"edge-insert",sourceId:e.source,sourceHandle:s,targetId:e.target,targetHandle:a}}const n=lf(t==null?void 0:t.sourceHandle),r=lf(t==null?void 0:t.targetHandle),o=(t==null?void 0:t.sourceNodeId)!==void 0||n!==void 0,i=(t==null?void 0:t.targetNodeId)!==void 0||r!==void 0;return o&&i?null:o?t!=null&&t.sourceNodeId&&n?{mode:"source",sourceId:t.sourceNodeId,sourceHandle:n}:null:i?t!=null&&t.targetNodeId&&r?{mode:"target",targetId:t.targetNodeId,targetHandle:r}:null:{mode:"independent"}};function uZ({nodeSelectorVisible:t,effectiveNodeAddInfo:e,workflowId:n,onSearch:r,onFetchCategories:o,onFetchNodesByCategory:i}){var b;const s=Pt(),{isMcpServerCanvas:a}=MN(),l=RQ(a?"mcp":s.scene??"",e==null?void 0:e.protocol,a),c=y.useMemo(()=>cZ(e),[e]),u=y.useMemo(()=>{var v;return JSON.stringify({visible:t,protocol:e==null?void 0:e.protocol,trigger:!!(e!=null&&e.trigger),edgeId:(v=e==null?void 0:e.edge)==null?void 0:v.id,connectableContext:c,workflowId:n})},[c,(b=e==null?void 0:e.edge)==null?void 0:b.id,e==null?void 0:e.protocol,e==null?void 0:e.trigger,t,n]),d=y.useCallback((v={})=>c?YQ(c,{scene:l,trigger:!!(e!=null&&e.trigger),categoryName:v.categoryName,keyword:v.keyword??v.name,linkId:v.linkId,flowId:v.flow_id??n,page:v.page,size:v.size}):null,[c,e==null?void 0:e.trigger,l,n]),f=y.useCallback(async()=>{const v=d();return v?lZ(v):[]},[d]),p=y.useCallback(async(v={})=>{const w=d(v);return w?await UN(w):{nodes:[],total:0,page:v.page||1,size:v.size||20,pages:0}},[d]),m=y.useCallback(async(v,w)=>{const g=d({linkId:v.id});return GQ({node:v,query:g,fetchConnectablePage:UN})},[d]);return{actionRequestContextKey:u,connectableContext:c,onSearch:r||p,onFetchCategories:o||f,onFetchNodesByCategory:i||p,fetchNodeActions:m}}const dZ=({categories:t,categoriesReady:e,initialCategory:n,nodeSelectorVisible:r,nodeAddInfo:o,onFetchNodesByCategory:i,defaultPageSize:s=20,flowId:a,useConnectableDataSource:l=!1})=>{const[c,u]=y.useState(n||"ALL"),[d,f]=y.useState([]),[p,m]=y.useState(!1),[b,v]=y.useState({page:1,size:s,total:0,hasMore:!0}),w=y.useRef(0),g=r&&o&&o.trigger===!0,C=r&&o&&o.protocol===$e.AI_TOOL,S=r&&o&&o.protocol===$e.BUILTIN_MCP,k=y.useMemo(()=>o==null?void 0:o.protocol,[o==null?void 0:o.protocol]),x=y.useMemo(()=>{const N=o==null?void 0:o.protocol;if(N===$e.AI_TOOL)return"tool";if(N===$e.AI_LANGUAGE_MODEL)return"model";if(N===$e.AI_MEMORY)return"memory"},[o==null?void 0:o.protocol]),E=((o==null?void 0:o.protocol)===$e.MCP_SERVER||(o==null?void 0:o.protocol)===$e.BUILTIN_MCP)&&!l,O=y.useMemo(()=>c==="ALL"?null:t.find(N=>N.id===c)||null,[c,t]),A=y.useCallback((N,P=1)=>{var I;return{app_domain_category:l?void 0:E?sw:N&&N!=="ALL"?N:void 0,categoryName:(I=t.find(z=>z.id===N))==null?void 0:I.categoryName,page:P,size:E?cO:s,trigger:!!g,type:x,protocol:k,flow_id:a}},[s,t,E,g,x,k,a,l]),T=y.useCallback(async(N,P=1,I=!1)=>{if(!r)return;const z=++w.current;m(!0);try{const H=A(N,P),{nodes:J,total:K,size:ee}=await i(H);if(z!==w.current)return;f($=>I?[...$,...J]:J),v({page:P,size:ee,total:K,hasMore:P*ee<K})}catch(H){if(z!==w.current)return;console.error("Failed to fetch category data:",H),I||f([])}finally{z===w.current&&m(!1)}},[A,r,i]),B=y.useCallback(async N=>{u(N),await T(N,1,!1)},[T]),M=y.useCallback(async()=>{p||!b.hasMore||await T(c||"ALL",b.page+1,!0)},[T,p,b,c]),F=y.useCallback(()=>{w.current+=1,m(!1),u(n||"ALL"),f([]),v({page:1,size:s,total:0,hasMore:!0})},[n,s]);return y.useEffect(()=>{var P,I;if(!r||!e){F();return}const N=n&&((P=t.find(z=>z.id===n))==null?void 0:P.id)||((I=t[0])==null?void 0:I.id)||"ALL";u(N),T(N,1,!1)},[t,e,T,n,r,F]),{categoryNodes:d,currentCategory:O,isLoadingNodes:p,isRealTriggerMode:g,isAIToolMode:C,isBuiltinMCPMode:S,navigateToCategory:B,loadMoreNodes:M,resetNavigation:F,pagination:b,activeCategoryId:c,setActiveCategoryId:u}},fZ=({onSearch:t})=>{const[e,n]=y.useState(""),[r,o]=y.useState([]),[i,s]=y.useState(!1),[a,l]=y.useState({total:0,page:1,size:20}),c=y.useRef(0),u=y.useCallback(async(f,p={})=>{if(n(f),!f.trim()){c.current+=1,s(!1),o([]),l({total:0,page:1,size:p.size||20});return}s(!0);const m=++c.current;try{const{nodes:b,total:v,page:w,size:g}=await t({...p,name:f});if(m!==c.current)return;o(b),l({total:v,page:w,size:g})}catch(b){if(m!==c.current)return;console.error("Search failed:",b),o([]),l({total:0,page:1,size:p.size||20})}finally{m===c.current&&s(!1)}},[t]),d=y.useCallback(()=>{c.current+=1,s(!1),n(""),o([]),l({total:0,page:1,size:20})},[]);return{searchText:e,searchResults:r,isSearching:i,searchMeta:a,handleSearch:u,clearSearch:d,setSearchText:n}},qN={async loadFlow(t){const n=await Gf(t),r=n;if(r&&typeof r=="object"&&r.result===!1)throw new wT(typeof r.error=="string"?r.error:void 0,typeof r.error_description=="string"?r.error_description:void 0);const{nodes:o,edges:i,workflowName:s}=bT(n);return{nodes:o,edges:i,name:s||n.name||"",opStatus:n.op_status,executionControl:n.execution_control??null,metadata:n}},async saveFlow({workflowId:t,payload:e}){if(!e)throw new Error("缺少工作流草稿数据");await oc(t,e)},buildFlowPayload:JX,async createNode({workflowId:t,nodeType:e,actionId:n,actionKey:r,actionVer:o,configSchema:i,position:s}){const l=await wy({flow_id:t,node_type:e,action_id:n,...r?{action_key:r,action_ver:o}:{},properties:i||{},position:s});return l?{nodeId:l.id,nodeData:{action_name:l.action_name,connector_name:l.connector_name,status:l.status,icon:l.icon,protocol:l.protocol,...r?{action_key:r,action_ver:o,nodeKey:r,nodeVersion:o}:{},...mI(n,l)}}:(console.error("创建失败",l),null)},stickyNodeKey:YX,HeaderComponent:PQ,PanelComponent:({availableCategories:t=VQ,initialCategory:e,onSearch:n,onFetchCategories:r,onFetchNodesByCategory:o,restrictToCategory:i})=>{const s=y.useRef(null),a=y.useRef(null),[l,c]=y.useState([]),[u,d]=y.useState({}),{nodeSelectorVisible:f,closeNodeSelector:p,handleNodeSelect:m,nodeAddInfo:b}=uc(),v=El(),w=b;UQ({nodeSelectorVisible:f,nodeAddInfo:w});const{actionRequestContextKey:g,onSearch:C,onFetchCategories:S,onFetchNodesByCategory:k,fetchNodeActions:x}=uZ({nodeSelectorVisible:f,effectiveNodeAddInfo:w,workflowId:v,onSearch:n,onFetchCategories:r,onFetchNodesByCategory:o}),{categories:D,categoriesReady:E,isLoadingCategories:O}=qQ({onFetchCategories:S,restrictToCategory:i,nodeSelectorVisible:f,nodeAddInfo:w,fallbackCategories:t,requestContextKey:g}),{searchText:A,searchResults:T,isSearching:B,handleSearch:M,clearSearch:F,setSearchText:N}=fZ({onSearch:C}),P=y.useRef(A),{categoryNodes:I,isLoadingNodes:z,isRealTriggerMode:H,navigateToCategory:J,loadMoreNodes:K,resetNavigation:ee,pagination:$,activeCategoryId:U,currentCategory:R}=dZ({categories:D,categoriesReady:E,initialCategory:e,nodeSelectorVisible:f,nodeAddInfo:w,onFetchNodesByCategory:k,flowId:v}),te=y.useMemo(()=>(w==null?void 0:w.protocol)===$e.MCP_SERVER?"选择 MCP Server 入口":(w==null?void 0:w.protocol)===$e.BUILTIN_MCP?"选择 MCP 工具":(w==null?void 0:w.protocol)===$e.AI_LANGUAGE_MODEL?"选择模型":"选择动作",[w==null?void 0:w.protocol]),se=y.useMemo(()=>(w==null?void 0:w.protocol)===$e.AI_LANGUAGE_MODEL||(w==null?void 0:w.protocol)===$e.AI_MEMORY?"按模型名称搜索":(w==null?void 0:w.protocol)===$e.MCP_SERVER?"按 MCP Server 入口名称搜索":(w==null?void 0:w.protocol)===$e.BUILTIN_MCP?"按 MCP 工具名称搜索":"按节点/动作名称搜索",[w==null?void 0:w.protocol]),be=A,j=y.useMemo(()=>w==null?void 0:w.protocol,[w==null?void 0:w.protocol]),Y=y.useMemo(()=>{const Ce=w==null?void 0:w.protocol;if(Ce===$e.AI_TOOL)return"tool";if(Ce===$e.AI_LANGUAGE_MODEL)return"model";if(Ce===$e.AI_MEMORY)return"memory"},[w==null?void 0:w.protocol]),W=(w==null?void 0:w.protocol)===$e.MCP_SERVER||(w==null?void 0:w.protocol)===$e.BUILTIN_MCP,X=(w==null?void 0:w.protocol)===$e.MCP_SERVER,re=y.useMemo(()=>A?T:I,[I,T,A]),Z=y.useCallback(()=>({app_domain_category:W?sw:U&&U!=="ALL"?U:void 0,trigger:!!H,type:Y,protocol:j,flow_id:v,...W?{page:1,size:cO}:{}}),[U,W,H,Y,j,v]),{run:de,cancel:ve}=St.useDebounceFn(Ce=>{const Oe=Ce.trim();if(!Oe){F(),c([]);return}M(Oe,Z())},{wait:300}),we=y.useCallback(async Ce=>{if(X&&Ce.matchedActions.length){d(Pe=>({...Pe,[Ce.id]:{actions:Ce.matchedActions||[],loading:!1,source:"full"}}));return}d(Pe=>{var qe,zn;return{...Pe,[Ce.id]:{actions:((qe=Pe[Ce.id])==null?void 0:qe.actions)||[],loading:!0,source:(zn=Pe[Ce.id])==null?void 0:zn.source}}});const Oe=await x(Ce,{suppressLoading:!0});d(Pe=>({...Pe,[Ce.id]:{actions:Oe,loading:!1,source:"full"}}))},[x,X]),fe=async Ce=>{if(l.includes(Ce.id)){c(qe=>qe.filter(zn=>zn!==Ce.id));return}c(qe=>[...qe,Ce.id]);const Pe=u[Ce.id];(!Pe||Pe.actions.length===0||Pe.source==="search-partial")&&await we(Ce)},le=async Ce=>{await we(Ce)},Se=(Ce,Oe)=>{const Pe={id:Oe.id??Oe.action_id,action_id:Oe.action_id??Oe.id,action_type:Oe.action_type,type:Oe.action_type,action_key:Oe.action_key,action_ver:Oe.action_ver,action_name:Oe.action_name,name:Ce.name,description:Oe.name||Oe.description,connector_name:(Ce==null?void 0:Ce.name)??Oe.connector_name,connector_id:Oe.connector_id,account_schema_id:Oe.account_schema_id,protocol:Oe.protocol,deployment_type:Ce.deployment_type,icon:Ce.icon??Oe.icon,nodeId:Oe.nodeId,config_schema:Oe.config_schema,category:Ce==null?void 0:Ce.category,nodeKey:Oe.nodeKey,nodeVersion:Oe.nodeVersion,isAction:!0};m(Pe)},ce=async Ce=>{c([]),F(),await J(Ce.id)},Fe=Ce=>{N(Ce),de(Ce)},Ve=Ce=>{if(A||!$.hasMore||z)return;const{scrollTop:Oe,scrollHeight:Pe,clientHeight:qe}=Ce.currentTarget;Pe-Oe-qe<120&&K()};y.useEffect(()=>{if(!f){const Ce=setTimeout(()=>{F(),ee(),c([]),d({})},200);return()=>clearTimeout(Ce)}return()=>ve()},[f,F,ee,ve]),y.useEffect(()=>{if(P.current=A,A){const Ce=T.filter(Oe=>Oe.defaultExpanded).map(Oe=>Oe.id);c(Ce)}},[T,A]),y.useEffect(()=>{A||c([])},[U,A]),y.useEffect(()=>{P.current&&M(P.current,Z())},[U,Z,M]),y.useEffect(()=>{d(Ce=>{const Oe={};return re.forEach(Pe=>{Pe.matchedActions&&Pe.matchedActions.length>0?Oe[Pe.id]={actions:Pe.matchedActions,loading:!1,source:"search-partial"}:Ce[Pe.id]?Oe[Pe.id]=Ce[Pe.id]:Oe[Pe.id]={actions:[],loading:!1}}),Oe})},[re]),St.useClickAway(Ce=>{if(f){const Oe=Ce.target;if(/start-node/.test(Oe.className))return;p()}},s);const je=!E||O||!A&&z,We=()=>B||re.length===0&&je||z?h.jsx("div",{className:"node-card-list","aria-busy":"true","aria-live":"polite",children:[0,1,2,3,4,5,6,7,8,9].map(Ce=>h.jsxs("div",{className:"node-card-skeleton",style:{animationDelay:`${Ce*80}ms`},children:[h.jsx("div",{className:"node-card-skeleton-icon"}),h.jsxs("div",{className:"node-card-skeleton-content",children:[h.jsx("div",{className:"node-card-skeleton-title"}),h.jsx("div",{className:"node-card-skeleton-desc"})]}),h.jsx("div",{className:"node-card-skeleton-arrow"})]},`skeleton-${Ce}`))}):re.length===0?h.jsx("div",{className:"empty-state",children:h.jsx("div",{className:"empty-text",children:"暂无符合条件的节点"})}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"node-card-list",children:re.map(Ce=>{var Oe,Pe,qe;return h.jsx(zQ,{node:Ce,expanded:l.includes(Ce.id),actions:((Oe=u[Ce.id])==null?void 0:Oe.actions)||[],loading:((Pe=u[Ce.id])==null?void 0:Pe.loading)||!1,hasPartialActions:((qe=u[Ce.id])==null?void 0:qe.source)==="search-partial",onToggle:fe,onActionSelect:Se,onLoadAllActions:le},Ce.id)})}),!A&&z&&re.length>0&&h.jsx("div",{className:"list-loading",children:h.jsx("span",{children:"正在加载更多"})}),!A&&!$.hasMore&&!z&&re.length>0&&h.jsx("div",{className:"list-footer",children:"已加载全部"})]});return f?h.jsxs("div",{className:ar("modern-node-selector",{visible:f}),ref:s,children:[h.jsx(HQ,{currentCategory:R,categoryPath:[],selectedNode:null,onClose:p,title:te,showBackButton:!1}),h.jsx("div",{className:"search-container",children:h.jsx(_.Input,{placeholder:se,prefix:h.jsx(bW,{size:16}),allowClear:!0,value:be,onChange:Ce=>Fe(Ce.target.value)})}),h.jsx(LQ,{categories:D,activeId:U||"ALL",loading:O,onChange:ce}),h.jsx("div",{className:"panel-content-box",children:h.jsx("div",{className:"panel-content",ref:a,onClick:Ce=>Ce.stopPropagation(),onScroll:Ve,children:We()})})]}):null},requiresTriggerNode:!0},hZ=t=>{const e=gX(qN.nodeTypes);return h.jsx(SQ,{strategy:qN,nodeTypes:e,...t})},kt={"configSubflow-container":"_configSubflow-container_1ocqs_1","configSubflow-selectSection":"_configSubflow-selectSection_1ocqs_4","configSubflow-selectWrapper":"_configSubflow-selectWrapper_1ocqs_19","configSubflow-select":"_configSubflow-select_1ocqs_4","configSubflow-optionContent":"_configSubflow-optionContent_1ocqs_28","configSubflow-optionName":"_configSubflow-optionName_1ocqs_34","configSubflow-optionLink":"_configSubflow-optionLink_1ocqs_41","configSubflow-paramsSection":"_configSubflow-paramsSection_1ocqs_66","configSubflow-paramsTitle":"_configSubflow-paramsTitle_1ocqs_71","configSubflow-paramsList":"_configSubflow-paramsList_1ocqs_83","configSubflow-paramItem":"_configSubflow-paramItem_1ocqs_88",hasError:"_hasError_1ocqs_101","configSubflow-paramKey":"_configSubflow-paramKey_1ocqs_105","configSubflow-paramKeyLabel":"_configSubflow-paramKeyLabel_1ocqs_110","configSubflow-paramValue":"_configSubflow-paramValue_1ocqs_130","configSubflow-hintMessage":"_configSubflow-hintMessage_1ocqs_156",warning:"_warning_1ocqs_170",info:"_info_1ocqs_175","configSubflow-errorText":"_configSubflow-errorText_1ocqs_185","configSubflow-loading":"_configSubflow-loading_1ocqs_191"},pZ=(t,e={})=>!(t!=null&&t.params)||Object.keys(t.params).length===0?[]:Object.entries(t.params).map(([n,r],o)=>({id:`${n}_${o}`,key:n,value:e[n]!==void 0?e[n]:r,exampleValue:r})),mZ=t=>!!(t!=null&&t.params&&Object.keys(t.params).length>0),GN=y.forwardRef(({value:t,onChange:e,disabled:n=!1,nodeId:r=""},o)=>{const[i,s]=y.useState(t==null?void 0:t.flowId),[a,l]=y.useState([]),[c,u]=y.useState([]),d=At(),f=Sl(),p=n||!d,{data:m=[],loading:b,run:v}=St.useRequest(Ky,{debounceWait:300}),w=m||[],g=y.useMemo(()=>w.find(F=>F.id===i),[w,i]);y.useEffect(()=>{(t==null?void 0:t.flowId)!==i&&s(t==null?void 0:t.flowId)},[t==null?void 0:t.flowId]),y.useEffect(()=>{if(g){const F=pZ(g,t==null?void 0:t.input);l(F)}else l([])},[g,t==null?void 0:t.input]);const C=y.useCallback((F,N)=>{if(!F){e==null||e(void 0);return}e==null||e({flowId:F,input:N})},[e]),S=y.useCallback(F=>{s(F),u([]);const N=w.find(I=>I.id===F),P={};N!=null&&N.params&&Object.entries(N.params).forEach(([I,z])=>{P[I]=z}),C(F,P)},[w,C]),k=y.useCallback((F,N)=>{const P={...(t==null?void 0:t.input)||{}};P[F]=N,C(i,P),u(I=>I.filter(z=>!(z.type==="param"&&z.paramKey===F)))},[i,t==null?void 0:t.input,C]),x=y.useCallback((F,N)=>{N.stopPropagation(),N.preventDefault(),f(`/link/ai-flow/edit?id=${F}`,!0)},[f]),D=y.useCallback(()=>{const F=[];return i||F.push({type:"flow",message:"请选择子流程"}),g!=null&&g.params&&Object.keys(g.params).forEach(N=>{var I;const P=(I=t==null?void 0:t.input)==null?void 0:I[N];(P==null||P==="")&&F.push({type:"param",paramKey:N,message:`参数 "${N}" 不能为空`})}),u(F),F.length===0},[i,g,t==null?void 0:t.input]),E=y.useCallback(()=>{u([])},[]);y.useImperativeHandle(o,()=>({validate:D,clearErrors:E}),[D,E]);const O=()=>{var F;return(F=c.find(N=>N.type==="flow"))==null?void 0:F.message},A=F=>{var N;return(N=c.find(P=>P.type==="param"&&P.paramKey===F))==null?void 0:N.message},T=F=>h.jsxs("div",{className:kt["configSubflow-optionContent"],children:[h.jsx("span",{className:kt["configSubflow-optionName"],children:F.name}),h.jsx(_.Tooltip,{title:"在新标签页中打开子流程",children:h.jsx("button",{type:"button",className:kt["configSubflow-optionLink"],"aria-label":`在新标签页打开子流程:${F.name}`,onClick:N=>x(F.id,N),children:h.jsx(ie.ExportOutlined,{})})})]}),B=()=>i?b?h.jsxs("div",{className:kt["configSubflow-loading"],children:[h.jsx(_.Spin,{size:"small"}),h.jsx("span",{style:{marginLeft:8},children:"加载中..."})]}):mZ(g)?h.jsx("div",{className:kt["configSubflow-paramsList"],children:a.map(F=>{const N=A(F.key);return h.jsxs("div",{className:`${kt["configSubflow-paramItem"]} workflow-config-subflow__param ${N?kt.hasError:""}`,children:[h.jsx("div",{className:kt["configSubflow-paramKey"],children:h.jsx(_.Tooltip,{title:`示例值: ${F.exampleValue}`,children:h.jsx("div",{className:kt["configSubflow-paramKeyLabel"],children:F.key})})}),h.jsxs("div",{className:kt["configSubflow-paramValue"],children:[h.jsx(In,{value:F.value,onChange:P=>k(F.key,P),placeholder:`示例: ${F.exampleValue}`,disabled:p,borrow:!0,nodeId:r,valueType:"ADAPTOR"}),N&&h.jsx("div",{className:kt["configSubflow-errorText"],children:N})]})]},F.id)})}):h.jsxs("div",{className:`${kt["configSubflow-hintMessage"]} ${kt.info}`,children:[h.jsx(ie.InfoCircleOutlined,{}),h.jsx("span",{children:"该流程无需进行参数配置"})]}):h.jsxs("div",{className:`${kt["configSubflow-hintMessage"]} ${kt.warning}`,children:[h.jsx(ie.InfoCircleOutlined,{}),h.jsx("span",{children:"请先选择子流程"})]}),M=O();return h.jsxs("div",{className:kt["configSubflow-container"],children:[h.jsxs("div",{className:kt["configSubflow-selectSection"],children:[h.jsx("div",{className:kt["configSubflow-selectWrapper"],children:h.jsx(_.Select,{className:kt["configSubflow-select"],value:i,onChange:S,placeholder:"请选择子流程",disabled:p,loading:b,showSearch:!0,filterOption:!1,onSearch:v,notFoundContent:b?h.jsx(_.Spin,{size:"small"}):"暂无数据",allowClear:!0,status:M?"error":void 0,options:w.map(F=>({value:F.id,label:T(F)}))})}),M&&h.jsx("div",{className:kt["configSubflow-errorText"],children:M})]}),h.jsxs("div",{className:kt["configSubflow-paramsSection"],children:[h.jsxs("div",{className:kt["configSubflow-paramsTitle"],children:[h.jsx(ie.SettingOutlined,{}),h.jsx("span",{children:"参数配置"})]}),B()]})]})});GN.displayName="ConfigSubflow";function gZ(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>r=>{e.forEach(o=>o(r))},e)}const cf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ls(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Ub(t){return"nodeType"in t}function _n(t){var e,n;return t?Ls(t)?t:Ub(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function qb(t){const{Document:e}=_n(t);return t instanceof e}function Ml(t){return Ls(t)?!1:t instanceof _n(t).HTMLElement}function RN(t){return t instanceof _n(t).SVGElement}function $s(t){return t?Ls(t)?t.document:Ub(t)?qb(t)?t:Ml(t)||RN(t)?t.ownerDocument:document:document:document}const Vr=cf?y.useLayoutEffect:y.useEffect;function Gb(t){const e=y.useRef(t);return Vr(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}function wZ(){const t=y.useRef(null),e=y.useCallback((r,o)=>{t.current=setInterval(r,o)},[]),n=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Il(t,e){e===void 0&&(e=[t]);const n=y.useRef(t);return Vr(()=>{n.current!==t&&(n.current=t)},e),n}function Pl(t,e){const n=y.useRef();return y.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function uf(t){const e=Gb(t),n=y.useRef(null),r=y.useCallback(o=>{o!==n.current&&(e==null||e(o,n.current)),n.current=o},[]);return[n,r]}function Rb(t){const e=y.useRef();return y.useEffect(()=>{e.current=t},[t]),e.current}let Kb={};function Ll(t,e){return y.useMemo(()=>{if(e)return e;const n=Kb[t]==null?0:Kb[t]+1;return Kb[t]=n,t+"-"+n},[t,e])}function KN(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+t*c)}return i},{...e})}}const zs=KN(1),$l=KN(-1);function bZ(t){return"clientX"in t&&"clientY"in t}function Yb(t){if(!t)return!1;const{KeyboardEvent:e}=_n(t.target);return e&&t instanceof e}function vZ(t){if(!t)return!1;const{TouchEvent:e}=_n(t.target);return e&&t instanceof e}function Xb(t){if(vZ(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return bZ(t)?{x:t.clientX,y:t.clientY}:null}const zl=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[zl.Translate.toString(t),zl.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),YN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function yZ(t){return t.matches(YN)?t:t.querySelector(YN)}const CZ={display:"none"};function kZ(t){let{id:e,value:n}=t;return y.createElement("div",{id:e,style:CZ},n)}function SZ(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return y.createElement("div",{id:e,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function EZ(){const[t,e]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const XN=y.createContext(null);function xZ(t){const e=y.useContext(XN);y.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function DZ(){const[t]=y.useState(()=>new Set),e=y.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[y.useCallback(r=>{let{type:o,event:i}=r;t.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[t]),e]}const _Z={draggable:`
145
+ `)})]}),N.detail&&h.jsxs("div",{className:"workflow-debug-panel__log-detail-block",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"详细信息"}),h.jsx("pre",{children:JSON.stringify(N.detail,null,2)})]})]})]},N.id))]})]}),h.jsxs("div",{className:"workflow-debug-panel__section",children:[h.jsxs("div",{className:"workflow-debug-panel__summary",children:[h.jsxs("span",{children:["节点数: ",e.length]}),h.jsxs("span",{children:["连线数: ",n.length]})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"结构图预览"}),h.jsx("div",{className:"workflow-debug-panel__graph",children:h.jsxs("svg",{className:"workflow-debug-panel__graph-canvas",width:"100%",height:T,viewBox:`0 0 ${A} ${T}`,preserveAspectRatio:"xMinYMin meet",children:[h.jsxs("defs",{children:[h.jsx("marker",{id:"workflow-debug-arrow",markerWidth:"10",markerHeight:"10",refX:"8",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:h.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#8c8c8c"})}),h.jsx("marker",{id:"workflow-debug-arrow-dup",markerWidth:"10",markerHeight:"10",refX:"8",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:h.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#cf1322"})})]}),E.edges.map(N=>{const P=O.get(N.source),I=O.get(N.target);if(!P||!I)return null;const z=k.has(N.id),H=P.x+nf,J=P.y+Bl/2,K=I.x,ee=I.y+Bl/2;return h.jsx("line",{x1:H,y1:J,x2:K,y2:ee,stroke:z?"#cf1322":"#8c8c8c",strokeWidth:z?2.2:1.4,markerEnd:z?"url(#workflow-debug-arrow-dup)":"url(#workflow-debug-arrow)"},N.id)}),E.nodes.map(N=>h.jsxs("g",{transform:`translate(${N.x}, ${N.y})`,children:[h.jsx("rect",{width:nf,height:Bl,rx:6,fill:"#ffffff",stroke:"#91caff",strokeWidth:1.4}),h.jsx("text",{x:nf/2,y:Bl/2+4,textAnchor:"middle",fontSize:"11",fill:"#1f1f1f",children:N.label})]},N.id))]})})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"Mermaid 图"}),h.jsx("div",{className:"workflow-debug-panel__mermaid-actions",children:h.jsx(_.Button,{size:"small",onClick:async()=>{await rf(D)?_.message.success("Mermaid 已复制"):_.message.error("复制失败")},children:"复制 Mermaid"})}),h.jsx("pre",{children:D})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"结构布局"}),h.jsx("pre",{children:B})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"连线关系"}),h.jsxs("div",{className:"workflow-debug-panel__edge-list",children:[x.length===0&&h.jsx("div",{className:"workflow-debug-panel__log-empty",children:"暂无连线"}),x.map(N=>h.jsxs("div",{className:`workflow-debug-panel__edge-line${N.isDuplicate?" workflow-debug-panel__edge-line--duplicate":""}`,children:[h.jsx("span",{children:N.text}),N.isDuplicate&&h.jsx("span",{className:"workflow-debug-panel__edge-flag",children:"重复"})]},N.id))]})]}),S&&S.length>0&&h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"重复连线"}),h.jsx("div",{className:"workflow-debug-panel__edge-list",children:S.map(N=>h.jsxs("div",{className:"workflow-debug-panel__edge-line--duplicate",children:[h.jsx("span",{children:N.relation}),h.jsx("span",{className:"workflow-debug-panel__edge-flag",children:N.edgeIds.join(", ")})]},N.key))})]}),h.jsxs(_.Space,{direction:"vertical",size:8,style:{width:"100%"},children:[h.jsx(_.Select,{value:u,placeholder:"选择节点查看详情",options:b,onChange:N=>d(N),allowClear:!0,size:"small"}),h.jsx(_.Select,{value:f,placeholder:"选择连线查看详情",options:v,onChange:N=>p(N),allowClear:!0,size:"small"})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"节点详情"}),h.jsx("pre",{children:w?JSON.stringify(Ib(w),null,2):"未选择节点"})]}),h.jsxs("div",{className:"workflow-debug-panel__detail",children:[h.jsx("div",{className:"workflow-debug-panel__detail-title",children:"连线详情"}),h.jsx("pre",{children:g?JSON.stringify({...Pb(g),sourceName:C.get(g.source),targetName:C.get(g.target),isDuplicate:k.has(g.id)},null,2):"未选择连线"})]})]})]}):null},BN=y.createContext(null),vQ=({api:t,children:e})=>h.jsx(BN.Provider,{value:t,children:e}),Lb=()=>{const t=y.useContext(BN);if(!t)throw new Error("useCanvasApi must be used within a CanvasApiProvider");return t},FN=y.createContext(null),yQ=({value:t,children:e})=>h.jsx(FN.Provider,{value:t,children:e}),MN=()=>y.useContext(FN)??{hasTriggerNode:!1,isMcpServerCanvas:!1};function CQ({nodes:t,edges:e}){const n=new Map(t.map(a=>[a.id,a])),r=new Map,o=[],i=[];for(const a of t){if(!Nl(a))continue;const l=Mb(a);if(!l){o.push(a.id),i.push({code:"SCHEMA_NOT_READY",reason:"节点端口 Schema 尚未就绪,保存时交由后端继续校验",blocking:!1,nodeId:a.id});continue}r.set(a.id,l);for(const c of l.inputs??[]){if(!c.required)continue;e.some(d=>d.target===a.id&&d.targetHandle===c.name)||i.push({code:"REQUIRED_INPUT_MISSING",reason:`必需输入端口 ${c.displayName||c.name} 尚未连接`,blocking:!0,nodeId:a.id,portName:c.name})}}for(const a of e){const l=n.get(a.source),c=n.get(a.target),u=Nl(l),d=Nl(c);if(!u&&!d||u&&!r.has(a.source)||d&&!r.has(a.target))continue;const f=e.filter(m=>m!==a&&(!a.id||m.id!==a.id)),p=xN({sourceNode:l,targetNode:c,sourceHandle:a.sourceHandle,targetHandle:a.targetHandle,edges:f});p.applicable&&!p.valid&&p.code!=="SCHEMA_NOT_READY"&&p.code!=="NOT_APPLICABLE"&&i.push({code:p.code,reason:p.reason,blocking:!0,edgeId:a.id,sourceNodeId:a.source,targetNodeId:a.target})}const s=i.filter(a=>a.blocking);return{valid:s.length===0,issues:i,blockingIssues:s,missingSchemaNodeIds:o}}const of={categoryUnavailable:"link.flow.connectable.category_unavailable",connectorUnavailable:"link.flow.connectable.connector_unavailable",actionUnavailable:"link.flow.connectable.action_unavailable",loadFailed:"link.flow.connectable.load_failed",noCompatibleNodes:"link.flow.connectable.no_compatible_nodes",noCompatibleInput:"link.flow.connectable.no_compatible_input",noCompatibleOutput:"link.flow.connectable.no_compatible_output",noBidirectionalCompatiblePort:"link.flow.connectable.no_bidirectional_compatible_port",schemaUnavailable:"link.flow.connectable.schema_unavailable",existingEdgeInvalid:"link.flow.connectable.existing_edge_invalid"},kQ=({onOpenNodeSelector:t})=>h.jsx(ne.Panel,{position:"top-center",style:{background:"transparent",boxShadow:"none",border:"0 none",width:"100%",height:"100%",display:"flex",flexFlow:"column",justifyContent:"center"},children:h.jsxs("div",{className:"setup-panel",children:[h.jsx("h4",{children:" 选择一个开始节点 "}),h.jsx("div",{className:"desc",children:"入口类型决定画布定义"}),h.jsx("div",{className:"start-node-placeholder",children:h.jsxs("div",{className:"start-node-select",children:[h.jsxs("button",{type:"button",onClick:()=>t(),className:"nodrag nopan start-node trigger","aria-label":"添加触发节点",children:[h.jsx("div",{className:"start-node-icon",children:"TR"}),h.jsxs("div",{className:"start-node-text",children:[h.jsx("h3",{className:"start-node-text-title",children:"自动化触发器"}),h.jsx("p",{className:"start-node-text-desc",children:"由触发器启动业务流程"})]}),h.jsx("div",{className:"node-footer",children:"选择触发方式 ›"})]}),h.jsxs("button",{type:"button",onClick:()=>{t({protocol:$e.MCP_SERVER})},className:"nodrag nopan start-node mcp","aria-label":"添加 MCP 节点",children:[h.jsx("div",{className:"start-node-icon",children:"MCP"}),h.jsxs("div",{className:"start-node-text",children:[h.jsx("h3",{className:"start-node-text-title",children:"MCP 网关"}),h.jsx("p",{className:"start-node-text-desc",children:"基于画布编排快速构建 MCP SERVER"})]}),h.jsx("div",{className:"node-footer",children:"开始配置 ›"})]})]})})]})}),SQ=t=>{var A,T,B;const{workflowId:e,strategy:n,onOffline:r,nodeTypes:o}=t,i=Pt(),s=Te.useIntl(),a=y.useRef(""),l=uQ(t,n.stickyNodeKey),{setUnSave:c,store:u,updateSaveStatus:d}=l,f=((T=(A=i.nodeSelector)==null?void 0:A.connectable)==null?void 0:T.enabled)===!0,p=At(),{hasTriggerNode:m,isMcpServerCanvas:b}=l,v=y.useCallback(()=>{if(!e||!n.buildFlowPayload)throw new Error("当前画布不支持生成 ACM 草稿数据");const{nodes:M,edges:F}=u.getState(),N=M.map(z=>z.id),P=F.filter(z=>N.includes(z.target)&&z.source&&z.sourceHandle&&z.targetHandle),I=Iw.getState().workflow;return n.buildFlowPayload({nodes:M,edges:P,workflowName:I.workflowName,workflowId:e,executionControl:I.executionControl,metadata:I.flowMetadata})},[u,n,e]),w=y.useCallback(async()=>{var M;if(!e)throw new Error("缺少工作流 ID");try{d(Ln.SAVING);const{nodes:F,edges:N}=u.getState();if(f){const K=CQ({nodes:F,edges:N});if(K.missingSchemaNodeIds.length>0){const ee=[...K.missingSchemaNodeIds].sort().join(",");a.current!==ee&&(a.current=ee,_.message.warning(s.formatMessage({id:of.schemaUnavailable}))),console.warn("[workflow:connectable] save with unavailable schemas",{nodeIds:K.missingSchemaNodeIds})}else a.current="";if(!K.valid){const ee=s.formatMessage({id:of.existingEdgeInvalid});_.message.error(ee),console.warn("[workflow:connectable] block save for invalid graph",{issueCount:K.blockingIssues.length,issues:K.blockingIssues.map($=>({code:$.code,nodeId:$.nodeId,portName:$.portName,edgeId:$.edgeId,sourceNodeId:$.sourceNodeId,targetNodeId:$.targetNodeId}))}),d(Ln.ERROR,new Error(ee));return}}const P=F.map(K=>K.id),I=N.filter(K=>P.includes(K.target)&&K.source&&K.sourceHandle&&K.targetHandle),z=Iw.getState().workflow,H=n.buildFlowPayload?v():void 0,J={...H,nodes:H.nodes.map(K=>K.saveType?{...K,node_type:K.saveType}:K)};return await n.saveFlow({nodes:J.nodes,edges:I,workflowName:z.workflowName,workflowId:e,executionControl:z.executionControl,metadata:z.flowMetadata,payload:J}),c(!1),d(Ln.SAVED),J&&await((M=t.onSave)==null?void 0:M.call(t,J)),J}catch(F){throw d(Ln.ERROR,F),F}},[f,v,s,t.onSave,c,u,n,d,e]);l.saveFlowRef.current=w;const g=hJ(w),{loadError:C,retry:S}=cJ({workflowId:e,strategy:n,setNodes:l.setNodes,setEdges:l.setEdges,fitView:l.reactFlow.fitView,setLoading:l.setLoading,dispatch:l.dispatch,setFlowOpStatusAction:l.setFlowOpStatusAction,refreshWorkFlowNum:l.refreshWorkFlowNum,onLoad:t.onLoad});dJ({workflowId:e,strategy:n,store:l.store,addNodes:l.addNodes,addEdges:l.addEdges,removeEdges:l.removeEdges,updateEdge:l.reactFlow.updateEdge,setNodeAddCallback:l.setNodeAddCallback,handleEdgeAddNode:l.handleEdgeAddNode,setNodeConfigVisible:l.setNodeConfigVisible,setNodeFitHumanView:l.setNodeFitHumanView,validateConnectionAgainstSnapshot:l.validateConnectionAgainstSnapshot,saveFlow:g});const k=n.HeaderComponent,x=n.PanelComponent,D=n.ConfigModalComponent,E=p&&!m&&!b,O=y.useMemo(()=>({hasTriggerNode:m,isMcpServerCanvas:b}),[m,b]);return h.jsx(vQ,{api:l.canvasApi,children:h.jsxs(yQ,{value:O,children:[h.jsxs("div",{className:l.isPreviewMode?"workflow-canvas-container workflow-canvas-container-preview":"workflow-canvas-container",style:{height:i.canvas.height?`${i.canvas.height}`:void 0},children:[l.showCanvasHeader&&h.jsx(k,{loading:l.loading||!!C,onSave:w,getFlowPayload:v,autoSaveStatus:l.autoSaveStatus,unSave:l.unSave,lastSavedTime:l.lastSavedTime,onOffline:r}),h.jsxs("div",{className:"workflow-canvas",children:[h.jsx(ZX,{loading:l.loading,error:C,onRetry:S}),h.jsx(eJ,{}),h.jsxs(ne.ReactFlow,{nodes:l.nodes,edges:l.edges,onNodesChange:l.onNodesChange,onEdgesChange:l.handleEdgesChange,onConnect:l.handleConnect,multiSelectionKeyCode:null,nodeTypes:o,edgeTypes:UX,connectionLineType:ne.ConnectionLineType.Bezier,connectionMode:ne.ConnectionMode.Loose,onNodeMouseEnter:l.onNodeMouseEnter,onNodeMouseLeave:l.onNodeMouseLeave,onEdgeMouseEnter:l.onEdgeMouseEnter,onEdgeMouseLeave:l.onEdgeMouseLeave,onNodeContextMenu:l.onNodeContextMenu,onPaneContextMenu:l.onPaneContextMenu,defaultEdgeOptions:KX,style:qX,defaultViewport:l.isPreviewMode?RX:GX,minZoom:.1,maxZoom:2,fitView:!1,snapToGrid:!0,snapGrid:[20,20],deleteKeyCode:null,nodesDraggable:!l.isInteractionDisabled,nodesConnectable:!l.isInteractionDisabled,elementsSelectable:!l.isInteractionDisabled,className:"react-flow-canvas-container",...l.restNativeProps,isValidConnection:l.isValidConnection,children:[l.showBackground&&h.jsx(ne.Background,{gap:(B=i.canvas.grid)==null?void 0:B.size,color:"#eee",variant:ne.BackgroundVariant.Lines}),l.showFastOperationButtons&&!E&&h.jsx(QX,{onOpenNodeSelector:l.handleOpenNodeSelector,onAddNoteNode:l.handleAddNoteNode,onTidyCanvas:l.handleTidy}),!l.loading&&!C&&E&&h.jsx(kQ,{onOpenNodeSelector:l.handleOpenNodeSelector}),l.showControls&&h.jsx(ne.Controls,{onInteractiveChange:M=>{l.setLocked(!M)}}),!l.loading&&l.showMiniMap&&h.jsx(fQ,{}),h.jsx(x,{}),h.jsx(oJ,{horizontal:l.helperLineHorizontal,vertical:l.helperLineVertical}),h.jsx(bQ,{visible:l.debugVisible,nodes:l.nodes,edges:l.edges,onClose:()=>l.setDebugVisible(!1)})]})]})]}),D&&h.jsx(D,{})]})})};var yr=(t=>(t.SECOND="second",t.MINUTE="minute",t.HOUR="hour",t))(yr||{});function EQ(t){return{[yr.SECOND]:"SECONDS",[yr.MINUTE]:"MINUTES",[yr.HOUR]:"HOURS"}[t]}function xQ(t){return{SECONDS:yr.SECOND,MINUTES:yr.MINUTE,HOURS:yr.HOUR}[t]}function DQ(){return{enableControl:!1,timeoutValue:30,timeoutUnit:yr.MINUTE,maxNodeExecutions:1e4,webhookUrl:""}}function _Q(t){return{enabled:t.enableControl,timeout_value:t.timeoutValue,timeout_unit:EQ(t.timeoutUnit),max_node_executions:t.maxNodeExecutions,webhook_url:t.webhookUrl||void 0}}function AQ(t){return{enableControl:t.enabled,timeoutValue:t.timeout_value,timeoutUnit:xQ(t.timeout_unit),maxNodeExecutions:t.max_node_executions,webhookUrl:t.webhook_url||""}}function OQ(t){if(!t)return!0;try{return new URL(t),!0}catch{return!1}}const{Text:$b}=_.Typography,TQ=y.forwardRef((t,e)=>{const[n,r]=y.useState(!1),[o,i]=y.useState(!1),[s]=_.Form.useForm(),a=_.Form.useWatch("enableControl",s),l=Ms(),c=Is(b=>b.workflow.executionControl),u=Lb(),d=()=>{r(!0),s.setFieldsValue(c?AQ(c):DQ())},f=()=>{r(!1)};y.useImperativeHandle(e,()=>({open:d,close:f}),[d,f]);const p=async()=>{try{const b=await s.validateFields();i(!0),l(mT(_Q(b))),await u.saveFlow(),_.message.success(G("common.save_success")),r(!1)}catch(b){_.message.error(G("common.save_failed")),console.error(b)}finally{i(!1)}},m=(b,v)=>!v||OQ(v)?Promise.resolve():Promise.reject(new Error(G("app.workflow.global_config.url_invalid")));return h.jsx(_.Drawer,{title:G("app.workflow.canvas.header.settings_label"),placement:"right",width:480,open:n,onClose:f,footer:h.jsxs(_.Space,{style:{float:"right"},children:[h.jsx(_.Button,{onClick:f,children:G("app.common.word.cancel")}),h.jsx(_.Button,{type:"primary",onClick:p,loading:o,children:G("app.common.word.save")})]}),children:h.jsxs(_.Form,{form:s,layout:"vertical",autoComplete:"off",children:[h.jsx(_.Form.Item,{label:G("app.workflow.global_config.enable_control"),name:"enableControl",valuePropName:"checked",children:h.jsx(_.Switch,{})}),a&&h.jsxs(h.Fragment,{children:[h.jsxs(_.Form.Item,{label:G("app.workflow.global_config.timeout_label"),required:!0,style:{marginBottom:8},children:[h.jsxs(_.Space.Compact,{style:{width:"100%"},children:[h.jsx(_.Form.Item,{name:"timeoutValue",noStyle:!0,rules:[{required:!0,message:G("app.workflow.global_config.timeout_required")},{type:"number",min:1,message:G("app.workflow.global_config.timeout_min")}],children:h.jsx(_.InputNumber,{style:{width:"70%"},placeholder:G("app.workflow.global_config.please_input"),min:1})}),h.jsx(_.Form.Item,{name:"timeoutUnit",noStyle:!0,rules:[{required:!0}],children:h.jsxs(_.Select,{style:{width:"30%"},children:[h.jsx(_.Select.Option,{value:yr.SECOND,children:G("app.workflow.global_config.unit_second")}),h.jsx(_.Select.Option,{value:yr.MINUTE,children:G("common.minute")}),h.jsx(_.Select.Option,{value:yr.HOUR,children:G("common.hour")})]})})]}),h.jsx($b,{type:"secondary",style:{fontSize:12},children:G("app.workflow.global_config.timeout_help")})]}),h.jsx(_.Form.Item,{label:G("app.workflow.global_config.max_node_label"),name:"maxNodeExecutions",rules:[{required:!0,message:G("app.workflow.global_config.max_node_required")},{type:"number",min:1,message:G("app.workflow.global_config.max_node_min")}],children:h.jsx(_.InputNumber,{style:{width:"100%"},placeholder:G("app.workflow.global_config.please_input"),min:1,precision:0})}),h.jsx($b,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-16,marginBottom:16},children:G("app.workflow.global_config.max_node_help")}),h.jsx(_.Form.Item,{label:G("app.workflow.global_config.webhook_label"),name:"webhookUrl",rules:[{validator:m}],children:h.jsx(_.Input,{placeholder:G("app.workflow.global_config.webhook_placeholder")})}),h.jsx($b,{type:"secondary",style:{fontSize:12,display:"block",marginTop:-16},children:G("app.workflow.global_config.webhook_help")})]})]})})}),NQ=t=>t==="category"?"分类":"标签",IN=({value:t=[],onChange:e,placeholder:n,templateId:r,optionItems:o,type:i,onCreate:s,onUpdate:a,onDelete:l,onAddRelation:c,onRemoveRelation:u})=>{const[d,f]=y.useState(!1),[p,m]=y.useState(null),[b,v]=y.useState(""),[w,g]=y.useState(!1),[C,S]=y.useState(""),[k,x]=y.useState(!1),D=NQ(i),E=I=>{var z;return(z=o.find(H=>H.name===I))==null?void 0:z.id},O=async I=>{const z=E(I);if(!z)return;const H=t.includes(I);try{x(!0),H?(await u(r,z),e==null||e(t.filter(J=>J!==I))):(await c(r,z),e==null||e([...t,I]))}finally{x(!1)}},A=(I,z)=>{z.stopPropagation();const H=E(I);H&&u(r,H).then(()=>{e==null||e(t.filter(J=>J!==I))}).catch(()=>{_.message.error("移除失败")})},T=(I,z)=>{z.stopPropagation(),m(I),v(I)},B=async()=>{const I=b.trim();if(!I||!p)return;if(I.length>8){_.message.error("名称长度不能超过8个字符");return}const z=E(p);if(z)try{x(!0),await a(z,I),e==null||e(t.map(H=>H===p?I:H)),_.message.success("修改成功")}catch{_.message.error("修改失败")}finally{x(!1),m(null),v("")}},M=()=>{m(null),v("")},F=async I=>{const z=E(I);if(z)try{x(!0),await l(z),e==null||e(t.filter(H=>H!==I)),_.message.success("删除成功")}catch{_.message.error("删除失败")}finally{x(!1)}},N=async()=>{const I=C.trim();if(I){if(I.length>8){_.message.error("名称长度不能超过8个字符");return}try{x(!0),await s(I),g(!1),S(""),_.message.success("创建成功")}catch{_.message.error("创建失败")}finally{x(!1)}}},P=()=>{g(!1),S("")};return h.jsxs("div",{className:"template-editable-select",children:[h.jsxs("div",{className:"template-editable-select-input",role:"combobox",tabIndex:0,"aria-expanded":d,"aria-haspopup":"listbox","aria-label":`选择或管理${D}`,onClick:()=>f(!d),onKeyDown:I=>{(I.key==="Enter"||I.key===" ")&&(I.preventDefault(),f(z=>!z)),I.key==="Escape"&&f(!1)},children:[h.jsx("div",{className:"template-editable-select-tags",children:t.length===0?h.jsx("span",{className:"template-editable-select-placeholder",children:n}):t.map(I=>h.jsx(_.Tag,{closable:!0,onClose:z=>A(I,z),style:{marginRight:4,marginBottom:4},children:I},I))}),h.jsx("div",{className:`template-editable-select-arrow ${d?"template-editable-select-arrow-open":""}`,children:h.jsx(ie.DownOutlined,{})})]}),d&&h.jsxs(h.Fragment,{children:[h.jsx("button",{type:"button","aria-label":`关闭${D}选择器`,className:"template-editable-select-dropdown-overlay",onClick:()=>f(!1)}),h.jsx("div",{className:"template-editable-select-dropdown-container",role:"listbox","aria-label":`${D}选项`,onClick:I=>I.stopPropagation(),children:h.jsxs("div",{className:"template-editable-select-dropdown",children:[o.map(I=>h.jsx("div",{className:"template-editable-select-dropdown-item",children:p===I.name?h.jsx("div",{className:"template-editable-select-edit-container",children:h.jsx(_.Input,{autoFocus:!0,className:"template-editable-select-edit-input",disabled:k,maxLength:8,onChange:z=>v(z.target.value),onPressEnter:B,placeholder:`输入新${D}名称(8个字符以内)`,size:"small",suffix:h.jsxs("div",{className:"template-editable-select-edit-actions",children:[h.jsx(_.Button,{className:"template-editable-select-confirm-btn",icon:h.jsx(ie.CheckOutlined,{}),loading:k,onClick:B,size:"small",type:"text"}),h.jsx(_.Button,{className:"template-editable-select-cancel-btn",disabled:k,icon:h.jsx(ie.CloseOutlined,{}),onClick:M,size:"small",type:"text"})]}),value:b})}):h.jsxs(h.Fragment,{children:[h.jsxs("button",{type:"button",role:"option","aria-selected":t.includes(I.name),className:"template-editable-select-item-content",onClick:()=>O(I.name),children:[h.jsx("div",{className:"template-editable-select-check",children:t.includes(I.name)&&h.jsx(ie.CheckOutlined,{style:{color:"#1890ff"}})}),h.jsx("span",{className:"template-editable-select-name",children:I.name})]}),h.jsxs("div",{className:"template-editable-select-actions",children:[h.jsx(_.Button,{className:"template-editable-select-action-btn",disabled:k,icon:h.jsx(ie.EditOutlined,{}),onClick:z=>T(I.name,z),size:"small",type:"text"}),h.jsx(_.Popconfirm,{cancelText:"取消",okText:"确定",onConfirm:()=>F(I.name),title:`确定删除${D}"${I.name}"吗?`,children:h.jsx(_.Button,{className:"template-editable-select-action-btn",danger:!0,disabled:k,icon:h.jsx(ie.DeleteOutlined,{}),onClick:z=>z.stopPropagation(),size:"small",type:"text"})})]})]})},I.id)),w?h.jsx("div",{className:"template-editable-select-dropdown-item",children:h.jsx("div",{className:"template-editable-select-edit-container",children:h.jsx(_.Input,{autoFocus:!0,className:"template-editable-select-edit-input",disabled:k,maxLength:8,onChange:I=>S(I.target.value),onPressEnter:N,placeholder:`输入新${D}名称(8个字符以内)`,size:"small",suffix:h.jsxs("div",{className:"template-editable-select-edit-actions",children:[h.jsx(_.Button,{className:"template-editable-select-confirm-btn",icon:h.jsx(ie.CheckOutlined,{}),loading:k,onClick:N,size:"small",type:"text"}),h.jsx(_.Button,{className:"template-editable-select-cancel-btn",disabled:k,icon:h.jsx(ie.CloseOutlined,{}),onClick:P,size:"small",type:"text"})]}),value:C})})}):h.jsxs("button",{type:"button",className:"template-editable-select-add-item",onClick:()=>g(!0),children:[h.jsx(ie.PlusOutlined,{style:{color:"#1890ff",marginRight:4}}),h.jsx("span",{children:"添加选项"})]})]})})]})]})},{TextArea:BQ}=_.Input,{Text:zb,Title:sf}=_.Typography,PN=t=>Array.isArray(t)?t.map(e=>e.name).filter(Boolean):[],FQ=({open:t,workflowId:e,workflowName:n,onOpenChange:r,onSuccess:o})=>{const[i]=_.Form.useForm(),s=Ms(),[a,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState([]),[p,m]=y.useState([]),[b,v]=y.useState([]),[w,g]=y.useState([]),C=y.useCallback(async()=>{const P=await yy();return f(P||[]),P},[]),S=y.useCallback(async()=>{const P=await Dy();return m(P||[]),P},[]),k=y.useCallback(async()=>{if(e){u(!0);try{let P;try{P=await by(e)}catch{P=await Gf(e)}const I=PN(P==null?void 0:P.categories),z=PN(P==null?void 0:P.tags);v(I),g(z),i.setFieldsValue({name:(P==null?void 0:P.name)||n||"",description:(P==null?void 0:P.description)||"",category:I,tags:z})}catch{_.message.error("获取模板设置失败"),v([]),g([]),i.setFieldsValue({name:n||"",description:"",category:[],tags:[]})}finally{u(!1)}}},[i,e,n]);y.useEffect(()=>{t&&(k(),C().catch(()=>{_.message.error("获取分类列表失败")}),S().catch(()=>{_.message.error("获取标签列表失败")}))},[C,S,k,t]);const x=async P=>{const I=await Cy({name:P});return await C(),I},D=async(P,I)=>{const z=await ky(P,{name:I});return await C(),z},E=async P=>{const I=await Sy(P);return await C(),I},O=async P=>{const I=await _y({name:P});return await S(),I},A=async(P,I)=>{const z=await Ay(P,{name:I});return await S(),z},T=async P=>{const I=await Oy(P);return await S(),I},B=async()=>{try{const P=await i.validateFields();l(!0);const I={description:P.description,ai_flow:1,id:e};P.name&&(I.name=P.name);try{await vy(e,I)}catch{await oc(e,I)}P.name&&s(Tl(P.name)),_.message.success("模板设置已保存"),r(!1),o==null||o()}catch(P){if(P!=null&&P.errorFields)return;_.message.error("保存失败,请重试")}finally{l(!1)}},M=()=>{r(!1)},F=P=>{v(P),i.setFieldValue("category",P)},N=P=>{g(P),i.setFieldValue("tags",P)};return h.jsx(_.Modal,{cancelText:"取消",confirmLoading:a,okText:"保存设置",onCancel:M,onOk:B,open:t,title:h.jsxs(_.Space,{children:[h.jsx(ie.SettingOutlined,{}),h.jsx("span",{children:"模板设置"})]}),width:600,children:c?h.jsx(_.Skeleton,{active:!0,paragraph:{rows:8}}):h.jsxs("div",{className:"workflow-template-settings-modal",children:[h.jsx("div",{className:"workflow-template-settings-hint",children:h.jsx(zb,{type:"secondary",children:"设置模板的基本信息,包括描述和分类标签,便于更好地组织和管理模板。"})}),h.jsxs(_.Form,{form:i,layout:"vertical",preserve:!1,requiredMark:!1,children:[h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.FileTextOutlined,{style:{color:"#1890ff"}}),h.jsx(sf,{level:5,children:"模板名称"})]}),h.jsx(_.Form.Item,{name:"name",rules:[{max:50,message:"最多50个字符"}],children:h.jsx(_.Input,{placeholder:"请输入模板名称",size:"large"})})]}),h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.FileTextOutlined,{style:{color:"#1890ff"}}),h.jsx(sf,{level:5,children:"模板描述"})]}),h.jsx(_.Form.Item,{name:"description",rules:[{max:500,message:"最多500个字符"}],children:h.jsx(BQ,{maxLength:500,placeholder:"请输入模板描述,描述该模板的功能和使用场景...",rows:4,showCount:!0})})]}),h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.TagsOutlined,{style:{color:"#1890ff"}}),h.jsx(sf,{level:5,children:"模板分类"}),h.jsx(zb,{className:"workflow-template-settings-subtitle",type:"secondary",children:"(可多选)"})]}),h.jsx(_.Form.Item,{name:"category",rules:[{required:!0,message:"请选择模板分类"}],children:h.jsx(IN,{onAddRelation:Ey,onChange:F,onCreate:x,onDelete:E,onRemoveRelation:xy,onUpdate:D,optionItems:d,placeholder:"请选择模板分类",templateId:e,type:"category",value:b})})]}),h.jsxs(_.Card,{styles:{body:{padding:16}},className:"workflow-template-settings-card workflow-template-settings-card-last",size:"small",children:[h.jsxs(_.Space,{className:"workflow-template-settings-section-title",children:[h.jsx(ie.TagsOutlined,{style:{color:"#52c41a"}}),h.jsx(sf,{level:5,children:"模板标签"}),h.jsx(zb,{className:"workflow-template-settings-subtitle",type:"secondary",children:"(可多选)"})]}),h.jsx(_.Form.Item,{name:"tags",children:h.jsx(IN,{onAddRelation:Ty,onChange:N,onCreate:O,onDelete:T,onRemoveRelation:Ny,onUpdate:A,optionItems:p,placeholder:"请选择模板标签",templateId:e,type:"tag",value:w})})]})]})]})})},{Title:MQ}=_.Typography,Hb="[workflow:online-validation]",IQ=({metadata:t})=>{const e=Sl(),n=t.op_status,r=t.id,i=t&&t.effective_version_no!=null&&t.effective_version_no!==""?h.jsx("span",{style:{marginLeft:4},children:h.jsx(Te.FormattedMessage,{id:"app.workflow.version.tag",values:{version:t.effective_version_no}})}):null;return{[er.UNPUBLISHED]:h.jsxs(_.Tag,{bordered:!1,color:"orange",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.not-published"}),i]}),[er.ONLINE]:h.jsxs(_.Tag,{bordered:!1,color:"green",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.already-online"}),i]}),[er.OFFLINE]:h.jsxs(_.Tag,{bordered:!1,color:"default",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.already-offline"}),i]}),[er.ONLINE_ING]:h.jsxs(_.Tag,{bordered:!1,color:"processing",children:[h.jsx(Te.FormattedMessage,{id:"app.common.word.going-online"}),i]}),[er.ON_WARN]:h.jsxs(_.Tag,{bordered:!1,color:"#faad14",onClick:()=>{e(`/link/log?warnId=${r}`)},children:[h.jsx(Te.FormattedMessage,{id:"common.warning"}),i]}),[er.OFF_WARN]:h.jsxs(_.Tag,{bordered:!1,color:"#faad14",onClick:()=>{e(`/link/log?warnId=${r}`)},children:[h.jsx(Te.FormattedMessage,{id:"common.warning"}),i]})}[n??""]??null},PQ=({loading:t=!1,onSave:e,getFlowPayload:n,autoSaveStatus:r=Ln.IDLE,lastSavedTime:o,unSave:i,onOffline:s})=>{var X,re;const a=Lb(),l=Sl(),c=Ms(),u=At(),d=na(),f=Is(Z=>Z.workflow.workflowName),p=Is(Z=>{var de;return(de=Z.workflow.flowMetadata)==null?void 0:de.op_status}),[m,b]=y.useState(!1),[v,w]=y.useState(f),[g,C]=y.useState(!1),[S,k]=y.useState(!1),x=y.useRef(null),{getNodes:D}=ne.useReactFlow(),O=Pt().toolbar,A=O==null?void 0:O.versionManagement,T=!!(A!=null&&A.onShowHistory),B=!!(A!=null&&A.onConfirmPublish),M=O==null?void 0:O.templateSettings,{isMcpServerCanvas:F}=MN(),N=p===er.ONLINE||p===er.ON_WARN,P=y.useRef(null),I=PX(),z=I.id;y.useEffect(()=>{w(f)},[f]),y.useEffect(()=>{m&&x.current&&x.current.focus()},[m]),y.useCallback(()=>{const de=D().filter(ve=>ve.data.status!==me.SUCCESS&&ve.data.status!==me.RUNNABLE);return de.length&&console.warn(`${Hb} node status check failed`,{unhealthyNodes:de.map(ve=>({id:ve.id,name:ve.data.name,type:ve.type,status:ve.data.status}))}),de.length===0},[D]),y.useCallback(()=>{var ve,we;const Z=D(),de=(fe,le,Se)=>(console.warn(`${Hb} required config check failed`,{node:{id:fe.id,name:fe.data.name,type:fe.type,status:fe.data.status},reason:le,details:Se,configSchema:fe.data.config_schema}),!1);for(const fe of Z){const{data:le,type:Se}=fe,{config_schema:ce}=le;if(Se===pe.LOOP){if(!(ce!=null&&ce.asc))return de(fe,"loop config is missing asc");const Fe=Object.keys(ce??{});if(Fe.length===0)return de(fe,"loop config schema is empty");if(Fe.some(Ve=>typeof ce[Ve]>"u"))return de(fe,"loop config contains undefined values",{undefinedKeys:Fe.filter(Ve=>typeof ce[Ve]>"u")})}else if(Se===pe.CONDITION){if(!((ve=ce==null?void 0:ce.or_list)!=null&&ve.length))return de(fe,"condition config is missing or_list");if(!ce.or_list.every(Ve=>Ve.and_list.every(je=>je.query&&je.operator)))return de(fe,"condition config contains incomplete rules")}else if(Se===pe.SWITCH){if(!((we=ce==null?void 0:ce.branches)!=null&&we.length))return de(fe,"switch config is missing branches");if(!ce.branches.every(Ve=>Ve.or_list.every(je=>je.and_list.every(We=>We.query&&We.operator))))return de(fe,"switch config contains incomplete branch rules")}else if(Se!==pe.STICKY){if(!Ui(fe.type)){const Fe=ce==null?void 0:ce.sub_params;if(!Array.isArray(Fe))return de(fe,"config_schema.sub_params is missing or invalid");const Ve=Fe.every(We=>We.required&&!We.is_child?typeof We.value<"u"&&We.value!==null?!0:(console.warn(`${Hb} required param missing`,{key:We.key,name:We.name,displayName:We.display_name,item:We}),!1):!0);if(!Ve)return de(fe,"required parameters are missing",{missingParams:Fe.filter(We=>We.required&&!We.is_child&&(typeof We.value>"u"||We.value===null)).map(We=>({key:We.key,name:We.name,label:We.label}))});const je=ce!=null&&ce.account_schema_id?!!ce.account_id:!0;if(!Ve||!je)return de(fe,"account is required but account_id is missing",{accountSchemaId:ce==null?void 0:ce.account_schema_id,accountId:ce==null?void 0:ce.account_id})}}}return!0},[D]);const H=async()=>{try{await(e==null?void 0:e()),_.message.success(G("workflow.version.save_success"))}catch{_.message.error(G("workflow.version.save_failed"))}},J=Z=>{w(Z.target.value)};St.useUnmount(()=>{c(Mw()),Tl("")});const K=y.useCallback(()=>{const Z=f,de=v.trim(),ve=de||G("app.workflow.canvas.header.workflow_name_unnamed");c(Tl(ve)),oc(z,{name:ve}).then(()=>{}).catch(()=>{c(Tl(Z))}),b(!1)},[c,v,f,z]),ee=()=>{K()},$=()=>{K()},U=()=>{var Z;t||d==="edit"&&((Z=O==null?void 0:O.flowName)==null?void 0:Z.editable)!==!1&&b(!0)},R=()=>{if(!i)switch(r){case Ln.SAVING:return h.jsxs("div",{className:"save-state saving",children:[h.jsx("div",{className:"status-icon"}),"保存中"]});case Ln.SAVED:return h.jsx(_.Tooltip,{title:`已自动保存 (${o})`,children:h.jsx("div",{style:{display:"flex",alignItems:"center"},children:h.jsxs(_.Tag,{bordered:!1,color:"green",children:["已保存"," ",h.jsx("span",{style:{fontSize:10,marginLeft:4,color:"#999"},children:o})]})})});case Ln.ERROR:return h.jsx(_.Tooltip,{title:"自动保存失败",children:h.jsx(_.Badge,{status:"error",text:h.jsx("span",{children:"保存失败"})})});default:return null}},[te,se]=_.Modal.useModal(),be=async()=>{var de;const Z=()=>{var ve,we;if((ve=O==null?void 0:O.nav)!=null&&ve.onBack){O.nav.onBack();return}if((we=O==null?void 0:O.nav)!=null&&we.backTo){ac.push(O.nav.backTo);return}ac.back()};if(!N&&((de=O==null?void 0:O.nav)!=null&&de.confirmOnBackWhenOffline)&&i){await te.confirm({title:G("user.common.operation_title"),content:O.nav.backConfirmMessage||"当前流程未保存,是否确认返回?"})&&Z();return}Z()},j=()=>{var de;const Z=[];return I!=null&&I.id&&Z.push(h.jsxs(_.Space,{size:8,children:[h.jsx(_.Tag,{bordered:!1,color:"blue",icon:h.jsx(ie.EditOutlined,{}),children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.draft_editing_tag"})}),F&&h.jsx(_.Tag,{bordered:!1,color:"blue",children:"MCP Server"}),h.jsx("span",{style:(de=O==null?void 0:O.flowStatusTag)==null?void 0:de.style,children:h.jsx(IQ,{metadata:I})}),i&&h.jsx(_.Tag,{bordered:!1,color:"orange",icon:h.jsx(ie.WarningOutlined,{}),children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.unsaved_tag"})})]},"online-area")),Z},Y=y.useMemo(()=>{const Z=[];return T&&Z.push({size:"small",key:"history",icon:h.jsx(ie.HistoryOutlined,{}),label:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.history_versions"}),onClick:()=>{var de;(de=A==null?void 0:A.onShowHistory)==null||de.call(A)}}),Z.push({size:"small",key:"help",icon:h.jsx(ie.QuestionCircleOutlined,{}),label:(O==null?void 0:O.helpDocText)||h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.help_doc_default"}),onClick:()=>{l((O==null?void 0:O.helpDocUrl)||"https://1in15q85qd.apifox.cn/8698531m0",!0)}}),Z.push({size:"small",key:"settings",icon:h.jsx(ie.SettingOutlined,{}),label:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.settings_label"}),onClick:()=>{var de;(de=P.current)==null||de.open()}}),u&&(M!=null&&M.enabled)&&z&&Z.push({size:"small",key:"templateSettings",label:M.buttonText||h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.template_settings_default"}),icon:h.jsx(ie.FileDoneOutlined,{}),onClick:()=>k(!0)}),Z},[T,u,l,M==null?void 0:M.enabled,z,O==null?void 0:O.helpDocText,O==null?void 0:O.helpDocUrl,M.buttonText,A==null?void 0:A.onShowHistory]),W=d==="edit";return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"workflow-canvas-header",children:[h.jsxs("div",{className:"workflow-header-left-area",children:[((X=O.nav)==null?void 0:X.showBack)&&h.jsx(_.Button,{type:"default",size:"small",icon:h.jsx(ie.LeftOutlined,{className:"workflow-back-icon"}),onClick:be,style:{width:29}},"back"),h.jsx("div",{className:"workflow-name-icon",children:`${f??""}`.length>2?f.substring(0,2):f}),m?h.jsx(_.Input,{size:"small",ref:x,value:v,onChange:J,onPressEnter:ee,onBlur:$,maxLength:30,className:"workflow-name-input",placeholder:"请输入工作流名称"},"name-input"):h.jsx("div",{className:"workflow-name",onClick:U,children:f?h.jsxs("div",{className:"workflow-name-container",children:[h.jsx(MQ,{level:4,className:"workflow-name-text",children:f}),W&&h.jsx("div",{className:"workflow-name-desc",children:"点击名称可编辑,最多 30 字"})]}):h.jsx(_.Skeleton.Input,{active:!0,size:"small"})},"name-display"),j()]}),h.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[u&&R(),h.jsxs(_.Space,{style:{marginLeft:16},children:[(re=O==null?void 0:O.buttons)==null?void 0:re.map(Z=>h.jsx(_.Button,{size:"small",style:Z.style,icon:Z.icon,type:Z.type??"default",disabled:t,onClick:()=>{Z.onClick&&a&&Z.onClick(a)},children:Z.label},Z.id)),h.jsx(_.Button,{size:"small",icon:h.jsx(ie.SaveOutlined,{}),loading:r===Ln.SAVING,disabled:t,onClick:H,children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.save_draft"})}),N&&s&&h.jsx(_.Button,{size:"small",icon:h.jsx(wW,{size:16}),loading:g,disabled:!z||t,onClick:async()=>{C(!0);try{await s(z)&&(_.message.success(G("workflow.version.offline_success")),await(a==null?void 0:a.refreshFlowVersionStatus()))}catch{console.error("call offline error")}finally{C(!1)}},children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.offline_flow"})}),h.jsx(_.Dropdown,{trigger:["click"],disabled:t,menu:{items:Y},overlayClassName:"small",children:h.jsx(_.Button,{icon:h.jsx(ie.DownOutlined,{}),iconPosition:"end",size:"small",children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.more"})})}),B&&h.jsx(_.Button,{size:"small",icon:h.jsx(ie.ToTopOutlined,{}),type:"primary",disabled:t,onClick:async()=>{var Z;i&&await H(),(Z=A==null?void 0:A.onConfirmPublish)==null||Z.call(A,n==null?void 0:n())},children:h.jsx(Te.FormattedMessage,{id:"app.workflow.canvas.header.publish_enable"})}),h.jsx(TQ,{ref:P})]})]})]}),se,(M==null?void 0:M.enabled)&&z&&h.jsx(FQ,{onOpenChange:k,open:S,workflowId:z,workflowName:f})]})},LQ=({categories:t,activeId:e,loading:n,onChange:r})=>{const o=Te.useIntl(),i=s=>{const a=s.currentTarget,l=a.scrollWidth-a.clientWidth;if(l<=0||Math.abs(s.deltaY)<=Math.abs(s.deltaX))return;const c=Math.min(Math.max(a.scrollLeft+s.deltaY,0),l);c!==a.scrollLeft&&(s.preventDefault(),a.scrollLeft=c)};return n?h.jsx("div",{className:"category-tabs-wrapper loading","aria-busy":"true","aria-live":"polite",children:h.jsx("div",{className:"category-tabs",children:[0,1,2,3,4].map(s=>h.jsx("div",{className:"category-tab-skeleton",style:{animationDelay:`${s*80}ms`}},`category-skeleton-${s}`))})}):h.jsxs("div",{className:"category-tabs-wrapper",children:[h.jsx("div",{className:"category-tabs",onWheel:i,children:t.map(s=>h.jsx("div",{className:ar("category-tab",{active:e===s.id,disabled:s.filterable===!1}),title:s.filterable===!1?o.formatMessage({id:of.categoryUnavailable}):void 0,onClick:()=>{if(s.filterable===!1){_.message.warning(o.formatMessage({id:of.categoryUnavailable}));return}r(s)},children:s.name},s.id))}),h.jsx("div",{className:"category-tabs-mask left"}),h.jsx("div",{className:"category-tabs-mask right"})]})},$Q=({action:t,parentNode:e,onSelect:n})=>{const r=t.status===0||t.disabled===!0,o=()=>{r||(parseInt(`${t.id}`,10)<1?n(e,{...t,type:`${t.action_key}@${t.action_ver}`,saveType:t.action_type}):n(e,t))};return h.jsxs("button",{type:"button",className:`action-item${r?" is-disabled":""}`,onClick:o,disabled:r,"aria-label":`选择动作 ${t.name}`,title:r?"后续版本支持":void 0,children:[h.jsx("div",{className:"item-icon","data-category":e.category.split("-")[0]||"action",children:t.icon?h.jsx("img",{src:t.icon,alt:t.name,style:{width:32,height:32}}):h.jsx("div",{children:t.name.charAt(0).toUpperCase()})}),h.jsxs("div",{className:"item-content",children:[h.jsx("div",{className:"item-title",children:t.name}),t.description&&h.jsx("div",{className:"item-description",children:t.description})]})]})},zQ=({node:t,expanded:e,actions:n,loading:r,hasPartialActions:o,onToggle:i,onActionSelect:s,onLoadAllActions:a})=>{const l=()=>{i(t)},c=u=>{u.stopPropagation(),a==null||a(t)};return h.jsxs("div",{className:ar("node-card",{expanded:e}),children:[h.jsxs("button",{type:"button",className:"node-card-header","aria-expanded":e,"aria-label":`${e?"收起":"展开"} ${t.name}`,onClick:l,children:[h.jsx("div",{className:"node-card-icon",children:t.icon?h.jsx("img",{src:t.icon,alt:t.name}):h.jsx("span",{children:t.name.charAt(0).toUpperCase()})}),h.jsxs("div",{className:"node-card-info",children:[h.jsx("div",{className:"node-card-title",children:t.name}),t.description&&h.jsx("div",{className:"node-card-desc",children:t.description})]}),h.jsx(ie.CaretDownOutlined,{className:ar("node-card-arrow",{expanded:e})})]}),e&&h.jsxs("div",{className:"node-card-body",children:[r?h.jsx("div",{className:"node-card-state",children:"动作加载中..."}):n.length===0?h.jsx("div",{className:"node-card-state",children:"暂无可用动作"}):h.jsx("div",{className:"node-card-actions",children:n.map(u=>h.jsx("div",{className:"node-card-action-wrapper",children:h.jsx($Q,{action:u,parentNode:t,onSelect:s})},u.id))}),o&&!r&&h.jsx("button",{type:"button",className:"node-card-more",onClick:c,children:"查看该节点全部动作"})]})]})},HQ=({currentCategory:t,categoryPath:e,selectedNode:n,onBack:r,onClose:o,title:i,subTitle:s,showBackButton:a})=>{const l=()=>n?n.name:t?t.name:"节点选择器",c=()=>n?"选择动作":e.length>0?e.slice(0,-1).map(p=>p.name).join(" / "):"",u=i||l(),d=s??c(),f=typeof a=="boolean"?a:!!(n||e.length>0);return h.jsxs("div",{className:"panel-header",children:[h.jsxs("div",{className:"header-left",children:[f&&r&&h.jsx("button",{type:"button",className:"back-button","aria-label":"返回上一级",onClick:r,children:h.jsx(ie.ArrowLeftOutlined,{})}),h.jsxs("div",{className:"title",children:[u,d&&h.jsx("div",{className:"category-path",children:d})]})]}),h.jsx("button",{type:"button",className:"close-button","aria-label":"关闭节点选择器",onClick:o,children:h.jsx(ie.CloseOutlined,{})})]})},VQ=[],jQ=new Set(Object.values(pe)),WQ=t=>{if(t)return jQ.has(t)?t:void 0},UQ=({nodeSelectorVisible:t,nodeAddInfo:e})=>{const[n,r]=y.useState(!1),o=El();return{isLoadingActions:n,fetchNodeActions:async(s,a)=>{a!=null&&a.suppressLoading||r(!0);try{const l=t&&e&&e.trigger===!0,c=(e==null?void 0:e.protocol)===$e.MCP_SERVER||(e==null?void 0:e.protocol)===$e.BUILTIN_MCP,u=e==null?void 0:e.protocol,d={linkId:s.id,flowId:o},f=WQ(s.type);f&&(d.actionType=f),c&&(d.page=(a==null?void 0:a.page)??1,d.size=(a==null?void 0:a.size)??iR),u&&(d.protocol=u),l&&(d.trigger=!0);const p=await py(d);return p&&p.items&&Array.isArray(p.items)?p.items.map(b=>{var w;const v=b.action_ver??((w=b.node_schema)==null?void 0:w.version);return b.action_key&&b.node_schema&&A0(b.action_key,v,b.node_schema),{...b,id:b.id,action_key:b.action_key,action_ver:v,nodeKey:b.action_key,nodeVersion:v,name:b.name||"未命名动作",description:b.description||"",connector_name:s.name,nodeId:s.id,nodeIcon:s.icon}}):[]}catch(l){return console.error("获取动作列表失败:",l),[]}finally{a!=null&&a.suppressLoading||r(!1)}}}},qQ=({onFetchCategories:t,restrictToCategory:e,nodeSelectorVisible:n,nodeAddInfo:r,fallbackCategories:o=[],requestContextKey:i,useConnectableDataSource:s=!1})=>{const[a,l]=y.useState(o),[c,u]=y.useState(!1),[d,f]=y.useState(null),p=y.useRef(0);return y.useEffect(()=>{if(!n){p.current+=1,u(!1),f(null);return}return(async()=>{const b=++p.current;u(!0),f(null);try{let v="action";const w=n&&r&&r.trigger,g=r==null?void 0:r.protocol;w?v="trigger":g===$e.MCP_SERVER||g===$e.BUILTIN_MCP?v=lO:g===$e.AI_TOOL?v="mcp":g===$e.AI_LANGUAGE_MODEL?v="model":g===$e.AI_MEMORY&&(v="memory");const C=await t(v);if(b!==p.current)return;const k=e?C.filter(D=>D.id===e):v===lO&&!s?C.filter(D=>D.id===sw):w?C:C.filter(D=>D.id!=="TRIGGER"),x=e?null:{id:"ALL",name:"全部",description:"全部分类",icon:void 0};l(x?[x,...k]:k),f(i)}catch(v){if(b!==p.current)return;console.error("Failed to fetch categories:",v),l(o),f(i)}finally{b===p.current&&u(!1)}})(),()=>{p.current+=1}},[o,r==null?void 0:r.protocol,r==null?void 0:r.trigger,n,t,i,e,s]),{categories:a,categoriesReady:n&&d===i,isLoadingCategories:c,setCategories:l}};async function GQ({node:t,query:e,fetchConnectablePage:n,filterPage:r=o=>o}){var s;if(!e)return[];const o=r(await n(e)),i=o.nodes.find(a=>a.id===t.id);return(i==null?void 0:i.matchedActions)??((s=o.nodes[0])==null?void 0:s.matchedActions)??[]}function RQ(t,e,n=!1){return n||e===$e.BUILTIN_MCP||e===$e.MCP_SERVER?"mcp":t}const LN=/^[1-9]\d*$/,Vb=t=>{if(typeof t=="number")return Number.isSafeInteger(t)&&t>0?t:void 0;const e=t.trim();if(LN.test(e))return e},Hr=t=>{const e=t==null?void 0:t.trim();return e||void 0},$N=t=>{if(t==null)return;if(typeof t=="number")return Number.isSafeInteger(t)&&t>0?t:void 0;const e=t.trim();if(!LN.test(e))return;const n=Number(e);return Number.isSafeInteger(n)?n:void 0},KQ=t=>{const e=t.scene.trim(),n=Hr(t.categoryName),r=Hr(t.flowId),o=$N(t.page),i=$N(t.size);return{scene:e,trigger:t.trigger,...n===void 0?{}:{categoryName:n},...Hr(t.linkId)===void 0?{}:{linkId:Hr(t.linkId)},...Hr(t.keyword)===void 0?{}:{keyword:Hr(t.keyword)},...r===void 0?{}:{flowId:r},...o===void 0?{}:{page:o},...i===void 0?{}:{size:i}}},YQ=(t,e)=>{const n=KQ(e);switch(t.mode){case"independent":return{...n,mode:"independent"};case"source":{const r=Vb(t.sourceId),o=Hr(t.sourceHandle);return r===void 0||o===void 0?null:{...n,mode:"source",sourceId:r,sourceHandle:o}}case"target":{const r=Vb(t.targetId),o=Hr(t.targetHandle);return r===void 0||o===void 0?null:{...n,mode:"target",targetId:r,targetHandle:o}}case"edge-insert":{const r=Vb(t.sourceId),o=Hr(t.sourceHandle),i=Hr(t.targetHandle);return r===void 0||o===void 0||i===void 0?null:{...n,mode:"source",sourceId:r,sourceHandle:o}}}},zN="[workflow:connectable]",Bi=t=>!!t&&typeof t=="object"&&!Array.isArray(t),jb=(t,e)=>Object.hasOwn(t,e),qt=(t,e)=>{for(const n of e)if(jb(t,n)&&t[n]!==void 0&&t[n]!==null)return t[n]},Bt=(t,e)=>{for(const n of e){const r=t[n];if(typeof r=="string"&&r.trim())return r.trim()}},Fl=t=>{if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(typeof t=="string"&&t.trim()){const e=Number(t);return Number.isFinite(e)?e:void 0}},Wb=(t,e=!1)=>typeof t=="boolean"?t:t===1||t==="1"||t==="true"?!0:t===0||t==="0"||t==="false"?!1:e,XQ=t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):[],HN=t=>{let e=t,n=0;for(;n<4&&Bi(e)&&jb(e,"data")&&!jb(e,"items");)e=e.data,n+=1;return e},JQ=t=>{const e=HN(t);return Array.isArray(e)?e.filter(Bi).map(n=>{const r=Bt(n,["name","categoryName","category_name"]),o=Bt(n,["label","name"])??"";return r||console.warn(`${zN} category has no filter name`,{name:o,availableKeys:Object.keys(n).sort()}),{id:r||o,categoryName:r,name:o,description:Bt(n,["desc","description"])??"",icon:Bt(n,["icon"]),searchAction:Wb(qt(n,["searchAction","search_action"])),filterable:!!r}}):[]},VN=t=>{if(typeof t=="number")return Number.isSafeInteger(t)&&t>0?String(t):void 0;if(typeof t!="string")return;const e=t.trim();if(e){if(/^-?\d+$/.test(e)){const n=e.startsWith("-")?e.slice(1):e;if(e.startsWith("-")||/^0+$/.test(n))return}return e}},QQ=t=>{if(typeof t=="number")return Number.isSafeInteger(t)?String(t):void 0;if(typeof t!="string")return;const e=t.trim();return/^-?\d+$/.test(e)?e:void 0},jN=(t,e)=>{for(const n of e){const r=VN(t[n]);if(r!==void 0)return{value:r,source:n}}},WN=(t,e)=>{console.warn(`${zN} ${t} has no stable identifier`,{name:Bt(e,["name","label","actionName","action_name"]),availableKeys:Object.keys(e).sort()})},ZQ=t=>{const e=Bi(t)?t:{},n=jN(e,["id","linkId","link_id","appPackage","app_package","connectorId","connector_id"]);return n||WN("connector",e),{...e,id:(n==null?void 0:n.value)??"",selectable:!!n,identifierSource:n==null?void 0:n.source,name:Bt(e,["name","displayName","display_name"])??"",description:Bt(e,["description","desc"])??null,build_type:Bt(e,["buildType","build_type"]),app_domain_category:XQ(qt(e,["appDomainCategory","app_domain_category"])),app_action_category:qt(e,["appActionCategory","app_action_category"]),deployment_type:Bt(e,["deploymentType","deployment_type"]),app_package:Bt(e,["appPackage","app_package"]),ver_name:Bt(e,["verName","ver_name"]),ver_number:Fl(qt(e,["verNumber","ver_number"])),ver_type:Bt(e,["verType","ver_type"]),icon:Bt(e,["icon"])}},eZ=t=>{const e=Bi(t)?t:{},n=jN(e,["actionKey","action_key","nodeKey","node_key"]),r=qt(e,["nodeSchema","node_schema"]),o=Bi(r)?r:null,i=o?Bt(o,["key"]):void 0,s=o?Fl(qt(o,["version"])):void 0,a=QQ(qt(e,["id","actionId","action_id"]))??(i?"0":void 0),l=n??(i?{value:i,source:"nodeSchema.key"}:void 0);l||WN("action",e);const c=Bt(e,["actionKey","action_key","nodeKey","node_key"])??i,u=VN(qt(e,["connectorId","connector_id"]));return{...e,id:(l==null?void 0:l.value)??"",backendActionId:a,action_id:a,selectable:!!l,identifierSource:l==null?void 0:l.source,action_key:c,action_ver:Fl(qt(e,["actionVer","action_ver","nodeVersion","node_version","version"]))??s,is_trigger:Fl(qt(e,["isTrigger","is_trigger"]))??(Wb(qt(e,["isTrigger","is_trigger"]))?1:0),name:Bt(e,["name","actionName","action_name"])??"",description:Bt(e,["description","desc"])??null,connector_id:u??null,status:l?1:0,protocol:Bt(e,["protocol"])??"",config_schema:qt(e,["configSchema","config_schema"])??{},sample_output:qt(e,["sampleOutput","sample_output"]),node_struct:Bt(e,["nodeStruct","node_struct"])??"",action_type:Bt(e,["actionType","action_type"])??null}},tZ=t=>{if(typeof t!="string"||!t.trim())return;const e=t.trim().toUpperCase();switch(e){case"CONNECTOR_ONL":return"CONNECTOR_ONLY";case"ACTION_MATCHED":return"ACTION_ONLY";case"BOTH":return"BOTH_MATCHED";default:return e}},af=(t,e,n)=>Fl(qt(t,e))??n,nZ=t=>{const e=HN(t),n=Bi(e)?e:{},r=qt(n,["items","records"]),o=Array.isArray(r)?r.filter(Bi).map(i=>{const s=ZQ(i.connector),a=qt(i,["matchedActions","matched_actions"]),l=Array.isArray(a)?a.map(c=>eZ(c)):[];return{connector:s,matched_actions:l,default_expanded:Wb(qt(i,["defaultExpanded","default_expanded"])),match_type:tZ(qt(i,["matchType","match_type"]))}}):[];return{items:o,total:af(n,["total"],o.length),size:af(n,["size"],o.length),page:af(n,["page","current"],1),pages:af(n,["pages"],0)}},rZ=(t,e)=>{var a;const n=t.action_type||t.node_struct||pe.ACTION,r=t.action_ver??((a=t.node_schema)==null?void 0:a.version);t.action_key&&t.node_schema&&A0(t.action_key,r,t.node_schema);const{node_schema:o,nodeSchema:i,...s}=t;return{...s,id:t.id,type:n,action_type:n,action_key:t.action_key,action_ver:r,nodeKey:t.action_key,nodeVersion:r,action_name:t.name||e.name,name:t.name||e.name,description:t.description||e.description||"",connector_name:e.name,nodeId:e.id,nodeIcon:e.icon}},oZ=(t,e)=>{if(typeof e=="boolean")return e;if(!t)return!1;const n=t.toUpperCase();return n==="ACTION_ONLY"||n==="BOTH_MATCHED"},iZ=(t,e)=>{const{matchedActions:n,defaultExpanded:r,matchType:o}=e||{};return{id:t.id||t.name,selectable:"selectable"in t&&typeof t.selectable=="boolean"?t.selectable:!0,identifierSource:"identifierSource"in t&&typeof t.identifierSource=="string"?t.identifierSource:void 0,type:t.build_type||pe.ACTION,name:t.name,description:t.description||"",category:t.app_domain_category&&t.app_domain_category[0]||"unknown",icon:t.icon||void 0,app_domain_category:t.app_domain_category||[],actionCategories:t.app_action_category||[],deployment_type:t.deployment_type,build_type:t.build_type,matchedActions:n,defaultExpanded:oZ(o,r),matchType:o,connector:t}},sZ=t=>JQ(t).map(e=>({id:e.id,categoryName:e.categoryName,filterable:e.filterable,name:e.name,description:e.description,icon:e.icon,search_action:e.searchAction,nodes:[]})),aZ=t=>{const e=nZ(t);return{nodes:e.items.map(({connector:r,matched_actions:o,default_expanded:i,match_type:s})=>{const a=o.map(l=>rZ(l,r));return iZ(r,{matchedActions:a,defaultExpanded:i,matchType:s})}),total:e.total,page:e.page,size:e.size,pages:e.pages}},lZ=async t=>{const{apiQueryConnectableNodePackageCategories:e}=await Promise.resolve().then(()=>Yy),n=await e(t);return sZ(n)},UN=async t=>{const{apiQueryConnectableNodePackagePlugins:e}=await Promise.resolve().then(()=>Yy),n=await e(t);return aZ(n)},lf=t=>(t==null?void 0:t.trim())||void 0,cZ=t=>{const e=t==null?void 0:t.edge;if(e){const s=lf(e.sourceHandle??e.sourceHandleId),a=lf(e.targetHandle??e.targetHandleId);return e.source===void 0||e.target===void 0||!s||!a?null:String(e.source)===String(e.target)&&s===He.LOOP?{mode:"source",sourceId:e.source,sourceHandle:s}:{mode:"edge-insert",sourceId:e.source,sourceHandle:s,targetId:e.target,targetHandle:a}}const n=lf(t==null?void 0:t.sourceHandle),r=lf(t==null?void 0:t.targetHandle),o=(t==null?void 0:t.sourceNodeId)!==void 0||n!==void 0,i=(t==null?void 0:t.targetNodeId)!==void 0||r!==void 0;return o&&i?null:o?t!=null&&t.sourceNodeId&&n?{mode:"source",sourceId:t.sourceNodeId,sourceHandle:n}:null:i?t!=null&&t.targetNodeId&&r?{mode:"target",targetId:t.targetNodeId,targetHandle:r}:null:{mode:"independent"}};function uZ({nodeSelectorVisible:t,effectiveNodeAddInfo:e,workflowId:n,onSearch:r,onFetchCategories:o,onFetchNodesByCategory:i}){var b;const s=Pt(),{isMcpServerCanvas:a}=MN(),l=RQ(a?"mcp":s.scene??"",e==null?void 0:e.protocol,a),c=y.useMemo(()=>cZ(e),[e]),u=y.useMemo(()=>{var v;return JSON.stringify({visible:t,protocol:e==null?void 0:e.protocol,trigger:!!(e!=null&&e.trigger),edgeId:(v=e==null?void 0:e.edge)==null?void 0:v.id,connectableContext:c,workflowId:n})},[c,(b=e==null?void 0:e.edge)==null?void 0:b.id,e==null?void 0:e.protocol,e==null?void 0:e.trigger,t,n]),d=y.useCallback((v={})=>c?YQ(c,{scene:l,trigger:!!(e!=null&&e.trigger),categoryName:v.categoryName,keyword:v.keyword??v.name,linkId:v.linkId,flowId:v.flow_id??n,page:v.page,size:v.size}):null,[c,e==null?void 0:e.trigger,l,n]),f=y.useCallback(async()=>{const v=d();return v?lZ(v):[]},[d]),p=y.useCallback(async(v={})=>{const w=d(v);return w?await UN(w):{nodes:[],total:0,page:v.page||1,size:v.size||20,pages:0}},[d]),m=y.useCallback(async(v,w)=>{const g=d({linkId:v.id});return GQ({node:v,query:g,fetchConnectablePage:UN})},[d]);return{actionRequestContextKey:u,connectableContext:c,onSearch:r||p,onFetchCategories:o||f,onFetchNodesByCategory:i||p,fetchNodeActions:m}}const dZ=({categories:t,categoriesReady:e,initialCategory:n,nodeSelectorVisible:r,nodeAddInfo:o,onFetchNodesByCategory:i,defaultPageSize:s=20,flowId:a,useConnectableDataSource:l=!1})=>{const[c,u]=y.useState(n||"ALL"),[d,f]=y.useState([]),[p,m]=y.useState(!1),[b,v]=y.useState({page:1,size:s,total:0,hasMore:!0}),w=y.useRef(0),g=r&&o&&o.trigger===!0,C=r&&o&&o.protocol===$e.AI_TOOL,S=r&&o&&o.protocol===$e.BUILTIN_MCP,k=y.useMemo(()=>o==null?void 0:o.protocol,[o==null?void 0:o.protocol]),x=y.useMemo(()=>{const N=o==null?void 0:o.protocol;if(N===$e.AI_TOOL)return"tool";if(N===$e.AI_LANGUAGE_MODEL)return"model";if(N===$e.AI_MEMORY)return"memory"},[o==null?void 0:o.protocol]),E=((o==null?void 0:o.protocol)===$e.MCP_SERVER||(o==null?void 0:o.protocol)===$e.BUILTIN_MCP)&&!l,O=y.useMemo(()=>c==="ALL"?null:t.find(N=>N.id===c)||null,[c,t]),A=y.useCallback((N,P=1)=>{var I;return{app_domain_category:l?void 0:E?sw:N&&N!=="ALL"?N:void 0,categoryName:(I=t.find(z=>z.id===N))==null?void 0:I.categoryName,page:P,size:E?cO:s,trigger:!!g,type:x,protocol:k,flow_id:a}},[s,t,E,g,x,k,a,l]),T=y.useCallback(async(N,P=1,I=!1)=>{if(!r)return;const z=++w.current;m(!0);try{const H=A(N,P),{nodes:J,total:K,size:ee}=await i(H);if(z!==w.current)return;f($=>I?[...$,...J]:J),v({page:P,size:ee,total:K,hasMore:P*ee<K})}catch(H){if(z!==w.current)return;console.error("Failed to fetch category data:",H),I||f([])}finally{z===w.current&&m(!1)}},[A,r,i]),B=y.useCallback(async N=>{u(N),await T(N,1,!1)},[T]),M=y.useCallback(async()=>{p||!b.hasMore||await T(c||"ALL",b.page+1,!0)},[T,p,b,c]),F=y.useCallback(()=>{w.current+=1,m(!1),u(n||"ALL"),f([]),v({page:1,size:s,total:0,hasMore:!0})},[n,s]);return y.useEffect(()=>{var P,I;if(!r||!e){F();return}const N=n&&((P=t.find(z=>z.id===n))==null?void 0:P.id)||((I=t[0])==null?void 0:I.id)||"ALL";u(N),T(N,1,!1)},[t,e,T,n,r,F]),{categoryNodes:d,currentCategory:O,isLoadingNodes:p,isRealTriggerMode:g,isAIToolMode:C,isBuiltinMCPMode:S,navigateToCategory:B,loadMoreNodes:M,resetNavigation:F,pagination:b,activeCategoryId:c,setActiveCategoryId:u}},fZ=({onSearch:t})=>{const[e,n]=y.useState(""),[r,o]=y.useState([]),[i,s]=y.useState(!1),[a,l]=y.useState({total:0,page:1,size:20}),c=y.useRef(0),u=y.useCallback(async(f,p={})=>{if(n(f),!f.trim()){c.current+=1,s(!1),o([]),l({total:0,page:1,size:p.size||20});return}s(!0);const m=++c.current;try{const{nodes:b,total:v,page:w,size:g}=await t({...p,name:f});if(m!==c.current)return;o(b),l({total:v,page:w,size:g})}catch(b){if(m!==c.current)return;console.error("Search failed:",b),o([]),l({total:0,page:1,size:p.size||20})}finally{m===c.current&&s(!1)}},[t]),d=y.useCallback(()=>{c.current+=1,s(!1),n(""),o([]),l({total:0,page:1,size:20})},[]);return{searchText:e,searchResults:r,isSearching:i,searchMeta:a,handleSearch:u,clearSearch:d,setSearchText:n}},qN={async loadFlow(t){const n=await Gf(t),r=n;if(r&&typeof r=="object"&&r.result===!1)throw new wT(typeof r.error=="string"?r.error:void 0,typeof r.error_description=="string"?r.error_description:void 0);const{nodes:o,edges:i,workflowName:s}=bT(n);return{nodes:o,edges:i,name:s||n.name||"",opStatus:n.op_status,executionControl:n.execution_control??null,metadata:n}},async saveFlow({workflowId:t,payload:e}){if(!e)throw new Error("缺少工作流草稿数据");await oc(t,e)},buildFlowPayload:JX,async createNode({workflowId:t,nodeType:e,actionId:n,actionKey:r,actionVer:o,configSchema:i,position:s}){const l=await wy({flow_id:t,node_type:e,action_id:n,...r?{action_key:r,action_ver:o}:{},properties:i||{},position:s});return l?{nodeId:l.id,nodeData:{action_name:l.action_name,connector_name:l.connector_name,status:l.status,icon:l.icon,protocol:l.protocol,...r?{action_key:r,action_ver:o,nodeKey:r,nodeVersion:o}:{},...mI(n,l)}}:(console.error("创建失败",l),null)},stickyNodeKey:YX,HeaderComponent:PQ,PanelComponent:({availableCategories:t=VQ,initialCategory:e,onSearch:n,onFetchCategories:r,onFetchNodesByCategory:o,restrictToCategory:i})=>{const s=y.useRef(null),a=y.useRef(null),[l,c]=y.useState([]),[u,d]=y.useState({}),{nodeSelectorVisible:f,closeNodeSelector:p,handleNodeSelect:m,nodeAddInfo:b}=uc(),v=El(),w=b;UQ({nodeSelectorVisible:f,nodeAddInfo:w});const{actionRequestContextKey:g,onSearch:C,onFetchCategories:S,onFetchNodesByCategory:k,fetchNodeActions:x}=uZ({nodeSelectorVisible:f,effectiveNodeAddInfo:w,workflowId:v,onSearch:n,onFetchCategories:r,onFetchNodesByCategory:o}),{categories:D,categoriesReady:E,isLoadingCategories:O}=qQ({onFetchCategories:S,restrictToCategory:i,nodeSelectorVisible:f,nodeAddInfo:w,fallbackCategories:t,requestContextKey:g}),{searchText:A,searchResults:T,isSearching:B,handleSearch:M,clearSearch:F,setSearchText:N}=fZ({onSearch:C}),P=y.useRef(A),{categoryNodes:I,isLoadingNodes:z,isRealTriggerMode:H,navigateToCategory:J,loadMoreNodes:K,resetNavigation:ee,pagination:$,activeCategoryId:U,currentCategory:R}=dZ({categories:D,categoriesReady:E,initialCategory:e,nodeSelectorVisible:f,nodeAddInfo:w,onFetchNodesByCategory:k,flowId:v}),te=y.useMemo(()=>(w==null?void 0:w.protocol)===$e.MCP_SERVER?"选择 MCP Server 入口":(w==null?void 0:w.protocol)===$e.BUILTIN_MCP?"选择 MCP 工具":(w==null?void 0:w.protocol)===$e.AI_LANGUAGE_MODEL?"选择模型":"选择动作",[w==null?void 0:w.protocol]),se=y.useMemo(()=>(w==null?void 0:w.protocol)===$e.AI_LANGUAGE_MODEL||(w==null?void 0:w.protocol)===$e.AI_MEMORY?"按模型名称搜索":(w==null?void 0:w.protocol)===$e.MCP_SERVER?"按 MCP Server 入口名称搜索":(w==null?void 0:w.protocol)===$e.BUILTIN_MCP?"按 MCP 工具名称搜索":"按节点/动作名称搜索",[w==null?void 0:w.protocol]),be=A,j=y.useMemo(()=>w==null?void 0:w.protocol,[w==null?void 0:w.protocol]),Y=y.useMemo(()=>{const Ce=w==null?void 0:w.protocol;if(Ce===$e.AI_TOOL)return"tool";if(Ce===$e.AI_LANGUAGE_MODEL)return"model";if(Ce===$e.AI_MEMORY)return"memory"},[w==null?void 0:w.protocol]),W=(w==null?void 0:w.protocol)===$e.MCP_SERVER||(w==null?void 0:w.protocol)===$e.BUILTIN_MCP,X=(w==null?void 0:w.protocol)===$e.MCP_SERVER,re=y.useMemo(()=>A?T:I,[I,T,A]),Z=y.useCallback(()=>({app_domain_category:W?sw:U&&U!=="ALL"?U:void 0,trigger:!!H,type:Y,protocol:j,flow_id:v,...W?{page:1,size:cO}:{}}),[U,W,H,Y,j,v]),{run:de,cancel:ve}=St.useDebounceFn(Ce=>{const Oe=Ce.trim();if(!Oe){F(),c([]);return}M(Oe,Z())},{wait:300}),we=y.useCallback(async Ce=>{if(X&&Ce.matchedActions.length){d(Pe=>({...Pe,[Ce.id]:{actions:Ce.matchedActions||[],loading:!1,source:"full"}}));return}d(Pe=>{var qe,zn;return{...Pe,[Ce.id]:{actions:((qe=Pe[Ce.id])==null?void 0:qe.actions)||[],loading:!0,source:(zn=Pe[Ce.id])==null?void 0:zn.source}}});const Oe=await x(Ce,{suppressLoading:!0});d(Pe=>({...Pe,[Ce.id]:{actions:Oe,loading:!1,source:"full"}}))},[x,X]),fe=async Ce=>{if(l.includes(Ce.id)){c(qe=>qe.filter(zn=>zn!==Ce.id));return}c(qe=>[...qe,Ce.id]);const Pe=u[Ce.id];(!Pe||Pe.actions.length===0||Pe.source==="search-partial")&&await we(Ce)},le=async Ce=>{await we(Ce)},Se=(Ce,Oe)=>{const Pe={id:Oe.id??Oe.action_id,action_id:Oe.action_id??Oe.id,action_type:Oe.action_type,type:Oe.action_type,action_key:Oe.action_key,action_ver:Oe.action_ver,action_name:Oe.action_name,name:Ce.name,description:Oe.name||Oe.description,connector_name:(Ce==null?void 0:Ce.name)??Oe.connector_name,connector_id:Oe.connector_id,account_schema_id:Oe.account_schema_id,protocol:Oe.protocol,deployment_type:Ce.deployment_type,icon:Ce.icon??Oe.icon,nodeId:Oe.nodeId,config_schema:Oe.config_schema,category:Ce==null?void 0:Ce.category,nodeKey:Oe.nodeKey,nodeVersion:Oe.nodeVersion,isAction:!0};m(Pe)},ce=async Ce=>{c([]),F(),await J(Ce.id)},Fe=Ce=>{N(Ce),de(Ce)},Ve=Ce=>{if(A||!$.hasMore||z)return;const{scrollTop:Oe,scrollHeight:Pe,clientHeight:qe}=Ce.currentTarget;Pe-Oe-qe<120&&K()};y.useEffect(()=>{if(!f){const Ce=setTimeout(()=>{F(),ee(),c([]),d({})},200);return()=>clearTimeout(Ce)}return()=>ve()},[f,F,ee,ve]),y.useEffect(()=>{if(P.current=A,A){const Ce=T.filter(Oe=>Oe.defaultExpanded).map(Oe=>Oe.id);c(Ce)}},[T,A]),y.useEffect(()=>{A||c([])},[U,A]),y.useEffect(()=>{P.current&&M(P.current,Z())},[U,Z,M]),y.useEffect(()=>{d(Ce=>{const Oe={};return re.forEach(Pe=>{Pe.matchedActions&&Pe.matchedActions.length>0?Oe[Pe.id]={actions:Pe.matchedActions,loading:!1,source:"search-partial"}:Ce[Pe.id]?Oe[Pe.id]=Ce[Pe.id]:Oe[Pe.id]={actions:[],loading:!1}}),Oe})},[re]),St.useClickAway(Ce=>{if(f){const Oe=Ce.target;if(/start-node/.test(Oe.className))return;p()}},s);const je=!E||O||!A&&z,We=()=>B||re.length===0&&je||z?h.jsx("div",{className:"node-card-list","aria-busy":"true","aria-live":"polite",children:[0,1,2,3,4,5,6,7,8,9].map(Ce=>h.jsxs("div",{className:"node-card-skeleton",style:{animationDelay:`${Ce*80}ms`},children:[h.jsx("div",{className:"node-card-skeleton-icon"}),h.jsxs("div",{className:"node-card-skeleton-content",children:[h.jsx("div",{className:"node-card-skeleton-title"}),h.jsx("div",{className:"node-card-skeleton-desc"})]}),h.jsx("div",{className:"node-card-skeleton-arrow"})]},`skeleton-${Ce}`))}):re.length===0?h.jsx("div",{className:"empty-state",children:h.jsx("div",{className:"empty-text",children:"暂无符合条件的节点"})}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"node-card-list",children:re.map(Ce=>{var Oe,Pe,qe;return h.jsx(zQ,{node:Ce,expanded:l.includes(Ce.id),actions:((Oe=u[Ce.id])==null?void 0:Oe.actions)||[],loading:((Pe=u[Ce.id])==null?void 0:Pe.loading)||!1,hasPartialActions:((qe=u[Ce.id])==null?void 0:qe.source)==="search-partial",onToggle:fe,onActionSelect:Se,onLoadAllActions:le},Ce.id)})}),!A&&z&&re.length>0&&h.jsx("div",{className:"list-loading",children:h.jsx("span",{children:"正在加载更多"})}),!A&&!$.hasMore&&!z&&re.length>0&&h.jsx("div",{className:"list-footer",children:"已加载全部"})]});return f?h.jsxs("div",{className:ar("modern-node-selector",{visible:f}),ref:s,children:[h.jsx(HQ,{currentCategory:R,categoryPath:[],selectedNode:null,onClose:p,title:te,showBackButton:!1}),h.jsx("div",{className:"search-container",children:h.jsx(_.Input,{placeholder:se,prefix:h.jsx(bW,{size:16}),allowClear:!0,value:be,onChange:Ce=>Fe(Ce.target.value)})}),h.jsx(LQ,{categories:D,activeId:U||"ALL",loading:O,onChange:ce}),h.jsx("div",{className:"panel-content-box",children:h.jsx("div",{className:"panel-content",ref:a,onClick:Ce=>Ce.stopPropagation(),onScroll:Ve,children:We()})})]}):null},requiresTriggerNode:!0},hZ=t=>{const e=gX(qN.nodeTypes);return h.jsx(SQ,{strategy:qN,nodeTypes:e,...t})},kt={"configSubflow-container":"_configSubflow-container_1ocqs_1","configSubflow-selectSection":"_configSubflow-selectSection_1ocqs_4","configSubflow-selectWrapper":"_configSubflow-selectWrapper_1ocqs_19","configSubflow-select":"_configSubflow-select_1ocqs_4","configSubflow-optionContent":"_configSubflow-optionContent_1ocqs_28","configSubflow-optionName":"_configSubflow-optionName_1ocqs_34","configSubflow-optionLink":"_configSubflow-optionLink_1ocqs_41","configSubflow-paramsSection":"_configSubflow-paramsSection_1ocqs_66","configSubflow-paramsTitle":"_configSubflow-paramsTitle_1ocqs_71","configSubflow-paramsList":"_configSubflow-paramsList_1ocqs_83","configSubflow-paramItem":"_configSubflow-paramItem_1ocqs_88",hasError:"_hasError_1ocqs_101","configSubflow-paramKey":"_configSubflow-paramKey_1ocqs_105","configSubflow-paramKeyLabel":"_configSubflow-paramKeyLabel_1ocqs_110","configSubflow-paramValue":"_configSubflow-paramValue_1ocqs_130","configSubflow-hintMessage":"_configSubflow-hintMessage_1ocqs_156",warning:"_warning_1ocqs_170",info:"_info_1ocqs_175","configSubflow-errorText":"_configSubflow-errorText_1ocqs_185","configSubflow-loading":"_configSubflow-loading_1ocqs_191"},pZ=(t,e={})=>!(t!=null&&t.params)||Object.keys(t.params).length===0?[]:Object.entries(t.params).map(([n,r],o)=>({id:`${n}_${o}`,key:n,value:e[n]!==void 0?e[n]:r,exampleValue:r})),mZ=t=>!!(t!=null&&t.params&&Object.keys(t.params).length>0),GN=y.forwardRef(({value:t,onChange:e,disabled:n=!1,nodeId:r=""},o)=>{const[i,s]=y.useState(t==null?void 0:t.flowId),[a,l]=y.useState([]),[c,u]=y.useState([]),d=At(),f=Sl(),p=n||!d,{data:m=[],loading:b,run:v}=St.useRequest(Ky,{debounceWait:300}),w=m||[],g=y.useMemo(()=>w.find(F=>F.id===i),[w,i]);y.useEffect(()=>{(t==null?void 0:t.flowId)!==i&&s(t==null?void 0:t.flowId)},[t==null?void 0:t.flowId]),y.useEffect(()=>{if(g){const F=pZ(g,t==null?void 0:t.input);l(F)}else l([])},[g,t==null?void 0:t.input]);const C=y.useCallback((F,N)=>{if(!F){e==null||e(void 0);return}e==null||e({flowId:F,input:N})},[e]),S=y.useCallback(F=>{s(F),u([]);const N=w.find(I=>I.id===F),P={};N!=null&&N.params&&Object.entries(N.params).forEach(([I,z])=>{P[I]=z}),C(F,P)},[w,C]),k=y.useCallback((F,N)=>{const P={...(t==null?void 0:t.input)||{}};P[F]=N,C(i,P),u(I=>I.filter(z=>!(z.type==="param"&&z.paramKey===F)))},[i,t==null?void 0:t.input,C]),x=y.useCallback((F,N)=>{N.stopPropagation(),N.preventDefault(),f(`/link/ai-flow/edit?id=${F}`,!0)},[f]),D=y.useCallback(()=>{const F=[];return i||F.push({type:"flow",message:"请选择子流程"}),g!=null&&g.params&&Object.keys(g.params).forEach(N=>{var I;const P=(I=t==null?void 0:t.input)==null?void 0:I[N];(P==null||P==="")&&F.push({type:"param",paramKey:N,message:`参数 "${N}" 不能为空`})}),u(F),F.length===0},[i,g,t==null?void 0:t.input]),E=y.useCallback(()=>{u([])},[]);y.useImperativeHandle(o,()=>({validate:D,clearErrors:E}),[D,E]);const O=()=>{var F;return(F=c.find(N=>N.type==="flow"))==null?void 0:F.message},A=F=>{var N;return(N=c.find(P=>P.type==="param"&&P.paramKey===F))==null?void 0:N.message},T=F=>h.jsxs("div",{className:kt["configSubflow-optionContent"],children:[h.jsx("span",{className:kt["configSubflow-optionName"],children:F.name}),h.jsx(_.Tooltip,{title:"在新标签页中打开子流程",children:h.jsx("button",{type:"button",className:kt["configSubflow-optionLink"],"aria-label":`在新标签页打开子流程:${F.name}`,onClick:N=>x(F.id,N),children:h.jsx(ie.ExportOutlined,{})})})]}),B=()=>i?b?h.jsxs("div",{className:kt["configSubflow-loading"],children:[h.jsx(_.Spin,{size:"small"}),h.jsx("span",{style:{marginLeft:8},children:"加载中..."})]}):mZ(g)?h.jsx("div",{className:kt["configSubflow-paramsList"],children:a.map(F=>{const N=A(F.key);return h.jsxs("div",{className:`${kt["configSubflow-paramItem"]} workflow-config-subflow__param ${N?kt.hasError:""}`,children:[h.jsx("div",{className:kt["configSubflow-paramKey"],children:h.jsx(_.Tooltip,{title:`示例值: ${F.exampleValue}`,children:h.jsx("div",{className:kt["configSubflow-paramKeyLabel"],children:F.key})})}),h.jsxs("div",{className:kt["configSubflow-paramValue"],children:[h.jsx(In,{value:F.value,onChange:P=>k(F.key,P),placeholder:`示例: ${F.exampleValue}`,disabled:p,borrow:!0,nodeId:r,valueType:"ADAPTOR"}),N&&h.jsx("div",{className:kt["configSubflow-errorText"],children:N})]})]},F.id)})}):h.jsxs("div",{className:`${kt["configSubflow-hintMessage"]} ${kt.info}`,children:[h.jsx(ie.InfoCircleOutlined,{}),h.jsx("span",{children:"该流程无需进行参数配置"})]}):h.jsxs("div",{className:`${kt["configSubflow-hintMessage"]} ${kt.warning}`,children:[h.jsx(ie.InfoCircleOutlined,{}),h.jsx("span",{children:"请先选择子流程"})]}),M=O();return h.jsxs("div",{className:kt["configSubflow-container"],children:[h.jsxs("div",{className:kt["configSubflow-selectSection"],children:[h.jsx("div",{className:kt["configSubflow-selectWrapper"],children:h.jsx(_.Select,{className:kt["configSubflow-select"],value:i,onChange:S,placeholder:"请选择子流程",disabled:p,loading:b,showSearch:!0,filterOption:!1,onSearch:v,notFoundContent:b?h.jsx(_.Spin,{size:"small"}):"暂无数据",allowClear:!0,status:M?"error":void 0,options:w.map(F=>({value:F.id,label:T(F)}))})}),M&&h.jsx("div",{className:kt["configSubflow-errorText"],children:M})]}),h.jsxs("div",{className:kt["configSubflow-paramsSection"],children:[h.jsxs("div",{className:kt["configSubflow-paramsTitle"],children:[h.jsx(ie.SettingOutlined,{}),h.jsx("span",{children:"参数配置"})]}),B()]})]})});GN.displayName="ConfigSubflow";function gZ(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return y.useMemo(()=>r=>{e.forEach(o=>o(r))},e)}const cf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ls(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function Ub(t){return"nodeType"in t}function _n(t){var e,n;return t?Ls(t)?t:Ub(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function qb(t){const{Document:e}=_n(t);return t instanceof e}function Ml(t){return Ls(t)?!1:t instanceof _n(t).HTMLElement}function RN(t){return t instanceof _n(t).SVGElement}function $s(t){return t?Ls(t)?t.document:Ub(t)?qb(t)?t:Ml(t)||RN(t)?t.ownerDocument:document:document:document}const Vr=cf?y.useLayoutEffect:y.useEffect;function Gb(t){const e=y.useRef(t);return Vr(()=>{e.current=t}),y.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}function wZ(){const t=y.useRef(null),e=y.useCallback((r,o)=>{t.current=setInterval(r,o)},[]),n=y.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Il(t,e){e===void 0&&(e=[t]);const n=y.useRef(t);return Vr(()=>{n.current!==t&&(n.current=t)},e),n}function Pl(t,e){const n=y.useRef();return y.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function uf(t){const e=Gb(t),n=y.useRef(null),r=y.useCallback(o=>{o!==n.current&&(e==null||e(o,n.current)),n.current=o},[]);return[n,r]}function Rb(t){const e=y.useRef();return y.useEffect(()=>{e.current=t},[t]),e.current}let Kb={};function Ll(t,e){return y.useMemo(()=>{if(e)return e;const n=Kb[t]==null?0:Kb[t]+1;return Kb[t]=n,t+"-"+n},[t,e])}function KN(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+t*c)}return i},{...e})}}const zs=KN(1),$l=KN(-1);function bZ(t){return"clientX"in t&&"clientY"in t}function Yb(t){if(!t)return!1;const{KeyboardEvent:e}=_n(t.target);return e&&t instanceof e}function vZ(t){if(!t)return!1;const{TouchEvent:e}=_n(t.target);return e&&t instanceof e}function Xb(t){if(vZ(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return bZ(t)?{x:t.clientX,y:t.clientY}:null}const zl=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[zl.Translate.toString(t),zl.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),YN="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function yZ(t){return t.matches(YN)?t:t.querySelector(YN)}const CZ={display:"none"};function kZ(t){let{id:e,value:n}=t;return y.createElement("div",{id:e,style:CZ},n)}function SZ(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return y.createElement("div",{id:e,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function EZ(){const[t,e]=y.useState("");return{announce:y.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const XN=y.createContext(null);function xZ(t){const e=y.useContext(XN);y.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(t)},[t,e])}function DZ(){const[t]=y.useState(()=>new Set),e=y.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[y.useCallback(r=>{let{type:o,event:i}=r;t.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[t]),e]}const _Z={draggable:`
146
146
  To pick up a draggable item, press the space bar.
147
147
  While dragging, use the arrow keys to move the item.
148
148
  Press space again to drop the item in its new position, or press escape to cancel.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalsee-ai/rcs",
3
- "version": "2.0.0-beta11",
3
+ "version": "2.0.0-beta12",
4
4
  "packageManager": "pnpm@10.12.1",
5
5
  "repository": {
6
6
  "type": "git"