import { FlowNodeRender as oe, useFlow as se, useFlowVariables as ie, FlowManager as le, singleNodeCreateUi as ce, FlowNodeManager as L, getFlowInstance as mt, FlowEditor as Ir } from "@easy-coder/sdk/flow";
import D, { useMemo as P, useCallback as G, createContext as kr, useContext as ue, useState as Re, useRef as Dr } from "react";
import { Icon as fe, Grid as N, Select as de, Cascader as $r, Switch as ht, Modal as Fr, Input as Se, Button as bt, List as rt, Popover as nt } from "@arco-design/web-react";
import { useEffectCallback as ee, useHold as pe, generateId as Vr } from "@easy-coder/sdk/helper";
import { useGlobalVariable as xt, GLOBAL_VARIABLE_PREFIX as vt, useEventDefine as yt, getMethodFromStore as jt, useEventFlow as wt } from "@easy-coder/sdk/store";
import { SetterVariable as M, isFxValue as V, computedFormula as A } from "@easy-coder/sdk/variable";
function Ar(e) {
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var Ne = { exports: {} }, X = {};
/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var at;
function Lr() {
  if (at)
    return X;
  at = 1;
  var e = D, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), a = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = {
    key: !0,
    ref: !0,
    __self: !0,
    __source: !0
  };
  function l(c, f, m) {
    var p, h = {}, b = null, O = null;
    m !== void 0 && (b = "" + m), f.key !== void 0 && (b = "" + f.key), f.ref !== void 0 && (O = f.ref);
    for (p in f)
      a.call(f, p) && !s.hasOwnProperty(p) && (h[p] = f[p]);
    if (c && c.defaultProps)
      for (p in f = c.defaultProps, f)
        h[p] === void 0 && (h[p] = f[p]);
    return {
      $$typeof: t,
      type: c,
      key: b,
      ref: O,
      props: h,
      _owner: i.current
    };
  }
  return X.Fragment = n, X.jsx = l, X.jsxs = l, X;
}
var Z = {};
/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
var ot;
function Wr() {
  return ot || (ot = 1, process.env.NODE_ENV !== "production" && function() {
    var e = D, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), a = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), s = Symbol.for("react.profiler"), l = Symbol.for("react.provider"), c = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), h = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), T = Symbol.iterator, j = "@@iterator";
    function C(r) {
      if (r === null || typeof r != "object")
        return null;
      var u = T && r[T] || r[j];
      return typeof u == "function" ? u : null;
    }
    var g = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
    function R(r) {
      {
        for (var u = arguments.length, d = new Array(u > 1 ? u - 1 : 0), x = 1; x < u; x++)
          d[x - 1] = arguments[x];
        Xt("error", r, d);
      }
    }
    function Xt(r, u, d) {
      {
        var x = g.ReactDebugCurrentFrame, w = x.getStackAddendum();
        w !== "" && (u += "%s", d = d.concat([w]));
        var E = d.map(function(y) {
          return String(y);
        });
        E.unshift("Warning: " + u), Function.prototype.apply.call(console[r], console, E);
      }
    }
    var Zt = !1, Qt = !1, er = !1, tr = !1, rr = !1, Ie;
    Ie = Symbol.for("react.module.reference");
    function nr(r) {
      return !!(typeof r == "string" || typeof r == "function" || r === a || r === s || rr || r === i || r === m || r === p || tr || r === O || Zt || Qt || er || typeof r == "object" && r !== null && (r.$$typeof === b || r.$$typeof === h || r.$$typeof === l || r.$$typeof === c || r.$$typeof === f || // This needs to include all possible module reference object
      // types supported by any Flight configuration anywhere since
      // we don't know which Flight build this will end up being used
      // with.
      r.$$typeof === Ie || r.getModuleId !== void 0));
    }
    function ar(r, u, d) {
      var x = r.displayName;
      if (x)
        return x;
      var w = u.displayName || u.name || "";
      return w !== "" ? d + "(" + w + ")" : d;
    }
    function ke(r) {
      return r.displayName || "Context";
    }
    function F(r) {
      if (r == null)
        return null;
      if (typeof r.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
        return r.displayName || r.name || null;
      if (typeof r == "string")
        return r;
      switch (r) {
        case a:
          return "Fragment";
        case n:
          return "Portal";
        case s:
          return "Profiler";
        case i:
          return "StrictMode";
        case m:
          return "Suspense";
        case p:
          return "SuspenseList";
      }
      if (typeof r == "object")
        switch (r.$$typeof) {
          case c:
            var u = r;
            return ke(u) + ".Consumer";
          case l:
            var d = r;
            return ke(d._context) + ".Provider";
          case f:
            return ar(r, r.render, "ForwardRef");
          case h:
            var x = r.displayName || null;
            return x !== null ? x : F(r.type) || "Memo";
          case b: {
            var w = r, E = w._payload, y = w._init;
            try {
              return F(y(E));
            } catch {
              return null;
            }
          }
        }
      return null;
    }
    var W = Object.assign, K = 0, De, $e, Fe, Ve, Ae, Le, We;
    function ze() {
    }
    ze.__reactDisabledLog = !0;
    function or() {
      {
        if (K === 0) {
          De = console.log, $e = console.info, Fe = console.warn, Ve = console.error, Ae = console.group, Le = console.groupCollapsed, We = console.groupEnd;
          var r = {
            configurable: !0,
            enumerable: !0,
            value: ze,
            writable: !0
          };
          Object.defineProperties(console, {
            info: r,
            log: r,
            warn: r,
            error: r,
            group: r,
            groupCollapsed: r,
            groupEnd: r
          });
        }
        K++;
      }
    }
    function sr() {
      {
        if (K--, K === 0) {
          var r = {
            configurable: !0,
            enumerable: !0,
            writable: !0
          };
          Object.defineProperties(console, {
            log: W({}, r, {
              value: De
            }),
            info: W({}, r, {
              value: $e
            }),
            warn: W({}, r, {
              value: Fe
            }),
            error: W({}, r, {
              value: Ve
            }),
            group: W({}, r, {
              value: Ae
            }),
            groupCollapsed: W({}, r, {
              value: Le
            }),
            groupEnd: W({}, r, {
              value: We
            })
          });
        }
        K < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
      }
    }
    var be = g.ReactCurrentDispatcher, xe;
    function te(r, u, d) {
      {
        if (xe === void 0)
          try {
            throw Error();
          } catch (w) {
            var x = w.stack.trim().match(/\n( *(at )?)/);
            xe = x && x[1] || "";
          }
        return `
` + xe + r;
      }
    }
    var ve = !1, re;
    {
      var ir = typeof WeakMap == "function" ? WeakMap : Map;
      re = new ir();
    }
    function Me(r, u) {
      if (!r || ve)
        return "";
      {
        var d = re.get(r);
        if (d !== void 0)
          return d;
      }
      var x;
      ve = !0;
      var w = Error.prepareStackTrace;
      Error.prepareStackTrace = void 0;
      var E;
      E = be.current, be.current = null, or();
      try {
        if (u) {
          var y = function() {
            throw Error();
          };
          if (Object.defineProperty(y.prototype, "props", {
            set: function() {
              throw Error();
            }
          }), typeof Reflect == "object" && Reflect.construct) {
            try {
              Reflect.construct(y, []);
            } catch (k) {
              x = k;
            }
            Reflect.construct(r, [], y);
          } else {
            try {
              y.call();
            } catch (k) {
              x = k;
            }
            r.call(y.prototype);
          }
        } else {
          try {
            throw Error();
          } catch (k) {
            x = k;
          }
          r();
        }
      } catch (k) {
        if (k && x && typeof k.stack == "string") {
          for (var v = k.stack.split(`
`), I = x.stack.split(`
`), S = v.length - 1, _ = I.length - 1; S >= 1 && _ >= 0 && v[S] !== I[_]; )
            _--;
          for (; S >= 1 && _ >= 0; S--, _--)
            if (v[S] !== I[_]) {
              if (S !== 1 || _ !== 1)
                do
                  if (S--, _--, _ < 0 || v[S] !== I[_]) {
                    var $ = `
` + v[S].replace(" at new ", " at ");
                    return r.displayName && $.includes("<anonymous>") && ($ = $.replace("<anonymous>", r.displayName)), typeof r == "function" && re.set(r, $), $;
                  }
                while (S >= 1 && _ >= 0);
              break;
            }
        }
      } finally {
        ve = !1, be.current = E, sr(), Error.prepareStackTrace = w;
      }
      var Y = r ? r.displayName || r.name : "", z = Y ? te(Y) : "";
      return typeof r == "function" && re.set(r, z), z;
    }
    function lr(r, u, d) {
      return Me(r, !1);
    }
    function cr(r) {
      var u = r.prototype;
      return !!(u && u.isReactComponent);
    }
    function ne(r, u, d) {
      if (r == null)
        return "";
      if (typeof r == "function")
        return Me(r, cr(r));
      if (typeof r == "string")
        return te(r);
      switch (r) {
        case m:
          return te("Suspense");
        case p:
          return te("SuspenseList");
      }
      if (typeof r == "object")
        switch (r.$$typeof) {
          case f:
            return lr(r.render);
          case h:
            return ne(r.type, u, d);
          case b: {
            var x = r, w = x._payload, E = x._init;
            try {
              return ne(E(w), u, d);
            } catch {
            }
          }
        }
      return "";
    }
    var q = Object.prototype.hasOwnProperty, Be = {}, Ye = g.ReactDebugCurrentFrame;
    function ae(r) {
      if (r) {
        var u = r._owner, d = ne(r.type, r._source, u ? u.type : null);
        Ye.setExtraStackFrame(d);
      } else
        Ye.setExtraStackFrame(null);
    }
    function ur(r, u, d, x, w) {
      {
        var E = Function.call.bind(q);
        for (var y in r)
          if (E(r, y)) {
            var v = void 0;
            try {
              if (typeof r[y] != "function") {
                var I = Error((x || "React class") + ": " + d + " type `" + y + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[y] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
                throw I.name = "Invariant Violation", I;
              }
              v = r[y](u, y, x, d, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
            } catch (S) {
              v = S;
            }
            v && !(v instanceof Error) && (ae(w), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", x || "React class", d, y, typeof v), ae(null)), v instanceof Error && !(v.message in Be) && (Be[v.message] = !0, ae(w), R("Failed %s type: %s", d, v.message), ae(null));
          }
      }
    }
    var fr = Array.isArray;
    function ye(r) {
      return fr(r);
    }
    function dr(r) {
      {
        var u = typeof Symbol == "function" && Symbol.toStringTag, d = u && r[Symbol.toStringTag] || r.constructor.name || "Object";
        return d;
      }
    }
    function pr(r) {
      try {
        return Ge(r), !1;
      } catch {
        return !0;
      }
    }
    function Ge(r) {
      return "" + r;
    }
    function Ue(r) {
      if (pr(r))
        return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", dr(r)), Ge(r);
    }
    var J = g.ReactCurrentOwner, mr = {
      key: !0,
      ref: !0,
      __self: !0,
      __source: !0
    }, He, Ke, je;
    je = {};
    function hr(r) {
      if (q.call(r, "ref")) {
        var u = Object.getOwnPropertyDescriptor(r, "ref").get;
        if (u && u.isReactWarning)
          return !1;
      }
      return r.ref !== void 0;
    }
    function br(r) {
      if (q.call(r, "key")) {
        var u = Object.getOwnPropertyDescriptor(r, "key").get;
        if (u && u.isReactWarning)
          return !1;
      }
      return r.key !== void 0;
    }
    function xr(r, u) {
      if (typeof r.ref == "string" && J.current && u && J.current.stateNode !== u) {
        var d = F(J.current.type);
        je[d] || (R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', F(J.current.type), r.ref), je[d] = !0);
      }
    }
    function vr(r, u) {
      {
        var d = function() {
          He || (He = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
        };
        d.isReactWarning = !0, Object.defineProperty(r, "key", {
          get: d,
          configurable: !0
        });
      }
    }
    function yr(r, u) {
      {
        var d = function() {
          Ke || (Ke = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", u));
        };
        d.isReactWarning = !0, Object.defineProperty(r, "ref", {
          get: d,
          configurable: !0
        });
      }
    }
    var jr = function(r, u, d, x, w, E, y) {
      var v = {
        // This tag allows us to uniquely identify this as a React Element
        $$typeof: t,
        // Built-in properties that belong on the element
        type: r,
        key: u,
        ref: d,
        props: y,
        // Record the component responsible for creating this element.
        _owner: E
      };
      return v._store = {}, Object.defineProperty(v._store, "validated", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: !1
      }), Object.defineProperty(v, "_self", {
        configurable: !1,
        enumerable: !1,
        writable: !1,
        value: x
      }), Object.defineProperty(v, "_source", {
        configurable: !1,
        enumerable: !1,
        writable: !1,
        value: w
      }), Object.freeze && (Object.freeze(v.props), Object.freeze(v)), v;
    };
    function wr(r, u, d, x, w) {
      {
        var E, y = {}, v = null, I = null;
        d !== void 0 && (Ue(d), v = "" + d), br(u) && (Ue(u.key), v = "" + u.key), hr(u) && (I = u.ref, xr(u, w));
        for (E in u)
          q.call(u, E) && !mr.hasOwnProperty(E) && (y[E] = u[E]);
        if (r && r.defaultProps) {
          var S = r.defaultProps;
          for (E in S)
            y[E] === void 0 && (y[E] = S[E]);
        }
        if (v || I) {
          var _ = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
          v && vr(y, _), I && yr(y, _);
        }
        return jr(r, v, I, w, x, J.current, y);
      }
    }
    var we = g.ReactCurrentOwner, qe = g.ReactDebugCurrentFrame;
    function B(r) {
      if (r) {
        var u = r._owner, d = ne(r.type, r._source, u ? u.type : null);
        qe.setExtraStackFrame(d);
      } else
        qe.setExtraStackFrame(null);
    }
    var ge;
    ge = !1;
    function Ee(r) {
      return typeof r == "object" && r !== null && r.$$typeof === t;
    }
    function Je() {
      {
        if (we.current) {
          var r = F(we.current.type);
          if (r)
            return `

Check the render method of \`` + r + "`.";
        }
        return "";
      }
    }
    function gr(r) {
      {
        if (r !== void 0) {
          var u = r.fileName.replace(/^.*[\\\/]/, ""), d = r.lineNumber;
          return `

Check your code at ` + u + ":" + d + ".";
        }
        return "";
      }
    }
    var Xe = {};
    function Er(r) {
      {
        var u = Je();
        if (!u) {
          var d = typeof r == "string" ? r : r.displayName || r.name;
          d && (u = `

Check the top-level render call using <` + d + ">.");
        }
        return u;
      }
    }
    function Ze(r, u) {
      {
        if (!r._store || r._store.validated || r.key != null)
          return;
        r._store.validated = !0;
        var d = Er(u);
        if (Xe[d])
          return;
        Xe[d] = !0;
        var x = "";
        r && r._owner && r._owner !== we.current && (x = " It was passed a child from " + F(r._owner.type) + "."), B(r), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', d, x), B(null);
      }
    }
    function Qe(r, u) {
      {
        if (typeof r != "object")
          return;
        if (ye(r))
          for (var d = 0; d < r.length; d++) {
            var x = r[d];
            Ee(x) && Ze(x, u);
          }
        else if (Ee(r))
          r._store && (r._store.validated = !0);
        else if (r) {
          var w = C(r);
          if (typeof w == "function" && w !== r.entries)
            for (var E = w.call(r), y; !(y = E.next()).done; )
              Ee(y.value) && Ze(y.value, u);
        }
      }
    }
    function Or(r) {
      {
        var u = r.type;
        if (u == null || typeof u == "string")
          return;
        var d;
        if (typeof u == "function")
          d = u.propTypes;
        else if (typeof u == "object" && (u.$$typeof === f || // Note: Memo only checks outer props here.
        // Inner props are checked in the reconciler.
        u.$$typeof === h))
          d = u.propTypes;
        else
          return;
        if (d) {
          var x = F(u);
          ur(d, r.props, "prop", x, r);
        } else if (u.PropTypes !== void 0 && !ge) {
          ge = !0;
          var w = F(u);
          R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", w || "Unknown");
        }
        typeof u.getDefaultProps == "function" && !u.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
      }
    }
    function Rr(r) {
      {
        for (var u = Object.keys(r.props), d = 0; d < u.length; d++) {
          var x = u[d];
          if (x !== "children" && x !== "key") {
            B(r), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", x), B(null);
            break;
          }
        }
        r.ref !== null && (B(r), R("Invalid attribute `ref` supplied to `React.Fragment`."), B(null));
      }
    }
    var et = {};
    function tt(r, u, d, x, w, E) {
      {
        var y = nr(r);
        if (!y) {
          var v = "";
          (r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (v += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
          var I = gr(w);
          I ? v += I : v += Je();
          var S;
          r === null ? S = "null" : ye(r) ? S = "array" : r !== void 0 && r.$$typeof === t ? (S = "<" + (F(r.type) || "Unknown") + " />", v = " Did you accidentally export a JSX literal instead of a component?") : S = typeof r, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", S, v);
        }
        var _ = wr(r, u, d, w, E);
        if (_ == null)
          return _;
        if (y) {
          var $ = u.children;
          if ($ !== void 0)
            if (x)
              if (ye($)) {
                for (var Y = 0; Y < $.length; Y++)
                  Qe($[Y], r);
                Object.freeze && Object.freeze($);
              } else
                R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
            else
              Qe($, r);
        }
        if (q.call(u, "key")) {
          var z = F(r), k = Object.keys(u).filter(function(Tr) {
            return Tr !== "key";
          }), Oe = k.length > 0 ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}";
          if (!et[z + Oe]) {
            var Pr = k.length > 0 ? "{" + k.join(": ..., ") + ": ...}" : "{}";
            R(`A props object containing a "key" prop is being spread into JSX:
  let props = %s;
  <%s {...props} />
React keys must be passed directly to JSX without using spread:
  let props = %s;
  <%s key={someKey} {...props} />`, Oe, z, Pr, z), et[z + Oe] = !0;
          }
        }
        return r === a ? Rr(_) : Or(_), _;
      }
    }
    function Sr(r, u, d) {
      return tt(r, u, d, !0);
    }
    function Nr(r, u, d) {
      return tt(r, u, d, !1);
    }
    var _r = Nr, Cr = Sr;
    Z.Fragment = a, Z.jsx = _r, Z.jsxs = Cr;
  }()), Z;
}
process.env.NODE_ENV === "production" ? Ne.exports = Lr() : Ne.exports = Wr();
var o = Ne.exports;
function gt(e) {
  return /* @__PURE__ */ o.jsx(fe, {
    ...e,
    viewBox: "0 0 1024 1024",
    children: /* @__PURE__ */ o.jsx("path", {
      d: "M893.456 553.048a60.648 60.648 0 0 1 77.912 15.872 75.048 75.048 0 0 1-4.248 84.304c-22.776 27.016-52.408 29.64-84.304 25.016a138.944 138.944 0 0 1-21.256-5.264c-20.016-10.624-32.264-1.488-44.024 13.264l-3.312 4.104c-23.656 29.28-24.184 29.928-12.576 69.56a1348.28 1348.28 0 0 0 28.024 93.8c14.88 44.024 40.264 57.656 85.784 47.024a196.32 196.32 0 0 1 12.864-3.576 250.64 250.64 0 0 0 12.152-3.304c1.504 25.008-4.248 33.52-27.016 42.904-38.64 14.888-77.792 27.016-120.68 22.888a88.8 88.8 0 0 1-80.048-61.16c-4.952-14.088-8.896-28.76-13.064-44.208-2.56-9.504-5.2-19.312-8.2-29.456-3.104 3.832-5.336 7.136-7.344 10.104a192.32 192.32 0 0 1-2.16 3.152 1738.376 1738.376 0 0 0-19.376 27.84c-13.32 19.416-26.8 39.056-42.16 57.96a104.688 104.688 0 0 1-37.512 29.64 64.552 64.552 0 0 1-80.544-16.008 70.544 70.544 0 0 1 6.872-85.672c22.768-27.016 53.52-28.136 85.808-22.896a152.08 152.08 0 0 1 22.752 5.384 25 25 0 0 0 36.024-10.624 211.216 211.216 0 0 0 21.264-28.152c3.952-5.92 5.472-13.12 4.24-20.136-10.624-37.52-21.248-75.032-32.256-112.56-14.88-50.016-41.4-62.528-91.176-50.016-6.64 0.552-13.2 1.832-19.56 3.808-2.376-27.744 12.712-39.76 36.192-46.584 37.52-12.512 75.04-22.768 114.936-18.512a87.52 87.52 0 0 1 75.04 57.656 480.76 480.76 0 0 1 21.264 73.664c3.152-3.984 5.4-7.28 7.44-10.248 0.704-1.04 1.384-2.04 2.072-3.016a928.288 928.288 0 0 1 58.896-83.168 128.56 128.56 0 0 1 41.28-33.384zM480 56c231.168 0 419.912 181.552 431.44 409.848-19.6 1.848-40.088 8.088-61.608 19.824-17.376 9.76-33.264 21.992-48.768 35.584h-1.536a167.368 167.368 0 0 0-104.128-49.32c-50.664-5.28-98.656 5.816-146.56 21.68-30.984 9.28-53.64 24.888-68.984 44.904-12.104 15.8-20.352 34.56-22.152 55.392-1.52 17.736 1.416 37.312 12.256 58.232l29.176 56.28 14.096 15.136v31.216c-23.48 7.96-44.88 22.024-63.744 43.824a141.6 141.6 0 0 0-2.704 3.104l-0.016-280.48-132.216 0.032c0.936 21.264 2.728 41.96 5.32 61.96l2.056 14.848 2.576 15.84c17.904 102.336 56.56 182.472 102.032 218.64a150.56 150.56 0 0 0-15.032 54.552 144.856 144.856 0 0 0 0.36 27.56C205.64 881.984 48 703.416 48 488 48 249.4 241.4 56 480 56zM248.024 521.256h-132.08l0.4 4.176c13.464 132.2 97.392 243.608 213.632 296.008-22.976-35.6-41.92-79.36-55.832-128.8l-3.144-11.52-3.656-14.72-3.36-15.016-1.88-9.192a773.08 773.08 0 0 1-14.08-120.936zM329.976 154.56l-2.968 1.328-3.656 1.712c-114.04 54.184-195.544 165.648-207.408 297.168h132.08l0.392-8.664a778.648 778.648 0 0 1 12.768-107.8l2.8-13.688 3.36-15.024 3.656-14.728 1.664-6.224c14.064-51.584 33.52-97.224 57.312-134.08z m116.8-24.032c-52.664 25.56-99.36 109.968-120.68 222.84l-1.6 8.736-2.56 15.816a728.056 728.056 0 0 0-7.384 76.848h132.216z m183.248 24.056l2.656 4.192 2.816 4.56c20.456 33.824 37.472 74.32 50.24 119.584l3.264 11.968 3.656 14.704 3.36 15.024 1.704 8.192c7.696 38.416 12.576 79.384 14.256 121.96h132.08l-0.4-4.184c-13.44-132.216-97.368-243.624-213.632-296z m-116.768-24.056l-0.024 324.24H645.44a734.28 734.28 0 0 0-5.544-63.736l-1.84-13.12-2.56-15.808c-20.52-117.216-68.24-205.328-122.248-231.576z"
    })
  });
}
function zr({
  id: e,
  node: t
}) {
  const n = P(() => Rt(t.params), [t.params]);
  return /* @__PURE__ */ o.jsx(oe, {
    showActions: ["delete", "open"],
    node: t,
    isComplete: n,
    defaultLabel: t.label,
    icon: /* @__PURE__ */ o.jsx(gt, {
      className: "node-icon"
    }),
    MainRender: Mr
  });
}
function Mr({
  node: e
}) {
  var c, f, m;
  const {
    flowManager: t,
    readonly: n
  } = se(), a = xt(), i = ie(), s = ee((p, h) => {
    const b = {
      ...e.params,
      [p]: h
    };
    t.updateNode(e.name, {
      label: e.label,
      params: b,
      result: e.result
    });
  }, [e]), l = P(() => {
    const p = [];
    for (const h in a)
      p.push({
        value: h,
        label: a[h].define.label
      });
    return p;
  }, [a]);
  return /* @__PURE__ */ o.jsxs(N.Row, {
    className: "panel-row",
    gutter: 8,
    children: [/* @__PURE__ */ o.jsx(N.Col, {
      flex: "120px",
      children: /* @__PURE__ */ o.jsx(de, {
        size: "mini",
        disabled: n,
        options: l,
        value: (c = e.params) == null ? void 0 : c.id,
        onChange: (p) => s("id", p)
      })
    }), /* @__PURE__ */ o.jsx(N.Col, {
      flex: "auto",
      children: ((f = e.params) == null ? void 0 : f.id) && /* @__PURE__ */ o.jsx(M, {
        disabled: n,
        useFx: !0,
        size: "mini",
        variables: i,
        define: a[e.params.id].define,
        value: (m = e.params) == null ? void 0 : m.value,
        onChange: (p) => s("value", p),
        showLabel: !1
      })
    })]
  });
}
function Br() {
  return /* @__PURE__ */ o.jsxs("div", {
    className: "flow-create-display",
    children: [/* @__PURE__ */ o.jsx(gt, {
      className: "node-icon"
    }), /* @__PURE__ */ o.jsx("span", {
      style: {
        fontSize: "0.55rem"
      },
      children: Et
    })]
  });
}
const Et = "赋值页面变量", Ot = "setGlobalVariable", Yr = {
  type: Ot,
  RenderWhenFlowNode: zr,
  RenderWhenCreate: Br,
  onBeforeInsert(e, t) {
    return {
      label: Et
    };
  },
  checkComplete: Rt,
  onCreateUi: ce,
  onComputedLog: () => {
  }
};
le.UseNode(Yr);
function Rt(e) {
  return !!(e != null && e.id);
}
let St = class extends L {
  constructor(t) {
    super(t);
  }
  async _execute() {
    if (!this.option.node.params)
      return;
    const t = this.option.node.params, n = V(t.value) ? await A({
      context: this.option.flow.context,
      contextDefine: this.option.flow.contextDefine,
      code: t.value.code
    }) : t.value;
    this.option.flow.getExtra("store").variableStore.updateValueByPath([...vt, t.id], n);
  }
};
St.Type = Ot;
L.AddNode(St);
function U(e, t) {
  if (!t)
    return;
  let n = t;
  for (let i = 0; i < e.length - 1; i++) {
    const s = n[e[i]];
    if ((s == null ? void 0 : s.type) !== "path")
      return;
    n = s.children;
  }
  const a = n[e[e.length - 1]];
  if (a.type === "event")
    return a;
}
function Nt(e, t) {
  if (!t)
    return;
  let n = t;
  for (let i = 0; i < e.length - 1; i++) {
    const s = n[e[i]];
    if (typeof t != "object")
      return;
    n = s;
  }
  const a = n[e[e.length - 1]];
  if (typeof a == "function")
    return a;
}
function Gr(e, t, n) {
  var a;
  return t.type === "flow" ? !!t.id : t.type === "method" ? !(!((a = t.eventPath) != null && a.length) || !U(t.eventPath, n.methods)) : t.type === "setGlobalVariable" ? !!t.id : t.type === "openLink" ? !!t.url : !1;
}
function _t({
  value: e,
  methods: t,
  onChange: n,
  ...a
}) {
  const i = P(() => Ct(t), [t]);
  return /* @__PURE__ */ o.jsx($r, {
    ...a,
    showSearch: !0,
    options: i,
    value: e,
    onChange: (s) => n == null ? void 0 : n(s)
  });
}
function Ct(e) {
  const t = [];
  for (const n in e) {
    const a = e[n];
    a.type === "path" ? t.push({
      value: n,
      label: a.label,
      checked: !1,
      children: Ct(a.children)
    }) : t.push({
      value: n,
      label: a.label
    });
  }
  return t;
}
function Pt({
  disabled: e,
  value: t,
  variables: n,
  params: a,
  onChange: i
}) {
  const [s, l] = pe(t, i), c = G((f, m) => {
    l((p) => {
      const h = p ? [...p] : [];
      for (let b = 0; b < Math.max(f, h.length); b++)
        h[b] === void 0 && (h[b] = void 0);
      return h[f] = m, h;
    });
  }, []);
  return a == null ? void 0 : a.map((f, m) => /* @__PURE__ */ o.jsxs("div", {
    className: "event-row",
    children: [/* @__PURE__ */ o.jsx("label", {
      className: "label",
      children: f.label
    }), /* @__PURE__ */ o.jsx(M, {
      useFx: !0,
      disabled: e,
      showLabel: !1,
      size: "mini",
      define: f,
      value: s == null ? void 0 : s[m],
      variables: n,
      onChange: (p) => c(m, p)
    })]
  }, m));
}
function Tt(e) {
  return /* @__PURE__ */ o.jsx(fe, {
    ...e,
    viewBox: "0 0 1024 1024",
    children: /* @__PURE__ */ o.jsx("path", {
      d: "M546.368 562.048L908.8 682.88l-180.224 61.824-61.44 179.776-120.768-362.432zM482.496 128a341.76 341.76 0 0 1 324.416 449.408l-4.032 11.392-53.376-19.84a284.8 284.8 0 1 0-211.072 179.968l10.88-2.368 13.312 55.424A341.76 341.76 0 1 1 482.56 128v-0.064z"
    })
  });
}
function Ur({
  id: e,
  node: t
}) {
  const n = P(() => Dt(t.params), [t.params]);
  return /* @__PURE__ */ o.jsx(oe, {
    showActions: ["delete", "open"],
    node: t,
    isComplete: n,
    defaultLabel: t.label,
    icon: /* @__PURE__ */ o.jsx(Tt, {
      className: "node-icon"
    }),
    MainRender: Hr
  });
}
function Hr({
  node: e
}) {
  var c, f, m, p;
  const {
    flowManager: t,
    readonly: n
  } = se(), a = ie(), i = yt(), s = ee((h, b) => {
    const O = {
      ...e.params,
      [h]: b
    };
    let T = e.result;
    if (h === "eventPath") {
      const j = U(b, i);
      if (!j)
        return;
      j.return ? T = {
        _return: {
          ...j.return,
          label: "执行结果",
          apiName: "_return"
        }
      } : T = void 0;
    }
    t.updateNode(e.name, {
      label: e.label,
      params: O,
      result: T
    });
  }, [e, i]), l = P(() => {
    var h, b;
    if ((h = e.params) != null && h.eventPath)
      return U((b = e.params) == null ? void 0 : b.eventPath, i);
  }, [(c = e.params) == null ? void 0 : c.eventPath, i]);
  return /* @__PURE__ */ o.jsxs(o.Fragment, {
    children: [/* @__PURE__ */ o.jsxs(N.Row, {
      className: "panel-row",
      children: [/* @__PURE__ */ o.jsx(N.Col, {
        flex: "120px",
        children: /* @__PURE__ */ o.jsx("label", {
          className: "panel-label is-require",
          children: "选择方法"
        })
      }), /* @__PURE__ */ o.jsx(N.Col, {
        flex: "auto",
        children: /* @__PURE__ */ o.jsx(_t, {
          size: "mini",
          methods: i,
          disabled: n,
          value: (f = e.params) == null ? void 0 : f.eventPath,
          onChange: (h) => s("eventPath", h)
        })
      })]
    }), ((m = l == null ? void 0 : l.params) == null ? void 0 : m.length) && /* @__PURE__ */ o.jsxs(N.Row, {
      className: "panel-row",
      align: "center",
      children: [/* @__PURE__ */ o.jsx(N.Col, {
        flex: "120px",
        children: /* @__PURE__ */ o.jsx("label", {
          className: "panel-label",
          children: "方法入参"
        })
      }), /* @__PURE__ */ o.jsx(N.Col, {
        flex: "auto",
        children: /* @__PURE__ */ o.jsx(Pt, {
          disabled: n,
          variables: a,
          params: l == null ? void 0 : l.params,
          value: (p = e.params) == null ? void 0 : p.paramsSetting,
          onChange: (h) => s("paramsSetting", h)
        })
      })]
    })]
  });
}
function Kr() {
  return /* @__PURE__ */ o.jsxs("div", {
    className: "flow-create-display",
    children: [/* @__PURE__ */ o.jsx(Tt, {
      className: "node-icon"
    }), /* @__PURE__ */ o.jsx("span", {
      children: It
    })]
  });
}
const It = "调用函数", kt = "triggerMethod", qr = {
  type: kt,
  RenderWhenFlowNode: Ur,
  RenderWhenCreate: Kr,
  onBeforeInsert(e, t) {
    return {
      label: It
    };
  },
  checkComplete: Dt,
  onCreateUi: ce,
  onComputedLog: () => {
  }
};
le.UseNode(qr);
function Dt(e) {
  var t;
  return !!((t = e == null ? void 0 : e.eventPath) != null && t.length);
}
class $t extends L {
  constructor(t) {
    super(t);
  }
  async _execute() {
    var m, p;
    if (!this.option.node.params)
      return;
    const t = this.option.node.params;
    if (!((m = t.eventPath) != null && m.length))
      throw new Error("未定义方法的路径");
    const n = this.option.flow.getExtra("store"), a = n.eventDefine.getValue(), i = U(t.eventPath, a);
    if (!i)
      throw new Error(`未定义方法: ${t.eventPath.join(".")}`);
    const s = Nt(t.eventPath, jt(n));
    if (!s)
      throw new Error(`未找到方法: ${t.eventPath.join(".")}`);
    const l = [], c = i.params || [];
    for (let h = 0; h < c.length; h++) {
      const b = (p = t.paramsSetting) == null ? void 0 : p[h];
      V(b) ? l.push(await A({
        context: this.option.flow.context,
        contextDefine: this.option.flow.contextDefine,
        code: b.code
      })) : l.push(b);
    }
    const f = await s(...l);
    this.option.flow.context[this.option.node.name] = {
      _return: f
    };
  }
}
$t.Type = kt;
L.AddNode($t);
function Ft({
  value: e,
  eventFlows: t,
  onChange: n,
  ...a
}) {
  const i = P(() => {
    const s = [];
    for (const l in t)
      s.push({
        value: l,
        label: t[l].label
      });
    return s;
  }, [t]);
  return /* @__PURE__ */ o.jsx(de, {
    ...a,
    options: i,
    value: e,
    onChange: n
  });
}
function Vt({
  disabled: e,
  value: t,
  variables: n,
  params: a,
  onChange: i
}) {
  var f;
  const [s, l] = pe(t, i), c = G((m, p) => {
    l((h) => ({
      ...h,
      [m]: p
    }));
  }, []);
  return (f = Object.entries(a || {})) == null ? void 0 : f.map(([m, p]) => /* @__PURE__ */ o.jsxs("div", {
    className: "event-row",
    children: [/* @__PURE__ */ o.jsx("label", {
      className: "label",
      children: p.label
    }), /* @__PURE__ */ o.jsx(M, {
      useFx: !0,
      disabled: e,
      showLabel: !1,
      size: "mini",
      define: p,
      value: s == null ? void 0 : s[m],
      variables: n,
      onChange: (h) => c(m, h)
    })]
  }, m));
}
function At(e) {
  return /* @__PURE__ */ o.jsx(fe, {
    ...e,
    viewBox: "0 0 1024 1024",
    children: /* @__PURE__ */ o.jsx("path", {
      d: "M832 128a64 64 0 0 1 64 64v128a64 64 0 0 1-64 64H480a64 64 0 0 1-64-64V192a64 64 0 0 1 64-64h352zM544 640a64 64 0 0 1 64 64v128a64 64 0 0 1-64 64H192a64 64 0 0 1-64-64v-128a64 64 0 0 1 64-64h352zM416 224.96v64H194.4l-1.44 190.656h703.136v320.928H608v-64l224.096-0.032v-192.896H128.448l2.432-318.624zM526.176 413.152l90.528 90.528-90.528 90.496-90.496-90.496z"
    })
  });
}
function Jr({
  id: e,
  node: t
}) {
  const n = P(() => zt(t.params), [t.params]);
  return /* @__PURE__ */ o.jsx(oe, {
    showActions: ["delete", "open"],
    node: t,
    isComplete: n,
    defaultLabel: t.label,
    icon: /* @__PURE__ */ o.jsx(At, {
      className: "node-icon"
    }),
    MainRender: Xr
  });
}
function Xr({
  node: e
}) {
  var c, f, m, p, h;
  const {
    flowManager: t,
    readonly: n
  } = se(), a = ie(), i = wt(), s = ee((b, O) => {
    const T = {
      ...e.params,
      [b]: O
    };
    let j = e.result;
    if (b === "id") {
      const C = i[O];
      if (!C)
        return;
      if (j = {
        _code: {
          type: "number",
          label: "状态码",
          apiName: "_code"
        },
        _msg: {
          type: "string",
          label: "提示信息",
          apiName: "_msg"
        }
      }, C.result) {
        const g = {
          type: "object",
          label: "执行结果",
          apiName: "_return",
          prototype: {}
        };
        for (const R in C.result)
          g.prototype[R] = C.result[R].desc;
        Object.keys(g.prototype).length > 0 && (j._return = g);
      }
    }
    t.updateNode(e.name, {
      label: e.label,
      params: T,
      result: j
    });
  }, [e, i]), l = P(() => {
    var b;
    if ((b = e.params) != null && b.id)
      return i[e.params.id];
  }, [i, (c = e.params) == null ? void 0 : c.id]);
  return /* @__PURE__ */ o.jsxs(o.Fragment, {
    children: [/* @__PURE__ */ o.jsxs(N.Row, {
      className: "panel-row",
      children: [/* @__PURE__ */ o.jsx(N.Col, {
        flex: "120px",
        children: /* @__PURE__ */ o.jsx("label", {
          className: "panel-label is-require",
          children: "选择事件流"
        })
      }), /* @__PURE__ */ o.jsx(N.Col, {
        flex: "auto",
        children: /* @__PURE__ */ o.jsx(Ft, {
          size: "mini",
          eventFlows: i,
          disabled: n,
          value: (f = e.params) == null ? void 0 : f.id,
          onChange: (b) => s("id", b)
        })
      })]
    }), Object.keys(((m = l == null ? void 0 : l.params) == null ? void 0 : m.input) || {}).length > 0 && /* @__PURE__ */ o.jsxs(N.Row, {
      className: "panel-row",
      align: "center",
      children: [/* @__PURE__ */ o.jsx(N.Col, {
        flex: "120px",
        children: /* @__PURE__ */ o.jsx("label", {
          className: "panel-label",
          children: "流程入参"
        })
      }), /* @__PURE__ */ o.jsx(N.Col, {
        flex: "auto",
        children: /* @__PURE__ */ o.jsx(Vt, {
          disabled: n,
          variables: a,
          params: (p = l == null ? void 0 : l.params) == null ? void 0 : p.input,
          value: (h = e.params) == null ? void 0 : h.paramsSetting,
          onChange: (b) => s("paramsSetting", b)
        })
      })]
    })]
  });
}
function Zr() {
  return /* @__PURE__ */ o.jsxs("div", {
    className: "flow-create-display",
    children: [/* @__PURE__ */ o.jsx(At, {
      className: "node-icon"
    }), /* @__PURE__ */ o.jsx("span", {
      style: {
        fontSize: "0.7rem"
      },
      children: Lt
    })]
  });
}
const Lt = "调用事件流", Wt = "eventFlow", Qr = {
  type: Wt,
  RenderWhenFlowNode: Jr,
  RenderWhenCreate: Zr,
  onBeforeInsert(e, t) {
    return {
      label: Lt
    };
  },
  checkComplete: zt,
  onCreateUi: ce,
  onComputedLog: () => {
  }
};
le.UseNode(Qr);
function zt(e) {
  return !!(e != null && e.id);
}
class Mt extends L {
  constructor(t) {
    super(t);
  }
  async _execute() {
    var f, m;
    if (!this.option.node.params)
      return;
    const t = this.option.node.params;
    if (!t.id)
      throw new Error("未定义方法的路径");
    const n = this.option.flow.getExtra("store"), a = n.eventFlow.getValue(), i = a == null ? void 0 : a[t.id];
    if (!i)
      throw new Error(`未找到事件流: ${t.id}`);
    const s = {};
    for (const p in (f = i.params) == null ? void 0 : f.input) {
      const h = (m = t.paramsSetting) == null ? void 0 : m[p];
      V(h) ? s[p] = await A({
        context: this.option.flow.context,
        contextDefine: this.option.flow.contextDefine,
        code: h.code
      }) : s[p] = h;
    }
    const l = mt(i);
    l.addExtra("store", n);
    const c = await l.execute(s);
    this.option.flow.context[this.option.node.name] = {
      _return: c.data,
      _code: c.code,
      _msg: c.msg
    };
  }
}
Mt.Type = Wt;
L.AddNode(Mt);
function Bt(e) {
  return /* @__PURE__ */ o.jsx(fe, {
    ...e,
    viewBox: "0 0 1024 1024",
    children: /* @__PURE__ */ o.jsx("path", {
      d: "M597.15264 384c11.84 0 23.04 4.48 31.488 12.736 100.16 92.8 107.584 244.48 17.024 345.92l-216.448 216.32c-92.992 93.12-250.88 85.184-351.552-17.088-97.216-92.736-104-241.472-15.488-341.952l78.08-78.72 0.064 0.128a45.696 45.696 0 0 1 60.8 0.448 41.28 41.28 0 0 1 3.2 58.24l-77.44 77.952a162.688 162.688 0 0 0 17.024 228.224c67.2 67.008 166.4 72.96 222.464 16.64l216.128-217.6a162.688 162.688 0 0 0-17.024-228.288 41.6 41.6 0 0 1-9.408-46.528A44.8 44.8 0 0 1 597.15264 384z m349.056-301.632a246.208 246.208 0 0 1 15.744 343.04l-77.952 78.784h-0.128a45.632 45.632 0 0 1-62.72 1.28 41.536 41.536 0 0 1-1.344-60.288l77.44-77.76a163.456 163.456 0 0 0-16.896-228.992c-67.2-67.2-166.528-73.216-222.592-16.64L441.63264 339.84a163.328 163.328 0 0 0 17.024 228.928 41.6 41.6 0 0 1-1.984 58.688 45.888 45.888 0 0 1-61.12 1.6C295.32864 536 287.84064 384 378.40064 282.24l216.32-216.96c93.12-93.44 251.072-85.504 351.488 17.088z"
    })
  });
}
function en({
  id: e,
  node: t
}) {
  const n = P(() => Ut(t.params), [t.params]);
  return /* @__PURE__ */ o.jsx(oe, {
    showActions: ["delete", "open"],
    node: t,
    isComplete: n,
    defaultLabel: t.label,
    icon: /* @__PURE__ */ o.jsx(Bt, {
      className: "node-icon"
    }),
    MainRender: rn
  });
}
const tn = {
  type: "string",
  apiName: "url",
  label: "地址"
};
function rn({
  node: e
}) {
  var s, l;
  const {
    flowManager: t,
    readonly: n
  } = se(), a = ie(), i = ee((c, f) => {
    const m = {
      ...e.params,
      [c]: f
    };
    t.updateNode(e.name, {
      label: e.label,
      params: m,
      result: e.result
    });
  }, [e]);
  return /* @__PURE__ */ o.jsxs(o.Fragment, {
    children: [/* @__PURE__ */ o.jsxs(N.Row, {
      className: "panel-row",
      gutter: 8,
      children: [/* @__PURE__ */ o.jsx(N.Col, {
        flex: "120px",
        children: /* @__PURE__ */ o.jsx("label", {
          className: "panel-label is-require",
          children: "地址"
        })
      }), /* @__PURE__ */ o.jsx(N.Col, {
        flex: "auto",
        children: /* @__PURE__ */ o.jsx(M, {
          disabled: n,
          useFx: !0,
          size: "mini",
          variables: a,
          define: tn,
          value: (s = e.params) == null ? void 0 : s.url,
          onChange: (c) => i("url", c),
          showLabel: !1
        })
      })]
    }), /* @__PURE__ */ o.jsxs(N.Row, {
      className: "panel-row",
      gutter: 8,
      children: [/* @__PURE__ */ o.jsx(N.Col, {
        flex: "120px",
        children: /* @__PURE__ */ o.jsx("label", {
          className: "panel-label",
          children: "在当前页面打开"
        })
      }), /* @__PURE__ */ o.jsx(N.Col, {
        flex: "auto",
        children: /* @__PURE__ */ o.jsx(ht, {
          size: "small",
          checked: (l = e.params) == null ? void 0 : l.openInSelf,
          onChange: (c) => i("openInSelf", c)
        })
      })]
    })]
  });
}
function nn() {
  return /* @__PURE__ */ o.jsxs("div", {
    className: "flow-create-display",
    children: [/* @__PURE__ */ o.jsx(Bt, {
      className: "node-icon"
    }), /* @__PURE__ */ o.jsx("span", {
      children: Yt
    })]
  });
}
const Yt = "打开链接", Gt = "openLink", an = {
  type: Gt,
  RenderWhenFlowNode: en,
  RenderWhenCreate: nn,
  onBeforeInsert(e, t) {
    return {
      label: Yt
    };
  },
  checkComplete: Ut,
  onCreateUi: ce,
  onComputedLog: () => {
  }
};
le.UseNode(an);
function Ut(e) {
  return !!(e != null && e.url);
}
class Ht extends L {
  constructor(t) {
    super(t);
  }
  async _execute() {
    if (!this.option.node.params)
      return;
    const t = this.option.node.params, n = V(t.url) ? await A({
      context: this.option.flow.context,
      contextDefine: this.option.flow.contextDefine,
      code: t.url.code
    }) : t.url;
    window.open(n, t.openInSelf ? "_self" : "blank");
  }
}
Ht.Type = Gt;
L.AddNode(Ht);
function H() {
  return H = Object.assign ? Object.assign.bind() : function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var n = arguments[t];
      for (var a in n)
        Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
    }
    return e;
  }, H.apply(this, arguments);
}
function Q(e) {
  "@babel/helpers - typeof";
  return Q = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
    return typeof t;
  } : function(t) {
    return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
  }, Q(e);
}
function on(e, t) {
  if (Q(e) != "object" || !e)
    return e;
  var n = e[Symbol.toPrimitive];
  if (n !== void 0) {
    var a = n.call(e, t || "default");
    if (Q(a) != "object")
      return a;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return (t === "string" ? String : Number)(e);
}
function sn(e) {
  var t = on(e, "string");
  return Q(t) == "symbol" ? t : t + "";
}
function me(e, t, n) {
  return t = sn(t), t in e ? Object.defineProperty(e, t, {
    value: n,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = n, e;
}
var he = kr({
  prefixCls: "arco"
});
function st(e, t) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var a = Object.getOwnPropertySymbols(e);
    t && (a = a.filter(function(i) {
      return Object.getOwnPropertyDescriptor(e, i).enumerable;
    })), n.push.apply(n, a);
  }
  return n;
}
function it(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? arguments[t] : {};
    t % 2 ? st(Object(n), !0).forEach(function(a) {
      me(e, a, n[a]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : st(Object(n)).forEach(function(a) {
      Object.defineProperty(e, a, Object.getOwnPropertyDescriptor(n, a));
    });
  }
  return e;
}
function ln(e, t) {
  var n = ue(he), a = n.prefixCls, i = a === void 0 ? "arco" : a, s = e.spin, l = e.className, c = it(it({
    "aria-hidden": !0,
    focusable: !1,
    ref: t
  }, e), {}, {
    className: "".concat(l ? l + " " : "").concat(i, "-icon ").concat(i, "-icon-plus")
  });
  return s && (c.className = "".concat(c.className, " ").concat(i, "-icon-loading")), delete c.spin, delete c.isIcon, /* @__PURE__ */ D.createElement("svg", H({
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "4",
    viewBox: "0 0 48 48"
  }, c), /* @__PURE__ */ D.createElement("path", {
    d: "M5 24h38M24 5v38"
  }));
}
var _e = /* @__PURE__ */ D.forwardRef(ln);
_e.defaultProps = {
  isIcon: !0
};
_e.displayName = "IconPlus";
const cn = _e;
function lt(e, t) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var a = Object.getOwnPropertySymbols(e);
    t && (a = a.filter(function(i) {
      return Object.getOwnPropertyDescriptor(e, i).enumerable;
    })), n.push.apply(n, a);
  }
  return n;
}
function ct(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? arguments[t] : {};
    t % 2 ? lt(Object(n), !0).forEach(function(a) {
      me(e, a, n[a]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : lt(Object(n)).forEach(function(a) {
      Object.defineProperty(e, a, Object.getOwnPropertyDescriptor(n, a));
    });
  }
  return e;
}
function un(e, t) {
  var n = ue(he), a = n.prefixCls, i = a === void 0 ? "arco" : a, s = e.spin, l = e.className, c = ct(ct({
    "aria-hidden": !0,
    focusable: !1,
    ref: t
  }, e), {}, {
    className: "".concat(l ? l + " " : "").concat(i, "-icon ").concat(i, "-icon-search")
  });
  return s && (c.className = "".concat(c.className, " ").concat(i, "-icon-loading")), delete c.spin, delete c.isIcon, /* @__PURE__ */ D.createElement("svg", H({
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "4",
    viewBox: "0 0 48 48"
  }, c), /* @__PURE__ */ D.createElement("path", {
    d: "M33.072 33.071c6.248-6.248 6.248-16.379 0-22.627-6.249-6.249-16.38-6.249-22.628 0-6.248 6.248-6.248 16.379 0 22.627 6.248 6.248 16.38 6.248 22.628 0Zm0 0 8.485 8.485"
  }));
}
var Ce = /* @__PURE__ */ D.forwardRef(un);
Ce.defaultProps = {
  isIcon: !0
};
Ce.displayName = "IconSearch";
const fn = Ce;
function ut(e, t) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var a = Object.getOwnPropertySymbols(e);
    t && (a = a.filter(function(i) {
      return Object.getOwnPropertyDescriptor(e, i).enumerable;
    })), n.push.apply(n, a);
  }
  return n;
}
function ft(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? arguments[t] : {};
    t % 2 ? ut(Object(n), !0).forEach(function(a) {
      me(e, a, n[a]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ut(Object(n)).forEach(function(a) {
      Object.defineProperty(e, a, Object.getOwnPropertyDescriptor(n, a));
    });
  }
  return e;
}
function dn(e, t) {
  var n = ue(he), a = n.prefixCls, i = a === void 0 ? "arco" : a, s = e.spin, l = e.className, c = ft(ft({
    "aria-hidden": !0,
    focusable: !1,
    ref: t
  }, e), {}, {
    className: "".concat(l ? l + " " : "").concat(i, "-icon ").concat(i, "-icon-delete")
  });
  return s && (c.className = "".concat(c.className, " ").concat(i, "-icon-loading")), delete c.spin, delete c.isIcon, /* @__PURE__ */ D.createElement("svg", H({
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "4",
    viewBox: "0 0 48 48"
  }, c), /* @__PURE__ */ D.createElement("path", {
    d: "M5 11h5.5m0 0v29a1 1 0 0 0 1 1h25a1 1 0 0 0 1-1V11m-27 0H16m21.5 0H43m-5.5 0H32m-16 0V7h16v4m-16 0h16M20 18v15m8-15v15"
  }));
}
var Pe = /* @__PURE__ */ D.forwardRef(dn);
Pe.defaultProps = {
  isIcon: !0
};
Pe.displayName = "IconDelete";
const pn = Pe;
function dt(e, t) {
  var n = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var a = Object.getOwnPropertySymbols(e);
    t && (a = a.filter(function(i) {
      return Object.getOwnPropertyDescriptor(e, i).enumerable;
    })), n.push.apply(n, a);
  }
  return n;
}
function pt(e) {
  for (var t = 1; t < arguments.length; t++) {
    var n = arguments[t] != null ? arguments[t] : {};
    t % 2 ? dt(Object(n), !0).forEach(function(a) {
      me(e, a, n[a]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : dt(Object(n)).forEach(function(a) {
      Object.defineProperty(e, a, Object.getOwnPropertyDescriptor(n, a));
    });
  }
  return e;
}
function mn(e, t) {
  var n = ue(he), a = n.prefixCls, i = a === void 0 ? "arco" : a, s = e.spin, l = e.className, c = pt(pt({
    "aria-hidden": !0,
    focusable: !1,
    ref: t
  }, e), {}, {
    className: "".concat(l ? l + " " : "").concat(i, "-icon ").concat(i, "-icon-edit")
  });
  return s && (c.className = "".concat(c.className, " ").concat(i, "-icon-loading")), delete c.spin, delete c.isIcon, /* @__PURE__ */ D.createElement("svg", H({
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "4",
    viewBox: "0 0 48 48"
  }, c), /* @__PURE__ */ D.createElement("path", {
    d: "m30.48 19.038 5.733-5.734a1 1 0 0 0 0-1.414l-5.586-5.586a1 1 0 0 0-1.414 0l-5.734 5.734m7 7L15.763 33.754a1 1 0 0 1-.59.286l-6.048.708a1 1 0 0 1-1.113-1.069l.477-6.31a1 1 0 0 1 .29-.631l14.7-14.7m7 7-7-7M6 42h36"
  }));
}
var Te = /* @__PURE__ */ D.forwardRef(mn);
Te.defaultProps = {
  isIcon: !0
};
Te.displayName = "IconEdit";
const hn = Te;
var Kt = { exports: {} };
/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/
(function(e) {
  (function() {
    var t = {}.hasOwnProperty;
    function n() {
      for (var s = "", l = 0; l < arguments.length; l++) {
        var c = arguments[l];
        c && (s = i(s, a(c)));
      }
      return s;
    }
    function a(s) {
      if (typeof s == "string" || typeof s == "number")
        return s;
      if (typeof s != "object")
        return "";
      if (Array.isArray(s))
        return n.apply(null, s);
      if (s.toString !== Object.prototype.toString && !s.toString.toString().includes("[native code]"))
        return s.toString();
      var l = "";
      for (var c in s)
        t.call(s, c) && s[c] && (l = i(l, c));
      return l;
    }
    function i(s, l) {
      return l ? s ? s + " " + l : s + l : s;
    }
    e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
  })();
})(Kt);
var bn = Kt.exports;
const qt = /* @__PURE__ */ Ar(bn);
function xn({
  visible: e,
  eventFlow: t,
  disabledNodes: n,
  modalProps: a,
  onClose: i,
  onUpdate: s
}) {
  const [l, c] = Re(!1), f = Dr(null), m = ee((p) => {
    t && (s == null || s({
      ...t,
      label: p
    }));
  }, [t, s]);
  return /* @__PURE__ */ o.jsx(Fr, {
    ...a,
    wrapClassName: qt("event-flow-editor-modal", a == null ? void 0 : a.wrapClassName),
    visible: e,
    footer: null,
    title: t && /* @__PURE__ */ o.jsxs("div", {
      style: {
        paddingRight: "1.5rem",
        display: "flex",
        alignItems: "center",
        gap: 8
      },
      children: [/* @__PURE__ */ o.jsx(Se, {
        size: "small",
        value: t == null ? void 0 : t.label,
        onChange: m
      }), /* @__PURE__ */ o.jsx(bt, {
        size: "mini",
        type: "primary",
        onClick: () => c(!0),
        children: "流程变量"
      })]
    }),
    onCancel: i,
    children: /* @__PURE__ */ o.jsx("div", {
      ref: f,
      style: {
        height: "100%"
      },
      children: e && t && /* @__PURE__ */ o.jsx(Ir, {
        disabledNodes: n,
        flow: t,
        onChangeFlow: (p) => s == null ? void 0 : s({
          ...p,
          label: t.label,
          apiName: t.apiName
        }),
        flowVariableProps: {
          visible: l,
          onHidden: () => c(!1),
          getPopupContainer: () => f.current || document.body,
          modalProps: {
            getPopupContainer: () => f.current || document.body,
            wrapStyle: {
              position: "absolute"
            },
            maskStyle: {
              position: "absolute"
            }
          }
        }
      })
    })
  });
}
function Ln({
  modalProps: e,
  disabledNodes: t,
  eventFlows: n,
  onChange: a
}) {
  const [i, s] = pe(n, a), [l, c] = Re(""), [f, m] = Re(), p = P(() => {
    var C;
    const j = [];
    for (const g in i)
      (C = i[g].label) != null && C.includes(l) && j.push({
        id: g,
        eventFlow: i[g]
      });
    return j;
  }, [i, l]), h = G(() => {
    const j = Vr("event_flow");
    s((C) => ({
      ...C,
      [j]: {
        label: "事件流",
        apiName: j,
        type: "pageEvent"
      }
    })), m(j);
  }, []), b = G((j, C) => {
    s((g) => {
      if (!(g != null && g[j]))
        return;
      const R = {
        ...g[j],
        label: C
      };
      return {
        ...g,
        [j]: R
      };
    });
  }, []), O = G((j, C) => {
    s((g) => {
      if (g != null && g[j])
        return {
          ...g,
          [j]: C
        };
    });
  }, []), T = G((j) => {
    s((C) => {
      const g = {
        ...C
      };
      return delete g[j], g;
    });
  }, []);
  return /* @__PURE__ */ o.jsxs("div", {
    className: "event-flow-setter-wrapper",
    children: [/* @__PURE__ */ o.jsxs("div", {
      className: "event-flow-setter-top",
      children: [/* @__PURE__ */ o.jsx(Se, {
        prefix: /* @__PURE__ */ o.jsx(fn, {}),
        size: "mini",
        placeholder: "请输入关键词",
        value: l,
        onChange: c
      }), /* @__PURE__ */ o.jsx(bt, {
        type: "primary",
        size: "mini",
        icon: /* @__PURE__ */ o.jsx(cn, {}),
        onClick: h,
        children: "添加"
      })]
    }), /* @__PURE__ */ o.jsx(rt, {
      size: "small",
      dataSource: p,
      pagination: {
        pageSize: 6,
        hideOnSinglePage: !0
      },
      render: (j) => /* @__PURE__ */ o.jsx(rt.Item, {
        className: "event-flow-setter-item",
        actions: [/* @__PURE__ */ o.jsx(nt, {
          trigger: "hover",
          position: "top",
          content: "编辑流程",
          children: /* @__PURE__ */ o.jsx(hn, {
            className: "event-flow-setter-edit-icon",
            onClick: () => m(j.id)
          })
        }), /* @__PURE__ */ o.jsx(nt, {
          trigger: "hover",
          position: "top",
          content: "删除流程",
          children: /* @__PURE__ */ o.jsx(pn, {
            className: "event-flow-setter-delete-icon",
            onClick: () => T(j.id)
          })
        })],
        children: /* @__PURE__ */ o.jsx(Se, {
          size: "mini",
          value: j.eventFlow.label,
          onChange: (C) => b(j.id, C)
        })
      }, j.id)
    }), /* @__PURE__ */ o.jsx(xn, {
      modalProps: e,
      disabledNodes: t,
      visible: !!f,
      eventFlow: i == null ? void 0 : i[f || ""],
      onClose: () => m(void 0),
      onUpdate: (j) => f && O(f, j)
    })]
  });
}
const vn = [{
  value: "flow",
  label: "调用事件流"
}, {
  value: "method",
  label: "调用方法"
}, {
  value: "setGlobalVariable",
  label: "赋值页面变量"
}, {
  value: "openLink",
  label: "打开链接"
}];
function yn({
  value: e,
  onChange: t,
  ...n
}) {
  return /* @__PURE__ */ o.jsx(de, {
    ...n,
    options: vn,
    value: e,
    onChange: t
  });
}
function Jt({
  define: e,
  variables: t,
  value: n,
  onChange: a
}) {
  return e ? /* @__PURE__ */ o.jsxs("div", {
    className: "event-row",
    children: [/* @__PURE__ */ o.jsx("label", {
      className: "label",
      children: "返回值"
    }), /* @__PURE__ */ o.jsx(M, {
      useFx: !0,
      showLabel: !1,
      size: "mini",
      define: e,
      value: n,
      variables: t,
      onChange: a
    })]
  }) : null;
}
function jn({
  value: e,
  triggerMethod: t,
  variables: n,
  eventFlows: a,
  onChange: i
}) {
  var c, f;
  const s = P(() => {
    if ((e == null ? void 0 : e.type) === "flow" && e.id)
      return a == null ? void 0 : a[e.id];
  }, [e, a]), l = P(() => {
    if (s != null && s.result) {
      const m = {
        type: "object",
        label: "执行结果",
        apiName: "_return",
        prototype: {}
      };
      for (const p in s.result)
        m.prototype[p] = s.result[p].desc;
      if (Object.keys(m.prototype).length > 0)
        return {
          ...n,
          _return: m
        };
    }
    return n;
  }, [s, n]);
  return /* @__PURE__ */ o.jsxs(o.Fragment, {
    children: [/* @__PURE__ */ o.jsxs("div", {
      className: "event-row",
      children: [/* @__PURE__ */ o.jsx("label", {
        className: "label",
        children: "事件流"
      }), /* @__PURE__ */ o.jsx(Ft, {
        value: e.id,
        size: "mini",
        eventFlows: a,
        onChange: (m) => i == null ? void 0 : i({
          type: e.type,
          id: m
        })
      })]
    }), Object.keys(((c = s == null ? void 0 : s.params) == null ? void 0 : c.input) || {}).length > 0 && /* @__PURE__ */ o.jsxs(o.Fragment, {
      children: [/* @__PURE__ */ o.jsx("div", {
        className: "event-line"
      }), /* @__PURE__ */ o.jsx(Vt, {
        value: e.paramsSetting,
        variables: n,
        params: (f = s == null ? void 0 : s.params) == null ? void 0 : f.input,
        onChange: (m) => i == null ? void 0 : i({
          ...e,
          paramsSetting: m
        })
      })]
    }), t.return && /* @__PURE__ */ o.jsxs(o.Fragment, {
      children: [/* @__PURE__ */ o.jsx("div", {
        className: "event-line"
      }), /* @__PURE__ */ o.jsx(Jt, {
        define: t.return,
        variables: l,
        value: e == null ? void 0 : e.resultSetting,
        onChange: (m) => i == null ? void 0 : i({
          ...e,
          resultSetting: m
        })
      })]
    })]
  });
}
function wn({
  value: e,
  triggerMethod: t,
  variables: n,
  methods: a,
  onChange: i
}) {
  var c;
  const s = P(() => {
    var f;
    if ((e == null ? void 0 : e.type) === "method" && (f = e.eventPath) != null && f.length)
      return U(e.eventPath, a);
  }, [e, a]), l = P(() => s != null && s.return ? {
    ...n,
    _return: {
      ...s.return,
      label: "执行结果",
      apiName: "_return"
    }
  } : n, [s, n]);
  return /* @__PURE__ */ o.jsxs(o.Fragment, {
    children: [/* @__PURE__ */ o.jsxs("div", {
      className: "event-row",
      children: [/* @__PURE__ */ o.jsx("label", {
        className: "label",
        children: "方法"
      }), /* @__PURE__ */ o.jsx(_t, {
        value: e.eventPath,
        size: "mini",
        methods: a,
        onChange: (f) => i == null ? void 0 : i({
          type: e.type,
          eventPath: f || []
        })
      })]
    }), ((c = s == null ? void 0 : s.params) == null ? void 0 : c.length) && /* @__PURE__ */ o.jsxs(o.Fragment, {
      children: [/* @__PURE__ */ o.jsx("div", {
        className: "event-line"
      }), /* @__PURE__ */ o.jsx(Pt, {
        variables: n,
        params: s == null ? void 0 : s.params,
        value: e.paramsSetting,
        onChange: (f) => i == null ? void 0 : i({
          ...e,
          paramsSetting: f
        })
      })]
    }), t.return && /* @__PURE__ */ o.jsxs(o.Fragment, {
      children: [/* @__PURE__ */ o.jsx("div", {
        className: "event-line"
      }), /* @__PURE__ */ o.jsx(Jt, {
        define: t.return,
        variables: l,
        value: e == null ? void 0 : e.resultSetting,
        onChange: (f) => i == null ? void 0 : i({
          ...e,
          resultSetting: f
        })
      })]
    })]
  });
}
function gn({
  value: e,
  variables: t,
  onChange: n
}) {
  const a = xt(), i = P(() => {
    if ((e == null ? void 0 : e.type) === "setGlobalVariable" && e.id)
      return a == null ? void 0 : a[e.id];
  }, [e, a]), s = P(() => {
    const l = [];
    for (const c in a)
      l.push({
        value: c,
        label: a[c].define.label
      });
    return l;
  }, [a]);
  return /* @__PURE__ */ o.jsxs(o.Fragment, {
    children: [/* @__PURE__ */ o.jsxs("div", {
      className: "event-row",
      children: [/* @__PURE__ */ o.jsx("label", {
        className: "label",
        children: "选择变量"
      }), /* @__PURE__ */ o.jsx(de, {
        size: "mini",
        options: s,
        value: e == null ? void 0 : e.id,
        onChange: (l) => n == null ? void 0 : n({
          ...e,
          id: l
        })
      })]
    }), i && /* @__PURE__ */ o.jsxs(o.Fragment, {
      children: [/* @__PURE__ */ o.jsx("div", {
        className: "event-line"
      }), /* @__PURE__ */ o.jsxs("div", {
        className: "event-row",
        children: [/* @__PURE__ */ o.jsx("label", {
          className: "label",
          children: "新值"
        }), /* @__PURE__ */ o.jsx(M, {
          useFx: !0,
          size: "mini",
          variables: t,
          define: i.define,
          value: e == null ? void 0 : e.value,
          onChange: (l) => n == null ? void 0 : n({
            ...e,
            value: l
          }),
          showLabel: !1
        })]
      })]
    })]
  });
}
const En = {
  type: "string",
  apiName: "url",
  label: "地址"
};
function On({
  value: e,
  variables: t,
  onChange: n
}) {
  return /* @__PURE__ */ o.jsxs(o.Fragment, {
    children: [/* @__PURE__ */ o.jsxs("div", {
      className: "event-row",
      children: [/* @__PURE__ */ o.jsx("label", {
        className: "label",
        children: "地址"
      }), /* @__PURE__ */ o.jsx(M, {
        useFx: !0,
        size: "mini",
        variables: t,
        define: En,
        value: e == null ? void 0 : e.url,
        onChange: (a) => n == null ? void 0 : n({
          ...e,
          url: a
        }),
        showLabel: !1
      })]
    }), /* @__PURE__ */ o.jsxs("div", {
      className: "event-row",
      children: [/* @__PURE__ */ o.jsx("label", {
        className: "label",
        children: "在当前页面打开"
      }), /* @__PURE__ */ o.jsx(ht, {
        size: "small",
        checked: e.openInSelf,
        onChange: (a) => n == null ? void 0 : n({
          ...e,
          openInSelf: a
        })
      })]
    })]
  });
}
function Wn({
  variables: e,
  triggerMethod: t,
  value: n,
  onChange: a
}) {
  const i = wt(), s = yt(), [l, c] = pe(n, a), f = P(() => l ? Gr(t, l, {
    eventFlows: i,
    methods: s
  }) : !0, [l, t, i, s]), m = P(() => {
    var h;
    if (!((h = t == null ? void 0 : t.params) != null && h.length))
      return e;
    const p = {
      type: "object",
      label: "函数入参",
      prototype: {},
      apiName: "_params"
    };
    return t.params.forEach((b, O) => {
      p.prototype[O] = b;
    }), {
      ...e,
      _params: p
    };
  }, [e, t]);
  return /* @__PURE__ */ o.jsxs("div", {
    className: qt("event-setter-wrapper", !f && "not-complete"),
    children: [/* @__PURE__ */ o.jsx("div", {
      className: "event-label",
      children: t.label
    }), /* @__PURE__ */ o.jsxs("div", {
      className: "event-row",
      children: [/* @__PURE__ */ o.jsx("label", {
        className: "label",
        children: "事件类型"
      }), /* @__PURE__ */ o.jsx(yn, {
        allowClear: !0,
        value: l == null ? void 0 : l.type,
        size: "mini",
        onChange: (p) => c(p ? {
          type: p
        } : void 0)
      })]
    }), (l == null ? void 0 : l.type) === "flow" && /* @__PURE__ */ o.jsx(jn, {
      value: l,
      triggerMethod: t,
      variables: m,
      eventFlows: i,
      onChange: c
    }), (l == null ? void 0 : l.type) === "method" && /* @__PURE__ */ o.jsx(wn, {
      value: l,
      triggerMethod: t,
      variables: m,
      methods: s,
      onChange: c
    }), (l == null ? void 0 : l.type) === "setGlobalVariable" && /* @__PURE__ */ o.jsx(gn, {
      value: l,
      variables: m,
      onChange: c
    }), (l == null ? void 0 : l.type) === "openLink" && /* @__PURE__ */ o.jsx(On, {
      value: l,
      variables: m,
      onChange: c
    })]
  });
}
async function Rn({
  value: e,
  triggerMethod: t,
  withTriggerParamsVariable: n,
  withTriggerParamsContext: a,
  methodContext: i,
  methods: s
}) {
  var h, b;
  if (!((h = e.eventPath) != null && h.length))
    throw new Error("未定义方法的路径");
  const l = U(e.eventPath, s);
  if (!l)
    throw new Error(`未定义方法: ${e.eventPath.join(".")}`);
  const c = Nt(e.eventPath, i);
  if (!c)
    throw new Error(`未找到方法: ${e.eventPath.join(".")}`);
  const f = [], m = l.params || [];
  for (let O = 0; O < m.length; O++) {
    const T = (b = e.paramsSetting) == null ? void 0 : b[O];
    V(T) ? f.push(await A({
      context: a,
      contextDefine: n,
      code: T.code
    })) : f.push(T);
  }
  const p = await c(...f);
  if (t.return) {
    if (V(e.resultSetting)) {
      const {
        withTriggerReturnContext: O,
        withTriggerReturnVariable: T
      } = Sn(l, n, a, p);
      return await A({
        context: O,
        contextDefine: T,
        code: e.resultSetting.code
      });
    }
    return e.resultSetting;
  }
}
function Sn(e, t, n, a) {
  const i = {
    ...t
  }, s = {
    ...n
  };
  return e.return && (i._return = {
    ...e.return,
    label: "执行结果",
    apiName: "_return"
  }, s._return = a), {
    withTriggerReturnVariable: i,
    withTriggerReturnContext: s
  };
}
async function Nn({
  withTriggerParamsContext: e,
  withTriggerParamsVariable: t,
  eventFlows: n,
  store: a,
  value: i,
  triggerMethod: s
}) {
  var p, h;
  if (!i.id)
    throw new Error("未定义方法的路径");
  const l = n == null ? void 0 : n[i.id];
  if (!l)
    throw new Error(`未找到事件流: ${i.id}`);
  const c = {};
  for (const b in (p = l.params) == null ? void 0 : p.input) {
    const O = (h = i.paramsSetting) == null ? void 0 : h[b];
    V(O) ? c[b] = await A({
      context: e,
      contextDefine: t,
      code: O.code
    }) : c[b] = O;
  }
  const f = mt(l);
  f.addExtra("store", a);
  const m = await f.execute(c);
  if (m.code !== 0) {
    console.error(m.msg);
    return;
  }
  if (s.return) {
    if (V(i.resultSetting)) {
      const {
        withTriggerReturnContext: b,
        withTriggerReturnVariable: O
      } = _n(l, t, e, m.data);
      return await A({
        context: b,
        contextDefine: O,
        code: i.resultSetting.code
      });
    }
    return i.resultSetting;
  }
}
function _n(e, t, n, a) {
  const i = {
    ...t
  }, s = {
    ...n
  };
  if (e.result) {
    const l = {
      type: "object",
      label: "执行结果",
      apiName: "_return",
      prototype: {}
    };
    for (const c in e.result)
      l.prototype[c] = e.result[c].desc;
    i._return = l, s._return = a;
  }
  return {
    withTriggerReturnVariable: i,
    withTriggerReturnContext: s
  };
}
async function Cn({
  withTriggerParamsContext: e,
  withTriggerParamsVariable: t,
  value: n,
  store: a
}) {
  if (!n.id)
    throw new Error("未选择页面变量");
  const i = V(n.value) ? await A({
    context: e,
    contextDefine: t,
    code: n.value.code
  }) : n.value;
  a.variableStore.updateValueByPath([...vt, n.id], i);
}
async function Pn({
  withTriggerParamsContext: e,
  withTriggerParamsVariable: t,
  value: n
}) {
  if (!n.url)
    throw new Error("未填写页面地址");
  const a = V(n.url) ? await A({
    context: e,
    contextDefine: t,
    code: n.url.code
  }) : n.url;
  window.open(a, n.openInSelf ? "_self" : "blank");
}
async function zn({
  value: e,
  triggerMethod: t,
  triggerParams: n,
  variables: a,
  variableContext: i,
  store: s
}) {
  const {
    withTriggerParamsContext: l,
    withTriggerParamsVariable: c
  } = Tn(t, a, i, n);
  if (e.type === "flow")
    return await Nn({
      withTriggerParamsVariable: c,
      withTriggerParamsContext: l,
      eventFlows: s.eventFlow.getValue(),
      store: s,
      value: e,
      triggerMethod: t
    });
  if (e.type === "method")
    return await Rn({
      withTriggerParamsVariable: c,
      withTriggerParamsContext: l,
      methods: s.eventDefine.getValue(),
      methodContext: jt(s),
      value: e,
      triggerMethod: t
    });
  if (e.type === "setGlobalVariable") {
    await Cn({
      withTriggerParamsVariable: c,
      withTriggerParamsContext: l,
      store: s,
      value: e
    });
    return;
  }
  if (e.type === "openLink") {
    await Pn({
      withTriggerParamsVariable: c,
      withTriggerParamsContext: l,
      value: e
    });
    return;
  }
}
function Tn(e, t, n, a) {
  var l;
  const i = {
    ...t
  }, s = {
    ...n
  };
  if ((l = e == null ? void 0 : e.params) != null && l.length) {
    const c = {
      type: "object",
      label: "函数入参",
      prototype: {},
      apiName: "_params"
    }, f = {};
    e.params.forEach((m, p) => {
      c.prototype[p] = m, f[p] = a == null ? void 0 : a[p];
    }), i._params = c, s._params = f;
  }
  return {
    withTriggerParamsVariable: i,
    withTriggerParamsContext: s
  };
}
export {
  Ln as EventFlowSetter,
  Wn as EventSetter,
  zn as executeEvent
};
