import {
  d as f
} from "./chunk-IXWND6JI.js";
import {
  a as i
} from "./chunk-IO47FP3U.js";

// src/actions/runtime/configureActions.ts
var c = {
  depth: 10,
  clearOnStoryChange: !0,
  limit: 50
}, S = /* @__PURE__ */ i((n = {}) => {
  Object.assign(c, n);
}, "configureActions");

// src/actions/runtime/action.ts
import { ImplicitActionsDuringRendering as b } from "storybook/internal/preview-errors";
import { global as y } from "@storybook/global";
import { addons as v } from "storybook/preview-api";
var d = /* @__PURE__ */ i((n, o) => {
  let t = Object.getPrototypeOf(n);
  return !t || o(t) ? t : d(t, o);
}, "findProto"), E = /* @__PURE__ */ i((n) => !!(typeof n == "object" && n && d(n, (o) => /^Synthetic(?:Base)?Event$/.test(o.constructor.name)) && typeof n.persist == "function"), "isReactSyntheticEvent"), j = /* @__PURE__ */ i((n) => {
  if (E(n)) {
    let o = Object.create(
      n.constructor.prototype,
      Object.getOwnPropertyDescriptors(n)
    );
    o.persist();
    let t = Object.getOwnPropertyDescriptor(o, "view"), e = t?.value;
    return typeof e == "object" && e?.constructor.name === "Window" && Object.defineProperty(o, "view", {
      ...t,
      value: Object.create(e.constructor.prototype)
    }), o;
  }
  return n;
}, "serializeArg");
function u(n, o = {}) {
  let t = {
    ...c,
    ...o
  }, e = /* @__PURE__ */ i(function(...r) {
    if (o.implicit) {
      let l = ("__STORYBOOK_PREVIEW__" in y ? y.__STORYBOOK_PREVIEW__ : void 0)?.storyRenders.find(
        (s) => s.phase === "playing" || s.phase === "rendering"
      );
      if (l) {
        let s = !globalThis?.FEATURES?.disallowImplicitActionsInRenderV8, m = new b({
          phase: l.phase,
          name: n,
          deprecated: s
        });
        if (s)
          console.warn(m);
        else
          throw m;
      }
    }
    let g = v.getChannel(), h = Date.now().toString(36) + Math.random().toString(36).substring(2), O = 5, a = r.map(j), A = r.length > 1 ? a : a[0], w = {
      id: h,
      count: 0,
      data: { name: n, args: A },
      options: {
        ...t,
        maxDepth: O + (t.depth || 3)
      }
    };
    g.emit(f, w);
  }, "actionHandler");
  return e.isAction = !0, e.implicit = o.implicit, e;
}
i(u, "action");

// src/actions/runtime/actions.ts
var z = /* @__PURE__ */ i((...n) => {
  let o = c, t = n;
  t.length === 1 && Array.isArray(t[0]) && ([t] = t), t.length !== 1 && typeof t[t.length - 1] != "string" && (o = {
    ...c,
    ...t.pop()
  });
  let e = t[0];
  (t.length !== 1 || typeof e == "string") && (e = {}, t.forEach((r) => {
    e[r] = r;
  }));
  let p = {};
  return Object.keys(e).forEach((r) => {
    p[r] = u(e[r], o);
  }), p;
}, "actions");

export {
  c as a,
  S as b,
  u as c,
  z as d
};
