const h$a = window.wp.element.createContext(null), c$d = {
  didCatch: false,
  error: null
};
let m$5 = class m extends window.wp.element.Component {
  constructor(e2) {
    super(e2), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = c$d;
  }
  static getDerivedStateFromError(e2) {
    return { didCatch: true, error: e2 };
  }
  resetErrorBoundary(...e2) {
    const { error: t2 } = this.state;
    t2 !== null && (this.props.onReset?.({
      args: e2,
      reason: "imperative-api"
    }), this.setState(c$d));
  }
  componentDidCatch(e2, t2) {
    this.props.onError?.(e2, t2);
  }
  componentDidUpdate(e2, t2) {
    const { didCatch: o4 } = this.state, { resetKeys: s2 } = this.props;
    o4 && t2.error !== null && C$9(e2.resetKeys, s2) && (this.props.onReset?.({
      next: s2,
      prev: e2.resetKeys,
      reason: "keys"
    }), this.setState(c$d));
  }
  render() {
    const { children: e2, fallbackRender: t2, FallbackComponent: o4, fallback: s2 } = this.props, { didCatch: n2, error: a3 } = this.state;
    let i2 = e2;
    if (n2) {
      const u2 = {
        error: a3,
        resetErrorBoundary: this.resetErrorBoundary
      };
      if (typeof t2 == "function")
        i2 = t2(u2);
      else if (o4)
        i2 = window.wp.element.createElement(o4, u2);
      else if (s2 !== void 0)
        i2 = s2;
      else
        throw a3;
    }
    return window.wp.element.createElement(
      h$a.Provider,
      {
        value: {
          didCatch: n2,
          error: a3,
          resetErrorBoundary: this.resetErrorBoundary
        }
      },
      i2
    );
  }
};
function C$9(r2 = [], e2 = []) {
  return r2.length !== e2.length || r2.some((t2, o4) => !Object.is(t2, e2[o4]));
}
var PopStateEventType = "popstate";
function isLocation(obj) {
  return typeof obj === "object" && obj != null && "pathname" in obj && "search" in obj && "hash" in obj && "state" in obj && "key" in obj;
}
function createHashHistory(options = {}) {
  function createHashLocation(window2, globalHistory) {
    let {
      pathname = "/",
      search = "",
      hash = ""
    } = parsePath(window2.location.hash.substring(1));
    if (!pathname.startsWith("/") && !pathname.startsWith(".")) {
      pathname = "/" + pathname;
    }
    return createLocation(
      "",
      { pathname, search, hash },
      // state defaults to `null` because `window.history.state` does
      globalHistory.state && globalHistory.state.usr || null,
      globalHistory.state && globalHistory.state.key || "default"
    );
  }
  function createHashHref(window2, to) {
    let base = window2.document.querySelector("base");
    let href = "";
    if (base && base.getAttribute("href")) {
      let url = window2.location.href;
      let hashIndex = url.indexOf("#");
      href = hashIndex === -1 ? url : url.slice(0, hashIndex);
    }
    return href + "#" + (typeof to === "string" ? to : createPath(to));
  }
  function validateHashLocation(location, to) {
    warning(
      location.pathname.charAt(0) === "/",
      `relative pathnames are not supported in hash history.push(${JSON.stringify(
        to
      )})`
    );
  }
  return getUrlBasedHistory(
    createHashLocation,
    createHashHref,
    validateHashLocation,
    options
  );
}
function invariant(value, message) {
  if (value === false || value === null || typeof value === "undefined") {
    throw new Error(message);
  }
}
function warning(cond, message) {
  if (!cond) {
    if (typeof console !== "undefined") console.warn(message);
    try {
      throw new Error(message);
    } catch (e2) {
    }
  }
}
function createKey() {
  return Math.random().toString(36).substring(2, 10);
}
function getHistoryState(location, index2) {
  return {
    usr: location.state,
    key: location.key,
    idx: index2,
    masked: location.unstable_mask ? {
      pathname: location.pathname,
      search: location.search,
      hash: location.hash
    } : void 0
  };
}
function createLocation(current, to, state = null, key, unstable_mask) {
  let location = {
    pathname: typeof current === "string" ? current : current.pathname,
    search: "",
    hash: "",
    ...typeof to === "string" ? parsePath(to) : to,
    state,
    // TODO: This could be cleaned up.  push/replace should probably just take
    // full Locations now and avoid the need to run through this flow at all
    // But that's a pretty big refactor to the current test suite so going to
    // keep as is for the time being and just let any incoming keys take precedence
    key: to && to.key || key || createKey(),
    unstable_mask
  };
  return location;
}
function createPath({
  pathname = "/",
  search = "",
  hash = ""
}) {
  if (search && search !== "?")
    pathname += search.charAt(0) === "?" ? search : "?" + search;
  if (hash && hash !== "#")
    pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
  return pathname;
}
function parsePath(path) {
  let parsedPath = {};
  if (path) {
    let hashIndex = path.indexOf("#");
    if (hashIndex >= 0) {
      parsedPath.hash = path.substring(hashIndex);
      path = path.substring(0, hashIndex);
    }
    let searchIndex = path.indexOf("?");
    if (searchIndex >= 0) {
      parsedPath.search = path.substring(searchIndex);
      path = path.substring(0, searchIndex);
    }
    if (path) {
      parsedPath.pathname = path;
    }
  }
  return parsedPath;
}
function getUrlBasedHistory(getLocation, createHref2, validateLocation, options = {}) {
  let { window: window2 = document.defaultView, v5Compat = false } = options;
  let globalHistory = window2.history;
  let action = "POP";
  let listener = null;
  let index2 = getIndex();
  if (index2 == null) {
    index2 = 0;
    globalHistory.replaceState({ ...globalHistory.state, idx: index2 }, "");
  }
  function getIndex() {
    let state = globalHistory.state || { idx: null };
    return state.idx;
  }
  function handlePop() {
    action = "POP";
    let nextIndex = getIndex();
    let delta = nextIndex == null ? null : nextIndex - index2;
    index2 = nextIndex;
    if (listener) {
      listener({ action, location: history.location, delta });
    }
  }
  function push(to, state) {
    action = "PUSH";
    let location = isLocation(to) ? to : createLocation(history.location, to, state);
    if (validateLocation) validateLocation(location, to);
    index2 = getIndex() + 1;
    let historyState = getHistoryState(location, index2);
    let url = history.createHref(location.unstable_mask || location);
    try {
      globalHistory.pushState(historyState, "", url);
    } catch (error) {
      if (error instanceof DOMException && error.name === "DataCloneError") {
        throw error;
      }
      window2.location.assign(url);
    }
    if (v5Compat && listener) {
      listener({ action, location: history.location, delta: 1 });
    }
  }
  function replace2(to, state) {
    action = "REPLACE";
    let location = isLocation(to) ? to : createLocation(history.location, to, state);
    if (validateLocation) validateLocation(location, to);
    index2 = getIndex();
    let historyState = getHistoryState(location, index2);
    let url = history.createHref(location.unstable_mask || location);
    globalHistory.replaceState(historyState, "", url);
    if (v5Compat && listener) {
      listener({ action, location: history.location, delta: 0 });
    }
  }
  function createURL(to) {
    return createBrowserURLImpl(to);
  }
  let history = {
    get action() {
      return action;
    },
    get location() {
      return getLocation(window2, globalHistory);
    },
    listen(fn) {
      if (listener) {
        throw new Error("A history only accepts one active listener");
      }
      window2.addEventListener(PopStateEventType, handlePop);
      listener = fn;
      return () => {
        window2.removeEventListener(PopStateEventType, handlePop);
        listener = null;
      };
    },
    createHref(to) {
      return createHref2(window2, to);
    },
    createURL,
    encodeLocation(to) {
      let url = createURL(to);
      return {
        pathname: url.pathname,
        search: url.search,
        hash: url.hash
      };
    },
    push,
    replace: replace2,
    go(n2) {
      return globalHistory.go(n2);
    }
  };
  return history;
}
function createBrowserURLImpl(to, isAbsolute = false) {
  let base = "http://localhost";
  if (typeof window !== "undefined") {
    base = window.location.origin !== "null" ? window.location.origin : window.location.href;
  }
  invariant(base, "No window.location.(origin|href) available to create URL");
  let href = typeof to === "string" ? to : createPath(to);
  href = href.replace(/ $/, "%20");
  if (!isAbsolute && href.startsWith("//")) {
    href = base + href;
  }
  return new URL(href, base);
}
function matchRoutes(routes, locationArg, basename = "/") {
  return matchRoutesImpl(routes, locationArg, basename, false);
}
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
  let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
  let pathname = stripBasename(location.pathname || "/", basename);
  if (pathname == null) {
    return null;
  }
  let branches = flattenRoutes(routes);
  rankRouteBranches(branches);
  let matches = null;
  for (let i2 = 0; matches == null && i2 < branches.length; ++i2) {
    let decoded = decodePath(pathname);
    matches = matchRouteBranch(
      branches[i2],
      decoded,
      allowPartial
    );
  }
  return matches;
}
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
  let flattenRoute = (route, index2, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
    let meta = {
      relativePath: relativePath === void 0 ? route.path || "" : relativePath,
      caseSensitive: route.caseSensitive === true,
      childrenIndex: index2,
      route
    };
    if (meta.relativePath.startsWith("/")) {
      if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
        return;
      }
      invariant(
        meta.relativePath.startsWith(parentPath),
        `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
      );
      meta.relativePath = meta.relativePath.slice(parentPath.length);
    }
    let path = joinPaths([parentPath, meta.relativePath]);
    let routesMeta = parentsMeta.concat(meta);
    if (route.children && route.children.length > 0) {
      invariant(
        // Our types know better, but runtime JS may not!
        // @ts-expect-error
        route.index !== true,
        `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
      );
      flattenRoutes(
        route.children,
        branches,
        routesMeta,
        path,
        hasParentOptionalSegments
      );
    }
    if (route.path == null && !route.index) {
      return;
    }
    branches.push({
      path,
      score: computeScore(path, route.index),
      routesMeta
    });
  };
  routes.forEach((route, index2) => {
    if (route.path === "" || !route.path?.includes("?")) {
      flattenRoute(route, index2);
    } else {
      for (let exploded of explodeOptionalSegments(route.path)) {
        flattenRoute(route, index2, true, exploded);
      }
    }
  });
  return branches;
}
function explodeOptionalSegments(path) {
  let segments = path.split("/");
  if (segments.length === 0) return [];
  let [first, ...rest] = segments;
  let isOptional = first.endsWith("?");
  let required = first.replace(/\?$/, "");
  if (rest.length === 0) {
    return isOptional ? [required, ""] : [required];
  }
  let restExploded = explodeOptionalSegments(rest.join("/"));
  let result = [];
  result.push(
    ...restExploded.map(
      (subpath) => subpath === "" ? required : [required, subpath].join("/")
    )
  );
  if (isOptional) {
    result.push(...restExploded);
  }
  return result.map(
    (exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
  );
}
function rankRouteBranches(branches) {
  branches.sort(
    (a3, b2) => a3.score !== b2.score ? b2.score - a3.score : compareIndexes(
      a3.routesMeta.map((meta) => meta.childrenIndex),
      b2.routesMeta.map((meta) => meta.childrenIndex)
    )
  );
}
var paramRe = /^:[\w-]+$/;
var dynamicSegmentValue = 3;
var indexRouteValue = 2;
var emptySegmentValue = 1;
var staticSegmentValue = 10;
var splatPenalty = -2;
var isSplat = (s2) => s2 === "*";
function computeScore(path, index2) {
  let segments = path.split("/");
  let initialScore = segments.length;
  if (segments.some(isSplat)) {
    initialScore += splatPenalty;
  }
  if (index2) {
    initialScore += indexRouteValue;
  }
  return segments.filter((s2) => !isSplat(s2)).reduce(
    (score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
    initialScore
  );
}
function compareIndexes(a3, b2) {
  let siblings = a3.length === b2.length && a3.slice(0, -1).every((n2, i2) => n2 === b2[i2]);
  return siblings ? (
    // If two routes are siblings, we should try to match the earlier sibling
    // first. This allows people to have fine-grained control over the matching
    // behavior by simply putting routes with identical paths in the order they
    // want them tried.
    a3[a3.length - 1] - b2[b2.length - 1]
  ) : (
    // Otherwise, it doesn't really make sense to rank non-siblings by index,
    // so they sort equally.
    0
  );
}
function matchRouteBranch(branch, pathname, allowPartial = false) {
  let { routesMeta } = branch;
  let matchedParams = {};
  let matchedPathname = "/";
  let matches = [];
  for (let i2 = 0; i2 < routesMeta.length; ++i2) {
    let meta = routesMeta[i2];
    let end = i2 === routesMeta.length - 1;
    let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
    let match = matchPath(
      { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
      remainingPathname
    );
    let route = meta.route;
    if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
      match = matchPath(
        {
          path: meta.relativePath,
          caseSensitive: meta.caseSensitive,
          end: false
        },
        remainingPathname
      );
    }
    if (!match) {
      return null;
    }
    Object.assign(matchedParams, match.params);
    matches.push({
      // TODO: Can this as be avoided?
      params: matchedParams,
      pathname: joinPaths([matchedPathname, match.pathname]),
      pathnameBase: normalizePathname(
        joinPaths([matchedPathname, match.pathnameBase])
      ),
      route
    });
    if (match.pathnameBase !== "/") {
      matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
    }
  }
  return matches;
}
function matchPath(pattern, pathname) {
  if (typeof pattern === "string") {
    pattern = { path: pattern, caseSensitive: false, end: true };
  }
  let [matcher, compiledParams] = compilePath(
    pattern.path,
    pattern.caseSensitive,
    pattern.end
  );
  let match = pathname.match(matcher);
  if (!match) return null;
  let matchedPathname = match[0];
  let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
  let captureGroups = match.slice(1);
  let params = compiledParams.reduce(
    (memo2, { paramName, isOptional }, index2) => {
      if (paramName === "*") {
        let splatValue = captureGroups[index2] || "";
        pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
      }
      const value = captureGroups[index2];
      if (isOptional && !value) {
        memo2[paramName] = void 0;
      } else {
        memo2[paramName] = (value || "").replace(/%2F/g, "/");
      }
      return memo2;
    },
    {}
  );
  return {
    params,
    pathname: matchedPathname,
    pathnameBase,
    pattern
  };
}
function compilePath(path, caseSensitive = false, end = true) {
  warning(
    path === "*" || !path.endsWith("*") || path.endsWith("/*"),
    `Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
  );
  let params = [];
  let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
    /\/:([\w-]+)(\?)?/g,
    (match, paramName, isOptional, index2, str) => {
      params.push({ paramName, isOptional: isOptional != null });
      if (isOptional) {
        let nextChar = str.charAt(index2 + match.length);
        if (nextChar && nextChar !== "/") {
          return "/([^\\/]*)";
        }
        return "(?:/([^\\/]*))?";
      }
      return "/([^\\/]+)";
    }
  ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
  if (path.endsWith("*")) {
    params.push({ paramName: "*" });
    regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
  } else if (end) {
    regexpSource += "\\/*$";
  } else if (path !== "" && path !== "/") {
    regexpSource += "(?:(?=\\/|$))";
  } else ;
  let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
  return [matcher, params];
}
function decodePath(value) {
  try {
    return value.split("/").map((v2) => decodeURIComponent(v2).replace(/\//g, "%2F")).join("/");
  } catch (error) {
    warning(
      false,
      `The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
    );
    return value;
  }
}
function stripBasename(pathname, basename) {
  if (basename === "/") return pathname;
  if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
    return null;
  }
  let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
  let nextChar = pathname.charAt(startIndex);
  if (nextChar && nextChar !== "/") {
    return null;
  }
  return pathname.slice(startIndex) || "/";
}
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
function resolvePath(to, fromPathname = "/") {
  let {
    pathname: toPathname,
    search = "",
    hash = ""
  } = typeof to === "string" ? parsePath(to) : to;
  let pathname;
  if (toPathname) {
    toPathname = removeDoubleSlashes(toPathname);
    if (toPathname.startsWith("/")) {
      pathname = resolvePathname(toPathname.substring(1), "/");
    } else {
      pathname = resolvePathname(toPathname, fromPathname);
    }
  } else {
    pathname = fromPathname;
  }
  return {
    pathname,
    search: normalizeSearch(search),
    hash: normalizeHash(hash)
  };
}
function resolvePathname(relativePath, fromPathname) {
  let segments = removeTrailingSlash(fromPathname).split("/");
  let relativeSegments = relativePath.split("/");
  relativeSegments.forEach((segment) => {
    if (segment === "..") {
      if (segments.length > 1) segments.pop();
    } else if (segment !== ".") {
      segments.push(segment);
    }
  });
  return segments.length > 1 ? segments.join("/") : "/";
}
function getInvalidPathError(char, field, dest, path) {
  return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
    path
  )}].  Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
}
function getPathContributingMatches(matches) {
  return matches.filter(
    (match, index2) => index2 === 0 || match.route.path && match.route.path.length > 0
  );
}
function getResolveToMatches(matches) {
  let pathMatches = getPathContributingMatches(matches);
  return pathMatches.map(
    (match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
  );
}
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
  let to;
  if (typeof toArg === "string") {
    to = parsePath(toArg);
  } else {
    to = { ...toArg };
    invariant(
      !to.pathname || !to.pathname.includes("?"),
      getInvalidPathError("?", "pathname", "search", to)
    );
    invariant(
      !to.pathname || !to.pathname.includes("#"),
      getInvalidPathError("#", "pathname", "hash", to)
    );
    invariant(
      !to.search || !to.search.includes("#"),
      getInvalidPathError("#", "search", "hash", to)
    );
  }
  let isEmptyPath = toArg === "" || to.pathname === "";
  let toPathname = isEmptyPath ? "/" : to.pathname;
  let from;
  if (toPathname == null) {
    from = locationPathname;
  } else {
    let routePathnameIndex = routePathnames.length - 1;
    if (!isPathRelative && toPathname.startsWith("..")) {
      let toSegments = toPathname.split("/");
      while (toSegments[0] === "..") {
        toSegments.shift();
        routePathnameIndex -= 1;
      }
      to.pathname = toSegments.join("/");
    }
    from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
  }
  let path = resolvePath(to, from);
  let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
  let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
  if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
    path.pathname += "/";
  }
  return path;
}
var removeDoubleSlashes = (path) => path.replace(/\/\/+/g, "/");
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
var ErrorResponseImpl = class {
  constructor(status, statusText, data2, internal = false) {
    this.status = status;
    this.statusText = statusText || "";
    this.internal = internal;
    if (data2 instanceof Error) {
      this.data = data2.toString();
      this.error = data2;
    } else {
      this.data = data2;
    }
  }
};
function isRouteErrorResponse(error) {
  return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
}
function getRoutePattern(matches) {
  let parts = matches.map((m3) => m3.route.path).filter(Boolean);
  return joinPaths(parts) || "/";
}
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
function parseToInfo(_to, basename) {
  let to = _to;
  if (typeof to !== "string" || !ABSOLUTE_URL_REGEX.test(to)) {
    return {
      absoluteURL: void 0,
      isExternal: false,
      to
    };
  }
  let absoluteURL = to;
  let isExternal = false;
  if (isBrowser) {
    try {
      let currentUrl = new URL(window.location.href);
      let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
      let path = stripBasename(targetUrl.pathname, basename);
      if (targetUrl.origin === currentUrl.origin && path != null) {
        to = path + targetUrl.search + targetUrl.hash;
      } else {
        isExternal = true;
      }
    } catch (e2) {
      warning(
        false,
        `<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
      );
    }
  }
  return {
    absoluteURL,
    isExternal,
    to
  };
}
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
var validMutationMethodsArr = [
  "POST",
  "PUT",
  "PATCH",
  "DELETE"
];
new Set(
  validMutationMethodsArr
);
var validRequestMethodsArr = [
  "GET",
  ...validMutationMethodsArr
];
new Set(validRequestMethodsArr);
var DataRouterContext = window.wp.element.createContext(null);
DataRouterContext.displayName = "DataRouter";
var DataRouterStateContext = window.wp.element.createContext(null);
DataRouterStateContext.displayName = "DataRouterState";
var RSCRouterContext = window.wp.element.createContext(false);
function useIsRSCRouterContext() {
  return window.wp.element.useContext(RSCRouterContext);
}
var ViewTransitionContext = window.wp.element.createContext({
  isTransitioning: false
});
ViewTransitionContext.displayName = "ViewTransition";
var FetchersContext = window.wp.element.createContext(
  /* @__PURE__ */ new Map()
);
FetchersContext.displayName = "Fetchers";
var AwaitContext = window.wp.element.createContext(null);
AwaitContext.displayName = "Await";
var NavigationContext = window.wp.element.createContext(
  null
);
NavigationContext.displayName = "Navigation";
var LocationContext = window.wp.element.createContext(
  null
);
LocationContext.displayName = "Location";
var RouteContext = window.wp.element.createContext({
  outlet: null,
  matches: [],
  isDataRoute: false
});
RouteContext.displayName = "Route";
var RouteErrorContext = window.wp.element.createContext(null);
RouteErrorContext.displayName = "RouteError";
var ERROR_DIGEST_BASE = "REACT_ROUTER_ERROR";
var ERROR_DIGEST_REDIRECT = "REDIRECT";
var ERROR_DIGEST_ROUTE_ERROR_RESPONSE = "ROUTE_ERROR_RESPONSE";
function decodeRedirectErrorDigest(digest) {
  if (digest.startsWith(`${ERROR_DIGEST_BASE}:${ERROR_DIGEST_REDIRECT}:{`)) {
    try {
      let parsed = JSON.parse(digest.slice(28));
      if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string" && typeof parsed.location === "string" && typeof parsed.reloadDocument === "boolean" && typeof parsed.replace === "boolean") {
        return parsed;
      }
    } catch {
    }
  }
}
function decodeRouteErrorResponseDigest(digest) {
  if (digest.startsWith(
    `${ERROR_DIGEST_BASE}:${ERROR_DIGEST_ROUTE_ERROR_RESPONSE}:{`
  )) {
    try {
      let parsed = JSON.parse(digest.slice(40));
      if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string") {
        return new ErrorResponseImpl(
          parsed.status,
          parsed.statusText,
          parsed.data
        );
      }
    } catch {
    }
  }
}
function useHref(to, { relative } = {}) {
  invariant(
    useInRouterContext(),
    // TODO: This error is probably because they somehow have 2 versions of the
    // router loaded. We can help them understand how to avoid that.
    `useHref() may be used only in the context of a <Router> component.`
  );
  let { basename, navigator: navigator2 } = window.wp.element.useContext(NavigationContext);
  let { hash, pathname, search } = useResolvedPath(to, { relative });
  let joinedPathname = pathname;
  if (basename !== "/") {
    joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
  }
  return navigator2.createHref({ pathname: joinedPathname, search, hash });
}
function useInRouterContext() {
  return window.wp.element.useContext(LocationContext) != null;
}
function useLocation() {
  invariant(
    useInRouterContext(),
    // TODO: This error is probably because they somehow have 2 versions of the
    // router loaded. We can help them understand how to avoid that.
    `useLocation() may be used only in the context of a <Router> component.`
  );
  return window.wp.element.useContext(LocationContext).location;
}
var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
function useIsomorphicLayoutEffect(cb) {
  let isStatic = window.wp.element.useContext(NavigationContext).static;
  if (!isStatic) {
    window.wp.element.useLayoutEffect(cb);
  }
}
function useNavigate() {
  let { isDataRoute } = window.wp.element.useContext(RouteContext);
  return isDataRoute ? useNavigateStable() : useNavigateUnstable();
}
function useNavigateUnstable() {
  invariant(
    useInRouterContext(),
    // TODO: This error is probably because they somehow have 2 versions of the
    // router loaded. We can help them understand how to avoid that.
    `useNavigate() may be used only in the context of a <Router> component.`
  );
  let dataRouterContext = window.wp.element.useContext(DataRouterContext);
  let { basename, navigator: navigator2 } = window.wp.element.useContext(NavigationContext);
  let { matches } = window.wp.element.useContext(RouteContext);
  let { pathname: locationPathname } = useLocation();
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
  let activeRef = window.wp.element.useRef(false);
  useIsomorphicLayoutEffect(() => {
    activeRef.current = true;
  });
  let navigate = window.wp.element.useCallback(
    (to, options = {}) => {
      warning(activeRef.current, navigateEffectWarning);
      if (!activeRef.current) return;
      if (typeof to === "number") {
        navigator2.go(to);
        return;
      }
      let path = resolveTo(
        to,
        JSON.parse(routePathnamesJson),
        locationPathname,
        options.relative === "path"
      );
      if (dataRouterContext == null && basename !== "/") {
        path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
      }
      (!!options.replace ? navigator2.replace : navigator2.push)(
        path,
        options.state,
        options
      );
    },
    [
      basename,
      navigator2,
      routePathnamesJson,
      locationPathname,
      dataRouterContext
    ]
  );
  return navigate;
}
window.wp.element.createContext(null);
function useParams() {
  let { matches } = window.wp.element.useContext(RouteContext);
  let routeMatch = matches[matches.length - 1];
  return routeMatch ? routeMatch.params : {};
}
function useResolvedPath(to, { relative } = {}) {
  let { matches } = window.wp.element.useContext(RouteContext);
  let { pathname: locationPathname } = useLocation();
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
  return window.wp.element.useMemo(
    () => resolveTo(
      to,
      JSON.parse(routePathnamesJson),
      locationPathname,
      relative === "path"
    ),
    [to, routePathnamesJson, locationPathname, relative]
  );
}
function useRoutes(routes, locationArg) {
  return useRoutesImpl(routes, locationArg);
}
function useRoutesImpl(routes, locationArg, dataRouterOpts) {
  invariant(
    useInRouterContext(),
    // TODO: This error is probably because they somehow have 2 versions of the
    // router loaded. We can help them understand how to avoid that.
    `useRoutes() may be used only in the context of a <Router> component.`
  );
  let { navigator: navigator2 } = window.wp.element.useContext(NavigationContext);
  let { matches: parentMatches } = window.wp.element.useContext(RouteContext);
  let routeMatch = parentMatches[parentMatches.length - 1];
  let parentParams = routeMatch ? routeMatch.params : {};
  let parentPathname = routeMatch ? routeMatch.pathname : "/";
  let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
  let parentRoute = routeMatch && routeMatch.route;
  {
    let parentPath = parentRoute && parentRoute.path || "";
    warningOnce(
      parentPathname,
      !parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
      `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
    );
  }
  let locationFromContext = useLocation();
  let location;
  if (locationArg) {
    let parsedLocationArg = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
    invariant(
      parentPathnameBase === "/" || parsedLocationArg.pathname?.startsWith(parentPathnameBase),
      `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${parentPathnameBase}" but pathname "${parsedLocationArg.pathname}" was given in the \`location\` prop.`
    );
    location = parsedLocationArg;
  } else {
    location = locationFromContext;
  }
  let pathname = location.pathname || "/";
  let remainingPathname = pathname;
  if (parentPathnameBase !== "/") {
    let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
    let segments = pathname.replace(/^\//, "").split("/");
    remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
  }
  let matches = matchRoutes(routes, { pathname: remainingPathname });
  {
    warning(
      parentRoute || matches != null,
      `No routes matched location "${location.pathname}${location.search}${location.hash}" `
    );
    warning(
      matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
      `Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
    );
  }
  let renderedMatches = _renderMatches(
    matches && matches.map(
      (match) => Object.assign({}, match, {
        params: Object.assign({}, parentParams, match.params),
        pathname: joinPaths([
          parentPathnameBase,
          // Re-encode pathnames that were decoded inside matchRoutes.
          // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
          // `new URL()` internally and we need to prevent it from treating
          // them as separators
          navigator2.encodeLocation ? navigator2.encodeLocation(
            match.pathname.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
          ).pathname : match.pathname
        ]),
        pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
          parentPathnameBase,
          // Re-encode pathnames that were decoded inside matchRoutes
          // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
          // `new URL()` internally and we need to prevent it from treating
          // them as separators
          navigator2.encodeLocation ? navigator2.encodeLocation(
            match.pathnameBase.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
          ).pathname : match.pathnameBase
        ])
      })
    ),
    parentMatches,
    dataRouterOpts
  );
  if (locationArg && renderedMatches) {
    return /* @__PURE__ */ window.wp.element.createElement(
      LocationContext.Provider,
      {
        value: {
          location: {
            pathname: "/",
            search: "",
            hash: "",
            state: null,
            key: "default",
            unstable_mask: void 0,
            ...location
          },
          navigationType: "POP"
          /* Pop */
        }
      },
      renderedMatches
    );
  }
  return renderedMatches;
}
function DefaultErrorComponent() {
  let error = useRouteError();
  let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
  let stack = error instanceof Error ? error.stack : null;
  let lightgrey = "rgba(200,200,200, 0.5)";
  let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
  let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
  let devInfo = null;
  {
    console.error(
      "Error handled by React Router default ErrorBoundary:",
      error
    );
    devInfo = /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ window.wp.element.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ window.wp.element.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ window.wp.element.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
  }
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ window.wp.element.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ window.wp.element.createElement("pre", { style: preStyles }, stack) : null, devInfo);
}
var defaultErrorElement = /* @__PURE__ */ window.wp.element.createElement(DefaultErrorComponent, null);
var RenderErrorBoundary = class extends window.wp.element.Component {
  constructor(props) {
    super(props);
    this.state = {
      location: props.location,
      revalidation: props.revalidation,
      error: props.error
    };
  }
  static getDerivedStateFromError(error) {
    return { error };
  }
  static getDerivedStateFromProps(props, state) {
    if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
      return {
        error: props.error,
        location: props.location,
        revalidation: props.revalidation
      };
    }
    return {
      error: props.error !== void 0 ? props.error : state.error,
      location: state.location,
      revalidation: props.revalidation || state.revalidation
    };
  }
  componentDidCatch(error, errorInfo) {
    if (this.props.onError) {
      this.props.onError(error, errorInfo);
    } else {
      console.error(
        "React Router caught the following error during render",
        error
      );
    }
  }
  render() {
    let error = this.state.error;
    if (this.context && typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
      const decoded = decodeRouteErrorResponseDigest(error.digest);
      if (decoded) error = decoded;
    }
    let result = error !== void 0 ? /* @__PURE__ */ window.wp.element.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ window.wp.element.createElement(
      RouteErrorContext.Provider,
      {
        value: error,
        children: this.props.component
      }
    )) : this.props.children;
    if (this.context) {
      return /* @__PURE__ */ window.wp.element.createElement(RSCErrorHandler, { error }, result);
    }
    return result;
  }
};
RenderErrorBoundary.contextType = RSCRouterContext;
var errorRedirectHandledMap = /* @__PURE__ */ new WeakMap();
function RSCErrorHandler({
  children,
  error
}) {
  let { basename } = window.wp.element.useContext(NavigationContext);
  if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
    let redirect2 = decodeRedirectErrorDigest(error.digest);
    if (redirect2) {
      let existingRedirect = errorRedirectHandledMap.get(error);
      if (existingRedirect) throw existingRedirect;
      let parsed = parseToInfo(redirect2.location, basename);
      if (isBrowser && !errorRedirectHandledMap.get(error)) {
        if (parsed.isExternal || redirect2.reloadDocument) {
          window.location.href = parsed.absoluteURL || parsed.to;
        } else {
          const redirectPromise = Promise.resolve().then(
            () => window.__reactRouterDataRouter.navigate(parsed.to, {
              replace: redirect2.replace
            })
          );
          errorRedirectHandledMap.set(error, redirectPromise);
          throw redirectPromise;
        }
      }
      return /* @__PURE__ */ window.wp.element.createElement(
        "meta",
        {
          httpEquiv: "refresh",
          content: `0;url=${parsed.absoluteURL || parsed.to}`
        }
      );
    }
  }
  return children;
}
function RenderedRoute({ routeContext, match, children }) {
  let dataRouterContext = window.wp.element.useContext(DataRouterContext);
  if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
    dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
  }
  return /* @__PURE__ */ window.wp.element.createElement(RouteContext.Provider, { value: routeContext }, children);
}
function _renderMatches(matches, parentMatches = [], dataRouterOpts) {
  let dataRouterState = dataRouterOpts?.state;
  if (matches == null) {
    if (!dataRouterState) {
      return null;
    }
    if (dataRouterState.errors) {
      matches = dataRouterState.matches;
    } else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
      matches = dataRouterState.matches;
    } else {
      return null;
    }
  }
  let renderedMatches = matches;
  let errors = dataRouterState?.errors;
  if (errors != null) {
    let errorIndex = renderedMatches.findIndex(
      (m3) => m3.route.id && errors?.[m3.route.id] !== void 0
    );
    invariant(
      errorIndex >= 0,
      `Could not find a matching route for errors on route IDs: ${Object.keys(
        errors
      ).join(",")}`
    );
    renderedMatches = renderedMatches.slice(
      0,
      Math.min(renderedMatches.length, errorIndex + 1)
    );
  }
  let renderFallback = false;
  let fallbackIndex = -1;
  if (dataRouterOpts && dataRouterState) {
    renderFallback = dataRouterState.renderFallback;
    for (let i2 = 0; i2 < renderedMatches.length; i2++) {
      let match = renderedMatches[i2];
      if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
        fallbackIndex = i2;
      }
      if (match.route.id) {
        let { loaderData, errors: errors2 } = dataRouterState;
        let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
        if (match.route.lazy || needsToRunLoader) {
          if (dataRouterOpts.isStatic) {
            renderFallback = true;
          }
          if (fallbackIndex >= 0) {
            renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
          } else {
            renderedMatches = [renderedMatches[0]];
          }
          break;
        }
      }
    }
  }
  let onErrorHandler = dataRouterOpts?.onError;
  let onError = dataRouterState && onErrorHandler ? (error, errorInfo) => {
    onErrorHandler(error, {
      location: dataRouterState.location,
      params: dataRouterState.matches?.[0]?.params ?? {},
      unstable_pattern: getRoutePattern(dataRouterState.matches),
      errorInfo
    });
  } : void 0;
  return renderedMatches.reduceRight(
    (outlet, match, index2) => {
      let error;
      let shouldRenderHydrateFallback = false;
      let errorElement = null;
      let hydrateFallbackElement = null;
      if (dataRouterState) {
        error = errors && match.route.id ? errors[match.route.id] : void 0;
        errorElement = match.route.errorElement || defaultErrorElement;
        if (renderFallback) {
          if (fallbackIndex < 0 && index2 === 0) {
            warningOnce(
              "route-fallback",
              false,
              "No `HydrateFallback` element provided to render during initial hydration"
            );
            shouldRenderHydrateFallback = true;
            hydrateFallbackElement = null;
          } else if (fallbackIndex === index2) {
            shouldRenderHydrateFallback = true;
            hydrateFallbackElement = match.route.hydrateFallbackElement || null;
          }
        }
      }
      let matches2 = parentMatches.concat(renderedMatches.slice(0, index2 + 1));
      let getChildren = () => {
        let children;
        if (error) {
          children = errorElement;
        } else if (shouldRenderHydrateFallback) {
          children = hydrateFallbackElement;
        } else if (match.route.Component) {
          children = /* @__PURE__ */ window.wp.element.createElement(match.route.Component, null);
        } else if (match.route.element) {
          children = match.route.element;
        } else {
          children = outlet;
        }
        return /* @__PURE__ */ window.wp.element.createElement(
          RenderedRoute,
          {
            match,
            routeContext: {
              outlet,
              matches: matches2,
              isDataRoute: dataRouterState != null
            },
            children
          }
        );
      };
      return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index2 === 0) ? /* @__PURE__ */ window.wp.element.createElement(
        RenderErrorBoundary,
        {
          location: dataRouterState.location,
          revalidation: dataRouterState.revalidation,
          component: errorElement,
          error,
          children: getChildren(),
          routeContext: { outlet: null, matches: matches2, isDataRoute: true },
          onError
        }
      ) : getChildren();
    },
    null
  );
}
function getDataRouterConsoleError(hookName) {
  return `${hookName} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`;
}
function useDataRouterContext(hookName) {
  let ctx = window.wp.element.useContext(DataRouterContext);
  invariant(ctx, getDataRouterConsoleError(hookName));
  return ctx;
}
function useDataRouterState(hookName) {
  let state = window.wp.element.useContext(DataRouterStateContext);
  invariant(state, getDataRouterConsoleError(hookName));
  return state;
}
function useRouteContext(hookName) {
  let route = window.wp.element.useContext(RouteContext);
  invariant(route, getDataRouterConsoleError(hookName));
  return route;
}
function useCurrentRouteId(hookName) {
  let route = useRouteContext(hookName);
  let thisRoute = route.matches[route.matches.length - 1];
  invariant(
    thisRoute.route.id,
    `${hookName} can only be used on routes that contain a unique "id"`
  );
  return thisRoute.route.id;
}
function useRouteId() {
  return useCurrentRouteId(
    "useRouteId"
    /* UseRouteId */
  );
}
function useRouteError() {
  let error = window.wp.element.useContext(RouteErrorContext);
  let state = useDataRouterState(
    "useRouteError"
    /* UseRouteError */
  );
  let routeId = useCurrentRouteId(
    "useRouteError"
    /* UseRouteError */
  );
  if (error !== void 0) {
    return error;
  }
  return state.errors?.[routeId];
}
function useNavigateStable() {
  let { router } = useDataRouterContext(
    "useNavigate"
    /* UseNavigateStable */
  );
  let id = useCurrentRouteId(
    "useNavigate"
    /* UseNavigateStable */
  );
  let activeRef = window.wp.element.useRef(false);
  useIsomorphicLayoutEffect(() => {
    activeRef.current = true;
  });
  let navigate = window.wp.element.useCallback(
    async (to, options = {}) => {
      warning(activeRef.current, navigateEffectWarning);
      if (!activeRef.current) return;
      if (typeof to === "number") {
        await router.navigate(to);
      } else {
        await router.navigate(to, { fromRouteId: id, ...options });
      }
    },
    [router, id]
  );
  return navigate;
}
var alreadyWarned = {};
function warningOnce(key, cond, message) {
  if (!cond && !alreadyWarned[key]) {
    alreadyWarned[key] = true;
    warning(false, message);
  }
}
var alreadyWarned2 = {};
function warnOnce(condition, message) {
  if (!condition && !alreadyWarned2[message]) {
    alreadyWarned2[message] = true;
    console.warn(message);
  }
}
var USE_OPTIMISTIC = "useOptimistic";
window.wp.element[USE_OPTIMISTIC];
window.wp.element.memo(DataRoutes);
function DataRoutes({
  routes,
  future,
  state,
  isStatic,
  onError
}) {
  return useRoutesImpl(routes, void 0, { state, isStatic, onError });
}
function Navigate({
  to,
  replace: replace2,
  state,
  relative
}) {
  invariant(
    useInRouterContext(),
    // TODO: This error is probably because they somehow have 2 versions of
    // the router loaded. We can help them understand how to avoid that.
    `<Navigate> may be used only in the context of a <Router> component.`
  );
  let { static: isStatic } = window.wp.element.useContext(NavigationContext);
  warning(
    !isStatic,
    `<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
  );
  let { matches } = window.wp.element.useContext(RouteContext);
  let { pathname: locationPathname } = useLocation();
  let navigate = useNavigate();
  let path = resolveTo(
    to,
    getResolveToMatches(matches),
    locationPathname,
    relative === "path"
  );
  let jsonPath = JSON.stringify(path);
  window.wp.element.useEffect(() => {
    navigate(JSON.parse(jsonPath), { replace: replace2, state, relative });
  }, [navigate, jsonPath, relative, replace2, state]);
  return null;
}
function Route(props) {
  invariant(
    false,
    `A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`
  );
}
function Router({
  basename: basenameProp = "/",
  children = null,
  location: locationProp,
  navigationType = "POP",
  navigator: navigator2,
  static: staticProp = false,
  unstable_useTransitions
}) {
  invariant(
    !useInRouterContext(),
    `You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
  );
  let basename = basenameProp.replace(/^\/*/, "/");
  let navigationContext = window.wp.element.useMemo(
    () => ({
      basename,
      navigator: navigator2,
      static: staticProp,
      unstable_useTransitions,
      future: {}
    }),
    [basename, navigator2, staticProp, unstable_useTransitions]
  );
  if (typeof locationProp === "string") {
    locationProp = parsePath(locationProp);
  }
  let {
    pathname = "/",
    search = "",
    hash = "",
    state = null,
    key = "default",
    unstable_mask
  } = locationProp;
  let locationContext = window.wp.element.useMemo(() => {
    let trailingPathname = stripBasename(pathname, basename);
    if (trailingPathname == null) {
      return null;
    }
    return {
      location: {
        pathname: trailingPathname,
        search,
        hash,
        state,
        key,
        unstable_mask
      },
      navigationType
    };
  }, [
    basename,
    pathname,
    search,
    hash,
    state,
    key,
    navigationType,
    unstable_mask
  ]);
  warning(
    locationContext != null,
    `<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
  );
  if (locationContext == null) {
    return null;
  }
  return /* @__PURE__ */ window.wp.element.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ window.wp.element.createElement(LocationContext.Provider, { children, value: locationContext }));
}
function Routes({
  children,
  location
}) {
  return useRoutes(createRoutesFromChildren(children), location);
}
(class extends window.wp.element.Component {
  constructor(props) {
    super(props);
    this.state = { error: null };
  }
  static getDerivedStateFromError(error) {
    return { error };
  }
  componentDidCatch(error, errorInfo) {
    if (this.props.onError) {
      this.props.onError(error, errorInfo);
    } else {
      console.error(
        "<Await> caught the following error during render",
        error,
        errorInfo
      );
    }
  }
  render() {
    let { children, errorElement, resolve } = this.props;
    let promise = null;
    let status = 0;
    if (!(resolve instanceof Promise)) {
      status = 1;
      promise = Promise.resolve();
      Object.defineProperty(promise, "_tracked", { get: () => true });
      Object.defineProperty(promise, "_data", { get: () => resolve });
    } else if (this.state.error) {
      status = 2;
      let renderError = this.state.error;
      promise = Promise.reject().catch(() => {
      });
      Object.defineProperty(promise, "_tracked", { get: () => true });
      Object.defineProperty(promise, "_error", { get: () => renderError });
    } else if (resolve._tracked) {
      promise = resolve;
      status = "_error" in promise ? 2 : "_data" in promise ? 1 : 0;
    } else {
      status = 0;
      Object.defineProperty(resolve, "_tracked", { get: () => true });
      promise = resolve.then(
        (data2) => Object.defineProperty(resolve, "_data", { get: () => data2 }),
        (error) => {
          this.props.onError?.(error);
          Object.defineProperty(resolve, "_error", { get: () => error });
        }
      );
    }
    if (status === 2 && !errorElement) {
      throw promise._error;
    }
    if (status === 2) {
      return /* @__PURE__ */ window.wp.element.createElement(AwaitContext.Provider, { value: promise, children: errorElement });
    }
    if (status === 1) {
      return /* @__PURE__ */ window.wp.element.createElement(AwaitContext.Provider, { value: promise, children });
    }
    throw promise;
  }
});
function createRoutesFromChildren(children, parentPath = []) {
  let routes = [];
  window.wp.element.Children.forEach(children, (element, index2) => {
    if (!window.wp.element.isValidElement(element)) {
      return;
    }
    let treePath = [...parentPath, index2];
    if (element.type === window.wp.element.Fragment) {
      routes.push.apply(
        routes,
        createRoutesFromChildren(element.props.children, treePath)
      );
      return;
    }
    invariant(
      element.type === Route,
      `[${typeof element.type === "string" ? element.type : element.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
    );
    invariant(
      !element.props.index || !element.props.children,
      "An index route cannot have child routes."
    );
    let route = {
      id: element.props.id || treePath.join("-"),
      caseSensitive: element.props.caseSensitive,
      element: element.props.element,
      Component: element.props.Component,
      index: element.props.index,
      path: element.props.path,
      middleware: element.props.middleware,
      loader: element.props.loader,
      action: element.props.action,
      hydrateFallbackElement: element.props.hydrateFallbackElement,
      HydrateFallback: element.props.HydrateFallback,
      errorElement: element.props.errorElement,
      ErrorBoundary: element.props.ErrorBoundary,
      hasErrorBoundary: element.props.hasErrorBoundary === true || element.props.ErrorBoundary != null || element.props.errorElement != null,
      shouldRevalidate: element.props.shouldRevalidate,
      handle: element.props.handle,
      lazy: element.props.lazy
    };
    if (element.props.children) {
      route.children = createRoutesFromChildren(
        element.props.children,
        treePath
      );
    }
    routes.push(route);
  });
  return routes;
}
var defaultMethod = "get";
var defaultEncType = "application/x-www-form-urlencoded";
function isHtmlElement(object) {
  return typeof HTMLElement !== "undefined" && object instanceof HTMLElement;
}
function isButtonElement(object) {
  return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
}
function isFormElement(object) {
  return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
}
function isInputElement(object) {
  return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
}
function isModifiedEvent(event) {
  return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
}
function shouldProcessLinkClick(event, target) {
  return event.button === 0 && // Ignore everything but left clicks
  (!target || target === "_self") && // Let browser handle "target=_blank" etc.
  !isModifiedEvent(event);
}
function createSearchParams(init = "") {
  return new URLSearchParams(
    typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo2, key) => {
      let value = init[key];
      return memo2.concat(
        Array.isArray(value) ? value.map((v2) => [key, v2]) : [[key, value]]
      );
    }, [])
  );
}
function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
  let searchParams = createSearchParams(locationSearch);
  if (defaultSearchParams) {
    defaultSearchParams.forEach((_2, key) => {
      if (!searchParams.has(key)) {
        defaultSearchParams.getAll(key).forEach((value) => {
          searchParams.append(key, value);
        });
      }
    });
  }
  return searchParams;
}
var _formDataSupportsSubmitter = null;
function isFormDataSubmitterSupported() {
  if (_formDataSupportsSubmitter === null) {
    try {
      new FormData(
        document.createElement("form"),
        // @ts-expect-error if FormData supports the submitter parameter, this will throw
        0
      );
      _formDataSupportsSubmitter = false;
    } catch (e2) {
      _formDataSupportsSubmitter = true;
    }
  }
  return _formDataSupportsSubmitter;
}
var supportedFormEncTypes = /* @__PURE__ */ new Set([
  "application/x-www-form-urlencoded",
  "multipart/form-data",
  "text/plain"
]);
function getFormEncType(encType) {
  if (encType != null && !supportedFormEncTypes.has(encType)) {
    warning(
      false,
      `"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
    );
    return null;
  }
  return encType;
}
function getFormSubmissionInfo(target, basename) {
  let method;
  let action;
  let encType;
  let formData;
  let body;
  if (isFormElement(target)) {
    let attr = target.getAttribute("action");
    action = attr ? stripBasename(attr, basename) : null;
    method = target.getAttribute("method") || defaultMethod;
    encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
    formData = new FormData(target);
  } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
    let form = target.form;
    if (form == null) {
      throw new Error(
        `Cannot submit a <button> or <input type="submit"> without a <form>`
      );
    }
    let attr = target.getAttribute("formaction") || form.getAttribute("action");
    action = attr ? stripBasename(attr, basename) : null;
    method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
    encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
    formData = new FormData(form, target);
    if (!isFormDataSubmitterSupported()) {
      let { name, type, value } = target;
      if (type === "image") {
        let prefix = name ? `${name}.` : "";
        formData.append(`${prefix}x`, "0");
        formData.append(`${prefix}y`, "0");
      } else if (name) {
        formData.append(name, value);
      }
    }
  } else if (isHtmlElement(target)) {
    throw new Error(
      `Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
    );
  } else {
    method = defaultMethod;
    action = null;
    encType = defaultEncType;
    body = target;
  }
  if (formData && encType === "text/plain") {
    body = formData;
    formData = void 0;
  }
  return { action, method: method.toLowerCase(), encType, formData, body };
}
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
function invariant2(value, message) {
  if (value === false || value === null || typeof value === "undefined") {
    throw new Error(message);
  }
}
function singleFetchUrl(reqUrl, basename, trailingSlashAware, extension) {
  let url = typeof reqUrl === "string" ? new URL(
    reqUrl,
    // This can be called during the SSR flow via PrefetchPageLinksImpl so
    // don't assume window is available
    typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
  ) : reqUrl;
  if (trailingSlashAware) {
    if (url.pathname.endsWith("/")) {
      url.pathname = `${url.pathname}_.${extension}`;
    } else {
      url.pathname = `${url.pathname}.${extension}`;
    }
  } else {
    if (url.pathname === "/") {
      url.pathname = `_root.${extension}`;
    } else if (basename && stripBasename(url.pathname, basename) === "/") {
      url.pathname = `${removeTrailingSlash(basename)}/_root.${extension}`;
    } else {
      url.pathname = `${removeTrailingSlash(url.pathname)}.${extension}`;
    }
  }
  return url;
}
async function loadRouteModule(route, routeModulesCache) {
  if (route.id in routeModulesCache) {
    return routeModulesCache[route.id];
  }
  try {
    let routeModule = await import(
      /* @vite-ignore */
      /* webpackIgnore: true */
      route.module
    );
    routeModulesCache[route.id] = routeModule;
    return routeModule;
  } catch (error) {
    console.error(
      `Error loading route module \`${route.module}\`, reloading page...`
    );
    console.error(error);
    if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
    void 0) ;
    window.location.reload();
    return new Promise(() => {
    });
  }
}
function isHtmlLinkDescriptor(object) {
  if (object == null) {
    return false;
  }
  if (object.href == null) {
    return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
  }
  return typeof object.rel === "string" && typeof object.href === "string";
}
async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
  let links = await Promise.all(
    matches.map(async (match) => {
      let route = manifest.routes[match.route.id];
      if (route) {
        let mod = await loadRouteModule(route, routeModules);
        return mod.links ? mod.links() : [];
      }
      return [];
    })
  );
  return dedupeLinkDescriptors(
    links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
      (link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
    )
  );
}
function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
  let isNew = (match, index2) => {
    if (!currentMatches[index2]) return true;
    return match.route.id !== currentMatches[index2].route.id;
  };
  let matchPathChanged = (match, index2) => {
    return (
      // param change, /users/123 -> /users/456
      currentMatches[index2].pathname !== match.pathname || // splat param changed, which is not present in match.path
      // e.g. /files/images/avatar.jpg -> files/finances.xls
      currentMatches[index2].route.path?.endsWith("*") && currentMatches[index2].params["*"] !== match.params["*"]
    );
  };
  if (mode === "assets") {
    return nextMatches.filter(
      (match, index2) => isNew(match, index2) || matchPathChanged(match, index2)
    );
  }
  if (mode === "data") {
    return nextMatches.filter((match, index2) => {
      let manifestRoute = manifest.routes[match.route.id];
      if (!manifestRoute || !manifestRoute.hasLoader) {
        return false;
      }
      if (isNew(match, index2) || matchPathChanged(match, index2)) {
        return true;
      }
      if (match.route.shouldRevalidate) {
        let routeChoice = match.route.shouldRevalidate({
          currentUrl: new URL(
            location.pathname + location.search + location.hash,
            window.origin
          ),
          currentParams: currentMatches[0]?.params || {},
          nextUrl: new URL(page, window.origin),
          nextParams: match.params,
          defaultShouldRevalidate: true
        });
        if (typeof routeChoice === "boolean") {
          return routeChoice;
        }
      }
      return true;
    });
  }
  return [];
}
function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
  return dedupeHrefs(
    matches.map((match) => {
      let route = manifest.routes[match.route.id];
      if (!route) return [];
      let hrefs = [route.module];
      if (route.clientActionModule) {
        hrefs = hrefs.concat(route.clientActionModule);
      }
      if (route.clientLoaderModule) {
        hrefs = hrefs.concat(route.clientLoaderModule);
      }
      if (includeHydrateFallback && route.hydrateFallbackModule) {
        hrefs = hrefs.concat(route.hydrateFallbackModule);
      }
      if (route.imports) {
        hrefs = hrefs.concat(route.imports);
      }
      return hrefs;
    }).flat(1)
  );
}
function dedupeHrefs(hrefs) {
  return [...new Set(hrefs)];
}
function sortKeys(obj) {
  let sorted = {};
  let keys = Object.keys(obj).sort();
  for (let key of keys) {
    sorted[key] = obj[key];
  }
  return sorted;
}
function dedupeLinkDescriptors(descriptors, preloads) {
  let set = /* @__PURE__ */ new Set();
  new Set(preloads);
  return descriptors.reduce((deduped, descriptor) => {
    let key = JSON.stringify(sortKeys(descriptor));
    if (!set.has(key)) {
      set.add(key);
      deduped.push({ key, link: descriptor });
    }
    return deduped;
  }, []);
}
function isFogOfWarEnabled(routeDiscovery, ssr) {
  return routeDiscovery.mode === "lazy" && ssr === true;
}
function getPartialManifest({ sri, ...manifest }, router) {
  let routeIds = new Set(router.state.matches.map((m3) => m3.route.id));
  let segments = router.state.location.pathname.split("/").filter(Boolean);
  let paths = ["/"];
  segments.pop();
  while (segments.length > 0) {
    paths.push(`/${segments.join("/")}`);
    segments.pop();
  }
  paths.forEach((path) => {
    let matches = matchRoutes(router.routes, path, router.basename);
    if (matches) {
      matches.forEach((m3) => routeIds.add(m3.route.id));
    }
  });
  let initialRoutes = [...routeIds].reduce(
    (acc, id) => Object.assign(acc, { [id]: manifest.routes[id] }),
    {}
  );
  return {
    ...manifest,
    routes: initialRoutes,
    sri: sri ? true : void 0
  };
}
function useDataRouterContext2() {
  let context = window.wp.element.useContext(DataRouterContext);
  invariant2(
    context,
    "You must render this element inside a <DataRouterContext.Provider> element"
  );
  return context;
}
function useDataRouterStateContext() {
  let context = window.wp.element.useContext(DataRouterStateContext);
  invariant2(
    context,
    "You must render this element inside a <DataRouterStateContext.Provider> element"
  );
  return context;
}
var FrameworkContext = window.wp.element.createContext(void 0);
FrameworkContext.displayName = "FrameworkContext";
function useFrameworkContext() {
  let context = window.wp.element.useContext(FrameworkContext);
  invariant2(
    context,
    "You must render this element inside a <HydratedRouter> element"
  );
  return context;
}
function usePrefetchBehavior(prefetch, theirElementProps) {
  let frameworkContext = window.wp.element.useContext(FrameworkContext);
  let [maybePrefetch, setMaybePrefetch] = window.wp.element.useState(false);
  let [shouldPrefetch, setShouldPrefetch] = window.wp.element.useState(false);
  let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
  let ref = window.wp.element.useRef(null);
  window.wp.element.useEffect(() => {
    if (prefetch === "render") {
      setShouldPrefetch(true);
    }
    if (prefetch === "viewport") {
      let callback = (entries) => {
        entries.forEach((entry) => {
          setShouldPrefetch(entry.isIntersecting);
        });
      };
      let observer = new IntersectionObserver(callback, { threshold: 0.5 });
      if (ref.current) observer.observe(ref.current);
      return () => {
        observer.disconnect();
      };
    }
  }, [prefetch]);
  window.wp.element.useEffect(() => {
    if (maybePrefetch) {
      let id = setTimeout(() => {
        setShouldPrefetch(true);
      }, 100);
      return () => {
        clearTimeout(id);
      };
    }
  }, [maybePrefetch]);
  let setIntent = () => {
    setMaybePrefetch(true);
  };
  let cancelIntent = () => {
    setMaybePrefetch(false);
    setShouldPrefetch(false);
  };
  if (!frameworkContext) {
    return [false, ref, {}];
  }
  if (prefetch !== "intent") {
    return [shouldPrefetch, ref, {}];
  }
  return [
    shouldPrefetch,
    ref,
    {
      onFocus: composeEventHandlers(onFocus, setIntent),
      onBlur: composeEventHandlers(onBlur, cancelIntent),
      onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
      onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
      onTouchStart: composeEventHandlers(onTouchStart, setIntent)
    }
  ];
}
function composeEventHandlers(theirHandler, ourHandler) {
  return (event) => {
    theirHandler && theirHandler(event);
    if (!event.defaultPrevented) {
      ourHandler(event);
    }
  };
}
function getActiveMatches(matches, errors, isSpaMode) {
  if (isSpaMode && !isHydrated) {
    return [matches[0]];
  }
  return matches;
}
function PrefetchPageLinks({ page, ...linkProps }) {
  let rsc = useIsRSCRouterContext();
  let { router } = useDataRouterContext2();
  let matches = window.wp.element.useMemo(
    () => matchRoutes(router.routes, page, router.basename),
    [router.routes, page, router.basename]
  );
  if (!matches) {
    return null;
  }
  if (rsc) {
    return /* @__PURE__ */ window.wp.element.createElement(RSCPrefetchPageLinksImpl, { page, matches, ...linkProps });
  }
  return /* @__PURE__ */ window.wp.element.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
}
function useKeyedPrefetchLinks(matches) {
  let { manifest, routeModules } = useFrameworkContext();
  let [keyedPrefetchLinks, setKeyedPrefetchLinks] = window.wp.element.useState([]);
  window.wp.element.useEffect(() => {
    let interrupted = false;
    void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
      (links) => {
        if (!interrupted) {
          setKeyedPrefetchLinks(links);
        }
      }
    );
    return () => {
      interrupted = true;
    };
  }, [matches, manifest, routeModules]);
  return keyedPrefetchLinks;
}
function RSCPrefetchPageLinksImpl({
  page,
  matches: nextMatches,
  ...linkProps
}) {
  let location = useLocation();
  let { future } = useFrameworkContext();
  let { basename } = useDataRouterContext2();
  let dataHrefs = window.wp.element.useMemo(() => {
    if (page === location.pathname + location.search + location.hash) {
      return [];
    }
    let url = singleFetchUrl(
      page,
      basename,
      future.unstable_trailingSlashAwareDataRequests,
      "rsc"
    );
    let hasSomeRoutesWithShouldRevalidate = false;
    let targetRoutes = [];
    for (let match of nextMatches) {
      if (typeof match.route.shouldRevalidate === "function") {
        hasSomeRoutesWithShouldRevalidate = true;
      } else {
        targetRoutes.push(match.route.id);
      }
    }
    if (hasSomeRoutesWithShouldRevalidate && targetRoutes.length > 0) {
      url.searchParams.set("_routes", targetRoutes.join(","));
    }
    return [url.pathname + url.search];
  }, [
    basename,
    future.unstable_trailingSlashAwareDataRequests,
    page,
    location,
    nextMatches
  ]);
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ window.wp.element.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })));
}
function PrefetchPageLinksImpl({
  page,
  matches: nextMatches,
  ...linkProps
}) {
  let location = useLocation();
  let { future, manifest, routeModules } = useFrameworkContext();
  let { basename } = useDataRouterContext2();
  let { loaderData, matches } = useDataRouterStateContext();
  let newMatchesForData = window.wp.element.useMemo(
    () => getNewMatchesForLinks(
      page,
      nextMatches,
      matches,
      manifest,
      location,
      "data"
    ),
    [page, nextMatches, matches, manifest, location]
  );
  let newMatchesForAssets = window.wp.element.useMemo(
    () => getNewMatchesForLinks(
      page,
      nextMatches,
      matches,
      manifest,
      location,
      "assets"
    ),
    [page, nextMatches, matches, manifest, location]
  );
  let dataHrefs = window.wp.element.useMemo(() => {
    if (page === location.pathname + location.search + location.hash) {
      return [];
    }
    let routesParams = /* @__PURE__ */ new Set();
    let foundOptOutRoute = false;
    nextMatches.forEach((m3) => {
      let manifestRoute = manifest.routes[m3.route.id];
      if (!manifestRoute || !manifestRoute.hasLoader) {
        return;
      }
      if (!newMatchesForData.some((m22) => m22.route.id === m3.route.id) && m3.route.id in loaderData && routeModules[m3.route.id]?.shouldRevalidate) {
        foundOptOutRoute = true;
      } else if (manifestRoute.hasClientLoader) {
        foundOptOutRoute = true;
      } else {
        routesParams.add(m3.route.id);
      }
    });
    if (routesParams.size === 0) {
      return [];
    }
    let url = singleFetchUrl(
      page,
      basename,
      future.unstable_trailingSlashAwareDataRequests,
      "data"
    );
    if (foundOptOutRoute && routesParams.size > 0) {
      url.searchParams.set(
        "_routes",
        nextMatches.filter((m3) => routesParams.has(m3.route.id)).map((m3) => m3.route.id).join(",")
      );
    }
    return [url.pathname + url.search];
  }, [
    basename,
    future.unstable_trailingSlashAwareDataRequests,
    loaderData,
    location,
    manifest,
    newMatchesForData,
    nextMatches,
    page,
    routeModules
  ]);
  let moduleHrefs = window.wp.element.useMemo(
    () => getModuleLinkHrefs(newMatchesForAssets, manifest),
    [newMatchesForAssets, manifest]
  );
  let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ window.wp.element.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ window.wp.element.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
    // these don't spread `linkProps` because they are full link descriptors
    // already with their own props
    /* @__PURE__ */ window.wp.element.createElement(
      "link",
      {
        key,
        nonce: linkProps.nonce,
        ...link,
        crossOrigin: link.crossOrigin ?? linkProps.crossOrigin
      }
    )
  )));
}
var isHydrated = false;
function setIsHydrated() {
  isHydrated = true;
}
function Scripts(scriptProps) {
  let {
    manifest,
    serverHandoffString,
    isSpaMode,
    renderMeta,
    routeDiscovery,
    ssr
  } = useFrameworkContext();
  let { router, static: isStatic, staticContext } = useDataRouterContext2();
  let { matches: routerMatches } = useDataRouterStateContext();
  let isRSCRouterContext = useIsRSCRouterContext();
  let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
  if (renderMeta) {
    renderMeta.didRenderScripts = true;
  }
  let matches = getActiveMatches(routerMatches, null, isSpaMode);
  window.wp.element.useEffect(() => {
    setIsHydrated();
  }, []);
  let initialScripts = window.wp.element.useMemo(() => {
    if (isRSCRouterContext) {
      return null;
    }
    let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
    let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
    let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
${matches.map((match, routeIndex) => {
      let routeVarName = `route${routeIndex}`;
      let manifestEntry = manifest.routes[match.route.id];
      invariant2(manifestEntry, `Route ${match.route.id} not found in manifest`);
      let {
        clientActionModule,
        clientLoaderModule,
        clientMiddlewareModule,
        hydrateFallbackModule,
        module
      } = manifestEntry;
      let chunks = [
        ...clientActionModule ? [
          {
            module: clientActionModule,
            varName: `${routeVarName}_clientAction`
          }
        ] : [],
        ...clientLoaderModule ? [
          {
            module: clientLoaderModule,
            varName: `${routeVarName}_clientLoader`
          }
        ] : [],
        ...clientMiddlewareModule ? [
          {
            module: clientMiddlewareModule,
            varName: `${routeVarName}_clientMiddleware`
          }
        ] : [],
        ...hydrateFallbackModule ? [
          {
            module: hydrateFallbackModule,
            varName: `${routeVarName}_HydrateFallback`
          }
        ] : [],
        { module, varName: `${routeVarName}_main` }
      ];
      if (chunks.length === 1) {
        return `import * as ${routeVarName} from ${JSON.stringify(module)};`;
      }
      let chunkImportsSnippet = chunks.map((chunk) => `import * as ${chunk.varName} from "${chunk.module}";`).join("\n");
      let mergedChunksSnippet = `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(",")}};`;
      return [chunkImportsSnippet, mergedChunksSnippet].join("\n");
    }).join("\n")}
  ${enableFogOfWar ? (
      // Inline a minimal manifest with the SSR matches
      `window.__reactRouterManifest = ${JSON.stringify(
        getPartialManifest(manifest, router),
        null,
        2
      )};`
    ) : ""}
  window.__reactRouterRouteModules = {${matches.map((match, index2) => `${JSON.stringify(match.route.id)}:route${index2}`).join(",")}};

import(${JSON.stringify(manifest.entry.module)});`;
    return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(
      "script",
      {
        ...scriptProps,
        suppressHydrationWarning: true,
        dangerouslySetInnerHTML: { __html: contextScript },
        type: void 0
      }
    ), /* @__PURE__ */ window.wp.element.createElement(
      "script",
      {
        ...scriptProps,
        suppressHydrationWarning: true,
        dangerouslySetInnerHTML: { __html: routeModulesScript },
        type: "module",
        async: true
      }
    ));
  }, []);
  let preloads = isHydrated || isRSCRouterContext ? [] : dedupe(
    manifest.entry.imports.concat(
      getModuleLinkHrefs(matches, manifest, {
        includeHydrateFallback: true
      })
    )
  );
  let sri = typeof manifest.sri === "object" ? manifest.sri : {};
  warnOnce(
    !isRSCRouterContext,
    "The <Scripts /> element is a no-op when using RSC and can be safely removed."
  );
  return isHydrated || isRSCRouterContext ? null : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, typeof manifest.sri === "object" ? /* @__PURE__ */ window.wp.element.createElement(
    "script",
    {
      ...scriptProps,
      "rr-importmap": "",
      type: "importmap",
      suppressHydrationWarning: true,
      dangerouslySetInnerHTML: {
        __html: JSON.stringify({
          integrity: sri
        })
      }
    }
  ) : null, !enableFogOfWar ? /* @__PURE__ */ window.wp.element.createElement(
    "link",
    {
      rel: "modulepreload",
      href: manifest.url,
      crossOrigin: scriptProps.crossOrigin,
      integrity: sri[manifest.url],
      suppressHydrationWarning: true
    }
  ) : null, /* @__PURE__ */ window.wp.element.createElement(
    "link",
    {
      rel: "modulepreload",
      href: manifest.entry.module,
      crossOrigin: scriptProps.crossOrigin,
      integrity: sri[manifest.entry.module],
      suppressHydrationWarning: true
    }
  ), preloads.map((path) => /* @__PURE__ */ window.wp.element.createElement(
    "link",
    {
      key: path,
      rel: "modulepreload",
      href: path,
      crossOrigin: scriptProps.crossOrigin,
      integrity: sri[path],
      suppressHydrationWarning: true
    }
  )), initialScripts);
}
function dedupe(array) {
  return [...new Set(array)];
}
function mergeRefs(...refs) {
  return (value) => {
    refs.forEach((ref) => {
      if (typeof ref === "function") {
        ref(value);
      } else if (ref != null) {
        ref.current = value;
      }
    });
  };
}
(class extends window.wp.element.Component {
  constructor(props) {
    super(props);
    this.state = { error: props.error || null, location: props.location };
  }
  static getDerivedStateFromError(error) {
    return { error };
  }
  static getDerivedStateFromProps(props, state) {
    if (state.location !== props.location) {
      return { error: props.error || null, location: props.location };
    }
    return { error: props.error || state.error, location: state.location };
  }
  render() {
    if (this.state.error) {
      return /* @__PURE__ */ window.wp.element.createElement(
        RemixRootDefaultErrorBoundary,
        {
          error: this.state.error,
          isOutsideRemixApp: true
        }
      );
    } else {
      return this.props.children;
    }
  }
});
function RemixRootDefaultErrorBoundary({
  error,
  isOutsideRemixApp
}) {
  console.error(error);
  let heyDeveloper = /* @__PURE__ */ window.wp.element.createElement(
    "script",
    {
      dangerouslySetInnerHTML: {
        __html: `
        console.log(
          "💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
        );
      `
      }
    }
  );
  if (isRouteErrorResponse(error)) {
    return /* @__PURE__ */ window.wp.element.createElement(BoundaryShell, { title: "Unhandled Thrown Response!" }, /* @__PURE__ */ window.wp.element.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText), heyDeveloper);
  }
  let errorInstance;
  if (error instanceof Error) {
    errorInstance = error;
  } else {
    let errorString = error == null ? "Unknown Error" : typeof error === "object" && "toString" in error ? error.toString() : JSON.stringify(error);
    errorInstance = new Error(errorString);
  }
  return /* @__PURE__ */ window.wp.element.createElement(
    BoundaryShell,
    {
      title: "Application Error!",
      isOutsideRemixApp
    },
    /* @__PURE__ */ window.wp.element.createElement("h1", { style: { fontSize: "24px" } }, "Application Error"),
    /* @__PURE__ */ window.wp.element.createElement(
      "pre",
      {
        style: {
          padding: "2rem",
          background: "hsla(10, 50%, 50%, 0.1)",
          color: "red",
          overflow: "auto"
        }
      },
      errorInstance.stack
    ),
    heyDeveloper
  );
}
function BoundaryShell({
  title,
  renderScripts,
  isOutsideRemixApp,
  children
}) {
  let { routeModules } = useFrameworkContext();
  if (routeModules.root?.Layout && !isOutsideRemixApp) {
    return children;
  }
  return /* @__PURE__ */ window.wp.element.createElement("html", { lang: "en" }, /* @__PURE__ */ window.wp.element.createElement("head", null, /* @__PURE__ */ window.wp.element.createElement("meta", { charSet: "utf-8" }), /* @__PURE__ */ window.wp.element.createElement(
    "meta",
    {
      name: "viewport",
      content: "width=device-width,initial-scale=1,viewport-fit=cover"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("title", null, title)), /* @__PURE__ */ window.wp.element.createElement("body", null, /* @__PURE__ */ window.wp.element.createElement("main", { style: { fontFamily: "system-ui, sans-serif", padding: "2rem" } }, children, renderScripts ? /* @__PURE__ */ window.wp.element.createElement(Scripts, null) : null)));
}
var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
try {
  if (isBrowser2) {
    window.__reactRouterVersion = // @ts-expect-error
    "7.14.1";
  }
} catch (e2) {
}
function HashRouter({
  basename,
  children,
  unstable_useTransitions,
  window: window2
}) {
  let historyRef = window.wp.element.useRef();
  if (historyRef.current == null) {
    historyRef.current = createHashHistory({ window: window2, v5Compat: true });
  }
  let history = historyRef.current;
  let [state, setStateImpl] = window.wp.element.useState({
    action: history.action,
    location: history.location
  });
  let setState = window.wp.element.useCallback(
    (newState) => {
      if (unstable_useTransitions === false) {
        setStateImpl(newState);
      } else {
        window.wp.element.startTransition(() => setStateImpl(newState));
      }
    },
    [unstable_useTransitions]
  );
  window.wp.element.useLayoutEffect(() => history.listen(setState), [history, setState]);
  return /* @__PURE__ */ window.wp.element.createElement(
    Router,
    {
      basename,
      children,
      location: state.location,
      navigationType: state.action,
      navigator: history,
      unstable_useTransitions
    }
  );
}
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
var Link$2 = window.wp.element.forwardRef(
  function LinkWithRef({
    onClick,
    discover = "render",
    prefetch = "none",
    relative,
    reloadDocument,
    replace: replace2,
    unstable_mask,
    state,
    target,
    to,
    preventScrollReset,
    viewTransition,
    unstable_defaultShouldRevalidate,
    ...rest
  }, forwardedRef) {
    let { basename, navigator: navigator2, unstable_useTransitions } = window.wp.element.useContext(NavigationContext);
    let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
    let parsed = parseToInfo(to, basename);
    to = parsed.to;
    let href = useHref(to, { relative });
    let location = useLocation();
    let maskedHref = null;
    if (unstable_mask) {
      let resolved = resolveTo(
        unstable_mask,
        [],
        location.unstable_mask ? location.unstable_mask.pathname : "/",
        true
      );
      if (basename !== "/") {
        resolved.pathname = resolved.pathname === "/" ? basename : joinPaths([basename, resolved.pathname]);
      }
      maskedHref = navigator2.createHref(resolved);
    }
    let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
      prefetch,
      rest
    );
    let internalOnClick = useLinkClickHandler(to, {
      replace: replace2,
      unstable_mask,
      state,
      target,
      preventScrollReset,
      relative,
      viewTransition,
      unstable_defaultShouldRevalidate,
      unstable_useTransitions
    });
    function handleClick(event) {
      if (onClick) onClick(event);
      if (!event.defaultPrevented) {
        internalOnClick(event);
      }
    }
    let isSpaLink = !(parsed.isExternal || reloadDocument);
    let link = (
      // eslint-disable-next-line jsx-a11y/anchor-has-content
      /* @__PURE__ */ window.wp.element.createElement(
        "a",
        {
          ...rest,
          ...prefetchHandlers,
          href: (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href,
          onClick: isSpaLink ? handleClick : onClick,
          ref: mergeRefs(forwardedRef, prefetchRef),
          target,
          "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
        }
      )
    );
    return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, link, /* @__PURE__ */ window.wp.element.createElement(PrefetchPageLinks, { page: href })) : link;
  }
);
Link$2.displayName = "Link";
var NavLink = window.wp.element.forwardRef(
  function NavLinkWithRef({
    "aria-current": ariaCurrentProp = "page",
    caseSensitive = false,
    className: classNameProp = "",
    end = false,
    style: styleProp,
    to,
    viewTransition,
    children,
    ...rest
  }, ref) {
    let path = useResolvedPath(to, { relative: rest.relative });
    let location = useLocation();
    let routerState = window.wp.element.useContext(DataRouterStateContext);
    let { navigator: navigator2, basename } = window.wp.element.useContext(NavigationContext);
    let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
    // eslint-disable-next-line react-hooks/rules-of-hooks
    useViewTransitionState(path) && viewTransition === true;
    let toPathname = navigator2.encodeLocation ? navigator2.encodeLocation(path).pathname : path.pathname;
    let locationPathname = location.pathname;
    let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
    if (!caseSensitive) {
      locationPathname = locationPathname.toLowerCase();
      nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
      toPathname = toPathname.toLowerCase();
    }
    if (nextLocationPathname && basename) {
      nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
    }
    const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
    let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
    let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
    let renderProps = {
      isActive,
      isPending,
      isTransitioning
    };
    let ariaCurrent = isActive ? ariaCurrentProp : void 0;
    let className;
    if (typeof classNameProp === "function") {
      className = classNameProp(renderProps);
    } else {
      className = [
        classNameProp,
        isActive ? "active" : null,
        isPending ? "pending" : null,
        isTransitioning ? "transitioning" : null
      ].filter(Boolean).join(" ");
    }
    let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
    return /* @__PURE__ */ window.wp.element.createElement(
      Link$2,
      {
        ...rest,
        "aria-current": ariaCurrent,
        className,
        ref,
        style,
        to,
        viewTransition
      },
      typeof children === "function" ? children(renderProps) : children
    );
  }
);
NavLink.displayName = "NavLink";
var Form = window.wp.element.forwardRef(
  ({
    discover = "render",
    fetcherKey,
    navigate,
    reloadDocument,
    replace: replace2,
    state,
    method = defaultMethod,
    action,
    onSubmit,
    relative,
    preventScrollReset,
    viewTransition,
    unstable_defaultShouldRevalidate,
    ...props
  }, forwardedRef) => {
    let { unstable_useTransitions } = window.wp.element.useContext(NavigationContext);
    let submit = useSubmit();
    let formAction = useFormAction(action, { relative });
    let formMethod = method.toLowerCase() === "get" ? "get" : "post";
    let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
    let submitHandler = (event) => {
      onSubmit && onSubmit(event);
      if (event.defaultPrevented) return;
      event.preventDefault();
      let submitter = event.nativeEvent.submitter;
      let submitMethod = submitter?.getAttribute("formmethod") || method;
      let doSubmit = () => submit(submitter || event.currentTarget, {
        fetcherKey,
        method: submitMethod,
        navigate,
        replace: replace2,
        state,
        relative,
        preventScrollReset,
        viewTransition,
        unstable_defaultShouldRevalidate
      });
      if (unstable_useTransitions && navigate !== false) {
        window.wp.element.startTransition(() => doSubmit());
      } else {
        doSubmit();
      }
    };
    return /* @__PURE__ */ window.wp.element.createElement(
      "form",
      {
        ref: forwardedRef,
        method: formMethod,
        action: formAction,
        onSubmit: reloadDocument ? onSubmit : submitHandler,
        ...props,
        "data-discover": !isAbsolute && discover === "render" ? "true" : void 0
      }
    );
  }
);
Form.displayName = "Form";
function getDataRouterConsoleError2(hookName) {
  return `${hookName} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`;
}
function useDataRouterContext3(hookName) {
  let ctx = window.wp.element.useContext(DataRouterContext);
  invariant(ctx, getDataRouterConsoleError2(hookName));
  return ctx;
}
function useLinkClickHandler(to, {
  target,
  replace: replaceProp,
  unstable_mask,
  state,
  preventScrollReset,
  relative,
  viewTransition,
  unstable_defaultShouldRevalidate,
  unstable_useTransitions
} = {}) {
  let navigate = useNavigate();
  let location = useLocation();
  let path = useResolvedPath(to, { relative });
  return window.wp.element.useCallback(
    (event) => {
      if (shouldProcessLinkClick(event, target)) {
        event.preventDefault();
        let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
        let doNavigate = () => navigate(to, {
          replace: replace2,
          unstable_mask,
          state,
          preventScrollReset,
          relative,
          viewTransition,
          unstable_defaultShouldRevalidate
        });
        if (unstable_useTransitions) {
          window.wp.element.startTransition(() => doNavigate());
        } else {
          doNavigate();
        }
      }
    },
    [
      location,
      navigate,
      path,
      replaceProp,
      unstable_mask,
      state,
      target,
      to,
      preventScrollReset,
      relative,
      viewTransition,
      unstable_defaultShouldRevalidate,
      unstable_useTransitions
    ]
  );
}
function useSearchParams(defaultInit) {
  warning(
    typeof URLSearchParams !== "undefined",
    `You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
  );
  let defaultSearchParamsRef = window.wp.element.useRef(createSearchParams(defaultInit));
  let hasSetSearchParamsRef = window.wp.element.useRef(false);
  let location = useLocation();
  let searchParams = window.wp.element.useMemo(
    () => (
      // Only merge in the defaults if we haven't yet called setSearchParams.
      // Once we call that we want those to take precedence, otherwise you can't
      // remove a param with setSearchParams({}) if it has an initial value
      getSearchParamsForLocation(
        location.search,
        hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current
      )
    ),
    [location.search]
  );
  let navigate = useNavigate();
  let setSearchParams = window.wp.element.useCallback(
    (nextInit, navigateOptions) => {
      const newSearchParams = createSearchParams(
        typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
      );
      hasSetSearchParamsRef.current = true;
      navigate("?" + newSearchParams, navigateOptions);
    },
    [navigate, searchParams]
  );
  return [searchParams, setSearchParams];
}
var fetcherId = 0;
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
function useSubmit() {
  let { router } = useDataRouterContext3(
    "useSubmit"
    /* UseSubmit */
  );
  let { basename } = window.wp.element.useContext(NavigationContext);
  let currentRouteId = useRouteId();
  let routerFetch = router.fetch;
  let routerNavigate = router.navigate;
  return window.wp.element.useCallback(
    async (target, options = {}) => {
      let { action, method, encType, formData, body } = getFormSubmissionInfo(
        target,
        basename
      );
      if (options.navigate === false) {
        let key = options.fetcherKey || getUniqueFetcherId();
        await routerFetch(key, currentRouteId, options.action || action, {
          unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
          preventScrollReset: options.preventScrollReset,
          formData,
          body,
          formMethod: options.method || method,
          formEncType: options.encType || encType,
          flushSync: options.flushSync
        });
      } else {
        await routerNavigate(options.action || action, {
          unstable_defaultShouldRevalidate: options.unstable_defaultShouldRevalidate,
          preventScrollReset: options.preventScrollReset,
          formData,
          body,
          formMethod: options.method || method,
          formEncType: options.encType || encType,
          replace: options.replace,
          state: options.state,
          fromRouteId: currentRouteId,
          flushSync: options.flushSync,
          viewTransition: options.viewTransition
        });
      }
    },
    [routerFetch, routerNavigate, basename, currentRouteId]
  );
}
function useFormAction(action, { relative } = {}) {
  let { basename } = window.wp.element.useContext(NavigationContext);
  let routeContext = window.wp.element.useContext(RouteContext);
  invariant(routeContext, "useFormAction must be used inside a RouteContext");
  let [match] = routeContext.matches.slice(-1);
  let path = { ...useResolvedPath(action ? action : ".", { relative }) };
  let location = useLocation();
  if (action == null) {
    path.search = location.search;
    let params = new URLSearchParams(path.search);
    let indexValues = params.getAll("index");
    let hasNakedIndexParam = indexValues.some((v2) => v2 === "");
    if (hasNakedIndexParam) {
      params.delete("index");
      indexValues.filter((v2) => v2).forEach((v2) => params.append("index", v2));
      let qs = params.toString();
      path.search = qs ? `?${qs}` : "";
    }
  }
  if ((!action || action === ".") && match.route.index) {
    path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
  }
  if (basename !== "/") {
    path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
  }
  return createPath(path);
}
function useViewTransitionState(to, { relative } = {}) {
  let vtContext = window.wp.element.useContext(ViewTransitionContext);
  invariant(
    vtContext != null,
    "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?"
  );
  let { basename } = useDataRouterContext3(
    "useViewTransitionState"
    /* useViewTransitionState */
  );
  let path = useResolvedPath(to, { relative });
  if (!vtContext.isTransitioning) {
    return false;
  }
  let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
  let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
  return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
}
function getDefaultExportFromCjs(x2) {
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
}
function Ve$1(e2) {
  var r2, t2, o4 = "";
  if (typeof e2 == "string" || typeof e2 == "number") o4 += e2;
  else if (typeof e2 == "object") if (Array.isArray(e2)) {
    var n2 = e2.length;
    for (r2 = 0; r2 < n2; r2++) e2[r2] && (t2 = Ve$1(e2[r2])) && (o4 && (o4 += " "), o4 += t2);
  } else for (t2 in e2) e2[t2] && (o4 && (o4 += " "), o4 += t2);
  return o4;
}
function _e$1() {
  for (var e2, r2, t2 = 0, o4 = "", n2 = arguments.length; t2 < n2; t2++) (e2 = arguments[t2]) && (r2 = Ve$1(e2)) && (o4 && (o4 += " "), o4 += r2);
  return o4;
}
const we$2 = (e2) => typeof e2 == "boolean" ? `${e2}` : e2 === 0 ? "0" : e2, ze$1 = _e$1, me$1 = (e2, r2) => (t2) => {
  var o4;
  if (r2?.variants == null) return ze$1(e2, t2?.class, t2?.className);
  const { variants: n2, defaultVariants: s2 } = r2, a3 = Object.keys(n2).map((b2) => {
    const f2 = t2?.[b2], g2 = s2?.[b2];
    if (f2 === null) return null;
    const y2 = we$2(f2) || we$2(g2);
    return n2[b2][y2];
  }), u2 = t2 && Object.entries(t2).reduce((b2, f2) => {
    let [g2, y2] = f2;
    return y2 === void 0 || (b2[g2] = y2), b2;
  }, {}), c2 = r2 == null || (o4 = r2.compoundVariants) === null || o4 === void 0 ? void 0 : o4.reduce((b2, f2) => {
    let { class: g2, className: y2, ...I2 } = f2;
    return Object.entries(I2).every((P2) => {
      let [C2, v2] = P2;
      return Array.isArray(v2) ? v2.includes({
        ...s2,
        ...u2
      }[C2]) : {
        ...s2,
        ...u2
      }[C2] === v2;
    }) ? [
      ...b2,
      g2,
      y2
    ] : b2;
  }, []);
  return ze$1(e2, a3, c2, t2?.class, t2?.className);
}, Ze$2 = (e2, r2) => {
  const t2 = new Array(e2.length + r2.length);
  for (let o4 = 0; o4 < e2.length; o4++)
    t2[o4] = e2[o4];
  for (let o4 = 0; o4 < r2.length; o4++)
    t2[e2.length + o4] = r2[o4];
  return t2;
}, Je$1 = (e2, r2) => ({
  classGroupId: e2,
  validator: r2
}), je$1 = (e2 = /* @__PURE__ */ new Map(), r2 = null, t2) => ({
  nextPart: e2,
  validators: r2,
  classGroupId: t2
}), ee$2 = "-", Ce$1 = [], Ke$4 = "arbitrary..", Qe$1 = (e2) => {
  const r2 = tt$2(e2), {
    conflictingClassGroups: t2,
    conflictingClassGroupModifiers: o4
  } = e2;
  return {
    getClassGroupId: (a3) => {
      if (a3.startsWith("[") && a3.endsWith("]"))
        return et$1(a3);
      const u2 = a3.split(ee$2), c2 = u2[0] === "" && u2.length > 1 ? 1 : 0;
      return Me$1(u2, c2, r2);
    },
    getConflictingClassGroupIds: (a3, u2) => {
      if (u2) {
        const c2 = o4[a3], b2 = t2[a3];
        return c2 ? b2 ? Ze$2(b2, c2) : c2 : b2 || Ce$1;
      }
      return t2[a3] || Ce$1;
    }
  };
}, Me$1 = (e2, r2, t2) => {
  if (e2.length - r2 === 0)
    return t2.classGroupId;
  const n2 = e2[r2], s2 = t2.nextPart.get(n2);
  if (s2) {
    const b2 = Me$1(e2, r2 + 1, s2);
    if (b2) return b2;
  }
  const a3 = t2.validators;
  if (a3 === null)
    return;
  const u2 = r2 === 0 ? e2.join(ee$2) : e2.slice(r2).join(ee$2), c2 = a3.length;
  for (let b2 = 0; b2 < c2; b2++) {
    const f2 = a3[b2];
    if (f2.validator(u2))
      return f2.classGroupId;
  }
}, et$1 = (e2) => e2.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
  const r2 = e2.slice(1, -1), t2 = r2.indexOf(":"), o4 = r2.slice(0, t2);
  return o4 ? Ke$4 + o4 : void 0;
})(), tt$2 = (e2) => {
  const {
    theme: r2,
    classGroups: t2
  } = e2;
  return rt$1(t2, r2);
}, rt$1 = (e2, r2) => {
  const t2 = je$1();
  for (const o4 in e2) {
    const n2 = e2[o4];
    ue$2(n2, t2, o4, r2);
  }
  return t2;
}, ue$2 = (e2, r2, t2, o4) => {
  const n2 = e2.length;
  for (let s2 = 0; s2 < n2; s2++) {
    const a3 = e2[s2];
    ot$1(a3, r2, t2, o4);
  }
}, ot$1 = (e2, r2, t2, o4) => {
  if (typeof e2 == "string") {
    nt$1(e2, r2, t2);
    return;
  }
  if (typeof e2 == "function") {
    st$1(e2, r2, t2, o4);
    return;
  }
  at$1(e2, r2, t2, o4);
}, nt$1 = (e2, r2, t2) => {
  const o4 = e2 === "" ? r2 : Te$3(r2, e2);
  o4.classGroupId = t2;
}, st$1 = (e2, r2, t2, o4) => {
  if (it$1(e2)) {
    ue$2(e2(o4), r2, t2, o4);
    return;
  }
  r2.validators === null && (r2.validators = []), r2.validators.push(Je$1(t2, e2));
}, at$1 = (e2, r2, t2, o4) => {
  const n2 = Object.entries(e2), s2 = n2.length;
  for (let a3 = 0; a3 < s2; a3++) {
    const [u2, c2] = n2[a3];
    ue$2(c2, Te$3(r2, u2), t2, o4);
  }
}, Te$3 = (e2, r2) => {
  let t2 = e2;
  const o4 = r2.split(ee$2), n2 = o4.length;
  for (let s2 = 0; s2 < n2; s2++) {
    const a3 = o4[s2];
    let u2 = t2.nextPart.get(a3);
    u2 || (u2 = je$1(), t2.nextPart.set(a3, u2)), t2 = u2;
  }
  return t2;
}, it$1 = (e2) => "isThemeGetter" in e2 && e2.isThemeGetter === true, lt$1 = (e2) => {
  if (e2 < 1)
    return {
      get: () => {
      },
      set: () => {
      }
    };
  let r2 = 0, t2 = /* @__PURE__ */ Object.create(null), o4 = /* @__PURE__ */ Object.create(null);
  const n2 = (s2, a3) => {
    t2[s2] = a3, r2++, r2 > e2 && (r2 = 0, o4 = t2, t2 = /* @__PURE__ */ Object.create(null));
  };
  return {
    get(s2) {
      let a3 = t2[s2];
      if (a3 !== void 0)
        return a3;
      if ((a3 = o4[s2]) !== void 0)
        return n2(s2, a3), a3;
    },
    set(s2, a3) {
      s2 in t2 ? t2[s2] = a3 : n2(s2, a3);
    }
  };
}, de$3 = "!", Se = ":", ct$1 = [], Ae$3 = (e2, r2, t2, o4, n2) => ({
  modifiers: e2,
  hasImportantModifier: r2,
  baseClassName: t2,
  maybePostfixModifierPosition: o4,
  isExternal: n2
}), dt$1 = (e2) => {
  const {
    prefix: r2,
    experimentalParseClassName: t2
  } = e2;
  let o4 = (n2) => {
    const s2 = [];
    let a3 = 0, u2 = 0, c2 = 0, b2;
    const f2 = n2.length;
    for (let C2 = 0; C2 < f2; C2++) {
      const v2 = n2[C2];
      if (a3 === 0 && u2 === 0) {
        if (v2 === Se) {
          s2.push(n2.slice(c2, C2)), c2 = C2 + 1;
          continue;
        }
        if (v2 === "/") {
          b2 = C2;
          continue;
        }
      }
      v2 === "[" ? a3++ : v2 === "]" ? a3-- : v2 === "(" ? u2++ : v2 === ")" && u2--;
    }
    const g2 = s2.length === 0 ? n2 : n2.slice(c2);
    let y2 = g2, I2 = false;
    g2.endsWith(de$3) ? (y2 = g2.slice(0, -1), I2 = true) : (
      /**
       * In Tailwind CSS v3 the important modifier was at the start of the base class name. This is still supported for legacy reasons.
       * @see https://github.com/dcastil/tailwind-merge/issues/513#issuecomment-2614029864
       */
      g2.startsWith(de$3) && (y2 = g2.slice(1), I2 = true)
    );
    const P2 = b2 && b2 > c2 ? b2 - c2 : void 0;
    return Ae$3(s2, I2, y2, P2);
  };
  if (r2) {
    const n2 = r2 + Se, s2 = o4;
    o4 = (a3) => a3.startsWith(n2) ? s2(a3.slice(n2.length)) : Ae$3(ct$1, false, a3, void 0, true);
  }
  if (t2) {
    const n2 = o4;
    o4 = (s2) => t2({
      className: s2,
      parseClassName: n2
    });
  }
  return o4;
}, mt$2 = (e2) => {
  const r2 = /* @__PURE__ */ new Map();
  return e2.orderSensitiveModifiers.forEach((t2, o4) => {
    r2.set(t2, 1e6 + o4);
  }), (t2) => {
    const o4 = [];
    let n2 = [];
    for (let s2 = 0; s2 < t2.length; s2++) {
      const a3 = t2[s2], u2 = a3[0] === "[", c2 = r2.has(a3);
      u2 || c2 ? (n2.length > 0 && (n2.sort(), o4.push(...n2), n2 = []), o4.push(a3)) : n2.push(a3);
    }
    return n2.length > 0 && (n2.sort(), o4.push(...n2)), o4;
  };
}, ut$1 = (e2) => ({
  cache: lt$1(e2.cacheSize),
  parseClassName: dt$1(e2),
  sortModifiers: mt$2(e2),
  ...Qe$1(e2)
}), bt$2 = /\s+/, pt$2 = (e2, r2) => {
  const {
    parseClassName: t2,
    getClassGroupId: o4,
    getConflictingClassGroupIds: n2,
    sortModifiers: s2
  } = r2, a3 = [], u2 = e2.trim().split(bt$2);
  let c2 = "";
  for (let b2 = u2.length - 1; b2 >= 0; b2 -= 1) {
    const f2 = u2[b2], {
      isExternal: g2,
      modifiers: y2,
      hasImportantModifier: I2,
      baseClassName: P2,
      maybePostfixModifierPosition: C2
    } = t2(f2);
    if (g2) {
      c2 = f2 + (c2.length > 0 ? " " + c2 : c2);
      continue;
    }
    let v2 = !!C2, M2 = o4(v2 ? P2.substring(0, C2) : P2);
    if (!M2) {
      if (!v2) {
        c2 = f2 + (c2.length > 0 ? " " + c2 : c2);
        continue;
      }
      if (M2 = o4(P2), !M2) {
        c2 = f2 + (c2.length > 0 ? " " + c2 : c2);
        continue;
      }
      v2 = false;
    }
    const Y2 = y2.length === 0 ? "" : y2.length === 1 ? y2[0] : s2(y2).join(":"), $2 = I2 ? Y2 + de$3 : Y2, L2 = $2 + M2;
    if (a3.indexOf(L2) > -1)
      continue;
    a3.push(L2);
    const W2 = n2(M2, v2);
    for (let T3 = 0; T3 < W2.length; ++T3) {
      const D2 = W2[T3];
      a3.push($2 + D2);
    }
    c2 = f2 + (c2.length > 0 ? " " + c2 : c2);
  }
  return c2;
}, ft$2 = (...e2) => {
  let r2 = 0, t2, o4, n2 = "";
  for (; r2 < e2.length; )
    (t2 = e2[r2++]) && (o4 = Ee(t2)) && (n2 && (n2 += " "), n2 += o4);
  return n2;
}, Ee = (e2) => {
  if (typeof e2 == "string")
    return e2;
  let r2, t2 = "";
  for (let o4 = 0; o4 < e2.length; o4++)
    e2[o4] && (r2 = Ee(e2[o4])) && (t2 && (t2 += " "), t2 += r2);
  return t2;
}, gt$4 = (e2, ...r2) => {
  let t2, o4, n2, s2;
  const a3 = (c2) => {
    const b2 = r2.reduce((f2, g2) => g2(f2), e2());
    return t2 = ut$1(b2), o4 = t2.cache.get, n2 = t2.cache.set, s2 = u2, u2(c2);
  }, u2 = (c2) => {
    const b2 = o4(c2);
    if (b2)
      return b2;
    const f2 = pt$2(c2, t2);
    return n2(c2, f2), f2;
  };
  return s2 = a3, (...c2) => s2(ft$2(...c2));
}, ht$4 = [], h$9 = (e2) => {
  const r2 = (t2) => t2[e2] || ht$4;
  return r2.isThemeGetter = true, r2;
}, Ge$2 = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, Oe$2 = /^\((?:(\w[\w-]*):)?(.+)\)$/i, xt$2 = /^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/, yt$3 = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, vt$3 = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, kt$2 = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, wt$2 = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, zt$1 = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, V$3 = (e2) => xt$2.test(e2), p$9 = (e2) => !!e2 && !Number.isNaN(Number(e2)), _$4 = (e2) => !!e2 && Number.isInteger(Number(e2)), ie = (e2) => e2.endsWith("%") && p$9(e2.slice(0, -1)), N$2 = (e2) => yt$3.test(e2), Le$2 = () => true, Ct$3 = (e2) => (
  // `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
  // For example, `hsl(0 0% 0%)` would be classified as a length without this check.
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
  vt$3.test(e2) && !kt$2.test(e2)
), be$1 = () => false, St$2 = (e2) => wt$2.test(e2), At$3 = (e2) => zt$1.test(e2), Rt$3 = (e2) => !i$6(e2) && !l$8(e2), It$2 = (e2) => j$6(e2, Be$1, be$1), i$6 = (e2) => Ge$2.test(e2), G$3 = (e2) => j$6(e2, $e$2, Ct$3), Re$2 = (e2) => j$6(e2, Et$4, p$9), Pt$3 = (e2) => j$6(e2, Ue$1, Le$2), Nt$1 = (e2) => j$6(e2, De$1, be$1), Ie$1 = (e2) => j$6(e2, We$2, be$1), Vt$1 = (e2) => j$6(e2, Fe$5, At$3), K$2 = (e2) => j$6(e2, Ye$2, St$2), l$8 = (e2) => Oe$2.test(e2), U$2 = (e2) => O$3(e2, $e$2), _t$3 = (e2) => O$3(e2, De$1), Pe$1 = (e2) => O$3(e2, We$2), jt$1 = (e2) => O$3(e2, Be$1), Mt$3 = (e2) => O$3(e2, Fe$5), Q$1 = (e2) => O$3(e2, Ye$2, true), Tt$3 = (e2) => O$3(e2, Ue$1, true), j$6 = (e2, r2, t2) => {
  const o4 = Ge$2.exec(e2);
  return o4 ? o4[1] ? r2(o4[1]) : t2(o4[2]) : false;
}, O$3 = (e2, r2, t2 = false) => {
  const o4 = Oe$2.exec(e2);
  return o4 ? o4[1] ? r2(o4[1]) : t2 : false;
}, We$2 = (e2) => e2 === "position" || e2 === "percentage", Fe$5 = (e2) => e2 === "image" || e2 === "url", Be$1 = (e2) => e2 === "length" || e2 === "size" || e2 === "bg-size", $e$2 = (e2) => e2 === "length", Et$4 = (e2) => e2 === "number", De$1 = (e2) => e2 === "family-name", Ue$1 = (e2) => e2 === "number" || e2 === "weight", Ye$2 = (e2) => e2 === "shadow", Gt$1 = () => {
  const e2 = h$9("color"), r2 = h$9("font"), t2 = h$9("text"), o4 = h$9("font-weight"), n2 = h$9("tracking"), s2 = h$9("leading"), a3 = h$9("breakpoint"), u2 = h$9("container"), c2 = h$9("spacing"), b2 = h$9("radius"), f2 = h$9("shadow"), g2 = h$9("inset-shadow"), y2 = h$9("text-shadow"), I2 = h$9("drop-shadow"), P2 = h$9("blur"), C2 = h$9("perspective"), v2 = h$9("aspect"), M2 = h$9("ease"), Y2 = h$9("animate"), $2 = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], L2 = () => [
    "center",
    "top",
    "bottom",
    "left",
    "right",
    "top-left",
    // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
    "left-top",
    "top-right",
    // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
    "right-top",
    "bottom-right",
    // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
    "right-bottom",
    "bottom-left",
    // Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
    "left-bottom"
  ], W2 = () => [...L2(), l$8, i$6], T3 = () => ["auto", "hidden", "clip", "visible", "scroll"], D2 = () => ["auto", "contain", "none"], d2 = () => [l$8, i$6, c2], S2 = () => [V$3, "full", "auto", ...d2()], pe2 = () => [_$4, "none", "subgrid", l$8, i$6], fe2 = () => ["auto", {
    span: ["full", _$4, l$8, i$6]
  }, _$4, l$8, i$6], q2 = () => [_$4, "auto", l$8, i$6], ge2 = () => ["auto", "min", "max", "fr", l$8, i$6], re2 = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], F2 = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], R2 = () => ["auto", ...d2()], E2 = () => [V$3, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...d2()], oe2 = () => [V$3, "screen", "full", "dvw", "lvw", "svw", "min", "max", "fit", ...d2()], ne2 = () => [V$3, "screen", "full", "lh", "dvh", "lvh", "svh", "min", "max", "fit", ...d2()], m3 = () => [e2, l$8, i$6], he2 = () => [...L2(), Pe$1, Ie$1, {
    position: [l$8, i$6]
  }], xe2 = () => ["no-repeat", {
    repeat: ["", "x", "y", "space", "round"]
  }], ye2 = () => ["auto", "cover", "contain", jt$1, It$2, {
    size: [l$8, i$6]
  }], se = () => [ie, U$2, G$3], k2 = () => [
    // Deprecated since Tailwind CSS v4.0.0
    "",
    "none",
    "full",
    b2,
    l$8,
    i$6
  ], w2 = () => ["", p$9, U$2, G$3], H2 = () => ["solid", "dashed", "dotted", "double"], ve2 = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], x2 = () => [p$9, ie, Pe$1, Ie$1], ke = () => [
    // Deprecated since Tailwind CSS v4.0.0
    "",
    "none",
    P2,
    l$8,
    i$6
  ], X2 = () => ["none", p$9, l$8, i$6], Z2 = () => ["none", p$9, l$8, i$6], ae = () => [p$9, l$8, i$6], J2 = () => [V$3, "full", ...d2()];
  return {
    cacheSize: 500,
    theme: {
      animate: ["spin", "ping", "pulse", "bounce"],
      aspect: ["video"],
      blur: [N$2],
      breakpoint: [N$2],
      color: [Le$2],
      container: [N$2],
      "drop-shadow": [N$2],
      ease: ["in", "out", "in-out"],
      font: [Rt$3],
      "font-weight": ["thin", "extralight", "light", "normal", "medium", "semibold", "bold", "extrabold", "black"],
      "inset-shadow": [N$2],
      leading: ["none", "tight", "snug", "normal", "relaxed", "loose"],
      perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
      radius: [N$2],
      shadow: [N$2],
      spacing: ["px", p$9],
      text: [N$2],
      "text-shadow": [N$2],
      tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
    },
    classGroups: {
      // --------------
      // --- Layout ---
      // --------------
      /**
       * Aspect Ratio
       * @see https://tailwindcss.com/docs/aspect-ratio
       */
      aspect: [{
        aspect: ["auto", "square", V$3, i$6, l$8, v2]
      }],
      /**
       * Container
       * @see https://tailwindcss.com/docs/container
       * @deprecated since Tailwind CSS v4.0.0
       */
      container: ["container"],
      /**
       * Columns
       * @see https://tailwindcss.com/docs/columns
       */
      columns: [{
        columns: [p$9, i$6, l$8, u2]
      }],
      /**
       * Break After
       * @see https://tailwindcss.com/docs/break-after
       */
      "break-after": [{
        "break-after": $2()
      }],
      /**
       * Break Before
       * @see https://tailwindcss.com/docs/break-before
       */
      "break-before": [{
        "break-before": $2()
      }],
      /**
       * Break Inside
       * @see https://tailwindcss.com/docs/break-inside
       */
      "break-inside": [{
        "break-inside": ["auto", "avoid", "avoid-page", "avoid-column"]
      }],
      /**
       * Box Decoration Break
       * @see https://tailwindcss.com/docs/box-decoration-break
       */
      "box-decoration": [{
        "box-decoration": ["slice", "clone"]
      }],
      /**
       * Box Sizing
       * @see https://tailwindcss.com/docs/box-sizing
       */
      box: [{
        box: ["border", "content"]
      }],
      /**
       * Display
       * @see https://tailwindcss.com/docs/display
       */
      display: ["block", "inline-block", "inline", "flex", "inline-flex", "table", "inline-table", "table-caption", "table-cell", "table-column", "table-column-group", "table-footer-group", "table-header-group", "table-row-group", "table-row", "flow-root", "grid", "inline-grid", "contents", "list-item", "hidden"],
      /**
       * Screen Reader Only
       * @see https://tailwindcss.com/docs/display#screen-reader-only
       */
      sr: ["sr-only", "not-sr-only"],
      /**
       * Floats
       * @see https://tailwindcss.com/docs/float
       */
      float: [{
        float: ["right", "left", "none", "start", "end"]
      }],
      /**
       * Clear
       * @see https://tailwindcss.com/docs/clear
       */
      clear: [{
        clear: ["left", "right", "both", "none", "start", "end"]
      }],
      /**
       * Isolation
       * @see https://tailwindcss.com/docs/isolation
       */
      isolation: ["isolate", "isolation-auto"],
      /**
       * Object Fit
       * @see https://tailwindcss.com/docs/object-fit
       */
      "object-fit": [{
        object: ["contain", "cover", "fill", "none", "scale-down"]
      }],
      /**
       * Object Position
       * @see https://tailwindcss.com/docs/object-position
       */
      "object-position": [{
        object: W2()
      }],
      /**
       * Overflow
       * @see https://tailwindcss.com/docs/overflow
       */
      overflow: [{
        overflow: T3()
      }],
      /**
       * Overflow X
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-x": [{
        "overflow-x": T3()
      }],
      /**
       * Overflow Y
       * @see https://tailwindcss.com/docs/overflow
       */
      "overflow-y": [{
        "overflow-y": T3()
      }],
      /**
       * Overscroll Behavior
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      overscroll: [{
        overscroll: D2()
      }],
      /**
       * Overscroll Behavior X
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-x": [{
        "overscroll-x": D2()
      }],
      /**
       * Overscroll Behavior Y
       * @see https://tailwindcss.com/docs/overscroll-behavior
       */
      "overscroll-y": [{
        "overscroll-y": D2()
      }],
      /**
       * Position
       * @see https://tailwindcss.com/docs/position
       */
      position: ["static", "fixed", "absolute", "relative", "sticky"],
      /**
       * Inset
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      inset: [{
        inset: S2()
      }],
      /**
       * Inset Inline
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-x": [{
        "inset-x": S2()
      }],
      /**
       * Inset Block
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-y": [{
        "inset-y": S2()
      }],
      /**
       * Inset Inline Start
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       * @todo class group will be renamed to `inset-s` in next major release
       */
      start: [{
        "inset-s": S2(),
        /**
         * @deprecated since Tailwind CSS v4.2.0 in favor of `inset-s-*` utilities.
         * @see https://github.com/tailwindlabs/tailwindcss/pull/19613
         */
        start: S2()
      }],
      /**
       * Inset Inline End
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       * @todo class group will be renamed to `inset-e` in next major release
       */
      end: [{
        "inset-e": S2(),
        /**
         * @deprecated since Tailwind CSS v4.2.0 in favor of `inset-e-*` utilities.
         * @see https://github.com/tailwindlabs/tailwindcss/pull/19613
         */
        end: S2()
      }],
      /**
       * Inset Block Start
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-bs": [{
        "inset-bs": S2()
      }],
      /**
       * Inset Block End
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      "inset-be": [{
        "inset-be": S2()
      }],
      /**
       * Top
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      top: [{
        top: S2()
      }],
      /**
       * Right
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      right: [{
        right: S2()
      }],
      /**
       * Bottom
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      bottom: [{
        bottom: S2()
      }],
      /**
       * Left
       * @see https://tailwindcss.com/docs/top-right-bottom-left
       */
      left: [{
        left: S2()
      }],
      /**
       * Visibility
       * @see https://tailwindcss.com/docs/visibility
       */
      visibility: ["visible", "invisible", "collapse"],
      /**
       * Z-Index
       * @see https://tailwindcss.com/docs/z-index
       */
      z: [{
        z: [_$4, "auto", l$8, i$6]
      }],
      // ------------------------
      // --- Flexbox and Grid ---
      // ------------------------
      /**
       * Flex Basis
       * @see https://tailwindcss.com/docs/flex-basis
       */
      basis: [{
        basis: [V$3, "full", "auto", u2, ...d2()]
      }],
      /**
       * Flex Direction
       * @see https://tailwindcss.com/docs/flex-direction
       */
      "flex-direction": [{
        flex: ["row", "row-reverse", "col", "col-reverse"]
      }],
      /**
       * Flex Wrap
       * @see https://tailwindcss.com/docs/flex-wrap
       */
      "flex-wrap": [{
        flex: ["nowrap", "wrap", "wrap-reverse"]
      }],
      /**
       * Flex
       * @see https://tailwindcss.com/docs/flex
       */
      flex: [{
        flex: [p$9, V$3, "auto", "initial", "none", i$6]
      }],
      /**
       * Flex Grow
       * @see https://tailwindcss.com/docs/flex-grow
       */
      grow: [{
        grow: ["", p$9, l$8, i$6]
      }],
      /**
       * Flex Shrink
       * @see https://tailwindcss.com/docs/flex-shrink
       */
      shrink: [{
        shrink: ["", p$9, l$8, i$6]
      }],
      /**
       * Order
       * @see https://tailwindcss.com/docs/order
       */
      order: [{
        order: [_$4, "first", "last", "none", l$8, i$6]
      }],
      /**
       * Grid Template Columns
       * @see https://tailwindcss.com/docs/grid-template-columns
       */
      "grid-cols": [{
        "grid-cols": pe2()
      }],
      /**
       * Grid Column Start / End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start-end": [{
        col: fe2()
      }],
      /**
       * Grid Column Start
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-start": [{
        "col-start": q2()
      }],
      /**
       * Grid Column End
       * @see https://tailwindcss.com/docs/grid-column
       */
      "col-end": [{
        "col-end": q2()
      }],
      /**
       * Grid Template Rows
       * @see https://tailwindcss.com/docs/grid-template-rows
       */
      "grid-rows": [{
        "grid-rows": pe2()
      }],
      /**
       * Grid Row Start / End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start-end": [{
        row: fe2()
      }],
      /**
       * Grid Row Start
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-start": [{
        "row-start": q2()
      }],
      /**
       * Grid Row End
       * @see https://tailwindcss.com/docs/grid-row
       */
      "row-end": [{
        "row-end": q2()
      }],
      /**
       * Grid Auto Flow
       * @see https://tailwindcss.com/docs/grid-auto-flow
       */
      "grid-flow": [{
        "grid-flow": ["row", "col", "dense", "row-dense", "col-dense"]
      }],
      /**
       * Grid Auto Columns
       * @see https://tailwindcss.com/docs/grid-auto-columns
       */
      "auto-cols": [{
        "auto-cols": ge2()
      }],
      /**
       * Grid Auto Rows
       * @see https://tailwindcss.com/docs/grid-auto-rows
       */
      "auto-rows": [{
        "auto-rows": ge2()
      }],
      /**
       * Gap
       * @see https://tailwindcss.com/docs/gap
       */
      gap: [{
        gap: d2()
      }],
      /**
       * Gap X
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-x": [{
        "gap-x": d2()
      }],
      /**
       * Gap Y
       * @see https://tailwindcss.com/docs/gap
       */
      "gap-y": [{
        "gap-y": d2()
      }],
      /**
       * Justify Content
       * @see https://tailwindcss.com/docs/justify-content
       */
      "justify-content": [{
        justify: [...re2(), "normal"]
      }],
      /**
       * Justify Items
       * @see https://tailwindcss.com/docs/justify-items
       */
      "justify-items": [{
        "justify-items": [...F2(), "normal"]
      }],
      /**
       * Justify Self
       * @see https://tailwindcss.com/docs/justify-self
       */
      "justify-self": [{
        "justify-self": ["auto", ...F2()]
      }],
      /**
       * Align Content
       * @see https://tailwindcss.com/docs/align-content
       */
      "align-content": [{
        content: ["normal", ...re2()]
      }],
      /**
       * Align Items
       * @see https://tailwindcss.com/docs/align-items
       */
      "align-items": [{
        items: [...F2(), {
          baseline: ["", "last"]
        }]
      }],
      /**
       * Align Self
       * @see https://tailwindcss.com/docs/align-self
       */
      "align-self": [{
        self: ["auto", ...F2(), {
          baseline: ["", "last"]
        }]
      }],
      /**
       * Place Content
       * @see https://tailwindcss.com/docs/place-content
       */
      "place-content": [{
        "place-content": re2()
      }],
      /**
       * Place Items
       * @see https://tailwindcss.com/docs/place-items
       */
      "place-items": [{
        "place-items": [...F2(), "baseline"]
      }],
      /**
       * Place Self
       * @see https://tailwindcss.com/docs/place-self
       */
      "place-self": [{
        "place-self": ["auto", ...F2()]
      }],
      // Spacing
      /**
       * Padding
       * @see https://tailwindcss.com/docs/padding
       */
      p: [{
        p: d2()
      }],
      /**
       * Padding Inline
       * @see https://tailwindcss.com/docs/padding
       */
      px: [{
        px: d2()
      }],
      /**
       * Padding Block
       * @see https://tailwindcss.com/docs/padding
       */
      py: [{
        py: d2()
      }],
      /**
       * Padding Inline Start
       * @see https://tailwindcss.com/docs/padding
       */
      ps: [{
        ps: d2()
      }],
      /**
       * Padding Inline End
       * @see https://tailwindcss.com/docs/padding
       */
      pe: [{
        pe: d2()
      }],
      /**
       * Padding Block Start
       * @see https://tailwindcss.com/docs/padding
       */
      pbs: [{
        pbs: d2()
      }],
      /**
       * Padding Block End
       * @see https://tailwindcss.com/docs/padding
       */
      pbe: [{
        pbe: d2()
      }],
      /**
       * Padding Top
       * @see https://tailwindcss.com/docs/padding
       */
      pt: [{
        pt: d2()
      }],
      /**
       * Padding Right
       * @see https://tailwindcss.com/docs/padding
       */
      pr: [{
        pr: d2()
      }],
      /**
       * Padding Bottom
       * @see https://tailwindcss.com/docs/padding
       */
      pb: [{
        pb: d2()
      }],
      /**
       * Padding Left
       * @see https://tailwindcss.com/docs/padding
       */
      pl: [{
        pl: d2()
      }],
      /**
       * Margin
       * @see https://tailwindcss.com/docs/margin
       */
      m: [{
        m: R2()
      }],
      /**
       * Margin Inline
       * @see https://tailwindcss.com/docs/margin
       */
      mx: [{
        mx: R2()
      }],
      /**
       * Margin Block
       * @see https://tailwindcss.com/docs/margin
       */
      my: [{
        my: R2()
      }],
      /**
       * Margin Inline Start
       * @see https://tailwindcss.com/docs/margin
       */
      ms: [{
        ms: R2()
      }],
      /**
       * Margin Inline End
       * @see https://tailwindcss.com/docs/margin
       */
      me: [{
        me: R2()
      }],
      /**
       * Margin Block Start
       * @see https://tailwindcss.com/docs/margin
       */
      mbs: [{
        mbs: R2()
      }],
      /**
       * Margin Block End
       * @see https://tailwindcss.com/docs/margin
       */
      mbe: [{
        mbe: R2()
      }],
      /**
       * Margin Top
       * @see https://tailwindcss.com/docs/margin
       */
      mt: [{
        mt: R2()
      }],
      /**
       * Margin Right
       * @see https://tailwindcss.com/docs/margin
       */
      mr: [{
        mr: R2()
      }],
      /**
       * Margin Bottom
       * @see https://tailwindcss.com/docs/margin
       */
      mb: [{
        mb: R2()
      }],
      /**
       * Margin Left
       * @see https://tailwindcss.com/docs/margin
       */
      ml: [{
        ml: R2()
      }],
      /**
       * Space Between X
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-x": [{
        "space-x": d2()
      }],
      /**
       * Space Between X Reverse
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-x-reverse": ["space-x-reverse"],
      /**
       * Space Between Y
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-y": [{
        "space-y": d2()
      }],
      /**
       * Space Between Y Reverse
       * @see https://tailwindcss.com/docs/margin#adding-space-between-children
       */
      "space-y-reverse": ["space-y-reverse"],
      // --------------
      // --- Sizing ---
      // --------------
      /**
       * Size
       * @see https://tailwindcss.com/docs/width#setting-both-width-and-height
       */
      size: [{
        size: E2()
      }],
      /**
       * Inline Size
       * @see https://tailwindcss.com/docs/width
       */
      "inline-size": [{
        inline: ["auto", ...oe2()]
      }],
      /**
       * Min-Inline Size
       * @see https://tailwindcss.com/docs/min-width
       */
      "min-inline-size": [{
        "min-inline": ["auto", ...oe2()]
      }],
      /**
       * Max-Inline Size
       * @see https://tailwindcss.com/docs/max-width
       */
      "max-inline-size": [{
        "max-inline": ["none", ...oe2()]
      }],
      /**
       * Block Size
       * @see https://tailwindcss.com/docs/height
       */
      "block-size": [{
        block: ["auto", ...ne2()]
      }],
      /**
       * Min-Block Size
       * @see https://tailwindcss.com/docs/min-height
       */
      "min-block-size": [{
        "min-block": ["auto", ...ne2()]
      }],
      /**
       * Max-Block Size
       * @see https://tailwindcss.com/docs/max-height
       */
      "max-block-size": [{
        "max-block": ["none", ...ne2()]
      }],
      /**
       * Width
       * @see https://tailwindcss.com/docs/width
       */
      w: [{
        w: [u2, "screen", ...E2()]
      }],
      /**
       * Min-Width
       * @see https://tailwindcss.com/docs/min-width
       */
      "min-w": [{
        "min-w": [
          u2,
          "screen",
          /** Deprecated. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          "none",
          ...E2()
        ]
      }],
      /**
       * Max-Width
       * @see https://tailwindcss.com/docs/max-width
       */
      "max-w": [{
        "max-w": [
          u2,
          "screen",
          "none",
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          "prose",
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          {
            screen: [a3]
          },
          ...E2()
        ]
      }],
      /**
       * Height
       * @see https://tailwindcss.com/docs/height
       */
      h: [{
        h: ["screen", "lh", ...E2()]
      }],
      /**
       * Min-Height
       * @see https://tailwindcss.com/docs/min-height
       */
      "min-h": [{
        "min-h": ["screen", "lh", "none", ...E2()]
      }],
      /**
       * Max-Height
       * @see https://tailwindcss.com/docs/max-height
       */
      "max-h": [{
        "max-h": ["screen", "lh", ...E2()]
      }],
      // ------------------
      // --- Typography ---
      // ------------------
      /**
       * Font Size
       * @see https://tailwindcss.com/docs/font-size
       */
      "font-size": [{
        text: ["base", t2, U$2, G$3]
      }],
      /**
       * Font Smoothing
       * @see https://tailwindcss.com/docs/font-smoothing
       */
      "font-smoothing": ["antialiased", "subpixel-antialiased"],
      /**
       * Font Style
       * @see https://tailwindcss.com/docs/font-style
       */
      "font-style": ["italic", "not-italic"],
      /**
       * Font Weight
       * @see https://tailwindcss.com/docs/font-weight
       */
      "font-weight": [{
        font: [o4, Tt$3, Pt$3]
      }],
      /**
       * Font Stretch
       * @see https://tailwindcss.com/docs/font-stretch
       */
      "font-stretch": [{
        "font-stretch": ["ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded", ie, i$6]
      }],
      /**
       * Font Family
       * @see https://tailwindcss.com/docs/font-family
       */
      "font-family": [{
        font: [_t$3, Nt$1, r2]
      }],
      /**
       * Font Feature Settings
       * @see https://tailwindcss.com/docs/font-feature-settings
       */
      "font-features": [{
        "font-features": [i$6]
      }],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-normal": ["normal-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-ordinal": ["ordinal"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-slashed-zero": ["slashed-zero"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-figure": ["lining-nums", "oldstyle-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-spacing": ["proportional-nums", "tabular-nums"],
      /**
       * Font Variant Numeric
       * @see https://tailwindcss.com/docs/font-variant-numeric
       */
      "fvn-fraction": ["diagonal-fractions", "stacked-fractions"],
      /**
       * Letter Spacing
       * @see https://tailwindcss.com/docs/letter-spacing
       */
      tracking: [{
        tracking: [n2, l$8, i$6]
      }],
      /**
       * Line Clamp
       * @see https://tailwindcss.com/docs/line-clamp
       */
      "line-clamp": [{
        "line-clamp": [p$9, "none", l$8, Re$2]
      }],
      /**
       * Line Height
       * @see https://tailwindcss.com/docs/line-height
       */
      leading: [{
        leading: [
          /** Deprecated since Tailwind CSS v4.0.0. @see https://github.com/tailwindlabs/tailwindcss.com/issues/2027#issuecomment-2620152757 */
          s2,
          ...d2()
        ]
      }],
      /**
       * List Style Image
       * @see https://tailwindcss.com/docs/list-style-image
       */
      "list-image": [{
        "list-image": ["none", l$8, i$6]
      }],
      /**
       * List Style Position
       * @see https://tailwindcss.com/docs/list-style-position
       */
      "list-style-position": [{
        list: ["inside", "outside"]
      }],
      /**
       * List Style Type
       * @see https://tailwindcss.com/docs/list-style-type
       */
      "list-style-type": [{
        list: ["disc", "decimal", "none", l$8, i$6]
      }],
      /**
       * Text Alignment
       * @see https://tailwindcss.com/docs/text-align
       */
      "text-alignment": [{
        text: ["left", "center", "right", "justify", "start", "end"]
      }],
      /**
       * Placeholder Color
       * @deprecated since Tailwind CSS v3.0.0
       * @see https://v3.tailwindcss.com/docs/placeholder-color
       */
      "placeholder-color": [{
        placeholder: m3()
      }],
      /**
       * Text Color
       * @see https://tailwindcss.com/docs/text-color
       */
      "text-color": [{
        text: m3()
      }],
      /**
       * Text Decoration
       * @see https://tailwindcss.com/docs/text-decoration
       */
      "text-decoration": ["underline", "overline", "line-through", "no-underline"],
      /**
       * Text Decoration Style
       * @see https://tailwindcss.com/docs/text-decoration-style
       */
      "text-decoration-style": [{
        decoration: [...H2(), "wavy"]
      }],
      /**
       * Text Decoration Thickness
       * @see https://tailwindcss.com/docs/text-decoration-thickness
       */
      "text-decoration-thickness": [{
        decoration: [p$9, "from-font", "auto", l$8, G$3]
      }],
      /**
       * Text Decoration Color
       * @see https://tailwindcss.com/docs/text-decoration-color
       */
      "text-decoration-color": [{
        decoration: m3()
      }],
      /**
       * Text Underline Offset
       * @see https://tailwindcss.com/docs/text-underline-offset
       */
      "underline-offset": [{
        "underline-offset": [p$9, "auto", l$8, i$6]
      }],
      /**
       * Text Transform
       * @see https://tailwindcss.com/docs/text-transform
       */
      "text-transform": ["uppercase", "lowercase", "capitalize", "normal-case"],
      /**
       * Text Overflow
       * @see https://tailwindcss.com/docs/text-overflow
       */
      "text-overflow": ["truncate", "text-ellipsis", "text-clip"],
      /**
       * Text Wrap
       * @see https://tailwindcss.com/docs/text-wrap
       */
      "text-wrap": [{
        text: ["wrap", "nowrap", "balance", "pretty"]
      }],
      /**
       * Text Indent
       * @see https://tailwindcss.com/docs/text-indent
       */
      indent: [{
        indent: d2()
      }],
      /**
       * Vertical Alignment
       * @see https://tailwindcss.com/docs/vertical-align
       */
      "vertical-align": [{
        align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", l$8, i$6]
      }],
      /**
       * Whitespace
       * @see https://tailwindcss.com/docs/whitespace
       */
      whitespace: [{
        whitespace: ["normal", "nowrap", "pre", "pre-line", "pre-wrap", "break-spaces"]
      }],
      /**
       * Word Break
       * @see https://tailwindcss.com/docs/word-break
       */
      break: [{
        break: ["normal", "words", "all", "keep"]
      }],
      /**
       * Overflow Wrap
       * @see https://tailwindcss.com/docs/overflow-wrap
       */
      wrap: [{
        wrap: ["break-word", "anywhere", "normal"]
      }],
      /**
       * Hyphens
       * @see https://tailwindcss.com/docs/hyphens
       */
      hyphens: [{
        hyphens: ["none", "manual", "auto"]
      }],
      /**
       * Content
       * @see https://tailwindcss.com/docs/content
       */
      content: [{
        content: ["none", l$8, i$6]
      }],
      // -------------------
      // --- Backgrounds ---
      // -------------------
      /**
       * Background Attachment
       * @see https://tailwindcss.com/docs/background-attachment
       */
      "bg-attachment": [{
        bg: ["fixed", "local", "scroll"]
      }],
      /**
       * Background Clip
       * @see https://tailwindcss.com/docs/background-clip
       */
      "bg-clip": [{
        "bg-clip": ["border", "padding", "content", "text"]
      }],
      /**
       * Background Origin
       * @see https://tailwindcss.com/docs/background-origin
       */
      "bg-origin": [{
        "bg-origin": ["border", "padding", "content"]
      }],
      /**
       * Background Position
       * @see https://tailwindcss.com/docs/background-position
       */
      "bg-position": [{
        bg: he2()
      }],
      /**
       * Background Repeat
       * @see https://tailwindcss.com/docs/background-repeat
       */
      "bg-repeat": [{
        bg: xe2()
      }],
      /**
       * Background Size
       * @see https://tailwindcss.com/docs/background-size
       */
      "bg-size": [{
        bg: ye2()
      }],
      /**
       * Background Image
       * @see https://tailwindcss.com/docs/background-image
       */
      "bg-image": [{
        bg: ["none", {
          linear: [{
            to: ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
          }, _$4, l$8, i$6],
          radial: ["", l$8, i$6],
          conic: [_$4, l$8, i$6]
        }, Mt$3, Vt$1]
      }],
      /**
       * Background Color
       * @see https://tailwindcss.com/docs/background-color
       */
      "bg-color": [{
        bg: m3()
      }],
      /**
       * Gradient Color Stops From Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from-pos": [{
        from: se()
      }],
      /**
       * Gradient Color Stops Via Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via-pos": [{
        via: se()
      }],
      /**
       * Gradient Color Stops To Position
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to-pos": [{
        to: se()
      }],
      /**
       * Gradient Color Stops From
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-from": [{
        from: m3()
      }],
      /**
       * Gradient Color Stops Via
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-via": [{
        via: m3()
      }],
      /**
       * Gradient Color Stops To
       * @see https://tailwindcss.com/docs/gradient-color-stops
       */
      "gradient-to": [{
        to: m3()
      }],
      // ---------------
      // --- Borders ---
      // ---------------
      /**
       * Border Radius
       * @see https://tailwindcss.com/docs/border-radius
       */
      rounded: [{
        rounded: k2()
      }],
      /**
       * Border Radius Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-s": [{
        "rounded-s": k2()
      }],
      /**
       * Border Radius End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-e": [{
        "rounded-e": k2()
      }],
      /**
       * Border Radius Top
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-t": [{
        "rounded-t": k2()
      }],
      /**
       * Border Radius Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-r": [{
        "rounded-r": k2()
      }],
      /**
       * Border Radius Bottom
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-b": [{
        "rounded-b": k2()
      }],
      /**
       * Border Radius Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-l": [{
        "rounded-l": k2()
      }],
      /**
       * Border Radius Start Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ss": [{
        "rounded-ss": k2()
      }],
      /**
       * Border Radius Start End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-se": [{
        "rounded-se": k2()
      }],
      /**
       * Border Radius End End
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-ee": [{
        "rounded-ee": k2()
      }],
      /**
       * Border Radius End Start
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-es": [{
        "rounded-es": k2()
      }],
      /**
       * Border Radius Top Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tl": [{
        "rounded-tl": k2()
      }],
      /**
       * Border Radius Top Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-tr": [{
        "rounded-tr": k2()
      }],
      /**
       * Border Radius Bottom Right
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-br": [{
        "rounded-br": k2()
      }],
      /**
       * Border Radius Bottom Left
       * @see https://tailwindcss.com/docs/border-radius
       */
      "rounded-bl": [{
        "rounded-bl": k2()
      }],
      /**
       * Border Width
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w": [{
        border: w2()
      }],
      /**
       * Border Width Inline
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-x": [{
        "border-x": w2()
      }],
      /**
       * Border Width Block
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-y": [{
        "border-y": w2()
      }],
      /**
       * Border Width Inline Start
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-s": [{
        "border-s": w2()
      }],
      /**
       * Border Width Inline End
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-e": [{
        "border-e": w2()
      }],
      /**
       * Border Width Block Start
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-bs": [{
        "border-bs": w2()
      }],
      /**
       * Border Width Block End
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-be": [{
        "border-be": w2()
      }],
      /**
       * Border Width Top
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-t": [{
        "border-t": w2()
      }],
      /**
       * Border Width Right
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-r": [{
        "border-r": w2()
      }],
      /**
       * Border Width Bottom
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-b": [{
        "border-b": w2()
      }],
      /**
       * Border Width Left
       * @see https://tailwindcss.com/docs/border-width
       */
      "border-w-l": [{
        "border-l": w2()
      }],
      /**
       * Divide Width X
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-x": [{
        "divide-x": w2()
      }],
      /**
       * Divide Width X Reverse
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-x-reverse": ["divide-x-reverse"],
      /**
       * Divide Width Y
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-y": [{
        "divide-y": w2()
      }],
      /**
       * Divide Width Y Reverse
       * @see https://tailwindcss.com/docs/border-width#between-children
       */
      "divide-y-reverse": ["divide-y-reverse"],
      /**
       * Border Style
       * @see https://tailwindcss.com/docs/border-style
       */
      "border-style": [{
        border: [...H2(), "hidden", "none"]
      }],
      /**
       * Divide Style
       * @see https://tailwindcss.com/docs/border-style#setting-the-divider-style
       */
      "divide-style": [{
        divide: [...H2(), "hidden", "none"]
      }],
      /**
       * Border Color
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color": [{
        border: m3()
      }],
      /**
       * Border Color Inline
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-x": [{
        "border-x": m3()
      }],
      /**
       * Border Color Block
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-y": [{
        "border-y": m3()
      }],
      /**
       * Border Color Inline Start
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-s": [{
        "border-s": m3()
      }],
      /**
       * Border Color Inline End
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-e": [{
        "border-e": m3()
      }],
      /**
       * Border Color Block Start
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-bs": [{
        "border-bs": m3()
      }],
      /**
       * Border Color Block End
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-be": [{
        "border-be": m3()
      }],
      /**
       * Border Color Top
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-t": [{
        "border-t": m3()
      }],
      /**
       * Border Color Right
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-r": [{
        "border-r": m3()
      }],
      /**
       * Border Color Bottom
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-b": [{
        "border-b": m3()
      }],
      /**
       * Border Color Left
       * @see https://tailwindcss.com/docs/border-color
       */
      "border-color-l": [{
        "border-l": m3()
      }],
      /**
       * Divide Color
       * @see https://tailwindcss.com/docs/divide-color
       */
      "divide-color": [{
        divide: m3()
      }],
      /**
       * Outline Style
       * @see https://tailwindcss.com/docs/outline-style
       */
      "outline-style": [{
        outline: [...H2(), "none", "hidden"]
      }],
      /**
       * Outline Offset
       * @see https://tailwindcss.com/docs/outline-offset
       */
      "outline-offset": [{
        "outline-offset": [p$9, l$8, i$6]
      }],
      /**
       * Outline Width
       * @see https://tailwindcss.com/docs/outline-width
       */
      "outline-w": [{
        outline: ["", p$9, U$2, G$3]
      }],
      /**
       * Outline Color
       * @see https://tailwindcss.com/docs/outline-color
       */
      "outline-color": [{
        outline: m3()
      }],
      // ---------------
      // --- Effects ---
      // ---------------
      /**
       * Box Shadow
       * @see https://tailwindcss.com/docs/box-shadow
       */
      shadow: [{
        shadow: [
          // Deprecated since Tailwind CSS v4.0.0
          "",
          "none",
          f2,
          Q$1,
          K$2
        ]
      }],
      /**
       * Box Shadow Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-shadow-color
       */
      "shadow-color": [{
        shadow: m3()
      }],
      /**
       * Inset Box Shadow
       * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-shadow
       */
      "inset-shadow": [{
        "inset-shadow": ["none", g2, Q$1, K$2]
      }],
      /**
       * Inset Box Shadow Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-shadow-color
       */
      "inset-shadow-color": [{
        "inset-shadow": m3()
      }],
      /**
       * Ring Width
       * @see https://tailwindcss.com/docs/box-shadow#adding-a-ring
       */
      "ring-w": [{
        ring: w2()
      }],
      /**
       * Ring Width Inset
       * @see https://v3.tailwindcss.com/docs/ring-width#inset-rings
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-w-inset": ["ring-inset"],
      /**
       * Ring Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-ring-color
       */
      "ring-color": [{
        ring: m3()
      }],
      /**
       * Ring Offset Width
       * @see https://v3.tailwindcss.com/docs/ring-offset-width
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-offset-w": [{
        "ring-offset": [p$9, G$3]
      }],
      /**
       * Ring Offset Color
       * @see https://v3.tailwindcss.com/docs/ring-offset-color
       * @deprecated since Tailwind CSS v4.0.0
       * @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
       */
      "ring-offset-color": [{
        "ring-offset": m3()
      }],
      /**
       * Inset Ring Width
       * @see https://tailwindcss.com/docs/box-shadow#adding-an-inset-ring
       */
      "inset-ring-w": [{
        "inset-ring": w2()
      }],
      /**
       * Inset Ring Color
       * @see https://tailwindcss.com/docs/box-shadow#setting-the-inset-ring-color
       */
      "inset-ring-color": [{
        "inset-ring": m3()
      }],
      /**
       * Text Shadow
       * @see https://tailwindcss.com/docs/text-shadow
       */
      "text-shadow": [{
        "text-shadow": ["none", y2, Q$1, K$2]
      }],
      /**
       * Text Shadow Color
       * @see https://tailwindcss.com/docs/text-shadow#setting-the-shadow-color
       */
      "text-shadow-color": [{
        "text-shadow": m3()
      }],
      /**
       * Opacity
       * @see https://tailwindcss.com/docs/opacity
       */
      opacity: [{
        opacity: [p$9, l$8, i$6]
      }],
      /**
       * Mix Blend Mode
       * @see https://tailwindcss.com/docs/mix-blend-mode
       */
      "mix-blend": [{
        "mix-blend": [...ve2(), "plus-darker", "plus-lighter"]
      }],
      /**
       * Background Blend Mode
       * @see https://tailwindcss.com/docs/background-blend-mode
       */
      "bg-blend": [{
        "bg-blend": ve2()
      }],
      /**
       * Mask Clip
       * @see https://tailwindcss.com/docs/mask-clip
       */
      "mask-clip": [{
        "mask-clip": ["border", "padding", "content", "fill", "stroke", "view"]
      }, "mask-no-clip"],
      /**
       * Mask Composite
       * @see https://tailwindcss.com/docs/mask-composite
       */
      "mask-composite": [{
        mask: ["add", "subtract", "intersect", "exclude"]
      }],
      /**
       * Mask Image
       * @see https://tailwindcss.com/docs/mask-image
       */
      "mask-image-linear-pos": [{
        "mask-linear": [p$9]
      }],
      "mask-image-linear-from-pos": [{
        "mask-linear-from": x2()
      }],
      "mask-image-linear-to-pos": [{
        "mask-linear-to": x2()
      }],
      "mask-image-linear-from-color": [{
        "mask-linear-from": m3()
      }],
      "mask-image-linear-to-color": [{
        "mask-linear-to": m3()
      }],
      "mask-image-t-from-pos": [{
        "mask-t-from": x2()
      }],
      "mask-image-t-to-pos": [{
        "mask-t-to": x2()
      }],
      "mask-image-t-from-color": [{
        "mask-t-from": m3()
      }],
      "mask-image-t-to-color": [{
        "mask-t-to": m3()
      }],
      "mask-image-r-from-pos": [{
        "mask-r-from": x2()
      }],
      "mask-image-r-to-pos": [{
        "mask-r-to": x2()
      }],
      "mask-image-r-from-color": [{
        "mask-r-from": m3()
      }],
      "mask-image-r-to-color": [{
        "mask-r-to": m3()
      }],
      "mask-image-b-from-pos": [{
        "mask-b-from": x2()
      }],
      "mask-image-b-to-pos": [{
        "mask-b-to": x2()
      }],
      "mask-image-b-from-color": [{
        "mask-b-from": m3()
      }],
      "mask-image-b-to-color": [{
        "mask-b-to": m3()
      }],
      "mask-image-l-from-pos": [{
        "mask-l-from": x2()
      }],
      "mask-image-l-to-pos": [{
        "mask-l-to": x2()
      }],
      "mask-image-l-from-color": [{
        "mask-l-from": m3()
      }],
      "mask-image-l-to-color": [{
        "mask-l-to": m3()
      }],
      "mask-image-x-from-pos": [{
        "mask-x-from": x2()
      }],
      "mask-image-x-to-pos": [{
        "mask-x-to": x2()
      }],
      "mask-image-x-from-color": [{
        "mask-x-from": m3()
      }],
      "mask-image-x-to-color": [{
        "mask-x-to": m3()
      }],
      "mask-image-y-from-pos": [{
        "mask-y-from": x2()
      }],
      "mask-image-y-to-pos": [{
        "mask-y-to": x2()
      }],
      "mask-image-y-from-color": [{
        "mask-y-from": m3()
      }],
      "mask-image-y-to-color": [{
        "mask-y-to": m3()
      }],
      "mask-image-radial": [{
        "mask-radial": [l$8, i$6]
      }],
      "mask-image-radial-from-pos": [{
        "mask-radial-from": x2()
      }],
      "mask-image-radial-to-pos": [{
        "mask-radial-to": x2()
      }],
      "mask-image-radial-from-color": [{
        "mask-radial-from": m3()
      }],
      "mask-image-radial-to-color": [{
        "mask-radial-to": m3()
      }],
      "mask-image-radial-shape": [{
        "mask-radial": ["circle", "ellipse"]
      }],
      "mask-image-radial-size": [{
        "mask-radial": [{
          closest: ["side", "corner"],
          farthest: ["side", "corner"]
        }]
      }],
      "mask-image-radial-pos": [{
        "mask-radial-at": L2()
      }],
      "mask-image-conic-pos": [{
        "mask-conic": [p$9]
      }],
      "mask-image-conic-from-pos": [{
        "mask-conic-from": x2()
      }],
      "mask-image-conic-to-pos": [{
        "mask-conic-to": x2()
      }],
      "mask-image-conic-from-color": [{
        "mask-conic-from": m3()
      }],
      "mask-image-conic-to-color": [{
        "mask-conic-to": m3()
      }],
      /**
       * Mask Mode
       * @see https://tailwindcss.com/docs/mask-mode
       */
      "mask-mode": [{
        mask: ["alpha", "luminance", "match"]
      }],
      /**
       * Mask Origin
       * @see https://tailwindcss.com/docs/mask-origin
       */
      "mask-origin": [{
        "mask-origin": ["border", "padding", "content", "fill", "stroke", "view"]
      }],
      /**
       * Mask Position
       * @see https://tailwindcss.com/docs/mask-position
       */
      "mask-position": [{
        mask: he2()
      }],
      /**
       * Mask Repeat
       * @see https://tailwindcss.com/docs/mask-repeat
       */
      "mask-repeat": [{
        mask: xe2()
      }],
      /**
       * Mask Size
       * @see https://tailwindcss.com/docs/mask-size
       */
      "mask-size": [{
        mask: ye2()
      }],
      /**
       * Mask Type
       * @see https://tailwindcss.com/docs/mask-type
       */
      "mask-type": [{
        "mask-type": ["alpha", "luminance"]
      }],
      /**
       * Mask Image
       * @see https://tailwindcss.com/docs/mask-image
       */
      "mask-image": [{
        mask: ["none", l$8, i$6]
      }],
      // ---------------
      // --- Filters ---
      // ---------------
      /**
       * Filter
       * @see https://tailwindcss.com/docs/filter
       */
      filter: [{
        filter: [
          // Deprecated since Tailwind CSS v3.0.0
          "",
          "none",
          l$8,
          i$6
        ]
      }],
      /**
       * Blur
       * @see https://tailwindcss.com/docs/blur
       */
      blur: [{
        blur: ke()
      }],
      /**
       * Brightness
       * @see https://tailwindcss.com/docs/brightness
       */
      brightness: [{
        brightness: [p$9, l$8, i$6]
      }],
      /**
       * Contrast
       * @see https://tailwindcss.com/docs/contrast
       */
      contrast: [{
        contrast: [p$9, l$8, i$6]
      }],
      /**
       * Drop Shadow
       * @see https://tailwindcss.com/docs/drop-shadow
       */
      "drop-shadow": [{
        "drop-shadow": [
          // Deprecated since Tailwind CSS v4.0.0
          "",
          "none",
          I2,
          Q$1,
          K$2
        ]
      }],
      /**
       * Drop Shadow Color
       * @see https://tailwindcss.com/docs/filter-drop-shadow#setting-the-shadow-color
       */
      "drop-shadow-color": [{
        "drop-shadow": m3()
      }],
      /**
       * Grayscale
       * @see https://tailwindcss.com/docs/grayscale
       */
      grayscale: [{
        grayscale: ["", p$9, l$8, i$6]
      }],
      /**
       * Hue Rotate
       * @see https://tailwindcss.com/docs/hue-rotate
       */
      "hue-rotate": [{
        "hue-rotate": [p$9, l$8, i$6]
      }],
      /**
       * Invert
       * @see https://tailwindcss.com/docs/invert
       */
      invert: [{
        invert: ["", p$9, l$8, i$6]
      }],
      /**
       * Saturate
       * @see https://tailwindcss.com/docs/saturate
       */
      saturate: [{
        saturate: [p$9, l$8, i$6]
      }],
      /**
       * Sepia
       * @see https://tailwindcss.com/docs/sepia
       */
      sepia: [{
        sepia: ["", p$9, l$8, i$6]
      }],
      /**
       * Backdrop Filter
       * @see https://tailwindcss.com/docs/backdrop-filter
       */
      "backdrop-filter": [{
        "backdrop-filter": [
          // Deprecated since Tailwind CSS v3.0.0
          "",
          "none",
          l$8,
          i$6
        ]
      }],
      /**
       * Backdrop Blur
       * @see https://tailwindcss.com/docs/backdrop-blur
       */
      "backdrop-blur": [{
        "backdrop-blur": ke()
      }],
      /**
       * Backdrop Brightness
       * @see https://tailwindcss.com/docs/backdrop-brightness
       */
      "backdrop-brightness": [{
        "backdrop-brightness": [p$9, l$8, i$6]
      }],
      /**
       * Backdrop Contrast
       * @see https://tailwindcss.com/docs/backdrop-contrast
       */
      "backdrop-contrast": [{
        "backdrop-contrast": [p$9, l$8, i$6]
      }],
      /**
       * Backdrop Grayscale
       * @see https://tailwindcss.com/docs/backdrop-grayscale
       */
      "backdrop-grayscale": [{
        "backdrop-grayscale": ["", p$9, l$8, i$6]
      }],
      /**
       * Backdrop Hue Rotate
       * @see https://tailwindcss.com/docs/backdrop-hue-rotate
       */
      "backdrop-hue-rotate": [{
        "backdrop-hue-rotate": [p$9, l$8, i$6]
      }],
      /**
       * Backdrop Invert
       * @see https://tailwindcss.com/docs/backdrop-invert
       */
      "backdrop-invert": [{
        "backdrop-invert": ["", p$9, l$8, i$6]
      }],
      /**
       * Backdrop Opacity
       * @see https://tailwindcss.com/docs/backdrop-opacity
       */
      "backdrop-opacity": [{
        "backdrop-opacity": [p$9, l$8, i$6]
      }],
      /**
       * Backdrop Saturate
       * @see https://tailwindcss.com/docs/backdrop-saturate
       */
      "backdrop-saturate": [{
        "backdrop-saturate": [p$9, l$8, i$6]
      }],
      /**
       * Backdrop Sepia
       * @see https://tailwindcss.com/docs/backdrop-sepia
       */
      "backdrop-sepia": [{
        "backdrop-sepia": ["", p$9, l$8, i$6]
      }],
      // --------------
      // --- Tables ---
      // --------------
      /**
       * Border Collapse
       * @see https://tailwindcss.com/docs/border-collapse
       */
      "border-collapse": [{
        border: ["collapse", "separate"]
      }],
      /**
       * Border Spacing
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing": [{
        "border-spacing": d2()
      }],
      /**
       * Border Spacing X
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-x": [{
        "border-spacing-x": d2()
      }],
      /**
       * Border Spacing Y
       * @see https://tailwindcss.com/docs/border-spacing
       */
      "border-spacing-y": [{
        "border-spacing-y": d2()
      }],
      /**
       * Table Layout
       * @see https://tailwindcss.com/docs/table-layout
       */
      "table-layout": [{
        table: ["auto", "fixed"]
      }],
      /**
       * Caption Side
       * @see https://tailwindcss.com/docs/caption-side
       */
      caption: [{
        caption: ["top", "bottom"]
      }],
      // ---------------------------------
      // --- Transitions and Animation ---
      // ---------------------------------
      /**
       * Transition Property
       * @see https://tailwindcss.com/docs/transition-property
       */
      transition: [{
        transition: ["", "all", "colors", "opacity", "shadow", "transform", "none", l$8, i$6]
      }],
      /**
       * Transition Behavior
       * @see https://tailwindcss.com/docs/transition-behavior
       */
      "transition-behavior": [{
        transition: ["normal", "discrete"]
      }],
      /**
       * Transition Duration
       * @see https://tailwindcss.com/docs/transition-duration
       */
      duration: [{
        duration: [p$9, "initial", l$8, i$6]
      }],
      /**
       * Transition Timing Function
       * @see https://tailwindcss.com/docs/transition-timing-function
       */
      ease: [{
        ease: ["linear", "initial", M2, l$8, i$6]
      }],
      /**
       * Transition Delay
       * @see https://tailwindcss.com/docs/transition-delay
       */
      delay: [{
        delay: [p$9, l$8, i$6]
      }],
      /**
       * Animation
       * @see https://tailwindcss.com/docs/animation
       */
      animate: [{
        animate: ["none", Y2, l$8, i$6]
      }],
      // ------------------
      // --- Transforms ---
      // ------------------
      /**
       * Backface Visibility
       * @see https://tailwindcss.com/docs/backface-visibility
       */
      backface: [{
        backface: ["hidden", "visible"]
      }],
      /**
       * Perspective
       * @see https://tailwindcss.com/docs/perspective
       */
      perspective: [{
        perspective: [C2, l$8, i$6]
      }],
      /**
       * Perspective Origin
       * @see https://tailwindcss.com/docs/perspective-origin
       */
      "perspective-origin": [{
        "perspective-origin": W2()
      }],
      /**
       * Rotate
       * @see https://tailwindcss.com/docs/rotate
       */
      rotate: [{
        rotate: X2()
      }],
      /**
       * Rotate X
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-x": [{
        "rotate-x": X2()
      }],
      /**
       * Rotate Y
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-y": [{
        "rotate-y": X2()
      }],
      /**
       * Rotate Z
       * @see https://tailwindcss.com/docs/rotate
       */
      "rotate-z": [{
        "rotate-z": X2()
      }],
      /**
       * Scale
       * @see https://tailwindcss.com/docs/scale
       */
      scale: [{
        scale: Z2()
      }],
      /**
       * Scale X
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-x": [{
        "scale-x": Z2()
      }],
      /**
       * Scale Y
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-y": [{
        "scale-y": Z2()
      }],
      /**
       * Scale Z
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-z": [{
        "scale-z": Z2()
      }],
      /**
       * Scale 3D
       * @see https://tailwindcss.com/docs/scale
       */
      "scale-3d": ["scale-3d"],
      /**
       * Skew
       * @see https://tailwindcss.com/docs/skew
       */
      skew: [{
        skew: ae()
      }],
      /**
       * Skew X
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-x": [{
        "skew-x": ae()
      }],
      /**
       * Skew Y
       * @see https://tailwindcss.com/docs/skew
       */
      "skew-y": [{
        "skew-y": ae()
      }],
      /**
       * Transform
       * @see https://tailwindcss.com/docs/transform
       */
      transform: [{
        transform: [l$8, i$6, "", "none", "gpu", "cpu"]
      }],
      /**
       * Transform Origin
       * @see https://tailwindcss.com/docs/transform-origin
       */
      "transform-origin": [{
        origin: W2()
      }],
      /**
       * Transform Style
       * @see https://tailwindcss.com/docs/transform-style
       */
      "transform-style": [{
        transform: ["3d", "flat"]
      }],
      /**
       * Translate
       * @see https://tailwindcss.com/docs/translate
       */
      translate: [{
        translate: J2()
      }],
      /**
       * Translate X
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-x": [{
        "translate-x": J2()
      }],
      /**
       * Translate Y
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-y": [{
        "translate-y": J2()
      }],
      /**
       * Translate Z
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-z": [{
        "translate-z": J2()
      }],
      /**
       * Translate None
       * @see https://tailwindcss.com/docs/translate
       */
      "translate-none": ["translate-none"],
      // ---------------------
      // --- Interactivity ---
      // ---------------------
      /**
       * Accent Color
       * @see https://tailwindcss.com/docs/accent-color
       */
      accent: [{
        accent: m3()
      }],
      /**
       * Appearance
       * @see https://tailwindcss.com/docs/appearance
       */
      appearance: [{
        appearance: ["none", "auto"]
      }],
      /**
       * Caret Color
       * @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities
       */
      "caret-color": [{
        caret: m3()
      }],
      /**
       * Color Scheme
       * @see https://tailwindcss.com/docs/color-scheme
       */
      "color-scheme": [{
        scheme: ["normal", "dark", "light", "light-dark", "only-dark", "only-light"]
      }],
      /**
       * Cursor
       * @see https://tailwindcss.com/docs/cursor
       */
      cursor: [{
        cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", l$8, i$6]
      }],
      /**
       * Field Sizing
       * @see https://tailwindcss.com/docs/field-sizing
       */
      "field-sizing": [{
        "field-sizing": ["fixed", "content"]
      }],
      /**
       * Pointer Events
       * @see https://tailwindcss.com/docs/pointer-events
       */
      "pointer-events": [{
        "pointer-events": ["auto", "none"]
      }],
      /**
       * Resize
       * @see https://tailwindcss.com/docs/resize
       */
      resize: [{
        resize: ["none", "", "y", "x"]
      }],
      /**
       * Scroll Behavior
       * @see https://tailwindcss.com/docs/scroll-behavior
       */
      "scroll-behavior": [{
        scroll: ["auto", "smooth"]
      }],
      /**
       * Scroll Margin
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-m": [{
        "scroll-m": d2()
      }],
      /**
       * Scroll Margin Inline
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mx": [{
        "scroll-mx": d2()
      }],
      /**
       * Scroll Margin Block
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-my": [{
        "scroll-my": d2()
      }],
      /**
       * Scroll Margin Inline Start
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ms": [{
        "scroll-ms": d2()
      }],
      /**
       * Scroll Margin Inline End
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-me": [{
        "scroll-me": d2()
      }],
      /**
       * Scroll Margin Block Start
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mbs": [{
        "scroll-mbs": d2()
      }],
      /**
       * Scroll Margin Block End
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mbe": [{
        "scroll-mbe": d2()
      }],
      /**
       * Scroll Margin Top
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mt": [{
        "scroll-mt": d2()
      }],
      /**
       * Scroll Margin Right
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mr": [{
        "scroll-mr": d2()
      }],
      /**
       * Scroll Margin Bottom
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-mb": [{
        "scroll-mb": d2()
      }],
      /**
       * Scroll Margin Left
       * @see https://tailwindcss.com/docs/scroll-margin
       */
      "scroll-ml": [{
        "scroll-ml": d2()
      }],
      /**
       * Scroll Padding
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-p": [{
        "scroll-p": d2()
      }],
      /**
       * Scroll Padding Inline
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-px": [{
        "scroll-px": d2()
      }],
      /**
       * Scroll Padding Block
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-py": [{
        "scroll-py": d2()
      }],
      /**
       * Scroll Padding Inline Start
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-ps": [{
        "scroll-ps": d2()
      }],
      /**
       * Scroll Padding Inline End
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pe": [{
        "scroll-pe": d2()
      }],
      /**
       * Scroll Padding Block Start
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pbs": [{
        "scroll-pbs": d2()
      }],
      /**
       * Scroll Padding Block End
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pbe": [{
        "scroll-pbe": d2()
      }],
      /**
       * Scroll Padding Top
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pt": [{
        "scroll-pt": d2()
      }],
      /**
       * Scroll Padding Right
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pr": [{
        "scroll-pr": d2()
      }],
      /**
       * Scroll Padding Bottom
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pb": [{
        "scroll-pb": d2()
      }],
      /**
       * Scroll Padding Left
       * @see https://tailwindcss.com/docs/scroll-padding
       */
      "scroll-pl": [{
        "scroll-pl": d2()
      }],
      /**
       * Scroll Snap Align
       * @see https://tailwindcss.com/docs/scroll-snap-align
       */
      "snap-align": [{
        snap: ["start", "end", "center", "align-none"]
      }],
      /**
       * Scroll Snap Stop
       * @see https://tailwindcss.com/docs/scroll-snap-stop
       */
      "snap-stop": [{
        snap: ["normal", "always"]
      }],
      /**
       * Scroll Snap Type
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-type": [{
        snap: ["none", "x", "y", "both"]
      }],
      /**
       * Scroll Snap Type Strictness
       * @see https://tailwindcss.com/docs/scroll-snap-type
       */
      "snap-strictness": [{
        snap: ["mandatory", "proximity"]
      }],
      /**
       * Touch Action
       * @see https://tailwindcss.com/docs/touch-action
       */
      touch: [{
        touch: ["auto", "none", "manipulation"]
      }],
      /**
       * Touch Action X
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-x": [{
        "touch-pan": ["x", "left", "right"]
      }],
      /**
       * Touch Action Y
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-y": [{
        "touch-pan": ["y", "up", "down"]
      }],
      /**
       * Touch Action Pinch Zoom
       * @see https://tailwindcss.com/docs/touch-action
       */
      "touch-pz": ["touch-pinch-zoom"],
      /**
       * User Select
       * @see https://tailwindcss.com/docs/user-select
       */
      select: [{
        select: ["none", "text", "all", "auto"]
      }],
      /**
       * Will Change
       * @see https://tailwindcss.com/docs/will-change
       */
      "will-change": [{
        "will-change": ["auto", "scroll", "contents", "transform", l$8, i$6]
      }],
      // -----------
      // --- SVG ---
      // -----------
      /**
       * Fill
       * @see https://tailwindcss.com/docs/fill
       */
      fill: [{
        fill: ["none", ...m3()]
      }],
      /**
       * Stroke Width
       * @see https://tailwindcss.com/docs/stroke-width
       */
      "stroke-w": [{
        stroke: [p$9, U$2, G$3, Re$2]
      }],
      /**
       * Stroke
       * @see https://tailwindcss.com/docs/stroke
       */
      stroke: [{
        stroke: ["none", ...m3()]
      }],
      // ---------------------
      // --- Accessibility ---
      // ---------------------
      /**
       * Forced Color Adjust
       * @see https://tailwindcss.com/docs/forced-color-adjust
       */
      "forced-color-adjust": [{
        "forced-color-adjust": ["auto", "none"]
      }]
    },
    conflictingClassGroups: {
      overflow: ["overflow-x", "overflow-y"],
      overscroll: ["overscroll-x", "overscroll-y"],
      inset: ["inset-x", "inset-y", "inset-bs", "inset-be", "start", "end", "top", "right", "bottom", "left"],
      "inset-x": ["right", "left"],
      "inset-y": ["top", "bottom"],
      flex: ["basis", "grow", "shrink"],
      gap: ["gap-x", "gap-y"],
      p: ["px", "py", "ps", "pe", "pbs", "pbe", "pt", "pr", "pb", "pl"],
      px: ["pr", "pl"],
      py: ["pt", "pb"],
      m: ["mx", "my", "ms", "me", "mbs", "mbe", "mt", "mr", "mb", "ml"],
      mx: ["mr", "ml"],
      my: ["mt", "mb"],
      size: ["w", "h"],
      "font-size": ["leading"],
      "fvn-normal": ["fvn-ordinal", "fvn-slashed-zero", "fvn-figure", "fvn-spacing", "fvn-fraction"],
      "fvn-ordinal": ["fvn-normal"],
      "fvn-slashed-zero": ["fvn-normal"],
      "fvn-figure": ["fvn-normal"],
      "fvn-spacing": ["fvn-normal"],
      "fvn-fraction": ["fvn-normal"],
      "line-clamp": ["display", "overflow"],
      rounded: ["rounded-s", "rounded-e", "rounded-t", "rounded-r", "rounded-b", "rounded-l", "rounded-ss", "rounded-se", "rounded-ee", "rounded-es", "rounded-tl", "rounded-tr", "rounded-br", "rounded-bl"],
      "rounded-s": ["rounded-ss", "rounded-es"],
      "rounded-e": ["rounded-se", "rounded-ee"],
      "rounded-t": ["rounded-tl", "rounded-tr"],
      "rounded-r": ["rounded-tr", "rounded-br"],
      "rounded-b": ["rounded-br", "rounded-bl"],
      "rounded-l": ["rounded-tl", "rounded-bl"],
      "border-spacing": ["border-spacing-x", "border-spacing-y"],
      "border-w": ["border-w-x", "border-w-y", "border-w-s", "border-w-e", "border-w-bs", "border-w-be", "border-w-t", "border-w-r", "border-w-b", "border-w-l"],
      "border-w-x": ["border-w-r", "border-w-l"],
      "border-w-y": ["border-w-t", "border-w-b"],
      "border-color": ["border-color-x", "border-color-y", "border-color-s", "border-color-e", "border-color-bs", "border-color-be", "border-color-t", "border-color-r", "border-color-b", "border-color-l"],
      "border-color-x": ["border-color-r", "border-color-l"],
      "border-color-y": ["border-color-t", "border-color-b"],
      translate: ["translate-x", "translate-y", "translate-none"],
      "translate-none": ["translate", "translate-x", "translate-y", "translate-z"],
      "scroll-m": ["scroll-mx", "scroll-my", "scroll-ms", "scroll-me", "scroll-mbs", "scroll-mbe", "scroll-mt", "scroll-mr", "scroll-mb", "scroll-ml"],
      "scroll-mx": ["scroll-mr", "scroll-ml"],
      "scroll-my": ["scroll-mt", "scroll-mb"],
      "scroll-p": ["scroll-px", "scroll-py", "scroll-ps", "scroll-pe", "scroll-pbs", "scroll-pbe", "scroll-pt", "scroll-pr", "scroll-pb", "scroll-pl"],
      "scroll-px": ["scroll-pr", "scroll-pl"],
      "scroll-py": ["scroll-pt", "scroll-pb"],
      touch: ["touch-x", "touch-y", "touch-pz"],
      "touch-x": ["touch"],
      "touch-y": ["touch"],
      "touch-pz": ["touch"]
    },
    conflictingClassGroupModifiers: {
      "font-size": ["leading"]
    },
    orderSensitiveModifiers: ["*", "**", "after", "backdrop", "before", "details-content", "file", "first-letter", "first-line", "marker", "placeholder", "selection"]
  };
}, Ot$2 = /* @__PURE__ */ gt$4(Gt$1);
function B$1(...e2) {
  return Ot$2(_e$1(e2));
}
const er$1 = (e2 = 8) => `${Math.random().toString(36).substring(e2)}`, Lt$2 = me$1("flex items-center gap-1.5", {
  variants: {
    size: {
      sm: "gap-1",
      md: "gap-1.5",
      lg: "gap-2"
    }
  },
  defaultVariants: {
    size: "md"
  }
}), le$1 = me$1("block animate-bounce rounded-full bg-current", {
  variants: {
    size: {
      sm: "size-1",
      md: "size-1.5",
      lg: "size-2"
    }
  },
  defaultVariants: {
    size: "md"
  }
}), Wt$1 = ({
  size: e2,
  label: r2,
  className: t2
}) => /* @__PURE__ */ window.wp.element.jsxs("span", { className: B$1(Lt$2({ size: e2, className: t2 })), children: [
  /* @__PURE__ */ window.wp.element.jsx("span", { className: B$1(le$1({ size: e2 }), "[animation-delay:-0.2s]") }),
  /* @__PURE__ */ window.wp.element.jsx("span", { className: B$1(le$1({ size: e2 })) }),
  /* @__PURE__ */ window.wp.element.jsx("span", { className: B$1(le$1({ size: e2 }), "[animation-delay:0.2s]") }),
  r2 && /* @__PURE__ */ window.wp.element.jsx("span", { className: "ml-1 block text-current", children: r2 })
] });
function Ne$2(e2, r2) {
  if (typeof e2 == "function")
    return e2(r2);
  e2 != null && (e2.current = r2);
}
function Ft$3(...e2) {
  return (r2) => {
    let t2 = false;
    const o4 = e2.map((n2) => {
      const s2 = Ne$2(n2, r2);
      return !t2 && typeof s2 == "function" && (t2 = true), s2;
    });
    if (t2)
      return () => {
        for (let n2 = 0; n2 < o4.length; n2++) {
          const s2 = o4[n2];
          typeof s2 == "function" ? s2() : Ne$2(e2[n2], null);
        }
      };
  };
}
var Bt$3 = /* @__PURE__ */ Symbol.for("react.lazy"), te$1 = window.wp.element[" use ".trim().toString()];
function $t$1(e2) {
  return typeof e2 == "object" && e2 !== null && "then" in e2;
}
function qe$2(e2) {
  return e2 != null && typeof e2 == "object" && "$$typeof" in e2 && e2.$$typeof === Bt$3 && "_payload" in e2 && $t$1(e2._payload);
}
// @__NO_SIDE_EFFECTS__
function Dt$3(e2) {
  const r2 = /* @__PURE__ */ Yt$1(e2), t2 = window.wp.element.forwardRef((o4, n2) => {
    let { children: s2, ...a3 } = o4;
    qe$2(s2) && typeof te$1 == "function" && (s2 = te$1(s2._payload));
    const u2 = window.wp.element.Children.toArray(s2), c2 = u2.find(Ht$1);
    if (c2) {
      const b2 = c2.props.children, f2 = u2.map((g2) => g2 === c2 ? window.wp.element.Children.count(b2) > 1 ? window.wp.element.Children.only(null) : window.wp.element.isValidElement(b2) ? b2.props.children : null : g2);
      return /* @__PURE__ */ window.wp.element.jsx(r2, { ...a3, ref: n2, children: window.wp.element.isValidElement(b2) ? window.wp.element.cloneElement(b2, void 0, f2) : null });
    }
    return /* @__PURE__ */ window.wp.element.jsx(r2, { ...a3, ref: n2, children: s2 });
  });
  return t2.displayName = `${e2}.Slot`, t2;
}
var Ut$1 = /* @__PURE__ */ Dt$3("Slot");
// @__NO_SIDE_EFFECTS__
function Yt$1(e2) {
  const r2 = window.wp.element.forwardRef((t2, o4) => {
    let { children: n2, ...s2 } = t2;
    if (qe$2(n2) && typeof te$1 == "function" && (n2 = te$1(n2._payload)), window.wp.element.isValidElement(n2)) {
      const a3 = Zt$1(n2), u2 = Xt$1(s2, n2.props);
      return n2.type !== window.wp.element.Fragment && (u2.ref = o4 ? Ft$3(o4, a3) : a3), window.wp.element.cloneElement(n2, u2);
    }
    return window.wp.element.Children.count(n2) > 1 ? window.wp.element.Children.only(null) : null;
  });
  return r2.displayName = `${e2}.SlotClone`, r2;
}
var qt$1 = /* @__PURE__ */ Symbol("radix.slottable");
function Ht$1(e2) {
  return window.wp.element.isValidElement(e2) && typeof e2.type == "function" && "__radixId" in e2.type && e2.type.__radixId === qt$1;
}
function Xt$1(e2, r2) {
  const t2 = { ...r2 };
  for (const o4 in r2) {
    const n2 = e2[o4], s2 = r2[o4];
    /^on[A-Z]/.test(o4) ? n2 && s2 ? t2[o4] = (...u2) => {
      const c2 = s2(...u2);
      return n2(...u2), c2;
    } : n2 && (t2[o4] = n2) : o4 === "style" ? t2[o4] = { ...n2, ...s2 } : o4 === "className" && (t2[o4] = [n2, s2].filter(Boolean).join(" "));
  }
  return { ...e2, ...t2 };
}
function Zt$1(e2) {
  let r2 = Object.getOwnPropertyDescriptor(e2.props, "ref")?.get, t2 = r2 && "isReactWarning" in r2 && r2.isReactWarning;
  return t2 ? e2.ref : (r2 = Object.getOwnPropertyDescriptor(e2, "ref")?.get, t2 = r2 && "isReactWarning" in r2 && r2.isReactWarning, t2 ? e2.props.ref : e2.props.ref || e2.ref);
}
const Jt$1 = me$1(
  [
    // Layout
    "relative group/button inline-flex items-center justify-center font-bold text-nowrap cursor-pointer",
    // Transitions — spring deceleration (--ease-out) at --duration-fast
    "transition-all duration-fast ease-out",
    // Disabled — deliberately NO `pointer-events-none`: it swallowed hover
    // entirely, so neither `cursor-not-allowed` nor the `title` tooltip
    // callers pass to explain WHY a CTA is gated could ever show. A gated
    // primary button then read as enabled-but-broken (wp.org first-impression
    // QA, 2026-09-02: "Generate Post"/"New Campaign" felt like dead clicks).
    // Native `disabled` already blocks activation; we only suppress the
    // hover/press motion so the button doesn't *animate* like it's live.
    "disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:scale-100 disabled:active:scale-100 disabled:hover:translate-y-0 disabled:active:translate-y-0",
    // Focus — soft glow pattern (design guide 6.5)
    "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)]",
    // Micro-interactions (design guide 5.1 target)
    "hover:scale-[1.02] active:scale-[0.98]",
    // WP admin link-color reset — when asChild wraps <Link>→<a> or href is
    // set, WP's `a:visited` color flashes through. `no-underline!` blocks
    // the default <a> underline from WP admin too.
    "no-underline! visited:text-inherit! hover:text-inherit! focus:text-inherit!",
    // Icon defaults — every Button is permitted exactly one inline icon
    // before/after its label. Size is locked so a stray `<Icon size={N}/>`
    // can't desync from the label, `shrink-0` keeps it from collapsing
    // when the label wraps, and stroke-width 2.5 matches the label's
    // `font-bold`. Per-size overrides below tune the dimensions.
    "[&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:[stroke-width:2.5]",
    // Default gap between an icon and the label. The non-asChild branch
    // also applies this gap onto the inner content `<span>` (see
    // Button.tsx) since the outer button has only one direct child.
    "gap-2"
  ].join(" "),
  {
    variants: {
      variant: {
        primary: (
          // Structura Primary: Electric Indigo. Text is white in both modes.
          "bg-brand-600 text-white! visited:text-white! hover:text-white! focus:text-white! active:text-white! border border-transparent hover:bg-brand-700 shadow-lg shadow-brand-600/20 hover:-translate-y-0.5 active:translate-y-0 dark:bg-brand-500 dark:hover:bg-brand-400 dark:shadow-brand-500/20"
        ),
        accent: (
          // Structura Obsidian: Deep Gray/Black. White text in light mode,
          // inverts to dark text on light button in dark mode.
          "bg-gray-900 text-white! visited:text-white! hover:text-white! focus:text-white! active:text-white! border border-transparent hover:bg-gray-800 shadow-lg shadow-gray-900/20 hover:-translate-y-0.5 active:translate-y-0 dark:bg-white dark:text-gray-900! dark:visited:text-gray-900! dark:hover:text-gray-900! dark:focus:text-gray-900! dark:active:text-gray-900! dark:hover:bg-gray-100 dark:shadow-white/10"
        ),
        secondary: (
          // Standard secondary: White with Gray border. All text-color
          // utilities already use `!` here (WP conflict was found during
          // Phase 2 when this variant used asChild + Link).
          "bg-white! text-gray-700! visited:text-gray-700! focus:text-gray-700! active:text-gray-700! border border-gray-200! hover:bg-gray-50! hover:text-gray-900! hover:border-gray-300! shadow-sm dark:bg-gray-900! dark:border-gray-700! dark:text-gray-300! dark:visited:text-gray-300! dark:focus:text-gray-300! dark:active:text-gray-300! dark:hover:bg-gray-800! dark:hover:text-gray-100! dark:hover:border-gray-600!"
        ),
        danger: (
          // Semantic Red. Locked white in light mode, red-tinted white in dark.
          "bg-red-600 text-white! visited:text-white! hover:text-white! focus:text-white! active:text-white! border border-transparent hover:bg-red-700 shadow-md shadow-red-600/20 dark:bg-red-900/50 dark:text-red-100! dark:visited:text-red-100! dark:hover:text-red-100! dark:focus:text-red-100! dark:active:text-red-100! dark:border-red-900 dark:hover:bg-red-900"
        ),
        dangerGhost: (
          // Quiet destructive: red-tinted outline for actions that destroy
          // something reversible (revoke a link, disconnect) — a solid red
          // `danger` overweights those next to a primary CTA.
          "bg-red-500/5 text-red-600! visited:text-red-600! hover:text-red-600! focus:text-red-600! active:text-red-600! border border-red-500/30 hover:bg-red-500/10 hover:border-red-500/50 dark:bg-red-500/10 dark:text-red-400! dark:visited:text-red-400! dark:hover:text-red-400! dark:focus:text-red-400! dark:active:text-red-400! dark:border-red-500/30 dark:hover:bg-red-500/15"
        ),
        link: (
          // Link style: Brand text. Disable scale micro-interactions for
          // inline links; they should feel like text, not buttons.
          "bg-transparent text-brand-600! visited:text-brand-600! focus:text-brand-600! underline-offset-4 hover:underline disabled:no-underline p-0 h-auto hover:text-brand-700! active:text-brand-700! hover:scale-100 active:scale-100 dark:text-brand-400! dark:visited:text-brand-400! dark:focus:text-brand-400! dark:hover:text-brand-300! dark:active:text-brand-300!"
        ),
        transparent: (
          // Ghost/Transparent: sidebar items, quiet actions.
          "bg-transparent text-gray-600! visited:text-gray-600! focus:text-gray-600! active:text-gray-600! border border-transparent hover:bg-gray-100 hover:text-gray-900! dark:text-gray-400! dark:visited:text-gray-400! dark:focus:text-gray-400! dark:active:text-gray-400! dark:hover:bg-gray-800 dark:hover:text-white!"
        ),
        white: (
          // Neutral bordered button.
          "bg-white text-gray-900! visited:text-gray-900! hover:text-gray-900! focus:text-gray-900! active:text-gray-900! border border-gray-300 hover:bg-gray-50 shadow-sm dark:bg-gray-800 dark:border-gray-600 dark:text-white! dark:visited:text-white! dark:hover:text-white! dark:focus:text-white! dark:active:text-white! dark:hover:bg-gray-700"
        )
      },
      size: {
        // Per-size icon dimensions and gaps. The base classes set
        // `[&_svg]:size-4 gap-2` for `md`; `sm` tightens both, `lg`
        // loosens both. `icon` keeps the default svg size and zeroes
        // the gap since the button is icon-only.
        sm: "px-3 py-1.5 text-xs rounded-lg gap-1.5 [&_svg]:size-3.5",
        md: "px-5 py-2.5 text-sm rounded-xl",
        lg: "px-6 py-3 text-base rounded-2xl gap-2.5 [&_svg]:size-5",
        icon: "h-10 w-10 p-2 rounded-xl gap-0 [&_svg]:size-5"
      }
    },
    defaultVariants: {
      variant: "primary",
      size: "md"
    }
  }
), tr$1 = window.wp.element.forwardRef(
  ({ className: e2, variant: r2, size: t2, asChild: o4 = false, loading: n2 = false, children: s2, ...a3 }, u2) => {
    const c2 = n2 || a3.disabled, b2 = {
      className: B$1(Jt$1({ variant: r2, size: t2, className: e2 })),
      "aria-busy": n2 ? true : void 0,
      disabled: c2
    };
    if (o4)
      return /* @__PURE__ */ window.wp.element.jsx(Ut$1, { ref: u2, ...b2, ...a3, children: s2 });
    const g2 = /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
      n2 && /* @__PURE__ */ window.wp.element.jsxs("div", { className: "absolute inset-0 flex items-center justify-center", children: [
        /* @__PURE__ */ window.wp.element.jsx("span", { className: "sr-only", children: "Loading..." }),
        /* @__PURE__ */ window.wp.element.jsx(Wt$1, { size: t2 === "icon" ? "md" : t2 })
      ] }),
      /* @__PURE__ */ window.wp.element.jsx(
        "span",
        {
          className: B$1("inline-flex items-center justify-center transition-opacity", t2 === "sm" ? "gap-1.5" : t2 === "lg" ? "gap-2.5" : t2 === "icon" ? "gap-0" : "gap-2", {
            "opacity-0": n2
          }),
          children: s2
        }
      )
    ] });
    return a3.href ? /* @__PURE__ */ window.wp.element.jsx(
      "a",
      {
        ref: u2,
        "aria-disabled": c2,
        ...b2,
        ...a3,
        children: g2
      }
    ) : /* @__PURE__ */ window.wp.element.jsx(
      "button",
      {
        ref: u2,
        ...b2,
        ...a3,
        children: g2
      }
    );
  }
);
const $d447af545b77c9f1$export$b204af158042fbac = (el) => {
  return el?.ownerDocument ?? document;
};
const $d447af545b77c9f1$export$f21a1ffae260145a = (el) => {
  if (el && "window" in el && el.window === el) return el;
  const doc = $d447af545b77c9f1$export$b204af158042fbac(el);
  return doc.defaultView || window;
};
function $d447af545b77c9f1$var$isNode(value) {
  return value !== null && typeof value === "object" && "nodeType" in value && typeof value.nodeType === "number";
}
function $d447af545b77c9f1$export$af51f0f06c0f328a(node) {
  return $d447af545b77c9f1$var$isNode(node) && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in node;
}
let $6a20a7989e6c817a$var$_shadowDOM = false;
function $6a20a7989e6c817a$export$98658e8c59125e6a() {
  return $6a20a7989e6c817a$var$_shadowDOM;
}
function $23f2114a1b82827e$export$4282f70798064fe0(node, otherNode) {
  if (!$6a20a7989e6c817a$export$98658e8c59125e6a()) return otherNode && node ? node.contains(otherNode) : false;
  if (!node || !otherNode) return false;
  let currentNode = otherNode;
  while (currentNode !== null) {
    if (currentNode === node) return true;
    if (currentNode.tagName === "SLOT" && currentNode.assignedSlot)
      currentNode = currentNode.assignedSlot.parentNode;
    else if ($d447af545b77c9f1$export$af51f0f06c0f328a(currentNode))
      currentNode = currentNode.host;
    else currentNode = currentNode.parentNode;
  }
  return false;
}
const $23f2114a1b82827e$export$cd4e5573fbe2b576 = (doc = document) => {
  if (!$6a20a7989e6c817a$export$98658e8c59125e6a()) return doc.activeElement;
  let activeElement = doc.activeElement;
  while (activeElement && "shadowRoot" in activeElement && activeElement.shadowRoot?.activeElement) activeElement = activeElement.shadowRoot.activeElement;
  return activeElement;
};
function $23f2114a1b82827e$export$e58f029f0fbfdb29(event) {
  if ($6a20a7989e6c817a$export$98658e8c59125e6a() && event.target instanceof Element && event.target.shadowRoot) {
    if ("composedPath" in event) return event.composedPath()[0] ?? null;
    else if ("composedPath" in event.nativeEvent) return event.nativeEvent.composedPath()[0] ?? null;
  }
  return event.target;
}
function $1969ac565cfec8d0$export$de79e2c695e052f3(element) {
  if ($1969ac565cfec8d0$var$supportsPreventScroll()) element.focus({
    preventScroll: true
  });
  else {
    let scrollableElements = $1969ac565cfec8d0$var$getScrollableElements(element);
    element.focus();
    $1969ac565cfec8d0$var$restoreScrollPosition(scrollableElements);
  }
}
let $1969ac565cfec8d0$var$supportsPreventScrollCached = null;
function $1969ac565cfec8d0$var$supportsPreventScroll() {
  if ($1969ac565cfec8d0$var$supportsPreventScrollCached == null) {
    $1969ac565cfec8d0$var$supportsPreventScrollCached = false;
    try {
      let focusElem = document.createElement("div");
      focusElem.focus({
        get preventScroll() {
          $1969ac565cfec8d0$var$supportsPreventScrollCached = true;
          return true;
        }
      });
    } catch {
    }
  }
  return $1969ac565cfec8d0$var$supportsPreventScrollCached;
}
function $1969ac565cfec8d0$var$getScrollableElements(element) {
  let parent = element.parentNode;
  let scrollableElements = [];
  let rootScrollingElement = document.scrollingElement || document.documentElement;
  while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
    if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) scrollableElements.push({
      element: parent,
      scrollTop: parent.scrollTop,
      scrollLeft: parent.scrollLeft
    });
    parent = parent.parentNode;
  }
  if (rootScrollingElement instanceof HTMLElement) scrollableElements.push({
    element: rootScrollingElement,
    scrollTop: rootScrollingElement.scrollTop,
    scrollLeft: rootScrollingElement.scrollLeft
  });
  return scrollableElements;
}
function $1969ac565cfec8d0$var$restoreScrollPosition(scrollableElements) {
  for (let { element, scrollTop, scrollLeft } of scrollableElements) {
    element.scrollTop = scrollTop;
    element.scrollLeft = scrollLeft;
  }
}
const $c4867b2f328c2698$export$e5c5a5f917a5871c = typeof document !== "undefined" ? window.wp.element.useLayoutEffect : () => {
};
function $a92dc41f639950be$export$525bc4921d56d4a(nativeEvent) {
  let event = nativeEvent;
  event.nativeEvent = nativeEvent;
  event.isDefaultPrevented = () => event.defaultPrevented;
  event.isPropagationStopped = () => event.cancelBubble;
  event.persist = () => {
  };
  return event;
}
function $a92dc41f639950be$export$c2b7abe5d61ec696(event, target) {
  Object.defineProperty(event, "target", {
    value: target
  });
  Object.defineProperty(event, "currentTarget", {
    value: target
  });
}
function $a92dc41f639950be$export$715c682d09d639cc(onBlur) {
  let stateRef = (0, window.wp.element.useRef)({
    isFocused: false,
    observer: null
  });
  $c4867b2f328c2698$export$e5c5a5f917a5871c(() => {
    const state = stateRef.current;
    return () => {
      if (state.observer) {
        state.observer.disconnect();
        state.observer = null;
      }
    };
  }, []);
  return (0, window.wp.element.useCallback)((e2) => {
    let eventTarget = $23f2114a1b82827e$export$e58f029f0fbfdb29(e2);
    if (eventTarget instanceof HTMLButtonElement || eventTarget instanceof HTMLInputElement || eventTarget instanceof HTMLTextAreaElement || eventTarget instanceof HTMLSelectElement) {
      stateRef.current.isFocused = true;
      let target = eventTarget;
      let onBlurHandler = (e3) => {
        stateRef.current.isFocused = false;
        if (target.disabled) {
          let event = $a92dc41f639950be$export$525bc4921d56d4a(e3);
          onBlur?.(event);
        }
        if (stateRef.current.observer) {
          stateRef.current.observer.disconnect();
          stateRef.current.observer = null;
        }
      };
      target.addEventListener("focusout", onBlurHandler, {
        once: true
      });
      stateRef.current.observer = new MutationObserver(() => {
        if (stateRef.current.isFocused && target.disabled) {
          stateRef.current.observer?.disconnect();
          let relatedTargetEl = target === $23f2114a1b82827e$export$cd4e5573fbe2b576() ? null : $23f2114a1b82827e$export$cd4e5573fbe2b576();
          target.dispatchEvent(new FocusEvent("blur", {
            relatedTarget: relatedTargetEl
          }));
          target.dispatchEvent(new FocusEvent("focusout", {
            bubbles: true,
            relatedTarget: relatedTargetEl
          }));
        }
      });
      stateRef.current.observer.observe(target, {
        attributes: true,
        attributeFilter: [
          "disabled"
        ]
      });
    }
  }, [
    onBlur
  ]);
}
let $a92dc41f639950be$export$fda7da73ab5d4c48 = false;
function $2add3ce32c6007eb$var$testUserAgent(re2) {
  if (typeof window === "undefined" || window.navigator == null) return false;
  let brands = window.navigator["userAgentData"]?.brands;
  return Array.isArray(brands) && brands.some((brand) => re2.test(brand.brand)) || re2.test(window.navigator.userAgent);
}
function $2add3ce32c6007eb$var$testPlatform(re2) {
  return typeof window !== "undefined" && window.navigator != null ? re2.test(window.navigator["userAgentData"]?.platform || window.navigator.platform) : false;
}
function $2add3ce32c6007eb$var$cached(fn) {
  let res = null;
  return () => {
    if (res == null) res = fn();
    return res;
  };
}
const $2add3ce32c6007eb$export$9ac100e40613ea10 = $2add3ce32c6007eb$var$cached(function() {
  return $2add3ce32c6007eb$var$testPlatform(/^Mac/i);
});
const $2add3ce32c6007eb$export$7bef049ce92e4224 = $2add3ce32c6007eb$var$cached(function() {
  return $2add3ce32c6007eb$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
  $2add3ce32c6007eb$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
});
const $2add3ce32c6007eb$export$78551043582a6a98 = $2add3ce32c6007eb$var$cached(function() {
  return $2add3ce32c6007eb$var$testUserAgent(/AppleWebKit/i) && !$2add3ce32c6007eb$export$6446a186d09e379e();
});
const $2add3ce32c6007eb$export$6446a186d09e379e = $2add3ce32c6007eb$var$cached(function() {
  return $2add3ce32c6007eb$var$testUserAgent(/Chrome/i);
});
const $2add3ce32c6007eb$export$a11b0059900ceec8 = $2add3ce32c6007eb$var$cached(function() {
  return $2add3ce32c6007eb$var$testUserAgent(/Android/i);
});
const $2add3ce32c6007eb$export$b7d78993b74f766d = $2add3ce32c6007eb$var$cached(function() {
  return $2add3ce32c6007eb$var$testUserAgent(/Firefox/i);
});
function $b5c62b033c25b96d$export$60278871457622de(event) {
  if (event.pointerType === "" && event.isTrusted) return true;
  if ($2add3ce32c6007eb$export$a11b0059900ceec8() && event.pointerType) return event.type === "click" && event.buttons === 1;
  return event.detail === 0 && !event.pointerType;
}
function $caaf0dd3060ed57c$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
  let { metaKey, ctrlKey, altKey, shiftKey } = modifiers;
  if ($2add3ce32c6007eb$export$b7d78993b74f766d() && window.event?.type?.startsWith("key") && target.target === "_blank") {
    if ($2add3ce32c6007eb$export$9ac100e40613ea10()) metaKey = true;
    else ctrlKey = true;
  }
  let event = $2add3ce32c6007eb$export$78551043582a6a98() && $2add3ce32c6007eb$export$9ac100e40613ea10() && !$2add3ce32c6007eb$export$7bef049ce92e4224() && true ? new KeyboardEvent("keydown", {
    keyIdentifier: "Enter",
    metaKey,
    ctrlKey,
    altKey,
    shiftKey
  }) : new MouseEvent("click", {
    metaKey,
    ctrlKey,
    altKey,
    shiftKey,
    detail: 1,
    bubbles: true,
    cancelable: true
  });
  $caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening = setOpening;
  $1969ac565cfec8d0$export$de79e2c695e052f3(target);
  target.dispatchEvent(event);
  $caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening = false;
}
$caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening = false;
let $8f5a2122b0992be3$var$currentModality = null;
const $8f5a2122b0992be3$export$901e90a13c50a14e = /* @__PURE__ */ new Set();
let $8f5a2122b0992be3$export$d90243b58daecda7 = /* @__PURE__ */ new Map();
let $8f5a2122b0992be3$var$hasEventBeforeFocus = false;
let $8f5a2122b0992be3$var$hasBlurredWindowRecently = false;
const $8f5a2122b0992be3$var$FOCUS_VISIBLE_INPUT_KEYS = {
  Tab: true,
  Escape: true
};
function $8f5a2122b0992be3$var$triggerChangeHandlers(modality, e2) {
  for (let handler of $8f5a2122b0992be3$export$901e90a13c50a14e) handler(modality, e2);
}
function $8f5a2122b0992be3$var$isValidKey(e2) {
  return !(e2.metaKey || !$2add3ce32c6007eb$export$9ac100e40613ea10() && e2.altKey || e2.ctrlKey || e2.key === "Control" || e2.key === "Shift" || e2.key === "Meta");
}
function $8f5a2122b0992be3$var$handleKeyboardEvent(e2) {
  $8f5a2122b0992be3$var$hasEventBeforeFocus = true;
  if (!$caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening && $8f5a2122b0992be3$var$isValidKey(e2)) {
    $8f5a2122b0992be3$var$currentModality = "keyboard";
    $8f5a2122b0992be3$var$triggerChangeHandlers("keyboard", e2);
  }
}
function $8f5a2122b0992be3$var$handlePointerEvent(e2) {
  $8f5a2122b0992be3$var$currentModality = "pointer";
  "pointerType" in e2 ? e2.pointerType : "mouse";
  if (e2.type === "mousedown" || e2.type === "pointerdown") {
    $8f5a2122b0992be3$var$hasEventBeforeFocus = true;
    $8f5a2122b0992be3$var$triggerChangeHandlers("pointer", e2);
  }
}
function $8f5a2122b0992be3$var$handleClickEvent(e2) {
  if (!$caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening && $b5c62b033c25b96d$export$60278871457622de(e2)) {
    $8f5a2122b0992be3$var$hasEventBeforeFocus = true;
    $8f5a2122b0992be3$var$currentModality = "virtual";
  }
}
function $8f5a2122b0992be3$var$handleFocusEvent(e2) {
  let ownerWindow = $d447af545b77c9f1$export$f21a1ffae260145a($23f2114a1b82827e$export$e58f029f0fbfdb29(e2));
  let ownerDocument = $d447af545b77c9f1$export$b204af158042fbac($23f2114a1b82827e$export$e58f029f0fbfdb29(e2));
  if ($23f2114a1b82827e$export$e58f029f0fbfdb29(e2) === ownerWindow || $23f2114a1b82827e$export$e58f029f0fbfdb29(e2) === ownerDocument || $a92dc41f639950be$export$fda7da73ab5d4c48 || !e2.isTrusted) return;
  if (!$8f5a2122b0992be3$var$hasEventBeforeFocus && !$8f5a2122b0992be3$var$hasBlurredWindowRecently) {
    $8f5a2122b0992be3$var$currentModality = "virtual";
    $8f5a2122b0992be3$var$triggerChangeHandlers("virtual", e2);
  }
  $8f5a2122b0992be3$var$hasEventBeforeFocus = false;
  $8f5a2122b0992be3$var$hasBlurredWindowRecently = false;
}
function $8f5a2122b0992be3$var$handleWindowBlur() {
  $8f5a2122b0992be3$var$hasEventBeforeFocus = false;
  $8f5a2122b0992be3$var$hasBlurredWindowRecently = true;
}
function $8f5a2122b0992be3$var$setupGlobalFocusEvents(element) {
  if (typeof window === "undefined" || typeof document === "undefined") return;
  const windowObject = $d447af545b77c9f1$export$f21a1ffae260145a(element);
  const documentObject = $d447af545b77c9f1$export$b204af158042fbac(element);
  if ($8f5a2122b0992be3$export$d90243b58daecda7.get(windowObject)) return;
  let focus = windowObject.HTMLElement.prototype.focus;
  windowObject.HTMLElement.prototype.focus = function() {
    $8f5a2122b0992be3$var$hasEventBeforeFocus = true;
    focus.apply(this, arguments);
  };
  documentObject.addEventListener("keydown", $8f5a2122b0992be3$var$handleKeyboardEvent, true);
  documentObject.addEventListener("keyup", $8f5a2122b0992be3$var$handleKeyboardEvent, true);
  documentObject.addEventListener("click", $8f5a2122b0992be3$var$handleClickEvent, true);
  windowObject.addEventListener("focus", $8f5a2122b0992be3$var$handleFocusEvent, true);
  windowObject.addEventListener("blur", $8f5a2122b0992be3$var$handleWindowBlur, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.addEventListener("pointerdown", $8f5a2122b0992be3$var$handlePointerEvent, true);
    documentObject.addEventListener("pointermove", $8f5a2122b0992be3$var$handlePointerEvent, true);
    documentObject.addEventListener("pointerup", $8f5a2122b0992be3$var$handlePointerEvent, true);
  }
  windowObject.addEventListener("beforeunload", () => {
    $8f5a2122b0992be3$var$tearDownWindowFocusTracking(element);
  }, {
    once: true
  });
  $8f5a2122b0992be3$export$d90243b58daecda7.set(windowObject, {
    focus
  });
}
const $8f5a2122b0992be3$var$tearDownWindowFocusTracking = (element, loadListener) => {
  const windowObject = $d447af545b77c9f1$export$f21a1ffae260145a(element);
  const documentObject = $d447af545b77c9f1$export$b204af158042fbac(element);
  if (loadListener) documentObject.removeEventListener("DOMContentLoaded", loadListener);
  if (!$8f5a2122b0992be3$export$d90243b58daecda7.has(windowObject)) return;
  windowObject.HTMLElement.prototype.focus = $8f5a2122b0992be3$export$d90243b58daecda7.get(windowObject).focus;
  documentObject.removeEventListener("keydown", $8f5a2122b0992be3$var$handleKeyboardEvent, true);
  documentObject.removeEventListener("keyup", $8f5a2122b0992be3$var$handleKeyboardEvent, true);
  documentObject.removeEventListener("click", $8f5a2122b0992be3$var$handleClickEvent, true);
  windowObject.removeEventListener("focus", $8f5a2122b0992be3$var$handleFocusEvent, true);
  windowObject.removeEventListener("blur", $8f5a2122b0992be3$var$handleWindowBlur, false);
  if (typeof PointerEvent !== "undefined") {
    documentObject.removeEventListener("pointerdown", $8f5a2122b0992be3$var$handlePointerEvent, true);
    documentObject.removeEventListener("pointermove", $8f5a2122b0992be3$var$handlePointerEvent, true);
    documentObject.removeEventListener("pointerup", $8f5a2122b0992be3$var$handlePointerEvent, true);
  }
  $8f5a2122b0992be3$export$d90243b58daecda7.delete(windowObject);
};
function $8f5a2122b0992be3$export$2f1888112f558a7d(element) {
  const documentObject = $d447af545b77c9f1$export$b204af158042fbac(element);
  let loadListener;
  if (documentObject.readyState !== "loading") $8f5a2122b0992be3$var$setupGlobalFocusEvents(element);
  else {
    loadListener = () => {
      $8f5a2122b0992be3$var$setupGlobalFocusEvents(element);
    };
    documentObject.addEventListener("DOMContentLoaded", loadListener);
  }
  return () => $8f5a2122b0992be3$var$tearDownWindowFocusTracking(element, loadListener);
}
if (typeof document !== "undefined") $8f5a2122b0992be3$export$2f1888112f558a7d();
function $8f5a2122b0992be3$export$b9b3dfddab17db27() {
  return $8f5a2122b0992be3$var$currentModality !== "pointer";
}
const $8f5a2122b0992be3$var$nonTextInputTypes = /* @__PURE__ */ new Set([
  "checkbox",
  "radio",
  "range",
  "color",
  "file",
  "image",
  "button",
  "submit",
  "reset"
]);
function $8f5a2122b0992be3$var$isKeyboardFocusEvent(isTextInput, modality, e2) {
  let eventTarget = e2 ? $23f2114a1b82827e$export$e58f029f0fbfdb29(e2) : void 0;
  let document1 = $d447af545b77c9f1$export$b204af158042fbac(eventTarget);
  let ownerWindow = $d447af545b77c9f1$export$f21a1ffae260145a(eventTarget);
  const IHTMLInputElement = typeof ownerWindow !== "undefined" ? ownerWindow.HTMLInputElement : HTMLInputElement;
  const IHTMLTextAreaElement = typeof ownerWindow !== "undefined" ? ownerWindow.HTMLTextAreaElement : HTMLTextAreaElement;
  const IHTMLElement = typeof ownerWindow !== "undefined" ? ownerWindow.HTMLElement : HTMLElement;
  const IKeyboardEvent = typeof ownerWindow !== "undefined" ? ownerWindow.KeyboardEvent : KeyboardEvent;
  let activeElement = $23f2114a1b82827e$export$cd4e5573fbe2b576(document1);
  isTextInput = isTextInput || activeElement instanceof IHTMLInputElement && !$8f5a2122b0992be3$var$nonTextInputTypes.has(activeElement.type) || activeElement instanceof IHTMLTextAreaElement || activeElement instanceof IHTMLElement && activeElement.isContentEditable;
  return !(isTextInput && modality === "keyboard" && e2 instanceof IKeyboardEvent && !$8f5a2122b0992be3$var$FOCUS_VISIBLE_INPUT_KEYS[e2.key]);
}
function $8f5a2122b0992be3$export$ec71b4b83ac08ec3(fn, deps, opts) {
  $8f5a2122b0992be3$var$setupGlobalFocusEvents();
  (0, window.wp.element.useEffect)(() => {
    if (opts?.enabled === false) return;
    let handler = (modality, e2) => {
      if (!$8f5a2122b0992be3$var$isKeyboardFocusEvent(!!opts?.isTextInput, modality, e2)) return;
      fn($8f5a2122b0992be3$export$b9b3dfddab17db27());
    };
    $8f5a2122b0992be3$export$901e90a13c50a14e.add(handler);
    return () => {
      $8f5a2122b0992be3$export$901e90a13c50a14e.delete(handler);
    };
  }, deps);
}
function $1e74c67db218ce67$export$f8168d8dd8fd66e6(props) {
  let { isDisabled, onFocus: onFocusProp, onBlur: onBlurProp, onFocusChange } = props;
  const onBlur = (0, window.wp.element.useCallback)((e2) => {
    if ($23f2114a1b82827e$export$e58f029f0fbfdb29(e2) === e2.currentTarget) {
      if (onBlurProp) onBlurProp(e2);
      if (onFocusChange) onFocusChange(false);
      return true;
    }
  }, [
    onBlurProp,
    onFocusChange
  ]);
  const onSyntheticFocus = $a92dc41f639950be$export$715c682d09d639cc(onBlur);
  const onFocus = (0, window.wp.element.useCallback)((e2) => {
    let eventTarget = $23f2114a1b82827e$export$e58f029f0fbfdb29(e2);
    const ownerDocument = $d447af545b77c9f1$export$b204af158042fbac(eventTarget);
    const activeElement = ownerDocument ? $23f2114a1b82827e$export$cd4e5573fbe2b576(ownerDocument) : $23f2114a1b82827e$export$cd4e5573fbe2b576();
    if (eventTarget === e2.currentTarget && eventTarget === activeElement) {
      if (onFocusProp) onFocusProp(e2);
      if (onFocusChange) onFocusChange(true);
      onSyntheticFocus(e2);
    }
  }, [
    onFocusChange,
    onFocusProp,
    onSyntheticFocus
  ]);
  return {
    focusProps: {
      onFocus: !isDisabled && (onFocusProp || onFocusChange || onBlurProp) ? onFocus : void 0,
      onBlur: !isDisabled && (onBlurProp || onFocusChange) ? onBlur : void 0
    }
  };
}
function $48a7d519b337145d$export$4eaf04e54aa8eed6() {
  let globalListeners = (0, window.wp.element.useRef)(/* @__PURE__ */ new Map());
  let addGlobalListener = (0, window.wp.element.useCallback)((eventTarget, type, listener, options) => {
    let fn = options?.once ? (...args) => {
      globalListeners.current.delete(listener);
      listener(...args);
    } : listener;
    globalListeners.current.set(listener, {
      type,
      eventTarget,
      fn,
      options
    });
    eventTarget.addEventListener(type, fn, options);
  }, []);
  let removeGlobalListener = (0, window.wp.element.useCallback)((eventTarget, type, listener, options) => {
    let fn = globalListeners.current.get(listener)?.fn || listener;
    eventTarget.removeEventListener(type, fn, options);
    globalListeners.current.delete(listener);
  }, []);
  let removeAllGlobalListeners = (0, window.wp.element.useCallback)(() => {
    globalListeners.current.forEach((value, key) => {
      removeGlobalListener(value.eventTarget, value.type, key, value.options);
    });
  }, [
    removeGlobalListener
  ]);
  (0, window.wp.element.useEffect)(() => {
    return removeAllGlobalListeners;
  }, [
    removeAllGlobalListeners
  ]);
  return {
    addGlobalListener,
    removeGlobalListener,
    removeAllGlobalListeners
  };
}
function $2c9edc598a03d523$export$420e68273165f4ec(props) {
  let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
  let state = (0, window.wp.element.useRef)({
    isFocusWithin: false
  });
  let { addGlobalListener, removeAllGlobalListeners } = $48a7d519b337145d$export$4eaf04e54aa8eed6();
  let onBlur = (0, window.wp.element.useCallback)((e2) => {
    if (!$23f2114a1b82827e$export$4282f70798064fe0(e2.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e2))) return;
    if (state.current.isFocusWithin && !$23f2114a1b82827e$export$4282f70798064fe0(e2.currentTarget, e2.relatedTarget)) {
      state.current.isFocusWithin = false;
      removeAllGlobalListeners();
      if (onBlurWithin) onBlurWithin(e2);
      if (onFocusWithinChange) onFocusWithinChange(false);
    }
  }, [
    onBlurWithin,
    onFocusWithinChange,
    state,
    removeAllGlobalListeners
  ]);
  let onSyntheticFocus = $a92dc41f639950be$export$715c682d09d639cc(onBlur);
  let onFocus = (0, window.wp.element.useCallback)((e2) => {
    if (!$23f2114a1b82827e$export$4282f70798064fe0(e2.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e2))) return;
    let eventTarget = $23f2114a1b82827e$export$e58f029f0fbfdb29(e2);
    const ownerDocument = $d447af545b77c9f1$export$b204af158042fbac(eventTarget);
    const activeElement = $23f2114a1b82827e$export$cd4e5573fbe2b576(ownerDocument);
    if (!state.current.isFocusWithin && activeElement === eventTarget) {
      if (onFocusWithin) onFocusWithin(e2);
      if (onFocusWithinChange) onFocusWithinChange(true);
      state.current.isFocusWithin = true;
      onSyntheticFocus(e2);
      let currentTarget = e2.currentTarget;
      addGlobalListener(ownerDocument, "focus", (e3) => {
        let eventTarget2 = $23f2114a1b82827e$export$e58f029f0fbfdb29(e3);
        if (state.current.isFocusWithin && !$23f2114a1b82827e$export$4282f70798064fe0(currentTarget, eventTarget2)) {
          let nativeEvent = new ownerDocument.defaultView.FocusEvent("blur", {
            relatedTarget: eventTarget2
          });
          $a92dc41f639950be$export$c2b7abe5d61ec696(nativeEvent, currentTarget);
          let event = $a92dc41f639950be$export$525bc4921d56d4a(nativeEvent);
          onBlur(event);
        }
      }, {
        capture: true
      });
    }
  }, [
    onFocusWithin,
    onFocusWithinChange,
    onSyntheticFocus,
    addGlobalListener,
    onBlur
  ]);
  if (isDisabled) return {
    focusWithinProps: {
      // These cannot be null, that would conflict in mergeProps
      onFocus: void 0,
      onBlur: void 0
    }
  };
  return {
    focusWithinProps: {
      onFocus,
      onBlur
    }
  };
}
function $0c4a58759813079a$export$4e328f61c538687f(props = {}) {
  let { autoFocus = false, isTextInput, within } = props;
  let state = (0, window.wp.element.useRef)({
    isFocused: false,
    isFocusVisible: autoFocus || $8f5a2122b0992be3$export$b9b3dfddab17db27()
  });
  let [isFocused, setFocused] = (0, window.wp.element.useState)(false);
  let [isFocusVisibleState, setFocusVisible] = (0, window.wp.element.useState)(() => state.current.isFocused && state.current.isFocusVisible);
  let updateState = (0, window.wp.element.useCallback)(() => setFocusVisible(state.current.isFocused && state.current.isFocusVisible), []);
  let onFocusChange = (0, window.wp.element.useCallback)((isFocused2) => {
    state.current.isFocused = isFocused2;
    state.current.isFocusVisible = $8f5a2122b0992be3$export$b9b3dfddab17db27();
    setFocused(isFocused2);
    updateState();
  }, [
    updateState
  ]);
  $8f5a2122b0992be3$export$ec71b4b83ac08ec3((isFocusVisible) => {
    state.current.isFocusVisible = isFocusVisible;
    updateState();
  }, [
    isTextInput,
    isFocused
  ], {
    enabled: isFocused,
    isTextInput
  });
  let { focusProps } = $1e74c67db218ce67$export$f8168d8dd8fd66e6({
    isDisabled: within,
    onFocusChange
  });
  let { focusWithinProps } = $2c9edc598a03d523$export$420e68273165f4ec({
    isDisabled: !within,
    onFocusWithinChange: onFocusChange
  });
  return {
    isFocused,
    isFocusVisible: isFocusVisibleState,
    focusProps: within ? focusWithinProps : focusProps
  };
}
let $e969f22b6713ca4a$var$globalIgnoreEmulatedMouseEvents = false;
let $e969f22b6713ca4a$var$hoverCount = 0;
function $e969f22b6713ca4a$var$setGlobalIgnoreEmulatedMouseEvents() {
  $e969f22b6713ca4a$var$globalIgnoreEmulatedMouseEvents = true;
  setTimeout(() => {
    $e969f22b6713ca4a$var$globalIgnoreEmulatedMouseEvents = false;
  }, 500);
}
function $e969f22b6713ca4a$var$handleGlobalPointerEvent(e2) {
  if (e2.pointerType === "touch") $e969f22b6713ca4a$var$setGlobalIgnoreEmulatedMouseEvents();
}
function $e969f22b6713ca4a$var$setupGlobalTouchEvents() {
  let ownerDocument = $d447af545b77c9f1$export$b204af158042fbac(null);
  if (typeof ownerDocument === "undefined") return;
  if ($e969f22b6713ca4a$var$hoverCount === 0) {
    if (typeof PointerEvent !== "undefined") ownerDocument.addEventListener("pointerup", $e969f22b6713ca4a$var$handleGlobalPointerEvent);
  }
  $e969f22b6713ca4a$var$hoverCount++;
  return () => {
    $e969f22b6713ca4a$var$hoverCount--;
    if ($e969f22b6713ca4a$var$hoverCount > 0) return;
    if (typeof PointerEvent !== "undefined") ownerDocument.removeEventListener("pointerup", $e969f22b6713ca4a$var$handleGlobalPointerEvent);
  };
}
function $e969f22b6713ca4a$export$ae780daf29e6d456(props) {
  let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
  let [isHovered, setHovered] = (0, window.wp.element.useState)(false);
  let state = (0, window.wp.element.useRef)({
    isHovered: false,
    ignoreEmulatedMouseEvents: false,
    pointerType: "",
    target: null
  }).current;
  (0, window.wp.element.useEffect)($e969f22b6713ca4a$var$setupGlobalTouchEvents, []);
  let { addGlobalListener, removeAllGlobalListeners } = $48a7d519b337145d$export$4eaf04e54aa8eed6();
  let { hoverProps, triggerHoverEnd } = (0, window.wp.element.useMemo)(() => {
    let triggerHoverStart = (event, pointerType) => {
      state.pointerType = pointerType;
      if (isDisabled || pointerType === "touch" || state.isHovered || !$23f2114a1b82827e$export$4282f70798064fe0(event.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(event))) return;
      state.isHovered = true;
      let target = event.currentTarget;
      state.target = target;
      addGlobalListener($d447af545b77c9f1$export$b204af158042fbac($23f2114a1b82827e$export$e58f029f0fbfdb29(event)), "pointerover", (e2) => {
        if (state.isHovered && state.target && !$23f2114a1b82827e$export$4282f70798064fe0(state.target, $23f2114a1b82827e$export$e58f029f0fbfdb29(e2))) triggerHoverEnd2(e2, e2.pointerType);
      }, {
        capture: true
      });
      if (onHoverStart) onHoverStart({
        type: "hoverstart",
        target,
        pointerType
      });
      if (onHoverChange) onHoverChange(true);
      setHovered(true);
    };
    let triggerHoverEnd2 = (event, pointerType) => {
      let target = state.target;
      state.pointerType = "";
      state.target = null;
      if (pointerType === "touch" || !state.isHovered || !target) return;
      state.isHovered = false;
      removeAllGlobalListeners();
      if (onHoverEnd) onHoverEnd({
        type: "hoverend",
        target,
        pointerType
      });
      if (onHoverChange) onHoverChange(false);
      setHovered(false);
    };
    let hoverProps2 = {};
    if (typeof PointerEvent !== "undefined") {
      hoverProps2.onPointerEnter = (e2) => {
        if ($e969f22b6713ca4a$var$globalIgnoreEmulatedMouseEvents && e2.pointerType === "mouse") return;
        triggerHoverStart(e2, e2.pointerType);
      };
      hoverProps2.onPointerLeave = (e2) => {
        if (!isDisabled && $23f2114a1b82827e$export$4282f70798064fe0(e2.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e2))) triggerHoverEnd2(e2, e2.pointerType);
      };
    }
    return {
      hoverProps: hoverProps2,
      triggerHoverEnd: triggerHoverEnd2
    };
  }, [
    onHoverStart,
    onHoverChange,
    onHoverEnd,
    isDisabled,
    state,
    addGlobalListener,
    removeAllGlobalListeners
  ]);
  (0, window.wp.element.useEffect)(() => {
    if (isDisabled) triggerHoverEnd({
      currentTarget: state.target
    }, state.pointerType);
  }, [
    isDisabled
  ]);
  return {
    hoverProps,
    isHovered
  };
}
var i$5 = Object.defineProperty;
var d$4 = (t2, e2, n2) => e2 in t2 ? i$5(t2, e2, { enumerable: true, configurable: true, writable: true, value: n2 }) : t2[e2] = n2;
var r$7 = (t2, e2, n2) => (d$4(t2, typeof e2 != "symbol" ? e2 + "" : e2, n2), n2);
let o$8 = class o {
  constructor() {
    r$7(this, "current", this.detect());
    r$7(this, "handoffState", "pending");
    r$7(this, "currentId", 0);
  }
  set(e2) {
    this.current !== e2 && (this.handoffState = "pending", this.currentId = 0, this.current = e2);
  }
  reset() {
    this.set(this.detect());
  }
  nextId() {
    return ++this.currentId;
  }
  get isServer() {
    return this.current === "server";
  }
  get isClient() {
    return this.current === "client";
  }
  detect() {
    return typeof window == "undefined" || typeof document == "undefined" ? "server" : "client";
  }
  handoff() {
    this.handoffState === "pending" && (this.handoffState = "complete");
  }
  get isHandoffComplete() {
    return this.handoffState === "complete";
  }
};
let s$b = new o$8();
function l$7(n2) {
  var u2;
  return s$b.isServer ? null : n2 == null ? document : (u2 = n2 == null ? void 0 : n2.ownerDocument) != null ? u2 : document;
}
function r$6(n2) {
  var u2, o4;
  return s$b.isServer ? null : n2 == null ? document : (o4 = (u2 = n2 == null ? void 0 : n2.getRootNode) == null ? void 0 : u2.call(n2)) != null ? o4 : document;
}
function e$5(n2) {
  var u2, o4;
  return (o4 = (u2 = r$6(n2)) == null ? void 0 : u2.activeElement) != null ? o4 : null;
}
function d$3(n2) {
  return e$5(n2) === n2;
}
function t$5(e2) {
  typeof queueMicrotask == "function" ? queueMicrotask(e2) : Promise.resolve().then(e2).catch((o4) => setTimeout(() => {
    throw o4;
  }));
}
function o$7() {
  let s2 = [], r2 = { addEventListener(e2, t2, n2, i2) {
    return e2.addEventListener(t2, n2, i2), r2.add(() => e2.removeEventListener(t2, n2, i2));
  }, requestAnimationFrame(...e2) {
    let t2 = requestAnimationFrame(...e2);
    return r2.add(() => cancelAnimationFrame(t2));
  }, nextFrame(...e2) {
    return r2.requestAnimationFrame(() => r2.requestAnimationFrame(...e2));
  }, setTimeout(...e2) {
    let t2 = setTimeout(...e2);
    return r2.add(() => clearTimeout(t2));
  }, microTask(...e2) {
    let t2 = { current: true };
    return t$5(() => {
      t2.current && e2[0]();
    }), r2.add(() => {
      t2.current = false;
    });
  }, style(e2, t2, n2) {
    let i2 = e2.style.getPropertyValue(t2);
    return Object.assign(e2.style, { [t2]: n2 }), this.add(() => {
      Object.assign(e2.style, { [t2]: i2 });
    });
  }, group(e2) {
    let t2 = o$7();
    return e2(t2), this.add(() => t2.dispose());
  }, add(e2) {
    return s2.includes(e2) || s2.push(e2), () => {
      let t2 = s2.indexOf(e2);
      if (t2 >= 0) for (let n2 of s2.splice(t2, 1)) n2();
    };
  }, dispose() {
    for (let e2 of s2.splice(0)) e2();
  } };
  return r2;
}
function p$8() {
  let [e2] = window.wp.element.useState(o$7);
  return window.wp.element.useEffect(() => () => e2.dispose(), [e2]), e2;
}
let n$6 = (e2, t2) => {
  s$b.isServer ? window.wp.element.useEffect(e2, t2) : window.wp.element.useLayoutEffect(e2, t2);
};
function s$a(e2) {
  let r2 = window.wp.element.useRef(e2);
  return n$6(() => {
    r2.current = e2;
  }, [e2]), r2;
}
let o$6 = function(t2) {
  let e2 = s$a(t2);
  return window.wp.element.useCallback((...r2) => e2.current(...r2), [e2]);
};
function E$6(e2) {
  let t2 = e2.width / 2, n2 = e2.height / 2;
  return { top: e2.clientY - n2, right: e2.clientX + t2, bottom: e2.clientY + n2, left: e2.clientX - t2 };
}
function P$4(e2, t2) {
  return !(!e2 || !t2 || e2.right < t2.left || e2.left > t2.right || e2.bottom < t2.top || e2.top > t2.bottom);
}
function w$7({ disabled: e2 = false } = {}) {
  let t2 = window.wp.element.useRef(null), [n2, l2] = window.wp.element.useState(false), r2 = p$8(), o4 = o$6(() => {
    t2.current = null, l2(false), r2.dispose();
  }), f2 = o$6((s2) => {
    if (r2.dispose(), t2.current === null) {
      t2.current = s2.currentTarget, l2(true);
      {
        let i2 = l$7(s2.currentTarget);
        r2.addEventListener(i2, "pointerup", o4, false), r2.addEventListener(i2, "pointermove", (c2) => {
          if (t2.current) {
            let p2 = E$6(c2);
            l2(P$4(p2, t2.current.getBoundingClientRect()));
          }
        }, false), r2.addEventListener(i2, "pointercancel", o4, false);
      }
    }
  });
  return { pressed: n2, pressProps: e2 ? {} : { onPointerDown: f2, onPointerUp: o4, onClick: o4 } };
}
function n$5(e2) {
  return window.wp.element.useMemo(() => e2, Object.values(e2));
}
let e$4 = window.wp.element.createContext(void 0);
function a$f() {
  return window.wp.element.useContext(e$4);
}
function l$6({ value: t2, children: o4 }) {
  return window.wp.element.createElement(e$4.Provider, { value: t2 }, o4);
}
function t$4(...r2) {
  return Array.from(new Set(r2.flatMap((n2) => typeof n2 == "string" ? n2.split(" ") : []))).filter(Boolean).join(" ");
}
function u$e(r2, n2, ...a3) {
  if (r2 in n2) {
    let e2 = n2[r2];
    return typeof e2 == "function" ? e2(...a3) : e2;
  }
  let t2 = new Error(`Tried to handle "${r2}" but there is no handler defined. Only defined handlers are: ${Object.keys(n2).map((e2) => `"${e2}"`).join(", ")}.`);
  throw Error.captureStackTrace && Error.captureStackTrace(t2, u$e), t2;
}
var A$2 = ((a3) => (a3[a3.None = 0] = "None", a3[a3.RenderStrategy = 1] = "RenderStrategy", a3[a3.Static = 2] = "Static", a3))(A$2 || {}), C$8 = ((t2) => (t2[t2.Unmount = 0] = "Unmount", t2[t2.Hidden = 1] = "Hidden", t2))(C$8 || {});
function K$1() {
  let e2 = I$5();
  return window.wp.element.useCallback((r2) => U$1({ mergeRefs: e2, ...r2 }), [e2]);
}
function U$1({ ourProps: e2, theirProps: r2, slot: t2, defaultTag: a3, features: o4, visible: n2 = true, name: i2, mergeRefs: l2 }) {
  l2 = l2 != null ? l2 : H$4;
  let s2 = P$3(r2, e2);
  if (n2) return F$3(s2, t2, a3, i2, l2);
  let y2 = o4 != null ? o4 : 0;
  if (y2 & 2) {
    let { static: f2 = false, ...u2 } = s2;
    if (f2) return F$3(u2, t2, a3, i2, l2);
  }
  if (y2 & 1) {
    let { unmount: f2 = true, ...u2 } = s2;
    return u$e(f2 ? 0 : 1, { [0]() {
      return null;
    }, [1]() {
      return F$3({ ...u2, hidden: true, style: { display: "none" } }, t2, a3, i2, l2);
    } });
  }
  return F$3(s2, t2, a3, i2, l2);
}
function F$3(e2, r2 = {}, t2, a3, o4) {
  let { as: n2 = t2, children: i2, refName: l2 = "ref", ...s2 } = h$8(e2, ["unmount", "static"]), y2 = e2.ref !== void 0 ? { [l2]: e2.ref } : {}, f2 = typeof i2 == "function" ? i2(r2) : i2;
  f2 = E$5(f2), "className" in s2 && s2.className && typeof s2.className == "function" && (s2.className = s2.className(r2)), s2["aria-labelledby"] && s2["aria-labelledby"] === s2.id && (s2["aria-labelledby"] = void 0);
  let u2 = {};
  if (r2) {
    let d2 = false, p2 = [];
    for (let [c2, T3] of Object.entries(r2)) typeof T3 == "boolean" && (d2 = true), T3 === true && p2.push(c2.replace(/([A-Z])/g, (g2) => `-${g2.toLowerCase()}`));
    if (d2) {
      u2["data-headlessui-state"] = p2.join(" ");
      for (let c2 of p2) u2[`data-${c2}`] = "";
    }
  }
  if (b$4(n2) && (Object.keys(m$4(s2)).length > 0 || Object.keys(m$4(u2)).length > 0)) if (!window.wp.element.isValidElement(f2) || Array.isArray(f2) && f2.length > 1 || L$4(f2)) {
    if (Object.keys(m$4(s2)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${a3} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(m$4(s2)).concat(Object.keys(m$4(u2))).map((d2) => `  - ${d2}`).join(`
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((d2) => `  - ${d2}`).join(`
`)].join(`
`));
  } else {
    let d2 = f2.props, p2 = d2 == null ? void 0 : d2.className, c2 = typeof p2 == "function" ? (...R2) => t$4(p2(...R2), s2.className) : t$4(p2, s2.className), T3 = c2 ? { className: c2 } : {}, g2 = P$3(f2.props, m$4(h$8(s2, ["ref"])));
    for (let R2 in u2) R2 in g2 && delete u2[R2];
    return window.wp.element.cloneElement(f2, Object.assign({}, g2, u2, y2, { ref: o4(D$5(f2), y2.ref) }, T3));
  }
  return window.wp.element.createElement(n2, Object.assign({}, h$8(s2, ["ref"]), !b$4(n2) && y2, !b$4(n2) && u2), f2);
}
function I$5() {
  let e2 = window.wp.element.useRef([]), r2 = window.wp.element.useCallback((t2) => {
    for (let a3 of e2.current) a3 != null && (typeof a3 == "function" ? a3(t2) : a3.current = t2);
  }, []);
  return (...t2) => {
    if (!t2.every((a3) => a3 == null)) return e2.current = t2, r2;
  };
}
function H$4(...e2) {
  return e2.every((r2) => r2 == null) ? void 0 : (r2) => {
    for (let t2 of e2) t2 != null && (typeof t2 == "function" ? t2(r2) : t2.current = r2);
  };
}
function P$3(...e2) {
  if (e2.length === 0) return {};
  if (e2.length === 1) return e2[0];
  let r2 = {}, t2 = {};
  for (let o4 of e2) for (let n2 in o4) n2.startsWith("on") && typeof o4[n2] == "function" ? (t2[n2] != null || (t2[n2] = []), t2[n2].push(o4[n2])) : r2[n2] = o4[n2];
  if (r2.disabled || r2["aria-disabled"]) for (let o4 in t2) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(o4) && (t2[o4] = [(n2) => {
    var i2;
    return (i2 = n2 == null ? void 0 : n2.preventDefault) == null ? void 0 : i2.call(n2);
  }]);
  for (let o4 in t2) Object.assign(r2, { [o4](n2, ...i2) {
    let l2 = t2[o4];
    for (let s2 of l2) {
      if ((n2 instanceof Event || (n2 == null ? void 0 : n2.nativeEvent) instanceof Event) && n2.defaultPrevented) return;
      s2(n2, ...i2);
    }
  } });
  return r2;
}
function V$2(...e2) {
  if (e2.length === 0) return {};
  if (e2.length === 1) return e2[0];
  let r2 = {}, t2 = {};
  for (let o4 of e2) for (let n2 in o4) n2.startsWith("on") && typeof o4[n2] == "function" ? (t2[n2] != null || (t2[n2] = []), t2[n2].push(o4[n2])) : r2[n2] = o4[n2];
  for (let o4 in t2) Object.assign(r2, { [o4](...n2) {
    let i2 = t2[o4];
    for (let l2 of i2) l2 == null || l2(...n2);
  } });
  return r2;
}
function Y$1(e2) {
  var r2;
  return Object.assign(window.wp.element.forwardRef(e2), { displayName: (r2 = e2.displayName) != null ? r2 : e2.name });
}
function m$4(e2) {
  let r2 = Object.assign({}, e2);
  for (let t2 in r2) r2[t2] === void 0 && delete r2[t2];
  return r2;
}
function h$8(e2, r2 = []) {
  let t2 = Object.assign({}, e2);
  for (let a3 of r2) a3 in t2 && delete t2[a3];
  return t2;
}
function D$5(e2) {
  return window.wp.element.version.split(".")[0] >= "19" ? e2.props.ref : e2.ref;
}
function E$5(e2) {
  if (e2 != null && e2.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy")) {
    let r2 = e2._payload;
    if (r2 != null && r2.status === "fulfilled") return E$5(r2.value);
  }
  return e2;
}
function b$4(e2) {
  return e2 === window.wp.element.Fragment || e2 === /* @__PURE__ */ Symbol.for("react.fragment");
}
function L$4(e2) {
  return b$4(e2.type);
}
function b$3(l2, r2, c2) {
  let [i2, s2] = window.wp.element.useState(c2), e2 = l2 !== void 0, t2 = window.wp.element.useRef(e2), u2 = window.wp.element.useRef(false), d2 = window.wp.element.useRef(false);
  return e2 && !t2.current && !u2.current ? (u2.current = true, t2.current = e2, console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")) : !e2 && t2.current && !d2.current && (d2.current = true, t2.current = e2, console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")), [e2 ? l2 : i2, o$6((n2) => (e2 || window.wp.element.flushSync(() => s2(n2)), r2 == null ? void 0 : r2(n2)))];
}
function l$5(e2) {
  let [t2] = window.wp.element.useState(e2);
  return t2;
}
var _global_window_wp_element_useId = window.wp.element.useId;
function p$7(t2 = {}, i2 = null, n2 = []) {
  for (let [e2, o4] of Object.entries(t2)) s$9(n2, r$5(i2, e2), o4);
  return n2;
}
function r$5(t2, i2) {
  return t2 ? t2 + "[" + i2 + "]" : i2;
}
function s$9(t2, i2, n2) {
  if (Array.isArray(n2)) for (let [e2, o4] of n2.entries()) s$9(t2, r$5(i2, e2.toString()), o4);
  else n2 instanceof Date ? t2.push([i2, n2.toISOString()]) : typeof n2 == "boolean" ? t2.push([i2, n2 ? "1" : "0"]) : typeof n2 == "string" ? t2.push([i2, n2]) : typeof n2 == "number" ? t2.push([i2, `${n2}`]) : n2 == null ? t2.push([i2, ""]) : c$c(n2) && !window.wp.element.isValidElement(n2) && p$7(n2, i2, t2);
}
function g$3(t2) {
  var n2, e2;
  let i2 = (n2 = t2 == null ? void 0 : t2.form) != null ? n2 : t2.closest("form");
  if (i2) {
    for (let o4 of i2.elements) if (o4 !== t2 && (o4.tagName === "INPUT" && o4.type === "submit" || o4.tagName === "BUTTON" && o4.type === "submit" || o4.nodeName === "INPUT" && o4.type === "image")) {
      o4.click();
      return;
    }
    (e2 = i2.requestSubmit) == null || e2.call(i2);
  }
}
function c$c(t2) {
  if (Object.prototype.toString.call(t2) !== "[object Object]") return false;
  let i2 = Object.getPrototypeOf(t2);
  return i2 === null || Object.getPrototypeOf(i2) === null;
}
let a$e = "span";
var s$8 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(s$8 || {});
function l$4(t2, r2) {
  var n2;
  let { features: d2 = 1, ...e2 } = t2, o4 = { ref: r2, "aria-hidden": (d2 & 2) === 2 ? true : (n2 = e2["aria-hidden"]) != null ? n2 : void 0, hidden: (d2 & 4) === 4 ? true : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(d2 & 4) === 4 && (d2 & 2) !== 2 && { display: "none" } } };
  return K$1()({ ourProps: o4, theirProps: e2, slot: {}, defaultTag: a$e, name: "Hidden" });
}
let f$d = Y$1(l$4);
let f$c = window.wp.element.createContext(null);
function W$1(t2) {
  let [e2, r2] = window.wp.element.useState(null);
  return window.wp.element.createElement(f$c.Provider, { value: { target: e2 } }, t2.children, window.wp.element.createElement(f$d, { features: s$8.Hidden, ref: r2 }));
}
function c$b({ children: t2 }) {
  let e2 = window.wp.element.useContext(f$c);
  if (!e2) return window.wp.element.createElement(window.wp.element.Fragment, null, t2);
  let { target: r2 } = e2;
  return r2 ? window.wp.element.createPortal(window.wp.element.createElement(window.wp.element.Fragment, null, t2), r2) : null;
}
function j$5({ data: t2, form: e2, disabled: r2, onReset: n2, overrides: F2 }) {
  let [i2, a3] = window.wp.element.useState(null), p2 = p$8();
  return window.wp.element.useEffect(() => {
    if (n2 && i2) return p2.addEventListener(i2, "reset", n2);
  }, [i2, e2, n2]), window.wp.element.createElement(c$b, null, window.wp.element.createElement(C$7, { setForm: a3, formId: e2 }), p$7(t2).map(([s2, v2]) => window.wp.element.createElement(f$d, { features: s$8.Hidden, ...m$4({ key: s2, as: "input", type: "hidden", hidden: true, readOnly: true, form: e2, disabled: r2, name: s2, value: v2, ...F2 }) })));
}
function C$7({ setForm: t2, formId: e2 }) {
  return window.wp.element.useEffect(() => {
    if (e2) {
      let r2 = document.getElementById(e2);
      r2 && t2(r2);
    }
  }, [t2, e2]), e2 ? null : window.wp.element.createElement(f$d, { features: s$8.Hidden, as: "input", type: "hidden", hidden: true, readOnly: true, ref: (r2) => {
    if (!r2) return;
    let n2 = r2.closest("form");
    n2 && t2(n2);
  } });
}
let e$3 = window.wp.element.createContext(void 0);
function u$d() {
  return window.wp.element.useContext(e$3);
}
function f$b({ id: t2, children: r2 }) {
  return window.wp.element.createElement(e$3.Provider, { value: t2 }, r2);
}
function o$5(e2) {
  return typeof e2 != "object" || e2 === null ? false : "nodeType" in e2;
}
function t$3(e2) {
  return o$5(e2) && "tagName" in e2;
}
function n$4(e2) {
  return t$3(e2) && "accessKey" in e2;
}
function i$4(e2) {
  return t$3(e2) && "tabIndex" in e2;
}
function r$4(e2) {
  return t$3(e2) && "style" in e2;
}
function u$c(e2) {
  return n$4(e2) && e2.nodeName === "IFRAME";
}
function l$3(e2) {
  return n$4(e2) && e2.nodeName === "INPUT";
}
function m$3(e2) {
  return n$4(e2) && e2.nodeName === "LABEL";
}
function a$d(e2) {
  return n$4(e2) && e2.nodeName === "FIELDSET";
}
function E$4(e2) {
  return n$4(e2) && e2.nodeName === "LEGEND";
}
function L$3(e2) {
  return t$3(e2) ? e2.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]') : false;
}
function s$7(l2) {
  let e2 = l2.parentElement, t2 = null;
  for (; e2 && !a$d(e2); ) E$4(e2) && (t2 = e2), e2 = e2.parentElement;
  let i2 = (e2 == null ? void 0 : e2.getAttribute("disabled")) === "";
  return i2 && r$3(t2) ? false : i2;
}
function r$3(l2) {
  if (!l2) return false;
  let e2 = l2.previousElementSibling;
  for (; e2 !== null; ) {
    if (E$4(e2)) return false;
    e2 = e2.previousElementSibling;
  }
  return true;
}
let u$b = /* @__PURE__ */ Symbol();
function T$4(t2, n2 = true) {
  return Object.assign(t2, { [u$b]: n2 });
}
function y$5(...t2) {
  let n2 = window.wp.element.useRef(t2);
  window.wp.element.useEffect(() => {
    n2.current = t2;
  }, [t2]);
  let c2 = o$6((e2) => {
    for (let o4 of n2.current) o4 != null && (typeof o4 == "function" ? o4(e2) : o4.current = e2);
  });
  return t2.every((e2) => e2 == null || (e2 == null ? void 0 : e2[u$b])) ? void 0 : c2;
}
let a$c = window.wp.element.createContext(null);
a$c.displayName = "DescriptionContext";
function f$a() {
  let r2 = window.wp.element.useContext(a$c);
  if (r2 === null) {
    let e2 = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
    throw Error.captureStackTrace && Error.captureStackTrace(e2, f$a), e2;
  }
  return r2;
}
function w$6() {
  var r2, e2;
  return (e2 = (r2 = window.wp.element.useContext(a$c)) == null ? void 0 : r2.value) != null ? e2 : void 0;
}
function H$3() {
  let [r2, e2] = window.wp.element.useState([]);
  return [r2.length > 0 ? r2.join(" ") : void 0, window.wp.element.useMemo(() => function(t2) {
    let i2 = o$6((n2) => (e2((o4) => [...o4, n2]), () => e2((o4) => {
      let s2 = o4.slice(), p2 = s2.indexOf(n2);
      return p2 !== -1 && s2.splice(p2, 1), s2;
    }))), l2 = window.wp.element.useMemo(() => ({ register: i2, slot: t2.slot, name: t2.name, props: t2.props, value: t2.value }), [i2, t2.slot, t2.name, t2.props, t2.value]);
    return window.wp.element.createElement(a$c.Provider, { value: l2 }, t2.children);
  }, [e2])];
}
let I$4 = "p";
function C$6(r2, e2) {
  let c2 = _global_window_wp_element_useId(), t2 = a$f(), { id: i2 = `headlessui-description-${c2}`, ...l2 } = r2, n2 = f$a(), o4 = y$5(e2);
  n$6(() => n2.register(i2), [i2, n2.register]);
  let s2 = n$5({ ...n2.slot, disabled: t2 || false }), p2 = { ref: o4, ...n2.props, id: i2 };
  return K$1()({ ourProps: p2, theirProps: l2, slot: s2, defaultTag: I$4, name: n2.name || "Description" });
}
let _$3 = Y$1(C$6), M$5 = Object.assign(_$3, {});
var o$4 = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o$4 || {});
let L$2 = window.wp.element.createContext(null);
L$2.displayName = "LabelContext";
function C$5() {
  let n2 = window.wp.element.useContext(L$2);
  if (n2 === null) {
    let l2 = new Error("You used a <Label /> component, but it is not inside a relevant parent.");
    throw Error.captureStackTrace && Error.captureStackTrace(l2, C$5), l2;
  }
  return n2;
}
function N$1(n2) {
  var a3, e2, o4;
  let l2 = (e2 = (a3 = window.wp.element.useContext(L$2)) == null ? void 0 : a3.value) != null ? e2 : void 0;
  return ((o4 = n2 == null ? void 0 : n2.length) != null ? o4 : 0) > 0 ? [l2, ...n2].filter(Boolean).join(" ") : l2;
}
function V$1({ inherit: n2 = false } = {}) {
  let l2 = N$1(), [a3, e2] = window.wp.element.useState([]), o4 = n2 ? [l2, ...a3].filter(Boolean) : a3;
  return [o4.length > 0 ? o4.join(" ") : void 0, window.wp.element.useMemo(() => function(t2) {
    let p2 = o$6((i2) => (e2((u2) => [...u2, i2]), () => e2((u2) => {
      let d2 = u2.slice(), f2 = d2.indexOf(i2);
      return f2 !== -1 && d2.splice(f2, 1), d2;
    }))), b2 = window.wp.element.useMemo(() => ({ register: p2, slot: t2.slot, name: t2.name, props: t2.props, value: t2.value }), [p2, t2.slot, t2.name, t2.props, t2.value]);
    return window.wp.element.createElement(L$2.Provider, { value: b2 }, t2.children);
  }, [e2])];
}
let G$2 = "label";
function U(n2, l2) {
  var y2;
  let a3 = _global_window_wp_element_useId(), e2 = C$5(), o4 = u$d(), T3 = a$f(), { id: t2 = `headlessui-label-${a3}`, htmlFor: p2 = o4 != null ? o4 : (y2 = e2.props) == null ? void 0 : y2.htmlFor, passive: b2 = false, ...i2 } = n2, u2 = y$5(l2);
  n$6(() => e2.register(t2), [t2, e2.register]);
  let d2 = o$6((s2) => {
    let g2 = s2.currentTarget;
    if (!(s2.target !== s2.currentTarget && L$3(s2.target)) && (m$3(g2) && s2.preventDefault(), e2.props && "onClick" in e2.props && typeof e2.props.onClick == "function" && e2.props.onClick(s2), m$3(g2))) {
      let r2 = document.getElementById(g2.htmlFor);
      if (r2) {
        let E2 = r2.getAttribute("disabled");
        if (E2 === "true" || E2 === "") return;
        let x2 = r2.getAttribute("aria-disabled");
        if (x2 === "true" || x2 === "") return;
        (l$3(r2) && (r2.type === "file" || r2.type === "radio" || r2.type === "checkbox") || r2.role === "radio" || r2.role === "checkbox" || r2.role === "switch") && r2.click(), r2.focus({ preventScroll: true });
      }
    }
  }), f2 = n$5({ ...e2.slot, disabled: T3 || false }), c2 = { ref: u2, ...e2.props, id: t2, htmlFor: p2, onClick: d2 };
  return b2 && ("onClick" in c2 && (delete c2.htmlFor, delete c2.onClick), "onClick" in i2 && delete i2.onClick), K$1()({ ourProps: c2, theirProps: i2, slot: f2, defaultTag: p2 ? G$2 : "div", name: e2.name || "Label" });
}
let j$4 = Y$1(U), Z = Object.assign(j$4, {});
let de$2 = "span";
function pe(u2, b2) {
  let f2 = _global_window_wp_element_useId(), y2 = u$d(), T3 = a$f(), { id: h4 = y2 || `headlessui-checkbox-${f2}`, disabled: o4 = T3 || false, autoFocus: i2 = false, checked: C2, defaultChecked: k2, onChange: x2, name: d2, value: g2, form: E2, indeterminate: l2 = false, tabIndex: v2 = 0, ...P2 } = u2, r2 = l$5(k2), [a3, t2] = b$3(C2, x2, r2 != null ? r2 : false), D2 = N$1(), R2 = w$6(), A2 = p$8(), [F2, p2] = window.wp.element.useState(false), c2 = o$6(() => {
    p2(true), t2 == null || t2(!a3), A2.nextFrame(() => {
      p2(false);
    });
  }), K2 = o$6((e2) => {
    if (s$7(e2.currentTarget)) return e2.preventDefault();
    e2.preventDefault(), c2();
  }), _2 = o$6((e2) => {
    e2.key === o$4.Space ? (e2.preventDefault(), c2()) : e2.key === o$4.Enter && g$3(e2.currentTarget);
  }), H2 = o$6((e2) => e2.preventDefault()), { isFocusVisible: B2, focusProps: I2 } = $0c4a58759813079a$export$4e328f61c538687f({ autoFocus: i2 }), { isHovered: L2, hoverProps: M2 } = $e969f22b6713ca4a$export$ae780daf29e6d456({ isDisabled: o4 }), { pressed: U2, pressProps: O2 } = w$7({ disabled: o4 }), S2 = V$2({ ref: b2, id: h4, role: "checkbox", "aria-checked": l2 ? "mixed" : a3 ? "true" : "false", "aria-labelledby": D2, "aria-describedby": R2, "aria-disabled": o4 ? true : void 0, indeterminate: l2 ? "true" : void 0, tabIndex: o4 ? void 0 : v2, onKeyUp: o4 ? void 0 : _2, onKeyPress: o4 ? void 0 : H2, onClick: o4 ? void 0 : K2 }, I2, M2, O2), X2 = n$5({ checked: a3, disabled: o4, hover: L2, focus: B2, active: U2, indeterminate: l2, changing: F2, autofocus: i2 }), G2 = window.wp.element.useCallback(() => {
    if (r2 !== void 0) return t2 == null ? void 0 : t2(r2);
  }, [t2, r2]), W2 = K$1();
  return window.wp.element.createElement(window.wp.element.Fragment, null, d2 != null && window.wp.element.createElement(j$5, { disabled: o4, data: { [d2]: g2 || "on" }, overrides: { type: "checkbox", checked: a3 }, form: E2, onReset: G2 }), W2({ ourProps: S2, theirProps: P2, slot: X2, defaultTag: de$2, name: "Checkbox" }));
}
let Ke$3 = Y$1(pe);
let e$2 = window.wp.element.createContext(() => {
});
function C$4({ value: t2, children: o4 }) {
  return window.wp.element.createElement(e$2.Provider, { value: t2 }, o4);
}
function l$2(e2, r2) {
  return e2 !== null && r2 !== null && typeof e2 == "object" && typeof r2 == "object" && "id" in e2 && "id" in r2 ? e2.id === r2.id : e2 === r2;
}
function u$a(e2 = l$2) {
  return window.wp.element.useCallback((r2, t2) => {
    if (typeof e2 == "string") {
      let o4 = e2;
      return (r2 == null ? void 0 : r2[o4]) === (t2 == null ? void 0 : t2[o4]);
    }
    return e2(r2, t2);
  }, [e2]);
}
function h$7(i2) {
  if (i2 === null) return { width: 0, height: 0 };
  let { width: t2, height: e2 } = i2.getBoundingClientRect();
  return { width: t2, height: e2 };
}
function w$5(i2, t2, e2 = false) {
  let [r2, f2] = window.wp.element.useState(() => h$7(t2));
  return n$6(() => {
    if (!t2 || !i2) return;
    let n2 = o$7();
    return n2.requestAnimationFrame(function s2() {
      n2.requestAnimationFrame(s2), f2((u2) => {
        let o4 = h$7(t2);
        return o4.width === u2.width && o4.height === u2.height ? u2 : o4;
      });
    }), () => {
      n2.dispose();
    };
  }, [t2, i2]), e2 ? { width: `${r2.width}px`, height: `${r2.height}px` } : r2;
}
var g$2 = ((f2) => (f2[f2.Left = 0] = "Left", f2[f2.Right = 2] = "Right", f2))(g$2 || {});
function s$6(t2) {
  let r2 = window.wp.element.useRef(null), u2 = o$6((e2) => {
    r2.current = e2.pointerType, !s$7(e2.currentTarget) && e2.pointerType === "mouse" && e2.button === g$2.Left && (e2.preventDefault(), t2(e2));
  }), i2 = o$6((e2) => {
    r2.current !== "mouse" && (s$7(e2.currentTarget) || t2(e2));
  });
  return { onPointerDown: u2, onClick: i2 };
}
let a$b = class a extends Map {
  constructor(t2) {
    super();
    this.factory = t2;
  }
  get(t2) {
    let e2 = super.get(t2);
    return e2 === void 0 && (e2 = this.factory(t2), this.set(t2, e2)), e2;
  }
};
var h$6 = Object.defineProperty;
var v$2 = (t2, e2, r2) => e2 in t2 ? h$6(t2, e2, { enumerable: true, configurable: true, writable: true, value: r2 }) : t2[e2] = r2;
var S$6 = (t2, e2, r2) => (v$2(t2, e2 + "", r2), r2), b$2 = (t2, e2, r2) => {
  if (!e2.has(t2)) throw TypeError("Cannot " + r2);
};
var i$3 = (t2, e2, r2) => (b$2(t2, e2, "read from private field"), r2 ? r2.call(t2) : e2.get(t2)), c$a = (t2, e2, r2) => {
  if (e2.has(t2)) throw TypeError("Cannot add the same private member more than once");
  e2 instanceof WeakSet ? e2.add(t2) : e2.set(t2, r2);
}, u$9 = (t2, e2, r2, s2) => (b$2(t2, e2, "write to private field"), e2.set(t2, r2), r2);
var n$3, a$a, o$3;
let T$3 = class T {
  constructor(e2) {
    c$a(this, n$3, {});
    c$a(this, a$a, new a$b(() => /* @__PURE__ */ new Set()));
    c$a(this, o$3, /* @__PURE__ */ new Set());
    S$6(this, "disposables", o$7());
    u$9(this, n$3, e2), s$b.isServer && this.disposables.microTask(() => {
      this.dispose();
    });
  }
  dispose() {
    this.disposables.dispose();
  }
  get state() {
    return i$3(this, n$3);
  }
  subscribe(e2, r2) {
    if (s$b.isServer) return () => {
    };
    let s2 = { selector: e2, callback: r2, current: e2(i$3(this, n$3)) };
    return i$3(this, o$3).add(s2), this.disposables.add(() => {
      i$3(this, o$3).delete(s2);
    });
  }
  on(e2, r2) {
    return s$b.isServer ? () => {
    } : (i$3(this, a$a).get(e2).add(r2), this.disposables.add(() => {
      i$3(this, a$a).get(e2).delete(r2);
    }));
  }
  send(e2) {
    let r2 = this.reduce(i$3(this, n$3), e2);
    if (r2 !== i$3(this, n$3)) {
      u$9(this, n$3, r2);
      for (let s2 of i$3(this, o$3)) {
        let l2 = s2.selector(i$3(this, n$3));
        j$3(s2.current, l2) || (s2.current = l2, s2.callback(l2));
      }
      for (let s2 of i$3(this, a$a).get(e2.type)) s2(i$3(this, n$3), e2);
    }
  }
};
n$3 = /* @__PURE__ */ new WeakMap(), a$a = /* @__PURE__ */ new WeakMap(), o$3 = /* @__PURE__ */ new WeakMap();
function j$3(t2, e2) {
  return Object.is(t2, e2) ? true : typeof t2 != "object" || t2 === null || typeof e2 != "object" || e2 === null ? false : Array.isArray(t2) && Array.isArray(e2) ? t2.length !== e2.length ? false : f$9(t2[Symbol.iterator](), e2[Symbol.iterator]()) : t2 instanceof Map && e2 instanceof Map || t2 instanceof Set && e2 instanceof Set ? t2.size !== e2.size ? false : f$9(t2.entries(), e2.entries()) : p$6(t2) && p$6(e2) ? f$9(Object.entries(t2)[Symbol.iterator](), Object.entries(e2)[Symbol.iterator]()) : false;
}
function f$9(t2, e2) {
  do {
    let r2 = t2.next(), s2 = e2.next();
    if (r2.done && s2.done) return true;
    if (r2.done || s2.done || !Object.is(r2.value, s2.value)) return false;
  } while (true);
}
function p$6(t2) {
  if (Object.prototype.toString.call(t2) !== "[object Object]") return false;
  let e2 = Object.getPrototypeOf(t2);
  return e2 === null || Object.getPrototypeOf(e2) === null;
}
function k$5(t2) {
  let [e2, r2] = t2(), s2 = o$7();
  return (...l2) => {
    e2(...l2), s2.dispose(), s2.microTask(r2);
  };
}
var a$9 = Object.defineProperty;
var r$2 = (e2, c2, t2) => c2 in e2 ? a$9(e2, c2, { enumerable: true, configurable: true, writable: true, value: t2 }) : e2[c2] = t2;
var p$5 = (e2, c2, t2) => (r$2(e2, typeof c2 != "symbol" ? c2 + "" : c2, t2), t2);
var k$4 = ((t2) => (t2[t2.Push = 0] = "Push", t2[t2.Pop = 1] = "Pop", t2))(k$4 || {});
let y$4 = { [0](e2, c2) {
  let t2 = c2.id, s2 = e2.stack, i2 = e2.stack.indexOf(t2);
  if (i2 !== -1) {
    let n2 = e2.stack.slice();
    return n2.splice(i2, 1), n2.push(t2), s2 = n2, { ...e2, stack: s2 };
  }
  return { ...e2, stack: [...e2.stack, t2] };
}, [1](e2, c2) {
  let t2 = c2.id, s2 = e2.stack.indexOf(t2);
  if (s2 === -1) return e2;
  let i2 = e2.stack.slice();
  return i2.splice(s2, 1), { ...e2, stack: i2 };
} };
let o$2 = class o2 extends T$3 {
  constructor() {
    super(...arguments);
    p$5(this, "actions", { push: (t2) => this.send({ type: 0, id: t2 }), pop: (t2) => this.send({ type: 1, id: t2 }) });
    p$5(this, "selectors", { isTop: (t2, s2) => t2.stack[t2.stack.length - 1] === s2, inStack: (t2, s2) => t2.stack.includes(s2) });
  }
  static new() {
    return new o2({ stack: [] });
  }
  reduce(t2, s2) {
    return u$e(s2.type, y$4, t2, s2);
  }
};
const x$6 = new a$b(() => o$2.new());
var withSelector = { exports: {} };
var useSyncExternalStoreWithSelector_production = {};
var _global_window_wp_element = window.wp.element;
var hasRequiredUseSyncExternalStoreWithSelector_production;
function requireUseSyncExternalStoreWithSelector_production() {
  if (hasRequiredUseSyncExternalStoreWithSelector_production) return useSyncExternalStoreWithSelector_production;
  hasRequiredUseSyncExternalStoreWithSelector_production = 1;
  var React = _global_window_wp_element;
  function is(x2, y2) {
    return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2;
  }
  var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
  useSyncExternalStoreWithSelector_production.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
    var instRef = useRef(null);
    if (null === instRef.current) {
      var inst = { hasValue: false, value: null };
      instRef.current = inst;
    } else inst = instRef.current;
    instRef = useMemo(
      function() {
        function memoizedSelector(nextSnapshot) {
          if (!hasMemo) {
            hasMemo = true;
            memoizedSnapshot = nextSnapshot;
            nextSnapshot = selector(nextSnapshot);
            if (void 0 !== isEqual && inst.hasValue) {
              var currentSelection = inst.value;
              if (isEqual(currentSelection, nextSnapshot))
                return memoizedSelection = currentSelection;
            }
            return memoizedSelection = nextSnapshot;
          }
          currentSelection = memoizedSelection;
          if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
          var nextSelection = selector(nextSnapshot);
          if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))
            return memoizedSnapshot = nextSnapshot, currentSelection;
          memoizedSnapshot = nextSnapshot;
          return memoizedSelection = nextSelection;
        }
        var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
        return [
          function() {
            return memoizedSelector(getSnapshot());
          },
          null === maybeGetServerSnapshot ? void 0 : function() {
            return memoizedSelector(maybeGetServerSnapshot());
          }
        ];
      },
      [getSnapshot, getServerSnapshot, selector, isEqual]
    );
    var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
    useEffect(
      function() {
        inst.hasValue = true;
        inst.value = value;
      },
      [value]
    );
    useDebugValue(value);
    return value;
  };
  return useSyncExternalStoreWithSelector_production;
}
var hasRequiredWithSelector;
function requireWithSelector() {
  if (hasRequiredWithSelector) return withSelector.exports;
  hasRequiredWithSelector = 1;
  {
    withSelector.exports = requireUseSyncExternalStoreWithSelector_production();
  }
  return withSelector.exports;
}
var withSelectorExports = requireWithSelector();
function S$5(e2, n2, r2 = j$3) {
  return withSelectorExports.useSyncExternalStoreWithSelector(o$6((i2) => e2.subscribe(s$5, i2)), o$6(() => e2.state), o$6(() => e2.state), o$6(n2), r2);
}
function s$5(e2) {
  return e2;
}
function I$3(o4, s2) {
  let t2 = window.wp.element.useId(), r2 = x$6.get(s2), [i2, c2] = S$5(r2, window.wp.element.useCallback((e2) => [r2.selectors.isTop(e2, t2), r2.selectors.inStack(e2, t2)], [r2, t2]));
  return n$6(() => {
    if (o4) return r2.actions.push(t2), () => r2.actions.pop(t2);
  }, [r2, o4, t2]), o4 ? c2 ? i2 : true : false;
}
let f$8 = /* @__PURE__ */ new Map(), u$8 = /* @__PURE__ */ new Map();
function h$5(t2) {
  var e2;
  let r2 = (e2 = u$8.get(t2)) != null ? e2 : 0;
  return u$8.set(t2, r2 + 1), r2 !== 0 ? () => m$2(t2) : (f$8.set(t2, { "aria-hidden": t2.getAttribute("aria-hidden"), inert: t2.inert }), t2.setAttribute("aria-hidden", "true"), t2.inert = true, () => m$2(t2));
}
function m$2(t2) {
  var i2;
  let r2 = (i2 = u$8.get(t2)) != null ? i2 : 1;
  if (r2 === 1 ? u$8.delete(t2) : u$8.set(t2, r2 - 1), r2 !== 1) return;
  let e2 = f$8.get(t2);
  e2 && (e2["aria-hidden"] === null ? t2.removeAttribute("aria-hidden") : t2.setAttribute("aria-hidden", e2["aria-hidden"]), t2.inert = e2.inert, f$8.delete(t2));
}
function y$3(t2, { allowed: r2, disallowed: e2 } = {}) {
  let i2 = I$3(t2, "inert-others");
  n$6(() => {
    var d2, c2;
    if (!i2) return;
    let a3 = o$7();
    for (let n2 of (d2 = e2 == null ? void 0 : e2()) != null ? d2 : []) n2 && a3.add(h$5(n2));
    let s2 = (c2 = r2 == null ? void 0 : r2()) != null ? c2 : [];
    for (let n2 of s2) {
      if (!n2) continue;
      let l2 = l$7(n2);
      if (!l2) continue;
      let o4 = n2.parentElement;
      for (; o4 && o4 !== l2.body; ) {
        for (let p2 of o4.children) s2.some((E2) => p2.contains(E2)) || a3.add(h$5(p2));
        o4 = o4.parentElement;
      }
    }
    return a3.dispose;
  }, [i2, r2, e2]);
}
function p$4(s2, n2, o4) {
  let i2 = s$a((t2) => {
    let e2 = t2.getBoundingClientRect();
    e2.x === 0 && e2.y === 0 && e2.width === 0 && e2.height === 0 && o4();
  });
  window.wp.element.useEffect(() => {
    if (!s2) return;
    let t2 = n2 === null ? null : n$4(n2) ? n2 : n2.current;
    if (!t2) return;
    let e2 = o$7();
    if (typeof ResizeObserver != "undefined") {
      let r2 = new ResizeObserver(() => i2.current(t2));
      r2.observe(t2), e2.add(() => r2.disconnect());
    }
    if (typeof IntersectionObserver != "undefined") {
      let r2 = new IntersectionObserver(() => i2.current(t2));
      r2.observe(t2), e2.add(() => r2.disconnect());
    }
    return () => e2.dispose();
  }, [n2, i2, s2]);
}
let E$3 = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "details>summary", "textarea:not([disabled])"].map((e2) => `${e2}:not([tabindex='-1'])`).join(","), S$4 = ["[data-autofocus]"].map((e2) => `${e2}:not([tabindex='-1'])`).join(",");
var T$2 = ((o4) => (o4[o4.First = 1] = "First", o4[o4.Previous = 2] = "Previous", o4[o4.Next = 4] = "Next", o4[o4.Last = 8] = "Last", o4[o4.WrapAround = 16] = "WrapAround", o4[o4.NoScroll = 32] = "NoScroll", o4[o4.AutoFocus = 64] = "AutoFocus", o4))(T$2 || {}), A$1 = ((n2) => (n2[n2.Error = 0] = "Error", n2[n2.Overflow = 1] = "Overflow", n2[n2.Success = 2] = "Success", n2[n2.Underflow = 3] = "Underflow", n2))(A$1 || {}), O$2 = ((t2) => (t2[t2.Previous = -1] = "Previous", t2[t2.Next = 1] = "Next", t2))(O$2 || {});
function x$5(e2 = document.body) {
  return e2 == null ? [] : Array.from(e2.querySelectorAll(E$3)).sort((r2, t2) => Math.sign((r2.tabIndex || Number.MAX_SAFE_INTEGER) - (t2.tabIndex || Number.MAX_SAFE_INTEGER)));
}
function h$4(e2 = document.body) {
  return e2 == null ? [] : Array.from(e2.querySelectorAll(S$4)).sort((r2, t2) => Math.sign((r2.tabIndex || Number.MAX_SAFE_INTEGER) - (t2.tabIndex || Number.MAX_SAFE_INTEGER)));
}
var I$2 = ((t2) => (t2[t2.Strict = 0] = "Strict", t2[t2.Loose = 1] = "Loose", t2))(I$2 || {});
function H$2(e2, r2 = 0) {
  var t2;
  return e2 === ((t2 = l$7(e2)) == null ? void 0 : t2.body) ? false : u$e(r2, { [0]() {
    return e2.matches(E$3);
  }, [1]() {
    let l2 = e2;
    for (; l2 !== null; ) {
      if (l2.matches(E$3)) return true;
      l2 = l2.parentElement;
    }
    return false;
  } });
}
function K(e2) {
  o$7().nextFrame(() => {
    let r2 = e$5(e2);
    r2 && i$4(r2) && !H$2(r2, 0) && w$4(e2);
  });
}
var g$1 = ((t2) => (t2[t2.Keyboard = 0] = "Keyboard", t2[t2.Mouse = 1] = "Mouse", t2))(g$1 || {});
typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("keydown", (e2) => {
  e2.metaKey || e2.altKey || e2.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
}, true), document.addEventListener("click", (e2) => {
  e2.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e2.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
}, true));
function w$4(e2) {
  e2 == null || e2.focus({ preventScroll: true });
}
let _$2 = ["textarea", "input"].join(",");
function P$2(e2) {
  var r2, t2;
  return (t2 = (r2 = e2 == null ? void 0 : e2.matches) == null ? void 0 : r2.call(e2, _$2)) != null ? t2 : false;
}
function G$1(e2, r2 = (t2) => t2) {
  return e2.slice().sort((t2, l2) => {
    let n2 = r2(t2), a3 = r2(l2);
    if (n2 === null || a3 === null) return 0;
    let u2 = n2.compareDocumentPosition(a3);
    return u2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : u2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
  });
}
function R(e2, r2, t2 = e2 === null ? document.body : r$6(e2)) {
  return v$1(x$5(t2), r2, { relativeTo: e2 });
}
function v$1(e2, r2, { sorted: t2 = true, relativeTo: l2 = null, skipElements: n2 = [] } = {}) {
  let a3 = Array.isArray(e2) ? e2.length > 0 ? r$6(e2[0]) : document : r$6(e2), u2 = Array.isArray(e2) ? t2 ? G$1(e2) : e2 : r2 & 64 ? h$4(e2) : x$5(e2);
  n2.length > 0 && u2.length > 1 && (u2 = u2.filter((i2) => !n2.some((d2) => d2 != null && "current" in d2 ? (d2 == null ? void 0 : d2.current) === i2 : d2 === i2))), l2 = l2 != null ? l2 : a3 == null ? void 0 : a3.activeElement;
  let o4 = (() => {
    if (r2 & 5) return 1;
    if (r2 & 10) return -1;
    throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
  })(), M2 = (() => {
    if (r2 & 1) return 0;
    if (r2 & 2) return Math.max(0, u2.indexOf(l2)) - 1;
    if (r2 & 4) return Math.max(0, u2.indexOf(l2)) + 1;
    if (r2 & 8) return u2.length - 1;
    throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
  })(), N2 = r2 & 32 ? { preventScroll: true } : {}, m3 = 0, c2 = u2.length, s2;
  do {
    if (m3 >= c2 || m3 + c2 <= 0) return 0;
    let i2 = M2 + m3;
    if (r2 & 16) i2 = (i2 + c2) % c2;
    else {
      if (i2 < 0) return 3;
      if (i2 >= c2) return 1;
    }
    s2 = u2[i2], s2 == null || s2.focus(N2), m3 += o4;
  } while (s2 !== e$5(s2));
  return r2 & 6 && P$2(s2) && s2.select(), 2;
}
function t$2() {
  return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
}
function i$2() {
  return /Android/gi.test(window.navigator.userAgent);
}
function n$2() {
  return t$2() || i$2();
}
function i$1(t2, e2, o4, n2) {
  let u2 = s$a(o4);
  window.wp.element.useEffect(() => {
    if (!t2) return;
    function r2(m3) {
      u2.current(m3);
    }
    return document.addEventListener(e2, r2, n2), () => document.removeEventListener(e2, r2, n2);
  }, [t2, e2, n2]);
}
function s$4(t2, e2, o4, n2) {
  let i2 = s$a(o4);
  window.wp.element.useEffect(() => {
    if (!t2) return;
    function r2(d2) {
      i2.current(d2);
    }
    return window.addEventListener(e2, r2, n2), () => window.removeEventListener(e2, r2, n2);
  }, [t2, e2, n2]);
}
const C$3 = 30;
function k$3(o4, f2, h4) {
  let m3 = s$a(h4), s2 = window.wp.element.useCallback(function(e2, c2) {
    if (e2.defaultPrevented) return;
    let r2 = c2(e2);
    if (r2 === null || !r2.getRootNode().contains(r2) || !r2.isConnected) return;
    let M2 = (function u2(n2) {
      return typeof n2 == "function" ? u2(n2()) : Array.isArray(n2) || n2 instanceof Set ? n2 : [n2];
    })(f2);
    for (let u2 of M2) if (u2 !== null && (u2.contains(r2) || e2.composed && e2.composedPath().includes(u2))) return;
    return !H$2(r2, I$2.Loose) && r2.tabIndex !== -1 && e2.preventDefault(), m3.current(e2, r2);
  }, [m3, f2]), i2 = window.wp.element.useRef(null);
  i$1(o4, "pointerdown", (t2) => {
    var e2, c2;
    n$2() || (i2.current = ((c2 = (e2 = t2.composedPath) == null ? void 0 : e2.call(t2)) == null ? void 0 : c2[0]) || t2.target);
  }, true), i$1(o4, "pointerup", (t2) => {
    if (n$2() || !i2.current) return;
    let e2 = i2.current;
    return i2.current = null, s2(t2, () => e2);
  }, true);
  let l2 = window.wp.element.useRef({ x: 0, y: 0 });
  i$1(o4, "touchstart", (t2) => {
    l2.current.x = t2.touches[0].clientX, l2.current.y = t2.touches[0].clientY;
  }, true), i$1(o4, "touchend", (t2) => {
    let e2 = { x: t2.changedTouches[0].clientX, y: t2.changedTouches[0].clientY };
    if (!(Math.abs(e2.x - l2.current.x) >= C$3 || Math.abs(e2.y - l2.current.y) >= C$3)) return s2(t2, () => i$4(t2.target) ? t2.target : null);
  }, true), s$4(o4, "blur", (t2) => s2(t2, () => u$c(window.document.activeElement) ? window.document.activeElement : null), true);
}
function u$7(...e2) {
  return window.wp.element.useMemo(() => l$7(...e2), [...e2]);
}
function c$9(...e2) {
  return window.wp.element.useMemo(() => r$6(...e2), [...e2]);
}
var H$1 = ((e2) => (e2[e2.Ignore = 0] = "Ignore", e2[e2.Select = 1] = "Select", e2[e2.Close = 2] = "Close", e2))(H$1 || {});
const S$3 = { Ignore: { kind: 0 }, Select: (r2) => ({ kind: 1, target: r2 }), Close: { kind: 2 } }, M$4 = 200, f$7 = 5;
function L$1(r2, { trigger: n2, action: T3, close: e2, select: p2 }) {
  let l2 = window.wp.element.useRef(null), i2 = window.wp.element.useRef(null), u2 = window.wp.element.useRef(null);
  i$1(r2 && n2 !== null, "pointerdown", (t2) => {
    o$5(t2 == null ? void 0 : t2.target) && n2 != null && n2.contains(t2.target) && (i2.current = t2.x, u2.current = t2.y, l2.current = t2.timeStamp);
  }), i$1(r2 && n2 !== null, "pointerup", (t2) => {
    var s2, m3;
    let c2 = l2.current;
    if (c2 === null || (l2.current = null, !i$4(t2.target)) || Math.abs(t2.x - ((s2 = i2.current) != null ? s2 : t2.x)) < f$7 && Math.abs(t2.y - ((m3 = u2.current) != null ? m3 : t2.y)) < f$7) return;
    let a3 = T3(t2);
    switch (a3.kind) {
      case 0:
        return;
      case 1: {
        t2.timeStamp - c2 > M$4 && (p2(a3.target), e2());
        break;
      }
      case 2: {
        e2();
        break;
      }
    }
  }, { capture: true });
}
function E$2(n2, e2, a3, t2) {
  let i2 = s$a(a3);
  window.wp.element.useEffect(() => {
    n2 = n2 != null ? n2 : window;
    function r2(o4) {
      i2.current(o4);
    }
    return n2.addEventListener(e2, r2, t2), () => n2.removeEventListener(e2, r2, t2);
  }, [n2, e2, t2]);
}
function e$1(t2, u2) {
  return window.wp.element.useMemo(() => {
    var n2;
    if (t2.type) return t2.type;
    let r2 = (n2 = t2.as) != null ? n2 : "button";
    if (typeof r2 == "string" && r2.toLowerCase() === "button" || (u2 == null ? void 0 : u2.tagName) === "BUTTON" && !u2.hasAttribute("type")) return "button";
  }, [t2.type, t2.as, u2]);
}
function o$1(t2) {
  return window.wp.element.useSyncExternalStore(t2.subscribe, t2.getSnapshot, t2.getSnapshot);
}
function a$8(o4, r2) {
  let t2 = o4(), n2 = /* @__PURE__ */ new Set();
  return { getSnapshot() {
    return t2;
  }, subscribe(e2) {
    return n2.add(e2), () => n2.delete(e2);
  }, dispatch(e2, ...s2) {
    let i2 = r2[e2].call(t2, ...s2);
    i2 && (t2 = i2, n2.forEach((c2) => c2()));
  } };
}
function d$2() {
  let r2;
  return { before({ doc: e2 }) {
    var l2;
    let o4 = e2.documentElement, t2 = (l2 = e2.defaultView) != null ? l2 : window;
    r2 = Math.max(0, t2.innerWidth - o4.clientWidth);
  }, after({ doc: e2, d: o4 }) {
    let t2 = e2.documentElement, l2 = Math.max(0, t2.clientWidth - t2.offsetWidth), n2 = Math.max(0, r2 - l2);
    o4.style(t2, "paddingRight", `${n2}px`);
  } };
}
function w$3() {
  return t$2() ? { before({ doc: o4, d: r2, meta: m3 }) {
    function a3(s2) {
      for (let l2 of m3().containers) for (let c2 of l2()) if (c2.contains(s2)) return true;
      return false;
    }
    r2.microTask(() => {
      var c2;
      if (window.getComputedStyle(o4.documentElement).scrollBehavior !== "auto") {
        let t2 = o$7();
        t2.style(o4.documentElement, "scrollBehavior", "auto"), r2.add(() => r2.microTask(() => t2.dispose()));
      }
      let s2 = (c2 = window.scrollY) != null ? c2 : window.pageYOffset, l2 = null;
      r2.addEventListener(o4, "click", (t2) => {
        if (i$4(t2.target)) try {
          let e2 = t2.target.closest("a");
          if (!e2) return;
          let { hash: n2 } = new URL(e2.href), f2 = o4.querySelector(n2);
          i$4(f2) && !a3(f2) && (l2 = f2);
        } catch {
        }
      }, true), r2.group((t2) => {
        r2.addEventListener(o4, "touchstart", (e2) => {
          if (t2.dispose(), i$4(e2.target) && r$4(e2.target)) if (a3(e2.target)) {
            let n2 = e2.target;
            for (; n2.parentElement && a3(n2.parentElement); ) n2 = n2.parentElement;
            t2.style(n2, "overscrollBehavior", "contain");
          } else t2.style(e2.target, "touchAction", "none");
        });
      }), r2.addEventListener(o4, "touchmove", (t2) => {
        if (i$4(t2.target)) {
          if (l$3(t2.target)) return;
          if (a3(t2.target)) {
            let e2 = t2.target;
            for (; e2.parentElement && e2.dataset.headlessuiPortal !== "" && !(e2.scrollHeight > e2.clientHeight || e2.scrollWidth > e2.clientWidth); ) e2 = e2.parentElement;
            e2.dataset.headlessuiPortal === "" && t2.preventDefault();
          } else t2.preventDefault();
        }
      }, { passive: false }), r2.add(() => {
        var e2;
        let t2 = (e2 = window.scrollY) != null ? e2 : window.pageYOffset;
        s2 !== t2 && window.scrollTo(0, s2), l2 && l2.isConnected && (l2.scrollIntoView({ block: "nearest" }), l2 = null);
      });
    });
  } } : {};
}
function r$1() {
  return { before({ doc: e2, d: o4 }) {
    o4.style(e2.documentElement, "overflow", "hidden");
  } };
}
function r(e2) {
  let o4 = {};
  for (let t2 of e2) Object.assign(o4, t2(o4));
  return o4;
}
let c$8 = a$8(() => /* @__PURE__ */ new Map(), { PUSH(e2, o4) {
  var n2;
  let t2 = (n2 = this.get(e2)) != null ? n2 : { doc: e2, count: 0, d: o$7(), meta: /* @__PURE__ */ new Set(), computedMeta: {} };
  return t2.count++, t2.meta.add(o4), t2.computedMeta = r(t2.meta), this.set(e2, t2), this;
}, POP(e2, o4) {
  let t2 = this.get(e2);
  return t2 && (t2.count--, t2.meta.delete(o4), t2.computedMeta = r(t2.meta)), this;
}, SCROLL_PREVENT(e2) {
  let o4 = { doc: e2.doc, d: e2.d, meta() {
    return e2.computedMeta;
  } }, t2 = [w$3(), d$2(), r$1()];
  t2.forEach(({ before: n2 }) => n2 == null ? void 0 : n2(o4)), t2.forEach(({ after: n2 }) => n2 == null ? void 0 : n2(o4));
}, SCROLL_ALLOW({ d: e2 }) {
  e2.dispose();
}, TEARDOWN({ doc: e2 }) {
  this.delete(e2);
} });
c$8.subscribe(() => {
  let e2 = c$8.getSnapshot(), o4 = /* @__PURE__ */ new Map();
  for (let [t2] of e2) o4.set(t2, t2.documentElement.style.overflow);
  for (let t2 of e2.values()) {
    let n2 = o4.get(t2.doc) === "hidden", a3 = t2.count !== 0;
    (a3 && !n2 || !a3 && n2) && c$8.dispatch(t2.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", t2), t2.count === 0 && c$8.dispatch("TEARDOWN", t2);
  }
});
function a$7(r2, e2, n2 = () => ({ containers: [] })) {
  let f2 = o$1(c$8), o4 = e2 ? f2.get(e2) : void 0, i2 = o4 ? o4.count > 0 : false;
  return n$6(() => {
    if (!(!e2 || !r2)) return c$8.dispatch("PUSH", e2, n2), () => c$8.dispatch("POP", e2, n2);
  }, [r2, e2]), i2;
}
function f$6(e2, c2, n2 = () => [document.body]) {
  let r2 = I$3(e2, "scroll-lock");
  a$7(r2, c2, (t2) => {
    var o4;
    return { containers: [...(o4 = t2.containers) != null ? o4 : [], n2] };
  });
}
function t$1(e2) {
  return [e2.screenX, e2.screenY];
}
function u$6() {
  let e2 = window.wp.element.useRef([-1, -1]);
  return { wasMoved(r2) {
    let n2 = t$1(r2);
    return e2.current[0] === n2[0] && e2.current[1] === n2[1] ? false : (e2.current = n2, true);
  }, update(r2) {
    e2.current = t$1(r2);
  } };
}
function c$7(u2 = 0) {
  let [r2, a3] = window.wp.element.useState(u2), g2 = window.wp.element.useCallback((e2) => a3(e2), []), s2 = window.wp.element.useCallback((e2) => a3((l2) => l2 | e2), []), m3 = window.wp.element.useCallback((e2) => (r2 & e2) === e2, [r2]), n2 = window.wp.element.useCallback((e2) => a3((l2) => l2 & ~e2), []), F2 = window.wp.element.useCallback((e2) => a3((l2) => l2 ^ e2), []);
  return { flags: r2, setFlag: g2, addFlag: s2, hasFlag: m3, removeFlag: n2, toggleFlag: F2 };
}
var define_process_env_default = {};
var T$1, S$2;
typeof process != "undefined" && typeof globalThis != "undefined" && typeof Element != "undefined" && ((T$1 = process == null ? void 0 : define_process_env_default) == null ? void 0 : T$1["NODE_ENV"]) === "test" && typeof ((S$2 = Element == null ? void 0 : Element.prototype) == null ? void 0 : S$2.getAnimations) == "undefined" && (Element.prototype.getAnimations = function() {
  return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.", "Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.", "", "Example usage:", "```js", "import { mockAnimationsApi } from 'jsdom-testing-mocks'", "mockAnimationsApi()", "```"].join(`
`)), [];
});
var A = ((i2) => (i2[i2.None = 0] = "None", i2[i2.Closed = 1] = "Closed", i2[i2.Enter = 2] = "Enter", i2[i2.Leave = 4] = "Leave", i2))(A || {});
function x$4(e2) {
  let r2 = {};
  for (let t2 in e2) e2[t2] === true && (r2[`data-${t2}`] = "");
  return r2;
}
function N(e2, r2, t2, n2) {
  let [i2, a3] = window.wp.element.useState(t2), { hasFlag: s2, addFlag: o4, removeFlag: l2 } = c$7(e2 && i2 ? 3 : 0), u2 = window.wp.element.useRef(false), f2 = window.wp.element.useRef(false), E2 = p$8();
  return n$6(() => {
    var d2;
    if (e2) {
      if (t2 && a3(true), !r2) {
        t2 && o4(3);
        return;
      }
      return (d2 = n2 == null ? void 0 : n2.start) == null || d2.call(n2, t2), C$2(r2, { inFlight: u2, prepare() {
        f2.current ? f2.current = false : f2.current = u2.current, u2.current = true, !f2.current && (t2 ? (o4(3), l2(4)) : (o4(4), l2(2)));
      }, run() {
        f2.current ? t2 ? (l2(3), o4(4)) : (l2(4), o4(3)) : t2 ? l2(1) : o4(1);
      }, done() {
        var p2;
        f2.current && D$4(r2) || (u2.current = false, l2(7), t2 || a3(false), (p2 = n2 == null ? void 0 : n2.end) == null || p2.call(n2, t2));
      } });
    }
  }, [e2, t2, r2, E2]), e2 ? [i2, { closed: s2(1), enter: s2(2), leave: s2(4), transition: s2(2) || s2(4) }] : [t2, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
}
function C$2(e2, { prepare: r2, run: t2, done: n2, inFlight: i2 }) {
  let a3 = o$7();
  return j$2(e2, { prepare: r2, inFlight: i2 }), a3.nextFrame(() => {
    t2(), a3.requestAnimationFrame(() => {
      a3.add(M$3(e2, n2));
    });
  }), a3.dispose;
}
function M$3(e2, r2) {
  var a3, s2;
  let t2 = o$7();
  if (!e2) return t2.dispose;
  let n2 = false;
  t2.add(() => {
    n2 = true;
  });
  let i2 = (s2 = (a3 = e2.getAnimations) == null ? void 0 : a3.call(e2).filter((o4) => o4 instanceof CSSTransition)) != null ? s2 : [];
  return i2.length === 0 ? (r2(), t2.dispose) : (Promise.allSettled(i2.map((o4) => o4.finished)).then(() => {
    n2 || r2();
  }), t2.dispose);
}
function j$2(e2, { inFlight: r2, prepare: t2 }) {
  if (r2 != null && r2.current) {
    t2();
    return;
  }
  let n2 = e2.style.transition;
  e2.style.transition = "none", t2(), e2.offsetHeight, e2.style.transition = n2;
}
function D$4(e2) {
  var t2, n2;
  return ((n2 = (t2 = e2.getAnimations) == null ? void 0 : t2.call(e2)) != null ? n2 : []).some((i2) => i2 instanceof CSSTransition && i2.playState !== "finished");
}
function F$2(c2, { container: e2, accept: t2, walk: r2 }) {
  let o4 = window.wp.element.useRef(t2), l2 = window.wp.element.useRef(r2);
  window.wp.element.useEffect(() => {
    o4.current = t2, l2.current = r2;
  }, [t2, r2]), n$6(() => {
    if (!e2 || !c2) return;
    let n2 = l$7(e2);
    if (!n2) return;
    let f2 = o4.current, p2 = l2.current, i2 = Object.assign((m3) => f2(m3), { acceptNode: f2 }), u2 = n2.createTreeWalker(e2, NodeFilter.SHOW_ELEMENT, i2, false);
    for (; u2.nextNode(); ) p2(u2.currentNode);
  }, [e2, c2, o4, l2]);
}
function m$1(u2, t2) {
  let e2 = window.wp.element.useRef([]), r2 = o$6(u2);
  window.wp.element.useEffect(() => {
    let o4 = [...e2.current];
    for (let [a3, l2] of t2.entries()) if (e2.current[a3] !== l2) {
      let n2 = r2(t2, o4);
      return e2.current = t2, n2;
    }
  }, [r2, ...t2]);
}
function hasWindow() {
  return typeof window !== "undefined";
}
function getNodeName(node) {
  if (isNode(node)) {
    return (node.nodeName || "").toLowerCase();
  }
  return "#document";
}
function getWindow(node) {
  var _node$ownerDocument;
  return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
}
function getDocumentElement(node) {
  var _ref;
  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
}
function isNode(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof Node || value instanceof getWindow(value).Node;
}
function isElement(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof Element || value instanceof getWindow(value).Element;
}
function isHTMLElement(value) {
  if (!hasWindow()) {
    return false;
  }
  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
}
function isShadowRoot(value) {
  if (!hasWindow() || typeof ShadowRoot === "undefined") {
    return false;
  }
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
}
function isOverflowElement(element) {
  const {
    overflow,
    overflowX,
    overflowY,
    display
  } = getComputedStyle$1(element);
  return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
}
function isTableElement(element) {
  return /^(table|td|th)$/.test(getNodeName(element));
}
function isTopLayer(element) {
  try {
    if (element.matches(":popover-open")) {
      return true;
    }
  } catch (_e2) {
  }
  try {
    return element.matches(":modal");
  } catch (_e2) {
    return false;
  }
}
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
const containRe = /paint|layout|strict|content/;
const isNotNone = (value) => !!value && value !== "none";
let isWebKitValue;
function isContainingBlock(elementOrCss) {
  const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
  return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
}
function getContainingBlock(element) {
  let currentNode = getParentNode(element);
  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
    if (isContainingBlock(currentNode)) {
      return currentNode;
    } else if (isTopLayer(currentNode)) {
      return null;
    }
    currentNode = getParentNode(currentNode);
  }
  return null;
}
function isWebKit() {
  if (isWebKitValue == null) {
    isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
  }
  return isWebKitValue;
}
function isLastTraversableNode(node) {
  return /^(html|body|#document)$/.test(getNodeName(node));
}
function getComputedStyle$1(element) {
  return getWindow(element).getComputedStyle(element);
}
function getNodeScroll(element) {
  if (isElement(element)) {
    return {
      scrollLeft: element.scrollLeft,
      scrollTop: element.scrollTop
    };
  }
  return {
    scrollLeft: element.scrollX,
    scrollTop: element.scrollY
  };
}
function getParentNode(node) {
  if (getNodeName(node) === "html") {
    return node;
  }
  const result = (
    // Step into the shadow DOM of the parent of a slotted node.
    node.assignedSlot || // DOM Element detected.
    node.parentNode || // ShadowRoot detected.
    isShadowRoot(node) && node.host || // Fallback.
    getDocumentElement(node)
  );
  return isShadowRoot(result) ? result.host : result;
}
function getNearestOverflowAncestor(node) {
  const parentNode = getParentNode(node);
  if (isLastTraversableNode(parentNode)) {
    return node.ownerDocument ? node.ownerDocument.body : node.body;
  }
  if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
    return parentNode;
  }
  return getNearestOverflowAncestor(parentNode);
}
function getOverflowAncestors(node, list, traverseIframes) {
  var _node$ownerDocument2;
  if (list === void 0) {
    list = [];
  }
  if (traverseIframes === void 0) {
    traverseIframes = true;
  }
  const scrollableAncestor = getNearestOverflowAncestor(node);
  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  const win = getWindow(scrollableAncestor);
  if (isBody) {
    const frameElement = getFrameElement(win);
    return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
  } else {
    return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
  }
}
function getFrameElement(win) {
  return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
}
function getUserAgent() {
  const uaData = navigator.userAgentData;
  if (uaData && Array.isArray(uaData.brands)) {
    return uaData.brands.map((_ref) => {
      let {
        brand,
        version
      } = _ref;
      return brand + "/" + version;
    }).join(" ");
  }
  return navigator.userAgent;
}
const min = Math.min;
const max = Math.max;
const round = Math.round;
const floor = Math.floor;
const createCoords = (v2) => ({
  x: v2,
  y: v2
});
const oppositeSideMap = {
  left: "right",
  right: "left",
  bottom: "top",
  top: "bottom"
};
function clamp(start, value, end) {
  return max(start, min(value, end));
}
function evaluate(value, param) {
  return typeof value === "function" ? value(param) : value;
}
function getSide(placement) {
  return placement.split("-")[0];
}
function getAlignment(placement) {
  return placement.split("-")[1];
}
function getOppositeAxis(axis) {
  return axis === "x" ? "y" : "x";
}
function getAxisLength(axis) {
  return axis === "y" ? "height" : "width";
}
function getSideAxis(placement) {
  const firstChar = placement[0];
  return firstChar === "t" || firstChar === "b" ? "y" : "x";
}
function getAlignmentAxis(placement) {
  return getOppositeAxis(getSideAxis(placement));
}
function getAlignmentSides(placement, rects, rtl) {
  if (rtl === void 0) {
    rtl = false;
  }
  const alignment = getAlignment(placement);
  const alignmentAxis = getAlignmentAxis(placement);
  const length = getAxisLength(alignmentAxis);
  let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
  if (rects.reference[length] > rects.floating[length]) {
    mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  }
  return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
}
function getExpandedPlacements(placement) {
  const oppositePlacement = getOppositePlacement(placement);
  return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
}
function getOppositeAlignmentPlacement(placement) {
  return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
}
const lrPlacement = ["left", "right"];
const rlPlacement = ["right", "left"];
const tbPlacement = ["top", "bottom"];
const btPlacement = ["bottom", "top"];
function getSideList(side, isStart, rtl) {
  switch (side) {
    case "top":
    case "bottom":
      if (rtl) return isStart ? rlPlacement : lrPlacement;
      return isStart ? lrPlacement : rlPlacement;
    case "left":
    case "right":
      return isStart ? tbPlacement : btPlacement;
    default:
      return [];
  }
}
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  const alignment = getAlignment(placement);
  let list = getSideList(getSide(placement), direction === "start", rtl);
  if (alignment) {
    list = list.map((side) => side + "-" + alignment);
    if (flipAlignment) {
      list = list.concat(list.map(getOppositeAlignmentPlacement));
    }
  }
  return list;
}
function getOppositePlacement(placement) {
  const side = getSide(placement);
  return oppositeSideMap[side] + placement.slice(side.length);
}
function expandPaddingObject(padding) {
  return {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    ...padding
  };
}
function getPaddingObject(padding) {
  return typeof padding !== "number" ? expandPaddingObject(padding) : {
    top: padding,
    right: padding,
    bottom: padding,
    left: padding
  };
}
function rectToClientRect(rect) {
  const {
    x: x2,
    y: y2,
    width,
    height
  } = rect;
  return {
    width,
    height,
    top: y2,
    left: x2,
    right: x2 + width,
    bottom: y2 + height,
    x: x2,
    y: y2
  };
}
function computeCoordsFromPlacement(_ref, placement, rtl) {
  let {
    reference,
    floating
  } = _ref;
  const sideAxis = getSideAxis(placement);
  const alignmentAxis = getAlignmentAxis(placement);
  const alignLength = getAxisLength(alignmentAxis);
  const side = getSide(placement);
  const isVertical = sideAxis === "y";
  const commonX = reference.x + reference.width / 2 - floating.width / 2;
  const commonY = reference.y + reference.height / 2 - floating.height / 2;
  const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  let coords;
  switch (side) {
    case "top":
      coords = {
        x: commonX,
        y: reference.y - floating.height
      };
      break;
    case "bottom":
      coords = {
        x: commonX,
        y: reference.y + reference.height
      };
      break;
    case "right":
      coords = {
        x: reference.x + reference.width,
        y: commonY
      };
      break;
    case "left":
      coords = {
        x: reference.x - floating.width,
        y: commonY
      };
      break;
    default:
      coords = {
        x: reference.x,
        y: reference.y
      };
  }
  switch (getAlignment(placement)) {
    case "start":
      coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
      break;
    case "end":
      coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
      break;
  }
  return coords;
}
async function detectOverflow$1(state, options) {
  var _await$platform$isEle;
  if (options === void 0) {
    options = {};
  }
  const {
    x: x2,
    y: y2,
    platform: platform2,
    rects,
    elements,
    strategy
  } = state;
  const {
    boundary = "clippingAncestors",
    rootBoundary = "viewport",
    elementContext = "floating",
    altBoundary = false,
    padding = 0
  } = evaluate(options, state);
  const paddingObject = getPaddingObject(padding);
  const altContext = elementContext === "floating" ? "reference" : "floating";
  const element = elements[altBoundary ? altContext : elementContext];
  const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
    element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
    boundary,
    rootBoundary,
    strategy
  }));
  const rect = elementContext === "floating" ? {
    x: x2,
    y: y2,
    width: rects.floating.width,
    height: rects.floating.height
  } : rects.reference;
  const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
  const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
    x: 1,
    y: 1
  } : {
    x: 1,
    y: 1
  };
  const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
    elements,
    rect,
    offsetParent,
    strategy
  }) : rect);
  return {
    top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
    bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
    left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
    right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  };
}
const MAX_RESET_COUNT = 50;
const computePosition$1 = async (reference, floating, config) => {
  const {
    placement = "bottom",
    strategy = "absolute",
    middleware = [],
    platform: platform2
  } = config;
  const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
    ...platform2,
    detectOverflow: detectOverflow$1
  };
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
  let rects = await platform2.getElementRects({
    reference,
    floating,
    strategy
  });
  let {
    x: x2,
    y: y2
  } = computeCoordsFromPlacement(rects, placement, rtl);
  let statefulPlacement = placement;
  let resetCount = 0;
  const middlewareData = {};
  for (let i2 = 0; i2 < middleware.length; i2++) {
    const currentMiddleware = middleware[i2];
    if (!currentMiddleware) {
      continue;
    }
    const {
      name,
      fn
    } = currentMiddleware;
    const {
      x: nextX,
      y: nextY,
      data,
      reset
    } = await fn({
      x: x2,
      y: y2,
      initialPlacement: placement,
      placement: statefulPlacement,
      strategy,
      middlewareData,
      rects,
      platform: platformWithDetectOverflow,
      elements: {
        reference,
        floating
      }
    });
    x2 = nextX != null ? nextX : x2;
    y2 = nextY != null ? nextY : y2;
    middlewareData[name] = {
      ...middlewareData[name],
      ...data
    };
    if (reset && resetCount < MAX_RESET_COUNT) {
      resetCount++;
      if (typeof reset === "object") {
        if (reset.placement) {
          statefulPlacement = reset.placement;
        }
        if (reset.rects) {
          rects = reset.rects === true ? await platform2.getElementRects({
            reference,
            floating,
            strategy
          }) : reset.rects;
        }
        ({
          x: x2,
          y: y2
        } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
      }
      i2 = -1;
    }
  }
  return {
    x: x2,
    y: y2,
    placement: statefulPlacement,
    strategy,
    middlewareData
  };
};
const flip$2 = function(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: "flip",
    options,
    async fn(state) {
      var _middlewareData$arrow, _middlewareData$flip;
      const {
        placement,
        middlewareData,
        rects,
        initialPlacement,
        platform: platform2,
        elements
      } = state;
      const {
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = true,
        fallbackPlacements: specifiedFallbackPlacements,
        fallbackStrategy = "bestFit",
        fallbackAxisSideDirection = "none",
        flipAlignment = true,
        ...detectOverflowOptions
      } = evaluate(options, state);
      if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
        return {};
      }
      const side = getSide(placement);
      const initialSideAxis = getSideAxis(initialPlacement);
      const isBasePlacement = getSide(initialPlacement) === initialPlacement;
      const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
      const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
      const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
      if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
        fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
      }
      const placements = [initialPlacement, ...fallbackPlacements];
      const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
      const overflows = [];
      let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
      if (checkMainAxis) {
        overflows.push(overflow[side]);
      }
      if (checkCrossAxis) {
        const sides = getAlignmentSides(placement, rects, rtl);
        overflows.push(overflow[sides[0]], overflow[sides[1]]);
      }
      overflowsData = [...overflowsData, {
        placement,
        overflows
      }];
      if (!overflows.every((side2) => side2 <= 0)) {
        var _middlewareData$flip2, _overflowsData$filter;
        const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
        const nextPlacement = placements[nextIndex];
        if (nextPlacement) {
          const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
          if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
          // overflows the main axis.
          overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) {
            return {
              data: {
                index: nextIndex,
                overflows: overflowsData
              },
              reset: {
                placement: nextPlacement
              }
            };
          }
        }
        let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a3, b2) => a3.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
        if (!resetPlacement) {
          switch (fallbackStrategy) {
            case "bestFit": {
              var _overflowsData$filter2;
              const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => {
                if (hasFallbackAxisSideDirection) {
                  const currentSideAxis = getSideAxis(d2.placement);
                  return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
                  // reading directions favoring greater width.
                  currentSideAxis === "y";
                }
                return true;
              }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a3, b2) => a3[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
              if (placement2) {
                resetPlacement = placement2;
              }
              break;
            }
            case "initialPlacement":
              resetPlacement = initialPlacement;
              break;
          }
        }
        if (placement !== resetPlacement) {
          return {
            reset: {
              placement: resetPlacement
            }
          };
        }
      }
      return {};
    }
  };
};
const originSides = /* @__PURE__ */ new Set(["left", "top"]);
async function convertValueToCoords(state, options) {
  const {
    placement,
    platform: platform2,
    elements
  } = state;
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
  const side = getSide(placement);
  const alignment = getAlignment(placement);
  const isVertical = getSideAxis(placement) === "y";
  const mainAxisMulti = originSides.has(side) ? -1 : 1;
  const crossAxisMulti = rtl && isVertical ? -1 : 1;
  const rawValue = evaluate(options, state);
  let {
    mainAxis,
    crossAxis,
    alignmentAxis
  } = typeof rawValue === "number" ? {
    mainAxis: rawValue,
    crossAxis: 0,
    alignmentAxis: null
  } : {
    mainAxis: rawValue.mainAxis || 0,
    crossAxis: rawValue.crossAxis || 0,
    alignmentAxis: rawValue.alignmentAxis
  };
  if (alignment && typeof alignmentAxis === "number") {
    crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
  }
  return isVertical ? {
    x: crossAxis * crossAxisMulti,
    y: mainAxis * mainAxisMulti
  } : {
    x: mainAxis * mainAxisMulti,
    y: crossAxis * crossAxisMulti
  };
}
const offset$2 = function(options) {
  if (options === void 0) {
    options = 0;
  }
  return {
    name: "offset",
    options,
    async fn(state) {
      var _middlewareData$offse, _middlewareData$arrow;
      const {
        x: x2,
        y: y2,
        placement,
        middlewareData
      } = state;
      const diffCoords = await convertValueToCoords(state, options);
      if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
        return {};
      }
      return {
        x: x2 + diffCoords.x,
        y: y2 + diffCoords.y,
        data: {
          ...diffCoords,
          placement
        }
      };
    }
  };
};
const shift$2 = function(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: "shift",
    options,
    async fn(state) {
      const {
        x: x2,
        y: y2,
        placement,
        platform: platform2
      } = state;
      const {
        mainAxis: checkMainAxis = true,
        crossAxis: checkCrossAxis = false,
        limiter = {
          fn: (_ref) => {
            let {
              x: x3,
              y: y3
            } = _ref;
            return {
              x: x3,
              y: y3
            };
          }
        },
        ...detectOverflowOptions
      } = evaluate(options, state);
      const coords = {
        x: x2,
        y: y2
      };
      const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
      const crossAxis = getSideAxis(getSide(placement));
      const mainAxis = getOppositeAxis(crossAxis);
      let mainAxisCoord = coords[mainAxis];
      let crossAxisCoord = coords[crossAxis];
      if (checkMainAxis) {
        const minSide = mainAxis === "y" ? "top" : "left";
        const maxSide = mainAxis === "y" ? "bottom" : "right";
        const min2 = mainAxisCoord + overflow[minSide];
        const max2 = mainAxisCoord - overflow[maxSide];
        mainAxisCoord = clamp(min2, mainAxisCoord, max2);
      }
      if (checkCrossAxis) {
        const minSide = crossAxis === "y" ? "top" : "left";
        const maxSide = crossAxis === "y" ? "bottom" : "right";
        const min2 = crossAxisCoord + overflow[minSide];
        const max2 = crossAxisCoord - overflow[maxSide];
        crossAxisCoord = clamp(min2, crossAxisCoord, max2);
      }
      const limitedCoords = limiter.fn({
        ...state,
        [mainAxis]: mainAxisCoord,
        [crossAxis]: crossAxisCoord
      });
      return {
        ...limitedCoords,
        data: {
          x: limitedCoords.x - x2,
          y: limitedCoords.y - y2,
          enabled: {
            [mainAxis]: checkMainAxis,
            [crossAxis]: checkCrossAxis
          }
        }
      };
    }
  };
};
const size$2 = function(options) {
  if (options === void 0) {
    options = {};
  }
  return {
    name: "size",
    options,
    async fn(state) {
      var _state$middlewareData, _state$middlewareData2;
      const {
        placement,
        rects,
        platform: platform2,
        elements
      } = state;
      const {
        apply = () => {
        },
        ...detectOverflowOptions
      } = evaluate(options, state);
      const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
      const side = getSide(placement);
      const alignment = getAlignment(placement);
      const isYAxis = getSideAxis(placement) === "y";
      const {
        width,
        height
      } = rects.floating;
      let heightSide;
      let widthSide;
      if (side === "top" || side === "bottom") {
        heightSide = side;
        widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
      } else {
        widthSide = side;
        heightSide = alignment === "end" ? "top" : "bottom";
      }
      const maximumClippingHeight = height - overflow.top - overflow.bottom;
      const maximumClippingWidth = width - overflow.left - overflow.right;
      const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
      const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
      const noShift = !state.middlewareData.shift;
      let availableHeight = overflowAvailableHeight;
      let availableWidth = overflowAvailableWidth;
      if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
        availableWidth = maximumClippingWidth;
      }
      if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
        availableHeight = maximumClippingHeight;
      }
      if (noShift && !alignment) {
        const xMin = max(overflow.left, 0);
        const xMax = max(overflow.right, 0);
        const yMin = max(overflow.top, 0);
        const yMax = max(overflow.bottom, 0);
        if (isYAxis) {
          availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
        } else {
          availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
        }
      }
      await apply({
        ...state,
        availableWidth,
        availableHeight
      });
      const nextDimensions = await platform2.getDimensions(elements.floating);
      if (width !== nextDimensions.width || height !== nextDimensions.height) {
        return {
          reset: {
            rects: true
          }
        };
      }
      return {};
    }
  };
};
function getCssDimensions(element) {
  const css = getComputedStyle$1(element);
  let width = parseFloat(css.width) || 0;
  let height = parseFloat(css.height) || 0;
  const hasOffset = isHTMLElement(element);
  const offsetWidth = hasOffset ? element.offsetWidth : width;
  const offsetHeight = hasOffset ? element.offsetHeight : height;
  const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
  if (shouldFallback) {
    width = offsetWidth;
    height = offsetHeight;
  }
  return {
    width,
    height,
    $: shouldFallback
  };
}
function unwrapElement(element) {
  return !isElement(element) ? element.contextElement : element;
}
function getScale(element) {
  const domElement = unwrapElement(element);
  if (!isHTMLElement(domElement)) {
    return createCoords(1);
  }
  const rect = domElement.getBoundingClientRect();
  const {
    width,
    height,
    $: $2
  } = getCssDimensions(domElement);
  let x2 = ($2 ? round(rect.width) : rect.width) / width;
  let y2 = ($2 ? round(rect.height) : rect.height) / height;
  if (!x2 || !Number.isFinite(x2)) {
    x2 = 1;
  }
  if (!y2 || !Number.isFinite(y2)) {
    y2 = 1;
  }
  return {
    x: x2,
    y: y2
  };
}
const noOffsets = /* @__PURE__ */ createCoords(0);
function getVisualOffsets(element) {
  const win = getWindow(element);
  if (!isWebKit() || !win.visualViewport) {
    return noOffsets;
  }
  return {
    x: win.visualViewport.offsetLeft,
    y: win.visualViewport.offsetTop
  };
}
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  if (isFixed === void 0) {
    isFixed = false;
  }
  if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
    return false;
  }
  return isFixed;
}
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
  if (includeScale === void 0) {
    includeScale = false;
  }
  if (isFixedStrategy === void 0) {
    isFixedStrategy = false;
  }
  const clientRect = element.getBoundingClientRect();
  const domElement = unwrapElement(element);
  let scale = createCoords(1);
  if (includeScale) {
    if (offsetParent) {
      if (isElement(offsetParent)) {
        scale = getScale(offsetParent);
      }
    } else {
      scale = getScale(element);
    }
  }
  const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  let x2 = (clientRect.left + visualOffsets.x) / scale.x;
  let y2 = (clientRect.top + visualOffsets.y) / scale.y;
  let width = clientRect.width / scale.x;
  let height = clientRect.height / scale.y;
  if (domElement) {
    const win = getWindow(domElement);
    const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
    let currentWin = win;
    let currentIFrame = getFrameElement(currentWin);
    while (currentIFrame && offsetParent && offsetWin !== currentWin) {
      const iframeScale = getScale(currentIFrame);
      const iframeRect = currentIFrame.getBoundingClientRect();
      const css = getComputedStyle$1(currentIFrame);
      const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
      const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
      x2 *= iframeScale.x;
      y2 *= iframeScale.y;
      width *= iframeScale.x;
      height *= iframeScale.y;
      x2 += left;
      y2 += top;
      currentWin = getWindow(currentIFrame);
      currentIFrame = getFrameElement(currentWin);
    }
  }
  return rectToClientRect({
    width,
    height,
    x: x2,
    y: y2
  });
}
function getWindowScrollBarX(element, rect) {
  const leftScroll = getNodeScroll(element).scrollLeft;
  if (!rect) {
    return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
  }
  return rect.left + leftScroll;
}
function getHTMLOffset(documentElement, scroll) {
  const htmlRect = documentElement.getBoundingClientRect();
  const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
  const y2 = htmlRect.top + scroll.scrollTop;
  return {
    x: x2,
    y: y2
  };
}
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  let {
    elements,
    rect,
    offsetParent,
    strategy
  } = _ref;
  const isFixed = strategy === "fixed";
  const documentElement = getDocumentElement(offsetParent);
  const topLayer = elements ? isTopLayer(elements.floating) : false;
  if (offsetParent === documentElement || topLayer && isFixed) {
    return rect;
  }
  let scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  let scale = createCoords(1);
  const offsets = createCoords(0);
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
    if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
      scroll = getNodeScroll(offsetParent);
    }
    if (isOffsetParentAnElement) {
      const offsetRect = getBoundingClientRect(offsetParent);
      scale = getScale(offsetParent);
      offsets.x = offsetRect.x + offsetParent.clientLeft;
      offsets.y = offsetRect.y + offsetParent.clientTop;
    }
  }
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  return {
    width: rect.width * scale.x,
    height: rect.height * scale.y,
    x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
    y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
  };
}
function getClientRects(element) {
  return Array.from(element.getClientRects());
}
function getDocumentRect(element) {
  const html = getDocumentElement(element);
  const scroll = getNodeScroll(element);
  const body = element.ownerDocument.body;
  const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
  const y2 = -scroll.scrollTop;
  if (getComputedStyle$1(body).direction === "rtl") {
    x2 += max(html.clientWidth, body.clientWidth) - width;
  }
  return {
    width,
    height,
    x: x2,
    y: y2
  };
}
const SCROLLBAR_MAX = 25;
function getViewportRect(element, strategy) {
  const win = getWindow(element);
  const html = getDocumentElement(element);
  const visualViewport = win.visualViewport;
  let width = html.clientWidth;
  let height = html.clientHeight;
  let x2 = 0;
  let y2 = 0;
  if (visualViewport) {
    width = visualViewport.width;
    height = visualViewport.height;
    const visualViewportBased = isWebKit();
    if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
      x2 = visualViewport.offsetLeft;
      y2 = visualViewport.offsetTop;
    }
  }
  const windowScrollbarX = getWindowScrollBarX(html);
  if (windowScrollbarX <= 0) {
    const doc = html.ownerDocument;
    const body = doc.body;
    const bodyStyles = getComputedStyle(body);
    const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
    const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
    if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
      width -= clippingStableScrollbarWidth;
    }
  } else if (windowScrollbarX <= SCROLLBAR_MAX) {
    width += windowScrollbarX;
  }
  return {
    width,
    height,
    x: x2,
    y: y2
  };
}
function getInnerBoundingClientRect(element, strategy) {
  const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
  const top = clientRect.top + element.clientTop;
  const left = clientRect.left + element.clientLeft;
  const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
  const width = element.clientWidth * scale.x;
  const height = element.clientHeight * scale.y;
  const x2 = left * scale.x;
  const y2 = top * scale.y;
  return {
    width,
    height,
    x: x2,
    y: y2
  };
}
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
  let rect;
  if (clippingAncestor === "viewport") {
    rect = getViewportRect(element, strategy);
  } else if (clippingAncestor === "document") {
    rect = getDocumentRect(getDocumentElement(element));
  } else if (isElement(clippingAncestor)) {
    rect = getInnerBoundingClientRect(clippingAncestor, strategy);
  } else {
    const visualOffsets = getVisualOffsets(element);
    rect = {
      x: clippingAncestor.x - visualOffsets.x,
      y: clippingAncestor.y - visualOffsets.y,
      width: clippingAncestor.width,
      height: clippingAncestor.height
    };
  }
  return rectToClientRect(rect);
}
function hasFixedPositionAncestor(element, stopNode) {
  const parentNode = getParentNode(element);
  if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
    return false;
  }
  return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
}
function getClippingElementAncestors(element, cache) {
  const cachedResult = cache.get(element);
  if (cachedResult) {
    return cachedResult;
  }
  let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
  let currentContainingBlockComputedStyle = null;
  const elementIsFixed = getComputedStyle$1(element).position === "fixed";
  let currentNode = elementIsFixed ? getParentNode(element) : element;
  while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
    const computedStyle = getComputedStyle$1(currentNode);
    const currentNodeIsContaining = isContainingBlock(currentNode);
    if (!currentNodeIsContaining && computedStyle.position === "fixed") {
      currentContainingBlockComputedStyle = null;
    }
    const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
    if (shouldDropCurrentNode) {
      result = result.filter((ancestor) => ancestor !== currentNode);
    } else {
      currentContainingBlockComputedStyle = computedStyle;
    }
    currentNode = getParentNode(currentNode);
  }
  cache.set(element, result);
  return result;
}
function getClippingRect(_ref) {
  let {
    element,
    boundary,
    rootBoundary,
    strategy
  } = _ref;
  const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
  const clippingAncestors = [...elementClippingAncestors, rootBoundary];
  const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
  let top = firstRect.top;
  let right = firstRect.right;
  let bottom = firstRect.bottom;
  let left = firstRect.left;
  for (let i2 = 1; i2 < clippingAncestors.length; i2++) {
    const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy);
    top = max(rect.top, top);
    right = min(rect.right, right);
    bottom = min(rect.bottom, bottom);
    left = max(rect.left, left);
  }
  return {
    width: right - left,
    height: bottom - top,
    x: left,
    y: top
  };
}
function getDimensions(element) {
  const {
    width,
    height
  } = getCssDimensions(element);
  return {
    width,
    height
  };
}
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  const isOffsetParentAnElement = isHTMLElement(offsetParent);
  const documentElement = getDocumentElement(offsetParent);
  const isFixed = strategy === "fixed";
  const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
  let scroll = {
    scrollLeft: 0,
    scrollTop: 0
  };
  const offsets = createCoords(0);
  function setLeftRTLScrollbarOffset() {
    offsets.x = getWindowScrollBarX(documentElement);
  }
  if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
    if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
      scroll = getNodeScroll(offsetParent);
    }
    if (isOffsetParentAnElement) {
      const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
      offsets.x = offsetRect.x + offsetParent.clientLeft;
      offsets.y = offsetRect.y + offsetParent.clientTop;
    } else if (documentElement) {
      setLeftRTLScrollbarOffset();
    }
  }
  if (isFixed && !isOffsetParentAnElement && documentElement) {
    setLeftRTLScrollbarOffset();
  }
  const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
  const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
  return {
    x: x2,
    y: y2,
    width: rect.width,
    height: rect.height
  };
}
function isStaticPositioned(element) {
  return getComputedStyle$1(element).position === "static";
}
function getTrueOffsetParent(element, polyfill) {
  if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
    return null;
  }
  if (polyfill) {
    return polyfill(element);
  }
  let rawOffsetParent = element.offsetParent;
  if (getDocumentElement(element) === rawOffsetParent) {
    rawOffsetParent = rawOffsetParent.ownerDocument.body;
  }
  return rawOffsetParent;
}
function getOffsetParent(element, polyfill) {
  const win = getWindow(element);
  if (isTopLayer(element)) {
    return win;
  }
  if (!isHTMLElement(element)) {
    let svgOffsetParent = getParentNode(element);
    while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
      if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
        return svgOffsetParent;
      }
      svgOffsetParent = getParentNode(svgOffsetParent);
    }
    return win;
  }
  let offsetParent = getTrueOffsetParent(element, polyfill);
  while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
    offsetParent = getTrueOffsetParent(offsetParent, polyfill);
  }
  if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
    return win;
  }
  return offsetParent || getContainingBlock(element) || win;
}
const getElementRects = async function(data) {
  const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
  const getDimensionsFn = this.getDimensions;
  const floatingDimensions = await getDimensionsFn(data.floating);
  return {
    reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
    floating: {
      x: 0,
      y: 0,
      width: floatingDimensions.width,
      height: floatingDimensions.height
    }
  };
};
function isRTL(element) {
  return getComputedStyle$1(element).direction === "rtl";
}
const platform = {
  convertOffsetParentRelativeRectToViewportRelativeRect,
  getDocumentElement,
  getClippingRect,
  getOffsetParent,
  getElementRects,
  getClientRects,
  getDimensions,
  getScale,
  isElement,
  isRTL
};
function rectsAreEqual(a3, b2) {
  return a3.x === b2.x && a3.y === b2.y && a3.width === b2.width && a3.height === b2.height;
}
function observeMove(element, onMove) {
  let io = null;
  let timeoutId;
  const root = getDocumentElement(element);
  function cleanup() {
    var _io;
    clearTimeout(timeoutId);
    (_io = io) == null || _io.disconnect();
    io = null;
  }
  function refresh(skip, threshold) {
    if (skip === void 0) {
      skip = false;
    }
    if (threshold === void 0) {
      threshold = 1;
    }
    cleanup();
    const elementRectForRootMargin = element.getBoundingClientRect();
    const {
      left,
      top,
      width,
      height
    } = elementRectForRootMargin;
    if (!skip) {
      onMove();
    }
    if (!width || !height) {
      return;
    }
    const insetTop = floor(top);
    const insetRight = floor(root.clientWidth - (left + width));
    const insetBottom = floor(root.clientHeight - (top + height));
    const insetLeft = floor(left);
    const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
    const options = {
      rootMargin,
      threshold: max(0, min(1, threshold)) || 1
    };
    let isFirstUpdate = true;
    function handleObserve(entries) {
      const ratio = entries[0].intersectionRatio;
      if (ratio !== threshold) {
        if (!isFirstUpdate) {
          return refresh();
        }
        if (!ratio) {
          timeoutId = setTimeout(() => {
            refresh(false, 1e-7);
          }, 1e3);
        } else {
          refresh(false, ratio);
        }
      }
      if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
        refresh();
      }
      isFirstUpdate = false;
    }
    try {
      io = new IntersectionObserver(handleObserve, {
        ...options,
        // Handle <iframe>s
        root: root.ownerDocument
      });
    } catch (_e2) {
      io = new IntersectionObserver(handleObserve, options);
    }
    io.observe(element);
  }
  refresh(true);
  return cleanup;
}
function autoUpdate(reference, floating, update, options) {
  if (options === void 0) {
    options = {};
  }
  const {
    ancestorScroll = true,
    ancestorResize = true,
    elementResize = typeof ResizeObserver === "function",
    layoutShift = typeof IntersectionObserver === "function",
    animationFrame = false
  } = options;
  const referenceEl = unwrapElement(reference);
  const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
  ancestors.forEach((ancestor) => {
    ancestorScroll && ancestor.addEventListener("scroll", update, {
      passive: true
    });
    ancestorResize && ancestor.addEventListener("resize", update);
  });
  const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
  let reobserveFrame = -1;
  let resizeObserver = null;
  if (elementResize) {
    resizeObserver = new ResizeObserver((_ref) => {
      let [firstEntry] = _ref;
      if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
        resizeObserver.unobserve(floating);
        cancelAnimationFrame(reobserveFrame);
        reobserveFrame = requestAnimationFrame(() => {
          var _resizeObserver;
          (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
        });
      }
      update();
    });
    if (referenceEl && !animationFrame) {
      resizeObserver.observe(referenceEl);
    }
    if (floating) {
      resizeObserver.observe(floating);
    }
  }
  let frameId;
  let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  if (animationFrame) {
    frameLoop();
  }
  function frameLoop() {
    const nextRefRect = getBoundingClientRect(reference);
    if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
      update();
    }
    prevRefRect = nextRefRect;
    frameId = requestAnimationFrame(frameLoop);
  }
  update();
  return () => {
    var _resizeObserver2;
    ancestors.forEach((ancestor) => {
      ancestorScroll && ancestor.removeEventListener("scroll", update);
      ancestorResize && ancestor.removeEventListener("resize", update);
    });
    cleanupIo == null || cleanupIo();
    (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
    resizeObserver = null;
    if (animationFrame) {
      cancelAnimationFrame(frameId);
    }
  };
}
const detectOverflow = detectOverflow$1;
const offset$1 = offset$2;
const shift$1 = shift$2;
const flip$1 = flip$2;
const size$1 = size$2;
const computePosition = (reference, floating, options) => {
  const cache = /* @__PURE__ */ new Map();
  const mergedOptions = {
    platform,
    ...options
  };
  const platformWithCache = {
    ...mergedOptions.platform,
    _c: cache
  };
  return computePosition$1(reference, floating, {
    ...mergedOptions,
    platform: platformWithCache
  });
};
var isClient = typeof document !== "undefined";
var noop$1 = function noop() {
};
var index$1 = isClient ? window.wp.element.useLayoutEffect : noop$1;
function deepEqual(a3, b2) {
  if (a3 === b2) {
    return true;
  }
  if (typeof a3 !== typeof b2) {
    return false;
  }
  if (typeof a3 === "function" && a3.toString() === b2.toString()) {
    return true;
  }
  let length;
  let i2;
  let keys;
  if (a3 && b2 && typeof a3 === "object") {
    if (Array.isArray(a3)) {
      length = a3.length;
      if (length !== b2.length) return false;
      for (i2 = length; i2-- !== 0; ) {
        if (!deepEqual(a3[i2], b2[i2])) {
          return false;
        }
      }
      return true;
    }
    keys = Object.keys(a3);
    length = keys.length;
    if (length !== Object.keys(b2).length) {
      return false;
    }
    for (i2 = length; i2-- !== 0; ) {
      if (!{}.hasOwnProperty.call(b2, keys[i2])) {
        return false;
      }
    }
    for (i2 = length; i2-- !== 0; ) {
      const key = keys[i2];
      if (key === "_owner" && a3.$$typeof) {
        continue;
      }
      if (!deepEqual(a3[key], b2[key])) {
        return false;
      }
    }
    return true;
  }
  return a3 !== a3 && b2 !== b2;
}
function getDPR(element) {
  if (typeof window === "undefined") {
    return 1;
  }
  const win = element.ownerDocument.defaultView || window;
  return win.devicePixelRatio || 1;
}
function roundByDPR(element, value) {
  const dpr = getDPR(element);
  return Math.round(value * dpr) / dpr;
}
function useLatestRef(value) {
  const ref = window.wp.element.useRef(value);
  index$1(() => {
    ref.current = value;
  });
  return ref;
}
function useFloating$1(options) {
  if (options === void 0) {
    options = {};
  }
  const {
    placement = "bottom",
    strategy = "absolute",
    middleware = [],
    platform: platform2,
    elements: {
      reference: externalReference,
      floating: externalFloating
    } = {},
    transform = true,
    whileElementsMounted,
    open
  } = options;
  const [data, setData] = window.wp.element.useState({
    x: 0,
    y: 0,
    strategy,
    placement,
    middlewareData: {},
    isPositioned: false
  });
  const [latestMiddleware, setLatestMiddleware] = window.wp.element.useState(middleware);
  if (!deepEqual(latestMiddleware, middleware)) {
    setLatestMiddleware(middleware);
  }
  const [_reference, _setReference] = window.wp.element.useState(null);
  const [_floating, _setFloating] = window.wp.element.useState(null);
  const setReference = window.wp.element.useCallback((node) => {
    if (node !== referenceRef.current) {
      referenceRef.current = node;
      _setReference(node);
    }
  }, []);
  const setFloating = window.wp.element.useCallback((node) => {
    if (node !== floatingRef.current) {
      floatingRef.current = node;
      _setFloating(node);
    }
  }, []);
  const referenceEl = externalReference || _reference;
  const floatingEl = externalFloating || _floating;
  const referenceRef = window.wp.element.useRef(null);
  const floatingRef = window.wp.element.useRef(null);
  const dataRef = window.wp.element.useRef(data);
  const hasWhileElementsMounted = whileElementsMounted != null;
  const whileElementsMountedRef = useLatestRef(whileElementsMounted);
  const platformRef = useLatestRef(platform2);
  const openRef = useLatestRef(open);
  const update = window.wp.element.useCallback(() => {
    if (!referenceRef.current || !floatingRef.current) {
      return;
    }
    const config = {
      placement,
      strategy,
      middleware: latestMiddleware
    };
    if (platformRef.current) {
      config.platform = platformRef.current;
    }
    computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
      const fullData = {
        ...data2,
        // The floating element's position may be recomputed while it's closed
        // but still mounted (such as when transitioning out). To ensure
        // `isPositioned` will be `false` initially on the next open, avoid
        // setting it to `true` when `open === false` (must be specified).
        isPositioned: openRef.current !== false
      };
      if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
        dataRef.current = fullData;
        window.wp.element.flushSync(() => {
          setData(fullData);
        });
      }
    });
  }, [latestMiddleware, placement, strategy, platformRef, openRef]);
  index$1(() => {
    if (open === false && dataRef.current.isPositioned) {
      dataRef.current.isPositioned = false;
      setData((data2) => ({
        ...data2,
        isPositioned: false
      }));
    }
  }, [open]);
  const isMountedRef = window.wp.element.useRef(false);
  index$1(() => {
    isMountedRef.current = true;
    return () => {
      isMountedRef.current = false;
    };
  }, []);
  index$1(() => {
    if (referenceEl) referenceRef.current = referenceEl;
    if (floatingEl) floatingRef.current = floatingEl;
    if (referenceEl && floatingEl) {
      if (whileElementsMountedRef.current) {
        return whileElementsMountedRef.current(referenceEl, floatingEl, update);
      }
      update();
    }
  }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
  const refs = window.wp.element.useMemo(() => ({
    reference: referenceRef,
    floating: floatingRef,
    setReference,
    setFloating
  }), [setReference, setFloating]);
  const elements = window.wp.element.useMemo(() => ({
    reference: referenceEl,
    floating: floatingEl
  }), [referenceEl, floatingEl]);
  const floatingStyles = window.wp.element.useMemo(() => {
    const initialStyles = {
      position: strategy,
      left: 0,
      top: 0
    };
    if (!elements.floating) {
      return initialStyles;
    }
    const x2 = roundByDPR(elements.floating, data.x);
    const y2 = roundByDPR(elements.floating, data.y);
    if (transform) {
      return {
        ...initialStyles,
        transform: "translate(" + x2 + "px, " + y2 + "px)",
        ...getDPR(elements.floating) >= 1.5 && {
          willChange: "transform"
        }
      };
    }
    return {
      position: strategy,
      left: x2,
      top: y2
    };
  }, [strategy, transform, elements.floating, data.x, data.y]);
  return window.wp.element.useMemo(() => ({
    ...data,
    update,
    refs,
    elements,
    floatingStyles
  }), [data, update, refs, elements, floatingStyles]);
}
const offset = (options, deps) => {
  const result = offset$1(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};
const shift = (options, deps) => {
  const result = shift$1(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};
const flip = (options, deps) => {
  const result = flip$1(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};
const size = (options, deps) => {
  const result = size$1(options);
  return {
    name: result.name,
    fn: result.fn,
    options: [options, deps]
  };
};
const SafeReact = {
  ...window.wp.element
};
const useInsertionEffect = SafeReact.useInsertionEffect;
const useSafeInsertionEffect = useInsertionEffect || ((fn) => fn());
function useEffectEvent(callback) {
  const ref = window.wp.element.useRef(() => {
  });
  useSafeInsertionEffect(() => {
    ref.current = callback;
  });
  return window.wp.element.useCallback(function() {
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    return ref.current == null ? void 0 : ref.current(...args);
  }, []);
}
var index = typeof document !== "undefined" ? window.wp.element.useLayoutEffect : window.wp.element.useEffect;
let serverHandoffComplete = false;
let count = 0;
const genId = () => (
  // Ensure the id is unique with multiple independent versions of Floating UI
  // on <React 18
  "floating-ui-" + Math.random().toString(36).slice(2, 6) + count++
);
function useFloatingId() {
  const [id, setId] = window.wp.element.useState(() => serverHandoffComplete ? genId() : void 0);
  index(() => {
    if (id == null) {
      setId(genId());
    }
  }, []);
  window.wp.element.useEffect(() => {
    serverHandoffComplete = true;
  }, []);
  return id;
}
const useReactId = SafeReact.useId;
const useId = useReactId || useFloatingId;
function createPubSub() {
  const map = /* @__PURE__ */ new Map();
  return {
    emit(event, data) {
      var _map$get;
      (_map$get = map.get(event)) == null || _map$get.forEach((handler) => handler(data));
    },
    on(event, listener) {
      map.set(event, [...map.get(event) || [], listener]);
    },
    off(event, listener) {
      var _map$get2;
      map.set(event, ((_map$get2 = map.get(event)) == null ? void 0 : _map$get2.filter((l2) => l2 !== listener)) || []);
    }
  };
}
const FloatingNodeContext = /* @__PURE__ */ window.wp.element.createContext(null);
const FloatingTreeContext = /* @__PURE__ */ window.wp.element.createContext(null);
const useFloatingParentNodeId = () => {
  var _React$useContext;
  return ((_React$useContext = window.wp.element.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
};
const useFloatingTree = () => window.wp.element.useContext(FloatingTreeContext);
const FOCUSABLE_ATTRIBUTE = "data-floating-ui-focusable";
function useFloatingRootContext(options) {
  const {
    open = false,
    onOpenChange: onOpenChangeProp,
    elements: elementsProp
  } = options;
  const floatingId = useId();
  const dataRef = window.wp.element.useRef({});
  const [events] = window.wp.element.useState(() => createPubSub());
  const nested = useFloatingParentNodeId() != null;
  const [positionReference, setPositionReference] = window.wp.element.useState(elementsProp.reference);
  const onOpenChange = useEffectEvent((open2, event, reason) => {
    dataRef.current.openEvent = open2 ? event : void 0;
    events.emit("openchange", {
      open: open2,
      event,
      reason,
      nested
    });
    onOpenChangeProp == null || onOpenChangeProp(open2, event, reason);
  });
  const refs = window.wp.element.useMemo(() => ({
    setPositionReference
  }), []);
  const elements = window.wp.element.useMemo(() => ({
    reference: positionReference || elementsProp.reference || null,
    floating: elementsProp.floating || null,
    domReference: elementsProp.reference
  }), [positionReference, elementsProp.reference, elementsProp.floating]);
  return window.wp.element.useMemo(() => ({
    dataRef,
    open,
    onOpenChange,
    elements,
    events,
    floatingId,
    refs
  }), [open, onOpenChange, elements, events, floatingId, refs]);
}
function useFloating(options) {
  if (options === void 0) {
    options = {};
  }
  const {
    nodeId
  } = options;
  const internalRootContext = useFloatingRootContext({
    ...options,
    elements: {
      reference: null,
      floating: null,
      ...options.elements
    }
  });
  const rootContext = options.rootContext || internalRootContext;
  const computedElements = rootContext.elements;
  const [_domReference, setDomReference] = window.wp.element.useState(null);
  const [positionReference, _setPositionReference] = window.wp.element.useState(null);
  const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;
  const domReference = optionDomReference || _domReference;
  const domReferenceRef = window.wp.element.useRef(null);
  const tree = useFloatingTree();
  index(() => {
    if (domReference) {
      domReferenceRef.current = domReference;
    }
  }, [domReference]);
  const position = useFloating$1({
    ...options,
    elements: {
      ...computedElements,
      ...positionReference && {
        reference: positionReference
      }
    }
  });
  const setPositionReference = window.wp.element.useCallback((node) => {
    const computedPositionReference = isElement(node) ? {
      getBoundingClientRect: () => node.getBoundingClientRect(),
      contextElement: node
    } : node;
    _setPositionReference(computedPositionReference);
    position.refs.setReference(computedPositionReference);
  }, [position.refs]);
  const setReference = window.wp.element.useCallback((node) => {
    if (isElement(node) || node === null) {
      domReferenceRef.current = node;
      setDomReference(node);
    }
    if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
    // `null` to support `positionReference` + an unstable `reference`
    // callback ref.
    node !== null && !isElement(node)) {
      position.refs.setReference(node);
    }
  }, [position.refs]);
  const refs = window.wp.element.useMemo(() => ({
    ...position.refs,
    setReference,
    setPositionReference,
    domReference: domReferenceRef
  }), [position.refs, setReference, setPositionReference]);
  const elements = window.wp.element.useMemo(() => ({
    ...position.elements,
    domReference
  }), [position.elements, domReference]);
  const context = window.wp.element.useMemo(() => ({
    ...position,
    ...rootContext,
    refs,
    elements,
    nodeId
  }), [position, refs, elements, nodeId, rootContext]);
  index(() => {
    rootContext.dataRef.current.floatingContext = context;
    const node = tree == null ? void 0 : tree.nodesRef.current.find((node2) => node2.id === nodeId);
    if (node) {
      node.context = context;
    }
  });
  return window.wp.element.useMemo(() => ({
    ...position,
    context,
    refs,
    elements
  }), [position, refs, elements, context]);
}
const ACTIVE_KEY = "active";
const SELECTED_KEY = "selected";
function mergeProps(userProps, propsList, elementKey) {
  const map = /* @__PURE__ */ new Map();
  const isItem = elementKey === "item";
  let domUserProps = userProps;
  if (isItem && userProps) {
    const {
      [ACTIVE_KEY]: _2,
      [SELECTED_KEY]: __,
      ...validProps
    } = userProps;
    domUserProps = validProps;
  }
  return {
    ...elementKey === "floating" && {
      tabIndex: -1,
      [FOCUSABLE_ATTRIBUTE]: ""
    },
    ...domUserProps,
    ...propsList.map((value) => {
      const propsOrGetProps = value ? value[elementKey] : null;
      if (typeof propsOrGetProps === "function") {
        return userProps ? propsOrGetProps(userProps) : null;
      }
      return propsOrGetProps;
    }).concat(userProps).reduce((acc, props) => {
      if (!props) {
        return acc;
      }
      Object.entries(props).forEach((_ref) => {
        let [key, value] = _ref;
        if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {
          return;
        }
        if (key.indexOf("on") === 0) {
          if (!map.has(key)) {
            map.set(key, []);
          }
          if (typeof value === "function") {
            var _map$get;
            (_map$get = map.get(key)) == null || _map$get.push(value);
            acc[key] = function() {
              var _map$get2;
              for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
                args[_key] = arguments[_key];
              }
              return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map((fn) => fn(...args)).find((val) => val !== void 0);
            };
          }
        } else {
          acc[key] = value;
        }
      });
      return acc;
    }, {})
  };
}
function useInteractions(propsList) {
  if (propsList === void 0) {
    propsList = [];
  }
  const referenceDeps = propsList.map((key) => key == null ? void 0 : key.reference);
  const floatingDeps = propsList.map((key) => key == null ? void 0 : key.floating);
  const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
  const getReferenceProps = window.wp.element.useCallback(
    (userProps) => mergeProps(userProps, propsList, "reference"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    referenceDeps
  );
  const getFloatingProps = window.wp.element.useCallback(
    (userProps) => mergeProps(userProps, propsList, "floating"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    floatingDeps
  );
  const getItemProps = window.wp.element.useCallback(
    (userProps) => mergeProps(userProps, propsList, "item"),
    // eslint-disable-next-line react-hooks/exhaustive-deps
    itemDeps
  );
  return window.wp.element.useMemo(() => ({
    getReferenceProps,
    getFloatingProps,
    getItemProps
  }), [getReferenceProps, getFloatingProps, getItemProps]);
}
function getArgsWithCustomFloatingHeight(state, height) {
  return {
    ...state,
    rects: {
      ...state.rects,
      floating: {
        ...state.rects.floating,
        height
      }
    }
  };
}
const inner = (props) => ({
  name: "inner",
  options: props,
  async fn(state) {
    const {
      listRef,
      overflowRef,
      onFallbackChange,
      offset: innerOffset = 0,
      index: index2 = 0,
      minItemsVisible = 4,
      referenceOverflowThreshold = 0,
      scrollRef,
      ...detectOverflowOptions
    } = evaluate(props, state);
    const {
      rects,
      elements: {
        floating
      }
    } = state;
    const item = listRef.current[index2];
    const scrollEl = (scrollRef == null ? void 0 : scrollRef.current) || floating;
    const clientTop = floating.clientTop || scrollEl.clientTop;
    const floatingIsBordered = floating.clientTop !== 0;
    const scrollElIsBordered = scrollEl.clientTop !== 0;
    const floatingIsScrollEl = floating === scrollEl;
    if (!item) {
      return {};
    }
    const nextArgs = {
      ...state,
      ...await offset(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state)
    };
    const overflow = await detectOverflow(getArgsWithCustomFloatingHeight(nextArgs, scrollEl.scrollHeight + clientTop + floating.clientTop), detectOverflowOptions);
    const refOverflow = await detectOverflow(nextArgs, {
      ...detectOverflowOptions,
      elementContext: "reference"
    });
    const diffY = max(0, overflow.top);
    const nextY = nextArgs.y + diffY;
    const isScrollable = scrollEl.scrollHeight > scrollEl.clientHeight;
    const rounder = isScrollable ? (v2) => v2 : round;
    const maxHeight = rounder(max(0, scrollEl.scrollHeight + (floatingIsBordered && floatingIsScrollEl || scrollElIsBordered ? clientTop * 2 : 0) - diffY - max(0, overflow.bottom)));
    scrollEl.style.maxHeight = maxHeight + "px";
    scrollEl.scrollTop = diffY;
    if (onFallbackChange) {
      const shouldFallback = scrollEl.offsetHeight < item.offsetHeight * min(minItemsVisible, listRef.current.length) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold;
      window.wp.element.flushSync(() => onFallbackChange(shouldFallback));
    }
    if (overflowRef) {
      overflowRef.current = await detectOverflow(getArgsWithCustomFloatingHeight({
        ...nextArgs,
        y: nextY
      }, scrollEl.offsetHeight + clientTop + floating.clientTop), detectOverflowOptions);
    }
    return {
      y: nextY
    };
  }
});
function useInnerOffset(context, props) {
  const {
    open,
    elements
  } = context;
  const {
    enabled = true,
    overflowRef,
    scrollRef,
    onChange: unstable_onChange
  } = props;
  const onChange = useEffectEvent(unstable_onChange);
  const controlledScrollingRef = window.wp.element.useRef(false);
  const prevScrollTopRef = window.wp.element.useRef(null);
  const initialOverflowRef = window.wp.element.useRef(null);
  window.wp.element.useEffect(() => {
    if (!enabled) return;
    function onWheel(e2) {
      if (e2.ctrlKey || !el || overflowRef.current == null) {
        return;
      }
      const dY = e2.deltaY;
      const isAtTop = overflowRef.current.top >= -0.5;
      const isAtBottom = overflowRef.current.bottom >= -0.5;
      const remainingScroll = el.scrollHeight - el.clientHeight;
      const sign = dY < 0 ? -1 : 1;
      const method = dY < 0 ? "max" : "min";
      if (el.scrollHeight <= el.clientHeight) {
        return;
      }
      if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) {
        e2.preventDefault();
        window.wp.element.flushSync(() => {
          onChange((d2) => d2 + Math[method](dY, remainingScroll * sign));
        });
      } else if (/firefox/i.test(getUserAgent())) {
        el.scrollTop += dY;
      }
    }
    const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;
    if (open && el) {
      el.addEventListener("wheel", onWheel);
      requestAnimationFrame(() => {
        prevScrollTopRef.current = el.scrollTop;
        if (overflowRef.current != null) {
          initialOverflowRef.current = {
            ...overflowRef.current
          };
        }
      });
      return () => {
        prevScrollTopRef.current = null;
        initialOverflowRef.current = null;
        el.removeEventListener("wheel", onWheel);
      };
    }
  }, [enabled, open, elements.floating, overflowRef, scrollRef, onChange]);
  const floating = window.wp.element.useMemo(() => ({
    onKeyDown() {
      controlledScrollingRef.current = true;
    },
    onWheel() {
      controlledScrollingRef.current = false;
    },
    onPointerMove() {
      controlledScrollingRef.current = false;
    },
    onScroll() {
      const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating;
      if (!overflowRef.current || !el || !controlledScrollingRef.current) {
        return;
      }
      if (prevScrollTopRef.current !== null) {
        const scrollDiff = el.scrollTop - prevScrollTopRef.current;
        if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) {
          window.wp.element.flushSync(() => onChange((d2) => d2 + scrollDiff));
        }
      }
      requestAnimationFrame(() => {
        prevScrollTopRef.current = el.scrollTop;
      });
    }
  }), [elements.floating, onChange, overflowRef, scrollRef]);
  return window.wp.element.useMemo(() => enabled ? {
    floating
  } : {}, [enabled, floating]);
}
let y$2 = window.wp.element.createContext({ styles: void 0, setReference: () => {
}, setFloating: () => {
}, getReferenceProps: () => ({}), getFloatingProps: () => ({}), slot: {} });
y$2.displayName = "FloatingContext";
let $$1 = window.wp.element.createContext(null);
$$1.displayName = "PlacementContext";
function ye(e2) {
  return window.wp.element.useMemo(() => e2 ? typeof e2 == "string" ? { to: e2 } : e2 : null, [e2]);
}
function Fe$4() {
  return window.wp.element.useContext(y$2).setReference;
}
function be() {
  return window.wp.element.useContext(y$2).getReferenceProps;
}
function Te$2() {
  let { getFloatingProps: e2, slot: t2 } = window.wp.element.useContext(y$2);
  return window.wp.element.useCallback((...n2) => Object.assign({}, e2(...n2), { "data-anchor": t2.anchor }), [e2, t2]);
}
function Re$1(e2 = null) {
  e2 === false && (e2 = null), typeof e2 == "string" && (e2 = { to: e2 });
  let t2 = window.wp.element.useContext($$1), n2 = window.wp.element.useMemo(() => e2, [JSON.stringify(e2, (l2, o4) => {
    var u2;
    return (u2 = o4 == null ? void 0 : o4.outerHTML) != null ? u2 : o4;
  })]);
  n$6(() => {
    t2 == null || t2(n2 != null ? n2 : null);
  }, [t2, n2]);
  let r2 = window.wp.element.useContext(y$2);
  return window.wp.element.useMemo(() => [r2.setFloating, e2 ? r2.styles : {}], [r2.setFloating, e2, r2.styles]);
}
let D$3 = 4;
function Ae$2({ children: e2, enabled: t2 = true }) {
  let [n2, r2] = window.wp.element.useState(null), [l2, o4] = window.wp.element.useState(0), u2 = window.wp.element.useRef(null), [f2, s2] = window.wp.element.useState(null);
  ce$1(f2);
  let i2 = t2 && n2 !== null && f2 !== null, { to: F2 = "bottom", gap: E2 = 0, offset: A2 = 0, padding: c2 = 0, inner: h4 } = ge$1(n2, f2), [a3, p2 = "center"] = F2.split(" ");
  n$6(() => {
    i2 && o4(0);
  }, [i2]);
  let { refs: b2, floatingStyles: S2, context: g2 } = useFloating({ open: i2, placement: a3 === "selection" ? p2 === "center" ? "bottom" : `bottom-${p2}` : p2 === "center" ? `${a3}` : `${a3}-${p2}`, strategy: "absolute", transform: false, middleware: [offset({ mainAxis: a3 === "selection" ? 0 : E2, crossAxis: A2 }), shift({ padding: c2 }), a3 !== "selection" && flip({ padding: c2 }), a3 === "selection" && h4 ? inner({ ...h4, padding: c2, overflowRef: u2, offset: l2, minItemsVisible: D$3, referenceOverflowThreshold: c2, onFallbackChange(P2) {
    var L2, N2;
    if (!P2) return;
    let d2 = g2.elements.floating;
    if (!d2) return;
    let M2 = parseFloat(getComputedStyle(d2).scrollPaddingBottom) || 0, I2 = Math.min(D$3, d2.childElementCount), W2 = 0, B2 = 0;
    for (let m3 of (N2 = (L2 = g2.elements.floating) == null ? void 0 : L2.childNodes) != null ? N2 : []) if (n$4(m3)) {
      let x2 = m3.offsetTop, k2 = x2 + m3.clientHeight + M2, H2 = d2.scrollTop, U2 = H2 + d2.clientHeight;
      if (x2 >= H2 && k2 <= U2) I2--;
      else {
        B2 = Math.max(0, Math.min(k2, U2) - Math.max(x2, H2)), W2 = m3.clientHeight;
        break;
      }
    }
    I2 >= 1 && o4((m3) => {
      let x2 = W2 * I2 - B2 + M2;
      return m3 >= x2 ? m3 : x2;
    });
  } }) : null, size({ padding: c2, apply({ availableWidth: P2, availableHeight: d2, elements: M2 }) {
    Object.assign(M2.floating.style, { overflow: "auto", maxWidth: `${P2}px`, maxHeight: `min(var(--anchor-max-height, 100vh), ${d2}px)` });
  } })].filter(Boolean), whileElementsMounted: autoUpdate }), [w2 = a3, V2 = p2] = g2.placement.split("-");
  a3 === "selection" && (w2 = "selection");
  let G2 = window.wp.element.useMemo(() => ({ anchor: [w2, V2].filter(Boolean).join(" ") }), [w2, V2]), K2 = useInnerOffset(g2, { overflowRef: u2, onChange: o4 }), { getReferenceProps: Q2, getFloatingProps: X2 } = useInteractions([K2]), Y2 = o$6((P2) => {
    s2(P2), b2.setFloating(P2);
  });
  return window.wp.element.createElement($$1.Provider, { value: r2 }, window.wp.element.createElement(y$2.Provider, { value: { setFloating: Y2, setReference: b2.setReference, styles: S2, getReferenceProps: Q2, getFloatingProps: X2, slot: G2 } }, e2));
}
function ce$1(e2) {
  n$6(() => {
    if (!e2) return;
    let t2 = new MutationObserver(() => {
      let n2 = window.getComputedStyle(e2).maxHeight, r2 = parseFloat(n2);
      if (isNaN(r2)) return;
      let l2 = parseInt(n2);
      isNaN(l2) || r2 !== l2 && (e2.style.maxHeight = `${Math.ceil(r2)}px`);
    });
    return t2.observe(e2, { attributes: true, attributeFilter: ["style"] }), () => {
      t2.disconnect();
    };
  }, [e2]);
}
function ge$1(e2, t2) {
  var o4, u2, f2;
  let n2 = O$1((o4 = e2 == null ? void 0 : e2.gap) != null ? o4 : "var(--anchor-gap, 0)", t2), r2 = O$1((u2 = e2 == null ? void 0 : e2.offset) != null ? u2 : "var(--anchor-offset, 0)", t2), l2 = O$1((f2 = e2 == null ? void 0 : e2.padding) != null ? f2 : "var(--anchor-padding, 0)", t2);
  return { ...e2, gap: n2, offset: r2, padding: l2 };
}
function O$1(e2, t2, n2 = void 0) {
  let r2 = p$8(), l2 = o$6((s2, i2) => {
    if (s2 == null) return [n2, null];
    if (typeof s2 == "number") return [s2, null];
    if (typeof s2 == "string") {
      if (!i2) return [n2, null];
      let F2 = J$1(s2, i2);
      return [F2, (E2) => {
        let A2 = q(s2);
        {
          let c2 = A2.map((h4) => window.getComputedStyle(i2).getPropertyValue(h4));
          r2.requestAnimationFrame(function h4() {
            r2.nextFrame(h4);
            let a3 = false;
            for (let [b2, S2] of A2.entries()) {
              let g2 = window.getComputedStyle(i2).getPropertyValue(S2);
              if (c2[b2] !== g2) {
                c2[b2] = g2, a3 = true;
                break;
              }
            }
            if (!a3) return;
            let p2 = J$1(s2, i2);
            F2 !== p2 && (E2(p2), F2 = p2);
          });
        }
        return r2.dispose;
      }];
    }
    return [n2, null];
  }), o4 = window.wp.element.useMemo(() => l2(e2, t2)[0], [e2, t2]), [u2 = o4, f2] = window.wp.element.useState();
  return n$6(() => {
    let [s2, i2] = l2(e2, t2);
    if (f2(s2), !!i2) return i2(f2);
  }, [e2, t2]), u2;
}
function q(e2) {
  let t2 = /var\((.*)\)/.exec(e2);
  if (t2) {
    let n2 = t2[1].indexOf(",");
    if (n2 === -1) return [t2[1]];
    let r2 = t2[1].slice(0, n2).trim(), l2 = t2[1].slice(n2 + 1).trim();
    return l2 ? [r2, ...q(l2)] : [r2];
  }
  return [];
}
function J$1(e2, t2) {
  let n2 = document.createElement("div");
  t2.appendChild(n2), n2.style.setProperty("margin-top", "0px", "important"), n2.style.setProperty("margin-top", e2, "important");
  let r2 = parseFloat(window.getComputedStyle(n2).marginTop) || 0;
  return t2.removeChild(n2), r2;
}
function f$5({ children: t2, freeze: e2 }, o4) {
  let n2 = u$5(e2, t2);
  return window.wp.element.isValidElement(n2) ? window.wp.element.cloneElement(n2, { ref: o4 }) : window.wp.element.createElement(window.wp.element.Fragment, null, n2);
}
window.wp.element.forwardRef(f$5);
function u$5(t2, e2) {
  let [o4, n2] = window.wp.element.useState(e2);
  return !t2 && o4 !== e2 && n2(e2), t2 ? o4 : e2;
}
let n$1 = window.wp.element.createContext(null);
n$1.displayName = "OpenClosedContext";
var i = ((e2) => (e2[e2.Open = 1] = "Open", e2[e2.Closed = 2] = "Closed", e2[e2.Closing = 4] = "Closing", e2[e2.Opening = 8] = "Opening", e2))(i || {});
function u$4() {
  return window.wp.element.useContext(n$1);
}
function c$6({ value: o4, children: t2 }) {
  return window.wp.element.createElement(n$1.Provider, { value: o4 }, t2);
}
function s$3({ children: o4 }) {
  return window.wp.element.createElement(n$1.Provider, { value: null }, o4);
}
function t(n2) {
  function e2() {
    document.readyState !== "loading" && (n2(), document.removeEventListener("DOMContentLoaded", e2));
  }
  typeof window != "undefined" && typeof document != "undefined" && (document.addEventListener("DOMContentLoaded", e2), e2());
}
let n = [];
t(() => {
  function e2(t2) {
    if (!i$4(t2.target) || t2.target === document.body || n[0] === t2.target) return;
    let r2 = t2.target;
    r2 = r2.closest(E$3), n.unshift(r2 != null ? r2 : t2.target), n = n.filter((o4) => o4 != null && o4.isConnected), n.splice(10);
  }
  window.addEventListener("click", e2, { capture: true }), window.addEventListener("mousedown", e2, { capture: true }), window.addEventListener("focus", e2, { capture: true }), document.body.addEventListener("click", e2, { capture: true }), document.body.addEventListener("mousedown", e2, { capture: true }), document.body.addEventListener("focus", e2, { capture: true });
});
function u$3(l2) {
  throw new Error("Unexpected object: " + l2);
}
var c$5 = ((i2) => (i2[i2.First = 0] = "First", i2[i2.Previous = 1] = "Previous", i2[i2.Next = 2] = "Next", i2[i2.Last = 3] = "Last", i2[i2.Specific = 4] = "Specific", i2[i2.Nothing = 5] = "Nothing", i2))(c$5 || {});
function f$4(l2, n2) {
  let t2 = n2.resolveItems();
  if (t2.length <= 0) return null;
  let r2 = n2.resolveActiveIndex(), s2 = r2 != null ? r2 : -1;
  switch (l2.focus) {
    case 0: {
      for (let e2 = 0; e2 < t2.length; ++e2) if (!n2.resolveDisabled(t2[e2], e2, t2)) return e2;
      return r2;
    }
    case 1: {
      s2 === -1 && (s2 = t2.length);
      for (let e2 = s2 - 1; e2 >= 0; --e2) if (!n2.resolveDisabled(t2[e2], e2, t2)) return e2;
      return r2;
    }
    case 2: {
      for (let e2 = s2 + 1; e2 < t2.length; ++e2) if (!n2.resolveDisabled(t2[e2], e2, t2)) return e2;
      return r2;
    }
    case 3: {
      for (let e2 = t2.length - 1; e2 >= 0; --e2) if (!n2.resolveDisabled(t2[e2], e2, t2)) return e2;
      return r2;
    }
    case 4: {
      for (let e2 = 0; e2 < t2.length; ++e2) if (n2.resolveId(t2[e2], e2, t2) === l2.id) return e2;
      return r2;
    }
    case 5:
      return null;
    default:
      u$3(l2);
  }
}
function c$4(t2) {
  let r2 = o$6(t2), e2 = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => (e2.current = false, () => {
    e2.current = true, t$5(() => {
      e2.current && r2();
    });
  }), [r2]);
}
function s$2() {
  let r2 = typeof document == "undefined";
  return "useSyncExternalStore" in window.wp.element ? ((o4) => o4.useSyncExternalStore)(window.wp.element)(() => () => {
  }, () => false, () => !r2) : false;
}
function l$1() {
  let r2 = s$2(), [e2, n2] = window.wp.element.useState(s$b.isHandoffComplete);
  return e2 && s$b.isHandoffComplete === false && n2(false), window.wp.element.useEffect(() => {
    e2 !== true && n2(true);
  }, [e2]), window.wp.element.useEffect(() => s$b.handoff(), []), r2 ? false : e2;
}
let e = window.wp.element.createContext(false);
function a$6() {
  return window.wp.element.useContext(e);
}
function l(o4) {
  return window.wp.element.createElement(e.Provider, { value: o4.force }, o4.children);
}
function j$1(e2) {
  let o4 = a$6(), l2 = window.wp.element.useContext(c$3), [r2, p2] = window.wp.element.useState(() => {
    var s2;
    if (!o4 && l2 !== null) return (s2 = l2.current) != null ? s2 : null;
    if (s$b.isServer) return null;
    let t2 = e2 == null ? void 0 : e2.getElementById("headlessui-portal-root");
    if (t2) return t2;
    if (e2 === null) return null;
    let n2 = e2.createElement("div");
    return n2.setAttribute("id", "headlessui-portal-root"), e2.body.appendChild(n2);
  });
  return window.wp.element.useEffect(() => {
    r2 !== null && (e2 != null && e2.body.contains(r2) || e2 == null || e2.body.appendChild(r2));
  }, [r2, e2]), window.wp.element.useEffect(() => {
    o4 || l2 !== null && p2(l2.current);
  }, [l2, p2, o4]), r2;
}
let _$1 = window.wp.element.Fragment, I$1 = Y$1(function(o4, l2) {
  let { ownerDocument: r2 = null, ...p2 } = o4, t2 = window.wp.element.useRef(null), n2 = y$5(T$4((a3) => {
    t2.current = a3;
  }), l2), s2 = u$7(t2.current), C2 = r2 != null ? r2 : s2, u2 = j$1(C2), y2 = window.wp.element.useContext(m2), g2 = p$8(), v2 = l$1(), M2 = K$1();
  return c$4(() => {
    var a3;
    u2 && u2.childNodes.length <= 0 && ((a3 = u2.parentElement) == null || a3.removeChild(u2));
  }), !u2 || !v2 ? null : window.wp.element.createPortal(window.wp.element.createElement("div", { "data-headlessui-portal": "", ref: (a3) => {
    g2.dispose(), y2 && a3 && g2.add(y2.register(a3));
  } }, M2({ ourProps: { ref: n2 }, theirProps: p2, slot: {}, defaultTag: _$1, name: "Portal" })), u2);
});
function D$2(e2, o4) {
  let l2 = y$5(o4), { enabled: r2 = true, ownerDocument: p2, ...t2 } = e2, n2 = K$1();
  return r2 ? window.wp.element.createElement(I$1, { ...t2, ownerDocument: p2, ref: l2 }) : n2({ ourProps: { ref: l2 }, theirProps: t2, slot: {}, defaultTag: _$1, name: "Portal" });
}
let J = window.wp.element.Fragment, c$3 = window.wp.element.createContext(null);
function X$4(e2, o4) {
  let { target: l2, ...r2 } = e2, t2 = { ref: y$5(o4) }, n2 = K$1();
  return window.wp.element.createElement(c$3.Provider, { value: l2 }, n2({ ourProps: t2, theirProps: r2, defaultTag: J, name: "Popover.Group" }));
}
let m2 = window.wp.element.createContext(null);
function oe$3() {
  let e2 = window.wp.element.useContext(m2), o4 = window.wp.element.useRef([]), l2 = o$6((t2) => (o4.current.push(t2), e2 && e2.register(t2), () => r2(t2))), r2 = o$6((t2) => {
    let n2 = o4.current.indexOf(t2);
    n2 !== -1 && o4.current.splice(n2, 1), e2 && e2.unregister(t2);
  }), p2 = window.wp.element.useMemo(() => ({ register: l2, unregister: r2, portals: o4 }), [l2, r2, o4]);
  return [o4, window.wp.element.useMemo(() => function({ children: n2 }) {
    return window.wp.element.createElement(m2.Provider, { value: p2 }, n2);
  }, [p2])];
}
let k$2 = Y$1(D$2), B = Y$1(X$4), le = Object.assign(k$2, { Group: B });
const c$2 = { Idle: { kind: "Idle" }, Tracked: (e2) => ({ kind: "Tracked", position: e2 }), Moved: { kind: "Moved" } };
function a$5(e2) {
  let t2 = e2.getBoundingClientRect();
  return `${t2.x},${t2.y}`;
}
function p$3(e2, t2, i2) {
  let n2 = o$7();
  if (t2.kind === "Tracked") {
    let o4 = function() {
      d2 !== a$5(e2) && (n2.dispose(), i2());
    };
    let { position: d2 } = t2, s2 = new ResizeObserver(o4);
    s2.observe(e2), n2.add(() => s2.disconnect()), n2.addEventListener(window, "scroll", o4, { passive: true }), n2.addEventListener(window, "resize", o4);
  }
  return () => n2.dispose();
}
function a$4(o4, r2 = typeof document != "undefined" ? document.defaultView : null, t2) {
  let n2 = I$3(o4, "escape");
  E$2(r2, "keydown", (e2) => {
    n2 && (e2.defaultPrevented || e2.key === o$4.Escape && t2(e2));
  });
}
function f$3() {
  var t2;
  let [e2] = window.wp.element.useState(() => typeof window != "undefined" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [o4, c2] = window.wp.element.useState((t2 = e2 == null ? void 0 : e2.matches) != null ? t2 : false);
  return n$6(() => {
    if (!e2) return;
    function n2(r2) {
      c2(r2.matches);
    }
    return e2.addEventListener("change", n2), () => e2.removeEventListener("change", n2);
  }, [e2]), o4;
}
function S$1({ defaultContainers: l2 = [], portals: n2, mainTreeNode: o4 } = {}) {
  let c2 = o$6(() => {
    var r2, u2;
    let i2 = l$7(o4), t2 = [];
    for (let e2 of l2) e2 !== null && (t$3(e2) ? t2.push(e2) : "current" in e2 && t$3(e2.current) && t2.push(e2.current));
    if (n2 != null && n2.current) for (let e2 of n2.current) t2.push(e2);
    for (let e2 of (r2 = i2 == null ? void 0 : i2.querySelectorAll("html > *, body > *")) != null ? r2 : []) e2 !== document.body && e2 !== document.head && t$3(e2) && e2.id !== "headlessui-portal-root" && (o4 && (e2.contains(o4) || e2.contains((u2 = o4 == null ? void 0 : o4.getRootNode()) == null ? void 0 : u2.host)) || t2.some((E2) => e2.contains(E2)) || t2.push(e2));
    return t2;
  });
  return { resolveContainers: c2, contains: o$6((i2) => c2().some((t2) => t2.contains(i2))) };
}
let d$1 = window.wp.element.createContext(null);
function j({ children: l2, node: n2 }) {
  let [o4, c2] = window.wp.element.useState(null), i2 = x$3(n2 != null ? n2 : o4);
  return window.wp.element.createElement(d$1.Provider, { value: i2 }, l2, i2 === null && window.wp.element.createElement(f$d, { features: s$8.Hidden, ref: (t2) => {
    var r2, u2;
    if (t2) {
      for (let e2 of (u2 = (r2 = l$7(t2)) == null ? void 0 : r2.querySelectorAll("html > *, body > *")) != null ? u2 : []) if (e2 !== document.body && e2 !== document.head && t$3(e2) && e2 != null && e2.contains(t2)) {
        c2(e2);
        break;
      }
    }
  } }));
}
function x$3(l2 = null) {
  var n2;
  return (n2 = window.wp.element.useContext(d$1)) != null ? n2 : l2;
}
function f$2() {
  let e2 = window.wp.element.useRef(false);
  return n$6(() => (e2.current = true, () => {
    e2.current = false;
  }), []), e2;
}
var a$3 = ((r2) => (r2[r2.Forwards = 0] = "Forwards", r2[r2.Backwards = 1] = "Backwards", r2))(a$3 || {});
function u$2() {
  let e2 = window.wp.element.useRef(0);
  return s$4(true, "keydown", (r2) => {
    r2.key === "Tab" && (e2.current = r2.shiftKey ? 1 : 0);
  }, true), e2;
}
function x$2(o4) {
  if (!o4) return /* @__PURE__ */ new Set();
  if (typeof o4 == "function") return new Set(o4());
  let t2 = /* @__PURE__ */ new Set();
  for (let e2 of o4.current) t$3(e2.current) && t2.add(e2.current);
  return t2;
}
let $ = "div";
var G = ((n2) => (n2[n2.None = 0] = "None", n2[n2.InitialFocus = 1] = "InitialFocus", n2[n2.TabLock = 2] = "TabLock", n2[n2.FocusLock = 4] = "FocusLock", n2[n2.RestoreFocus = 8] = "RestoreFocus", n2[n2.AutoFocus = 16] = "AutoFocus", n2))(G || {});
function w$2(o4, t2) {
  let e2 = window.wp.element.useRef(null), r2 = y$5(e2, t2), { initialFocus: u2, initialFocusFallback: a3, containers: n2, features: s2 = 15, ...f2 } = o4;
  l$1() || (s2 = 0);
  let l2 = u$7(e2.current);
  re(s2, { ownerDocument: l2 });
  let T3 = ne(s2, { ownerDocument: l2, container: e2, initialFocus: u2, initialFocusFallback: a3 });
  oe$2(s2, { ownerDocument: l2, container: e2, containers: n2, previousActiveElement: T3 });
  let g2 = u$2(), A2 = o$6((c2) => {
    if (!n$4(e2.current)) return;
    let E2 = e2.current;
    ((V2) => V2())(() => {
      u$e(g2.current, { [a$3.Forwards]: () => {
        v$1(E2, T$2.First, { skipElements: [c2.relatedTarget, a3] });
      }, [a$3.Backwards]: () => {
        v$1(E2, T$2.Last, { skipElements: [c2.relatedTarget, a3] });
      } });
    });
  }), v2 = I$3(!!(s2 & 2), "focus-trap#tab-lock"), N2 = p$8(), b2 = window.wp.element.useRef(false), k2 = { ref: r2, onKeyDown(c2) {
    c2.key == "Tab" && (b2.current = true, N2.requestAnimationFrame(() => {
      b2.current = false;
    }));
  }, onBlur(c2) {
    if (!(s2 & 4)) return;
    let E2 = x$2(n2);
    n$4(e2.current) && E2.add(e2.current);
    let L2 = c2.relatedTarget;
    i$4(L2) && L2.dataset.headlessuiFocusGuard !== "true" && (I(E2, L2) || (b2.current ? v$1(e2.current, u$e(g2.current, { [a$3.Forwards]: () => T$2.Next, [a$3.Backwards]: () => T$2.Previous }) | T$2.WrapAround, { relativeTo: c2.target }) : i$4(c2.target) && w$4(c2.target)));
  } }, B2 = K$1();
  return window.wp.element.createElement(window.wp.element.Fragment, null, v2 && window.wp.element.createElement(f$d, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: A2, features: s$8.Focusable }), B2({ ourProps: k2, theirProps: f2, defaultTag: $, name: "FocusTrap" }), v2 && window.wp.element.createElement(f$d, { as: "button", type: "button", "data-headlessui-focus-guard": true, onFocus: A2, features: s$8.Focusable }));
}
let ee$1 = Y$1(w$2), ge = Object.assign(ee$1, { features: G });
function te(o4 = true) {
  let t2 = window.wp.element.useRef(n.slice());
  return m$1(([e2], [r2]) => {
    r2 === true && e2 === false && t$5(() => {
      t2.current.splice(0);
    }), r2 === false && e2 === true && (t2.current = n.slice());
  }, [o4, n, t2]), o$6(() => {
    var e2;
    return (e2 = t2.current.find((r2) => r2 != null && r2.isConnected)) != null ? e2 : null;
  });
}
function re(o4, { ownerDocument: t2 }) {
  let e2 = !!(o4 & 8), r2 = te(e2);
  m$1(() => {
    e2 || d$3(t2 == null ? void 0 : t2.body) && w$4(r2());
  }, [e2]), c$4(() => {
    e2 && w$4(r2());
  });
}
function ne(o4, { ownerDocument: t2, container: e2, initialFocus: r2, initialFocusFallback: u2 }) {
  let a3 = window.wp.element.useRef(null), n2 = I$3(!!(o4 & 1), "focus-trap#initial-focus"), s2 = f$2();
  return m$1(() => {
    if (o4 === 0) return;
    if (!n2) {
      u2 != null && u2.current && w$4(u2.current);
      return;
    }
    let f2 = e2.current;
    f2 && t$5(() => {
      if (!s2.current) return;
      let l2 = t2 == null ? void 0 : t2.activeElement;
      if (r2 != null && r2.current) {
        if ((r2 == null ? void 0 : r2.current) === l2) {
          a3.current = l2;
          return;
        }
      } else if (f2.contains(l2)) {
        a3.current = l2;
        return;
      }
      if (r2 != null && r2.current) w$4(r2.current);
      else {
        if (o4 & 16) {
          if (v$1(f2, T$2.First | T$2.AutoFocus) !== A$1.Error) return;
        } else if (v$1(f2, T$2.First) !== A$1.Error) return;
        if (u2 != null && u2.current && (w$4(u2.current), (t2 == null ? void 0 : t2.activeElement) === u2.current)) return;
        console.warn("There are no focusable elements inside the <FocusTrap />");
      }
      a3.current = t2 == null ? void 0 : t2.activeElement;
    });
  }, [u2, n2, o4]), a3;
}
function oe$2(o4, { ownerDocument: t2, container: e2, containers: r2, previousActiveElement: u2 }) {
  let a3 = f$2(), n2 = !!(o4 & 4);
  E$2(t2 == null ? void 0 : t2.defaultView, "focus", (s2) => {
    if (!n2 || !a3.current) return;
    let f2 = x$2(r2);
    n$4(e2.current) && f2.add(e2.current);
    let l2 = u2.current;
    if (!l2) return;
    let T3 = s2.target;
    n$4(T3) ? I(f2, T3) ? (u2.current = T3, w$4(T3)) : (s2.preventDefault(), s2.stopPropagation(), w$4(l2)) : w$4(u2.current);
  }, true);
}
function I(o4, t2) {
  for (let e2 of o4) if (e2.contains(t2)) return true;
  return false;
}
function ue$1(e2) {
  var t2;
  return !!(e2.enter || e2.enterFrom || e2.enterTo || e2.leave || e2.leaveFrom || e2.leaveTo) || !b$4((t2 = e2.as) != null ? t2 : de$1) || window.wp.element.Children.count(e2.children) === 1;
}
let V = window.wp.element.createContext(null);
V.displayName = "TransitionContext";
var De = ((n2) => (n2.Visible = "visible", n2.Hidden = "hidden", n2))(De || {});
function He$2() {
  let e2 = window.wp.element.useContext(V);
  if (e2 === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
  return e2;
}
function Ae$1() {
  let e2 = window.wp.element.useContext(w$1);
  if (e2 === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
  return e2;
}
let w$1 = window.wp.element.createContext(null);
w$1.displayName = "NestingContext";
function M$2(e2) {
  return "children" in e2 ? M$2(e2.children) : e2.current.filter(({ el: t2 }) => t2.current !== null).filter(({ state: t2 }) => t2 === "visible").length > 0;
}
function Te$1(e2, t2) {
  let n2 = s$a(e2), l2 = window.wp.element.useRef([]), S2 = f$2(), R2 = p$8(), d2 = o$6((o4, i2 = C$8.Hidden) => {
    let a3 = l2.current.findIndex(({ el: s2 }) => s2 === o4);
    a3 !== -1 && (u$e(i2, { [C$8.Unmount]() {
      l2.current.splice(a3, 1);
    }, [C$8.Hidden]() {
      l2.current[a3].state = "hidden";
    } }), R2.microTask(() => {
      var s2;
      !M$2(l2) && S2.current && ((s2 = n2.current) == null || s2.call(n2));
    }));
  }), y2 = o$6((o4) => {
    let i2 = l2.current.find(({ el: a3 }) => a3 === o4);
    return i2 ? i2.state !== "visible" && (i2.state = "visible") : l2.current.push({ el: o4, state: "visible" }), () => d2(o4, C$8.Unmount);
  }), C2 = window.wp.element.useRef([]), p2 = window.wp.element.useRef(Promise.resolve()), h4 = window.wp.element.useRef({ enter: [], leave: [] }), g2 = o$6((o4, i2, a3) => {
    C2.current.splice(0), t2 && (t2.chains.current[i2] = t2.chains.current[i2].filter(([s2]) => s2 !== o4)), t2 == null || t2.chains.current[i2].push([o4, new Promise((s2) => {
      C2.current.push(s2);
    })]), t2 == null || t2.chains.current[i2].push([o4, new Promise((s2) => {
      Promise.all(h4.current[i2].map(([r2, f2]) => f2)).then(() => s2());
    })]), i2 === "enter" ? p2.current = p2.current.then(() => t2 == null ? void 0 : t2.wait.current).then(() => a3(i2)) : a3(i2);
  }), v2 = o$6((o4, i2, a3) => {
    Promise.all(h4.current[i2].splice(0).map(([s2, r2]) => r2)).then(() => {
      var s2;
      (s2 = C2.current.shift()) == null || s2();
    }).then(() => a3(i2));
  });
  return window.wp.element.useMemo(() => ({ children: l2, register: y2, unregister: d2, onStart: g2, onStop: v2, wait: p2, chains: h4 }), [y2, d2, l2, g2, v2, h4, p2]);
}
let de$1 = window.wp.element.Fragment, fe = A$2.RenderStrategy;
function Fe$3(e2, t2) {
  var ee2, te2;
  let { transition: n2 = true, beforeEnter: l2, afterEnter: S2, beforeLeave: R2, afterLeave: d2, enter: y2, enterFrom: C2, enterTo: p2, entered: h4, leave: g2, leaveFrom: v2, leaveTo: o4, ...i$12 } = e2, [a3, s2] = window.wp.element.useState(null), r2 = window.wp.element.useRef(null), f2 = ue$1(e2), U2 = y$5(...f2 ? [r2, t2, s2] : t2 === null ? [] : [t2]), H2 = (ee2 = i$12.unmount) == null || ee2 ? C$8.Unmount : C$8.Hidden, { show: u2, appear: z2, initial: K2 } = He$2(), [m3, j2] = window.wp.element.useState(u2 ? "visible" : "hidden"), Q2 = Ae$1(), { register: A2, unregister: F2 } = Q2;
  n$6(() => A2(r2), [A2, r2]), n$6(() => {
    if (H2 === C$8.Hidden && r2.current) {
      if (u2 && m3 !== "visible") {
        j2("visible");
        return;
      }
      return u$e(m3, { ["hidden"]: () => F2(r2), ["visible"]: () => A2(r2) });
    }
  }, [m3, r2, A2, F2, u2, H2]);
  let G2 = l$1();
  n$6(() => {
    if (f2 && G2 && m3 === "visible" && r2.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
  }, [r2, m3, G2, f2]);
  let ce2 = K2 && !z2, Y2 = z2 && u2 && K2, B2 = window.wp.element.useRef(false), I2 = Te$1(() => {
    B2.current || (j2("hidden"), F2(r2));
  }, Q2), Z2 = o$6((W2) => {
    B2.current = true;
    let L2 = W2 ? "enter" : "leave";
    I2.onStart(r2, L2, (_2) => {
      _2 === "enter" ? l2 == null || l2() : _2 === "leave" && (R2 == null || R2());
    });
  }), $2 = o$6((W2) => {
    let L2 = W2 ? "enter" : "leave";
    B2.current = false, I2.onStop(r2, L2, (_2) => {
      _2 === "enter" ? S2 == null || S2() : _2 === "leave" && (d2 == null || d2());
    }), L2 === "leave" && !M$2(I2) && (j2("hidden"), F2(r2));
  });
  window.wp.element.useEffect(() => {
    f2 && n2 || (Z2(u2), $2(u2));
  }, [u2, f2, n2]);
  let pe2 = /* @__PURE__ */ (() => !(!n2 || !f2 || !G2 || ce2))(), [, T3] = N(pe2, a3, u2, { start: Z2, end: $2 }), Ce2 = m$4({ ref: U2, className: ((te2 = t$4(i$12.className, Y2 && y2, Y2 && C2, T3.enter && y2, T3.enter && T3.closed && C2, T3.enter && !T3.closed && p2, T3.leave && g2, T3.leave && !T3.closed && v2, T3.leave && T3.closed && o4, !T3.transition && u2 && h4)) == null ? void 0 : te2.trim()) || void 0, ...x$4(T3) }), N$12 = 0;
  m3 === "visible" && (N$12 |= i.Open), m3 === "hidden" && (N$12 |= i.Closed), u2 && m3 === "hidden" && (N$12 |= i.Opening), !u2 && m3 === "visible" && (N$12 |= i.Closing);
  let he2 = K$1();
  return window.wp.element.createElement(w$1.Provider, { value: I2 }, window.wp.element.createElement(c$6, { value: N$12 }, he2({ ourProps: Ce2, theirProps: i$12, defaultTag: de$1, features: fe, visible: m3 === "visible", name: "Transition.Child" })));
}
function Ie(e2, t2) {
  let { show: n2, appear: l2 = false, unmount: S2 = true, ...R2 } = e2, d2 = window.wp.element.useRef(null), y2 = ue$1(e2), C2 = y$5(...y2 ? [d2, t2] : t2 === null ? [] : [t2]);
  l$1();
  let p2 = u$4();
  if (n2 === void 0 && p2 !== null && (n2 = (p2 & i.Open) === i.Open), n2 === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
  let [h4, g2] = window.wp.element.useState(n2 ? "visible" : "hidden"), v2 = Te$1(() => {
    n2 || g2("hidden");
  }), [o4, i$12] = window.wp.element.useState(true), a3 = window.wp.element.useRef([n2]);
  n$6(() => {
    o4 !== false && a3.current[a3.current.length - 1] !== n2 && (a3.current.push(n2), i$12(false));
  }, [a3, n2]);
  let s2 = window.wp.element.useMemo(() => ({ show: n2, appear: l2, initial: o4 }), [n2, l2, o4]);
  n$6(() => {
    n2 ? g2("visible") : !M$2(v2) && d2.current !== null && g2("hidden");
  }, [n2, v2]);
  let r2 = { unmount: S2 }, f2 = o$6(() => {
    var u2;
    o4 && i$12(false), (u2 = e2.beforeEnter) == null || u2.call(e2);
  }), U2 = o$6(() => {
    var u2;
    o4 && i$12(false), (u2 = e2.beforeLeave) == null || u2.call(e2);
  }), H2 = K$1();
  return window.wp.element.createElement(w$1.Provider, { value: v2 }, window.wp.element.createElement(V.Provider, { value: s2 }, H2({ ourProps: { ...r2, as: window.wp.element.Fragment, children: window.wp.element.createElement(me, { ref: C2, ...r2, ...R2, beforeEnter: f2, beforeLeave: U2 }) }, theirProps: {}, defaultTag: window.wp.element.Fragment, features: fe, visible: h4 === "visible", name: "Transition" })));
}
function Le$1(e2, t2) {
  let n2 = window.wp.element.useContext(V) !== null, l2 = u$4() !== null;
  return window.wp.element.createElement(window.wp.element.Fragment, null, !n2 && l2 ? window.wp.element.createElement(X$3, { ref: t2, ...e2 }) : window.wp.element.createElement(me, { ref: t2, ...e2 }));
}
let X$3 = Y$1(Ie), me = Y$1(Fe$3), Oe$1 = Y$1(Le$1), Ke$2 = Object.assign(X$3, { Child: Oe$1, Root: X$3 });
var we$1 = ((o4) => (o4[o4.Open = 0] = "Open", o4[o4.Closed = 1] = "Closed", o4))(we$1 || {}), Be = ((t2) => (t2[t2.SetTitleId = 0] = "SetTitleId", t2))(Be || {});
let Ue = { [0](e2, t2) {
  return e2.titleId === t2.id ? e2 : { ...e2, titleId: t2.id };
} }, w = window.wp.element.createContext(null);
w.displayName = "DialogContext";
function O(e2) {
  let t2 = window.wp.element.useContext(w);
  if (t2 === null) {
    let o4 = new Error(`<${e2} /> is missing a parent <Dialog /> component.`);
    throw Error.captureStackTrace && Error.captureStackTrace(o4, O), o4;
  }
  return t2;
}
function He$1(e2, t2) {
  return u$e(t2.type, Ue, e2, t2);
}
let z = Y$1(function(t2, o4) {
  let a3 = _global_window_wp_element_useId(), { id: n2 = `headlessui-dialog-${a3}`, open: i$12, onClose: p2, initialFocus: d2, role: s2 = "dialog", autoFocus: f2 = true, __demoMode: u2 = false, unmount: y2 = false, ...S2 } = t2, R2 = window.wp.element.useRef(false);
  s2 = (function() {
    return s2 === "dialog" || s2 === "alertdialog" ? s2 : (R2.current || (R2.current = true, console.warn(`Invalid role [${s2}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
  })();
  let g2 = u$4();
  i$12 === void 0 && g2 !== null && (i$12 = (g2 & i.Open) === i.Open);
  let T3 = window.wp.element.useRef(null), I2 = y$5(T3, o4), F2 = u$7(T3.current), c2 = i$12 ? 0 : 1, [b2, Q2] = window.wp.element.useReducer(He$1, { titleId: null, descriptionId: null, panelRef: window.wp.element.createRef() }), m3 = o$6(() => p2(false)), B$12 = o$6((r2) => Q2({ type: 0, id: r2 })), D2 = l$1() ? c2 === 0 : false, [Z2, ee2] = oe$3(), te2 = { get current() {
    var r2;
    return (r2 = b2.panelRef.current) != null ? r2 : T3.current;
  } }, v2 = x$3(), { resolveContainers: M2 } = S$1({ mainTreeNode: v2, portals: Z2, defaultContainers: [te2] }), U2 = g2 !== null ? (g2 & i.Closing) === i.Closing : false;
  y$3(u2 || U2 ? false : D2, { allowed: o$6(() => {
    var r2, W2;
    return [(W2 = (r2 = T3.current) == null ? void 0 : r2.closest("[data-headlessui-portal]")) != null ? W2 : null];
  }), disallowed: o$6(() => {
    var r2;
    return [(r2 = v2 == null ? void 0 : v2.closest("body > *:not(#headlessui-portal-root)")) != null ? r2 : null];
  }) });
  let P2 = x$6.get(null);
  n$6(() => {
    if (D2) return P2.actions.push(n2), () => P2.actions.pop(n2);
  }, [P2, n2, D2]);
  let H2 = S$5(P2, window.wp.element.useCallback((r2) => P2.selectors.isTop(r2, n2), [P2, n2]));
  k$3(H2, M2, (r2) => {
    r2.preventDefault(), m3();
  }), a$4(H2, F2 == null ? void 0 : F2.defaultView, (r2) => {
    r2.preventDefault(), r2.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), m3();
  }), f$6(u2 || U2 ? false : D2, F2, M2), p$4(D2, T3, m3);
  let [oe2, ne2] = H$3(), re2 = window.wp.element.useMemo(() => [{ dialogState: c2, close: m3, setTitleId: B$12, unmount: y2 }, b2], [c2, m3, B$12, y2, b2]), N2 = n$5({ open: c2 === 0 }), le$12 = { ref: I2, id: n2, role: s2, tabIndex: -1, "aria-modal": u2 ? void 0 : c2 === 0 ? true : void 0, "aria-labelledby": b2.titleId, "aria-describedby": oe2, unmount: y2 }, ae = !f$3(), E2 = G.None;
  D2 && !u2 && (E2 |= G.RestoreFocus, E2 |= G.TabLock, f2 && (E2 |= G.AutoFocus), ae && (E2 |= G.InitialFocus));
  let ie2 = K$1();
  return window.wp.element.createElement(s$3, null, window.wp.element.createElement(l, { force: true }, window.wp.element.createElement(le, null, window.wp.element.createElement(w.Provider, { value: re2 }, window.wp.element.createElement(B, { target: T3 }, window.wp.element.createElement(l, { force: false }, window.wp.element.createElement(ne2, { slot: N2 }, window.wp.element.createElement(ee2, null, window.wp.element.createElement(ge, { initialFocus: d2, initialFocusFallback: T3, containers: M2, features: E2 }, window.wp.element.createElement(C$4, { value: m3 }, ie2({ ourProps: le$12, theirProps: S2, slot: N2, defaultTag: Ne$1, features: We$1, visible: c2 === 0, name: "Dialog" })))))))))));
}), Ne$1 = "div", We$1 = A$2.RenderStrategy | A$2.Static;
function $e$1(e2, t2) {
  let { transition: o4 = false, open: a3, ...n2 } = e2, i2 = u$4(), p2 = e2.hasOwnProperty("open") || i2 !== null, d2 = e2.hasOwnProperty("onClose");
  if (!p2 && !d2) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
  if (!p2) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
  if (!d2) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
  if (!i2 && typeof e2.open != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e2.open}`);
  if (typeof e2.onClose != "function") throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e2.onClose}`);
  return (a3 !== void 0 || o4) && !n2.static ? window.wp.element.createElement(j, null, window.wp.element.createElement(Ke$2, { show: a3, transition: o4, unmount: n2.unmount }, window.wp.element.createElement(z, { ref: t2, ...n2 }))) : window.wp.element.createElement(j, null, window.wp.element.createElement(z, { ref: t2, open: a3, ...n2 }));
}
let je = "div";
function Ye$1(e2, t2) {
  let o4 = _global_window_wp_element_useId(), { id: a3 = `headlessui-dialog-panel-${o4}`, transition: n2 = false, ...i2 } = e2, [{ dialogState: p2, unmount: d2 }, s2] = O("Dialog.Panel"), f2 = y$5(t2, s2.panelRef), u2 = n$5({ open: p2 === 0 }), y2 = o$6((I2) => {
    I2.stopPropagation();
  }), S2 = { ref: f2, id: a3, onClick: y2 }, R2 = n2 ? Oe$1 : window.wp.element.Fragment, g2 = n2 ? { unmount: d2 } : {}, T3 = K$1();
  return window.wp.element.createElement(R2, { ...g2 }, T3({ ourProps: S2, theirProps: i2, slot: u2, defaultTag: je, name: "Dialog.Panel" }));
}
let Je = "div";
function Ke$1(e2, t2) {
  let { transition: o4 = false, ...a3 } = e2, [{ dialogState: n2, unmount: i2 }] = O("Dialog.Backdrop"), p2 = n$5({ open: n2 === 0 }), d2 = { ref: t2, "aria-hidden": true }, s2 = o4 ? Oe$1 : window.wp.element.Fragment, f2 = o4 ? { unmount: i2 } : {}, u2 = K$1();
  return window.wp.element.createElement(s2, { ...f2 }, u2({ ourProps: d2, theirProps: a3, slot: p2, defaultTag: Je, name: "Dialog.Backdrop" }));
}
let Xe$1 = "h2";
function Ve(e2, t2) {
  let o4 = _global_window_wp_element_useId(), { id: a3 = `headlessui-dialog-title-${o4}`, ...n2 } = e2, [{ dialogState: i2, setTitleId: p2 }] = O("Dialog.Title"), d2 = y$5(t2);
  window.wp.element.useEffect(() => (p2(a3), () => p2(null)), [a3, p2]);
  let s2 = n$5({ open: i2 === 0 }), f2 = { ref: d2, id: a3 };
  return K$1()({ ourProps: f2, theirProps: n2, slot: s2, defaultTag: Xe$1, name: "Dialog.Title" });
}
let qe$1 = Y$1($e$1), ze = Y$1(Ye$1);
Y$1(Ke$1);
let Qe = Y$1(Ve), ht$3 = Object.assign(qe$1, { Panel: ze, Title: Qe, Description: M$5 });
let _ = "div";
function c$1(d2, l2) {
  let t2 = `headlessui-control-${_global_window_wp_element_useId()}`, [p2, n2] = V$1(), [s2, a3] = H$3(), m3 = a$f(), { disabled: r2 = m3 || false, ...o4 } = d2, i2 = n$5({ disabled: r2 }), f2 = { ref: l2, disabled: r2 || void 0, "aria-disabled": r2 || void 0 }, F2 = K$1();
  return window.wp.element.createElement(l$6, { value: r2 }, window.wp.element.createElement(n2, { value: p2 }, window.wp.element.createElement(a3, { value: s2 }, window.wp.element.createElement(f$b, { id: t2 }, F2({ ourProps: f2, theirProps: { ...o4, children: window.wp.element.createElement(W$1, null, typeof o4.children == "function" ? o4.children(i2) : o4.children) }, slot: i2, defaultTag: _, name: "Field" })))));
}
let W = Y$1(c$1);
let x$1 = "input";
function h$3(r2, p2) {
  let n2 = _global_window_wp_element_useId(), s2 = u$d(), a3 = a$f(), { id: l2 = s2 || `headlessui-input-${n2}`, disabled: e2 = a3 || false, autoFocus: o4 = false, invalid: t2 = false, ...i2 } = r2, d2 = N$1(), u2 = w$6(), { isFocused: f2, focusProps: m3 } = $0c4a58759813079a$export$4e328f61c538687f({ autoFocus: o4 }), { isHovered: T3, hoverProps: b2 } = $e969f22b6713ca4a$export$ae780daf29e6d456({ isDisabled: e2 }), y2 = V$2({ ref: p2, id: l2, "aria-labelledby": d2, "aria-describedby": u2, "aria-invalid": t2 ? "true" : void 0, disabled: e2 || void 0, autoFocus: o4 }, m3, b2), I2 = n$5({ disabled: e2, invalid: t2, hover: T3, focus: f2, autofocus: o4 });
  return K$1()({ ourProps: y2, theirProps: i2, slot: I2, defaultTag: x$1, name: "Input" });
}
let X$2 = Y$1(h$3);
let a$2 = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;
function o3(e2) {
  var l2, n2;
  let i2 = (l2 = e2.innerText) != null ? l2 : "", t2 = e2.cloneNode(true);
  if (!n$4(t2)) return i2;
  let u2 = false;
  for (let f2 of t2.querySelectorAll('[hidden],[aria-hidden],[role="img"]')) f2.remove(), u2 = true;
  let r2 = u2 ? (n2 = t2.innerText) != null ? n2 : "" : i2;
  return a$2.test(r2) && (r2 = r2.replace(a$2, "")), r2;
}
function F$1(e2) {
  let i2 = e2.getAttribute("aria-label");
  if (typeof i2 == "string") return i2.trim();
  let t2 = e2.getAttribute("aria-labelledby");
  if (t2) {
    let u2 = t2.split(" ").map((r2) => {
      let l2 = document.getElementById(r2);
      if (l2) {
        let n2 = l2.getAttribute("aria-label");
        return typeof n2 == "string" ? n2.trim() : o3(l2).trim();
      }
      return null;
    }).filter(Boolean);
    if (u2.length > 0) return u2.join(", ");
  }
  return o3(e2).trim();
}
function s$1(c2) {
  let t2 = window.wp.element.useRef(""), r2 = window.wp.element.useRef("");
  return o$6(() => {
    let e2 = c2.current;
    if (!e2) return "";
    let u2 = e2.innerText;
    if (t2.current === u2) return r2.current;
    let n2 = F$1(e2).trim().toLowerCase();
    return t2.current = u2, r2.current = n2, n2;
  });
}
var T2 = Object.defineProperty;
var y$1 = (e2, o4, t2) => o4 in e2 ? T2(e2, o4, { enumerable: true, configurable: true, writable: true, value: t2 }) : e2[o4] = t2;
var b$1 = (e2, o4, t2) => (y$1(e2, typeof o4 != "symbol" ? o4 + "" : o4, t2), t2);
var F = ((t2) => (t2[t2.Open = 0] = "Open", t2[t2.Closed = 1] = "Closed", t2))(F || {}), P$1 = ((t2) => (t2[t2.Single = 0] = "Single", t2[t2.Multi = 1] = "Multi", t2))(P$1 || {}), C$1 = ((t2) => (t2[t2.Pointer = 0] = "Pointer", t2[t2.Other = 1] = "Other", t2))(C$1 || {}), k$1 = ((r2) => (r2[r2.OpenListbox = 0] = "OpenListbox", r2[r2.CloseListbox = 1] = "CloseListbox", r2[r2.GoToOption = 2] = "GoToOption", r2[r2.Search = 3] = "Search", r2[r2.ClearSearch = 4] = "ClearSearch", r2[r2.SelectOption = 5] = "SelectOption", r2[r2.RegisterOptions = 6] = "RegisterOptions", r2[r2.UnregisterOptions = 7] = "UnregisterOptions", r2[r2.SetButtonElement = 8] = "SetButtonElement", r2[r2.SetOptionsElement = 9] = "SetOptionsElement", r2[r2.SortOptions = 10] = "SortOptions", r2[r2.MarkButtonAsMoved = 11] = "MarkButtonAsMoved", r2))(k$1 || {});
function g(e2, o4 = (t2) => t2) {
  let t2 = e2.activeOptionIndex !== null ? e2.options[e2.activeOptionIndex] : null, n2 = G$1(o4(e2.options.slice()), (s2) => s2.dataRef.current.domRef.current), i2 = t2 ? n2.indexOf(t2) : null;
  return i2 === -1 && (i2 = null), { options: n2, activeOptionIndex: i2 };
}
let D$1 = { [1](e2) {
  if (e2.dataRef.current.disabled || e2.listboxState === 1) return e2;
  let o4 = e2.buttonElement ? c$2.Tracked(a$5(e2.buttonElement)) : e2.buttonPositionState;
  return { ...e2, activeOptionIndex: null, pendingFocus: { focus: c$5.Nothing }, listboxState: 1, __demoMode: false, buttonPositionState: o4 };
}, [0](e2, o4) {
  if (e2.dataRef.current.disabled || e2.listboxState === 0) return e2;
  let t2 = e2.activeOptionIndex, { isSelected: n2 } = e2.dataRef.current, i2 = e2.options.findIndex((s2) => n2(s2.dataRef.current.value));
  return i2 !== -1 && (t2 = i2), { ...e2, frozenValue: false, pendingFocus: o4.focus, listboxState: 0, activeOptionIndex: t2, __demoMode: false, buttonPositionState: c$2.Idle };
}, [2](e2, o4) {
  var s2, l2, c2, p2, f2;
  if (e2.dataRef.current.disabled || e2.listboxState === 1) return e2;
  let t2 = { ...e2, searchQuery: "", activationTrigger: (s2 = o4.trigger) != null ? s2 : 1, __demoMode: false };
  if (o4.focus === c$5.Nothing) return { ...t2, activeOptionIndex: null };
  if (o4.focus === c$5.Specific) return { ...t2, activeOptionIndex: e2.options.findIndex((d2) => d2.id === o4.id) };
  if (o4.focus === c$5.Previous) {
    let d2 = e2.activeOptionIndex;
    if (d2 !== null) {
      let O2 = e2.options[d2].dataRef.current.domRef, r2 = f$4(o4, { resolveItems: () => e2.options, resolveActiveIndex: () => e2.activeOptionIndex, resolveId: (u2) => u2.id, resolveDisabled: (u2) => u2.dataRef.current.disabled });
      if (r2 !== null) {
        let u2 = e2.options[r2].dataRef.current.domRef;
        if (((l2 = O2.current) == null ? void 0 : l2.previousElementSibling) === u2.current || ((c2 = u2.current) == null ? void 0 : c2.previousElementSibling) === null) return { ...t2, activeOptionIndex: r2 };
      }
    }
  } else if (o4.focus === c$5.Next) {
    let d2 = e2.activeOptionIndex;
    if (d2 !== null) {
      let O2 = e2.options[d2].dataRef.current.domRef, r2 = f$4(o4, { resolveItems: () => e2.options, resolveActiveIndex: () => e2.activeOptionIndex, resolveId: (u2) => u2.id, resolveDisabled: (u2) => u2.dataRef.current.disabled });
      if (r2 !== null) {
        let u2 = e2.options[r2].dataRef.current.domRef;
        if (((p2 = O2.current) == null ? void 0 : p2.nextElementSibling) === u2.current || ((f2 = u2.current) == null ? void 0 : f2.nextElementSibling) === null) return { ...t2, activeOptionIndex: r2 };
      }
    }
  }
  let n2 = g(e2), i2 = f$4(o4, { resolveItems: () => n2.options, resolveActiveIndex: () => n2.activeOptionIndex, resolveId: (d2) => d2.id, resolveDisabled: (d2) => d2.dataRef.current.disabled });
  return { ...t2, ...n2, activeOptionIndex: i2 };
}, [3]: (e2, o4) => {
  if (e2.dataRef.current.disabled || e2.listboxState === 1) return e2;
  let n2 = e2.searchQuery !== "" ? 0 : 1, i2 = e2.searchQuery + o4.value.toLowerCase(), l2 = (e2.activeOptionIndex !== null ? e2.options.slice(e2.activeOptionIndex + n2).concat(e2.options.slice(0, e2.activeOptionIndex + n2)) : e2.options).find((p2) => {
    var f2;
    return !p2.dataRef.current.disabled && ((f2 = p2.dataRef.current.textValue) == null ? void 0 : f2.startsWith(i2));
  }), c2 = l2 ? e2.options.indexOf(l2) : -1;
  return c2 === -1 || c2 === e2.activeOptionIndex ? { ...e2, searchQuery: i2 } : { ...e2, searchQuery: i2, activeOptionIndex: c2, activationTrigger: 1 };
}, [4](e2) {
  return e2.dataRef.current.disabled || e2.listboxState === 1 || e2.searchQuery === "" ? e2 : { ...e2, searchQuery: "" };
}, [5](e2) {
  return e2.dataRef.current.mode === 0 ? { ...e2, frozenValue: true } : { ...e2 };
}, [6]: (e2, o4) => {
  let t2 = e2.options.concat(o4.options), n2 = e2.activeOptionIndex;
  if (e2.pendingFocus.focus !== c$5.Nothing && (n2 = f$4(e2.pendingFocus, { resolveItems: () => t2, resolveActiveIndex: () => e2.activeOptionIndex, resolveId: (i2) => i2.id, resolveDisabled: (i2) => i2.dataRef.current.disabled })), e2.activeOptionIndex === null) {
    let { isSelected: i2 } = e2.dataRef.current;
    if (i2) {
      let s2 = t2.findIndex((l2) => i2 == null ? void 0 : i2(l2.dataRef.current.value));
      s2 !== -1 && (n2 = s2);
    }
  }
  return { ...e2, options: t2, activeOptionIndex: n2, pendingFocus: { focus: c$5.Nothing }, pendingShouldSort: true };
}, [7]: (e2, o4) => {
  let t2 = e2.options, n2 = [], i2 = new Set(o4.options);
  for (let [s2, l2] of t2.entries()) if (i2.has(l2.id) && (n2.push(s2), i2.delete(l2.id), i2.size === 0)) break;
  if (n2.length > 0) {
    t2 = t2.slice();
    for (let s2 of n2.reverse()) t2.splice(s2, 1);
  }
  return { ...e2, options: t2, activationTrigger: 1 };
}, [8]: (e2, o4) => e2.buttonElement === o4.element ? e2 : { ...e2, buttonElement: o4.element }, [9]: (e2, o4) => e2.optionsElement === o4.element ? e2 : { ...e2, optionsElement: o4.element }, [10]: (e2) => e2.pendingShouldSort ? { ...e2, ...g(e2), pendingShouldSort: false } : e2, [11](e2) {
  return e2.buttonPositionState.kind !== "Tracked" ? e2 : { ...e2, buttonPositionState: c$2.Moved };
} };
let h$2 = class h extends T$3 {
  constructor(t2) {
    super(t2);
    b$1(this, "actions", { onChange: (t3) => {
      let { onChange: n2, compare: i2, mode: s2, value: l2 } = this.state.dataRef.current;
      return u$e(s2, { [0]: () => n2 == null ? void 0 : n2(t3), [1]: () => {
        let c2 = l2.slice(), p2 = c2.findIndex((f2) => i2(f2, t3));
        return p2 === -1 ? c2.push(t3) : c2.splice(p2, 1), n2 == null ? void 0 : n2(c2);
      } });
    }, registerOption: k$5(() => {
      let t3 = [], n2 = /* @__PURE__ */ new Set();
      return [(i2, s2) => {
        n2.has(s2) || (n2.add(s2), t3.push({ id: i2, dataRef: s2 }));
      }, () => (n2.clear(), this.send({ type: 6, options: t3.splice(0) }))];
    }), unregisterOption: k$5(() => {
      let t3 = [];
      return [(n2) => t3.push(n2), () => {
        this.send({ type: 7, options: t3.splice(0) });
      }];
    }), goToOption: k$5(() => {
      let t3 = null;
      return [(n2, i2) => {
        t3 = { type: 2, ...n2, trigger: i2 };
      }, () => t3 && this.send(t3)];
    }), closeListbox: () => {
      this.send({ type: 1 });
    }, openListbox: (t3) => {
      this.send({ type: 0, focus: t3 });
    }, selectActiveOption: () => {
      var t3;
      if (this.state.activeOptionIndex !== null) {
        let { dataRef: n2 } = this.state.options[this.state.activeOptionIndex];
        this.actions.selectOption(n2.current.value);
      } else this.state.dataRef.current.mode === 0 && (this.actions.closeListbox(), (t3 = this.state.buttonElement) == null || t3.focus({ preventScroll: true }));
    }, selectOption: (t3) => {
      this.send({ type: 5, value: t3 });
    }, search: (t3) => {
      this.send({ type: 3, value: t3 });
    }, clearSearch: () => {
      this.send({ type: 4 });
    }, setButtonElement: (t3) => {
      this.send({ type: 8, element: t3 });
    }, setOptionsElement: (t3) => {
      this.send({ type: 9, element: t3 });
    } });
    b$1(this, "selectors", { activeDescendantId(t3) {
      var s2;
      let n2 = t3.activeOptionIndex, i2 = t3.options;
      return n2 === null || (s2 = i2[n2]) == null ? void 0 : s2.id;
    }, isActive(t3, n2) {
      var l2;
      let i2 = t3.activeOptionIndex, s2 = t3.options;
      return i2 !== null ? ((l2 = s2[i2]) == null ? void 0 : l2.id) === n2 : false;
    }, hasFrozenValue(t3) {
      return t3.frozenValue;
    }, shouldScrollIntoView(t3, n2) {
      return t3.__demoMode || t3.listboxState !== 0 || t3.activationTrigger === 0 ? false : this.isActive(t3, n2);
    }, didButtonMove(t3) {
      return t3.buttonPositionState.kind === "Moved";
    } });
    this.on(6, () => {
      requestAnimationFrame(() => {
        this.send({ type: 10 });
      });
    });
    {
      let n2 = this.state.id, i2 = x$6.get(null);
      this.disposables.add(i2.on(k$4.Push, (s2) => {
        !i2.selectors.isTop(s2, n2) && this.state.listboxState === 0 && this.actions.closeListbox();
      })), this.on(0, () => i2.actions.push(n2)), this.on(1, () => i2.actions.pop(n2));
    }
    this.disposables.group((n2) => {
      this.on(1, (i2) => {
        i2.buttonElement && (n2.dispose(), n2.add(p$3(i2.buttonElement, i2.buttonPositionState, () => {
          this.send({ type: 11 });
        })));
      });
    }), this.on(5, (n2, i2) => {
      var s2;
      this.actions.onChange(i2.value), this.state.dataRef.current.mode === 0 && (this.actions.closeListbox(), (s2 = this.state.buttonElement) == null || s2.focus({ preventScroll: true }));
    });
  }
  static new({ id: t2, __demoMode: n2 = false }) {
    return new h({ id: t2, dataRef: { current: {} }, listboxState: n2 ? 0 : 1, options: [], searchQuery: "", activeOptionIndex: null, activationTrigger: 1, buttonElement: null, optionsElement: null, pendingShouldSort: false, pendingFocus: { focus: c$5.Nothing }, frozenValue: false, __demoMode: n2, buttonPositionState: c$2.Idle });
  }
  reduce(t2, n2) {
    return u$e(n2.type, D$1, t2, n2);
  }
};
const c = window.wp.element.createContext(null);
function p$2(o4) {
  let e2 = window.wp.element.useContext(c);
  if (e2 === null) {
    let t2 = new Error(`<${o4} /> is missing a parent <Listbox /> component.`);
    throw Error.captureStackTrace && Error.captureStackTrace(t2, u$1), t2;
  }
  return e2;
}
function u$1({ id: o4, __demoMode: e2 = false }) {
  let t2 = window.wp.element.useMemo(() => h$2.new({ id: o4, __demoMode: e2 }), []);
  return c$4(() => t2.dispose()), t2;
}
let oe$1 = window.wp.element.createContext(null);
oe$1.displayName = "ListboxDataContext";
function Q(b2) {
  let E2 = window.wp.element.useContext(oe$1);
  if (E2 === null) {
    let m3 = new Error(`<${b2} /> is missing a parent <Listbox /> component.`);
    throw Error.captureStackTrace && Error.captureStackTrace(m3, Q), m3;
  }
  return E2;
}
let Pt$2 = window.wp.element.Fragment;
function gt$3(b2, E2) {
  let m3 = _global_window_wp_element_useId(), u2 = a$f(), { value: s2, defaultValue: a3, form: _2, name: i$12, onChange: y2, by: o4, invalid: x2 = false, disabled: O2 = u2 || false, horizontal: l2 = false, multiple: t2 = false, __demoMode: p2 = false, ...S2 } = b2;
  const h4 = l2 ? "horizontal" : "vertical";
  let I2 = y$5(E2), R2 = l$5(a3), [c$12 = t2 ? [] : void 0, L2] = b$3(s2, y2, R2), f2 = u$1({ id: m3, __demoMode: p2 }), k2 = window.wp.element.useRef({ static: false, hold: false }), N2 = window.wp.element.useRef(/* @__PURE__ */ new Map()), C2 = u$a(o4), V2 = window.wp.element.useCallback((P2) => u$e(n2.mode, { [P$1.Multi]: () => c$12.some((W2) => C2(W2, P2)), [P$1.Single]: () => C2(c$12, P2) }), [c$12]), n2 = n$5({ value: c$12, disabled: O2, invalid: x2, mode: t2 ? P$1.Multi : P$1.Single, orientation: h4, onChange: L2, compare: C2, isSelected: V2, optionsPropsRef: k2, listRef: N2 });
  n$6(() => {
    f2.state.dataRef.current = n2;
  }, [n2]);
  let F$12 = S$5(f2, (P2) => P2.listboxState), U2 = x$6.get(null), H2 = S$5(U2, window.wp.element.useCallback((P2) => U2.selectors.isTop(P2, m3), [U2, m3])), [A2, $2] = S$5(f2, (P2) => [P2.buttonElement, P2.optionsElement]);
  k$3(H2, [A2, $2], (P2, W2) => {
    f2.send({ type: k$1.CloseListbox }), H$2(W2, I$2.Loose) || (P2.preventDefault(), A2 == null || A2.focus());
  });
  let r2 = n$5({ open: F$12 === F.Open, disabled: O2, invalid: x2, value: c$12 }), [M2, ne2] = V$1({ inherit: true }), re2 = { ref: I2 }, q2 = window.wp.element.useCallback(() => {
    if (R2 !== void 0) return L2 == null ? void 0 : L2(R2);
  }, [L2, R2]), le2 = K$1();
  return window.wp.element.createElement(ne2, { value: M2, props: { htmlFor: A2 == null ? void 0 : A2.id }, slot: { open: F$12 === F.Open, disabled: O2 } }, window.wp.element.createElement(Ae$2, null, window.wp.element.createElement(c.Provider, { value: f2 }, window.wp.element.createElement(oe$1.Provider, { value: n2 }, window.wp.element.createElement(c$6, { value: u$e(F$12, { [F.Open]: i.Open, [F.Closed]: i.Closed }) }, i$12 != null && c$12 != null && window.wp.element.createElement(j$5, { disabled: O2, data: { [i$12]: c$12 }, form: _2, onReset: q2 }), le2({ ourProps: re2, theirProps: S2, slot: r2, defaultTag: Pt$2, name: "Listbox" }))))));
}
let vt$2 = "button";
function Et$3(b2, E2) {
  let m3 = _global_window_wp_element_useId(), u2 = u$d(), s2 = Q("Listbox.Button"), a3 = p$2("Listbox.Button"), { id: _2 = u2 || `headlessui-listbox-button-${m3}`, disabled: i2 = s2.disabled || false, autoFocus: y2 = false, ...o4 } = b2, x2 = y$5(E2, Fe$4(), a3.actions.setButtonElement), O2 = be(), [l2, t2, p2] = S$5(a3, (r2) => [r2.listboxState, r2.buttonElement, r2.optionsElement]), S2 = l2 === F.Open;
  L$1(S2, { trigger: t2, action: window.wp.element.useCallback((r2) => {
    if (t2 != null && t2.contains(r2.target)) return S$3.Ignore;
    let M2 = r2.target.closest('[role="option"]:not([data-disabled])');
    return n$4(M2) ? S$3.Select(M2) : p2 != null && p2.contains(r2.target) ? S$3.Ignore : S$3.Close;
  }, [t2, p2]), close: a3.actions.closeListbox, select: a3.actions.selectActiveOption });
  let h4 = o$6((r2) => {
    switch (r2.key) {
      case o$4.Enter:
        g$3(r2.currentTarget);
        break;
      case o$4.Space:
      case o$4.ArrowDown:
        r2.preventDefault(), a3.actions.openListbox({ focus: s2.value ? c$5.Nothing : c$5.First });
        break;
      case o$4.ArrowUp:
        r2.preventDefault(), a3.actions.openListbox({ focus: s2.value ? c$5.Nothing : c$5.Last });
        break;
    }
  }), I2 = o$6((r2) => {
    switch (r2.key) {
      case o$4.Space:
        r2.preventDefault();
        break;
    }
  }), R2 = s$6((r2) => {
    var M2;
    a3.state.listboxState === F.Open ? (window.wp.element.flushSync(() => a3.actions.closeListbox()), (M2 = a3.state.buttonElement) == null || M2.focus({ preventScroll: true })) : (r2.preventDefault(), a3.actions.openListbox({ focus: c$5.Nothing }));
  }), c2 = o$6((r2) => r2.preventDefault()), L2 = N$1([_2]), f2 = w$6(), { isFocusVisible: k2, focusProps: N2 } = $0c4a58759813079a$export$4e328f61c538687f({ autoFocus: y2 }), { isHovered: C2, hoverProps: V2 } = $e969f22b6713ca4a$export$ae780daf29e6d456({ isDisabled: i2 }), { pressed: n2, pressProps: F$12 } = w$7({ disabled: i2 }), U2 = n$5({ open: l2 === F.Open, active: n2 || l2 === F.Open, disabled: i2, invalid: s2.invalid, value: s2.value, hover: C2, focus: k2, autofocus: y2 }), H2 = S$5(a3, (r2) => r2.listboxState === F.Open), A2 = V$2(O2(), { ref: x2, id: _2, type: e$1(b2, t2), "aria-haspopup": "listbox", "aria-controls": p2 == null ? void 0 : p2.id, "aria-expanded": H2, "aria-labelledby": L2, "aria-describedby": f2, disabled: i2 || void 0, autoFocus: y2, onKeyDown: h4, onKeyUp: I2, onKeyPress: c2 }, R2, N2, V2, F$12);
  return K$1()({ ourProps: A2, theirProps: o4, slot: U2, defaultTag: vt$2, name: "Listbox.Button" });
}
let Oe = window.wp.element.createContext(false), ht$2 = "div", At$2 = A$2.RenderStrategy | A$2.Static;
function _t$2(b2, E2) {
  let m3 = _global_window_wp_element_useId(), { id: u2 = `headlessui-listbox-options-${m3}`, anchor: s2, portal: a3 = false, modal: _2 = true, transition: i$12 = false, ...y2 } = b2, o4 = ye(s2), [x2, O2] = window.wp.element.useState(null);
  o4 && (a3 = true);
  let l2 = Q("Listbox.Options"), t2 = p$2("Listbox.Options"), [p2, S2, h4, I2] = S$5(t2, (e2) => [e2.listboxState, e2.buttonElement, e2.optionsElement, e2.__demoMode]), R$1 = u$7(S2), c2 = u$7(h4), L2 = u$4(), [f2, k2] = N(i$12, x2, L2 !== null ? (L2 & i.Open) === i.Open : p2 === F.Open);
  p$4(f2, S2, t2.actions.closeListbox);
  let N$12 = I2 ? false : _2 && p2 === F.Open;
  f$6(N$12, c2);
  let C2 = I2 ? false : _2 && p2 === F.Open;
  y$3(C2, { allowed: window.wp.element.useCallback(() => [S2, h4], [S2, h4]) });
  let n2 = S$5(t2, t2.selectors.didButtonMove) ? false : f2, F$12 = S$5(t2, t2.selectors.hasFrozenValue) && !b2.static, U2 = u$5(F$12, l2.value), H2 = window.wp.element.useCallback((e2) => l2.compare(U2, e2), [l2.compare, U2]), A2 = S$5(t2, (e2) => {
    var de2;
    if (o4 == null || !((de2 = o4 == null ? void 0 : o4.to) != null && de2.includes("selection"))) return null;
    let w2 = e2.options.findIndex((ve2) => H2(ve2.dataRef.current.value));
    return w2 === -1 && (w2 = 0), w2;
  }), $2 = (() => {
    if (o4 == null) return;
    if (A2 === null) return { ...o4, inner: void 0 };
    let e2 = Array.from(l2.listRef.current.values());
    return { ...o4, inner: { listRef: { current: e2 }, index: A2 } };
  })(), [r2, M2] = Re$1($2), ne2 = Te$2(), re2 = y$5(E2, o4 ? r2 : null, t2.actions.setOptionsElement, O2), q2 = p$8();
  window.wp.element.useEffect(() => {
    let e2 = h4;
    e2 && p2 === F.Open && (d$3(e2) || e2 == null || e2.focus({ preventScroll: true }));
  }, [p2, h4]);
  let le$12 = o$6((e2) => {
    var w2;
    switch (q2.dispose(), e2.key) {
      case o$4.Space:
        if (t2.state.searchQuery !== "") return e2.preventDefault(), e2.stopPropagation(), t2.actions.search(e2.key);
      case o$4.Enter:
        e2.preventDefault(), e2.stopPropagation(), t2.actions.selectActiveOption();
        break;
      case u$e(l2.orientation, { vertical: o$4.ArrowDown, horizontal: o$4.ArrowRight }):
        return e2.preventDefault(), e2.stopPropagation(), t2.actions.goToOption({ focus: c$5.Next });
      case u$e(l2.orientation, { vertical: o$4.ArrowUp, horizontal: o$4.ArrowLeft }):
        return e2.preventDefault(), e2.stopPropagation(), t2.actions.goToOption({ focus: c$5.Previous });
      case o$4.Home:
      case o$4.PageUp:
        return e2.preventDefault(), e2.stopPropagation(), t2.actions.goToOption({ focus: c$5.First });
      case o$4.End:
      case o$4.PageDown:
        return e2.preventDefault(), e2.stopPropagation(), t2.actions.goToOption({ focus: c$5.Last });
      case o$4.Escape:
        e2.preventDefault(), e2.stopPropagation(), window.wp.element.flushSync(() => t2.actions.closeListbox()), (w2 = t2.state.buttonElement) == null || w2.focus({ preventScroll: true });
        return;
      case o$4.Tab:
        e2.preventDefault(), e2.stopPropagation(), window.wp.element.flushSync(() => t2.actions.closeListbox()), R(t2.state.buttonElement, e2.shiftKey ? T$2.Previous : T$2.Next);
        break;
      default:
        e2.key.length === 1 && (t2.actions.search(e2.key), q2.setTimeout(() => t2.actions.clearSearch(), 350));
        break;
    }
  }), P2 = S$5(t2, (e2) => {
    var w2;
    return (w2 = e2.buttonElement) == null ? void 0 : w2.id;
  }), W2 = n$5({ open: p2 === F.Open }), Le2 = V$2(o4 ? ne2() : {}, { id: u2, ref: re2, "aria-activedescendant": S$5(t2, t2.selectors.activeDescendantId), "aria-multiselectable": l2.mode === P$1.Multi ? true : void 0, "aria-labelledby": P2, "aria-orientation": l2.orientation, onKeyDown: le$12, role: "listbox", tabIndex: p2 === F.Open ? 0 : void 0, style: { ...y2.style, ...M2, "--button-width": w$5(f2, S2, true).width }, ...x$4(k2) }), Pe2 = K$1(), ge2 = window.wp.element.useMemo(() => l2.mode === P$1.Multi ? l2 : { ...l2, isSelected: H2 }, [l2, H2]);
  return window.wp.element.createElement(le, { enabled: a3 ? b2.static || f2 : false, ownerDocument: R$1 }, window.wp.element.createElement(oe$1.Provider, { value: ge2 }, Pe2({ ourProps: Le2, theirProps: y2, slot: W2, defaultTag: ht$2, features: At$2, visible: n2, name: "Listbox.Options" })));
}
let St$1 = "div";
function Dt$2(b2, E2) {
  let m3 = _global_window_wp_element_useId(), { id: u2 = `headlessui-listbox-option-${m3}`, disabled: s2 = false, value: a3, ..._2 } = b2, i2 = window.wp.element.useContext(Oe) === true, y2 = Q("Listbox.Option"), o4 = p$2("Listbox.Option"), x2 = S$5(o4, (n2) => o4.selectors.isActive(n2, u2)), O2 = y2.isSelected(a3), l2 = window.wp.element.useRef(null), t2 = s$1(l2), p2 = s$a({ disabled: s2, value: a3, domRef: l2, get textValue() {
    return t2();
  } }), S2 = y$5(E2, l2, (n2) => {
    n2 ? y2.listRef.current.set(u2, n2) : y2.listRef.current.delete(u2);
  }), h4 = S$5(o4, (n2) => o4.selectors.shouldScrollIntoView(n2, u2));
  n$6(() => {
    if (h4) return o$7().requestAnimationFrame(() => {
      var n2, F2;
      (F2 = (n2 = l2.current) == null ? void 0 : n2.scrollIntoView) == null || F2.call(n2, { block: "nearest" });
    });
  }, [h4, l2]), n$6(() => {
    if (!i2) return o4.actions.registerOption(u2, p2), () => o4.actions.unregisterOption(u2);
  }, [p2, u2, i2]);
  let I2 = o$6((n2) => {
    if (s2) return n2.preventDefault();
    o4.actions.selectOption(a3);
  }), R2 = o$6(() => {
    if (s2) return o4.actions.goToOption({ focus: c$5.Nothing });
    o4.actions.goToOption({ focus: c$5.Specific, id: u2 });
  }), c2 = u$6(), L2 = o$6((n2) => c2.update(n2)), f2 = o$6((n2) => {
    c2.wasMoved(n2) && (s2 || x2 && o4.state.activationTrigger === C$1.Pointer || o4.actions.goToOption({ focus: c$5.Specific, id: u2 }, C$1.Pointer));
  }), k2 = o$6((n2) => {
    c2.wasMoved(n2) && (s2 || x2 && o4.state.activationTrigger === C$1.Pointer && o4.actions.goToOption({ focus: c$5.Nothing }));
  }), N2 = n$5({ active: x2, focus: x2, selected: O2, disabled: s2, selectedOption: O2 && i2 }), C2 = i2 ? {} : { id: u2, ref: S2, role: "option", tabIndex: s2 === true ? void 0 : -1, "aria-disabled": s2 === true ? true : void 0, "aria-selected": O2, disabled: void 0, onClick: I2, onFocus: R2, onPointerEnter: L2, onMouseEnter: L2, onPointerMove: f2, onMouseMove: f2, onPointerLeave: k2, onMouseLeave: k2 }, V2 = K$1();
  return !O2 && i2 ? null : V2({ ourProps: C2, theirProps: _2, slot: N2, defaultTag: St$1, name: "Listbox.Option" });
}
let Rt$2 = window.wp.element.Fragment;
function Ft$2(b2, E2) {
  let { options: m3, placeholder: u2, ...s2 } = b2, _2 = { ref: y$5(E2) }, i2 = Q("ListboxSelectedOption"), y2 = n$5({}), o4 = i2.value === void 0 || i2.value === null || i2.mode === P$1.Multi && Array.isArray(i2.value) && i2.value.length === 0, x2 = K$1();
  return window.wp.element.createElement(Oe.Provider, { value: true }, x2({ ourProps: _2, theirProps: { ...s2, children: window.wp.element.createElement(window.wp.element.Fragment, null, u2 && o4 ? u2 : m3) }, slot: y2, defaultTag: Rt$2, name: "ListboxSelectedOption" }));
}
let Ct$2 = Y$1(gt$3), Mt$2 = Y$1(Et$3), wt$1 = Z, Bt$2 = Y$1(_t$2), It$1 = Y$1(Dt$2), kt$1 = Y$1(Ft$2), Mo = Object.assign(Ct$2, { Button: Mt$2, Label: wt$1, Options: Bt$2, Option: It$1, SelectedOption: kt$1 });
var y = Object.defineProperty;
var M$1 = (e2, i2, t2) => i2 in e2 ? y(e2, i2, { enumerable: true, configurable: true, writable: true, value: t2 }) : e2[i2] = t2;
var S = (e2, i2, t2) => (M$1(e2, typeof i2 != "symbol" ? i2 + "" : i2, t2), t2);
var P = ((t2) => (t2[t2.Open = 0] = "Open", t2[t2.Closed = 1] = "Closed", t2))(P || {}), D = ((t2) => (t2[t2.Pointer = 0] = "Pointer", t2[t2.Other = 1] = "Other", t2))(D || {}), C = ((o4) => (o4[o4.OpenMenu = 0] = "OpenMenu", o4[o4.CloseMenu = 1] = "CloseMenu", o4[o4.GoToItem = 2] = "GoToItem", o4[o4.Search = 3] = "Search", o4[o4.ClearSearch = 4] = "ClearSearch", o4[o4.RegisterItems = 5] = "RegisterItems", o4[o4.UnregisterItems = 6] = "UnregisterItems", o4[o4.SetButtonElement = 7] = "SetButtonElement", o4[o4.SetItemsElement = 8] = "SetItemsElement", o4[o4.SortItems = 9] = "SortItems", o4[o4.MarkButtonAsMoved = 10] = "MarkButtonAsMoved", o4))(C || {});
function x(e2, i2 = (t2) => t2) {
  let t2 = e2.activeItemIndex !== null ? e2.items[e2.activeItemIndex] : null, n2 = G$1(i2(e2.items.slice()), (s2) => s2.dataRef.current.domRef.current), r2 = t2 ? n2.indexOf(t2) : null;
  return r2 === -1 && (r2 = null), { items: n2, activeItemIndex: r2 };
}
let k = { [1](e2) {
  if (e2.menuState === 1) return e2;
  let i2 = e2.buttonElement ? c$2.Tracked(a$5(e2.buttonElement)) : e2.buttonPositionState;
  return { ...e2, activeItemIndex: null, pendingFocus: { focus: c$5.Nothing }, menuState: 1, buttonPositionState: i2 };
}, [0](e2, i2) {
  return e2.menuState === 0 ? e2 : { ...e2, __demoMode: false, pendingFocus: i2.focus, menuState: 0, buttonPositionState: c$2.Idle };
}, [2]: (e2, i2) => {
  var s2, l2, a3, I2, f2;
  if (e2.menuState === 1) return e2;
  let t2 = { ...e2, searchQuery: "", activationTrigger: (s2 = i2.trigger) != null ? s2 : 1, __demoMode: false };
  if (i2.focus === c$5.Nothing) return { ...t2, activeItemIndex: null };
  if (i2.focus === c$5.Specific) return { ...t2, activeItemIndex: e2.items.findIndex((d2) => d2.id === i2.id) };
  if (i2.focus === c$5.Previous) {
    let d2 = e2.activeItemIndex;
    if (d2 !== null) {
      let o4 = e2.items[d2].dataRef.current.domRef, c2 = f$4(i2, { resolveItems: () => e2.items, resolveActiveIndex: () => e2.activeItemIndex, resolveId: (u2) => u2.id, resolveDisabled: (u2) => u2.dataRef.current.disabled });
      if (c2 !== null) {
        let u2 = e2.items[c2].dataRef.current.domRef;
        if (((l2 = o4.current) == null ? void 0 : l2.previousElementSibling) === u2.current || ((a3 = u2.current) == null ? void 0 : a3.previousElementSibling) === null) return { ...t2, activeItemIndex: c2 };
      }
    }
  } else if (i2.focus === c$5.Next) {
    let d2 = e2.activeItemIndex;
    if (d2 !== null) {
      let o4 = e2.items[d2].dataRef.current.domRef, c2 = f$4(i2, { resolveItems: () => e2.items, resolveActiveIndex: () => e2.activeItemIndex, resolveId: (u2) => u2.id, resolveDisabled: (u2) => u2.dataRef.current.disabled });
      if (c2 !== null) {
        let u2 = e2.items[c2].dataRef.current.domRef;
        if (((I2 = o4.current) == null ? void 0 : I2.nextElementSibling) === u2.current || ((f2 = u2.current) == null ? void 0 : f2.nextElementSibling) === null) return { ...t2, activeItemIndex: c2 };
      }
    }
  }
  let n2 = x(e2), r2 = f$4(i2, { resolveItems: () => n2.items, resolveActiveIndex: () => n2.activeItemIndex, resolveId: (d2) => d2.id, resolveDisabled: (d2) => d2.dataRef.current.disabled });
  return { ...t2, ...n2, activeItemIndex: r2 };
}, [3]: (e2, i2) => {
  let n2 = e2.searchQuery !== "" ? 0 : 1, r2 = e2.searchQuery + i2.value.toLowerCase(), l2 = (e2.activeItemIndex !== null ? e2.items.slice(e2.activeItemIndex + n2).concat(e2.items.slice(0, e2.activeItemIndex + n2)) : e2.items).find((I2) => {
    var f2;
    return ((f2 = I2.dataRef.current.textValue) == null ? void 0 : f2.startsWith(r2)) && !I2.dataRef.current.disabled;
  }), a3 = l2 ? e2.items.indexOf(l2) : -1;
  return a3 === -1 || a3 === e2.activeItemIndex ? { ...e2, searchQuery: r2 } : { ...e2, searchQuery: r2, activeItemIndex: a3, activationTrigger: 1 };
}, [4](e2) {
  return e2.searchQuery === "" ? e2 : { ...e2, searchQuery: "", searchActiveItemIndex: null };
}, [5]: (e2, i2) => {
  let t2 = e2.items.concat(i2.items.map((r2) => r2)), n2 = e2.activeItemIndex;
  return e2.pendingFocus.focus !== c$5.Nothing && (n2 = f$4(e2.pendingFocus, { resolveItems: () => t2, resolveActiveIndex: () => e2.activeItemIndex, resolveId: (r2) => r2.id, resolveDisabled: (r2) => r2.dataRef.current.disabled })), { ...e2, items: t2, activeItemIndex: n2, pendingFocus: { focus: c$5.Nothing }, pendingShouldSort: true };
}, [6]: (e2, i2) => {
  let t2 = e2.items, n2 = [], r2 = new Set(i2.items);
  for (let [s2, l2] of t2.entries()) if (r2.has(l2.id) && (n2.push(s2), r2.delete(l2.id), r2.size === 0)) break;
  if (n2.length > 0) {
    t2 = t2.slice();
    for (let s2 of n2.reverse()) t2.splice(s2, 1);
  }
  return { ...e2, items: t2, activationTrigger: 1 };
}, [7]: (e2, i2) => e2.buttonElement === i2.element ? e2 : { ...e2, buttonElement: i2.element }, [8]: (e2, i2) => e2.itemsElement === i2.element ? e2 : { ...e2, itemsElement: i2.element }, [9]: (e2) => e2.pendingShouldSort ? { ...e2, ...x(e2), pendingShouldSort: false } : e2, [10](e2) {
  return e2.buttonPositionState.kind !== "Tracked" ? e2 : { ...e2, buttonPositionState: c$2.Moved };
} };
let h$1 = class h2 extends T$3 {
  constructor(t2) {
    super(t2);
    S(this, "actions", { registerItem: k$5(() => {
      let t3 = [], n2 = /* @__PURE__ */ new Set();
      return [(r2, s2) => {
        n2.has(s2) || (n2.add(s2), t3.push({ id: r2, dataRef: s2 }));
      }, () => (n2.clear(), this.send({ type: 5, items: t3.splice(0) }))];
    }), unregisterItem: k$5(() => {
      let t3 = [];
      return [(n2) => t3.push(n2), () => this.send({ type: 6, items: t3.splice(0) })];
    }) });
    S(this, "selectors", { activeDescendantId(t3) {
      var s2;
      let n2 = t3.activeItemIndex, r2 = t3.items;
      return n2 === null || (s2 = r2[n2]) == null ? void 0 : s2.id;
    }, isActive(t3, n2) {
      var l2;
      let r2 = t3.activeItemIndex, s2 = t3.items;
      return r2 !== null ? ((l2 = s2[r2]) == null ? void 0 : l2.id) === n2 : false;
    }, shouldScrollIntoView(t3, n2) {
      return t3.__demoMode || t3.menuState !== 0 || t3.activationTrigger === 0 ? false : this.isActive(t3, n2);
    }, didButtonMove(t3) {
      return t3.buttonPositionState.kind === "Moved";
    } });
    this.on(5, () => {
      this.disposables.requestAnimationFrame(() => {
        this.send({ type: 9 });
      });
    });
    {
      let n2 = this.state.id, r2 = x$6.get(null);
      this.disposables.add(r2.on(k$4.Push, (s2) => {
        !r2.selectors.isTop(s2, n2) && this.state.menuState === 0 && this.send({ type: 1 });
      })), this.on(0, () => r2.actions.push(n2)), this.on(1, () => r2.actions.pop(n2));
    }
    this.disposables.group((n2) => {
      this.on(1, (r2) => {
        r2.buttonElement && (n2.dispose(), n2.add(p$3(r2.buttonElement, r2.buttonPositionState, () => {
          this.send({ type: 10 });
        })));
      });
    });
  }
  static new({ id: t2, __demoMode: n2 = false }) {
    return new h2({ id: t2, __demoMode: n2, menuState: n2 ? 0 : 1, buttonElement: null, itemsElement: null, items: [], searchQuery: "", activeItemIndex: null, activationTrigger: 1, pendingShouldSort: false, pendingFocus: { focus: c$5.Nothing }, buttonPositionState: c$2.Idle });
  }
  reduce(t2, n2) {
    return u$e(n2.type, k, t2, n2);
  }
};
const a$1 = window.wp.element.createContext(null);
function p$1(t2) {
  let n2 = window.wp.element.useContext(a$1);
  if (n2 === null) {
    let e2 = new Error(`<${t2} /> is missing a parent <Menu /> component.`);
    throw Error.captureStackTrace && Error.captureStackTrace(e2, s), e2;
  }
  return n2;
}
function s({ id: t2, __demoMode: n2 = false }) {
  let e2 = window.wp.element.useMemo(() => h$1.new({ id: t2, __demoMode: n2 }), []);
  return c$4(() => e2.dispose()), e2;
}
let Ze$1 = window.wp.element.Fragment;
function et(m3, y2) {
  let l2 = _global_window_wp_element_useId(), { __demoMode: a3 = false, ...p2 } = m3, s$12 = s({ id: l2, __demoMode: a3 }), [n2, M2, f2] = S$5(s$12, (d2) => [d2.menuState, d2.itemsElement, d2.buttonElement]), _2 = y$5(y2), o4 = x$6.get(null), F2 = S$5(o4, window.wp.element.useCallback((d2) => o4.selectors.isTop(d2, l2), [o4, l2]));
  k$3(F2, [f2, M2], (d2, T3) => {
    var P2;
    s$12.send({ type: C.CloseMenu }), H$2(T3, I$2.Loose) || (d2.preventDefault(), (P2 = s$12.state.buttonElement) == null || P2.focus());
  });
  let I2 = o$6(() => {
    s$12.send({ type: C.CloseMenu });
  }), b2 = n$5({ open: n2 === P.Open, close: I2 }), i$12 = { ref: _2 }, g2 = K$1();
  return window.wp.element.createElement(Ae$2, null, window.wp.element.createElement(a$1.Provider, { value: s$12 }, window.wp.element.createElement(c$6, { value: u$e(n2, { [P.Open]: i.Open, [P.Closed]: i.Closed }) }, g2({ ourProps: i$12, theirProps: p2, slot: b2, defaultTag: Ze$1, name: "Menu" }))));
}
let tt$1 = "button";
function ot(m3, y2) {
  let l2 = p$1("Menu.Button"), a3 = _global_window_wp_element_useId(), { id: p2 = `headlessui-menu-button-${a3}`, disabled: s2 = false, autoFocus: n2 = false, ...M2 } = m3, f2 = window.wp.element.useRef(null), _2 = be(), o4 = y$5(y2, f2, Fe$4(), o$6((t2) => l2.send({ type: C.SetButtonElement, element: t2 }))), F2 = o$6((t2) => {
    switch (t2.key) {
      case o$4.Space:
      case o$4.Enter:
      case o$4.ArrowDown:
        t2.preventDefault(), t2.stopPropagation(), l2.send({ type: C.OpenMenu, focus: { focus: c$5.First } });
        break;
      case o$4.ArrowUp:
        t2.preventDefault(), t2.stopPropagation(), l2.send({ type: C.OpenMenu, focus: { focus: c$5.Last } });
        break;
    }
  }), I2 = o$6((t2) => {
    switch (t2.key) {
      case o$4.Space:
        t2.preventDefault();
        break;
    }
  }), [b2, i2, g2] = S$5(l2, (t2) => [t2.menuState, t2.buttonElement, t2.itemsElement]), d2 = b2 === P.Open;
  L$1(d2, { trigger: i2, action: window.wp.element.useCallback((t2) => {
    if (i2 != null && i2.contains(t2.target)) return S$3.Ignore;
    let S2 = t2.target.closest('[role="menuitem"]:not([data-disabled])');
    return n$4(S2) ? S$3.Select(S2) : g2 != null && g2.contains(t2.target) ? S$3.Ignore : S$3.Close;
  }, [i2, g2]), close: window.wp.element.useCallback(() => l2.send({ type: C.CloseMenu }), []), select: window.wp.element.useCallback((t2) => t2.click(), []) });
  let T3 = s$6((t2) => {
    var S2;
    s2 || (b2 === P.Open ? (window.wp.element.flushSync(() => l2.send({ type: C.CloseMenu })), (S2 = f2.current) == null || S2.focus({ preventScroll: true })) : (t2.preventDefault(), l2.send({ type: C.OpenMenu, focus: { focus: c$5.Nothing }, trigger: D.Pointer })));
  }), { isFocusVisible: P$12, focusProps: L2 } = $0c4a58759813079a$export$4e328f61c538687f({ autoFocus: n2 }), { isHovered: O2, hoverProps: v2 } = $e969f22b6713ca4a$export$ae780daf29e6d456({ isDisabled: s2 }), { pressed: D$12, pressProps: U2 } = w$7({ disabled: s2 }), H2 = n$5({ open: b2 === P.Open, active: D$12 || b2 === P.Open, disabled: s2, hover: O2, focus: P$12, autofocus: n2 }), G2 = V$2(_2(), { ref: o4, id: p2, type: e$1(m3, f2.current), "aria-haspopup": "menu", "aria-controls": g2 == null ? void 0 : g2.id, "aria-expanded": b2 === P.Open, disabled: s2 || void 0, autoFocus: n2, onKeyDown: F2, onKeyUp: I2 }, T3, L2, v2, U2);
  return K$1()({ ourProps: G2, theirProps: M2, slot: H2, defaultTag: tt$1, name: "Menu.Button" });
}
let nt = "div", rt = A$2.RenderStrategy | A$2.Static;
function at(m3, y2) {
  let l2 = _global_window_wp_element_useId(), { id: a3 = `headlessui-menu-items-${l2}`, anchor: p2, portal: s2 = false, modal: n2 = true, transition: M2 = false, ...f2 } = m3, _2 = ye(p2), o4 = p$1("Menu.Items"), [F2, I2] = Re$1(_2), b2 = Te$2(), [i$12, g2] = window.wp.element.useState(null), d2 = y$5(y2, _2 ? F2 : null, o$6((e2) => o4.send({ type: C.SetItemsElement, element: e2 })), g2), [T3, P$12] = S$5(o4, (e2) => [e2.menuState, e2.buttonElement]), L2 = u$7(P$12), O2 = u$7(i$12);
  _2 && (s2 = true);
  let v2 = u$4(), [D2, U2] = N(M2, i$12, v2 !== null ? (v2 & i.Open) === i.Open : T3 === P.Open);
  p$4(D2, P$12, () => {
    o4.send({ type: C.CloseMenu });
  });
  let H2 = S$5(o4, (e2) => e2.__demoMode), G2 = H2 ? false : n2 && T3 === P.Open;
  f$6(G2, O2);
  let w2 = H2 ? false : n2 && T3 === P.Open;
  y$3(w2, { allowed: window.wp.element.useCallback(() => [P$12, i$12], [P$12, i$12]) });
  let S2 = S$5(o4, o4.selectors.didButtonMove) ? false : D2;
  window.wp.element.useEffect(() => {
    let e2 = i$12;
    e2 && T3 === P.Open && (d$3(e2) || e2.focus({ preventScroll: true }));
  }, [T3, i$12]), F$2(T3 === P.Open, { container: i$12, accept(e2) {
    return e2.getAttribute("role") === "menuitem" ? NodeFilter.FILTER_REJECT : e2.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
  }, walk(e2) {
    e2.setAttribute("role", "none");
  } });
  let z2 = p$8(), le$12 = o$6((e2) => {
    var N2, Y2, Z2;
    switch (z2.dispose(), e2.key) {
      case o$4.Space:
        if (o4.state.searchQuery !== "") return e2.preventDefault(), e2.stopPropagation(), o4.send({ type: C.Search, value: e2.key });
      case o$4.Enter:
        if (e2.preventDefault(), e2.stopPropagation(), o4.state.activeItemIndex !== null) {
          let { dataRef: de2 } = o4.state.items[o4.state.activeItemIndex];
          (Y2 = (N2 = de2.current) == null ? void 0 : N2.domRef.current) == null || Y2.click();
        }
        o4.send({ type: C.CloseMenu }), K(o4.state.buttonElement);
        break;
      case o$4.ArrowDown:
        return e2.preventDefault(), e2.stopPropagation(), o4.send({ type: C.GoToItem, focus: c$5.Next });
      case o$4.ArrowUp:
        return e2.preventDefault(), e2.stopPropagation(), o4.send({ type: C.GoToItem, focus: c$5.Previous });
      case o$4.Home:
      case o$4.PageUp:
        return e2.preventDefault(), e2.stopPropagation(), o4.send({ type: C.GoToItem, focus: c$5.First });
      case o$4.End:
      case o$4.PageDown:
        return e2.preventDefault(), e2.stopPropagation(), o4.send({ type: C.GoToItem, focus: c$5.Last });
      case o$4.Escape:
        e2.preventDefault(), e2.stopPropagation(), window.wp.element.flushSync(() => o4.send({ type: C.CloseMenu })), (Z2 = o4.state.buttonElement) == null || Z2.focus({ preventScroll: true });
        break;
      case o$4.Tab:
        e2.preventDefault(), e2.stopPropagation(), window.wp.element.flushSync(() => o4.send({ type: C.CloseMenu })), R(o4.state.buttonElement, e2.shiftKey ? T$2.Previous : T$2.Next);
        break;
      default:
        e2.key.length === 1 && (o4.send({ type: C.Search, value: e2.key }), z2.setTimeout(() => o4.send({ type: C.ClearSearch }), 350));
        break;
    }
  }), pe2 = o$6((e2) => {
    switch (e2.key) {
      case o$4.Space:
        e2.preventDefault();
        break;
    }
  }), ie2 = n$5({ open: T3 === P.Open }), ue2 = V$2(_2 ? b2() : {}, { "aria-activedescendant": S$5(o4, o4.selectors.activeDescendantId), "aria-labelledby": S$5(o4, (e2) => {
    var N2;
    return (N2 = e2.buttonElement) == null ? void 0 : N2.id;
  }), id: a3, onKeyDown: le$12, onKeyUp: pe2, role: "menu", tabIndex: T3 === P.Open ? 0 : void 0, ref: d2, style: { ...f2.style, ...I2, "--button-width": w$5(D2, P$12, true).width }, ...x$4(U2) }), me2 = K$1();
  return window.wp.element.createElement(le, { enabled: s2 ? m3.static || D2 : false, ownerDocument: L2 }, me2({ ourProps: ue2, theirProps: f2, slot: ie2, defaultTag: nt, features: rt, visible: S2, name: "Menu.Items" }));
}
let st = window.wp.element.Fragment;
function lt(m3, y2) {
  let l2 = _global_window_wp_element_useId(), { id: a3 = `headlessui-menu-item-${l2}`, disabled: p2 = false, ...s2 } = m3, n2 = p$1("Menu.Item"), M2 = S$5(n2, (t2) => n2.selectors.isActive(t2, a3)), f2 = window.wp.element.useRef(null), _2 = y$5(y2, f2), o4 = S$5(n2, (t2) => n2.selectors.shouldScrollIntoView(t2, a3));
  n$6(() => {
    if (o4) return o$7().requestAnimationFrame(() => {
      var t2, S2;
      (S2 = (t2 = f2.current) == null ? void 0 : t2.scrollIntoView) == null || S2.call(t2, { block: "nearest" });
    });
  }, [o4, f2]);
  let F2 = s$1(f2), I2 = window.wp.element.useRef({ disabled: p2, domRef: f2, get textValue() {
    return F2();
  } });
  n$6(() => {
    I2.current.disabled = p2;
  }, [I2, p2]), n$6(() => (n2.actions.registerItem(a3, I2), () => n2.actions.unregisterItem(a3)), [I2, a3]);
  let b2 = o$6(() => {
    n2.send({ type: C.CloseMenu });
  }), i2 = o$6((t2) => {
    if (p2) return t2.preventDefault();
    n2.send({ type: C.CloseMenu }), K(n2.state.buttonElement);
  }), g2 = o$6(() => {
    if (p2) return n2.send({ type: C.GoToItem, focus: c$5.Nothing });
    n2.send({ type: C.GoToItem, focus: c$5.Specific, id: a3 });
  }), d2 = u$6(), T3 = o$6((t2) => d2.update(t2)), P2 = o$6((t2) => {
    d2.wasMoved(t2) && (p2 || M2 || n2.send({ type: C.GoToItem, focus: c$5.Specific, id: a3, trigger: D.Pointer }));
  }), L2 = o$6((t2) => {
    d2.wasMoved(t2) && (p2 || M2 && n2.state.activationTrigger === D.Pointer && n2.send({ type: C.GoToItem, focus: c$5.Nothing }));
  }), [O2, v2] = V$1(), [D$12, U2] = H$3(), H2 = n$5({ active: M2, focus: M2, disabled: p2, close: b2 }), G2 = { id: a3, ref: _2, role: "menuitem", tabIndex: p2 === true ? void 0 : -1, "aria-disabled": p2 === true ? true : void 0, "aria-labelledby": O2, "aria-describedby": D$12, disabled: void 0, onClick: i2, onFocus: g2, onPointerEnter: T3, onMouseEnter: T3, onPointerMove: P2, onMouseMove: P2, onPointerLeave: L2, onMouseLeave: L2 }, w2 = K$1();
  return window.wp.element.createElement(v2, null, window.wp.element.createElement(U2, null, w2({ ourProps: G2, theirProps: s2, slot: H2, defaultTag: st, name: "Menu.Item" })));
}
let pt$1 = "div";
function it(m3, y2) {
  let [l2, a3] = V$1(), p2 = m3, s2 = { ref: y2, "aria-labelledby": l2, role: "group" }, n2 = K$1();
  return window.wp.element.createElement(a3, null, n2({ ourProps: s2, theirProps: p2, slot: {}, defaultTag: pt$1, name: "Menu.Section" }));
}
let ut = "header";
function mt$1(m3, y2) {
  let l2 = _global_window_wp_element_useId(), { id: a3 = `headlessui-menu-heading-${l2}`, ...p2 } = m3, s2 = C$5();
  n$6(() => s2.register(a3), [a3, s2.register]);
  let n2 = { id: a3, ref: y2, role: "presentation", ...s2.props };
  return K$1()({ ourProps: n2, theirProps: p2, slot: {}, defaultTag: ut, name: "Menu.Heading" });
}
let dt = "div";
function Tt$2(m3, y2) {
  let l2 = m3, a3 = { ref: y2, role: "separator" };
  return K$1()({ ourProps: a3, theirProps: l2, slot: {}, defaultTag: dt, name: "Menu.Separator" });
}
let ct = Y$1(et), ft$1 = Y$1(ot), yt$2 = Y$1(at), gt$2 = Y$1(lt), Pt$1 = Y$1(it), Et$2 = Y$1(mt$1), Mt$1 = Y$1(Tt$2), lo = Object.assign(ct, { Button: ft$1, Items: yt$2, Item: gt$2, Section: Pt$1, Heading: Et$2, Separator: Mt$1 });
var f$1 = Object.defineProperty;
var b = (t2, n2, e2) => n2 in t2 ? f$1(t2, n2, { enumerable: true, configurable: true, writable: true, value: e2 }) : t2[n2] = e2;
var p = (t2, n2, e2) => (b(t2, typeof n2 != "symbol" ? n2 + "" : n2, e2), e2);
var v = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(v || {}), h3 = ((r2) => (r2[r2.OpenPopover = 0] = "OpenPopover", r2[r2.ClosePopover = 1] = "ClosePopover", r2[r2.SetButton = 2] = "SetButton", r2[r2.SetButtonId = 3] = "SetButtonId", r2[r2.SetPanel = 4] = "SetPanel", r2[r2.SetPanelId = 5] = "SetPanelId", r2))(h3 || {});
let E$1 = { [0]: (t2) => t2.popoverState === 0 ? t2 : { ...t2, popoverState: 0, __demoMode: false }, [1](t2) {
  return t2.popoverState === 1 ? t2 : { ...t2, popoverState: 1, __demoMode: false };
}, [2](t2, n2) {
  return t2.button === n2.button ? t2 : { ...t2, button: n2.button };
}, [3](t2, n2) {
  return t2.buttonId === n2.buttonId ? t2 : { ...t2, buttonId: n2.buttonId };
}, [4](t2, n2) {
  return t2.panel === n2.panel ? t2 : { ...t2, panel: n2.panel };
}, [5](t2, n2) {
  return t2.panelId === n2.panelId ? t2 : { ...t2, panelId: n2.panelId };
} };
class d extends T$3 {
  constructor(e2) {
    super(e2);
    p(this, "actions", { close: () => this.send({ type: 1 }), refocusableClose: (e3) => {
      this.actions.close();
      let o4 = (() => e3 ? n$4(e3) ? e3 : "current" in e3 && n$4(e3.current) ? e3.current : this.state.button : this.state.button)();
      o4 == null || o4.focus();
    }, open: () => this.send({ type: 0 }), setButtonId: (e3) => this.send({ type: 3, buttonId: e3 }), setButton: (e3) => this.send({ type: 2, button: e3 }), setPanelId: (e3) => this.send({ type: 5, panelId: e3 }), setPanel: (e3) => this.send({ type: 4, panel: e3 }) });
    p(this, "selectors", { isPortalled: (e3) => {
      var i2;
      if (!e3.button || !e3.panel) return false;
      let o4 = (i2 = l$7(e3.button)) != null ? i2 : document;
      for (let u2 of o4.querySelectorAll("body > *")) if (Number(u2 == null ? void 0 : u2.contains(e3.button)) ^ Number(u2 == null ? void 0 : u2.contains(e3.panel))) return true;
      let l2 = x$5(o4), s2 = l2.indexOf(e3.button), r2 = (s2 + l2.length - 1) % l2.length, c2 = (s2 + 1) % l2.length, S2 = l2[r2], m3 = l2[c2];
      return !e3.panel.contains(S2) && !e3.panel.contains(m3);
    } });
    {
      let o4 = this.state.id, l2 = x$6.get(null);
      this.on(0, () => l2.actions.push(o4)), this.on(1, () => l2.actions.pop(o4));
    }
  }
  static new({ id: e2, __demoMode: o4 = false }) {
    return new d({ id: e2, __demoMode: o4, popoverState: o4 ? 0 : 1, buttons: { current: [] }, button: null, buttonId: null, panel: null, panelId: null, beforePanelSentinel: { current: null }, afterPanelSentinel: { current: null }, afterButtonSentinel: { current: null } });
  }
  reduce(e2, o4) {
    return u$e(o4.type, E$1, e2, o4);
  }
}
const a2 = window.wp.element.createContext(null);
function u(r2) {
  let o4 = window.wp.element.useContext(a2);
  if (o4 === null) {
    let e2 = new Error(`<${r2} /> is missing a parent <Popover /> component.`);
    throw Error.captureStackTrace && Error.captureStackTrace(e2, u), e2;
  }
  return o4;
}
function f({ id: r2, __demoMode: o4 = false }) {
  let e2 = window.wp.element.useMemo(() => d.new({ id: r2, __demoMode: o4 }), []);
  return c$4(() => e2.dispose()), e2;
}
let Fe$2 = window.wp.element.createContext(null);
Fe$2.displayName = "PopoverGroupContext";
function we() {
  return window.wp.element.useContext(Fe$2);
}
let de = window.wp.element.createContext(null);
de.displayName = "PopoverPanelContext";
function mt() {
  return window.wp.element.useContext(de);
}
let vt$1 = "div";
function Tt$1(E2, O2) {
  var M2;
  let R2 = _global_window_wp_element_useId(), { __demoMode: B2 = false, ...T3 } = E2, n2 = f({ id: R2, __demoMode: B2 }), b2 = window.wp.element.useRef(null), t2 = y$5(O2, T$4((r2) => {
    b2.current = r2;
  })), [A2, d2, o4, C2, y2] = S$5(n2, window.wp.element.useCallback((r2) => [r2.popoverState, r2.button, r2.panel, r2.buttonId, r2.panelId], [])), D2 = c$9((M2 = b2.current) != null ? M2 : d2), _2 = s$a(C2), a$12 = s$a(y2), u2 = window.wp.element.useMemo(() => ({ buttonId: _2, panelId: a$12, close: n2.actions.close }), [_2, a$12, n2]), f$12 = we(), l2 = f$12 == null ? void 0 : f$12.registerPopover, c2 = o$6(() => {
    var F2, G2;
    let r2 = e$5((F2 = b2.current) != null ? F2 : d2);
    return (G2 = f$12 == null ? void 0 : f$12.isFocusWithinPopoverGroup()) != null ? G2 : r2 && ((d2 == null ? void 0 : d2.contains(r2)) || (o4 == null ? void 0 : o4.contains(r2)));
  });
  window.wp.element.useEffect(() => l2 == null ? void 0 : l2(u2), [l2, u2]);
  let [m3, W2] = oe$3(), V2 = x$3(d2), j$12 = S$1({ mainTreeNode: V2, portals: m3, defaultContainers: [{ get current() {
    return n2.state.button;
  } }, { get current() {
    return n2.state.panel;
  } }] });
  E$2(D2, "focus", (r2) => {
    var F2, G2, h4, k2, I2, H2;
    r2.target !== window && i$4(r2.target) && n2.state.popoverState === v.Open && (c2() || n2.state.button && n2.state.panel && (j$12.contains(r2.target) || (G2 = (F2 = n2.state.beforePanelSentinel.current) == null ? void 0 : F2.contains) != null && G2.call(F2, r2.target) || (k2 = (h4 = n2.state.afterPanelSentinel.current) == null ? void 0 : h4.contains) != null && k2.call(h4, r2.target) || (H2 = (I2 = n2.state.afterButtonSentinel.current) == null ? void 0 : I2.contains) != null && H2.call(I2, r2.target) || n2.actions.close()));
  }, true);
  let L2 = A2 === v.Open;
  k$3(L2, j$12.resolveContainers, (r2, F2) => {
    n2.actions.close(), H$2(F2, I$2.Loose) || (r2.preventDefault(), d2 == null || d2.focus());
  });
  let Y2 = n$5({ open: A2 === v.Open, close: n2.actions.refocusableClose }), $2 = S$5(n2, window.wp.element.useCallback((r2) => u$e(r2.popoverState, { [v.Open]: i.Open, [v.Closed]: i.Closed }), [])), Q2 = { ref: t2 }, Z2 = K$1();
  return window.wp.element.createElement(j, { node: V2 }, window.wp.element.createElement(Ae$2, null, window.wp.element.createElement(de.Provider, { value: null }, window.wp.element.createElement(a2.Provider, { value: n2 }, window.wp.element.createElement(C$4, { value: n2.actions.refocusableClose }, window.wp.element.createElement(c$6, { value: $2 }, window.wp.element.createElement(W2, null, Z2({ ourProps: Q2, theirProps: T3, slot: Y2, defaultTag: vt$1, name: "Popover" }))))))));
}
let Et$1 = "button";
function bt$1(E2, O2) {
  let R2 = _global_window_wp_element_useId(), { id: B2 = `headlessui-popover-button-${R2}`, disabled: T3 = false, autoFocus: n2 = false, ...b2 } = E2, t2 = u("Popover.Button"), [A2, d2, o4, C2, y2, D2, _2] = S$5(t2, window.wp.element.useCallback((e2) => [e2.popoverState, t2.selectors.isPortalled(e2), e2.button, e2.buttonId, e2.panel, e2.panelId, e2.afterButtonSentinel], [])), a3 = window.wp.element.useRef(null), u$12 = `headlessui-focus-sentinel-${_global_window_wp_element_useId()}`, f2 = we(), l2 = f2 == null ? void 0 : f2.closeOthers, m3 = mt() !== null;
  window.wp.element.useEffect(() => {
    if (!m3) return t2.actions.setButtonId(B2), () => t2.actions.setButtonId(null);
  }, [m3, B2, t2]);
  let [W2] = window.wp.element.useState(() => /* @__PURE__ */ Symbol()), V2 = y$5(a3, O2, Fe$4(), o$6((e2) => {
    if (!m3) {
      if (e2) t2.state.buttons.current.push(W2);
      else {
        let p2 = t2.state.buttons.current.indexOf(W2);
        p2 !== -1 && t2.state.buttons.current.splice(p2, 1);
      }
      t2.state.buttons.current.length > 1 && console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."), e2 && t2.actions.setButton(e2);
    }
  })), j2 = y$5(a3, O2), L2 = o$6((e2) => {
    var p2, i2, x2;
    if (m3) {
      if (t2.state.popoverState === v.Closed) return;
      switch (e2.key) {
        case o$4.Space:
        case o$4.Enter:
          e2.preventDefault(), (i2 = (p2 = e2.target).click) == null || i2.call(p2), t2.actions.close(), (x2 = t2.state.button) == null || x2.focus();
          break;
      }
    } else switch (e2.key) {
      case o$4.Space:
      case o$4.Enter:
        e2.preventDefault(), e2.stopPropagation(), t2.state.popoverState === v.Closed ? (l2 == null || l2(t2.state.buttonId), t2.actions.open()) : t2.actions.close();
        break;
      case o$4.Escape:
        if (t2.state.popoverState !== v.Open) return l2 == null ? void 0 : l2(t2.state.buttonId);
        if (!a3.current) return;
        let S2 = e$5(a3.current);
        if (S2 && !a3.current.contains(S2)) return;
        e2.preventDefault(), e2.stopPropagation(), t2.actions.close();
        break;
    }
  }), Y2 = o$6((e2) => {
    m3 || e2.key === o$4.Space && e2.preventDefault();
  }), $2 = o$6((e2) => {
    var p2, i2;
    s$7(e2.currentTarget) || T3 || (m3 ? (t2.actions.close(), (p2 = t2.state.button) == null || p2.focus()) : (e2.preventDefault(), e2.stopPropagation(), t2.state.popoverState === v.Closed ? (l2 == null || l2(t2.state.buttonId), t2.actions.open()) : t2.actions.close(), (i2 = t2.state.button) == null || i2.focus()));
  }), Q2 = o$6((e2) => {
    e2.preventDefault(), e2.stopPropagation();
  }), { isFocusVisible: Z2, focusProps: M2 } = $0c4a58759813079a$export$4e328f61c538687f({ autoFocus: n2 }), { isHovered: r2, hoverProps: F2 } = $e969f22b6713ca4a$export$ae780daf29e6d456({ isDisabled: T3 }), { pressed: G2, pressProps: h4 } = w$7({ disabled: T3 }), k2 = A2 === v.Open, I2 = n$5({ open: k2, active: G2 || k2, disabled: T3, hover: r2, focus: Z2, autofocus: n2 }), H2 = e$1(E2, o4), fe2 = m3 ? V$2({ ref: j2, type: H2, onKeyDown: L2, onClick: $2, disabled: T3 || void 0, autoFocus: n2 }, M2, F2, h4) : V$2({ ref: V2, id: C2, type: H2, "aria-expanded": A2 === v.Open, "aria-controls": y2 ? D2 : void 0, disabled: T3 || void 0, autoFocus: n2, onKeyDown: L2, onKeyUp: Y2, onClick: $2, onMouseDown: Q2 }, M2, F2, h4), ae = u$2(), Pe2 = o$6(() => {
    if (!n$4(t2.state.panel)) return;
    let e2 = t2.state.panel;
    function p2() {
      u$e(ae.current, { [a$3.Forwards]: () => v$1(e2, T$2.First), [a$3.Backwards]: () => v$1(e2, T$2.Last) }) === A$1.Error && v$1(x$5(r$6(t2.state.button)).filter((x2) => x2.dataset.headlessuiFocusGuard !== "true"), u$e(ae.current, { [a$3.Forwards]: T$2.Next, [a$3.Backwards]: T$2.Previous }), { relativeTo: t2.state.button });
    }
    p2();
  }), s2 = K$1();
  return window.wp.element.createElement(window.wp.element.Fragment, null, s2({ ourProps: fe2, theirProps: b2, slot: I2, defaultTag: Et$1, name: "Popover.Button" }), k2 && !m3 && d2 && window.wp.element.createElement(f$d, { id: u$12, ref: _2, features: s$8.Focusable, "data-headlessui-focus-guard": true, as: "button", type: "button", onFocus: Pe2 }));
}
let yt$1 = "div", gt$1 = A$2.RenderStrategy | A$2.Static;
function Ne(E2, O2) {
  let R2 = _global_window_wp_element_useId(), { id: B2 = `headlessui-popover-backdrop-${R2}`, transition: T3 = false, ...n2 } = E2, b2 = u("Popover.Backdrop"), t2 = S$5(b2, window.wp.element.useCallback((l2) => l2.popoverState, [])), [A2, d2] = window.wp.element.useState(null), o4 = y$5(O2, d2), C2 = u$4(), [y2, D2] = N(T3, A2, C2 !== null ? (C2 & i.Open) === i.Open : t2 === v.Open), _2 = o$6((l2) => {
    if (s$7(l2.currentTarget)) return l2.preventDefault();
    b2.actions.close();
  }), a3 = n$5({ open: t2 === v.Open }), u$12 = { ref: o4, id: B2, "aria-hidden": true, onClick: _2, ...x$4(D2) };
  return K$1()({ ourProps: u$12, theirProps: n2, slot: a3, defaultTag: yt$1, features: gt$1, visible: y2, name: "Popover.Backdrop" });
}
let Rt$1 = "div", Ft$1 = A$2.RenderStrategy | A$2.Static;
function Bt$1(E2, O2) {
  let R2 = _global_window_wp_element_useId(), { id: B2 = `headlessui-popover-panel-${R2}`, focus: T3 = false, anchor: n2, portal: b2 = false, modal: t2 = false, transition: A2 = false, ...d2 } = E2, o4 = u("Popover.Panel"), C2 = S$5(o4, o4.selectors.isPortalled), [y2, D2, _2, a3, u$12] = S$5(o4, window.wp.element.useCallback((s2) => [s2.popoverState, s2.button, s2.__demoMode, s2.beforePanelSentinel, s2.afterPanelSentinel], [])), f2 = `headlessui-focus-sentinel-before-${R2}`, l2 = `headlessui-focus-sentinel-after-${R2}`, c2 = window.wp.element.useRef(null), m3 = ye(n2), [W2, V2] = Re$1(m3), j2 = Te$2();
  m3 && (b2 = true);
  let [L2, Y2] = window.wp.element.useState(null), $2 = y$5(c2, O2, m3 ? W2 : null, o4.actions.setPanel, Y2), Q2 = u$7(D2), Z2 = u$7(c2.current);
  n$6(() => (o4.actions.setPanelId(B2), () => o4.actions.setPanelId(null)), [B2, o4]);
  let M2 = u$4(), [r2, F2] = N(A2, L2, M2 !== null ? (M2 & i.Open) === i.Open : y2 === v.Open);
  p$4(r2, D2, o4.actions.close), f$6(_2 ? false : t2 && r2, Z2);
  let h4 = o$6((s2) => {
    var e2;
    switch (s2.key) {
      case o$4.Escape:
        if (o4.state.popoverState !== v.Open || !c2.current) return;
        let p2 = e$5(c2.current);
        if (p2 && !c2.current.contains(p2)) return;
        s2.preventDefault(), s2.stopPropagation(), o4.actions.close(), (e2 = o4.state.button) == null || e2.focus();
        break;
    }
  });
  window.wp.element.useEffect(() => {
    var s2;
    E2.static || y2 === v.Closed && ((s2 = E2.unmount) == null || s2) && o4.actions.setPanel(null);
  }, [y2, E2.unmount, E2.static, o4]), window.wp.element.useEffect(() => {
    if (_2 || !T3 || y2 !== v.Open || !c2.current) return;
    let s2 = e$5(c2.current);
    c2.current.contains(s2) || v$1(c2.current, T$2.First);
  }, [_2, T3, c2.current, y2]);
  let k2 = n$5({ open: y2 === v.Open, close: o4.actions.refocusableClose }), I2 = V$2(m3 ? j2() : {}, { ref: $2, id: B2, onKeyDown: h4, onBlur: T3 && y2 === v.Open ? (s2) => {
    var p2, i2, x2, S2, me2;
    let e2 = s2.relatedTarget;
    e2 && c2.current && ((p2 = c2.current) != null && p2.contains(e2) || (o4.actions.close(), ((x2 = (i2 = a3.current) == null ? void 0 : i2.contains) != null && x2.call(i2, e2) || (me2 = (S2 = u$12.current) == null ? void 0 : S2.contains) != null && me2.call(S2, e2)) && e2.focus({ preventScroll: true })));
  } : void 0, tabIndex: -1, style: { ...d2.style, ...V2, "--button-width": w$5(r2, D2, true).width }, ...x$4(F2) }), H2 = u$2(), fe2 = o$6(() => {
    let s2 = c2.current;
    if (!s2) return;
    function e2() {
      u$e(H2.current, { [a$3.Forwards]: () => {
        var i2;
        v$1(s2, T$2.First) === A$1.Error && ((i2 = o4.state.afterPanelSentinel.current) == null || i2.focus());
      }, [a$3.Backwards]: () => {
        var p2;
        (p2 = o4.state.button) == null || p2.focus({ preventScroll: true });
      } });
    }
    e2();
  }), ae = o$6(() => {
    let s2 = c2.current;
    if (!s2) return;
    function e2() {
      u$e(H2.current, { [a$3.Forwards]: () => {
        var Be2;
        if (!o4.state.button) return;
        let p2 = (Be2 = r$6(o4.state.button)) != null ? Be2 : document.body, i2 = x$5(p2), x2 = i2.indexOf(o4.state.button), S2 = i2.slice(0, x2 + 1), se = [...i2.slice(x2 + 1), ...S2];
        for (let ve2 of se.slice()) if (ve2.dataset.headlessuiFocusGuard === "true" || L2 != null && L2.contains(ve2)) {
          let Ae2 = se.indexOf(ve2);
          Ae2 !== -1 && se.splice(Ae2, 1);
        }
        v$1(se, T$2.First, { sorted: false });
      }, [a$3.Backwards]: () => {
        var i2;
        v$1(s2, T$2.Previous) === A$1.Error && ((i2 = o4.state.button) == null || i2.focus());
      } });
    }
    e2();
  }), Pe2 = K$1();
  return window.wp.element.createElement(s$3, null, window.wp.element.createElement(de.Provider, { value: B2 }, window.wp.element.createElement(C$4, { value: o4.actions.refocusableClose }, window.wp.element.createElement(le, { enabled: b2 ? E2.static || r2 : false, ownerDocument: Q2 }, r2 && C2 && window.wp.element.createElement(f$d, { id: f2, ref: a3, features: s$8.Focusable, "data-headlessui-focus-guard": true, as: "button", type: "button", onFocus: fe2 }), Pe2({ ourProps: I2, theirProps: d2, slot: k2, defaultTag: Rt$1, features: Ft$1, visible: r2, name: "Popover.Panel" }), r2 && C2 && window.wp.element.createElement(f$d, { id: l2, ref: u$12, features: s$8.Focusable, "data-headlessui-focus-guard": true, as: "button", type: "button", onFocus: ae })))));
}
let At$1 = "div";
function _t$1(E2, O2) {
  let R2 = window.wp.element.useRef(null), B2 = y$5(R2, O2), [T3, n2] = window.wp.element.useState([]), b2 = o$6((a3) => {
    n2((u2) => {
      let f2 = u2.indexOf(a3);
      if (f2 !== -1) {
        let l2 = u2.slice();
        return l2.splice(f2, 1), l2;
      }
      return u2;
    });
  }), t2 = o$6((a3) => (n2((u2) => [...u2, a3]), () => b2(a3))), A2 = o$6(() => {
    var f2;
    let a3 = r$6(R2.current);
    if (!a3) return false;
    let u2 = e$5(R2.current);
    return (f2 = R2.current) != null && f2.contains(u2) ? true : T3.some((l2) => {
      var c2, m3;
      return ((c2 = a3.getElementById(l2.buttonId.current)) == null ? void 0 : c2.contains(u2)) || ((m3 = a3.getElementById(l2.panelId.current)) == null ? void 0 : m3.contains(u2));
    });
  }), d2 = o$6((a3) => {
    for (let u2 of T3) u2.buttonId.current !== a3 && u2.close();
  }), o4 = window.wp.element.useMemo(() => ({ registerPopover: t2, unregisterPopover: b2, isFocusWithinPopoverGroup: A2, closeOthers: d2 }), [t2, b2, A2, d2]), C2 = n$5({}), y2 = E2, D2 = { ref: B2 }, _2 = K$1();
  return window.wp.element.createElement(j, null, window.wp.element.createElement(Fe$2.Provider, { value: o4 }, _2({ ourProps: D2, theirProps: y2, slot: C2, defaultTag: At$1, name: "Popover.Group" })));
}
let Ct$1 = Y$1(Tt$1), Dt$1 = Y$1(bt$1), Ot$1 = Y$1(Ne), xt$1 = Y$1(Ne), Lt$1 = Y$1(Bt$1), ht$1 = Y$1(_t$1), vo = Object.assign(Ct$1, { Button: Dt$1, Backdrop: xt$1, Overlay: Ot$1, Panel: Lt$1, Group: ht$1 });
let E = window.wp.element.createContext(null);
E.displayName = "GroupContext";
let ve = window.wp.element.Fragment;
function xe(n2) {
  var c2;
  let [t2, a3] = window.wp.element.useState(null), [f2, h4] = V$1(), [b2, o4] = H$3(), s2 = window.wp.element.useMemo(() => ({ switch: t2, setSwitch: a3 }), [t2, a3]), T3 = {}, y2 = n2, p2 = K$1();
  return window.wp.element.createElement(o4, { name: "Switch.Description", value: b2 }, window.wp.element.createElement(h4, { name: "Switch.Label", value: f2, props: { htmlFor: (c2 = s2.switch) == null ? void 0 : c2.id, onClick(u2) {
    t2 && (m$3(u2.currentTarget) && u2.preventDefault(), t2.click(), t2.focus({ preventScroll: true }));
  } } }, window.wp.element.createElement(E.Provider, { value: s2 }, p2({ ourProps: T3, theirProps: y2, slot: {}, defaultTag: ve, name: "Switch.Group" }))));
}
let Ce = "button";
function Le(n2, t2) {
  var g2;
  let a3 = _global_window_wp_element_useId(), f2 = u$d(), h4 = a$f(), { id: b2 = f2 || `headlessui-switch-${a3}`, disabled: o4 = h4 || false, checked: s2, defaultChecked: T3, onChange: y2, name: p2, value: c2, form: u2, autoFocus: S2 = false, ...C2 } = n2, _2 = window.wp.element.useContext(E), [L2, R2] = window.wp.element.useState(null), G2 = window.wp.element.useRef(null), A2 = y$5(G2, t2, _2 === null ? null : _2.setSwitch, R2), l2 = l$5(T3), [d2, r2] = b$3(s2, y2, l2 != null ? l2 : false), F2 = p$8(), [H2, P2] = window.wp.element.useState(false), D2 = o$6(() => {
    P2(true), r2 == null || r2(!d2), F2.nextFrame(() => {
      P2(false);
    });
  }), k2 = o$6((e2) => {
    if (s$7(e2.currentTarget)) return e2.preventDefault();
    e2.preventDefault(), D2();
  }), M2 = o$6((e2) => {
    e2.key === o$4.Space ? (e2.preventDefault(), D2()) : e2.key === o$4.Enter && g$3(e2.currentTarget);
  }), U2 = o$6((e2) => e2.preventDefault()), I2 = N$1(), B2 = w$6(), { isFocusVisible: K2, focusProps: O2 } = $0c4a58759813079a$export$4e328f61c538687f({ autoFocus: S2 }), { isHovered: W2, hoverProps: N2 } = $e969f22b6713ca4a$export$ae780daf29e6d456({ isDisabled: o4 }), { pressed: J2, pressProps: V2 } = w$7({ disabled: o4 }), X2 = n$5({ checked: d2, disabled: o4, hover: W2, focus: K2, active: J2, autofocus: S2, changing: H2 }), j2 = V$2({ id: b2, ref: A2, role: "switch", type: e$1(n2, L2), tabIndex: n2.tabIndex === -1 ? 0 : (g2 = n2.tabIndex) != null ? g2 : 0, "aria-checked": d2, "aria-labelledby": I2, "aria-describedby": B2, disabled: o4 || void 0, autoFocus: S2, onClick: k2, onKeyUp: M2, onKeyPress: U2 }, O2, N2, V2), $2 = window.wp.element.useCallback(() => {
    if (l2 !== void 0) return r2 == null ? void 0 : r2(l2);
  }, [r2, l2]), q2 = K$1();
  return window.wp.element.createElement(window.wp.element.Fragment, null, p2 != null && window.wp.element.createElement(j$5, { disabled: o4, data: { [p2]: c2 || "on" }, overrides: { type: "checkbox", checked: d2 }, form: u2, onReset: $2 }), q2({ ourProps: j2, theirProps: C2, slot: X2, defaultTag: Ce, name: "Switch" }));
}
let Re = Y$1(Le), Ge$1 = xe, Ae = Z, Fe$1 = M$5, tt = Object.assign(Re, { Group: Ge$1, Label: Ae, Description: Fe$1 });
let L = "textarea";
function H(a3, t2) {
  let s2 = _global_window_wp_element_useId(), l2 = u$d(), d2 = a$f(), { id: i2 = l2 || `headlessui-textarea-${s2}`, disabled: e2 = d2 || false, autoFocus: r2 = false, invalid: o4 = false, ...p2 } = a3, n2 = N$1(), T3 = w$6(), { isFocused: f2, focusProps: m3 } = $0c4a58759813079a$export$4e328f61c538687f({ autoFocus: r2 }), { isHovered: u2, hoverProps: b2 } = $e969f22b6713ca4a$export$ae780daf29e6d456({ isDisabled: e2 }), y2 = V$2({ ref: t2, id: i2, "aria-labelledby": n2, "aria-describedby": T3, "aria-invalid": o4 ? "true" : void 0, disabled: e2 || void 0, autoFocus: r2 }, m3, b2), x2 = n$5({ disabled: e2, invalid: o4, hover: u2, focus: f2, autofocus: r2 });
  return K$1()({ ourProps: y2, theirProps: p2, slot: x2, defaultTag: L, name: "Textarea" });
}
let M = Y$1(H);
const toKebabCase$1 = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
const toCamelCase$1 = (string) => string.replace(
  /^([A-Z])|[\s-_]+(\w)/g,
  (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
);
const toPascalCase$1 = (string) => {
  const camelCase = toCamelCase$1(string);
  return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
};
const mergeClasses$1 = (...classes) => classes.filter((className, index2, array) => {
  return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
}).join(" ").trim();
const hasA11yProp$1 = (props) => {
  for (const prop in props) {
    if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
      return true;
    }
  }
};
var defaultAttributes$1 = {
  xmlns: "http://www.w3.org/2000/svg",
  width: 24,
  height: 24,
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  strokeWidth: 2,
  strokeLinecap: "round",
  strokeLinejoin: "round"
};
const Icon$1 = window.wp.element.forwardRef(
  ({
    color = "currentColor",
    size: size2 = 24,
    strokeWidth = 2,
    absoluteStrokeWidth,
    className = "",
    children,
    iconNode,
    ...rest
  }, ref) => window.wp.element.createElement(
    "svg",
    {
      ref,
      ...defaultAttributes$1,
      width: size2,
      height: size2,
      stroke: color,
      strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size2) : strokeWidth,
      className: mergeClasses$1("lucide", className),
      ...!children && !hasA11yProp$1(rest) && { "aria-hidden": "true" },
      ...rest
    },
    [
      ...iconNode.map(([tag, attrs]) => window.wp.element.createElement(tag, attrs)),
      ...Array.isArray(children) ? children : [children]
    ]
  )
);
const createLucideIcon$1 = (iconName, iconNode) => {
  const Component = window.wp.element.forwardRef(
    ({ className, ...props }, ref) => window.wp.element.createElement(Icon$1, {
      ref,
      iconNode,
      className: mergeClasses$1(
        `lucide-${toKebabCase$1(toPascalCase$1(iconName))}`,
        `lucide-${iconName}`,
        className
      ),
      ...props
    })
  );
  Component.displayName = toPascalCase$1(iconName);
  return Component;
};
const __iconNode$2B = [
  ["path", { d: "M5 3h14", key: "7usisc" }],
  ["path", { d: "m18 13-6-6-6 6", key: "1kf1n9" }],
  ["path", { d: "M12 7v14", key: "1akyts" }]
];
const ArrowUpToLine = createLucideIcon$1("arrow-up-to-line", __iconNode$2B);
const __iconNode$2A = [
  ["path", { d: "M18 6 7 17l-5-5", key: "116fxf" }],
  ["path", { d: "m22 10-7.5 7.5L13 16", key: "ke71qq" }]
];
const CheckCheck = createLucideIcon$1("check-check", __iconNode$2A);
const __iconNode$2z = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
const Check$1 = createLucideIcon$1("check", __iconNode$2z);
const __iconNode$2y = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
const ChevronDown$1 = createLucideIcon$1("chevron-down", __iconNode$2y);
const __iconNode$2x = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
const ChevronRight$1 = createLucideIcon$1("chevron-right", __iconNode$2x);
const __iconNode$2w = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
const ChevronUp$1 = createLucideIcon$1("chevron-up", __iconNode$2w);
const __iconNode$2v = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
];
const CircleAlert$1 = createLucideIcon$1("circle-alert", __iconNode$2v);
const __iconNode$2u = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
];
const CircleCheck$1 = createLucideIcon$1("circle-check", __iconNode$2u);
const __iconNode$2t = [
  ["path", { d: "M12 13v8", key: "1l5pq0" }],
  ["path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242", key: "1pljnt" }],
  ["path", { d: "m8 17 4-4 4 4", key: "1quai1" }]
];
const CloudUpload = createLucideIcon$1("cloud-upload", __iconNode$2t);
const __iconNode$2s = [
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
];
const Copy$1 = createLucideIcon$1("copy", __iconNode$2s);
const __iconNode$2r = [
  ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
  ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
  ["path", { d: "M12 18v-6", key: "17g6i2" }],
  ["path", { d: "m9 15 3 3 3-3", key: "1npd3o" }]
];
const FileDown = createLucideIcon$1("file-down", __iconNode$2r);
const __iconNode$2q = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
];
const Globe$1 = createLucideIcon$1("globe", __iconNode$2q);
const __iconNode$2p = [
  ["path", { d: "M16 5h6", key: "1vod17" }],
  ["path", { d: "M19 2v6", key: "4bpg5p" }],
  ["path", { d: "M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5", key: "1ue2ih" }],
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
];
const ImagePlus = createLucideIcon$1("image-plus", __iconNode$2p);
const __iconNode$2o = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M12 16v-4", key: "1dtifu" }],
  ["path", { d: "M12 8h.01", key: "e9boi3" }]
];
const Info$1 = createLucideIcon$1("info", __iconNode$2o);
const __iconNode$2n = [
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
];
const Link2$1 = createLucideIcon$1("link-2", __iconNode$2n);
const __iconNode$2m = [
  ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
  ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
];
const Link$1 = createLucideIcon$1("link", __iconNode$2m);
const __iconNode$2l = [
  ["path", { d: "M21 12h-8", key: "1bmf0i" }],
  ["path", { d: "M21 6H8", key: "1pqkrb" }],
  ["path", { d: "M21 18h-8", key: "1tm79t" }],
  ["path", { d: "M3 6v4c0 1.1.9 2 2 2h3", key: "1ywdgy" }],
  ["path", { d: "M3 10v6c0 1.1.9 2 2 2h3", key: "2wc746" }]
];
const ListTree = createLucideIcon$1("list-tree", __iconNode$2l);
const __iconNode$2k = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
const LoaderCircle$1 = createLucideIcon$1("loader-circle", __iconNode$2k);
const __iconNode$2j = [
  ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
];
const Lock$1 = createLucideIcon$1("lock", __iconNode$2j);
const __iconNode$2i = [["path", { d: "m8 3 4 8 5-5 5 15H2L8 3z", key: "otkl63" }]];
const Mountain = createLucideIcon$1("mountain", __iconNode$2i);
const __iconNode$2h = [
  [
    "path",
    {
      d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
      key: "1miecu"
    }
  ]
];
const Paperclip$1 = createLucideIcon$1("paperclip", __iconNode$2h);
const __iconNode$2g = [
  ["path", { d: "M5 12h14", key: "1ays0h" }],
  ["path", { d: "M12 5v14", key: "s699le" }]
];
const Plus$1 = createLucideIcon$1("plus", __iconNode$2g);
const __iconNode$2f = [
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
];
const RefreshCw$1 = createLucideIcon$1("refresh-cw", __iconNode$2f);
const __iconNode$2e = [
  ["path", { d: "m13.5 8.5-5 5", key: "1cs55j" }],
  ["path", { d: "m8.5 8.5 5 5", key: "a8mexj" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
];
const SearchX$1 = createLucideIcon$1("search-x", __iconNode$2e);
const __iconNode$2d = [
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
];
const Search$1 = createLucideIcon$1("search", __iconNode$2d);
const __iconNode$2c = [
  [
    "path",
    {
      d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
      key: "oel41y"
    }
  ],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
];
const ShieldCheck$1 = createLucideIcon$1("shield-check", __iconNode$2c);
const __iconNode$2b = [
  [
    "path",
    {
      d: "M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",
      key: "1s2grr"
    }
  ],
  ["path", { d: "M20 2v4", key: "1rf3ol" }],
  ["path", { d: "M22 4h-4", key: "gwowj6" }],
  ["circle", { cx: "4", cy: "20", r: "2", key: "6kqj1y" }]
];
const Sparkles$1 = createLucideIcon$1("sparkles", __iconNode$2b);
const __iconNode$2a = [
  ["polyline", { points: "14.5 17.5 3 6 3 3 6 3 17.5 14.5", key: "1hfsw2" }],
  ["line", { x1: "13", x2: "19", y1: "19", y2: "13", key: "1vrmhu" }],
  ["line", { x1: "16", x2: "20", y1: "16", y2: "20", key: "1bron3" }],
  ["line", { x1: "19", x2: "21", y1: "21", y2: "19", key: "13pww6" }],
  ["polyline", { points: "14.5 6.5 18 3 21 3 21 6 17.5 9.5", key: "hbey2j" }],
  ["line", { x1: "5", x2: "9", y1: "14", y2: "18", key: "1hf58s" }],
  ["line", { x1: "7", x2: "4", y1: "17", y2: "20", key: "pidxm4" }],
  ["line", { x1: "3", x2: "5", y1: "19", y2: "21", key: "1pehsh" }]
];
const Swords = createLucideIcon$1("swords", __iconNode$2a);
const __iconNode$29 = [
  ["path", { d: "M10 11v6", key: "nco0om" }],
  ["path", { d: "M14 11v6", key: "outv1u" }],
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
];
const Trash2$1 = createLucideIcon$1("trash-2", __iconNode$29);
const __iconNode$28 = [
  ["path", { d: "M16 7h6v6", key: "box55l" }],
  ["path", { d: "m22 7-8.5 8.5-5-5L2 17", key: "1t1m79" }]
];
const TrendingUp$1 = createLucideIcon$1("trending-up", __iconNode$28);
const __iconNode$27 = [
  [
    "path",
    {
      d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
      key: "wmoenq"
    }
  ],
  ["path", { d: "M12 9v4", key: "juzpu7" }],
  ["path", { d: "M12 17h.01", key: "p32p05" }]
];
const TriangleAlert$1 = createLucideIcon$1("triangle-alert", __iconNode$27);
const __iconNode$26 = [
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
];
const X$1 = createLucideIcon$1("x", __iconNode$26);
const qr = me$1(
  "relative flex shrink-0 overflow-hidden rounded-full",
  {
    variants: {
      size: {
        sm: "h-6 w-6 text-xs",
        md: "h-9 w-9 text-sm",
        lg: "h-12 w-12 text-base",
        xl: "h-16 w-16 text-lg"
      }
    },
    defaultVariants: {
      size: "md"
    }
  }
), pt = window.wp.element.forwardRef(
  ({ className: t2, size: r2, ...a3 }, i2) => /* @__PURE__ */ window.wp.element.jsx("span", { ref: i2, className: B$1(qr({ size: r2 }), t2), ...a3 })
);
pt.displayName = "Avatar";
const ht = window.wp.element.forwardRef(
  ({ className: t2, ...r2 }, a3) => /* @__PURE__ */ window.wp.element.jsx("img", { ref: a3, className: B$1("aspect-square h-full w-full", t2), alt: "", ...r2 })
);
ht.displayName = "AvatarImage";
const bt = window.wp.element.forwardRef(
  ({ className: t2, ...r2 }, a3) => /* @__PURE__ */ window.wp.element.jsx(
    "span",
    {
      ref: a3,
      className: B$1(
        "flex h-full w-full items-center justify-center rounded-full bg-neutral-200 font-semibold text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",
        t2
      ),
      ...r2
    }
  )
);
bt.displayName = "AvatarFallback";
Object.assign(pt, {
  Image: ht,
  Fallback: bt
});
const xt = window.wp.element.createContext({ size: "md" }), gt = ({
  open: t2,
  onClose: r2,
  children: a3,
  size: i2 = "md"
}) => /* @__PURE__ */ window.wp.element.jsx(xt.Provider, { value: { size: i2 }, children: /* @__PURE__ */ window.wp.element.jsx(Ke$2, { appear: true, show: t2, as: window.wp.element.Fragment, children: /* @__PURE__ */ window.wp.element.jsxs(ht$3, { onClose: r2, className: "relative z-[100050]", children: [
  /* @__PURE__ */ window.wp.element.jsx(
    Ke$2.Child,
    {
      as: window.wp.element.Fragment,
      enter: "duration-slow ease-out",
      enterFrom: "opacity-0",
      enterTo: "opacity-100",
      leave: "duration-normal ease-in",
      leaveFrom: "opacity-100",
      leaveTo: "opacity-0",
      children: /* @__PURE__ */ window.wp.element.jsx(
        "div",
        {
          className: "fixed inset-0 bg-neutral-900/40 backdrop-blur-md",
          "aria-hidden": "true"
        }
      )
    }
  ),
  /* @__PURE__ */ window.wp.element.jsx("div", { className: "fixed inset-0 flex w-screen items-center justify-center p-4", children: a3 })
] }) }) });
gt.displayName = "Dialog.Root";
const ft = window.wp.element.forwardRef(
  (t2, r2) => /* @__PURE__ */ window.wp.element.jsx(tr$1, { ref: r2, ...t2 })
);
ft.displayName = "Dialog.Trigger";
const kt = window.wp.element.forwardRef(
  ({ className: t2, children: r2, ...a3 }, i2) => {
    const { size: s2 } = window.wp.element.useContext(xt);
    return (
      // Panel entrance — design guide 5.4: --duration-slow (400ms) --ease-out enter
      /* @__PURE__ */ window.wp.element.jsx(
        Ke$2.Child,
        {
          as: window.wp.element.Fragment,
          enter: "duration-slow ease-out",
          enterFrom: "opacity-0 scale-95 translate-y-4 sm:translate-y-0",
          enterTo: "opacity-100 scale-100 translate-y-0",
          leave: "duration-normal ease-in",
          leaveFrom: "opacity-100 scale-100 translate-y-0",
          leaveTo: "opacity-0 scale-95 translate-y-4 sm:translate-y-0",
          children: /* @__PURE__ */ window.wp.element.jsx(
            ze,
            {
              ref: i2,
              className: B$1(
                // Frosted glass panel — design guide 5.4 target
                "relative transform overflow-hidden rounded-2xl border p-6 text-left",
                "border-neutral-200 bg-white/95 backdrop-blur-xl",
                // Elevation Level 3 — overlay shadow
                "shadow-[0_8px_16px_-4px_rgba(0,0,0,0.08),0_24px_48px_-8px_rgba(0,0,0,0.16)]",
                "transition-all",
                // Dark mode — frosted glass + glass-edge highlight
                "dark:border-neutral-700 dark:bg-neutral-800/95 dark:backdrop-blur-xl",
                "dark:ring-1 dark:ring-white/[0.08] dark:shadow-2xl dark:shadow-black/40",
                {
                  "w-full max-w-md": s2 === "md",
                  "w-full max-w-2xl": s2 === "lg",
                  "w-full max-w-4xl": s2 === "xl"
                },
                t2
              ),
              ...a3,
              children: r2
            }
          )
        }
      )
    );
  }
);
kt.displayName = "Dialog.Content";
const vt = ({ className: t2, ...r2 }) => /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("mb-5 text-center sm:text-left", t2), ...r2 });
vt.displayName = "Dialog.Header";
const wt = window.wp.element.forwardRef(
  ({ className: t2, ...r2 }, a3) => /* @__PURE__ */ window.wp.element.jsx(
    Qe,
    {
      ref: a3,
      className: B$1(
        "font-display m-0! text-xl leading-6 font-bold tracking-tight text-neutral-900 dark:text-white",
        t2
      ),
      ...r2
    }
  )
);
wt.displayName = "Dialog.Title";
const yt = window.wp.element.forwardRef(({ className: t2, ...r2 }, a3) => /* @__PURE__ */ window.wp.element.jsx(
  M$5,
  {
    ref: a3,
    className: B$1("mt-2 mb-0! text-sm text-neutral-500 dark:text-neutral-400", t2),
    ...r2
  }
));
yt.displayName = "Dialog.Description";
const Nt = ({ className: t2, ...r2 }) => /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("mt-4", t2), ...r2 });
Nt.displayName = "Dialog.Body";
const Ct = ({ className: t2, ...r2 }) => (
  // flex-wrap: buttons never shrink (`text-nowrap`) and the panel clips
  // (`overflow-hidden`), so a footer row that outgrows a `md` panel —
  // long labels, longer de/fr translations — must wrap to a second row
  // instead of cutting the primary CTA off at the panel edge.
  /* @__PURE__ */ window.wp.element.jsx(
    "div",
    {
      className: B$1(
        "mt-8 flex flex-col-reverse gap-3 sm:flex-row sm:flex-wrap sm:justify-end",
        t2
      ),
      ...r2
    }
  )
);
Ct.displayName = "Dialog.Footer";
const Lt = window.wp.element.forwardRef(
  ({ ...t2 }, r2) => /* @__PURE__ */ window.wp.element.jsx(Ut$1, { ref: r2, ...t2 })
);
Lt.displayName = "Dialog.Close";
const Y = {
  Root: gt,
  Content: kt,
  Header: vt,
  Title: wt,
  Description: yt,
  Body: Nt,
  Footer: Ct
}, Dn = ({
  isOpen: t2,
  onClose: r2,
  onConfirm: a3,
  title: i2,
  description: s2,
  variant: d2 = "primary",
  size: c2 = "md",
  children: n2,
  loading: u2 = false,
  confirmButtonProps: p2 = {},
  cancelButtonProps: b2 = {}
}) => {
  const m3 = d2 === "danger" ? TriangleAlert$1 : ShieldCheck$1, v2 = p2.label || "Confirm", g2 = p2.variant || (d2 === "danger" ? "danger" : "primary"), C2 = b2.label || "Cancel";
  return /* @__PURE__ */ window.wp.element.jsx(Y.Root, { open: t2, onClose: r2, size: c2, children: /* @__PURE__ */ window.wp.element.jsxs(Y.Content, { children: [
    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex gap-4", children: [
      /* @__PURE__ */ window.wp.element.jsx(
        "div",
        {
          className: B$1(
            "mx-auto flex h-12 w-12 shrink-0 items-center justify-center rounded-full sm:mx-0",
            d2 === "danger" ? "bg-red-50 dark:bg-red-900/20" : "bg-emerald-50 dark:bg-emerald-900/20"
          ),
          children: /* @__PURE__ */ window.wp.element.jsx(
            m3,
            {
              className: B$1(
                "h-6 w-6",
                d2 === "danger" ? "text-red-600 dark:text-red-400" : "text-emerald-600 dark:text-emerald-400"
              ),
              "aria-hidden": "true"
            }
          )
        }
      ),
      /* @__PURE__ */ window.wp.element.jsxs("div", { className: "grow", children: [
        /* @__PURE__ */ window.wp.element.jsx(Y.Header, { className: "mb-2 text-left", children: /* @__PURE__ */ window.wp.element.jsx(Y.Title, { children: i2 }) }),
        /* @__PURE__ */ window.wp.element.jsx(Y.Description, { children: s2 }),
        n2
      ] })
    ] }),
    /* @__PURE__ */ window.wp.element.jsxs(Y.Footer, { children: [
      /* @__PURE__ */ window.wp.element.jsx(tr$1, { variant: "secondary", onClick: r2, disabled: u2, children: C2 }),
      /* @__PURE__ */ window.wp.element.jsxs(tr$1, { variant: g2, onClick: a3, loading: u2, children: [
        p2.icon && /* @__PURE__ */ window.wp.element.jsx("span", { className: "mr-2", children: p2.icon }),
        u2 ? "Loading..." : v2
      ] })
    ] })
  ] }) });
}, ee = 8;
function Yr(t2, r2, a3) {
  let i2 = 0, s2 = 0;
  switch (a3) {
    case "top":
      i2 = t2.top - r2.height - ee, s2 = t2.left + (t2.width - r2.width) / 2;
      break;
    case "top-start":
      i2 = t2.top - r2.height - ee, s2 = t2.left;
      break;
    case "top-end":
      i2 = t2.top - r2.height - ee, s2 = t2.right - r2.width;
      break;
    case "bottom":
      i2 = t2.bottom + ee, s2 = t2.left + (t2.width - r2.width) / 2;
      break;
    case "bottom-start":
      i2 = t2.bottom + ee, s2 = t2.left;
      break;
    case "bottom-end":
      i2 = t2.bottom + ee, s2 = t2.right - r2.width;
      break;
    case "left":
      i2 = t2.top + (t2.height - r2.height) / 2, s2 = t2.left - r2.width - ee;
      break;
    case "left-start":
      i2 = t2.top, s2 = t2.left - r2.width - ee;
      break;
    case "left-end":
      i2 = t2.bottom - r2.height, s2 = t2.left - r2.width - ee;
      break;
    case "right":
      i2 = t2.top + (t2.height - r2.height) / 2, s2 = t2.right + ee;
      break;
    case "right-start":
      i2 = t2.top, s2 = t2.right + ee;
      break;
    case "right-end":
      i2 = t2.bottom - r2.height, s2 = t2.right + ee;
      break;
  }
  return { top: i2, left: s2 };
}
const ce = ({
  children: t2,
  title: r2,
  position: a3 = "bottom",
  className: i2 = ""
}) => {
  const s2 = window.wp.element.useRef(null), d2 = window.wp.element.useRef(null), [c2, n2] = window.wp.element.useState(false), u2 = window.wp.element.useRef(er$1()).current, p2 = () => n2(true), b2 = () => n2(false);
  window.wp.element.useEffect(() => {
    if (!c2 || !s2.current) return;
    const N2 = s2.current, D2 = d2.current, k2 = () => {
      const S2 = N2.getBoundingClientRect(), I2 = D2.getBoundingClientRect(), { top: B2, left: R2 } = Yr(
        S2,
        I2,
        a3
      );
      D2.style.top = `${B2}px`, D2.style.left = `${R2}px`;
    };
    k2();
    const _2 = new ResizeObserver(k2);
    return _2.observe(N2), window.addEventListener("scroll", k2, true), window.addEventListener("resize", k2), () => {
      _2.disconnect(), window.removeEventListener("scroll", k2, true), window.removeEventListener("resize", k2);
    };
  }, [c2, a3]);
  function m3(N2, D2) {
    return (k2) => {
      t2.props[N2]?.(k2), D2(k2);
    };
  }
  const v2 = {
    onMouseEnter: m3("onMouseEnter", (N2) => {
      s2.current = N2.currentTarget, p2();
    }),
    onMouseLeave: m3("onMouseLeave", b2),
    onFocus: m3("onFocus", (N2) => {
      s2.current = N2.currentTarget, p2();
    }),
    onBlur: m3("onBlur", b2),
    "aria-describedby": u2,
    // Pass the forwarded ref if the child supports it – harmless if not
    ref: (N2) => {
      s2.current = N2;
      const { ref: D2 } = t2;
      typeof D2 == "function" ? D2(N2) : D2 && typeof D2 == "object" && (D2.current = N2);
    }
  }, g2 = window.wp.element.cloneElement(t2, v2), C2 = c2 && typeof document < "u" && window.wp.element.createPortal(
    /* @__PURE__ */ window.wp.element.jsx(
      "div",
      {
        ref: d2,
        role: "tooltip",
        id: u2,
        className: B$1(
          // Design guide 6.1: rounded-lg minimum. Dark surface with glass-edge.
          "pointer-events-none fixed z-50 rounded-lg bg-neutral-900 px-2.5 py-1.5 text-xs text-white shadow-lg ring-1 ring-white/[0.08]",
          i2
        ),
        style: { top: 0, left: 0 },
        children: r2
      }
    ),
    document.body
  );
  return /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
    g2,
    C2
  ] });
}, Xr = me$1(
  [
    // Layout — shape only. Padding moves into the size axis so `sm`
    // can breathe a little more than `xs`.
    "inline-flex items-center gap-1 rounded-full",
    // Transitions — spring easing for badge pop (design guide 6.4)
    "transition-all duration-normal ease-spring",
    // Focus — soft glow pattern (design guide 6.5). Still applies in
    // the Link-wrapped configuration used by blog taxonomy chips —
    // consumers who want the focus ring on the wrapper instead pass
    // `tabIndex={-1}` + `className="focus:ring-0"` to the Badge.
    "focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)]"
  ],
  {
    variants: {
      intent: {
        default: "bg-neutral-100 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-300",
        primary: "bg-brand-600 text-white shadow-sm dark:bg-brand-500",
        success: "bg-emerald-50 text-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-300",
        secondary: "bg-neutral-900 text-white dark:bg-neutral-100 dark:text-neutral-900",
        destructive: "bg-red-50 text-red-700 dark:bg-red-950/30 dark:text-red-300",
        warning: "bg-amber-50 text-amber-700 dark:bg-amber-950/30 dark:text-amber-300",
        info: "bg-blue-50 text-blue-700 dark:bg-blue-950/30 dark:text-blue-300",
        premium: "bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300",
        indigo: "bg-brand-50 text-brand-700 dark:bg-brand-950/30 dark:text-brand-300",
        orange: "bg-orange-50 text-orange-700 dark:bg-orange-950/30 dark:text-orange-300"
      },
      variant: {
        solid: "border border-transparent",
        // `bg-transparent!` + `dark:bg-transparent!` on purpose: the
        // `intent` axis above emits a paired `bg-*`/`dark:bg-*` for every
        // semantic (e.g. primary = `bg-brand-600 dark:bg-brand-500`).
        // Those classes are meant for the solid variant but always make
        // it onto the element regardless of `variant`, and Tailwind's
        // utility ordering puts keyword backgrounds like `bg-transparent`
        // *before* named-color backgrounds within the same bucket — so
        // the more-specific `dark:bg-brand-500` wins in dark mode and the
        // outline chip renders as a solid pill with dark-on-dark text.
        // (Reported 2026-04-24 — category chips on
        // `/en/blog/best-wordpress-ai-content-automation-for-agencies`
        // appeared as filled indigo blocks.) Using the `!` suffix is the
        // cheapest surgical fix: it hoists both background declarations
        // above the intent pair without restructuring the axis, and
        // matches the `m-0!` pattern the SPA uses to punch through
        // wp-admin's margin cascade.
        outline: "bg-transparent! dark:bg-transparent! border"
      },
      size: {
        // Status-chrome scale (default). Matches the pre-size-axis
        // rendering exactly — byte-identical output with every
        // existing `<Badge intent="..." variant="...">` call-site.
        xs: "px-2.5 py-1 text-[10px] uppercase font-bold leading-none tracking-wide",
        // Topic-label scale (new, see spec §10.1). Mixed-case, less
        // aggressive tracking, slightly larger. Used by blog
        // category/tag surfaces and future channel-filter chips.
        sm: "px-3 py-1 text-xs normal-case font-semibold leading-tight tracking-normal"
      }
    },
    compoundVariants: [
      // ─── Outline Variants ────────────────────────────────────────────
      {
        variant: "outline",
        intent: "default",
        className: "border-neutral-200 text-neutral-600 dark:border-neutral-700 dark:text-neutral-400"
      },
      {
        variant: "outline",
        intent: "primary",
        className: "border-brand-300 text-brand-600 dark:border-brand-500/40 dark:text-brand-400"
      },
      {
        variant: "outline",
        intent: "success",
        className: "border-emerald-200 text-emerald-700 dark:border-emerald-800 dark:text-emerald-400"
      },
      {
        variant: "outline",
        intent: "secondary",
        className: "border-neutral-900 text-neutral-900 dark:border-neutral-300 dark:text-neutral-100"
      },
      {
        variant: "outline",
        intent: "destructive",
        className: "border-red-200 text-red-700 dark:border-red-800 dark:text-red-400"
      },
      {
        variant: "outline",
        intent: "warning",
        className: "border-amber-200 text-amber-700 dark:border-amber-800 dark:text-amber-400"
      },
      {
        variant: "outline",
        intent: "info",
        className: "border-blue-200 text-blue-700 dark:border-blue-800 dark:text-blue-400"
      },
      {
        variant: "outline",
        intent: "premium",
        className: "border-purple-200 text-purple-700 dark:border-purple-800 dark:text-purple-400"
      },
      {
        variant: "outline",
        intent: "indigo",
        className: "border-brand-200 text-brand-700 dark:border-brand-800 dark:text-brand-400"
      },
      {
        variant: "outline",
        intent: "orange",
        className: "border-orange-200 text-orange-700 dark:border-orange-800 dark:text-orange-400"
      },
      // ─── Solid Variants (border + dark mode glass-edge) ─────────────
      {
        variant: "solid",
        intent: "default",
        className: "border-neutral-200 dark:border-neutral-700 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "primary",
        className: "border-brand-700 dark:border-brand-400 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "success",
        className: "border-emerald-100 dark:border-emerald-900/50 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "secondary",
        className: "border-neutral-800 dark:border-neutral-200 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "destructive",
        className: "border-red-100 dark:border-red-900/50 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "warning",
        className: "border-amber-100 dark:border-amber-900/50 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "info",
        className: "border-blue-100 dark:border-blue-900/50 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "premium",
        className: "border-purple-100 dark:border-purple-900/50 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "indigo",
        className: "border-brand-100 dark:border-brand-900/50 dark:ring-1 dark:ring-white/[0.04]"
      },
      {
        variant: "solid",
        intent: "orange",
        className: "border-orange-100 dark:border-orange-900/50 dark:ring-1 dark:ring-white/[0.04]"
      }
    ],
    defaultVariants: {
      intent: "default",
      variant: "solid",
      size: "xs"
    }
  }
), Me = window.wp.element.forwardRef(
  ({ className: t2, intent: r2, variant: a3, size: i2, dot: s2, dotPulse: d2, children: c2, ...n2 }, u2) => /* @__PURE__ */ window.wp.element.jsxs(
    "span",
    {
      ref: u2,
      className: B$1(Xr({ intent: r2, variant: a3, size: i2 }), t2),
      ...n2,
      children: [
        (s2 || d2) && /* @__PURE__ */ window.wp.element.jsx(
          "span",
          {
            "data-badge-dot": "",
            "aria-hidden": "true",
            className: B$1(
              "size-1.5 shrink-0 rounded-full bg-current",
              d2 && "animate-pulse-dot motion-reduce:animate-none"
            )
          }
        ),
        c2
      ]
    }
  )
);
Me.displayName = "Badge";
const Tt = ({ children: t2, className: r2, ...a3 }) => {
  const i2 = window.wp.element.Children.toArray(t2).filter(Boolean);
  return /* @__PURE__ */ window.wp.element.jsx(
    "nav",
    {
      "aria-label": a3["aria-label"],
      className: B$1("min-w-0", r2),
      children: /* @__PURE__ */ window.wp.element.jsx("ol", { className: "flex min-w-0 items-center gap-1.5 text-xs font-semibold text-neutral-400 dark:text-neutral-500", children: i2.map((s2, d2) => /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
        d2 > 0 && /* @__PURE__ */ window.wp.element.jsx(
          "li",
          {
            "aria-hidden": "true",
            "data-breadcrumb-separator": "",
            className: "flex shrink-0 items-center text-neutral-300 dark:text-neutral-600",
            children: /* @__PURE__ */ window.wp.element.jsx(ChevronRight$1, { size: 12 })
          }
        ),
        s2
      ] }, d2)) })
    }
  );
};
Tt.displayName = "Breadcrumbs";
const _t = ({ children: t2, current: r2, asChild: a3, className: i2 }) => {
  if (r2)
    return /* @__PURE__ */ window.wp.element.jsx("li", { className: "flex min-w-0 items-center", children: /* @__PURE__ */ window.wp.element.jsx(
      "span",
      {
        "aria-current": "page",
        className: B$1("truncate text-neutral-600 dark:text-neutral-300", i2),
        children: t2
      }
    ) });
  const s2 = B$1(
    "shrink-0 transition-colors hover:text-neutral-600 dark:hover:text-neutral-300",
    i2
  );
  return /* @__PURE__ */ window.wp.element.jsx("li", { className: "flex shrink-0 items-center", children: a3 ? /* @__PURE__ */ window.wp.element.jsx(Ut$1, { className: s2, children: t2 }) : /* @__PURE__ */ window.wp.element.jsx("span", { className: s2, children: t2 }) });
};
_t.displayName = "Breadcrumbs.Item";
Object.assign(Tt, { Item: _t });
const Qr = me$1(
  [
    "pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border p-4 shadow-lg",
    // Transitions — ease-out for entrance, ease-in for exit
    "transition-all duration-300 ease-out",
    // Headless UI animation states
    "data-[state=open]:animate-in data-[state=closed]:animate-out",
    "data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full",
    "data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
    // Thick left border for severity indicator
    "border-l-[6px]"
  ].join(" "),
  {
    variants: {
      intent: {
        default: "bg-white border-gray-200 border-l-gray-500 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:border-l-gray-500 dark:text-gray-100 dark:ring-1 dark:ring-white/[0.04]",
        success: "bg-white border-gray-200 border-l-emerald-500 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:border-l-emerald-500 dark:text-gray-100 dark:ring-1 dark:ring-white/[0.04]",
        error: "bg-white border-gray-200 border-l-red-500 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:border-l-red-500 dark:text-gray-100 dark:ring-1 dark:ring-white/[0.04]",
        warning: "bg-white border-gray-200 border-l-amber-500 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:border-l-amber-500 dark:text-gray-100 dark:ring-1 dark:ring-white/[0.04]",
        info: "bg-white border-gray-200 border-l-brand-500 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:border-l-brand-500 dark:text-gray-100 dark:ring-1 dark:ring-white/[0.04]"
      }
    },
    defaultVariants: {
      intent: "default"
    }
  }
), Jr = {
  default: "text-gray-500 dark:text-gray-400",
  success: "text-emerald-500 dark:text-emerald-400",
  error: "text-red-500 dark:text-red-400",
  warning: "text-amber-500 dark:text-amber-400",
  info: "text-brand-500 dark:text-brand-400"
}, Ke = {
  success: CircleCheck$1,
  error: CircleAlert$1,
  warning: TriangleAlert$1,
  info: Info$1,
  default: Info$1
}, ea = 300, ta = window.wp.element.memo(function({
  id: r2,
  title: a3,
  message: i2,
  severity: s2 = "default",
  // Defaulting to avoid undefined
  duration: d2,
  action: c2,
  dismissible: n2,
  onDismiss: u2
}) {
  const [p2, b2] = window.wp.element.useState(false), [m3, v2] = window.wp.element.useState(false), [g2, C2] = window.wp.element.useState(null), N2 = window.wp.element.useCallback(() => {
    b2(false), setTimeout(() => u2(r2), ea);
  }, [r2, u2]);
  window.wp.element.useEffect(() => {
    const k2 = setTimeout(() => b2(true), 10);
    return () => clearTimeout(k2);
  }, []), window.wp.element.useEffect(() => {
    if (m3 || !d2) {
      g2 && (clearTimeout(g2), C2(null));
      return;
    }
    const k2 = setTimeout(() => {
      N2();
    }, d2);
    return C2(k2), () => {
      clearTimeout(k2);
    };
  }, [r2, d2, N2, m3]);
  const D2 = Ke[s2] || Ke.default;
  return /* @__PURE__ */ window.wp.element.jsxs(
    "div",
    {
      role: "status",
      "aria-live": "polite",
      onMouseEnter: () => v2(true),
      onMouseLeave: () => v2(false),
      className: B$1(
        Qr({ intent: s2 }),
        p2 ? "translate-x-0 opacity-100" : "translate-x-4 opacity-0"
      ),
      children: [
        /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("mt-0.5 shrink-0", Jr[s2]), children: /* @__PURE__ */ window.wp.element.jsx(D2, { size: 20, strokeWidth: 2.5 }) }),
        /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1", children: [
          a3 && /* @__PURE__ */ window.wp.element.jsx("div", { className: "mb-1 text-sm leading-tight font-bold", children: a3 }),
          /* @__PURE__ */ window.wp.element.jsx("div", { className: "text-sm leading-relaxed text-neutral-600 dark:text-neutral-300", children: i2 }),
          c2 && /* @__PURE__ */ window.wp.element.jsx(
            "button",
            {
              onClick: c2.onClick,
              className: "mt-3 cursor-pointer text-xs font-bold tracking-wide text-neutral-900 uppercase hover:underline focus-visible:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)] rounded dark:text-white",
              children: c2.label
            }
          )
        ] }),
        n2 && /* @__PURE__ */ window.wp.element.jsx(
          "button",
          {
            "aria-label": "Close",
            onClick: N2,
            className: "-mt-1 -mr-1 shrink-0 cursor-pointer rounded-lg p-1.5 text-neutral-400 transition-all duration-fast ease-out hover:bg-neutral-100 hover:text-neutral-900 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)] dark:hover:bg-neutral-800 dark:hover:text-white",
            children: /* @__PURE__ */ window.wp.element.jsx(X$1, { size: 16 })
          }
        )
      ]
    }
  );
}), ra = (t2) => ({
  "top-left": "top-8 left-0",
  "top-center": "top-8 left-1/2 -translate-x-1/2",
  "top-right": "top-8 right-0",
  "bottom-left": "bottom-0 left-0",
  "bottom-center": "bottom-0 left-1/2 -translate-x-1/2",
  "bottom-right": "bottom-0 right-0"
})[t2];
function aa({ toasts: t2, onDismiss: r2, placement: a3, offset: i2 = 4 }) {
  if (t2.length === 0)
    return null;
  const s2 = {
    padding: `${i2 * 0.25}rem`
  };
  return /* @__PURE__ */ window.wp.element.jsx(
    "div",
    {
      "aria-live": "assertive",
      "aria-atomic": "false",
      className: B$1(
        "pointer-events-none fixed z-100 flex w-full max-w-105 flex-col gap-3",
        // pointer-events-none lets clicks pass through gaps
        ra(a3),
        a3.includes("bottom") ? "flex-col-reverse" : "flex-col"
        // Stack direction
      ),
      style: s2,
      children: t2.map((d2) => /* @__PURE__ */ window.wp.element.jsx(ta, { ...d2, onDismiss: r2 }, d2.id))
    }
  );
}
class na {
  listeners = [];
  on = (r2) => {
    this.listeners.push(r2);
  };
  off = (r2) => {
    this.listeners = this.listeners.filter((a3) => a3 !== r2);
  };
  emit = (r2) => {
    this.listeners.forEach((a3) => a3(r2));
  };
}
const oe = new na(), An = {
  show: (t2) => oe.emit(t2),
  success: (t2, r2) => oe.emit({ ...r2, message: t2, severity: "success" }),
  error: (t2, r2) => oe.emit({ ...r2, message: t2, severity: "error" }),
  warning: (t2, r2) => oe.emit({ ...r2, message: t2, severity: "warning" }),
  info: (t2, r2) => oe.emit({ ...r2, message: t2, severity: "info" })
}, He = oe, Rt = window.wp.element.createContext(null), la = 5e3, ia = 5, sa = 4;
function Sn({
  children: t2,
  placement: r2 = "top-right",
  defaultDuration: a3 = la,
  maxToasts: i2 = ia,
  offset: s2 = sa
}) {
  const [d2, c2] = window.wp.element.useState([]), n2 = window.wp.element.useCallback(
    (b2) => {
      const m3 = er$1(), v2 = {
        id: m3,
        title: b2.title,
        message: b2.message,
        severity: b2.severity ?? "default",
        duration: b2.duration ?? a3,
        action: b2.action,
        dismissible: b2.dismissible ?? true
      };
      return c2((g2) => [...g2.length >= i2 ? g2.slice(1) : g2, v2]), m3;
    },
    [a3, i2]
  );
  window.wp.element.useEffect(() => {
    const b2 = (m3) => {
      n2(m3);
    };
    return He.on(b2), () => {
      He.off(b2);
    };
  }, [n2]);
  const u2 = window.wp.element.useCallback((b2) => {
    c2((m3) => m3.filter((v2) => v2.id !== b2));
  }, []), p2 = window.wp.element.useMemo(
    () => ({
      showToast: n2,
      dismissToast: u2,
      successToast: (b2, m3) => n2({ ...m3, message: b2, severity: "success" }),
      errorToast: (b2, m3) => n2({ ...m3, message: b2, severity: "error" }),
      warningToast: (b2, m3) => n2({ ...m3, message: b2, severity: "warning" }),
      infoToast: (b2, m3) => n2({ ...m3, message: b2, severity: "info" })
    }),
    [n2, u2]
  );
  return /* @__PURE__ */ window.wp.element.jsxs(Rt.Provider, { value: p2, children: [
    t2,
    typeof document < "u" && window.wp.element.createPortal(
      /* @__PURE__ */ window.wp.element.jsx(
        aa,
        {
          toasts: d2,
          onDismiss: u2,
          placement: r2,
          offset: s2
        }
      ),
      document.body
    )
  ] });
}
function Mn() {
  const t2 = window.wp.element.useContext(Rt);
  if (!t2)
    throw new Error("useToast must be used within a ToastProvider");
  return t2;
}
const da = me$1(
  [
    "relative w-full rounded-xl border p-4 shadow-sm",
    // Transitions — ease-out at duration-normal.
    "transition-all duration-normal ease-out",
    // 2-column grid: icon | content. The icon column is sized to
    // its child (auto), the content column takes the rest.
    "grid grid-cols-[auto_1fr] gap-x-3",
    // Icon: the only direct-child <svg>. Pinned to (row 1, col 1)
    // and given a consistent 20px box so callers don't have to
    // remember to size it. `mt-0.5` nudges the optical centre to
    // line up with the title's cap height.
    "[&>svg]:size-5 [&>svg]:row-start-1 [&>svg]:col-start-1 [&>svg]:mt-0.5 [&>svg]:shrink-0",
    // Non-svg direct children flow into column 2. `min-w-0` lets
    // long text wrap instead of forcing the grid track to grow.
    "[&>:not(svg)]:col-start-2 [&>:not(svg)]:min-w-0",
    // No icon? Let content span both columns so left-padding
    // isn't visually orphaned.
    "[&:not(:has(>svg))>*]:col-start-1 [&:not(:has(>svg))>*]:col-end-3",
    // Links inside the alert inherit the variant text colour with
    // an underline, overriding WordPress admin's global `a` blue
    // and visited-purple. `!` wins specificity against wp-admin's
    // `.wrap a, #wpbody-content a, …` selectors.
    "[&_a:not(.button)]:font-medium [&_a:not(.button)]:underline [&_a:not(.button)]:underline-offset-2",
    "[&_a:not(.button)]:text-current! [&_a:not(.button):visited]:text-current!",
    "[&_a:not(.button):hover]:text-current! [&_a:not(.button):hover]:opacity-80",
    "[&_a:not(.button):focus-visible]:outline-2 [&_a:not(.button):focus-visible]:outline-offset-2"
  ].join(" "),
  {
    variants: {
      variant: {
        default: "bg-white text-gray-800 border-gray-200 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-800 dark:ring-1 dark:ring-white/[0.04] [&>svg]:text-gray-500 dark:[&>svg]:text-gray-400",
        info: "bg-brand-50 text-brand-800 border-brand-100 dark:bg-brand-950/30 dark:text-brand-200 dark:border-brand-900/50 dark:ring-1 dark:ring-white/[0.04] [&>svg]:text-brand-600 dark:[&>svg]:text-brand-400",
        success: "bg-emerald-50 text-emerald-800 border-emerald-100 dark:bg-emerald-950/30 dark:text-emerald-200 dark:border-emerald-900/50 dark:ring-1 dark:ring-white/[0.04] [&>svg]:text-emerald-600 dark:[&>svg]:text-emerald-400",
        warning: "bg-amber-50 text-amber-800 border-amber-100 dark:bg-amber-950/30 dark:text-amber-200 dark:border-amber-900/50 dark:ring-1 dark:ring-white/[0.04] [&>svg]:text-amber-600 dark:[&>svg]:text-amber-400",
        error: "bg-red-50 text-red-800 border-red-100 dark:bg-red-950/30 dark:text-red-200 dark:border-red-900/50 dark:ring-1 dark:ring-white/[0.04] [&>svg]:text-red-600 dark:[&>svg]:text-red-400"
      }
    },
    defaultVariants: {
      variant: "default"
    }
  }
), zt = window.wp.element.forwardRef(
  ({
    className: t2,
    variant: r2,
    onDismiss: a3,
    dismissLabel: i2 = "Dismiss",
    children: s2,
    ...d2
  }, c2) => /* @__PURE__ */ window.wp.element.jsxs(
    "div",
    {
      ref: c2,
      role: "alert",
      className: B$1(da({ variant: r2 }), a3 && "pr-12", t2),
      ...d2,
      children: [
        s2,
        a3 && /* @__PURE__ */ window.wp.element.jsx(
          "button",
          {
            type: "button",
            "aria-label": i2,
            onClick: a3,
            className: B$1(
              // `absolute` removes the close button from the alert
              // grid flow so it doesn't push the icon column open.
              "absolute right-2 top-2 inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-md",
              "text-current opacity-60 transition-opacity",
              "hover:opacity-100",
              "focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current"
            ),
            children: /* @__PURE__ */ window.wp.element.jsx(X$1, { className: "h-4 w-4" })
          }
        )
      ]
    }
  )
);
zt.displayName = "Alert";
const Dt = window.wp.element.forwardRef(({ className: t2, ...r2 }, a3) => /* @__PURE__ */ window.wp.element.jsx(
  "h5",
  {
    ref: a3,
    className: B$1(
      "mt-0! mb-1! text-base! leading-none font-bold tracking-tight text-neutral-900 dark:text-white",
      t2
    ),
    ...r2
  }
));
Dt.displayName = "AlertTitle";
const It = window.wp.element.forwardRef(({ className: t2, ...r2 }, a3) => /* @__PURE__ */ window.wp.element.jsx(
  "div",
  {
    ref: a3,
    className: B$1("text-sm [&_p]:leading-relaxed", t2),
    ...r2
  }
));
It.displayName = "AlertDescription";
const Et = window.wp.element.forwardRef(({ className: t2, ...r2 }, a3) => /* @__PURE__ */ window.wp.element.jsx("div", { ref: a3, className: B$1("mt-4", t2), ...r2 }));
Et.displayName = "AlertAction";
const $n = Object.assign(zt, {
  Title: Dt,
  Description: It,
  Action: Et
}), oa = window.wp.element.forwardRef(
  ({
    value: t2,
    size: r2 = "sm",
    copyLabel: a3 = "Copy",
    copiedLabel: i2 = "Copied!",
    resetMs: s2 = 2e3,
    truncate: d2 = false,
    className: c2,
    ...n2
  }, u2) => {
    const [p2, b2] = window.wp.element.useState(false), m3 = window.wp.element.useRef(null);
    window.wp.element.useEffect(() => () => {
      m3.current && clearTimeout(m3.current);
    }, []);
    const v2 = window.wp.element.useCallback(() => {
      navigator.clipboard && navigator.clipboard.writeText(t2).then(() => {
        b2(true), m3.current && clearTimeout(m3.current), m3.current = setTimeout(() => b2(false), s2);
      });
    }, [t2, s2]), g2 = r2 === "md" ? "px-3 py-2 text-sm gap-2" : "px-2 py-1 text-xs gap-1.5", C2 = t2.includes(`
`);
    return /* @__PURE__ */ window.wp.element.jsxs(
      "div",
      {
        ref: u2,
        className: B$1(
          // Layout: monospace value on the left, button on the right.
          "rounded-md font-mono select-all",
          C2 || d2 ? "flex w-full max-w-full" : "inline-flex",
          // Top-align the copy button against tall snippets; center it for
          // single-line chips.
          C2 ? "items-start" : "items-center",
          // Light mode tones: subtle gray fill, gray-700 text — bright
          // enough to read against white cards but quiet enough not
          // to compete with body copy.
          "bg-gray-100 text-gray-800 ring-1 ring-gray-200",
          // Dark mode: matched against the gray-900 / neutral-900
          // surfaces the rest of the SPA uses for cards.
          "dark:bg-gray-800 dark:text-gray-100 dark:ring-white/10",
          g2,
          c2
        ),
        ...n2,
        children: [
          /* @__PURE__ */ window.wp.element.jsx(
            "span",
            {
              className: B$1(
                "min-w-0",
                d2 ? "truncate" : C2 ? "whitespace-pre-wrap break-words flex-1" : "break-all"
              ),
              "aria-label": t2,
              children: t2
            }
          ),
          /* @__PURE__ */ window.wp.element.jsx(
            "button",
            {
              type: "button",
              onClick: v2,
              "aria-label": p2 ? i2 : a3,
              "aria-live": "polite",
              className: B$1(
                "inline-flex items-center justify-center rounded-md cursor-pointer shrink-0",
                "text-gray-500 hover:text-gray-900 hover:bg-gray-200/60",
                "dark:text-gray-400 dark:hover:text-white dark:hover:bg-white/10",
                "transition-colors",
                "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-current",
                // Hit target — slightly larger than the icon so the
                // button is comfortable on touch devices.
                r2 === "md" ? "h-7 w-7" : "h-5 w-5"
              ),
              children: p2 ? /* @__PURE__ */ window.wp.element.jsx(
                Check$1,
                {
                  className: B$1(r2 === "md" ? "size-4" : "size-3.5", "text-emerald-600 dark:text-emerald-400"),
                  strokeWidth: 2.5
                }
              ) : /* @__PURE__ */ window.wp.element.jsx(
                Copy$1,
                {
                  className: r2 === "md" ? "size-4" : "size-3.5",
                  strokeWidth: 2.5
                }
              )
            }
          )
        ]
      }
    );
  }
);
oa.displayName = "CodeBlock";
const ca = me$1("animate-spin", {
  variants: {
    size: {
      sm: "size-4",
      md: "size-6",
      lg: "size-8"
    }
  },
  defaultVariants: {
    size: "sm"
  }
}), $e = ({
  className: t2,
  size: r2,
  primaryColorClass: a3 = "fill-brand-500 dark:fill-brand-400",
  secondaryColorClass: i2 = "fill-neutral-200 dark:fill-neutral-700"
}) => /* @__PURE__ */ window.wp.element.jsxs(
  "svg",
  {
    className: B$1(ca({ size: r2, className: t2 })),
    viewBox: "0 0 20 20",
    fill: "none",
    xmlns: "http://www.w3.org/2000/svg",
    children: [
      /* @__PURE__ */ window.wp.element.jsx(
        "path",
        {
          d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM1.28988 10C1.28988 14.8105 5.18953 18.7101 10 18.7101C14.8105 18.7101 18.7101 14.8105 18.7101 10C18.7101 5.18953 14.8105 1.28988 10 1.28988C5.18953 1.28988 1.28988 5.18953 1.28988 10Z",
          className: i2
        }
      ),
      /* @__PURE__ */ window.wp.element.jsx(
        "path",
        {
          d: "M19.3551 10C19.7113 10 20.0022 10.2891 19.9792 10.6445C19.8917 11.9999 19.5287 13.3257 18.9101 14.5399C18.1936 15.946 17.1546 17.1626 15.8779 18.0902C14.6011 19.0178 13.123 19.63 11.5643 19.8769C10.2184 20.0901 8.84535 20.0256 7.52922 19.69C7.18407 19.602 6.99906 19.2359 7.10913 18.8972C7.2192 18.5584 7.58265 18.3755 7.92862 18.4602C9.05034 18.7349 10.2177 18.7842 11.3626 18.6029C12.7202 18.3879 14.0076 17.8546 15.1197 17.0466C16.2317 16.2387 17.1367 15.179 17.7608 13.9543C18.287 12.9215 18.6008 11.796 18.6863 10.6444C18.7126 10.2891 18.9989 10 19.3551 10Z",
          className: a3
        }
      )
    ]
  }
), ua = me$1(
  "flex flex-col items-center justify-center gap-3 text-neutral-500 dark:text-neutral-400",
  {
    variants: {
      padding: {
        /**
         * No vertical padding. Use when the parent already provides
         * spacing (e.g. a Card with its own p-5) and the loader is
         * replacing the card's inner content for the loading state.
         */
        none: "",
        /**
         * Comfortable padding for inline "this section is loading"
         * uses — the default for most in-route use cases.
         */
        md: "py-10",
        /**
         * Extra breathing room for full-page route-level loaders
         * where the rest of the page is empty. Smaller than
         * AppLoader's `min-h-[70vh]` on purpose — the page shell
         * (header, breadcrumb) is visible above/below.
         */
        lg: "py-16"
      }
    },
    defaultVariants: {
      padding: "md"
    }
  }
), Fn = ({
  label: t2,
  srOnlyLabel: r2 = "Loading…",
  size: a3 = "md",
  padding: i2,
  className: s2
}) => /* @__PURE__ */ window.wp.element.jsxs(
  "div",
  {
    role: "status",
    "aria-live": "polite",
    "aria-busy": "true",
    className: B$1(ua({ padding: i2 }), s2),
    children: [
      /* @__PURE__ */ window.wp.element.jsx($e, { size: a3 }),
      t2 ? /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-sm text-neutral-600 dark:text-neutral-300", children: t2 }) : /* @__PURE__ */ window.wp.element.jsx("span", { className: "sr-only", children: r2 })
    ]
  }
);
function At({
  domain: t2,
  size: r2 = 14,
  className: a3,
  fallback: i2 = Globe$1
}) {
  const [s2, d2] = window.wp.element.useState(false);
  return s2 ? /* @__PURE__ */ window.wp.element.jsx(i2, { size: r2, className: B$1("shrink-0 text-neutral-400", a3) }) : /* @__PURE__ */ window.wp.element.jsx(
    "img",
    {
      src: `https://www.google.com/s2/favicons?domain=${encodeURIComponent(
        t2
      )}&sz=${Math.max(r2 * 2, 32)}`,
      alt: "",
      width: r2,
      height: r2,
      className: B$1("shrink-0 rounded-sm", a3),
      loading: "lazy",
      onError: () => d2(true),
      onLoad: (c2) => {
        c2.currentTarget.naturalWidth <= 16 && d2(true);
      }
    }
  );
}
const St = me$1(
  [
    "relative flex overflow-hidden rounded-xl border bg-white dark:bg-gray-900 shadow-sm",
    // Transitions — ease-out (spring deceleration) at duration-fast
    "transition-all duration-fast ease-out",
    "outline outline-0 outline-offset-0 outline-transparent"
  ],
  {
    variants: {
      intent: {
        default: [
          "border-gray-300 dark:border-gray-700",
          "text-gray-900 dark:text-gray-100",
          "placeholder:text-gray-400 dark:placeholder:text-gray-500",
          // Brand Focus — using ! to override potential WP generic input focus styles
          "focus-within:!border-brand-600 focus-within:!ring-4 focus-within:!ring-brand-600/10"
        ],
        error: [
          "border-red-500 dark:border-red-500/50",
          "text-red-900 dark:text-red-300",
          "placeholder:text-red-300 dark:placeholder:text-red-700",
          "focus-within:!border-red-600 focus-within:!ring-4 focus-within:!ring-red-600/10"
        ]
      }
    },
    defaultVariants: {
      intent: "default"
    }
  }
), Mt = me$1(
  "w-full !bg-transparent !border-0 !shadow-none !outline-none !ring-0 leading-none focus:outline-none placeholder:text-gray-400 dark:placeholder:text-gray-600 dark:text-white",
  {
    variants: {
      size: {
        xs: "!px-2 !py-1 !text-xs",
        sm: "!px-3 !py-1.5 !text-sm",
        md: "!px-4 !py-2.5 !text-sm"
      }
    },
    defaultVariants: {
      size: "md"
    }
  }
), $t = me$1(
  [
    "relative w-full cursor-pointer rounded-xl border bg-white dark:bg-gray-900 text-left shadow-sm",
    // Transitions — ease-out (spring deceleration) at duration-fast
    "transition-all duration-fast ease-out",
    "outline-0 outline-offset-0 outline-transparent",
    "text-gray-900 dark:text-gray-100 placeholder:text-gray-400",
    // Disabled state — HeadlessUI's ListboxButton renders a real
    // `<button disabled>` AND sets `data-disabled`, so cover both. Without
    // this a gated Select (e.g. the Pro-only "Image format" picker) looked
    // fully interactive — visually indistinguishable from an enabled one.
    "disabled:cursor-not-allowed disabled:opacity-55 disabled:shadow-none",
    "data-disabled:cursor-not-allowed data-disabled:opacity-55 data-disabled:shadow-none"
  ],
  {
    variants: {
      intent: {
        default: "border-gray-300 dark:border-gray-700 focus:!border-brand-600 focus:!ring-4 focus:!ring-brand-600/10",
        error: "border-red-500 dark:border-red-500/50 text-red-900 dark:text-red-300 focus:!border-red-500 focus:!ring-4 focus:!ring-red-500/10"
      },
      size: {
        xs: "px-2 py-1 pr-8 text-xs leading-none",
        sm: "px-3 py-1.5 pr-8 text-sm leading-none",
        md: "px-4 py-2.5 pr-10 text-sm leading-none"
      }
    },
    defaultVariants: {
      intent: "default",
      size: "md"
    }
  }
), ma = me$1("flex items-center text-gray-500 dark:text-gray-400", {
  variants: {
    size: {
      xs: "pl-2 pr-1",
      sm: "pl-3 pr-1.5",
      md: "pl-4 pr-2"
    }
  },
  defaultVariants: {
    size: "md"
  }
}), pa = me$1(
  "flex items-center text-gray-500 dark:text-gray-400 shrink-0",
  {
    variants: {
      size: {
        xs: "pr-2 pl-1",
        sm: "pr-3 pl-1.5",
        md: "pr-4 pl-2"
      }
    },
    defaultVariants: {
      size: "md"
    }
  }
), Pe = me$1("block", {
  variants: {
    labelStyle: {
      default: "mb-2 text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500",
      prominent: "mb-1.5 text-sm font-bold text-neutral-900 dark:text-white"
    }
  },
  defaultVariants: {
    labelStyle: "default"
  }
}), ha = me$1("text-xs font-medium", {
  variants: {
    intent: {
      default: "text-gray-500 dark:text-gray-400",
      error: "text-red-600 dark:text-red-400"
    },
    view: {
      default: "mt-2",
      tooltip: [
        "absolute z-20 mt-1 hidden w-full rounded-xl border shadow-lg",
        "px-3 py-1.5",
        "group-hover/field:block"
      ],
      hidden: "sr-only"
    }
  },
  compoundVariants: [
    {
      intent: "error",
      view: "tooltip",
      class: "border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950 dark:text-red-200"
    }
  ],
  defaultVariants: {
    intent: "default",
    view: "default"
  }
}), he = window.wp.element.forwardRef(
  ({
    label: t2,
    id: r2,
    required: a3,
    hiddenLabel: i2,
    error: s2,
    errorView: d2 = "default",
    loading: c2,
    size: n2 = "md",
    type: u2 = "text",
    leftAdornment: p2,
    rightAdornment: b2,
    className: m3,
    inputClassName: v2,
    labelStyle: g2 = "default",
    ...C2
  }, N2) => {
    const [D2, k2] = window.wp.element.useState(false), _2 = !s2 || d2 !== "default" && d2 !== "tooltip" ? "hidden" : d2;
    return /* @__PURE__ */ window.wp.element.jsxs(
      W,
      {
        as: "div",
        disabled: C2.disabled,
        className: "group/field relative disabled:opacity-40",
        children: [
          /* @__PURE__ */ window.wp.element.jsx(
            Z,
            {
              className: B$1(Pe({ labelStyle: g2 }), {
                "sr-only": i2
              }),
              children: a3 ? `${t2} *` : t2
            }
          ),
          /* @__PURE__ */ window.wp.element.jsxs(
            "div",
            {
              className: B$1(
                St({
                  intent: s2 ? "error" : "default"
                }),
                m3
              ),
              children: [
                p2 && /* @__PURE__ */ window.wp.element.jsx("div", { className: ma({ size: n2 }), children: p2 }),
                /* @__PURE__ */ window.wp.element.jsx(
                  X$2,
                  {
                    id: r2,
                    ref: N2,
                    type: u2,
                    className: B$1(Mt({ size: n2 }), v2),
                    onFocus: (S2) => {
                      k2(true), C2.onFocus?.(S2);
                    },
                    onBlur: (S2) => {
                      k2(false), C2.onBlur?.(S2);
                    },
                    ...C2
                  }
                ),
                c2 && /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex items-center px-3", children: /* @__PURE__ */ window.wp.element.jsx($e, {}) }),
                b2 && !c2 && /* @__PURE__ */ window.wp.element.jsx("div", { className: pa({ size: n2 }), children: b2 })
              ]
            }
          ),
          s2 && /* @__PURE__ */ window.wp.element.jsx(
            M$5,
            {
              role: "alert",
              className: B$1(
                ha({
                  intent: "error",
                  view: _2
                }),
                d2 === "tooltip" && D2 && "block!"
              ),
              children: s2
            }
          )
        ]
      }
    );
  }
);
he.displayName = "InputField";
const ba = {
  remove: (t2) => `Remove ${t2}`,
  addAll: "Add all",
  add: "Add",
  suggested: "Suggested — tap to add",
  discover: "AI suggest",
  addItem: "Add an item"
};
function xa(t2) {
  return t2 >= 1e3 ? `${Math.round(t2 / 1e3)}k` : String(t2);
}
const ga = {
  high: "bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400",
  medium: "bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400",
  low: "bg-neutral-200/70 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400",
  neutral: "bg-neutral-200/70 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400"
};
function Bn({
  kind: t2,
  leadingIcon: r2,
  added: a3,
  suggested: i2,
  onAdd: s2,
  onRemove: d2,
  onAddAll: c2,
  onDiscover: n2,
  discoverLabel: u2,
  discovering: p2 = false,
  discoverPrimary: b2 = false,
  suggestedLabel: m3,
  suggestedNotice: v2,
  emptyText: g2,
  inputPlaceholder: C2,
  chipBadges: N2,
  onAddManual: D2,
  addManualError: k2,
  disabled: _2 = false,
  ariaLabel: S2,
  hideInput: I2 = false,
  labels: B2
}) {
  const R2 = { ...ba, ...B2 }, [P2, V2] = window.wp.element.useState(""), U2 = () => {
    const y2 = P2.trim();
    !y2 || _2 || !D2 || D2(y2) !== false && V2("");
  }, M2 = (y2) => t2 === "domain" ? /* @__PURE__ */ window.wp.element.jsx(At, { domain: y2.label }) : r2 ? /* @__PURE__ */ window.wp.element.jsx(r2, { size: 12, className: "shrink-0", "aria-hidden": "true" }) : null;
  return /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col gap-4", children: [
    a3.length > 0 ? /* @__PURE__ */ window.wp.element.jsx("ul", { "aria-label": S2, className: "flex flex-wrap gap-2", children: a3.map((y2) => {
      const O2 = N2?.[y2.value];
      return /* @__PURE__ */ window.wp.element.jsxs(
        "li",
        {
          className: "flex items-center gap-1.5 rounded-full border border-brand-200 bg-brand-50 px-3 py-1 text-sm text-brand-800 dark:border-brand-900/40 dark:bg-brand-950/30 dark:text-brand-200",
          children: [
            M2(y2),
            /* @__PURE__ */ window.wp.element.jsx("span", { className: "truncate", children: y2.label }),
            O2 ? /* @__PURE__ */ window.wp.element.jsx(
              "span",
              {
                className: B$1(
                  "shrink-0 rounded px-1 py-px text-[9px] font-bold uppercase",
                  ga[O2.tone]
                ),
                children: O2.label
              }
            ) : null,
            /* @__PURE__ */ window.wp.element.jsx(
              "button",
              {
                type: "button",
                onClick: () => d2(y2.value),
                "aria-label": R2.remove(y2.label),
                className: "ml-0.5 shrink-0 cursor-pointer rounded text-brand-500 transition-colors hover:text-red-600 dark:text-brand-400",
                children: /* @__PURE__ */ window.wp.element.jsx(X$1, { size: 12 })
              }
            )
          ]
        },
        y2.value
      );
    }) }) : g2 ? /* @__PURE__ */ window.wp.element.jsx("div", { className: "rounded-md border border-dashed border-neutral-200 px-4 py-6 text-center dark:border-neutral-700", children: /* @__PURE__ */ window.wp.element.jsx("span", { className: "block text-sm text-neutral-500 dark:text-neutral-400", children: g2 }) }) : null,
    i2.length > 0 || n2 ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col gap-2 rounded-md border border-dashed border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-800 dark:bg-neutral-900/50", children: [
      v2,
      /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center justify-between gap-3", children: [
        /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-xs font-semibold uppercase tracking-wider text-neutral-500 dark:text-neutral-400", children: m3 ?? R2.suggested }),
        /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center gap-1", children: [
          c2 && i2.length > 0 ? /* @__PURE__ */ window.wp.element.jsxs(
            tr$1,
            {
              variant: "transparent",
              size: "sm",
              onClick: c2,
              disabled: _2,
              children: [
                /* @__PURE__ */ window.wp.element.jsx(Plus$1, { size: 12, className: "mr-1" }),
                R2.addAll
              ]
            }
          ) : null,
          n2 ? /* @__PURE__ */ window.wp.element.jsxs(
            tr$1,
            {
              variant: b2 ? "primary" : "transparent",
              size: "sm",
              onClick: n2,
              disabled: p2,
              children: [
                p2 ? /* @__PURE__ */ window.wp.element.jsx(LoaderCircle$1, { size: 14, className: "mr-1.5 animate-spin" }) : b2 ? /* @__PURE__ */ window.wp.element.jsx(Sparkles$1, { size: 14, className: "mr-1.5" }) : /* @__PURE__ */ window.wp.element.jsx(RefreshCw$1, { size: 14, className: "mr-1.5" }),
                u2 ?? R2.discover
              ]
            }
          ) : null
        ] })
      ] }),
      i2.length > 0 ? /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex flex-wrap gap-2", children: i2.map((y2) => {
        const O2 = /* @__PURE__ */ window.wp.element.jsxs(
          "button",
          {
            type: "button",
            onClick: () => {
              _2 || s2(y2.value);
            },
            disabled: _2,
            className: "flex cursor-pointer items-center gap-1.5 rounded-full border border-dashed border-neutral-300 bg-white px-3 py-1 text-xs text-neutral-700 transition-colors hover:border-brand-400 hover:bg-brand-50 hover:text-brand-700 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 dark:hover:bg-brand-950/30",
            children: [
              M2(y2),
              /* @__PURE__ */ window.wp.element.jsx("span", { children: y2.label }),
              typeof y2.count == "number" ? /* @__PURE__ */ window.wp.element.jsxs("span", { className: "text-neutral-400 dark:text-neutral-500", children: [
                "· ",
                xa(y2.count)
              ] }) : null,
              /* @__PURE__ */ window.wp.element.jsx(Plus$1, { size: 12, className: "ml-0.5 shrink-0 text-neutral-400" })
            ]
          },
          y2.value
        );
        return y2.tooltip ? /* @__PURE__ */ window.wp.element.jsx(ce, { title: y2.tooltip, children: O2 }, y2.value) : O2;
      }) }) : null
    ] }) : null,
    I2 ? null : /* @__PURE__ */ window.wp.element.jsx(
      he,
      {
        label: C2 ?? R2.addItem,
        hiddenLabel: true,
        size: "sm",
        value: P2,
        onChange: (y2) => V2(y2.target.value),
        onKeyDown: (y2) => {
          y2.key === "Enter" && (y2.preventDefault(), U2());
        },
        placeholder: C2,
        disabled: _2,
        error: k2 ?? void 0,
        rightAdornment: /* @__PURE__ */ window.wp.element.jsxs(
          tr$1,
          {
            variant: "transparent",
            size: "sm",
            onClick: U2,
            disabled: !P2.trim() || _2,
            children: [
              /* @__PURE__ */ window.wp.element.jsx(Plus$1, { size: 14, className: "mr-1" }),
              R2.add
            ]
          }
        )
      }
    )
  ] });
}
const fa = 20;
function Pt(t2, r2) {
  return r2 == null || t2 == null ? "winnable" : t2 > r2 ? "pillar" : t2 > r2 - fa ? "stretch" : "winnable";
}
const ka = {
  winnable: "text-emerald-600 dark:text-emerald-400",
  stretch: "text-amber-600 dark:text-amber-400",
  pillar: "text-purple-600 dark:text-purple-400"
}, va = {
  winnable: "bg-emerald-600 dark:bg-emerald-400",
  stretch: "bg-amber-600 dark:bg-amber-400",
  pillar: "bg-purple-600 dark:bg-purple-400"
}, Ft = window.wp.element.forwardRef(
  ({ kd: t2, state: r2, className: a3, ...i2 }, s2) => {
    const d2 = Math.max(0, Math.min(100, t2));
    return /* @__PURE__ */ window.wp.element.jsxs(
      "span",
      {
        ref: s2,
        "data-kd-state": r2,
        tabIndex: 0,
        className: B$1(
          "inline-flex items-center gap-1.5 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",
          a3
        ),
        ...i2,
        children: [
          /* @__PURE__ */ window.wp.element.jsx(
            "span",
            {
              "aria-hidden": "true",
              className: "relative inline-block h-1 w-[26px] shrink-0 overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-700",
              children: /* @__PURE__ */ window.wp.element.jsx(
                "span",
                {
                  className: B$1("absolute inset-y-0 left-0 rounded-full", va[r2]),
                  style: { width: `${d2}%` }
                }
              )
            }
          ),
          /* @__PURE__ */ window.wp.element.jsx("span", { className: B$1("font-mono text-[11px] font-medium tabular-nums", ka[r2]), children: t2 })
        ]
      }
    );
  }
);
Ft.displayName = "MetricChip";
const wa = ({ className: t2, ...r2 }) => /* @__PURE__ */ window.wp.element.jsx(
  "div",
  {
    "aria-hidden": true,
    className: B$1(
      "animate-pulse rounded-md bg-neutral-200/80 dark:bg-neutral-700/60",
      t2
    ),
    ...r2
  }
);
function Vn(t2) {
  switch (t2) {
    case "ranking":
    case "near_ranking":
      return "already_ranking";
    case "gap":
      return "competitor_gap";
    case "suggestion":
    case "related_search":
      return "related_search";
    case "people_also_ask":
      return "people_also_ask";
    case "ai_generated":
      return "ai_generated";
    default:
      return "manual";
  }
}
const jt = {
  remove: (t2) => `Remove ${t2}`,
  moveToTop: (t2) => `Move ${t2} to the top of the publish order`,
  provenance: {
    related_search: "Search-suggested — from live related-search data",
    people_also_ask: "People also ask — a question searchers pair with this topic",
    competitor_gap: "Competitor gap — they rank for it, you don't yet",
    already_ranking: "Already ranking — your site has a foothold here",
    ai_generated: "AI-generated — no live search data; numbers are estimates",
    manual: "Added manually"
  },
  variants: (t2) => `${t2} long-tail variant${t2 === 1 ? "" : "s"} ready as per-post keyphrases`,
  kd: (t2, r2, a3) => `Difficulty ${t2} — ${r2}` + (r2 === "pillar" ? ` (above your KD ≤ ${a3} ceiling)` : r2 === "stretch" ? ` (near your KD ≤ ${a3} ceiling)` : " for this site"),
  volume: (t2) => `${t2} monthly searches`,
  intent: { informational: "DIY", commercial: "Research" },
  bucket: { high: "High", medium: "Medium", low: "Low" },
  bucketEstimated: "Estimated volume bucket — no live search data",
  pending: "Looking up search data…"
}, ya = {
  related_search: Search$1,
  people_also_ask: Search$1,
  competitor_gap: Swords,
  already_ranking: TrendingUp$1,
  ai_generated: Sparkles$1,
  manual: Plus$1
}, Na = {
  high: "bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400",
  medium: "bg-amber-100 text-amber-700 dark:bg-amber-500/15 dark:text-amber-400",
  low: "bg-neutral-200/70 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400"
};
function Ge(t2, r2) {
  if (t2 < 1e3) return String(Math.round(t2));
  const a3 = Math.round(t2 / 100) / 10, i2 = Number.isInteger(a3) ? 0 : 1;
  return `${(() => {
    try {
      return new Intl.NumberFormat(r2, {
        minimumFractionDigits: i2,
        maximumFractionDigits: i2
      }).format(a3);
    } catch {
      return a3.toFixed(i2);
    }
  })()}K`;
}
function Ca(t2) {
  return t2 >= 1e3 ? "high" : t2 >= 100 ? "medium" : "low";
}
const We = "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent p-1.5 text-neutral-400 transition-colors duration-fast ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)] @max-[600px]:min-h-11 @max-[600px]:min-w-11", Bt = window.wp.element.forwardRef(
  ({
    position: t2,
    keyword: r2,
    metrics: a3,
    kdCeiling: i2 = null,
    source: s2,
    variantCount: d2 = 0,
    pillar: c2,
    estimated: n2 = false,
    pending: u2 = false,
    onRemove: p2,
    onMoveToTop: b2,
    locale: m3,
    animationDelayMs: v2,
    labels: g2,
    className: C2,
    trailing: N2
  }, D2) => {
    const k2 = { ...jt, ...g2 }, _2 = Pt(a3?.kd, i2), S2 = c2 ?? _2 === "pillar", I2 = u2 ? "manual" : n2 ? "ai_generated" : s2, B2 = ya[I2], R2 = typeof a3?.volumeNumber == "number" || typeof a3?.kd == "number" || !!a3?.intent, P2 = a3?.volumeBucket ?? (typeof a3?.volumeNumber == "number" ? Ca(a3.volumeNumber) : void 0);
    return /* @__PURE__ */ window.wp.element.jsxs(
      "li",
      {
        ref: D2,
        "data-keyword": r2,
        "data-position": t2,
        "data-pillar": S2 ? "" : void 0,
        "data-pending": u2 ? "" : void 0,
        className: B$1(
          // Spec §1/§8 row rhythm. `group` drives the hover-reveal actions.
          "group grid min-h-[38px] grid-cols-[26px_minmax(0,1fr)_max-content_max-content] items-center gap-x-2.5 rounded-[10px] px-2 py-1.5 transition-colors duration-fast",
          "hover:bg-brand-600/[0.045] dark:hover:bg-white/[0.03]",
          // Hairline separators between rows (not above the first).
          "border-t border-neutral-100 first:border-t-0 dark:border-white/[0.045]",
          // Narrow (container ≤600px): metrics wrap under the keyword.
          "@max-[600px]:min-h-12 @max-[600px]:grid-cols-[26px_minmax(0,1fr)_max-content] @max-[600px]:gap-y-px @max-[600px]:py-[9px]",
          // Entrance — fadeInUp with the list's stagger; static under reduced motion.
          v2 !== void 0 && "animate-in [animation-fill-mode:both] motion-reduce:animate-none",
          C2
        ),
        style: v2 !== void 0 ? { animationDelay: `${v2}ms` } : void 0,
        children: [
          /* @__PURE__ */ window.wp.element.jsx(
            "span",
            {
              "aria-hidden": "true",
              className: "w-[26px] text-right font-mono text-[10px] tabular-nums text-neutral-300 dark:text-neutral-600 @max-[600px]:col-start-1 @max-[600px]:row-start-1",
              children: String(t2).padStart(2, "0")
            }
          ),
          /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex min-w-0 items-center gap-2 @max-[600px]:col-start-2 @max-[600px]:row-start-1", children: [
            /* @__PURE__ */ window.wp.element.jsx(
              "span",
              {
                className: B$1(
                  "truncate text-sm font-[450] text-neutral-900 dark:text-neutral-100",
                  u2 && "opacity-50"
                ),
                children: r2
              }
            ),
            /* @__PURE__ */ window.wp.element.jsx(ce, { title: k2.provenance[I2], children: /* @__PURE__ */ window.wp.element.jsx(
              "span",
              {
                tabIndex: 0,
                role: "img",
                "aria-label": k2.provenance[I2],
                "data-provenance": I2,
                className: B$1(
                  "inline-flex shrink-0 items-center rounded-sm text-neutral-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 dark:text-neutral-600",
                  I2 === "ai_generated" && "text-amber-500 dark:text-amber-400"
                ),
                children: /* @__PURE__ */ window.wp.element.jsx(B2, { size: 12, "aria-hidden": "true" })
              }
            ) }),
            !n2 && !u2 && d2 > 0 ? /* @__PURE__ */ window.wp.element.jsx(ce, { title: k2.variants(d2), children: /* @__PURE__ */ window.wp.element.jsxs(
              "span",
              {
                tabIndex: 0,
                "aria-label": k2.variants(d2),
                "data-variants": d2,
                className: "inline-flex shrink-0 items-center gap-0.5 rounded-sm font-mono text-[10px] text-neutral-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 dark:text-neutral-500",
                children: [
                  /* @__PURE__ */ window.wp.element.jsx(ListTree, { size: 12, "aria-hidden": "true" }),
                  "+",
                  d2
                ]
              }
            ) }) : null
          ] }),
          /* @__PURE__ */ window.wp.element.jsx(
            "div",
            {
              "data-metrics": "",
              className: "flex items-center gap-3 @max-[600px]:col-start-2 @max-[600px]:row-start-2 @max-[600px]:gap-2.5",
              children: u2 ? /* @__PURE__ */ window.wp.element.jsx(
                wa,
                {
                  "aria-hidden": void 0,
                  role: "status",
                  "aria-label": k2.pending,
                  className: "h-3.5 w-[130px] rounded-md"
                }
              ) : n2 ? P2 ? /* @__PURE__ */ window.wp.element.jsx(ce, { title: k2.bucketEstimated, children: /* @__PURE__ */ window.wp.element.jsx(
                "span",
                {
                  tabIndex: 0,
                  "aria-label": `${k2.bucket[P2]} — ${k2.bucketEstimated}`,
                  "data-bucket": P2,
                  className: "inline-flex w-[64px] justify-end rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",
                  children: /* @__PURE__ */ window.wp.element.jsxs(
                    "span",
                    {
                      className: B$1(
                        "rounded px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wide",
                        Na[P2]
                      ),
                      children: [
                        "~ ",
                        k2.bucket[P2]
                      ]
                    }
                  )
                }
              ) }) : null : R2 ? (
                // Three FIXED-width slots whenever the row has any live metric, so
                // a keyword with only a KD (or only a volume) keeps its number in
                // the same column as its neighbours instead of sliding into the
                // gap (live QA 2026-08-28, legacy banks with partial DFS data).
                /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
                  /* @__PURE__ */ window.wp.element.jsx(
                    "span",
                    {
                      "data-volume-slot": "",
                      className: "inline-flex w-[42px] justify-end font-mono text-[11px] font-medium tabular-nums text-neutral-600 dark:text-neutral-300",
                      children: typeof a3?.volumeNumber == "number" ? /* @__PURE__ */ window.wp.element.jsx(
                        "span",
                        {
                          "data-volume": a3.volumeNumber,
                          "aria-label": k2.volume(
                            Ge(a3.volumeNumber, m3),
                            a3.volumeNumber
                          ),
                          children: Ge(a3.volumeNumber, m3)
                        }
                      ) : null
                    }
                  ),
                  /* @__PURE__ */ window.wp.element.jsx("span", { "data-kd-slot": "", className: "inline-flex w-[62px]", children: typeof a3?.kd == "number" ? /* @__PURE__ */ window.wp.element.jsx(ce, { title: k2.kd(a3.kd, _2, i2), children: /* @__PURE__ */ window.wp.element.jsx(
                    Ft,
                    {
                      kd: a3.kd,
                      state: _2,
                      "aria-label": k2.kd(a3.kd, _2, i2)
                    }
                  ) }) : null }),
                  /* @__PURE__ */ window.wp.element.jsx("span", { "data-intent-slot": "", className: "inline-flex w-[60px] justify-start", children: a3?.intent ? /* @__PURE__ */ window.wp.element.jsx(
                    "span",
                    {
                      "data-intent": a3.intent,
                      className: "rounded bg-neutral-100 px-1.5 py-0.5 text-[9px] font-bold uppercase tracking-wide text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400",
                      children: k2.intent[a3.intent]
                    }
                  ) : null })
                ] })
              ) : null
            }
          ),
          u2 ? /* @__PURE__ */ window.wp.element.jsx("span", { "aria-hidden": "true" }) : /* @__PURE__ */ window.wp.element.jsxs(
            "div",
            {
              "data-actions": "",
              className: B$1(
                "flex items-center gap-0.5 transition-opacity duration-fast",
                // Hover/focus-reveal on pointer devices; always visible on touch
                // and on the wrapped layout (spec §2 actions).
                "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 pointer-coarse:opacity-100",
                "@max-[600px]:col-start-3 @max-[600px]:row-span-2 @max-[600px]:row-start-1 @max-[600px]:opacity-100"
              ),
              children: [
                b2 && !S2 ? /* @__PURE__ */ window.wp.element.jsx(
                  "button",
                  {
                    type: "button",
                    onClick: b2,
                    "aria-label": k2.moveToTop(r2),
                    title: k2.moveToTop(r2),
                    "data-kb-move-top": "",
                    className: B$1(
                      We,
                      "hover:bg-brand-50 hover:text-brand-600 dark:hover:bg-brand-500/10 dark:hover:text-brand-400"
                    ),
                    children: /* @__PURE__ */ window.wp.element.jsx(ArrowUpToLine, { size: 14, "aria-hidden": "true" })
                  }
                ) : null,
                /* @__PURE__ */ window.wp.element.jsx(
                  "button",
                  {
                    type: "button",
                    onClick: p2,
                    "aria-label": k2.remove(r2),
                    "data-kb-remove": "",
                    className: B$1(
                      We,
                      "hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-500/10 dark:hover:text-red-400"
                    ),
                    children: /* @__PURE__ */ window.wp.element.jsx(X$1, { size: 14, "aria-hidden": "true" })
                  }
                ),
                N2
              ]
            }
          )
        ]
      }
    );
  }
);
Bt.displayName = "KeywordRow";
const La = {
  listAria: "Keyword bank, in publish order",
  pillarsAria: "Pillar keywords",
  publishOrder: "Publish order · best winnable volume first",
  orderEstimated: "order estimated",
  showAll: (t2) => `Show all ${t2} keywords`,
  showTop: (t2) => `Show top ${t2} only`,
  hiddenCaption: (t2, r2) => r2 > 0 ? `${t2} more · ${r2} pillar${r2 === 1 ? "" : "s"} publish last` : `${t2} more`,
  pillarsTitle: "Pillars",
  pillarsBody: "Long-term targets above your difficulty ceiling — published after the winnable ones.",
  variantsLine: (t2) => `${t2} long-tail variants ready — each post gets its own keyphrase, so seeds can safely repeat.`,
  movedToTop: "Moved to position 1"
}, Ta = 15, _a = 22, Ra = 440;
function On({
  items: t2,
  kdCeiling: r2 = null,
  estimated: a3 = false,
  modeCaption: i2,
  modeTooltip: s2,
  onRemove: d2,
  onMoveToTop: c2,
  addInputRef: n2,
  collapseAt: u2 = Ta,
  locale: p2,
  labels: b2,
  rowLabels: m3,
  className: v2
}) {
  const g2 = { ...La, ...b2 }, C2 = { ...jt, ...m3 }, N2 = window.wp.element.useId(), [D2, k2] = window.wp.element.useState(false), [_2, S2] = window.wp.element.useState(""), I2 = window.wp.element.useRef(null), B2 = window.wp.element.useRef(null), { regular: R2, pillars: P2 } = window.wp.element.useMemo(() => {
    const f2 = [], A2 = [];
    for (const z2 of t2)
      (!a3 && !z2.pending && (z2.pillar ?? Pt(z2.metrics?.kd, r2) === "pillar") ? A2 : f2).push(z2);
    return { regular: f2, pillars: A2 };
  }, [t2, a3, r2]), V2 = R2.length + P2.length, U2 = V2 > u2, M2 = U2 && !D2, y2 = M2 ? R2.slice(0, u2) : R2, O2 = V2 - y2.length, w2 = a3 ? 0 : t2.reduce((f2, A2) => f2 + (A2.variantCount ?? 0), 0), T3 = (f2, A2) => {
    B2.current = A2, d2(f2);
  };
  window.wp.element.useEffect(() => {
    const f2 = B2.current;
    if (f2 === null) return;
    B2.current = null;
    const A2 = Array.from(
      I2.current?.querySelectorAll("[data-kb-remove]") ?? []
    );
    if (A2.length === 0) {
      n2?.current?.focus();
      return;
    }
    A2[Math.min(f2, A2.length - 1)]?.focus();
  }, [t2, n2]);
  const L2 = (f2) => {
    c2?.(f2), S2(""), requestAnimationFrame(() => S2(g2.movedToTop));
  }, E2 = (f2, A2, z2, x2) => /* @__PURE__ */ window.wp.element.jsx(
    Bt,
    {
      position: A2,
      keyword: f2.keyword,
      metrics: f2.metrics,
      kdCeiling: r2,
      source: f2.source,
      variantCount: f2.variantCount,
      pillar: x2,
      estimated: a3,
      pending: f2.pending,
      onRemove: () => T3(f2.keyword, z2),
      onMoveToTop: c2 && !x2 ? () => L2(f2.keyword) : void 0,
      locale: p2,
      animationDelayMs: Math.min(z2 * _a, Ra),
      labels: C2
    },
    f2.keyword
  );
  return /* @__PURE__ */ window.wp.element.jsxs("div", { ref: I2, className: B$1("flex flex-col", v2), "data-keyword-bank": "", children: [
    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center justify-between gap-3 px-2 pb-1.5", children: [
      /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-[10px] font-black uppercase leading-none tracking-widest text-neutral-400 dark:text-neutral-500", children: g2.publishOrder }),
      a3 ? /* @__PURE__ */ window.wp.element.jsx("span", { className: "font-mono text-[10px] text-neutral-400 dark:text-neutral-500", children: g2.orderEstimated }) : i2 ? s2 ? /* @__PURE__ */ window.wp.element.jsx(ce, { title: s2, position: "top-end", children: /* @__PURE__ */ window.wp.element.jsx(
        "span",
        {
          tabIndex: 0,
          "aria-label": s2,
          "data-mode-caption": "",
          className: "rounded-sm font-mono text-[10px] text-neutral-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 dark:text-neutral-500",
          children: i2
        }
      ) }) : /* @__PURE__ */ window.wp.element.jsx("span", { "data-mode-caption": "", className: "font-mono text-[10px] text-neutral-400 dark:text-neutral-500", children: i2 }) : null
    ] }),
    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "relative", children: [
      /* @__PURE__ */ window.wp.element.jsx(
        "ul",
        {
          id: N2,
          "aria-label": g2.listAria,
          className: "@container flex flex-col",
          "data-collapsed": M2 ? "" : void 0,
          children: y2.map((f2, A2) => E2(f2, A2 + 1, A2, false))
        }
      ),
      M2 ? (
        // 88px gradient to the surface colour under the 15th row (spec §3).
        /* @__PURE__ */ window.wp.element.jsx(
          "div",
          {
            "aria-hidden": "true",
            className: "pointer-events-none absolute inset-x-0 bottom-0 h-[88px] bg-gradient-to-b from-transparent to-white to-[82%] dark:to-neutral-900"
          }
        )
      ) : null
    ] }),
    !M2 && P2.length > 0 ? /* @__PURE__ */ window.wp.element.jsxs(
      "div",
      {
        "data-pillars": "",
        className: "mt-3 rounded-xl bg-purple-50/60 p-2 ring-1 ring-purple-100 dark:bg-purple-500/[0.06] dark:ring-purple-500/15",
        children: [
          /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-0.5 px-2 pb-1 pt-1.5", children: [
            /* @__PURE__ */ window.wp.element.jsxs("span", { className: "inline-flex items-center gap-1.5 text-[10px] font-black uppercase leading-none tracking-widest text-purple-600 dark:text-purple-400", children: [
              /* @__PURE__ */ window.wp.element.jsx(Mountain, { size: 12, "aria-hidden": "true" }),
              g2.pillarsTitle
            ] }),
            /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400", children: g2.pillarsBody })
          ] }),
          /* @__PURE__ */ window.wp.element.jsx("ul", { "aria-label": g2.pillarsAria, className: "@container flex flex-col", children: P2.map(
            (f2, A2) => E2(f2, R2.length + A2 + 1, R2.length + A2, true)
          ) })
        ]
      }
    ) : null,
    U2 ? /* @__PURE__ */ window.wp.element.jsxs(
      "div",
      {
        className: B$1(
          "flex flex-col items-center gap-1",
          M2 ? "relative z-10 -mt-2" : "mt-3"
        ),
        children: [
          /* @__PURE__ */ window.wp.element.jsxs(
            "button",
            {
              type: "button",
              onClick: () => k2((f2) => !f2),
              "aria-expanded": !M2,
              "aria-controls": N2,
              "data-kb-toggle": "",
              className: B$1(
                "inline-flex cursor-pointer items-center gap-1.5 rounded-full border-0 px-4 py-1.5 text-xs font-bold transition-all duration-fast ease-out hover:scale-[1.02] active:scale-[0.98]",
                "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)]",
                M2 ? (
                  // Floating pill, elevation 2 (design guide §4.2).
                  "bg-white text-neutral-700 shadow-floating ring-1 ring-neutral-200 hover:text-brand-700 hover:ring-brand-300 dark:bg-neutral-800 dark:text-neutral-200 dark:ring-white/[0.06] dark:hover:text-brand-300"
                ) : "bg-transparent text-neutral-500 hover:text-brand-600 dark:text-neutral-400 dark:hover:text-brand-400"
              ),
              children: [
                M2 ? /* @__PURE__ */ window.wp.element.jsx(ChevronDown$1, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ window.wp.element.jsx(ChevronUp$1, { size: 14, "aria-hidden": "true" }),
                M2 ? g2.showAll(V2) : g2.showTop(u2)
              ]
            }
          ),
          M2 ? /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-[11px] text-neutral-400 dark:text-neutral-500", children: g2.hiddenCaption(O2, P2.length) }) : null
        ]
      }
    ) : null,
    w2 > 0 ? (
      // A <div>, not a <p>: wp-admin's unlayered `p { margin: 1em 0 }`
      // beats Tailwind's layered utilities, so a <p> here would need a
      // `!` reset the portal forbids.
      /* @__PURE__ */ window.wp.element.jsxs(
        "div",
        {
          "data-variants-line": "",
          className: "mt-3 flex items-start gap-2 px-2 text-xs leading-relaxed text-neutral-400 dark:text-neutral-500",
          children: [
            /* @__PURE__ */ window.wp.element.jsx(ListTree, { size: 14, "aria-hidden": "true", className: "mt-0.5 shrink-0" }),
            /* @__PURE__ */ window.wp.element.jsx("span", { children: g2.variantsLine(w2) })
          ]
        }
      )
    ) : null,
    /* @__PURE__ */ window.wp.element.jsx("span", { "aria-live": "polite", className: "sr-only", children: _2 })
  ] });
}
const za = {
  sectionTitle: "Referral links",
  optionalTag: "optional",
  siteHelper: "Your tracking links, woven into posts where they fit. Links added here seed every new campaign on this site.",
  campaignHelper: "Your tracking links, woven into posts where they fit. Seeded from Site SEO — edits apply to this campaign only; site defaults stay unchanged.",
  labelLabel: "Label",
  labelPlaceholder: "Product or brand name",
  urlLabel: "Destination URL",
  urlPlaceholder: "https://…",
  keywordsLabel: "Relevance keywords",
  keywordsOptionalTag: "optional",
  keywordsPlaceholder: "Topics where this link belongs — press Enter to add",
  keywordsAddAria: "Add a relevance keyword",
  anchorToggle: "Exact anchor text",
  anchorToggleQualifier: "— only if your program requires it",
  anchorLabel: "Exact anchor text",
  anchorPlaceholder: "e.g. TrailPass Pro app",
  anchorHint: "Used verbatim wherever this link appears. Leave empty and Structura writes a natural anchor for each post.",
  anchorClear: "Clear",
  addLink: "Add referral link",
  emptyText: "No referral links yet — add one to have Structura mention it in relevant posts.",
  ftcBefore: "Referral links are usually affiliate relationships. Review the ",
  ftcLink: "affiliate disclosure setting",
  ftcAfter: " for this content — Structura won't switch it on for you.",
  removeRow: (t2) => `Remove ${t2}`,
  removeKeyword: (t2) => `Remove ${t2}`,
  errorLabelRequired: "Label is required — it seeds the anchor text.",
  errorUrlInvalid: "Enter a full URL, including https://. Tracking parameters are kept as-is."
};
function Ze(t2) {
  const r2 = t2.trim().replace(/^https?:\/\//i, "").split("/")[0];
  return r2.includes(".") ? r2 : "";
}
function Da(t2) {
  try {
    const r2 = new URL(t2);
    return r2.protocol === "http:" || r2.protocol === "https:";
  } catch {
    return false;
  }
}
const Ia = () => ({ url: "", label: "", relevanceKeywords: [] });
function Un({
  value: t2,
  onChange: r2,
  binding: a3,
  disclosureHref: i2,
  onDisclosureClick: s2,
  disabled: d2 = false,
  labels: c2
}) {
  const n2 = { ...za, ...c2 }, u2 = window.wp.element.useRef(0), p2 = window.wp.element.useRef([]);
  for (; p2.current.length < t2.length; ) p2.current.push(u2.current++);
  p2.current.length > t2.length && (p2.current.length = t2.length);
  const [b2, m3] = window.wp.element.useState({}), [v2, g2] = window.wp.element.useState({}), [C2, N2] = window.wp.element.useState(/* @__PURE__ */ new Set()), D2 = (w2) => {
    requestAnimationFrame(() => {
      document.querySelector(`[data-referral-label="${w2}"]`)?.focus();
    });
  }, k2 = () => {
    if (d2) return;
    const w2 = u2.current++;
    p2.current = [...p2.current, w2], r2([...t2, Ia()]), D2(w2);
  }, _2 = (w2) => {
    d2 || (p2.current = p2.current.filter((T3, L2) => L2 !== w2), r2(t2.filter((T3, L2) => L2 !== w2)));
  }, S2 = (w2, T3) => {
    r2(t2.map((L2, E2) => E2 === w2 ? { ...L2, ...T3 } : L2));
  }, I2 = (w2, T3, L2) => {
    m3((E2) => {
      const f2 = { ...E2[w2] ?? {} };
      return L2 ? f2[T3] = true : delete f2[T3], { ...E2, [w2]: f2 };
    });
  }, B2 = (w2, T3) => {
    const L2 = (v2[T3] ?? "").trim();
    if (!L2) return;
    const E2 = t2[w2].relevanceKeywords ?? [];
    E2.includes(L2) || S2(w2, { relevanceKeywords: [...E2, L2] }), g2((f2) => ({ ...f2, [T3]: "" }));
  }, R2 = (w2, T3) => {
    const L2 = t2[w2].relevanceKeywords ?? [];
    S2(w2, { relevanceKeywords: L2.filter((E2) => E2 !== T3) });
  }, P2 = (w2, T3, L2) => {
    if (w2.key === "Enter")
      w2.preventDefault(), B2(T3, L2);
    else if (w2.key === "Backspace" && (v2[L2] ?? "") === "") {
      const E2 = t2[T3].relevanceKeywords ?? [];
      E2.length > 0 && (w2.preventDefault(), R2(T3, E2[E2.length - 1]));
    }
  }, V2 = (w2) => N2((T3) => new Set(T3).add(w2)), U2 = (w2, T3) => {
    S2(w2, { anchorText: void 0 }), N2((L2) => {
      const E2 = new Set(L2);
      return E2.delete(T3), E2;
    });
  }, M2 = a3 === "site" ? n2.siteHelper : n2.campaignHelper, y2 = s2 || i2 ? /* @__PURE__ */ window.wp.element.jsx(
    "a",
    {
      href: i2 ?? "#",
      onClick: (w2) => {
        s2 && (w2.preventDefault(), s2());
      },
      className: "font-semibold text-brand-600 hover:underline dark:text-brand-300",
      children: n2.ftcLink
    }
  ) : /* @__PURE__ */ window.wp.element.jsx("span", { className: "font-semibold text-neutral-500 dark:text-neutral-400", children: n2.ftcLink }), O2 = /* @__PURE__ */ window.wp.element.jsxs("p", { className: "flex items-start gap-1.5 text-[11px] leading-snug text-neutral-400 dark:text-neutral-500", children: [
    /* @__PURE__ */ window.wp.element.jsx(Info$1, { size: 13, className: "mt-px shrink-0", "aria-hidden": "true" }),
    /* @__PURE__ */ window.wp.element.jsxs("span", { children: [
      n2.ftcBefore,
      y2,
      n2.ftcAfter
    ] })
  ] });
  return /* @__PURE__ */ window.wp.element.jsxs(
    "section",
    {
      "aria-label": n2.sectionTitle,
      className: "overflow-hidden rounded-2xl border border-neutral-200 bg-white shadow-raised dark:border-neutral-800 dark:bg-neutral-900 dark:ring-1 dark:ring-white/[.04]",
      children: [
        /* @__PURE__ */ window.wp.element.jsxs("header", { className: "flex items-start gap-3 border-b border-neutral-100 px-5 py-4 dark:border-neutral-800", children: [
          /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300", children: /* @__PURE__ */ window.wp.element.jsx(Link$1, { size: 17, "aria-hidden": "true" }) }),
          /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1", children: [
            /* @__PURE__ */ window.wp.element.jsxs("p", { className: "text-sm font-bold text-neutral-900 dark:text-white", children: [
              n2.sectionTitle,
              " ",
              /* @__PURE__ */ window.wp.element.jsxs("span", { className: "font-normal text-neutral-400 dark:text-neutral-500", children: [
                "· ",
                n2.optionalTag
              ] })
            ] }),
            /* @__PURE__ */ window.wp.element.jsx("p", { className: "mt-0.5 text-xs leading-snug text-neutral-400 dark:text-neutral-500", children: M2 })
          ] })
        ] }),
        /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col gap-3 p-5", children: [
          t2.length === 0 ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col items-center gap-3 rounded-xl border border-dashed border-neutral-200 px-6 py-9 text-center dark:border-neutral-700", children: [
            /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex size-10 items-center justify-center rounded-full bg-neutral-100 text-neutral-400 dark:bg-white/[.06] dark:text-neutral-500", children: /* @__PURE__ */ window.wp.element.jsx(Link$1, { size: 17, "aria-hidden": "true" }) }),
            /* @__PURE__ */ window.wp.element.jsx("p", { className: "max-w-xs text-sm leading-relaxed text-neutral-500 dark:text-neutral-400", children: n2.emptyText }),
            /* @__PURE__ */ window.wp.element.jsxs(tr$1, { variant: "secondary", size: "sm", onClick: k2, disabled: d2, children: [
              /* @__PURE__ */ window.wp.element.jsx(Plus$1, { size: 14 }),
              n2.addLink
            ] })
          ] }) : /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
            t2.map((w2, T3) => {
              const L2 = p2.current[T3], E2 = b2[L2] ?? {}, f2 = w2.relevanceKeywords ?? [], A2 = C2.has(L2) || typeof w2.anchorText == "string" && w2.anchorText.length > 0;
              return /* @__PURE__ */ window.wp.element.jsx(
                "div",
                {
                  className: "rounded-xl border border-neutral-200 bg-white p-4 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 dark:ring-1 dark:ring-white/[.04]",
                  children: /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-start gap-2", children: [
                    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "grid min-w-0 flex-1 gap-4", children: [
                      /* @__PURE__ */ window.wp.element.jsxs(
                        "div",
                        {
                          className: "grid gap-4",
                          style: { gridTemplateColumns: "minmax(0,2fr) minmax(0,3fr)" },
                          children: [
                            /* @__PURE__ */ window.wp.element.jsx(
                              he,
                              {
                                label: n2.labelLabel,
                                required: true,
                                size: "sm",
                                "data-referral-label": L2,
                                placeholder: n2.labelPlaceholder,
                                value: w2.label,
                                disabled: d2,
                                "aria-invalid": E2.label ? true : void 0,
                                error: E2.label ? n2.errorLabelRequired : void 0,
                                onChange: (z2) => S2(T3, { label: z2.target.value }),
                                onBlur: () => I2(L2, "label", w2.label.trim() === "")
                              }
                            ),
                            /* @__PURE__ */ window.wp.element.jsx(
                              he,
                              {
                                label: n2.urlLabel,
                                required: true,
                                size: "sm",
                                type: "url",
                                placeholder: n2.urlPlaceholder,
                                value: w2.url,
                                disabled: d2,
                                "aria-invalid": E2.url ? true : void 0,
                                error: E2.url ? n2.errorUrlInvalid : void 0,
                                leftAdornment: Ze(w2.url) ? /* @__PURE__ */ window.wp.element.jsx(At, { domain: Ze(w2.url), size: 14 }) : /* @__PURE__ */ window.wp.element.jsx(Globe$1, { size: 14, className: "shrink-0 text-neutral-400", "aria-hidden": "true" }),
                                onChange: (z2) => S2(T3, { url: z2.target.value }),
                                onBlur: () => I2(
                                  L2,
                                  "url",
                                  w2.url.trim() !== "" && !Da(w2.url.trim())
                                )
                              }
                            )
                          ]
                        }
                      ),
                      /* @__PURE__ */ window.wp.element.jsxs("div", { children: [
                        /* @__PURE__ */ window.wp.element.jsxs("label", { className: "mb-2 block text-[10px] font-black uppercase tracking-widest text-neutral-400 dark:text-neutral-500", children: [
                          n2.keywordsLabel,
                          " ",
                          /* @__PURE__ */ window.wp.element.jsxs("span", { className: "text-neutral-300 dark:text-neutral-600", children: [
                            "· ",
                            n2.keywordsOptionalTag
                          ] })
                        ] }),
                        /* @__PURE__ */ window.wp.element.jsxs(
                          "div",
                          {
                            role: "group",
                            "aria-label": n2.keywordsLabel,
                            className: B$1(
                              "flex flex-wrap items-center gap-1.5 rounded-xl border border-neutral-300 bg-white px-2.5 py-2 shadow-sm transition-all dark:border-neutral-700 dark:bg-neutral-900",
                              "focus-within:!border-brand-600 focus-within:!ring-4 focus-within:!ring-brand-600/10"
                            ),
                            children: [
                              f2.map((z2) => /* @__PURE__ */ window.wp.element.jsxs(
                                "span",
                                {
                                  className: "inline-flex items-center gap-1 rounded-full border border-brand-200 bg-brand-50 px-2.5 py-0.5 text-xs text-brand-800 dark:border-brand-900/40 dark:bg-brand-950/30 dark:text-brand-200",
                                  children: [
                                    z2,
                                    /* @__PURE__ */ window.wp.element.jsx(
                                      "button",
                                      {
                                        type: "button",
                                        "aria-label": n2.removeKeyword(z2),
                                        onClick: () => R2(T3, z2),
                                        disabled: d2,
                                        className: "ml-0.5 shrink-0 cursor-pointer rounded text-brand-500 transition-colors hover:text-red-600 dark:text-brand-400",
                                        children: /* @__PURE__ */ window.wp.element.jsx(X$1, { size: 11 })
                                      }
                                    )
                                  ]
                                },
                                z2
                              )),
                              /* @__PURE__ */ window.wp.element.jsx(
                                "input",
                                {
                                  type: "text",
                                  value: v2[L2] ?? "",
                                  placeholder: f2.length ? "" : n2.keywordsPlaceholder,
                                  "aria-label": n2.keywordsAddAria,
                                  disabled: d2,
                                  onChange: (z2) => g2((x2) => ({ ...x2, [L2]: z2.target.value })),
                                  onKeyDown: (z2) => P2(z2, T3, L2),
                                  onBlur: () => B2(T3, L2),
                                  className: "min-w-[130px] flex-1 border-0 bg-transparent px-1.5 py-0.5 text-sm text-neutral-900 outline-none placeholder:text-neutral-400 dark:text-white dark:placeholder:text-neutral-600"
                                }
                              )
                            ]
                          }
                        )
                      ] }),
                      A2 ? /* @__PURE__ */ window.wp.element.jsx(
                        he,
                        {
                          label: n2.anchorLabel,
                          size: "sm",
                          placeholder: n2.anchorPlaceholder,
                          value: w2.anchorText ?? "",
                          disabled: d2,
                          onChange: (z2) => S2(T3, { anchorText: z2.target.value || void 0 }),
                          rightAdornment: w2.anchorText ? /* @__PURE__ */ window.wp.element.jsx(
                            tr$1,
                            {
                              variant: "transparent",
                              size: "sm",
                              onClick: () => U2(T3, L2),
                              disabled: d2,
                              children: n2.anchorClear
                            }
                          ) : void 0
                        }
                      ) : /* @__PURE__ */ window.wp.element.jsx("div", { children: /* @__PURE__ */ window.wp.element.jsxs(
                        "button",
                        {
                          type: "button",
                          "aria-expanded": false,
                          onClick: () => V2(L2),
                          disabled: d2,
                          className: "inline-flex items-center gap-1.5 rounded-lg py-1 text-xs font-semibold text-neutral-400 transition-colors hover:text-brand-600 dark:text-neutral-500 dark:hover:text-brand-300",
                          children: [
                            /* @__PURE__ */ window.wp.element.jsx(Plus$1, { size: 13, "aria-hidden": "true" }),
                            n2.anchorToggle,
                            " ",
                            /* @__PURE__ */ window.wp.element.jsx("span", { className: "font-normal text-neutral-300 dark:text-neutral-600", children: n2.anchorToggleQualifier })
                          ]
                        }
                      ) }),
                      A2 ? /* @__PURE__ */ window.wp.element.jsx("p", { className: "-mt-2 text-[11px] leading-snug text-neutral-400 dark:text-neutral-500", children: n2.anchorHint }) : null
                    ] }),
                    /* @__PURE__ */ window.wp.element.jsx(
                      "button",
                      {
                        type: "button",
                        "aria-label": n2.removeRow(w2.label.trim() || n2.sectionTitle),
                        onClick: () => _2(T3),
                        disabled: d2,
                        className: "-mr-1 -mt-1 inline-flex size-8 shrink-0 items-center justify-center rounded-lg text-neutral-400 transition-all hover:bg-neutral-100 hover:text-red-600 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:hover:text-red-400",
                        children: /* @__PURE__ */ window.wp.element.jsx(X$1, { size: 16 })
                      }
                    )
                  ] })
                },
                L2
              );
            }),
            /* @__PURE__ */ window.wp.element.jsx("div", { children: /* @__PURE__ */ window.wp.element.jsxs(tr$1, { variant: "secondary", size: "sm", onClick: k2, disabled: d2, children: [
              /* @__PURE__ */ window.wp.element.jsx(Plus$1, { size: 14 }),
              n2.addLink
            ] }) })
          ] }),
          O2
        ] })
      ]
    }
  );
}
const Ea = window.wp.element.forwardRef(
  ({ icon: t2, title: r2, description: a3, action: i2, className: s2, ...d2 }, c2) => /* @__PURE__ */ window.wp.element.jsxs(
    "div",
    {
      ref: c2,
      className: B$1(
        "flex flex-col items-center justify-center gap-4 rounded-2xl border border-dashed border-neutral-200 px-6 py-12 text-center dark:border-neutral-800",
        s2
      ),
      ...d2,
      children: [
        t2 ? /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-brand-50 text-brand-600 dark:bg-brand-950/40 dark:text-brand-400", children: t2 }) : null,
        /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col items-center gap-1.5", children: [
          /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-xl font-bold tracking-tight text-neutral-900 dark:text-neutral-50", children: r2 }),
          a3 ? /* @__PURE__ */ window.wp.element.jsx("span", { className: "max-w-sm text-sm leading-relaxed text-neutral-500 dark:text-neutral-400", children: a3 }) : null
        ] }),
        i2 ? /* @__PURE__ */ window.wp.element.jsx("div", { className: "mt-1", children: i2 }) : null
      ]
    }
  )
);
Ea.displayName = "EmptyState";
const Vt = window.wp.element.forwardRef(
  ({ children: t2, className: r2, variant: a3 = "default", interactive: i2 = false, ...s2 }, d2) => /* @__PURE__ */ window.wp.element.jsx(
    "div",
    {
      ref: d2,
      className: B$1(
        // Structure
        "relative overflow-hidden rounded-2xl border p-6",
        // Elevation — multi-layered raised shadow (design guide 4.1)
        "shadow-raised border-gray-200 bg-white",
        // Transitions — ease-out at duration-normal
        "duration-normal transition-all ease-out",
        // Dark mode — glass-edge treatment
        "dark:border-neutral-800 dark:bg-neutral-900 dark:ring-1 dark:ring-white/4",
        // Interactive hover — only when card represents a clickable target
        i2 && [
          "cursor-pointer",
          "hover:shadow-floating",
          "hover:-translate-y-0.5 hover:scale-[1.015]",
          "dark:hover:ring-white/8"
        ],
        // Danger variant — thick bottom border
        a3 === "danger" && "border-b-4 border-b-red-100 dark:border-b-red-900/20",
        r2
      ),
      ...s2,
      children: t2
    }
  )
);
Vt.displayName = "Card";
const Sa = ({
  open: t2,
  onClose: r2,
  src: a3,
  poster: i2,
  closeLabel: s2,
  videoProps: d2,
  videoClassName: c2,
  children: n2,
  className: u2
}) => /* @__PURE__ */ window.wp.element.jsx(Ke$2, { appear: true, show: t2, as: window.wp.element.Fragment, children: /* @__PURE__ */ window.wp.element.jsx(ht$3, { onClose: r2, className: "relative z-[100050]", children: /* @__PURE__ */ window.wp.element.jsx(
  Ke$2.Child,
  {
    as: window.wp.element.Fragment,
    enter: "duration-slow ease-out",
    enterFrom: "opacity-0",
    enterTo: "opacity-100",
    leave: "duration-normal ease-in",
    leaveFrom: "opacity-100",
    leaveTo: "opacity-0",
    children: /* @__PURE__ */ window.wp.element.jsxs(ze, { className: "fixed inset-0 flex items-center justify-center overflow-y-auto bg-neutral-950/95 p-4 sm:p-10", children: [
      /* @__PURE__ */ window.wp.element.jsx(
        "button",
        {
          type: "button",
          onClick: r2,
          "aria-label": s2,
          className: B$1(
            "absolute top-5 right-5 flex size-9 items-center justify-center rounded-full",
            "bg-white/10 text-white transition-all duration-fast ease-out hover:bg-white/20",
            "focus:outline-none focus-visible:ring-2 focus-visible:ring-white/50"
          ),
          children: /* @__PURE__ */ window.wp.element.jsx(X$1, { className: "size-[18px]", "aria-hidden": "true" })
        }
      ),
      /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex max-h-full flex-col items-center gap-6 sm:flex-row sm:gap-10", children: [
        /* @__PURE__ */ window.wp.element.jsx(
          "video",
          {
            controls: true,
            src: a3,
            poster: i2,
            className: B$1(
              "h-[533px] max-h-[80vh] w-[300px] shrink-0 rounded-2xl bg-neutral-900",
              "object-contain ring-1 ring-white/10",
              c2
            ),
            ...d2
          }
        ),
        n2 != null && /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("w-full max-w-[300px] sm:w-auto", u2), children: n2 })
      ] })
    ] })
  }
) }) });
Sa.displayName = "MediaLightbox";
const Ma = ["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp", "Home", "End"];
function Gn({
  options: t2,
  value: r2,
  onChange: a3,
  ariaLabel: i2,
  className: s2,
  disabled: d2
}) {
  const c2 = window.wp.element.useRef([]), n2 = t2.findIndex((p2) => p2.value === r2);
  return /* @__PURE__ */ window.wp.element.jsx(
    "div",
    {
      role: "radiogroup",
      "aria-label": i2,
      onKeyDown: (p2) => {
        if (d2 || !Ma.includes(p2.key)) return;
        p2.preventDefault();
        let b2;
        if (p2.key === "Home")
          b2 = 0;
        else if (p2.key === "End")
          b2 = t2.length - 1;
        else {
          const v2 = p2.key === "ArrowRight" || p2.key === "ArrowDown" ? 1 : -1;
          b2 = n2 === -1 ? 0 : (n2 + v2 + t2.length) % t2.length;
        }
        const m3 = t2[b2];
        m3 && (m3.value !== r2 && a3(m3.value), c2.current[b2]?.focus());
      },
      className: B$1("grid grid-cols-2 gap-2 sm:grid-cols-4", s2),
      children: t2.map((p2, b2) => {
        const m3 = p2.value === r2, v2 = p2.icon;
        return /* @__PURE__ */ window.wp.element.jsxs(
          "button",
          {
            ref: (g2) => {
              c2.current[b2] = g2;
            },
            type: "button",
            role: "radio",
            "aria-checked": m3,
            disabled: d2,
            tabIndex: m3 || n2 === -1 && b2 === 0 ? 0 : -1,
            onClick: () => a3(p2.value),
            className: B$1(
              "relative flex cursor-pointer flex-col items-start gap-1.5 rounded-xl border p-3 text-left transition-all duration-fast",
              "focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",
              "disabled:cursor-not-allowed disabled:opacity-55",
              m3 ? "border-brand-400 bg-brand-50/60 dark:border-brand-500/50 dark:bg-brand-500/10" : "border-neutral-200 hover:border-neutral-300 dark:border-neutral-800 dark:hover:border-neutral-700"
            ),
            children: [
              m3 && /* @__PURE__ */ window.wp.element.jsx(Check$1, { size: 14, className: "absolute top-2 right-2 text-brand-500", "aria-hidden": "true" }),
              v2 && /* @__PURE__ */ window.wp.element.jsx(v2, { size: 16, className: m3 ? "text-brand-500" : "text-neutral-400" }),
              /* @__PURE__ */ window.wp.element.jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
                /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-[12.5px] font-bold text-neutral-900 dark:text-white", children: p2.label }),
                p2.description != null && /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-[10px] leading-snug text-neutral-400 dark:text-neutral-500", children: p2.description })
              ] })
            ]
          },
          p2.value
        );
      })
    }
  );
}
const Ot = window.wp.element.createContext(null), $a = () => {
  const t2 = window.wp.element.useContext(Ot);
  if (!t2)
    throw new Error("PresetRadioCard must be used within a PresetRadioCardGroup.");
  return t2;
}, Pa = ["ArrowRight", "ArrowDown", "ArrowLeft", "ArrowUp", "Home", "End"], Ut = window.wp.element.forwardRef(
  ({ value: t2, onValueChange: r2, className: a3, onKeyDown: i2, children: s2, ...d2 }, c2) => {
    const n2 = (u2) => {
      if (i2?.(u2), u2.defaultPrevented || !Pa.includes(u2.key)) return;
      const p2 = Array.from(
        u2.currentTarget.querySelectorAll('[role="radio"]')
      ).filter((g2) => !g2.disabled);
      if (p2.length === 0) return;
      const b2 = u2.target.closest('[role="radio"]'), m3 = b2 ? p2.indexOf(b2) : -1;
      let v2;
      if (u2.key === "Home")
        v2 = 0;
      else if (u2.key === "End")
        v2 = p2.length - 1;
      else {
        const g2 = u2.key === "ArrowRight" || u2.key === "ArrowDown" ? 1 : -1;
        v2 = m3 === -1 ? 0 : (m3 + g2 + p2.length) % p2.length;
      }
      u2.preventDefault(), p2[v2].focus(), p2[v2].click();
    };
    return /* @__PURE__ */ window.wp.element.jsx(Ot.Provider, { value: { value: t2, onValueChange: r2 }, children: /* @__PURE__ */ window.wp.element.jsx(
      "div",
      {
        ref: c2,
        role: "radiogroup",
        className: B$1("grid grid-cols-3 gap-2.5", a3),
        onKeyDown: n2,
        ...d2,
        children: s2
      }
    ) });
  }
);
Ut.displayName = "PresetRadioCardGroup";
const Fa = window.wp.element.forwardRef(
  ({
    value: t2,
    name: r2,
    description: a3,
    thumbnailSrc: i2,
    thumbnailAlt: s2 = "",
    thumbnail: d2,
    className: c2,
    onClick: n2,
    ...u2
  }, p2) => {
    const b2 = $a(), m3 = b2.value === t2, v2 = b2.value == null || m3 ? 0 : -1;
    return /* @__PURE__ */ window.wp.element.jsxs(
      "button",
      {
        ref: p2,
        type: "button",
        role: "radio",
        "aria-checked": m3,
        tabIndex: v2,
        onClick: (g2) => {
          n2?.(g2), g2.defaultPrevented || b2.onValueChange(t2);
        },
        className: B$1(
          "group rounded-xl border p-2 text-left transition-all duration-fast ease-out",
          "focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",
          "disabled:cursor-not-allowed disabled:opacity-55",
          m3 ? "border-brand-600 bg-brand-50/60 shadow-glow-brand dark:border-brand-400 dark:bg-brand-500/10" : "border-neutral-200 bg-white hover:border-neutral-300 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:border-neutral-600",
          c2
        ),
        ...u2,
        children: [
          /* @__PURE__ */ window.wp.element.jsx("span", { className: "block h-24 w-full overflow-hidden rounded-lg bg-neutral-100 dark:bg-neutral-800", children: d2 ?? (i2 ? /* @__PURE__ */ window.wp.element.jsx("img", { src: i2, alt: s2, className: "h-full w-full object-cover" }) : null) }),
          /* @__PURE__ */ window.wp.element.jsxs("span", { className: "mt-2 flex items-center justify-between gap-1", children: [
            /* @__PURE__ */ window.wp.element.jsx("span", { className: "truncate text-xs font-bold text-neutral-900 dark:text-neutral-100", children: r2 }),
            m3 && /* @__PURE__ */ window.wp.element.jsx(
              Check$1,
              {
                className: "size-[13px] shrink-0 text-brand-600 dark:text-brand-400",
                "aria-hidden": "true"
              }
            )
          ] }),
          a3 != null && /* @__PURE__ */ window.wp.element.jsx("span", { className: "mt-0.5 block text-[10px] leading-snug text-neutral-500 dark:text-neutral-400", children: a3 })
        ]
      }
    );
  }
);
Fa.displayName = "PresetRadioCard";
const ja = "#5B3FE5", Ba = "linear-gradient(160deg,#e2dccf 0%,#c8bfae 46%,#8e8474 100%)", qe = "rgba(0,0,0,.6)";
function Va(t2) {
  const r2 = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(t2.trim());
  if (!r2) return "#ffffff";
  let a3 = r2[1];
  a3.length === 3 && (a3 = a3.split("").map((n2) => n2 + n2).join(""));
  const i2 = parseInt(a3.slice(0, 2), 16), s2 = parseInt(a3.slice(2, 4), 16), d2 = parseInt(a3.slice(4, 6), 16);
  return (i2 * 299 + s2 * 587 + d2 * 114) / 1e3 >= 128 ? "#0a0a0a" : "#ffffff";
}
const Oa = window.wp.element.forwardRef(
  ({ kind: t2, accent: r2 = ja, className: a3, style: i2, ...s2 }, d2) => /* @__PURE__ */ window.wp.element.jsxs(
    "div",
    {
      ref: d2,
      "data-kind": t2,
      className: B$1("relative h-full w-full overflow-hidden rounded-lg", a3),
      style: { backgroundImage: Ba, ...i2 },
      ...s2,
      "aria-hidden": "true",
      children: [
        /* @__PURE__ */ window.wp.element.jsx("div", { className: "absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-t from-neutral-950/30 to-transparent" }),
        t2 === "clean" && /* @__PURE__ */ window.wp.element.jsx("div", { className: "absolute inset-x-2 bottom-2 text-center", children: /* @__PURE__ */ window.wp.element.jsx(
          "span",
          {
            className: "rounded-md px-1.5 py-0.5 text-[8.5px] font-semibold leading-tight text-white",
            style: { backgroundColor: qe },
            children: "grows 3× faster"
          }
        ) }),
        t2 === "bold" && /* @__PURE__ */ window.wp.element.jsxs("div", { className: "absolute inset-x-1 bottom-2 text-center", children: [
          /* @__PURE__ */ window.wp.element.jsxs(
            "span",
            {
              className: "inline-block rounded-md px-1.5 py-1 text-[10px] font-black uppercase leading-none tracking-tight text-white",
              style: { backgroundColor: qe },
              children: [
                "GROWS",
                /* @__PURE__ */ window.wp.element.jsx("br", {}),
                "3× FASTER"
              ]
            }
          ),
          /* @__PURE__ */ window.wp.element.jsx(
            "span",
            {
              className: "mx-auto mt-1 block h-[3px] w-7 rounded-full",
              style: { backgroundColor: r2 }
            }
          )
        ] }),
        t2 === "kinetic" && /* @__PURE__ */ window.wp.element.jsxs("div", { className: "absolute inset-x-1 bottom-2 flex flex-wrap justify-center gap-[3px]", children: [
          /* @__PURE__ */ window.wp.element.jsx(
            "span",
            {
              className: "rounded-sm px-1 py-0.5 text-[8px] font-extrabold leading-none",
              style: { backgroundColor: r2, color: Va(r2) },
              children: "3×"
            }
          ),
          /* @__PURE__ */ window.wp.element.jsx("span", { className: "rounded-sm bg-neutral-950/85 px-1 py-0.5 text-[8px] font-bold leading-none text-white", children: "faster" })
        ] })
      ]
    }
  )
);
Oa.displayName = "VideoStylePreview";
const Ua = ["top", "middle", "bottom"], Ka = {
  top: { top: 5 },
  middle: { top: "50%", marginTop: -1.5 },
  bottom: { bottom: 5 }
}, Ha = window.wp.element.forwardRef(
  ({ value: t2, onValueChange: r2, labels: a3, className: i2, ...s2 }, d2) => /* @__PURE__ */ window.wp.element.jsx("div", { ref: d2, className: B$1("@container", i2), children: /* @__PURE__ */ window.wp.element.jsx(
    Ut,
    {
      value: t2,
      onValueChange: (c2) => r2(c2),
      className: "@max-[420px]:grid-cols-1",
      ...s2,
      children: Ua.map((c2) => {
        const n2 = t2 === c2;
        return /* @__PURE__ */ window.wp.element.jsxs(
          "button",
          {
            type: "button",
            role: "radio",
            "aria-checked": n2,
            tabIndex: t2 == null || n2 ? 0 : -1,
            onClick: () => r2(c2),
            className: B$1(
              "flex items-center gap-2.5 rounded-xl border px-3 py-2 text-left transition-all duration-fast ease-out",
              "focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",
              "disabled:cursor-not-allowed disabled:opacity-55",
              n2 ? "border-brand-600 bg-brand-50/60 shadow-glow-brand dark:border-brand-400 dark:bg-brand-500/10" : "border-neutral-200 bg-white hover:border-neutral-300 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:border-neutral-600"
            ),
            children: [
              /* @__PURE__ */ window.wp.element.jsx(
                "span",
                {
                  "aria-hidden": "true",
                  className: B$1(
                    "relative block h-11 w-[26px] shrink-0 rounded-[4px] border",
                    n2 ? "border-brand-400/70 bg-brand-100/50 dark:border-brand-400/60 dark:bg-brand-500/15" : "border-neutral-300 bg-neutral-100 dark:border-neutral-600 dark:bg-neutral-800"
                  ),
                  children: /* @__PURE__ */ window.wp.element.jsx(
                    "span",
                    {
                      className: B$1(
                        "absolute inset-x-[4px] h-[3px] rounded-full",
                        n2 ? "bg-brand-600 dark:bg-brand-400" : "bg-neutral-400 dark:bg-neutral-500"
                      ),
                      style: Ka[c2]
                    }
                  )
                }
              ),
              /* @__PURE__ */ window.wp.element.jsxs("span", { className: "flex min-w-0 items-center gap-1.5 text-xs font-bold text-neutral-900 dark:text-neutral-100", children: [
                /* @__PURE__ */ window.wp.element.jsx("span", { className: "truncate", children: a3[c2] }),
                n2 && /* @__PURE__ */ window.wp.element.jsx(
                  Check$1,
                  {
                    className: "size-3 shrink-0 text-brand-600 dark:text-brand-400",
                    "aria-hidden": "true"
                  }
                )
              ] })
            ]
          },
          c2
        );
      })
    }
  ) })
);
Ha.displayName = "PlacementRadio";
const Ga = window.wp.element.forwardRef(
  ({ title: t2, badge: r2, line: a3, cta: i2, icon: s2, className: d2, ...c2 }, n2) => /* @__PURE__ */ window.wp.element.jsxs(
    "div",
    {
      ref: n2,
      className: B$1(
        "flex flex-wrap items-center gap-3 rounded-xl border border-neutral-200 bg-neutral-50/70 px-4 py-3.5",
        "dark:border-neutral-700 dark:bg-neutral-800/40",
        d2
      ),
      ...c2,
      children: [
        /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-neutral-100 text-neutral-400 dark:bg-white/[.06] dark:text-neutral-500", children: s2 ?? /* @__PURE__ */ window.wp.element.jsx(Lock$1, { className: "size-4", "aria-hidden": "true" }) }),
        /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1 basis-48", children: [
          /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
            /* @__PURE__ */ window.wp.element.jsx("p", { className: "text-sm font-bold text-neutral-900 dark:text-neutral-100", children: t2 }),
            r2 != null && (typeof r2 == "string" ? /* @__PURE__ */ window.wp.element.jsx(Me, { intent: "premium", children: r2 }) : r2)
          ] }),
          a3 != null && /* @__PURE__ */ window.wp.element.jsx("p", { className: "mt-0.5 text-xs leading-relaxed text-neutral-500 dark:text-neutral-400", children: a3 })
        ] }),
        i2 != null && /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex shrink-0 items-center", children: i2 })
      ]
    }
  )
);
Ga.displayName = "SectionGateTeaser";
const Wa = window.wp.element.forwardRef(
  ({ colors: t2, size: r2 = 16, max: a3 = 5, label: i2, className: s2, ...d2 }, c2) => {
    const n2 = Math.round(r2 * 0.375);
    return /* @__PURE__ */ window.wp.element.jsx(
      "div",
      {
        ref: c2,
        role: "img",
        "aria-label": i2,
        className: B$1("flex shrink-0 items-center", s2),
        ...d2,
        children: t2.slice(0, a3).map((u2, p2) => /* @__PURE__ */ window.wp.element.jsx(
          "span",
          {
            "aria-hidden": "true",
            className: "rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/20",
            style: {
              width: r2,
              height: r2,
              backgroundColor: u2,
              marginLeft: p2 === 0 ? void 0 : -n2
            }
          },
          `${u2}-${p2}`
        ))
      }
    );
  }
);
Wa.displayName = "PaletteSwatches";
const Za = {
  brand: "bg-brand-600 dark:bg-brand-500",
  warning: "bg-amber-500"
}, Fe = window.wp.element.forwardRef(
  ({ className: t2, fillClassName: r2, value: a3, max: i2 = 100, intent: s2 = "brand", ...d2 }, c2) => {
    const n2 = a3 === void 0 ? void 0 : Math.min(Math.max(a3, 0), Math.max(i2, 0)), u2 = n2 === void 0, p2 = u2 || i2 <= 0 ? 0 : n2 / i2 * 100;
    return /* @__PURE__ */ window.wp.element.jsx(
      "div",
      {
        ref: c2,
        role: "progressbar",
        "aria-valuenow": u2 ? void 0 : n2,
        "aria-valuemin": u2 ? void 0 : 0,
        "aria-valuemax": u2 ? void 0 : i2,
        className: B$1(
          "h-1.5 w-full overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-700",
          t2
        ),
        ...d2,
        children: /* @__PURE__ */ window.wp.element.jsx(
          "div",
          {
            className: B$1(
              "h-full rounded-full",
              Za[s2],
              u2 && "w-1/3 animate-progress-runner motion-reduce:animate-none",
              r2
            ),
            style: u2 ? void 0 : { width: `${p2}%` }
          }
        )
      }
    );
  }
);
Fe.displayName = "ProgressBar";
const qa = window.wp.element.forwardRef(
  ({ used: t2, total: r2, label: a3, note: i2, exhausted: s2, barClassName: d2, className: c2, ...n2 }, u2) => {
    const p2 = s2 ?? t2 >= r2;
    return /* @__PURE__ */ window.wp.element.jsxs("div", { ref: u2, className: B$1("min-w-0", c2), ...n2, children: [
      /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
        /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-xs font-semibold text-neutral-700 dark:text-neutral-200", children: a3 }),
        i2 != null && /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-[11px] text-neutral-400 dark:text-neutral-500", children: i2 })
      ] }),
      /* @__PURE__ */ window.wp.element.jsx(
        Fe,
        {
          value: t2,
          max: r2,
          intent: p2 ? "warning" : "brand",
          className: B$1("mt-1.5", d2)
        }
      )
    ] });
  }
);
qa.displayName = "QuotaMeter";
function Wn({
  className: t2
}) {
  return /* @__PURE__ */ window.wp.element.jsxs(
    "svg",
    {
      viewBox: "0 0 40 40",
      fill: "none",
      ...t2 ? { className: t2 } : {},
      "aria-hidden": "true",
      children: [
        /* @__PURE__ */ window.wp.element.jsx(
          "rect",
          {
            x: "11.3",
            y: "5.3",
            width: "17.4",
            height: "29.4",
            rx: "4.7",
            stroke: "currentColor",
            strokeWidth: "2.6"
          }
        ),
        /* @__PURE__ */ window.wp.element.jsx("path", { d: "M17.6 15.2v9.6l8-4.8z", fill: "currentColor" })
      ]
    }
  );
}
const Ya = me$1(
  [
    "flex size-5 items-center justify-center rounded border shadow-sm",
    // Transitions — fast with spring deceleration
    "transition-all duration-fast ease-out",
    // Focus — soft glow pattern (design guide 6.5)
    "focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)]",
    // Disabled
    "data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
  ].join(" "),
  {
    variants: {
      intent: {
        primary: (
          // Unchecked — gray border, white bg
          "border-gray-300 bg-white dark:border-gray-700 dark:bg-gray-900 data-[checked]:bg-brand-600 data-[checked]:border-brand-600 data-[checked]:text-white hover:border-brand-500 dark:hover:border-brand-400"
        )
      }
    },
    defaultVariants: {
      intent: "primary"
    }
  }
), Xa = window.wp.element.forwardRef(
  ({ label: t2, hiddenLabel: r2, checked: a3, onChange: i2, className: s2, description: d2, ...c2 }, n2) => /* @__PURE__ */ window.wp.element.jsx("div", { ref: n2, children: /* @__PURE__ */ window.wp.element.jsxs(W, { className: B$1("flex items-start gap-3", s2), children: [
    /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex h-6 cursor-pointer items-center", children: /* @__PURE__ */ window.wp.element.jsx(
      Ke$3,
      {
        checked: a3,
        onChange: i2,
        ...c2,
        className: B$1("group/checkbox", Ya()),
        children: /* @__PURE__ */ window.wp.element.jsx(
          Check$1,
          {
            strokeWidth: 3,
            className: "size-3.5 text-white opacity-0 group-data-checked/checkbox:opacity-100"
          }
        )
      }
    ) }),
    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col", children: [
      /* @__PURE__ */ window.wp.element.jsx(
        Z,
        {
          className: B$1(
            "mt-0.5 cursor-pointer text-sm font-medium text-gray-700 select-none group-data-disabled:opacity-50 dark:text-gray-200",
            r2 && "sr-only"
          ),
          children: t2
        }
      ),
      d2 && /* @__PURE__ */ window.wp.element.jsx("p", { className: "text-xs text-gray-500 select-none group-data-disabled:opacity-50 dark:text-gray-400", children: d2 })
    ] })
  ] }) })
);
Xa.displayName = "Checkbox";
const Qa = me$1(
  [
    "relative inline-flex h-5 w-10 shrink-0 cursor-pointer items-center rounded-full",
    "border-2 border-transparent",
    // Transitions — spring easing for toggle (design guide 6.4: "Toggle/switch → --ease-spring")
    "transition-colors duration-normal ease-spring",
    // Focus — soft glow pattern (design guide 6.5)
    "focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)]",
    // Disabled
    "disabled:cursor-not-allowed disabled:opacity-50"
  ].join(" "),
  {
    variants: {
      intent: {
        primary: "bg-neutral-300 dark:bg-neutral-700 data-checked:bg-brand-600 dark:data-checked:bg-brand-500"
      }
    },
    defaultVariants: {
      intent: "primary"
    }
  }
), Ja = window.wp.element.forwardRef(
  ({ label: t2, hiddenLabel: r2, checked: a3, onChange: i2, className: s2, description: d2, disabled: c2, ...n2 }, u2) => /* @__PURE__ */ window.wp.element.jsx("div", { ref: u2, children: /* @__PURE__ */ window.wp.element.jsxs(W, { className: B$1("flex items-start justify-between gap-4", s2), children: [
    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col", children: [
      /* @__PURE__ */ window.wp.element.jsx(
        Z,
        {
          className: B$1(
            "mt-0.5 cursor-pointer text-sm font-medium text-gray-700 select-none dark:text-gray-200",
            c2 && "cursor-not-allowed opacity-50",
            r2 && "sr-only"
          ),
          children: t2
        }
      ),
      d2 && /* @__PURE__ */ window.wp.element.jsx(
        "p",
        {
          className: B$1(
            "text-xs text-gray-500 select-none dark:text-gray-400",
            c2 && "opacity-50"
          ),
          children: d2
        }
      )
    ] }),
    /* @__PURE__ */ window.wp.element.jsx(
      tt,
      {
        checked: a3,
        onChange: i2,
        disabled: c2,
        className: B$1("group", Qa()),
        ...n2,
        children: /* @__PURE__ */ window.wp.element.jsx(
          "span",
          {
            "aria-hidden": "true",
            className: "pointer-events-none inline-block size-4 translate-x-1 transform rounded-full bg-white shadow-sm ring-0 transition-transform duration-normal ease-spring group-data-checked:translate-x-5!"
          }
        )
      }
    )
  ] }) })
);
Ja.displayName = "Switch";
const en = /\.(png|jpe?g|gif|webp|svg|avif|bmp|ico)(\?|#|$)/i;
function tn(t2, r2) {
  return r2.includes("image") ? true : en.test(t2);
}
function ue(t2) {
  return t2 < 1024 ? `${t2} B` : t2 < 1024 * 1024 ? `${Math.round(t2 / 1024)} KB` : `${(t2 / (1024 * 1024)).toFixed(1)} MB`;
}
function Kt(t2, r2) {
  const a3 = r2.split(",").map((d2) => d2.trim().toLowerCase()).filter(Boolean);
  if (a3.length === 0) return true;
  const i2 = t2.type.toLowerCase(), s2 = t2.name.toLowerCase();
  return a3.some((d2) => d2.endsWith("/*") ? i2.startsWith(d2.slice(0, -1)) : d2.startsWith(".") ? s2.endsWith(d2) : i2 === d2);
}
const rn = window.wp.element.forwardRef(
  ({
    value: t2,
    onChange: r2,
    onUpload: a3,
    label: i2,
    hiddenLabel: s2,
    hint: d2,
    error: c2,
    accept: n2 = "image/*",
    maxSize: u2,
    preview: p2,
    allowUrl: b2 = false,
    disabled: m3 = false,
    className: v2
  }, g2) => {
    const C2 = window.wp.element.useRef(null), N2 = window.wp.element.useId(), [D2, k2] = window.wp.element.useState(false), [_2, S2] = window.wp.element.useState(false), [I2, B2] = window.wp.element.useState(null), [R2, P2] = window.wp.element.useState(null), [V2, U2] = window.wp.element.useState(false), [M2, y2] = window.wp.element.useState(""), O2 = c2 ?? R2, w2 = (p2 ?? tn(t2 ?? "", n2)) && !!t2 && !_2, T3 = window.wp.element.useCallback(
      async (f2) => {
        P2(null);
        const A2 = f2?.[0];
        if (A2) {
          if (!Kt(A2, n2)) {
            P2(`That file type isn't supported. Allowed: ${n2}.`);
            return;
          }
          if (u2 && A2.size > u2) {
            P2(
              `File is too large (${ue(A2.size)}). Max ${ue(u2)}.`
            );
            return;
          }
          S2(true), B2(null);
          try {
            const z2 = await a3(A2, {
              onProgress: (F2) => B2(Math.max(0, Math.min(100, F2)))
            }), x2 = typeof z2 == "string" ? z2 : z2.url;
            x2 && r2(x2);
          } catch (z2) {
            P2(
              z2 instanceof Error && z2.message ? z2.message : "Upload failed. Please try again."
            );
          } finally {
            S2(false), B2(null), C2.current && (C2.current.value = "");
          }
        }
      },
      [n2, u2, r2, a3]
    ), L2 = (f2) => {
      f2.preventDefault(), k2(false), !(m3 || _2) && T3(f2.dataTransfer.files);
    }, E2 = () => {
      m3 || _2 || C2.current?.click();
    };
    return /* @__PURE__ */ window.wp.element.jsxs("div", { ref: g2, className: B$1("flex flex-col gap-1.5", v2), children: [
      i2 ? /* @__PURE__ */ window.wp.element.jsx(
        "label",
        {
          htmlFor: N2,
          className: B$1(
            "text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400",
            s2 && "sr-only"
          ),
          children: i2
        }
      ) : null,
      w2 ? (
        /* ── Uploaded state — preview + replace/remove ─────────── */
        /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center gap-4 rounded-xl border border-neutral-200 bg-neutral-50 p-3 dark:border-neutral-800 dark:bg-neutral-900", children: [
          /* @__PURE__ */ window.wp.element.jsx(
            "img",
            {
              src: t2,
              alt: "",
              className: "h-14 w-14 shrink-0 rounded-lg border border-neutral-200 bg-white object-contain dark:border-neutral-700"
            }
          ),
          /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1", children: [
            /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! truncate text-sm font-medium text-neutral-800 dark:text-neutral-200", children: t2?.split("/").pop() || t2 }),
            /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! truncate text-xs text-neutral-400 dark:text-neutral-500", children: t2 })
          ] }),
          /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
            /* @__PURE__ */ window.wp.element.jsx(
              "button",
              {
                type: "button",
                onClick: E2,
                disabled: m3,
                className: "flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-neutral-500 transition-colors hover:bg-neutral-200/60 hover:text-neutral-700 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-neutral-200",
                "aria-label": "Replace file",
                title: "Replace",
                children: /* @__PURE__ */ window.wp.element.jsx(RefreshCw$1, { size: 15 })
              }
            ),
            /* @__PURE__ */ window.wp.element.jsx(
              "button",
              {
                type: "button",
                onClick: () => {
                  P2(null), r2("");
                },
                disabled: m3,
                className: "flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-neutral-500 transition-colors hover:bg-red-50 hover:text-red-600 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-400 dark:hover:bg-red-950/30 dark:hover:text-red-400",
                "aria-label": "Remove file",
                title: "Remove",
                children: /* @__PURE__ */ window.wp.element.jsx(Trash2$1, { size: 15 })
              }
            )
          ] })
        ] })
      ) : (
        /* ── Empty / dropzone state ────────────────────────────── */
        /* @__PURE__ */ window.wp.element.jsx(
          "div",
          {
            role: "button",
            tabIndex: m3 ? -1 : 0,
            "aria-disabled": m3,
            onClick: E2,
            onKeyDown: (f2) => {
              (f2.key === "Enter" || f2.key === " ") && (f2.preventDefault(), E2());
            },
            onDragOver: (f2) => {
              f2.preventDefault(), !m3 && !_2 && k2(true);
            },
            onDragLeave: () => k2(false),
            onDrop: L2,
            className: B$1(
              "flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed px-6 py-8 text-center transition-colors outline-none",
              "focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-neutral-950",
              m3 ? "cursor-not-allowed border-neutral-200 bg-neutral-50 opacity-60 dark:border-neutral-800 dark:bg-neutral-900" : D2 ? "cursor-pointer border-brand-400 bg-brand-50 dark:border-brand-500 dark:bg-brand-950/30" : O2 ? "cursor-pointer border-red-300 bg-red-50/40 dark:border-red-900/50 dark:bg-red-950/10" : "cursor-pointer border-neutral-300 bg-white hover:border-brand-300 hover:bg-brand-50/40 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:border-brand-600 dark:hover:bg-brand-950/20"
            ),
            children: _2 ? /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
              /* @__PURE__ */ window.wp.element.jsx(LoaderCircle$1, { size: 22, className: "animate-spin text-brand-500" }),
              /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! text-sm font-medium text-neutral-700 dark:text-neutral-300", children: I2 !== null ? `Uploading… ${I2}%` : "Uploading…" }),
              I2 !== null ? /* @__PURE__ */ window.wp.element.jsx("div", { className: "mt-1 h-1.5 w-40 overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-800", children: /* @__PURE__ */ window.wp.element.jsx(
                "div",
                {
                  className: "h-full rounded-full bg-brand-500 transition-all duration-200",
                  style: { width: `${I2}%` }
                }
              ) }) : null
            ] }) : /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
              /* @__PURE__ */ window.wp.element.jsx(
                "span",
                {
                  className: B$1(
                    "flex h-11 w-11 items-center justify-center rounded-full",
                    D2 ? "bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-300" : "bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"
                  ),
                  children: n2.includes("image") ? /* @__PURE__ */ window.wp.element.jsx(ImagePlus, { size: 20 }) : /* @__PURE__ */ window.wp.element.jsx(CloudUpload, { size: 20 })
                }
              ),
              /* @__PURE__ */ window.wp.element.jsxs("p", { className: "m-0! text-sm font-medium text-neutral-700 dark:text-neutral-300", children: [
                /* @__PURE__ */ window.wp.element.jsx("span", { className: "text-brand-600 dark:text-brand-400", children: "Click to upload" }),
                " ",
                "or drag and drop"
              ] }),
              /* @__PURE__ */ window.wp.element.jsxs("p", { className: "m-0! text-xs text-neutral-400 dark:text-neutral-500", children: [
                n2 === "image/*" ? "PNG, JPG, SVG or WebP" : n2,
                u2 ? ` · up to ${ue(u2)}` : ""
              ] })
            ] })
          }
        )
      ),
      /* @__PURE__ */ window.wp.element.jsx(
        "input",
        {
          ref: C2,
          id: N2,
          type: "file",
          accept: n2,
          disabled: m3,
          className: "hidden",
          onChange: (f2) => {
            T3(f2.target.files);
          }
        }
      ),
      b2 && !w2 && !_2 ? V2 ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center gap-2", children: [
        /* @__PURE__ */ window.wp.element.jsx(
          "input",
          {
            type: "url",
            autoFocus: true,
            value: M2,
            onChange: (f2) => y2(f2.target.value),
            onKeyDown: (f2) => {
              if (f2.key === "Enter") {
                f2.preventDefault();
                const A2 = M2.trim();
                A2 && r2(A2), U2(false), y2("");
              }
            },
            placeholder: "https://example.com/logo.png",
            className: "min-w-0 flex-1 rounded-lg border border-neutral-300 bg-white px-3 py-1.5 text-sm text-neutral-900 outline-none focus:border-brand-400 focus:ring-2 focus:ring-brand-500/30 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-100"
          }
        ),
        /* @__PURE__ */ window.wp.element.jsx(
          "button",
          {
            type: "button",
            onClick: () => {
              const f2 = M2.trim();
              f2 && r2(f2), U2(false), y2("");
            },
            className: "shrink-0 cursor-pointer rounded-md bg-brand-500 px-3 py-1.5 text-xs font-medium text-white hover:bg-brand-600",
            children: "Use URL"
          }
        ),
        /* @__PURE__ */ window.wp.element.jsx(
          "button",
          {
            type: "button",
            onClick: () => {
              U2(false), y2("");
            },
            "aria-label": "Cancel URL entry",
            className: "shrink-0 cursor-pointer rounded-md p-1.5 text-neutral-400 hover:text-neutral-600 dark:hover:text-neutral-300",
            children: /* @__PURE__ */ window.wp.element.jsx(X$1, { size: 14 })
          }
        )
      ] }) : /* @__PURE__ */ window.wp.element.jsxs(
        "button",
        {
          type: "button",
          onClick: () => U2(true),
          disabled: m3,
          className: "flex w-fit cursor-pointer items-center gap-1.5 text-xs text-neutral-500 transition-colors hover:text-brand-600 disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-400 dark:hover:text-brand-400",
          children: [
            /* @__PURE__ */ window.wp.element.jsx(Link2$1, { size: 12 }),
            "Paste a URL instead"
          ]
        }
      ) : null,
      O2 ? /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! text-xs text-red-600 dark:text-red-400", role: "alert", children: O2 }) : d2 ? /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400", children: d2 }) : null
    ] });
  }
);
rn.displayName = "FileUpload";
const Ye = ".pdf,.docx,.txt,.md,.html,.htm", an = 5, nn = 10 * 1024 * 1024, ln = 150;
function sn(t2) {
  const r2 = t2.lastIndexOf("."), a3 = r2 === -1 ? "" : t2.slice(r2 + 1).toLowerCase();
  return a3 === "htm" ? "html" : a3;
}
function dn() {
  return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `ra-${Math.random().toString(36).slice(2)}`;
}
function on() {
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}
function Te({ ext: t2, failed: r2 }) {
  return /* @__PURE__ */ window.wp.element.jsx(
    "span",
    {
      className: B$1(
        "flex h-9 w-10 shrink-0 items-center justify-center rounded-lg font-mono text-[9px] font-bold uppercase tracking-wide",
        r2 ? "bg-red-50 text-red-600 ring-1 ring-inset ring-red-100 dark:bg-red-500/10 dark:text-red-300 dark:ring-red-500/20" : "bg-neutral-100 text-neutral-500 ring-1 ring-inset ring-neutral-200 dark:bg-white/[.06] dark:text-neutral-400 dark:ring-white/[.08]"
      ),
      "aria-hidden": "true",
      children: t2.toUpperCase()
    }
  );
}
function _e({
  label: t2,
  onClick: r2,
  danger: a3,
  disabled: i2,
  children: s2
}) {
  return /* @__PURE__ */ window.wp.element.jsx(
    "button",
    {
      type: "button",
      "aria-label": t2,
      title: t2,
      onClick: r2,
      disabled: i2,
      className: B$1(
        "flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-neutral-400 transition-colors disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-500",
        a3 ? "hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-950/30 dark:hover:text-red-400" : "hover:bg-neutral-100 hover:text-neutral-600 dark:hover:bg-white/10 dark:hover:text-neutral-300"
      ),
      children: s2
    }
  );
}
const cn = window.wp.element.forwardRef(
  ({
    files: t2,
    onFilesChange: r2,
    onUpload: a3,
    onRemove: i2,
    maxFiles: s2 = an,
    maxSizeBytes: d2 = nn,
    disabled: c2 = false,
    labels: n2,
    className: u2
  }, p2) => {
    const b2 = window.wp.element.useRef(null), [m3, v2] = window.wp.element.useState(false), [g2, C2] = window.wp.element.useState([]), [N2, D2] = window.wp.element.useState(/* @__PURE__ */ new Set()), k2 = window.wp.element.useRef(t2);
    k2.current = t2;
    const _2 = window.wp.element.useRef(r2);
    _2.current = r2;
    const S2 = window.wp.element.useRef(a3);
    S2.current = a3;
    const I2 = window.wp.element.useRef(i2);
    I2.current = i2;
    const B2 = window.wp.element.useRef(Promise.resolve()), R2 = window.wp.element.useRef(/* @__PURE__ */ new Set()), P2 = window.wp.element.useRef(/* @__PURE__ */ new Map()), V2 = window.wp.element.useRef(/* @__PURE__ */ new Set());
    window.wp.element.useEffect(() => {
      const h4 = V2.current;
      return () => h4.forEach(clearTimeout);
    }, []);
    const U2 = window.wp.element.useCallback((h4) => {
      k2.current = h4, _2.current(h4);
    }, []), M2 = window.wp.element.useCallback(
      (h4, W2) => {
        U2(
          k2.current.map((K2) => K2.localId === h4 ? { ...K2, ...W2 } : K2)
        );
      },
      [U2]
    ), y2 = window.wp.element.useCallback(
      async (h4, W2) => {
        try {
          const K2 = await S2.current(W2);
          if (R2.current.delete(h4)) return;
          P2.current.delete(h4), M2(h4, {
            status: "ready",
            attachmentId: K2.attachmentId,
            extracted: {
              unit: K2.extractedUnit,
              used: K2.extractedUsed,
              total: K2.extractedTotal,
              truncated: K2.truncated
            },
            errorMessage: void 0
          });
        } catch (K2) {
          if (R2.current.delete(h4)) return;
          M2(h4, {
            status: "failed",
            errorMessage: K2 instanceof Error && K2.message ? K2.message : void 0
          });
        }
      },
      [M2]
    ), O2 = window.wp.element.useCallback(
      (h4, W2) => {
        B2.current = B2.current.then(() => y2(h4, W2));
      },
      [y2]
    ), w2 = t2.filter((h4) => !N2.has(h4.localId)).length, T3 = w2 >= s2, L2 = window.wp.element.useCallback(
      (h4) => {
        if (c2) return;
        const W2 = Array.from(h4 ?? []);
        if (W2.length === 0) return;
        const K2 = [], Q2 = [];
        let pe2 = false, je2 = k2.current.filter((Z2) => !N2.has(Z2.localId)).length;
        for (const Z2 of W2) {
          if (!Kt(Z2, Ye)) {
            Q2.push(n2.rejectType(Z2.name));
            continue;
          }
          if (Z2.size > d2) {
            Q2.push(n2.rejectSize(Z2.name, ue(Z2.size)));
            continue;
          }
          if (je2 >= s2) {
            pe2 || (Q2.push(n2.capStrip), pe2 = true);
            continue;
          }
          je2 += 1, K2.push({ localId: dn(), file: Z2 });
        }
        if (C2(
          (Z2) => K2.length > 0 ? Q2 : [...Z2, ...Q2]
        ), K2.length === 0) return;
        const xr = K2.map(({ localId: Z2, file: de2 }) => (P2.current.set(Z2, de2), {
          localId: Z2,
          name: de2.name,
          ext: sn(de2.name),
          sizeBytes: de2.size,
          status: "busy"
        }));
        U2([...k2.current, ...xr]);
        for (const { localId: Z2, file: de2 } of K2) O2(Z2, de2);
      },
      [U2, c2, O2, n2, N2, s2, d2]
    ), E2 = window.wp.element.useCallback(
      (h4) => {
        const W2 = () => {
          U2(k2.current.filter((Q2) => Q2.localId !== h4)), D2((Q2) => {
            if (!Q2.has(h4)) return Q2;
            const pe2 = new Set(Q2);
            return pe2.delete(h4), pe2;
          });
        };
        if (on()) {
          W2();
          return;
        }
        D2((Q2) => new Set(Q2).add(h4));
        const K2 = setTimeout(() => {
          V2.current.delete(K2), W2();
        }, ln);
        V2.current.add(K2);
      },
      [U2]
    ), f2 = window.wp.element.useCallback(
      (h4) => {
        h4.attachmentId && I2.current?.(h4.attachmentId), P2.current.delete(h4.localId), E2(h4.localId);
      },
      [E2]
    ), A2 = window.wp.element.useCallback(
      (h4) => {
        R2.current.add(h4.localId), f2(h4);
      },
      [f2]
    ), z2 = window.wp.element.useCallback(
      (h4) => {
        const W2 = P2.current.get(h4.localId);
        W2 && (M2(h4.localId, { status: "busy", errorMessage: void 0 }), O2(h4.localId, W2));
      },
      [O2, M2]
    ), x2 = () => {
      c2 || b2.current?.click();
    }, F2 = (h4) => {
      (h4.key === "Enter" || h4.key === " ") && (h4.preventDefault(), x2());
    }, ae = (h4) => {
      h4.preventDefault(), c2 || v2(true);
    }, X2 = () => v2(false), me2 = (h4) => {
      h4.preventDefault(), v2(false), L2(h4.dataTransfer.files);
    }, ke = "outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:shadow-glow-brand";
    return /* @__PURE__ */ window.wp.element.jsxs(Vt, { ref: p2, className: B$1("p-0", u2), children: [
      /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-start gap-3 border-b border-neutral-100 px-6 pb-4 pt-5 dark:border-neutral-800", children: [
        /* @__PURE__ */ window.wp.element.jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-neutral-100 text-neutral-500 ring-1 ring-inset ring-neutral-200/70 dark:bg-white/[.06] dark:text-neutral-400 dark:ring-white/[.08]", children: /* @__PURE__ */ window.wp.element.jsx(Paperclip$1, { size: 16, "aria-hidden": "true" }) }),
        /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1", children: [
          /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ window.wp.element.jsx("h3", { className: "m-0! text-[15px] font-bold tracking-tight text-neutral-900 dark:text-white", children: n2.title }),
            /* @__PURE__ */ window.wp.element.jsx("span", { className: "rounded bg-neutral-100 px-1.5 py-0.5 text-[9px] font-black uppercase tracking-wider text-neutral-400 dark:bg-white/10 dark:text-neutral-500", children: n2.optionalTag }),
            w2 >= 1 ? /* @__PURE__ */ window.wp.element.jsx("span", { className: "ml-auto shrink-0 rounded-full bg-neutral-100 px-2 py-0.5 text-[10px] font-bold text-neutral-500 ring-1 ring-inset ring-neutral-200 dark:bg-white/[.06] dark:text-neutral-400 dark:ring-white/[.08]", children: n2.counter(w2, s2) }) : null
          ] }),
          /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! mt-0.5 text-[12.5px] leading-relaxed text-neutral-500 dark:text-neutral-400", children: n2.valueLine })
        ] })
      ] }),
      /* @__PURE__ */ window.wp.element.jsxs("div", { className: "space-y-3 p-6 pt-5", children: [
        t2.length > 0 ? /* @__PURE__ */ window.wp.element.jsx(
          "div",
          {
            "aria-live": "polite",
            className: "divide-y divide-neutral-100 overflow-hidden rounded-xl border border-neutral-200 dark:divide-neutral-800 dark:border-neutral-800",
            children: t2.map((h4) => {
              const W2 = N2.has(h4.localId);
              return /* @__PURE__ */ window.wp.element.jsx(
                "div",
                {
                  className: B$1(
                    "grid grid-rows-[1fr] transition-[grid-template-rows,opacity] duration-fast ease-in motion-reduce:transition-none",
                    W2 && "grid-rows-[0fr] opacity-0"
                  ),
                  children: /* @__PURE__ */ window.wp.element.jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ window.wp.element.jsx("div", { className: "animate-slide-in-bottom motion-reduce:animate-none", children: h4.status === "busy" ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center gap-3 px-3.5 py-3", children: [
                    /* @__PURE__ */ window.wp.element.jsx(Te, { ext: h4.ext }),
                    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1", children: [
                      /* @__PURE__ */ window.wp.element.jsx(
                        "p",
                        {
                          className: "m-0! truncate text-[13px] font-semibold text-neutral-800 dark:text-neutral-100",
                          title: h4.name,
                          children: h4.name
                        }
                      ),
                      /* @__PURE__ */ window.wp.element.jsx(
                        Fe,
                        {
                          className: "mt-1.5 h-1 max-w-[240px] bg-neutral-200 dark:bg-white/10",
                          fillClassName: "bg-brand-500 dark:bg-brand-400"
                        }
                      ),
                      /* @__PURE__ */ window.wp.element.jsxs("p", { className: "m-0! mt-1 text-[11.5px] text-neutral-500 dark:text-neutral-400", children: [
                        n2.busy,
                        " ",
                        /* @__PURE__ */ window.wp.element.jsxs("span", { className: "text-neutral-400 dark:text-neutral-600", children: [
                          "· ",
                          ue(h4.sizeBytes)
                        ] })
                      ] })
                    ] }),
                    /* @__PURE__ */ window.wp.element.jsx(
                      _e,
                      {
                        label: `${n2.cancel} — ${h4.name}`,
                        onClick: () => A2(h4),
                        disabled: c2,
                        children: /* @__PURE__ */ window.wp.element.jsx(X$1, { size: 15, "aria-hidden": "true" })
                      }
                    )
                  ] }) : h4.status === "failed" ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2 bg-red-50/60 px-3.5 py-3 dark:bg-red-500/[.06]", children: [
                    /* @__PURE__ */ window.wp.element.jsx(Te, { ext: h4.ext, failed: true }),
                    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1 basis-40", children: [
                      /* @__PURE__ */ window.wp.element.jsx(
                        "p",
                        {
                          className: "m-0! truncate text-[13px] font-semibold text-neutral-800 dark:text-neutral-100",
                          title: h4.name,
                          children: h4.name
                        }
                      ),
                      /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! mt-0.5 text-[11.5px] font-medium leading-snug text-red-600 dark:text-red-400", children: h4.errorMessage || n2.failedNote })
                    ] }),
                    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [
                      /* @__PURE__ */ window.wp.element.jsxs(
                        "button",
                        {
                          type: "button",
                          "aria-label": `${n2.retry} — ${h4.name}`,
                          onClick: () => z2(h4),
                          disabled: c2,
                          className: "inline-flex cursor-pointer items-center gap-1.5 rounded-lg border border-neutral-200 bg-white px-2.5 py-1.5 text-[11px] font-bold text-neutral-700 shadow-sm transition-colors hover:bg-neutral-50 hover:text-neutral-900 disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:hover:text-neutral-100",
                          children: [
                            /* @__PURE__ */ window.wp.element.jsx(RefreshCw$1, { size: 12, "aria-hidden": "true" }),
                            n2.retry
                          ]
                        }
                      ),
                      /* @__PURE__ */ window.wp.element.jsx(
                        _e,
                        {
                          label: n2.remove(h4.name),
                          onClick: () => f2(h4),
                          danger: true,
                          disabled: c2,
                          children: /* @__PURE__ */ window.wp.element.jsx(Trash2$1, { size: 15, "aria-hidden": "true" })
                        }
                      )
                    ] })
                  ] }) : /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center gap-3 px-3.5 py-3", children: [
                    /* @__PURE__ */ window.wp.element.jsx(Te, { ext: h4.ext }),
                    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1", children: [
                      /* @__PURE__ */ window.wp.element.jsx(
                        "p",
                        {
                          className: "m-0! truncate text-[13px] font-semibold text-neutral-800 dark:text-neutral-100",
                          title: h4.name,
                          children: h4.name
                        }
                      ),
                      /* @__PURE__ */ window.wp.element.jsxs("p", { className: "m-0! mt-0.5 text-[11.5px] text-neutral-500 dark:text-neutral-400", children: [
                        ue(h4.sizeBytes),
                        h4.extracted ? ` · ${h4.extracted.unit === "pages" ? n2.readPages(h4.extracted.used) : n2.readWords(h4.extracted.used)}` : ""
                      ] }),
                      h4.extracted?.truncated ? (
                        // Informational, deliberately NOT amber —
                        // partial use is a fact, not a warning.
                        /* @__PURE__ */ window.wp.element.jsxs("p", { className: "m-0! mt-1 flex items-start gap-1.5 text-[11.5px] leading-snug text-neutral-500 dark:text-neutral-400", children: [
                          /* @__PURE__ */ window.wp.element.jsx(
                            Info$1,
                            {
                              size: 12,
                              className: "mt-0.5 shrink-0 text-neutral-400 dark:text-neutral-500",
                              "aria-hidden": "true"
                            }
                          ),
                          /* @__PURE__ */ window.wp.element.jsx("span", { children: n2.partialNote(
                            h4.extracted.used,
                            h4.extracted.unit
                          ) })
                        ] })
                      ) : null
                    ] }),
                    /* @__PURE__ */ window.wp.element.jsxs("span", { className: "flex size-6 shrink-0 items-center justify-center rounded-full bg-emerald-50 text-emerald-600 dark:bg-emerald-500/15 dark:text-emerald-400", children: [
                      /* @__PURE__ */ window.wp.element.jsx(Check$1, { size: 13, "aria-hidden": "true" }),
                      /* @__PURE__ */ window.wp.element.jsx("span", { className: "sr-only", children: n2.srReady })
                    ] }),
                    /* @__PURE__ */ window.wp.element.jsx(
                      _e,
                      {
                        label: n2.remove(h4.name),
                        onClick: () => f2(h4),
                        danger: true,
                        disabled: c2,
                        children: /* @__PURE__ */ window.wp.element.jsx(Trash2$1, { size: 15, "aria-hidden": "true" })
                      }
                    )
                  ] }) }) })
                },
                h4.localId
              );
            })
          }
        ) : null,
        T3 ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center justify-center gap-2 rounded-xl bg-neutral-50 px-4 py-2.5 text-center text-xs font-medium text-neutral-500 ring-1 ring-inset ring-neutral-200/70 dark:bg-white/[.03] dark:text-neutral-400 dark:ring-white/[.06]", children: [
          /* @__PURE__ */ window.wp.element.jsx(
            CheckCheck,
            {
              size: 14,
              className: "shrink-0 text-neutral-400 dark:text-neutral-500",
              "aria-hidden": "true"
            }
          ),
          n2.capStrip
        ] }) : w2 === 0 ? /* @__PURE__ */ window.wp.element.jsxs(
          "div",
          {
            role: "button",
            tabIndex: c2 ? -1 : 0,
            "aria-disabled": c2 || void 0,
            onClick: x2,
            onKeyDown: F2,
            onDragOver: ae,
            onDragLeave: X2,
            onDrop: me2,
            className: B$1(
              "flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed px-6 py-7 text-center transition-colors",
              ke,
              c2 ? "cursor-not-allowed border-neutral-200 bg-neutral-50 opacity-60 dark:border-neutral-800 dark:bg-white/[.02]" : m3 ? "cursor-pointer border-brand-400 bg-brand-50/70 dark:border-brand-500 dark:bg-brand-500/10" : "cursor-pointer border-neutral-300 bg-neutral-50/60 hover:border-brand-300 hover:bg-brand-50/40 dark:border-neutral-700 dark:bg-white/[.02] dark:hover:border-brand-500/60 dark:hover:bg-brand-500/[.06]"
            ),
            children: [
              /* @__PURE__ */ window.wp.element.jsx(
                "span",
                {
                  className: B$1(
                    "flex size-10 items-center justify-center rounded-full",
                    m3 ? "bg-brand-100 text-brand-600 dark:bg-brand-500/20 dark:text-brand-300" : "bg-neutral-100 text-neutral-400 dark:bg-white/[.06] dark:text-neutral-500"
                  ),
                  children: m3 ? /* @__PURE__ */ window.wp.element.jsx(FileDown, { size: 19, "aria-hidden": "true" }) : /* @__PURE__ */ window.wp.element.jsx(CloudUpload, { size: 19, "aria-hidden": "true" })
                }
              ),
              /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! text-[13px] font-medium text-neutral-600 dark:text-neutral-300", children: m3 ? n2.dropActive : /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
                /* @__PURE__ */ window.wp.element.jsx("span", { className: "font-bold text-brand-600 dark:text-brand-400", children: n2.dropCtaBold }),
                " ",
                n2.dropCta
              ] }) }),
              /* @__PURE__ */ window.wp.element.jsx("p", { className: "m-0! text-[11.5px] text-neutral-400 dark:text-neutral-500", children: n2.dropHint })
            ]
          }
        ) : /* @__PURE__ */ window.wp.element.jsxs(
          "div",
          {
            role: "button",
            tabIndex: c2 ? -1 : 0,
            "aria-disabled": c2 || void 0,
            onClick: x2,
            onKeyDown: F2,
            onDragOver: ae,
            onDragLeave: X2,
            onDrop: me2,
            className: B$1(
              "flex items-center justify-center gap-1.5 rounded-xl border border-dashed py-2.5 text-xs font-bold transition-colors",
              ke,
              c2 ? "cursor-not-allowed border-neutral-200 text-neutral-400 opacity-60 dark:border-neutral-800 dark:text-neutral-600" : m3 ? "cursor-pointer border-brand-400 bg-brand-50/70 text-brand-600 dark:border-brand-500 dark:bg-brand-500/10 dark:text-brand-300" : "cursor-pointer border-neutral-300 text-neutral-500 hover:border-brand-300 hover:text-brand-600 dark:border-neutral-700 dark:text-neutral-400 dark:hover:border-brand-500/60 dark:hover:text-brand-300"
            ),
            children: [
              m3 ? /* @__PURE__ */ window.wp.element.jsx(FileDown, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ window.wp.element.jsx(Plus$1, { size: 14, "aria-hidden": "true" }),
              m3 ? n2.dropActive : n2.addMore(w2, s2)
            ]
          }
        ),
        g2.length > 0 ? /* @__PURE__ */ window.wp.element.jsx("div", { className: "space-y-1.5", children: g2.map((h4, W2) => /* @__PURE__ */ window.wp.element.jsxs(
          "p",
          {
            role: "alert",
            className: "m-0! flex items-start gap-1.5 text-xs font-medium leading-relaxed text-red-600 dark:text-red-400",
            children: [
              /* @__PURE__ */ window.wp.element.jsx(CircleAlert$1, { size: 13, className: "mt-0.5 shrink-0", "aria-hidden": "true" }),
              /* @__PURE__ */ window.wp.element.jsx("span", { children: h4 })
            ]
          },
          `${h4}-${W2}`
        )) }) : null
      ] }),
      /* @__PURE__ */ window.wp.element.jsx(
        "input",
        {
          ref: b2,
          type: "file",
          multiple: true,
          accept: Ye,
          disabled: c2,
          className: "hidden",
          onChange: (h4) => {
            L2(h4.target.files), h4.target.value = "";
          }
        }
      )
    ] });
  }
);
cn.displayName = "ResearchAttachments";
const un = window.wp.element.forwardRef(
  ({
    label: t2,
    required: r2,
    hiddenLabel: a3,
    error: i2,
    loading: s2,
    leftAdornment: d2,
    rightAdornment: c2,
    className: n2,
    rows: u2,
    size: p2 = "md",
    labelStyle: b2 = "default",
    ...m3
  }, v2) => {
    const g2 = B$1(Mt({ size: p2 }), "resize-none leading-relaxed!");
    return /* @__PURE__ */ window.wp.element.jsxs(
      W,
      {
        as: "div",
        disabled: m3.disabled || s2,
        className: B$1("w-full disabled:opacity-50", n2),
        children: [
          /* @__PURE__ */ window.wp.element.jsx(
            Z,
            {
              className: B$1(Pe({ labelStyle: b2 }), {
                "sr-only": a3
              }),
              children: r2 ? `${t2} *` : t2
            }
          ),
          /* @__PURE__ */ window.wp.element.jsxs(
            "div",
            {
              className: St({
                intent: i2 ? "error" : "default"
              }),
              children: [
                d2 && /* @__PURE__ */ window.wp.element.jsx(
                  "div",
                  {
                    className: B$1("flex items-start", {
                      "py-1 pr-1 pl-1.5 text-xs": p2 === "xs",
                      "py-1.5 pr-1.5 pl-2 text-sm": p2 === "sm",
                      "py-2.5 pr-2 pl-3 text-sm": p2 === "md"
                    }),
                    children: d2
                  }
                ),
                /* @__PURE__ */ window.wp.element.jsx(M, { ref: v2, ...m3, rows: u2, className: g2 }),
                s2 && /* @__PURE__ */ window.wp.element.jsx(
                  "div",
                  {
                    className: B$1("flex items-center", {
                      "px-1.5": p2 === "xs",
                      "px-2": p2 === "sm",
                      "px-3": p2 === "md"
                    }),
                    children: /* @__PURE__ */ window.wp.element.jsx($e, {})
                  }
                ),
                c2 && !s2 && /* @__PURE__ */ window.wp.element.jsx(
                  "div",
                  {
                    className: B$1("flex items-start", {
                      "py-1 pr-1.5 pl-1 text-xs": p2 === "xs",
                      "py-1.5 pr-2 pl-1.5 text-sm": p2 === "sm",
                      "py-2.5 pr-3 pl-2 text-sm": p2 === "md"
                    }),
                    children: c2
                  }
                )
              ]
            }
          ),
          i2 && /* @__PURE__ */ window.wp.element.jsx(M$5, { className: "mt-2 text-sm text-red-600", children: i2 })
        ]
      }
    );
  }
);
un.displayName = "TextArea";
const Ht = window.wp.element.createContext(null), Gt = () => {
  const t2 = window.wp.element.useContext(Ht);
  if (!t2)
    throw new Error("Select sub-components must be used within a Select provider.");
  return t2;
}, mn = ({
  children: t2,
  options: r2,
  value: a3,
  onValueChange: i2,
  className: s2,
  error: d2,
  disabled: c2 = false,
  size: n2 = "md"
}) => {
  const u2 = window.wp.element.useMemo(
    () => ({ options: r2, value: a3, onValueChange: i2, size: n2, error: d2 }),
    [r2, a3, i2, n2, d2]
  );
  return /* @__PURE__ */ window.wp.element.jsx(Ht.Provider, { value: u2, children: /* @__PURE__ */ window.wp.element.jsx(Mo, { value: a3, onChange: i2, disabled: c2, children: /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("relative", s2), children: t2 }) }) });
}, Wt = window.wp.element.forwardRef(({ className: t2, hidden: r2, labelStyle: a3 = "default", ...i2 }, s2) => /* @__PURE__ */ window.wp.element.jsx(
  Z,
  {
    ref: s2,
    className: B$1(
      Pe({ labelStyle: a3 }),
      { "sr-only": r2 },
      t2
    ),
    ...i2
  }
));
Wt.displayName = "SelectLabel";
const Zt = window.wp.element.forwardRef(
  ({ className: t2, placeholder: r2 = "Select an option...", trailingAdornment: a3 }, i2) => {
    const { size: s2, value: d2, options: c2, error: n2 } = Gt(), u2 = c2.find((b2) => b2.value === d2), p2 = /* @__PURE__ */ window.wp.element.jsxs(
      Mt$2,
      {
        ref: i2,
        "aria-invalid": !!n2,
        className: B$1(
          $t({
            size: s2,
            intent: n2 ? "error" : "default"
          }),
          "flex items-center justify-between",
          // Reserve room for the adornment sitting between value and
          // chevron so long labels truncate before sliding under it.
          a3 != null && "pr-16",
          t2
        ),
        children: [
          u2 ? /* @__PURE__ */ window.wp.element.jsx("span", { className: "truncate", children: u2.label }) : /* @__PURE__ */ window.wp.element.jsx("span", { className: "truncate text-gray-400 dark:text-gray-500", children: r2 }),
          /* @__PURE__ */ window.wp.element.jsx(
            ChevronDown$1,
            {
              className: "absolute right-3 size-4 shrink-0 text-gray-400 transition-transform duration-200",
              "aria-hidden": "true"
            }
          )
        ]
      }
    );
    return a3 == null ? p2 : /* @__PURE__ */ window.wp.element.jsxs("div", { className: "relative", children: [
      p2,
      /* @__PURE__ */ window.wp.element.jsx("span", { className: "absolute inset-y-0 right-9 z-10 flex items-center", children: a3 })
    ] });
  }
);
Zt.displayName = "SelectTrigger";
const pn = ({ children: t2, className: r2, anchor: a3 = "bottom start" }) => {
  const { options: i2 } = Gt(), s2 = t2 ?? i2.map((d2) => /* @__PURE__ */ window.wp.element.jsx(qt, { value: d2.value, disabled: d2.disabled, badge: d2.badge, children: d2.label }, d2.value));
  return /* @__PURE__ */ window.wp.element.jsx(
    Bt$2,
    {
      anchor: a3,
      transition: true,
      className: B$1(
        // Dropdown panel — rounded-xl, shadow-xl, dark glass-edge.
        // z-[100060] sits above the Dialog modal layer (z-[100050])
        // and the onboarding wizard portal (z-[100000]) so dropdowns
        // are usable both standalone and inside dialogs that open over
        // the full-screen wizard. See Dialog.tsx for the layer scheme.
        "z-[100060] max-h-80! overflow-auto rounded-xl border border-gray-200 bg-white p-1 text-base shadow-xl transition duration-100 ease-in focus:outline-none data-leave:data-closed:opacity-0 sm:text-sm dark:border-gray-800 dark:bg-gray-900 dark:ring-1 dark:ring-white/[0.04]",
        r2,
        a3.includes("top") && "mb-1",
        a3.includes("bottom") && "mt-1"
      ),
      children: s2
    }
  );
}, qt = ({
  value: t2,
  children: r2,
  description: a3,
  disabled: i2,
  badge: s2
}) => /* @__PURE__ */ window.wp.element.jsxs(
  It$1,
  {
    value: t2,
    disabled: i2,
    className: B$1(
      "group relative rounded-lg py-2 pr-4 pl-10 text-gray-700 transition-colors select-none data-focus:bg-gray-100 data-focus:text-gray-900 dark:text-gray-300 dark:data-focus:bg-gray-800 dark:data-focus:text-white",
      i2 ? "cursor-not-allowed opacity-50" : "cursor-pointer"
    ),
    children: [
      /* @__PURE__ */ window.wp.element.jsxs("div", { children: [
        /* @__PURE__ */ window.wp.element.jsxs("span", { className: "flex items-center gap-2 truncate font-normal group-data-selected:font-bold group-data-selected:text-brand-600 dark:group-data-selected:text-brand-400", children: [
          r2,
          s2 && /* @__PURE__ */ window.wp.element.jsx("span", { className: "shrink-0 rounded-md bg-brand-100 px-1.5 py-0.5 text-[9px] font-black tracking-wider text-brand-700 uppercase dark:bg-brand-500/20 dark:text-brand-300", children: s2 })
        ] }),
        a3 && /* @__PURE__ */ window.wp.element.jsx("span", { className: "block text-xs font-normal text-gray-500 group-data-focus:text-gray-600 dark:text-gray-500 dark:group-data-focus:text-gray-400", children: a3 })
      ] }),
      /* @__PURE__ */ window.wp.element.jsx("span", { className: "invisible absolute inset-y-0 left-0 flex items-center pl-3 text-brand-500 group-data-selected:visible", children: /* @__PURE__ */ window.wp.element.jsx(Check$1, { className: "size-4 stroke-[3px]", "aria-hidden": "true" }) })
    ]
  }
), hn = ({
  children: t2,
  className: r2
}) => t2 ? /* @__PURE__ */ window.wp.element.jsx("p", { className: B$1("mt-1.5 text-xs font-medium text-red-600 dark:text-red-400", r2), children: t2 }) : null, Zn = Object.assign(mn, {
  Trigger: Zt,
  Content: pn,
  Item: qt,
  Label: Wt,
  Error: hn
}), bn = (t2, r2) => {
  const a3 = r2.toLowerCase();
  return t2.label.toLowerCase().includes(a3) || (t2.description?.toLowerCase().includes(a3) ?? false);
}, Xe = (t2, r2) => {
  if (!r2) return t2;
  const a3 = t2.toLowerCase().indexOf(r2.toLowerCase());
  return a3 === -1 ? t2 : /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
    t2.slice(0, a3),
    /* @__PURE__ */ window.wp.element.jsx("mark", { className: "rounded-sm bg-brand-100 px-0.5 text-brand-800 dark:bg-brand-500/25 dark:text-brand-200", children: t2.slice(a3, a3 + r2.length) }),
    t2.slice(a3 + r2.length)
  ] });
}, xn = "text-[10px] font-black uppercase tracking-widest text-neutral-400 dark:text-neutral-500", gn = ({
  value: t2,
  onChange: r2,
  groups: a3,
  placeholder: i2,
  footnote: s2,
  filter: d2,
  onOptionAction: c2,
  noMatchesLabel: n2,
  clearSearchLabel: u2 = "Clear search",
  searchCountLabel: p2,
  close: b2,
  listboxId: m3,
  baseId: v2
}) => {
  const [g2, C2] = window.wp.element.useState(""), [N2, D2] = window.wp.element.useState(t2 ?? null), k2 = window.wp.element.useRef(null), _2 = window.wp.element.useRef(true), S2 = window.wp.element.useRef(/* @__PURE__ */ new Map()), I2 = g2.trim(), B2 = d2 ?? bn, R2 = a3.map((x2) => {
    const F2 = x2.count ?? x2.options.length, ae = x2.gate ? [] : I2 ? x2.options.filter((X2) => B2(X2, I2)) : x2.options;
    return { group: x2, total: F2, matched: ae };
  }), P2 = R2.reduce((x2, F2) => x2 + F2.matched.length, 0), V2 = R2.flatMap(
    (x2) => x2.matched.filter((F2) => !F2.disabled).map((F2) => ({ option: F2, groupId: x2.group.id }))
  ), U2 = V2.findIndex((x2) => x2.option.id === N2), M2 = U2 === -1 ? V2.length > 0 ? 0 : -1 : U2, y2 = M2 >= 0 ? V2[M2] : null, O2 = (x2) => `${v2}-option-${x2}`;
  window.wp.element.useEffect(() => {
    y2 && document.getElementById(O2(y2.option.id))?.scrollIntoView?.({ block: "nearest" });
  }, [y2?.option.id]);
  const w2 = (x2) => {
    if (_2.current = true, V2.length === 0) return;
    const F2 = M2 === -1 ? x2 > 0 ? 0 : V2.length - 1 : (M2 + x2 + V2.length) % V2.length;
    D2(V2[F2].option.id);
  }, T3 = (x2) => {
    r2(x2), b2();
  }, L2 = (x2) => {
    switch (x2.key) {
      case "ArrowDown":
        x2.preventDefault(), w2(1);
        break;
      case "ArrowUp":
        x2.preventDefault(), w2(-1);
        break;
      case "Enter":
        x2.preventDefault(), y2 && T3(y2.option.id);
        break;
      case " ": {
        if (!_2.current || !y2) return;
        const { option: F2 } = y2;
        if (!c2 && F2.trailing == null) return;
        x2.preventDefault(), c2 ? c2(F2.id) : S2.current.get(F2.id)?.querySelector("button")?.click();
        break;
      }
    }
  }, E2 = () => {
    C2(""), _2.current = true, k2.current?.focus();
  }, f2 = (x2) => {
    const F2 = x2.id === t2, ae = y2?.option.id === x2.id;
    return /* @__PURE__ */ window.wp.element.jsxs(
      "div",
      {
        className: B$1(
          "flex items-center gap-2 rounded-lg px-2.5 py-[7px]",
          x2.disabled ? "opacity-40" : F2 ? "bg-brand-50 dark:bg-brand-500/10" : ae ? "bg-neutral-100 ring-2 ring-brand-500/40 ring-inset dark:bg-neutral-700/60" : "hover:bg-neutral-50 dark:hover:bg-neutral-700/50"
        ),
        onMouseDown: (X2) => X2.preventDefault(),
        onClick: (X2) => {
          X2.target.closest("button, a") || x2.disabled || T3(x2.id);
        },
        children: [
          /* @__PURE__ */ window.wp.element.jsxs(
            "div",
            {
              role: "option",
              id: O2(x2.id),
              "aria-selected": F2,
              "aria-disabled": x2.disabled || void 0,
              className: B$1(
                "flex min-w-0 flex-1 items-center gap-2",
                !x2.disabled && "cursor-pointer"
              ),
              children: [
                /* @__PURE__ */ window.wp.element.jsxs("div", { className: "min-w-0 flex-1", children: [
                  /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex items-center gap-1.5", children: [
                    /* @__PURE__ */ window.wp.element.jsx("span", { className: "truncate text-[13px] font-semibold text-neutral-900 dark:text-neutral-100", children: Xe(x2.label, I2) }),
                    x2.badge != null && (typeof x2.badge == "string" ? /* @__PURE__ */ window.wp.element.jsx("span", { className: "inline-flex items-center rounded-full border border-neutral-200 px-1.5 py-0.5 text-[9px] leading-none font-bold tracking-wide text-neutral-400 uppercase dark:border-neutral-600 dark:text-neutral-400", children: x2.badge }) : x2.badge)
                  ] }),
                  x2.description != null && /* @__PURE__ */ window.wp.element.jsx("span", { className: "block truncate text-[11px] leading-tight text-neutral-500 dark:text-neutral-400", children: Xe(x2.description, I2) })
                ] }),
                F2 && /* @__PURE__ */ window.wp.element.jsx(
                  Check$1,
                  {
                    className: "size-[15px] shrink-0 text-brand-600 dark:text-brand-400",
                    "aria-hidden": "true"
                  }
                )
              ]
            }
          ),
          x2.trailing != null && /* @__PURE__ */ window.wp.element.jsx(
            "span",
            {
              ref: (X2) => {
                S2.current.set(x2.id, X2);
              },
              className: "flex shrink-0 items-center",
              children: x2.trailing
            }
          )
        ]
      },
      x2.id
    );
  }, A2 = ({ group: x2, total: F2, matched: ae }) => {
    const X2 = `${v2}-group-${x2.id}`, me2 = x2.gate != null, ke = me2 || !I2 ? F2 : p2?.(ae.length, F2) ?? `${ae.length} of ${F2}`;
    return /* @__PURE__ */ window.wp.element.jsxs("div", { role: "group", "aria-labelledby": X2, children: [
      /* @__PURE__ */ window.wp.element.jsxs("div", { className: "sticky top-0 z-10 flex items-center justify-between gap-2 rounded-md bg-white/95 px-2.5 pt-2 pb-1 backdrop-blur-sm dark:bg-neutral-800/95", children: [
        /* @__PURE__ */ window.wp.element.jsxs("span", { id: X2, className: B$1("flex items-center gap-1.5", xn), children: [
          me2 && /* @__PURE__ */ window.wp.element.jsx(Lock$1, { className: "-mt-px size-2.5 shrink-0", "aria-hidden": "true" }),
          x2.label
        ] }),
        /* @__PURE__ */ window.wp.element.jsx("span", { className: "font-mono text-[10px] font-medium text-neutral-400 dark:text-neutral-500", children: ke })
      ] }),
      x2.gate != null ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "mx-1 mb-1 flex items-center gap-3 rounded-lg border border-dashed border-neutral-200 bg-neutral-50/70 px-3 py-2.5 dark:border-neutral-700 dark:bg-white/[.03]", children: [
        /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-neutral-100 text-neutral-400 dark:bg-white/[.06] dark:text-neutral-500", children: /* @__PURE__ */ window.wp.element.jsx(Lock$1, { className: "size-3.5", "aria-hidden": "true" }) }),
        /* @__PURE__ */ window.wp.element.jsx("p", { className: "min-w-0 flex-1 text-[11.5px] leading-snug text-neutral-500 dark:text-neutral-400", children: x2.gate.text }),
        /* @__PURE__ */ window.wp.element.jsx(
          "a",
          {
            href: x2.gate.cta.href,
            className: "shrink-0 text-[11.5px] font-bold text-brand-600 hover:underline dark:text-brand-400",
            children: x2.gate.cta.label
          }
        )
      ] }) : ae.map(f2)
    ] }, x2.id);
  }, z2 = I2.length > 0 && P2 === 0;
  return /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
    /* @__PURE__ */ window.wp.element.jsxs("div", { className: "mb-1 flex items-center gap-2 border-b border-neutral-100 px-2.5 pt-1 pb-2 dark:border-neutral-700", children: [
      /* @__PURE__ */ window.wp.element.jsx(Search$1, { className: "size-3.5 shrink-0 text-neutral-400", "aria-hidden": "true" }),
      /* @__PURE__ */ window.wp.element.jsx(
        "input",
        {
          ref: k2,
          autoFocus: true,
          type: "text",
          value: g2,
          placeholder: i2,
          "aria-controls": m3,
          "aria-autocomplete": "list",
          "aria-activedescendant": y2 ? O2(y2.option.id) : void 0,
          onChange: (x2) => {
            _2.current = false, C2(x2.target.value);
          },
          onKeyDown: L2,
          className: "w-full min-w-0 flex-1 !border-0 !bg-transparent !p-0 text-sm !text-neutral-900 !shadow-none !ring-0 !outline-none placeholder:text-neutral-400 dark:!text-neutral-100 dark:placeholder:text-neutral-500"
        }
      ),
      g2 ? /* @__PURE__ */ window.wp.element.jsx(
        "button",
        {
          type: "button",
          "aria-label": u2,
          onClick: E2,
          className: "flex size-5 shrink-0 items-center justify-center rounded-full text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600 dark:hover:bg-neutral-700 dark:hover:text-neutral-300",
          children: /* @__PURE__ */ window.wp.element.jsx(X$1, { className: "size-3", "aria-hidden": "true" })
        }
      ) : /* @__PURE__ */ window.wp.element.jsx(
        "kbd",
        {
          "aria-hidden": "true",
          className: "shrink-0 rounded border border-neutral-200 px-1 py-0.5 font-mono text-[9px] text-neutral-400 dark:border-neutral-600 dark:text-neutral-500",
          children: "↑↓"
        }
      )
    ] }),
    /* @__PURE__ */ window.wp.element.jsxs(
      "div",
      {
        role: "listbox",
        id: m3,
        className: "max-h-[380px] overflow-y-auto overscroll-contain",
        children: [
          z2 && /* @__PURE__ */ window.wp.element.jsxs("div", { className: "flex flex-col items-center gap-2 px-4 py-7 text-center", children: [
            /* @__PURE__ */ window.wp.element.jsx("div", { className: "flex size-9 items-center justify-center rounded-full bg-neutral-100 text-neutral-400 dark:bg-white/[.06] dark:text-neutral-500", children: /* @__PURE__ */ window.wp.element.jsx(SearchX$1, { className: "size-4", "aria-hidden": "true" }) }),
            /* @__PURE__ */ window.wp.element.jsx("p", { className: "text-sm font-semibold text-neutral-700 dark:text-neutral-200", children: n2?.(I2) ?? /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
              "No matches for “",
              I2,
              "”"
            ] }) }),
            /* @__PURE__ */ window.wp.element.jsx(
              "button",
              {
                type: "button",
                onClick: E2,
                className: "text-xs font-bold text-brand-600 hover:underline dark:text-brand-400",
                children: u2
              }
            )
          ] }),
          R2.filter((x2) => !z2 || x2.group.gate != null).map(A2)
        ]
      }
    ),
    s2 != null && /* @__PURE__ */ window.wp.element.jsx("p", { className: "mt-0.5 border-t border-neutral-100 px-2.5 pt-2 pb-1 text-[11px] leading-snug text-neutral-400 dark:border-neutral-700 dark:text-neutral-500", children: s2 })
  ] });
}, qn = ({
  value: t2,
  onChange: r2,
  groups: a3,
  placeholder: i2,
  triggerPlaceholder: s2 = "Select an option...",
  footnote: d2,
  filter: c2,
  leadingAdornment: n2,
  trailingAdornment: u2,
  onOptionAction: p2,
  disabled: b2 = false,
  className: m3,
  noMatchesLabel: v2,
  clearSearchLabel: g2,
  searchCountLabel: C2
}) => {
  const N2 = window.wp.element.useId(), D2 = `${N2}-listbox`, k2 = a3.flatMap((R2) => R2.options).find((R2) => R2.id === t2), _2 = window.wp.element.useRef(null), [S2, I2] = window.wp.element.useState(0);
  window.wp.element.useLayoutEffect(() => {
    I2(n2 != null ? _2.current?.offsetWidth ?? 0 : 0);
  }, [n2]);
  const B2 = /* @__PURE__ */ window.wp.element.jsxs(
    Dt$1,
    {
      role: "combobox",
      "aria-haspopup": "listbox",
      disabled: b2,
      style: n2 != null ? { paddingLeft: 16 + S2 + 8 } : void 0,
      className: B$1(
        $t({ size: "md" }),
        "flex items-center justify-between",
        // Same reservation as Select.Trigger: room for the trailing
        // adornment between value and chevron so long labels truncate
        // before sliding under it.
        u2 != null && "pr-16"
      ),
      children: [
        k2 ? /* @__PURE__ */ window.wp.element.jsxs("span", { className: "truncate", children: [
          k2.label,
          k2.description != null && /* @__PURE__ */ window.wp.element.jsxs("span", { className: "text-neutral-500 dark:text-neutral-400", children: [
            " ",
            "— ",
            k2.description
          ] })
        ] }) : /* @__PURE__ */ window.wp.element.jsx("span", { className: "truncate text-neutral-400 dark:text-neutral-500", children: s2 }),
        /* @__PURE__ */ window.wp.element.jsx(
          ChevronDown$1,
          {
            className: "absolute right-3 size-4 shrink-0 text-neutral-400 transition-transform duration-200 motion-reduce:transition-none",
            "aria-hidden": "true"
          }
        )
      ]
    }
  );
  return /* @__PURE__ */ window.wp.element.jsxs(vo, { className: B$1("relative", m3), children: [
    n2 != null || u2 != null ? /* @__PURE__ */ window.wp.element.jsxs("div", { className: "relative", children: [
      B2,
      n2 != null && // pointer-events-none lets clicks on the badge fall through to
      // the trigger button beneath it — the whole field stays clickable.
      /* @__PURE__ */ window.wp.element.jsx(
        "span",
        {
          ref: _2,
          className: "pointer-events-none absolute inset-y-0 left-4 z-10 flex items-center",
          children: n2
        }
      ),
      u2 != null && /* @__PURE__ */ window.wp.element.jsx("span", { className: "absolute inset-y-0 right-9 z-10 flex items-center", children: u2 })
    ] }) : B2,
    /* @__PURE__ */ window.wp.element.jsx(
      Lt$1,
      {
        anchor: { to: "bottom start", gap: 8 },
        transition: true,
        className: B$1(
          // Elevation-2 floating surface; dark mode is elevation-by-brightness
          // (bg-neutral-800 over the page's 900) + glass-edge ring.
          // w-(--button-width): the panel hugs the trigger field's width.
          // z-[100060] sits above the Dialog modal layer (z-[100050]) — the
          // voice picker's first home is ConfigureConnectionModal. See
          // Select.Content / Dialog.tsx for the layer scheme.
          "z-[100060] flex w-[var(--button-width)] flex-col rounded-xl border border-neutral-200 bg-white p-1.5 shadow-floating",
          "dark:border-neutral-700 dark:bg-neutral-800 dark:ring-1 dark:ring-white/[.06]",
          "duration-fast origin-top transition ease-out data-closed:translate-y-1 data-closed:opacity-0 motion-reduce:transition-none",
          "focus:outline-none"
        ),
        children: ({ close: R2 }) => /* @__PURE__ */ window.wp.element.jsx(
          gn,
          {
            value: t2,
            onChange: r2,
            groups: a3,
            placeholder: i2,
            footnote: d2,
            filter: c2,
            onOptionAction: p2,
            noMatchesLabel: v2,
            clearSearchLabel: g2,
            searchCountLabel: C2,
            close: R2,
            listboxId: D2,
            baseId: N2
          }
        )
      }
    )
  ] });
};
const Qn = ({
  items: t2,
  value: r2,
  onChange: a3,
  size: i2 = "md",
  stretch: s2 = false,
  className: d2,
  ...c2
}) => {
  const n2 = window.wp.element.useId(), u2 = i2 === "xs", p2 = t2.filter((m3) => !m3.disabled), b2 = (m3) => {
    const v2 = t2.findIndex((g2) => g2.id === r2);
    if (!(v2 < 0))
      for (let g2 = 1; g2 <= t2.length; g2++) {
        const C2 = t2[(v2 + m3 * g2 + t2.length * g2) % t2.length];
        if (!C2.disabled) {
          C2.id !== r2 && a3(C2.id);
          return;
        }
      }
  };
  return /* @__PURE__ */ window.wp.element.jsx(
    "div",
    {
      role: "tablist",
      "aria-label": c2["aria-label"],
      className: B$1(
        s2 ? "flex w-full" : "inline-flex max-w-full",
        u2 ? "gap-0.5 rounded-lg bg-neutral-200/60 p-0.5 dark:bg-white/[.07]" : B$1(
          "gap-1 overflow-x-auto rounded-xl p-1",
          "bg-neutral-100 dark:bg-neutral-800/60",
          "ring-1 ring-neutral-200/70 dark:ring-white/5"
        ),
        d2
      ),
      onKeyDown: (m3) => {
        m3.key === "ArrowRight" ? (m3.preventDefault(), b2(1)) : m3.key === "ArrowLeft" ? (m3.preventDefault(), b2(-1)) : m3.key === "Home" ? (m3.preventDefault(), p2[0] && a3(p2[0].id)) : m3.key === "End" && (m3.preventDefault(), p2.length && a3(p2[p2.length - 1].id));
      },
      children: t2.map((m3) => {
        const v2 = m3.id === r2;
        return /* @__PURE__ */ window.wp.element.jsxs(
          "button",
          {
            type: "button",
            role: "tab",
            id: `${n2}-${m3.id}`,
            title: m3.title,
            "aria-selected": v2,
            "aria-disabled": m3.disabled || void 0,
            tabIndex: v2 && !m3.disabled ? 0 : -1,
            onClick: m3.disabled ? void 0 : () => a3(m3.id),
            className: B$1(
              s2 ? "flex flex-1 justify-center" : "inline-flex shrink-0",
              "items-center font-bold whitespace-nowrap",
              u2 ? "gap-1 rounded-md px-2 py-1 text-[11px]" : "gap-1.5 rounded-lg px-3 py-1.5 text-xs",
              "transition-all duration-150 ease-out",
              "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40",
              m3.disabled ? "cursor-not-allowed text-neutral-300 dark:text-neutral-600" : v2 ? B$1(
                "cursor-pointer bg-white shadow-sm dark:bg-neutral-700",
                // xs: neutral-800/100 — quieter than the page strip's
                // full-contrast chip (handoff "Switcher" note).
                u2 ? "text-neutral-800 dark:text-neutral-100" : "text-neutral-900 dark:text-white"
              ) : B$1(
                "cursor-pointer text-neutral-500 dark:text-neutral-400",
                u2 ? "hover:text-neutral-700 dark:hover:text-neutral-200" : "hover:text-neutral-800 dark:hover:text-neutral-100"
              )
            ),
            children: [
              m3.icon && /* @__PURE__ */ window.wp.element.jsx(
                "span",
                {
                  "aria-hidden": "true",
                  className: B$1("shrink-0", u2 ? "[&_svg]:size-3" : "[&_svg]:size-3.5"),
                  children: m3.icon
                }
              ),
              m3.label,
              m3.badge && /* @__PURE__ */ window.wp.element.jsx(
                "span",
                {
                  className: B$1(
                    "rounded-full px-1.5 py-0.5 text-[10px] font-bold tracking-wide uppercase",
                    m3.badgeTone === "neutral" ? "bg-neutral-200/80 text-neutral-500 dark:bg-white/10 dark:text-neutral-400" : "bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-400"
                  ),
                  children: m3.badge
                }
              )
            ]
          },
          m3.id
        );
      })
    }
  );
}, Yt = ({ withBackdrop: t2, children: r2, className: a3, ...i2 }) => /* @__PURE__ */ window.wp.element.jsxs(vo, { className: B$1("relative", a3), ...i2, children: [
  t2 && /* @__PURE__ */ window.wp.element.jsx(xt$1, { className: "fixed inset-0 bg-neutral-900/20 dark:bg-black/40" }),
  r2
] });
Yt.displayName = "Popover.Root";
const Xt = window.wp.element.forwardRef(
  ({ asChild: t2, children: r2, className: a3, ...i2 }, s2) => t2 ? /* @__PURE__ */ window.wp.element.jsx(Dt$1, { as: Ut$1, ref: s2, className: a3, ...i2, children: r2 }) : /* @__PURE__ */ window.wp.element.jsx(Dt$1, { ref: s2, className: a3, ...i2, children: r2 })
);
Xt.displayName = "Popover.Trigger";
const Qt = window.wp.element.forwardRef(
  ({ className: t2, anchor: r2 = { to: "bottom start", gap: 8 }, ...a3 }, i2) => /* @__PURE__ */ window.wp.element.jsx(
    Lt$1,
    {
      ref: i2,
      anchor: r2,
      transition: true,
      className: B$1(
        // Surface — matches Select.Content. Floating elevation (design
        // guide §4.1) via the brand multi-layer shadow token; dark mode
        // leans on the glass-edge ring since shadows vanish on dark.
        "z-50 rounded-xl border border-neutral-200 bg-white p-1 shadow-floating",
        "dark:border-neutral-800 dark:bg-neutral-900 dark:ring-1 dark:ring-white/[0.06]",
        // Enter/leave — fade + scale + small lift, scaled from the
        // trigger-side corner so the panel feels like it springs open.
        "origin-top-right transition duration-fast ease-out",
        "data-closed:scale-95 data-closed:opacity-0 data-closed:translate-y-1",
        "focus:outline-none",
        t2
      ),
      ...a3
    }
  )
);
Qt.displayName = "Popover.Content";
const Jn = Object.assign(Yt, {
  Trigger: Xt,
  Content: Qt
}), Jt = ({ children: t2, ...r2 }) => /* @__PURE__ */ window.wp.element.jsx(lo, { as: "div", className: "relative", ...r2, children: t2 });
Jt.displayName = "DropdownMenu.Root";
const er = window.wp.element.forwardRef(
  ({ asChild: t2, children: r2, className: a3, ...i2 }, s2) => t2 ? /* @__PURE__ */ window.wp.element.jsx(ft$1, { as: Ut$1, ref: s2, className: a3, ...i2, children: r2 }) : /* @__PURE__ */ window.wp.element.jsx(ft$1, { ref: s2, className: a3, ...i2, children: r2 })
);
er.displayName = "DropdownMenu.Trigger";
const tr = window.wp.element.forwardRef(
  ({ className: t2, anchor: r2 = { to: "bottom end", gap: 8 }, ...a3 }, i2) => /* @__PURE__ */ window.wp.element.jsx(
    yt$2,
    {
      ref: i2,
      anchor: r2,
      transition: true,
      className: B$1(
        "z-50 min-w-[14rem] rounded-xl border border-neutral-200 bg-white p-1 shadow-xl",
        "dark:border-neutral-800 dark:bg-neutral-900 dark:ring-1 dark:ring-white/[0.04]",
        "transition duration-100 ease-out data-leave:data-closed:opacity-0",
        "data-closed:translate-y-1 data-open:translate-y-0",
        "focus:outline-none",
        t2
      ),
      ...a3
    }
  )
);
tr.displayName = "DropdownMenu.Content";
const rr = ({
  children: t2,
  icon: r2,
  onSelect: a3,
  destructive: i2,
  asChild: s2,
  disabled: d2,
  className: c2
}) => {
  const n2 = B$1(
    "group flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm",
    "text-neutral-700 transition-colors select-none",
    "data-focus:bg-neutral-100 data-focus:text-neutral-900",
    "dark:text-neutral-200 dark:data-focus:bg-neutral-800 dark:data-focus:text-white",
    i2 && "data-focus:bg-red-50 data-focus:text-red-700 dark:data-focus:bg-red-500/10 dark:data-focus:text-red-300",
    d2 && "pointer-events-none opacity-50",
    c2
  );
  return /* @__PURE__ */ window.wp.element.jsx(gt$2, { disabled: d2, children: s2 ? /* @__PURE__ */ window.wp.element.jsx(Ut$1, { className: n2, children: t2 }) : /* @__PURE__ */ window.wp.element.jsxs("button", { type: "button", onClick: a3, className: n2, children: [
    r2 && /* @__PURE__ */ window.wp.element.jsx("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center", children: r2 }),
    /* @__PURE__ */ window.wp.element.jsx("span", { className: "flex-1 text-left", children: t2 })
  ] }) });
};
rr.displayName = "DropdownMenu.Item";
const ar = ({ children: t2, className: r2 }) => /* @__PURE__ */ window.wp.element.jsx(
  "div",
  {
    className: B$1(
      "px-3 pt-2 pb-1 text-[10px] font-bold tracking-wider text-neutral-400 uppercase",
      r2
    ),
    children: t2
  }
);
ar.displayName = "DropdownMenu.Label";
const nr = ({ className: t2 }) => /* @__PURE__ */ window.wp.element.jsx(
  Mt$1,
  {
    className: B$1("my-1 h-px bg-neutral-200 dark:bg-neutral-800", t2)
  }
);
nr.displayName = "DropdownMenu.Separator";
Object.assign(Jt, {
  Trigger: er,
  Content: tr,
  Item: rr,
  Label: ar,
  Separator: nr
});
const lr = ({ children: t2, className: r2 }) => /* @__PURE__ */ window.wp.element.jsx(
  "header",
  {
    className: B$1(
      "sticky top-0 z-20 flex h-16 shrink-0 items-center gap-x-4 px-4 sm:px-6",
      "border-b border-neutral-200/80 bg-white/80 backdrop-blur-md",
      "dark:border-neutral-800/80 dark:bg-neutral-950/70",
      r2
    ),
    children: t2
  }
);
lr.displayName = "TopAppBar.Root";
const ir = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("flex items-center gap-3", r2), children: t2 });
ir.displayName = "TopAppBar.Start";
const sr = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("flex min-w-0 flex-1 items-center", r2), children: t2 });
sr.displayName = "TopAppBar.Context";
const dr = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("ml-auto flex items-center gap-1 sm:gap-2", r2), children: t2 });
dr.displayName = "TopAppBar.End";
Object.assign(lr, {
  Start: ir,
  Context: sr,
  End: dr
});
const or = ({ children: t2, className: r2 }) => /* @__PURE__ */ window.wp.element.jsx(
  "header",
  {
    className: B$1(
      "flex flex-col gap-6 md:flex-row md:items-end md:justify-between",
      r2
    ),
    children: t2
  }
);
or.displayName = "PageHeader.Root";
const cr = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("min-w-0 space-y-2", r2), children: t2 });
cr.displayName = "PageHeader.Group";
const ur = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx(
  "div",
  {
    className: B$1(
      "flex items-center gap-1.5 text-xs font-bold tracking-wide text-neutral-500 uppercase",
      "dark:text-neutral-400",
      r2
    ),
    children: t2
  }
);
ur.displayName = "PageHeader.Kicker";
const mr = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx(
  "h1",
  {
    className: B$1(
      "text-3xl font-bold tracking-tight text-neutral-900 dark:text-white",
      r2
    ),
    children: t2
  }
);
mr.displayName = "PageHeader.Title";
const pr = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx(
  "p",
  {
    className: B$1(
      "max-w-2xl text-sm text-neutral-500 dark:text-neutral-400",
      r2
    ),
    children: t2
  }
);
pr.displayName = "PageHeader.Description";
const hr = ({
  children: t2,
  className: r2
}) => /* @__PURE__ */ window.wp.element.jsx("div", { className: B$1("flex flex-wrap items-center gap-3", r2), children: t2 });
hr.displayName = "PageHeader.Actions";
Object.assign(or, {
  Group: cr,
  Kicker: ur,
  Title: mr,
  Description: pr,
  Actions: hr
});
const br = ({ className: t2, variant: r2 = "dark", gradient: a3 = true }) => {
  const i2 = r2 === "mono", s2 = { layer1: 0.55, layer2: 0.8, layer3: 1 }, d2 = r2 === "white" ? { layer1: "#6366f1", layer2: "#a5b4fc", layer3: "#e0e7ff" } : { layer1: "#2a2574", layer2: "#6366f1", layer3: "#a5b4fc" }, c2 = a3 && !i2, n2 = r2 === "white" ? "logo-w" : "logo-d";
  return /* @__PURE__ */ window.wp.element.jsxs(
    "svg",
    {
      className: B$1("h-10 w-10", t2),
      viewBox: "0 0 100 100",
      fill: "none",
      xmlns: "http://www.w3.org/2000/svg",
      children: [
        c2 && /* @__PURE__ */ window.wp.element.jsxs("defs", { children: [
          /* @__PURE__ */ window.wp.element.jsxs("linearGradient", { id: `${n2}-g1`, x1: "0", y1: "1", x2: "1", y2: "0", children: [
            /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "0%", stopColor: r2 === "white" ? "#4f46e5" : "#2a2574" }),
            /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "100%", stopColor: r2 === "white" ? "#6366f1" : "#3730a3" })
          ] }),
          /* @__PURE__ */ window.wp.element.jsxs("linearGradient", { id: `${n2}-g2`, x1: "0", y1: "1", x2: "1", y2: "0", children: [
            /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "0%", stopColor: r2 === "white" ? "#818cf8" : "#4338ca" }),
            /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "100%", stopColor: r2 === "white" ? "#a5b4fc" : "#6366f1" })
          ] }),
          /* @__PURE__ */ window.wp.element.jsxs("linearGradient", { id: `${n2}-g3`, x1: "0", y1: "1", x2: "1", y2: "0", children: [
            /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "0%", stopColor: r2 === "white" ? "#c7d2fe" : "#818cf8" }),
            /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "100%", stopColor: r2 === "white" ? "#e0e7ff" : "#a5b4fc" })
          ] }),
          /* @__PURE__ */ window.wp.element.jsx("filter", { id: `${n2}-shadow`, children: /* @__PURE__ */ window.wp.element.jsx(
            "feDropShadow",
            {
              dx: "0",
              dy: "1.5",
              stdDeviation: "2",
              floodColor: "#1e1b4b",
              floodOpacity: "0.2"
            }
          ) })
        ] }),
        /* @__PURE__ */ window.wp.element.jsx(
          "rect",
          {
            x: "8",
            y: "54",
            width: "54",
            height: "24",
            rx: "6",
            fill: i2 ? "white" : c2 ? `url(#${n2}-g1)` : d2.layer1,
            opacity: i2 ? s2.layer1 : void 0
          }
        ),
        /* @__PURE__ */ window.wp.element.jsx(
          "rect",
          {
            x: "24",
            y: "34",
            width: "48",
            height: "24",
            rx: "6",
            fill: i2 ? "white" : c2 ? `url(#${n2}-g2)` : d2.layer2,
            opacity: i2 ? s2.layer2 : void 0,
            filter: c2 ? `url(#${n2}-shadow)` : void 0
          }
        ),
        /* @__PURE__ */ window.wp.element.jsx(
          "rect",
          {
            x: "40",
            y: "14",
            width: "42",
            height: "24",
            rx: "6",
            fill: i2 ? "white" : c2 ? `url(#${n2}-g3)` : d2.layer3,
            opacity: i2 ? s2.layer3 : void 0,
            filter: c2 ? `url(#${n2}-shadow)` : void 0
          }
        ),
        c2 && /* @__PURE__ */ window.wp.element.jsxs(window.wp.element.Fragment, { children: [
          /* @__PURE__ */ window.wp.element.jsx("rect", { x: "24", y: "54", width: "38", height: "4", rx: "2", fill: "white", opacity: "0.08" }),
          /* @__PURE__ */ window.wp.element.jsx("rect", { x: "40", y: "34", width: "32", height: "4", rx: "2", fill: "white", opacity: "0.10" })
        ] })
      ]
    }
  );
}, kn = ({ className: t2, variant: r2 = "dark", gradient: a3 = true }) => /* @__PURE__ */ window.wp.element.jsxs("div", { className: B$1("flex w-fit shrink-0 items-center gap-3", t2), children: [
  /* @__PURE__ */ window.wp.element.jsx(br, { className: "h-9 w-9", variant: r2, gradient: a3 }),
  /* @__PURE__ */ window.wp.element.jsx(
    "span",
    {
      className: B$1(
        "font-sans text-sm leading-none font-black tracking-[0.18em] uppercase",
        // White wordmark for both the dark-bg (`white`) and colored-bg
        // (`mono`) marks; neutral/adaptive only for the standard `dark`.
        r2 === "dark" ? "text-neutral-900 dark:text-white" : "text-white"
      ),
      children: "Structura"
    }
  )
] }), al = ({ className: t2, view: r2 = "full", variant: a3 = "dark" }) => r2 === "icon" ? /* @__PURE__ */ window.wp.element.jsx(br, { className: t2, variant: a3 }) : /* @__PURE__ */ window.wp.element.jsx(kn, { className: t2, variant: a3 }), vn = ({ size: t2 = 16, className: r2, ...a3 }) => /* @__PURE__ */ window.wp.element.jsx(
  "svg",
  {
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "0 0 101 102",
    width: t2,
    height: t2,
    fill: "currentColor",
    className: r2,
    ...a3,
    children: /* @__PURE__ */ window.wp.element.jsx(
      "path",
      {
        d: "M93.9778 41.7467C96.2911 34.8011 95.4945 27.1925 91.795 20.8749C86.2315 11.1849 75.0471 6.19967 64.124 8.54567C59.2647 3.06955 52.2832 -0.0446402 44.9639 -1.51822e-05C33.7986 -0.0255152 23.892 7.16548 20.457 17.7926C13.2843 19.262 7.09308 23.7532 3.4701 30.1187C-2.13485 39.7832 -0.857088 51.9658 6.63105 60.2533C4.31769 67.1989 5.1143 74.8074 8.81376 81.125C14.3773 90.815 25.5617 95.8003 36.4848 93.4543C41.3409 98.9304 48.3256 102.045 55.6449 101.997C66.8165 102.025 76.7264 94.8281 80.1613 84.1914C87.334 82.722 93.5253 78.2308 97.1483 71.8654C102.747 62.2009 101.466 50.0278 93.9809 41.7403L93.9778 41.7467ZM55.6512 95.3317C51.1807 95.3381 46.8503 93.7731 43.4185 90.9075C43.5746 90.8246 43.8455 90.6748 44.0207 90.5664L64.3247 78.8364C65.3635 78.2467 66.0008 77.1407 65.9944 75.9454V47.312L74.5755 52.2686C74.6679 52.3132 74.7285 52.4025 74.7412 52.5045V76.2163C74.7285 86.7605 66.192 95.3094 55.6512 95.3317ZM14.5971 77.7909C12.3571 73.9213 11.5509 69.3855 12.3188 64.9835C12.4686 65.0728 12.7331 65.2354 12.9211 65.3437L33.2251 77.0737C34.2543 77.6762 35.5289 77.6762 36.5613 77.0737L61.3486 62.7555V72.6686C61.355 72.7706 61.3072 72.8694 61.2275 72.9332L40.7037 84.7875C31.5618 90.0532 19.8866 86.9231 14.6003 77.7909H14.5971ZM9.25349 33.456C11.484 29.58 15.005 26.6156 19.1984 25.076C19.1984 25.2514 19.1888 25.5605 19.1888 25.7773V49.2405C19.1824 50.4326 19.8197 51.5387 20.8553 52.1284L45.6426 66.4434L37.0616 71.4C36.9755 71.4574 36.8672 71.4669 36.7716 71.4255L16.2445 59.5616C7.12176 54.2767 3.99267 42.6009 9.2503 33.4592L9.25349 33.456ZM79.7567 49.8684L54.9694 35.5502L63.5504 30.5968C63.6365 30.5394 63.7448 30.5299 63.8404 30.5713L84.3674 42.4256C93.5062 47.7073 96.6384 59.4022 91.3585 68.544C89.1248 72.4136 85.607 75.378 81.4168 76.9207V52.7563C81.4264 51.5642 80.7923 50.4613 79.7599 49.8684H79.7567ZM88.2963 37.01C88.1466 36.9176 87.8821 36.7582 87.6941 36.6499L67.3901 24.9199C66.3609 24.3174 65.0863 24.3174 64.0539 24.9199L39.2666 39.2381V29.325C39.2602 29.223 39.308 29.1242 39.3877 29.0604L59.9115 17.2157C69.0534 11.9404 80.7413 15.08 86.0117 24.2282C88.239 28.0914 89.0451 32.6145 88.29 37.01H88.2963ZM34.6016 54.6784L26.0174 49.7218C25.9249 49.6772 25.8644 49.5879 25.8517 49.4859V25.7741C25.858 15.2171 34.42 6.66186 44.9735 6.66823C49.4377 6.66823 53.7585 8.23648 57.1903 11.0925C57.0342 11.1754 56.7665 11.3252 56.5881 11.4335L36.2841 23.1635C35.2453 23.7532 34.608 24.8561 34.6144 26.0514L34.6016 54.672V54.6784ZM39.2634 44.625L50.3044 38.2468L61.3454 44.6218V57.375L50.3044 63.75L39.2634 57.375V44.625Z",
        fill: "currentColor"
      }
    )
  }
), wn = ({ size: t2 = 16, className: r2, ...a3 }) => /* @__PURE__ */ window.wp.element.jsxs(
  "svg",
  {
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "0 0 65 65",
    width: t2,
    height: t2,
    fill: "currentColor",
    className: r2,
    ...a3,
    children: [
      /* @__PURE__ */ window.wp.element.jsxs("g", { clipPath: "url(#gemini_clip0)", children: [
        /* @__PURE__ */ window.wp.element.jsx(
          "path",
          {
            d: "M57.8647 29.0109C52.865 26.8587 48.4905 23.9061 44.7393 20.1567C40.99 16.4074 38.0373 12.031 35.8851 7.03132C35.0589 5.11516 34.395 3.14552 33.886 1.12608C33.72 0.465846 33.128 0.00109863 32.4475 0.00109863C31.7669 0.00109863 31.1749 0.465846 31.009 1.12608C30.4999 3.14552 29.836 5.11332 29.0098 7.03132C26.8576 12.031 23.905 16.4074 20.1556 20.1567C16.4063 23.9061 12.0299 26.8587 7.03022 29.0109C5.11406 29.8371 3.14442 30.501 1.12498 31.0101C0.464747 31.176 0 31.768 0 32.4486C0 33.1291 0.464747 33.7211 1.12498 33.8871C3.14442 34.3961 5.11222 35.06 7.03022 35.8862C12.0299 38.0384 16.4045 40.9911 20.1556 44.7404C23.9068 48.4897 26.8576 52.8661 29.0098 57.8658C29.836 59.782 30.4999 61.7516 31.009 63.771C31.1749 64.4313 31.7669 64.896 32.4475 64.896C33.128 64.896 33.72 64.4313 33.886 63.771C34.395 61.7516 35.0589 59.7838 35.8851 57.8658C38.0373 52.8661 40.99 48.4916 44.7393 44.7404C48.4886 40.9911 52.865 38.0384 57.8647 35.8862C59.7809 35.06 61.7505 34.3961 63.7699 33.8871C64.4302 33.7211 64.8949 33.1291 64.8949 32.4486C64.8949 31.768 64.4302 31.176 63.7699 31.0101C61.7505 30.501 59.7827 29.8371 57.8647 29.0109Z",
            fill: "white"
          }
        ),
        /* @__PURE__ */ window.wp.element.jsxs(
          "mask",
          {
            id: "gemini_mask0",
            style: { maskType: "alpha" },
            maskUnits: "userSpaceOnUse",
            x: "0",
            y: "0",
            width: "65",
            height: "65",
            children: [
              /* @__PURE__ */ window.wp.element.jsx(
                "path",
                {
                  d: "M32.4473 0C33.1278 0 33.7197 0.464783 33.8857 1.125C34.3947 3.14441 35.0586 5.11414 35.8848 7.03027C38.0369 12.0299 40.99 16.406 44.7393 20.1553C48.4903 23.9045 52.8647 26.8576 57.8643 29.0098C59.7821 29.8359 61.7502 30.4998 63.7695 31.0088C64.4297 31.1748 64.8944 31.7668 64.8945 32.4473C64.8945 33.1278 64.4298 33.7198 63.7695 33.8857C61.7502 34.3947 59.7803 35.0586 57.8643 35.8848C52.8646 38.037 48.4885 40.99 44.7393 44.7393C40.99 48.4904 38.037 52.8646 35.8848 57.8643C35.0586 59.7822 34.3947 61.7502 33.8857 63.7695C33.7198 64.4298 33.1278 64.8945 32.4473 64.8945C31.7668 64.8944 31.1748 64.4297 31.0088 63.7695C30.4998 61.7502 29.8359 59.7803 29.0098 57.8643C26.8576 52.8647 23.9063 48.4885 20.1553 44.7393C16.4041 40.99 12.0299 38.0369 7.03027 35.8848C5.1123 35.0586 3.14441 34.3947 1.125 33.8857C0.464783 33.7197 0 33.1278 0 32.4473C8.67651e-05 31.7668 0.464826 31.1748 1.125 31.0088C3.14442 30.4998 5.11413 29.836 7.03027 29.0098C12.03 26.8575 16.406 23.9046 20.1553 20.1553C23.9046 16.406 26.8575 12.03 29.0098 7.03027C29.836 5.11229 30.4998 3.14442 31.0088 1.125C31.1748 0.464826 31.7668 8.67651e-05 32.4473 0Z",
                  fill: "black"
                }
              ),
              /* @__PURE__ */ window.wp.element.jsx(
                "path",
                {
                  d: "M32.4473 0C33.1278 0 33.7197 0.464783 33.8857 1.125C34.3947 3.14441 35.0586 5.11414 35.8848 7.03027C38.0369 12.0299 40.99 16.406 44.7393 20.1553C48.4903 23.9045 52.8647 26.8576 57.8643 29.0098C59.7821 29.8359 61.7502 30.4998 63.7695 31.0088C64.4297 31.1748 64.8944 31.7668 64.8945 32.4473C64.8945 33.1278 64.4298 33.7198 63.7695 33.8857C61.7502 34.3947 59.7803 35.0586 57.8643 35.8848C52.8646 38.037 48.4885 40.99 44.7393 44.7393C40.99 48.4904 38.037 52.8646 35.8848 57.8643C35.0586 59.7822 34.3947 61.7502 33.8857 63.7695C33.7198 64.4298 33.1278 64.8945 32.4473 64.8945C31.7668 64.8944 31.1748 64.4297 31.0088 63.7695C30.4998 61.7502 29.8359 59.7803 29.0098 57.8643C26.8576 52.8647 23.9063 48.4885 20.1553 44.7393C16.4041 40.99 12.0299 38.0369 7.03027 35.8848C5.1123 35.0586 3.14441 34.3947 1.125 33.8857C0.464783 33.7197 0 33.1278 0 32.4473C8.67651e-05 31.7668 0.464826 31.1748 1.125 31.0088C3.14442 30.4998 5.11413 29.836 7.03027 29.0098C12.03 26.8575 16.406 23.9046 20.1553 20.1553C23.9046 16.406 26.8575 12.03 29.0098 7.03027C29.836 5.11229 30.4998 3.14442 31.0088 1.125C31.1748 0.464826 31.7668 8.67651e-05 32.4473 0Z",
                  fill: "url(#gemini_paint0)"
                }
              )
            ]
          }
        ),
        /* @__PURE__ */ window.wp.element.jsx("g", { mask: "url(#gemini_mask0)", children: /* @__PURE__ */ window.wp.element.jsx(
          "path",
          {
            d: "M32.4473 0C33.1278 0 33.7197 0.464783 33.8857 1.125C34.3947 3.14441 35.0586 5.11414 35.8848 7.03027C38.0369 12.0299 40.99 16.406 44.7393 20.1553C48.4903 23.9045 52.8647 26.8576 57.8643 29.0098C59.7821 29.8359 61.7502 30.4998 63.7695 31.0088C64.4297 31.1748 64.8944 31.7668 64.8945 32.4473C64.8945 33.1278 64.4298 33.7198 63.7695 33.8857C61.7502 34.3947 59.7803 35.0586 57.8643 35.8848C52.8646 38.037 48.4885 40.99 44.7393 44.7393C40.99 48.4904 38.037 52.8646 35.8848 57.8643C35.0586 59.7822 34.3947 61.7502 33.8857 63.7695C33.7198 64.4298 33.1278 64.8945 32.4473 64.8945C31.7668 64.8944 31.1748 64.4297 31.0088 63.7695C30.4998 61.7502 29.8359 59.7803 29.0098 57.8643C26.8576 52.8647 23.9063 48.4885 20.1553 44.7393C16.4041 40.99 12.0299 38.0369 7.03027 35.8848C5.1123 35.0586 3.14441 34.3947 1.125 33.8857C0.464783 33.7197 0 33.1278 0 32.4473C8.67651e-05 31.7668 0.464826 31.1748 1.125 31.0088C3.14442 30.4998 5.11413 29.836 7.03027 29.0098C12.03 26.8575 16.406 23.9046 20.1553 20.1553C23.9046 16.406 26.8575 12.03 29.0098 7.03027C29.836 5.11229 30.4998 3.14442 31.0088 1.125C31.1748 0.464826 31.7668 8.67651e-05 32.4473 0Z",
            fill: "url(#gemini_paint0)"
          }
        ) })
      ] }),
      /* @__PURE__ */ window.wp.element.jsxs("defs", { children: [
        /* @__PURE__ */ window.wp.element.jsxs(
          "linearGradient",
          {
            id: "gemini_paint0",
            x1: "18.4474",
            y1: "43.4202",
            x2: "52.1528",
            y2: "15.0035",
            gradientUnits: "userSpaceOnUse",
            children: [
              /* @__PURE__ */ window.wp.element.jsx("stop", { stopColor: "#4893FC" }),
              /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "0.27", stopColor: "#4893FC" }),
              /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "0.776981", stopColor: "#969DFF" }),
              /* @__PURE__ */ window.wp.element.jsx("stop", { offset: "1", stopColor: "#BD99FE" })
            ]
          }
        ),
        /* @__PURE__ */ window.wp.element.jsx("clipPath", { id: "gemini_clip0", children: /* @__PURE__ */ window.wp.element.jsx("rect", { width: "65", height: "65", fill: "white" }) })
      ] })
    ]
  }
), yn = ({ size: t2 = 16, className: r2, ...a3 }) => /* @__PURE__ */ window.wp.element.jsxs(
  "svg",
  {
    xmlns: "http://www.w3.org/2000/svg",
    viewBox: "0 0 52 52",
    width: t2,
    height: t2,
    fill: "currentColor",
    className: r2,
    ...a3,
    children: [
      /* @__PURE__ */ window.wp.element.jsx("g", { clipPath: "url(#claude_clip0)", children: /* @__PURE__ */ window.wp.element.jsx(
        "path",
        {
          d: "M10.1888 34.76L20.4093 29.0224L20.5811 28.5241L20.4093 28.2469H19.9112L18.2031 28.1416L12.3634 27.9837L7.29879 27.7731L2.39201 27.5099L1.15743 27.2467L0 25.7202L0.119251 24.9587L1.15743 24.2604L2.64454 24.3902L5.93093 24.6148L10.8623 24.9552L14.4398 25.1658L19.7394 25.7167H20.5811L20.7004 25.3763L20.4128 25.1658L20.1883 24.9552L15.0851 21.4951L9.56103 17.8385L6.66747 15.7329L5.10319 14.6661L4.31404 13.666L3.97383 11.4832L5.3943 9.91809L7.3023 10.0479L7.78982 10.1778L9.72237 11.6657L13.8505 14.8626L19.2413 18.8351L20.0305 19.4913L20.3461 19.2667L20.3847 19.1088L20.0305 18.5157L17.0983 13.2133L13.9698 7.81956L12.5774 5.58417L12.2091 4.24364C12.0793 3.69269 11.9846 3.22947 11.9846 2.66448L13.6015 0.467692L14.4959 0.179932L16.6529 0.467692L17.5613 1.25727L18.9011 4.32435L21.0721 9.15308L24.4392 15.7189L25.4248 17.6665L25.9509 19.4703L26.1473 20.0212H26.4875V19.7054L26.7646 16.0066L27.2766 11.4657L27.7747 5.62277L27.9466 3.97694L28.7603 2.00474L30.3771 0.93793L31.6398 1.54152L32.678 3.02944L32.5342 3.99097L31.9169 8.00555L30.7068 14.2941L29.9177 18.5052H30.3771L30.9032 17.9788L33.0322 15.1504L36.6097 10.6761L38.188 8.90041L40.0294 6.93874L41.2113 6.00528H43.4455L45.0905 8.45123L44.3539 10.9779L42.0531 13.8976L40.1451 16.3716L37.4094 20.0563L35.7013 23.0041L35.8591 23.2392L36.266 23.2006L42.4459 21.8846L45.7849 21.281L49.7693 20.5967L51.5721 21.4389L51.7685 22.2952L51.06 24.0463L46.7985 25.0991L41.8006 26.0992L34.358 27.8609L34.2668 27.9275L34.372 28.0574L37.725 28.3732L39.1595 28.4504H42.6704L49.2081 28.9382L50.9162 30.0682L51.9403 31.4508L51.7685 32.5036L49.138 33.8441L45.5885 33.0019L37.3042 31.0297L34.4632 30.3208H34.0704V30.556L36.4378 32.8721L40.7764 36.7919L46.2093 41.8452L46.4864 43.0945L45.7884 44.0806L45.0519 43.9753L40.2784 40.3819L38.437 38.7641L34.2668 35.2513H33.9897V35.6198L34.9507 37.027L40.0259 44.6596L40.2889 47.0003L39.9206 47.7618L38.6054 48.2215L37.1604 47.9583L34.1896 43.7858L31.1242 39.0869L28.6515 34.8758L28.3499 35.0478L26.8908 50.7727L26.2069 51.5763L24.6286 52.1799L23.3133 51.1798L22.6154 49.562L23.3133 46.3651L24.1551 42.1926L24.839 38.8764L25.4563 34.7565L25.8246 33.3879L25.8001 33.2967L25.4984 33.3353L22.3944 37.599L17.6735 43.9823L13.9382 47.9829L13.0438 48.3373L11.4936 47.5337L11.6374 46.0984L12.5037 44.821L17.6735 38.2412L20.7916 34.1635L22.8048 31.8088L22.7908 31.4684H22.6715L8.94023 40.3889L6.49561 40.7047L5.44341 39.7186L5.57318 38.1008L6.07122 37.5745L10.1994 34.732L10.1853 34.746L10.1888 34.76Z",
          fill: "#D97757"
        }
      ) }),
      /* @__PURE__ */ window.wp.element.jsx("defs", { children: /* @__PURE__ */ window.wp.element.jsx("clipPath", { id: "claude_clip0", children: /* @__PURE__ */ window.wp.element.jsx("rect", { width: "52", height: "52", fill: "white" }) }) })
    ]
  }
);
function il(t2) {
  switch ((t2 ?? "").toLowerCase()) {
    case "gemini":
    case "google":
      return wn;
    case "openai":
      return vn;
    case "anthropic":
    case "claude":
      return yn;
    default:
      return null;
  }
}
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
const toCamelCase = (string) => string.replace(
  /^([A-Z])|[\s-_]+(\w)/g,
  (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
);
const toPascalCase = (string) => {
  const camelCase = toCamelCase(string);
  return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
};
const mergeClasses = (...classes) => classes.filter((className, index2, array) => {
  return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index2;
}).join(" ").trim();
const hasA11yProp = (props) => {
  for (const prop in props) {
    if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
      return true;
    }
  }
};
var defaultAttributes = {
  xmlns: "http://www.w3.org/2000/svg",
  width: 24,
  height: 24,
  viewBox: "0 0 24 24",
  fill: "none",
  stroke: "currentColor",
  strokeWidth: 2,
  strokeLinecap: "round",
  strokeLinejoin: "round"
};
const Icon = window.wp.element.forwardRef(
  ({
    color = "currentColor",
    size: size2 = 24,
    strokeWidth = 2,
    absoluteStrokeWidth,
    className = "",
    children,
    iconNode,
    ...rest
  }, ref) => window.wp.element.createElement(
    "svg",
    {
      ref,
      ...defaultAttributes,
      width: size2,
      height: size2,
      stroke: color,
      strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size2) : strokeWidth,
      className: mergeClasses("lucide", className),
      ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
      ...rest
    },
    [
      ...iconNode.map(([tag, attrs]) => window.wp.element.createElement(tag, attrs)),
      ...Array.isArray(children) ? children : [children]
    ]
  )
);
const createLucideIcon = (iconName, iconNode) => {
  const Component = window.wp.element.forwardRef(
    ({ className, ...props }, ref) => window.wp.element.createElement(Icon, {
      ref,
      iconNode,
      className: mergeClasses(
        `lucide-${toKebabCase(toPascalCase(iconName))}`,
        `lucide-${iconName}`,
        className
      ),
      ...props
    })
  );
  Component.displayName = toPascalCase(iconName);
  return Component;
};
const __iconNode$25 = [
  [
    "path",
    {
      d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
      key: "169zse"
    }
  ]
];
const Activity = createLucideIcon("activity", __iconNode$25);
const __iconNode$24 = [
  ["path", { d: "M12 5v14", key: "s699le" }],
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
];
const ArrowDown = createLucideIcon("arrow-down", __iconNode$24);
const __iconNode$23 = [
  ["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
  ["path", { d: "M19 12H5", key: "x3x0zl" }]
];
const ArrowLeft = createLucideIcon("arrow-left", __iconNode$23);
const __iconNode$22 = [
  ["path", { d: "M5 12h14", key: "1ays0h" }],
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
];
const ArrowRight = createLucideIcon("arrow-right", __iconNode$22);
const __iconNode$21 = [
  ["path", { d: "M7 7h10v10", key: "1tivn9" }],
  ["path", { d: "M7 17 17 7", key: "1vkiza" }]
];
const ArrowUpRight = createLucideIcon("arrow-up-right", __iconNode$21);
const __iconNode$20 = [
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
];
const ArrowUp = createLucideIcon("arrow-up", __iconNode$20);
const __iconNode$1$ = [
  [
    "path",
    {
      d: "m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",
      key: "1yiouv"
    }
  ],
  ["circle", { cx: "12", cy: "8", r: "6", key: "1vp47v" }]
];
const Award = createLucideIcon("award", __iconNode$1$);
const __iconNode$1_ = [
  ["path", { d: "M10.268 21a2 2 0 0 0 3.464 0", key: "vwvbt9" }],
  ["path", { d: "M22 8c0-2.3-.8-4.3-2-6", key: "5bb3ad" }],
  [
    "path",
    {
      d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",
      key: "11g9vi"
    }
  ],
  ["path", { d: "M4 2C2.8 3.7 2 5.7 2 8", key: "tap9e0" }]
];
const BellRing = createLucideIcon("bell-ring", __iconNode$1_);
const __iconNode$1Z = [
  ["path", { d: "M10.268 21a2 2 0 0 0 3.464 0", key: "vwvbt9" }],
  [
    "path",
    {
      d: "M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",
      key: "11g9vi"
    }
  ]
];
const Bell = createLucideIcon("bell", __iconNode$1Z);
const __iconNode$1Y = [
  ["path", { d: "M12 21V7", key: "gj6g52" }],
  ["path", { d: "m16 12 2 2 4-4", key: "mdajum" }],
  [
    "path",
    {
      d: "M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",
      key: "8arnkb"
    }
  ]
];
const BookOpenCheck = createLucideIcon("book-open-check", __iconNode$1Y);
const __iconNode$1X = [
  ["path", { d: "M12 7v14", key: "1akyts" }],
  [
    "path",
    {
      d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",
      key: "ruj8y"
    }
  ]
];
const BookOpen = createLucideIcon("book-open", __iconNode$1X);
const __iconNode$1W = [
  ["path", { d: "M12 8V4H8", key: "hb8ula" }],
  ["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
  ["path", { d: "M2 14h2", key: "vft8re" }],
  ["path", { d: "M20 14h2", key: "4cs60a" }],
  ["path", { d: "M15 13v2", key: "1xurst" }],
  ["path", { d: "M9 13v2", key: "rq6x2g" }]
];
const Bot = createLucideIcon("bot", __iconNode$1W);
const __iconNode$1V = [
  [
    "path",
    {
      d: "M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",
      key: "lc1i9w"
    }
  ],
  ["path", { d: "m7 16.5-4.74-2.85", key: "1o9zyk" }],
  ["path", { d: "m7 16.5 5-3", key: "va8pkn" }],
  ["path", { d: "M7 16.5v5.17", key: "jnp8gn" }],
  [
    "path",
    {
      d: "M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",
      key: "8zsnat"
    }
  ],
  ["path", { d: "m17 16.5-5-3", key: "8arw3v" }],
  ["path", { d: "m17 16.5 4.74-2.85", key: "8rfmw" }],
  ["path", { d: "M17 16.5v5.17", key: "k6z78m" }],
  [
    "path",
    {
      d: "M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",
      key: "1xygjf"
    }
  ],
  ["path", { d: "M12 8 7.26 5.15", key: "1vbdud" }],
  ["path", { d: "m12 8 4.74-2.85", key: "3rx089" }],
  ["path", { d: "M12 13.5V8", key: "1io7kd" }]
];
const Boxes = createLucideIcon("boxes", __iconNode$1V);
const __iconNode$1U = [
  ["path", { d: "M10 12h4", key: "a56b0p" }],
  ["path", { d: "M10 8h4", key: "1sr2af" }],
  ["path", { d: "M14 21v-3a2 2 0 0 0-4 0v3", key: "1rgiei" }],
  [
    "path",
    {
      d: "M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",
      key: "secmi2"
    }
  ],
  ["path", { d: "M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16", key: "16ra0t" }]
];
const Building2 = createLucideIcon("building-2", __iconNode$1U);
const __iconNode$1T = [
  ["path", { d: "M16 14v2.2l1.6 1", key: "fo4ql5" }],
  ["path", { d: "M16 2v4", key: "4m81vk" }],
  ["path", { d: "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5", key: "1osxxc" }],
  ["path", { d: "M3 10h5", key: "r794hk" }],
  ["path", { d: "M8 2v4", key: "1cmpym" }],
  ["circle", { cx: "16", cy: "16", r: "6", key: "qoo3c4" }]
];
const CalendarClock = createLucideIcon("calendar-clock", __iconNode$1T);
const __iconNode$1S = [
  ["path", { d: "M8 2v4", key: "1cmpym" }],
  ["path", { d: "M16 2v4", key: "4m81vk" }],
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
  ["path", { d: "M3 10h18", key: "8toen8" }]
];
const Calendar = createLucideIcon("calendar", __iconNode$1S);
const __iconNode$1R = [
  [
    "path",
    {
      d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
      key: "18u6gg"
    }
  ],
  ["circle", { cx: "12", cy: "13", r: "3", key: "1vg3eu" }]
];
const Camera = createLucideIcon("camera", __iconNode$1R);
const __iconNode$1Q = [
  ["rect", { width: "18", height: "14", x: "3", y: "5", rx: "2", ry: "2", key: "12ruh7" }],
  ["path", { d: "M7 15h4M15 15h2M7 11h2M13 11h4", key: "1ueiar" }]
];
const Captions = createLucideIcon("captions", __iconNode$1Q);
const __iconNode$1P = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
const Check = createLucideIcon("check", __iconNode$1P);
const __iconNode$1O = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
const ChevronDown = createLucideIcon("chevron-down", __iconNode$1O);
const __iconNode$1N = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
const ChevronLeft = createLucideIcon("chevron-left", __iconNode$1N);
const __iconNode$1M = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
const ChevronRight = createLucideIcon("chevron-right", __iconNode$1M);
const __iconNode$1L = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
const ChevronUp = createLucideIcon("chevron-up", __iconNode$1L);
const __iconNode$1K = [
  ["path", { d: "m6 17 5-5-5-5", key: "xnjwq" }],
  ["path", { d: "m13 17 5-5-5-5", key: "17xmmf" }]
];
const ChevronsRight = createLucideIcon("chevrons-right", __iconNode$1K);
const __iconNode$1J = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
];
const CircleAlert = createLucideIcon("circle-alert", __iconNode$1J);
const __iconNode$1I = [
  ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
];
const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$1I);
const __iconNode$1H = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
];
const CircleCheck = createLucideIcon("circle-check", __iconNode$1H);
const __iconNode$1G = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
  ["path", { d: "M12 17h.01", key: "p32p05" }]
];
const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$1G);
const __iconNode$1F = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["circle", { cx: "12", cy: "10", r: "3", key: "ilqhr7" }],
  ["path", { d: "M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662", key: "154egf" }]
];
const CircleUser = createLucideIcon("circle-user", __iconNode$1F);
const __iconNode$1E = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
];
const CircleX = createLucideIcon("circle-x", __iconNode$1E);
const __iconNode$1D = [
  ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
  [
    "path",
    {
      d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",
      key: "116196"
    }
  ],
  ["path", { d: "M12 11h4", key: "1jrz19" }],
  ["path", { d: "M12 16h4", key: "n85exb" }],
  ["path", { d: "M8 11h.01", key: "1dfujw" }],
  ["path", { d: "M8 16h.01", key: "18s6g9" }]
];
const ClipboardList = createLucideIcon("clipboard-list", __iconNode$1D);
const __iconNode$1C = [
  ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }],
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
];
const Clock = createLucideIcon("clock", __iconNode$1C);
const __iconNode$1B = [
  ["path", { d: "m2 2 20 20", key: "1ooewy" }],
  ["path", { d: "M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193", key: "yfwify" }],
  [
    "path",
    { d: "M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07", key: "jlfiyv" }
  ]
];
const CloudOff = createLucideIcon("cloud-off", __iconNode$1B);
const __iconNode$1A = [
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
];
const Copy = createLucideIcon("copy", __iconNode$1A);
const __iconNode$1z = [
  ["path", { d: "M12 20v2", key: "1lh1kg" }],
  ["path", { d: "M12 2v2", key: "tus03m" }],
  ["path", { d: "M17 20v2", key: "1rnc9c" }],
  ["path", { d: "M17 2v2", key: "11trls" }],
  ["path", { d: "M2 12h2", key: "1t8f8n" }],
  ["path", { d: "M2 17h2", key: "7oei6x" }],
  ["path", { d: "M2 7h2", key: "asdhe0" }],
  ["path", { d: "M20 12h2", key: "1q8mjw" }],
  ["path", { d: "M20 17h2", key: "1fpfkl" }],
  ["path", { d: "M20 7h2", key: "1o8tra" }],
  ["path", { d: "M7 20v2", key: "4gnj0m" }],
  ["path", { d: "M7 2v2", key: "1i4yhu" }],
  ["rect", { x: "4", y: "4", width: "16", height: "16", rx: "2", key: "1vbyd7" }],
  ["rect", { x: "8", y: "8", width: "8", height: "8", rx: "1", key: "z9xiuo" }]
];
const Cpu = createLucideIcon("cpu", __iconNode$1z);
const __iconNode$1y = [
  ["rect", { width: "20", height: "14", x: "2", y: "5", rx: "2", key: "ynyp8z" }],
  ["line", { x1: "2", x2: "22", y1: "10", y2: "10", key: "1b3vmo" }]
];
const CreditCard = createLucideIcon("credit-card", __iconNode$1y);
const __iconNode$1x = [
  [
    "path",
    {
      d: "M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",
      key: "1vdc57"
    }
  ],
  ["path", { d: "M5 21h14", key: "11awu3" }]
];
const Crown = createLucideIcon("crown", __iconNode$1x);
const __iconNode$1w = [
  ["path", { d: "M12 15V3", key: "m9g1x1" }],
  ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
  ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
];
const Download = createLucideIcon("download", __iconNode$1w);
const __iconNode$1v = [
  ["path", { d: "M21.54 15H17a2 2 0 0 0-2 2v4.54", key: "1djwo0" }],
  [
    "path",
    {
      d: "M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",
      key: "1tzkfa"
    }
  ],
  ["path", { d: "M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05", key: "14pb5j" }],
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
];
const Earth = createLucideIcon("earth", __iconNode$1v);
const __iconNode$1u = [
  ["path", { d: "M15 3h6v6", key: "1q9fwt" }],
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
];
const ExternalLink = createLucideIcon("external-link", __iconNode$1u);
const __iconNode$1t = [
  [
    "path",
    {
      d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
      key: "ct8e1f"
    }
  ],
  ["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242", key: "151rxh" }],
  [
    "path",
    {
      d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",
      key: "13bj9a"
    }
  ],
  ["path", { d: "m2 2 20 20", key: "1ooewy" }]
];
const EyeOff = createLucideIcon("eye-off", __iconNode$1t);
const __iconNode$1s = [
  [
    "path",
    {
      d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
      key: "1nclc0"
    }
  ],
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
];
const Eye = createLucideIcon("eye", __iconNode$1s);
const __iconNode$1r = [
  [
    "path",
    {
      d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
      key: "1oefj6"
    }
  ],
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
  ["path", { d: "M10 12.5 8 15l2 2.5", key: "1tg20x" }],
  ["path", { d: "m14 12.5 2 2.5-2 2.5", key: "yinavb" }]
];
const FileCode = createLucideIcon("file-code", __iconNode$1r);
const __iconNode$1q = [
  [
    "path",
    {
      d: "m18.226 5.226-2.52-2.52A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.351",
      key: "1k2beg"
    }
  ],
  [
    "path",
    {
      d: "M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",
      key: "2t3380"
    }
  ],
  ["path", { d: "M8 18h1", key: "13wk12" }]
];
const FilePenLine = createLucideIcon("file-pen-line", __iconNode$1q);
const __iconNode$1p = [
  [
    "path",
    {
      d: "M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",
      key: "o6klzx"
    }
  ],
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
  [
    "path",
    {
      d: "M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",
      key: "zhnas1"
    }
  ]
];
const FilePen = createLucideIcon("file-pen", __iconNode$1p);
const __iconNode$1o = [
  ["path", { d: "M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1", key: "likhh7" }],
  ["path", { d: "M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1", key: "17ky3x" }],
  [
    "path",
    {
      d: "M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z",
      key: "1hyeo0"
    }
  ]
];
const FileStack = createLucideIcon("file-stack", __iconNode$1o);
const __iconNode$1n = [
  [
    "path",
    {
      d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
      key: "1oefj6"
    }
  ],
  ["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }],
  ["path", { d: "M10 9H8", key: "b1mrlr" }],
  ["path", { d: "M16 13H8", key: "t4e002" }],
  ["path", { d: "M16 17H8", key: "z1uh3a" }]
];
const FileText = createLucideIcon("file-text", __iconNode$1n);
const __iconNode$1m = [
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
  ["path", { d: "M7 3v18", key: "bbkbws" }],
  ["path", { d: "M3 7.5h4", key: "zfgn84" }],
  ["path", { d: "M3 12h18", key: "1i2n21" }],
  ["path", { d: "M3 16.5h4", key: "1230mu" }],
  ["path", { d: "M17 3v18", key: "in4fa5" }],
  ["path", { d: "M17 7.5h4", key: "myr1c1" }],
  ["path", { d: "M17 16.5h4", key: "go4c1d" }]
];
const Film = createLucideIcon("film", __iconNode$1m);
const __iconNode$1l = [
  [
    "path",
    {
      d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
      key: "usdka0"
    }
  ]
];
const FolderOpen = createLucideIcon("folder-open", __iconNode$1l);
const __iconNode$1k = [
  ["path", { d: "m12 14 4-4", key: "9kzdfg" }],
  ["path", { d: "M3.34 19a10 10 0 1 1 17.32 0", key: "19p75a" }]
];
const Gauge = createLucideIcon("gauge", __iconNode$1k);
const __iconNode$1j = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
  ["path", { d: "M2 12h20", key: "9i4pu4" }]
];
const Globe = createLucideIcon("globe", __iconNode$1j);
const __iconNode$1i = [
  [
    "path",
    {
      d: "M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",
      key: "j76jl0"
    }
  ],
  ["path", { d: "M22 10v6", key: "1lu8f3" }],
  ["path", { d: "M6 12.5V16a6 3 0 0 0 12 0v-3.5", key: "1r8lef" }]
];
const GraduationCap = createLucideIcon("graduation-cap", __iconNode$1i);
const __iconNode$1h = [
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
  ["path", { d: "M12 7v5l4 2", key: "1fdv2h" }]
];
const History = createLucideIcon("history", __iconNode$1h);
const __iconNode$1g = [
  ["path", { d: "M5 22h14", key: "ehvnwv" }],
  ["path", { d: "M5 2h14", key: "pdyrp9" }],
  [
    "path",
    {
      d: "M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",
      key: "1d314k"
    }
  ],
  [
    "path",
    { d: "M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2", key: "1vvvr6" }
  ]
];
const Hourglass = createLucideIcon("hourglass", __iconNode$1g);
const __iconNode$1f = [
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
  ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
  ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
];
const Image = createLucideIcon("image", __iconNode$1f);
const __iconNode$1e = [
  ["polyline", { points: "22 12 16 12 14 15 10 15 8 12 2 12", key: "o97t9d" }],
  [
    "path",
    {
      d: "M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",
      key: "oot6mr"
    }
  ]
];
const Inbox = createLucideIcon("inbox", __iconNode$1e);
const __iconNode$1d = [
  ["path", { d: "M6 16c5 0 7-8 12-8a4 4 0 0 1 0 8c-5 0-7-8-12-8a4 4 0 1 0 0 8", key: "18ogeb" }]
];
const Infinity$1 = createLucideIcon("infinity", __iconNode$1d);
const __iconNode$1c = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["path", { d: "M12 16v-4", key: "1dtifu" }],
  ["path", { d: "M12 8h.01", key: "e9boi3" }]
];
const Info = createLucideIcon("info", __iconNode$1c);
const __iconNode$1b = [
  [
    "path",
    {
      d: "M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",
      key: "1s6t7t"
    }
  ],
  ["circle", { cx: "16.5", cy: "7.5", r: ".5", fill: "currentColor", key: "w0ekpg" }]
];
const KeyRound = createLucideIcon("key-round", __iconNode$1b);
const __iconNode$1a = [
  ["path", { d: "m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4", key: "g0fldk" }],
  ["path", { d: "m21 2-9.6 9.6", key: "1j0ho8" }],
  ["circle", { cx: "7.5", cy: "15.5", r: "5.5", key: "yqb3hr" }]
];
const Key = createLucideIcon("key", __iconNode$1a);
const __iconNode$19 = [
  ["path", { d: "m5 8 6 6", key: "1wu5hv" }],
  ["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
  ["path", { d: "M2 5h12", key: "or177f" }],
  ["path", { d: "M7 2h1", key: "1t2jsx" }],
  ["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
  ["path", { d: "M14 18h6", key: "1m8k6r" }]
];
const Languages = createLucideIcon("languages", __iconNode$19);
const __iconNode$18 = [
  [
    "path",
    {
      d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
      key: "zw3jo"
    }
  ],
  [
    "path",
    {
      d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
      key: "1wduqc"
    }
  ],
  [
    "path",
    {
      d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
      key: "kqbvx6"
    }
  ]
];
const Layers = createLucideIcon("layers", __iconNode$18);
const __iconNode$17 = [
  ["rect", { width: "7", height: "9", x: "3", y: "3", rx: "1", key: "10lvy0" }],
  ["rect", { width: "7", height: "5", x: "14", y: "3", rx: "1", key: "16une8" }],
  ["rect", { width: "7", height: "9", x: "14", y: "12", rx: "1", key: "1hutg5" }],
  ["rect", { width: "7", height: "5", x: "3", y: "16", rx: "1", key: "ldoo1y" }]
];
const LayoutDashboard = createLucideIcon("layout-dashboard", __iconNode$17);
const __iconNode$16 = [
  ["path", { d: "m16 6 4 14", key: "ji33uf" }],
  ["path", { d: "M12 6v14", key: "1n7gus" }],
  ["path", { d: "M8 8v12", key: "1gg7y9" }],
  ["path", { d: "M4 4v16", key: "6qkkli" }]
];
const Library = createLucideIcon("library", __iconNode$16);
const __iconNode$15 = [
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
];
const Link2 = createLucideIcon("link-2", __iconNode$15);
const __iconNode$14 = [
  ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
  ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
];
const Link = createLucideIcon("link", __iconNode$14);
const __iconNode$13 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
const LoaderCircle = createLucideIcon("loader-circle", __iconNode$13);
const __iconNode$12 = [
  ["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
  ["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
];
const Lock = createLucideIcon("lock", __iconNode$12);
const __iconNode$11 = [
  ["path", { d: "M8 3H5a2 2 0 0 0-2 2v3", key: "1dcmit" }],
  ["path", { d: "M21 8V5a2 2 0 0 0-2-2h-3", key: "1e4gt3" }],
  ["path", { d: "M3 16v3a2 2 0 0 0 2 2h3", key: "wsl5sc" }],
  ["path", { d: "M16 21h3a2 2 0 0 0 2-2v-3", key: "18trek" }]
];
const Maximize = createLucideIcon("maximize", __iconNode$11);
const __iconNode$10 = [
  ["path", { d: "M4 5h16", key: "1tepv9" }],
  ["path", { d: "M4 12h16", key: "1lakjw" }],
  ["path", { d: "M4 19h16", key: "1djgab" }]
];
const Menu = createLucideIcon("menu", __iconNode$10);
const __iconNode$$ = [
  [
    "path",
    {
      d: "M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",
      key: "18887p"
    }
  ]
];
const MessageSquare = createLucideIcon("message-square", __iconNode$$);
const __iconNode$_ = [["path", { d: "M5 12h14", key: "1ays0h" }]];
const Minus = createLucideIcon("minus", __iconNode$_);
const __iconNode$Z = [
  ["circle", { cx: "8", cy: "18", r: "4", key: "1fc0mg" }],
  ["path", { d: "M12 18V2l7 4", key: "g04rme" }]
];
const Music2 = createLucideIcon("music-2", __iconNode$Z);
const __iconNode$Y = [
  ["path", { d: "M15 18h-5", key: "95g1m2" }],
  ["path", { d: "M18 14h-8", key: "sponae" }],
  [
    "path",
    {
      d: "M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-4 0v-9a2 2 0 0 1 2-2h2",
      key: "39pd36"
    }
  ],
  ["rect", { width: "8", height: "4", x: "10", y: "6", rx: "1", key: "aywv1n" }]
];
const Newspaper = createLucideIcon("newspaper", __iconNode$Y);
const __iconNode$X = [
  ["path", { d: "M12 16h.01", key: "1drbdi" }],
  ["path", { d: "M12 8v4", key: "1got3b" }],
  [
    "path",
    {
      d: "M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",
      key: "1fd625"
    }
  ]
];
const OctagonAlert = createLucideIcon("octagon-alert", __iconNode$X);
const __iconNode$W = [
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
  [
    "path",
    {
      d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",
      key: "2d38gg"
    }
  ],
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
];
const OctagonX = createLucideIcon("octagon-x", __iconNode$W);
const __iconNode$V = [
  ["path", { d: "M12 22v-9", key: "x3hkom" }],
  [
    "path",
    {
      d: "M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",
      key: "2ntwy6"
    }
  ],
  [
    "path",
    {
      d: "M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",
      key: "1pmm1c"
    }
  ],
  [
    "path",
    {
      d: "M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",
      key: "12ttoo"
    }
  ]
];
const PackageOpen = createLucideIcon("package-open", __iconNode$V);
const __iconNode$U = [
  [
    "path",
    {
      d: "M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",
      key: "1a0edw"
    }
  ],
  ["path", { d: "M12 22V12", key: "d0xqtd" }],
  ["polyline", { points: "3.29 7 12 12 20.71 7", key: "ousv84" }],
  ["path", { d: "m7.5 4.27 9 5.15", key: "1c824w" }]
];
const Package = createLucideIcon("package", __iconNode$U);
const __iconNode$T = [
  [
    "path",
    {
      d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
      key: "e79jfc"
    }
  ],
  ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
  ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
  ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
  ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
];
const Palette = createLucideIcon("palette", __iconNode$T);
const __iconNode$S = [
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
  ["path", { d: "M3 9h18", key: "1pudct" }],
  ["path", { d: "M9 21V9", key: "1oto5p" }]
];
const PanelsTopLeft = createLucideIcon("panels-top-left", __iconNode$S);
const __iconNode$R = [
  [
    "path",
    {
      d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",
      key: "1miecu"
    }
  ]
];
const Paperclip = createLucideIcon("paperclip", __iconNode$R);
const __iconNode$Q = [
  ["path", { d: "M5.8 11.3 2 22l10.7-3.79", key: "gwxi1d" }],
  ["path", { d: "M4 3h.01", key: "1vcuye" }],
  ["path", { d: "M22 8h.01", key: "1mrtc2" }],
  ["path", { d: "M15 2h.01", key: "1cjtqr" }],
  ["path", { d: "M22 20h.01", key: "1mrys2" }],
  [
    "path",
    {
      d: "m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",
      key: "hbicv8"
    }
  ],
  [
    "path",
    { d: "m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17", key: "1i94pl" }
  ],
  ["path", { d: "m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7", key: "1cofks" }],
  [
    "path",
    {
      d: "M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",
      key: "4kbmks"
    }
  ]
];
const PartyPopper = createLucideIcon("party-popper", __iconNode$Q);
const __iconNode$P = [
  ["rect", { x: "14", y: "3", width: "5", height: "18", rx: "1", key: "kaeet6" }],
  ["rect", { x: "5", y: "3", width: "5", height: "18", rx: "1", key: "1wsw3u" }]
];
const Pause = createLucideIcon("pause", __iconNode$P);
const __iconNode$O = [
  ["path", { d: "M13 21h8", key: "1jsn5i" }],
  [
    "path",
    {
      d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
      key: "1a8usu"
    }
  ]
];
const PenLine = createLucideIcon("pen-line", __iconNode$O);
const __iconNode$N = [
  [
    "path",
    {
      d: "M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",
      key: "nt11vn"
    }
  ],
  [
    "path",
    {
      d: "m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",
      key: "15qc1e"
    }
  ],
  ["path", { d: "m2.3 2.3 7.286 7.286", key: "1wuzzi" }],
  ["circle", { cx: "11", cy: "11", r: "2", key: "xmgehs" }]
];
const PenTool = createLucideIcon("pen-tool", __iconNode$N);
const __iconNode$M = [
  ["path", { d: "M13 21h8", key: "1jsn5i" }],
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }],
  [
    "path",
    {
      d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
      key: "1a8usu"
    }
  ]
];
const PencilLine = createLucideIcon("pencil-line", __iconNode$M);
const __iconNode$L = [
  [
    "path",
    {
      d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
      key: "1a8usu"
    }
  ],
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
];
const Pencil = createLucideIcon("pencil", __iconNode$L);
const __iconNode$K = [
  [
    "path",
    {
      d: "M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",
      key: "10ikf1"
    }
  ]
];
const Play = createLucideIcon("play", __iconNode$K);
const __iconNode$J = [
  ["path", { d: "M12 22v-5", key: "1ega77" }],
  ["path", { d: "M15 8V2", key: "18g5xt" }],
  [
    "path",
    { d: "M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z", key: "1xoxul" }
  ],
  ["path", { d: "M9 8V2", key: "14iosj" }]
];
const Plug = createLucideIcon("plug", __iconNode$J);
const __iconNode$I = [
  ["path", { d: "M5 12h14", key: "1ays0h" }],
  ["path", { d: "M12 5v14", key: "s699le" }]
];
const Plus = createLucideIcon("plus", __iconNode$I);
const __iconNode$H = [
  ["path", { d: "M16.247 7.761a6 6 0 0 1 0 8.478", key: "1fwjs5" }],
  ["path", { d: "M19.075 4.933a10 10 0 0 1 0 14.134", key: "ehdyv1" }],
  ["path", { d: "M4.925 19.067a10 10 0 0 1 0-14.134", key: "1q22gi" }],
  ["path", { d: "M7.753 16.239a6 6 0 0 1 0-8.478", key: "r2q7qm" }],
  ["circle", { cx: "12", cy: "12", r: "2", key: "1c9p78" }]
];
const Radio = createLucideIcon("radio", __iconNode$H);
const __iconNode$G = [
  ["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }],
  ["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
  ["path", { d: "M16 16h5v5", key: "ccwih5" }]
];
const RefreshCcw = createLucideIcon("refresh-ccw", __iconNode$G);
const __iconNode$F = [
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
];
const RefreshCw = createLucideIcon("refresh-cw", __iconNode$F);
const __iconNode$E = [
  [
    "path",
    {
      d: "M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",
      key: "m3kijz"
    }
  ],
  [
    "path",
    {
      d: "m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",
      key: "1fmvmk"
    }
  ],
  ["path", { d: "M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0", key: "1f8sc4" }],
  ["path", { d: "M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5", key: "qeys4" }]
];
const Rocket = createLucideIcon("rocket", __iconNode$E);
const __iconNode$D = [
  ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
  ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
];
const RotateCcw = createLucideIcon("rotate-ccw", __iconNode$D);
const __iconNode$C = [
  [
    "path",
    {
      d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
      key: "1c8476"
    }
  ],
  ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
  ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
];
const Save = createLucideIcon("save", __iconNode$C);
const __iconNode$B = [
  ["path", { d: "M12 3v18", key: "108xh3" }],
  ["path", { d: "m19 8 3 8a5 5 0 0 1-6 0zV7", key: "zcdpyk" }],
  ["path", { d: "M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1", key: "1yorad" }],
  ["path", { d: "m5 8 3 8a5 5 0 0 1-6 0zV7", key: "eua70x" }],
  ["path", { d: "M7 21h10", key: "1b0cd5" }]
];
const Scale = createLucideIcon("scale", __iconNode$B);
const __iconNode$A = [
  ["path", { d: "m8 11 2 2 4-4", key: "1sed1v" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
];
const SearchCheck = createLucideIcon("search-check", __iconNode$A);
const __iconNode$z = [
  ["path", { d: "m13.5 8.5-5 5", key: "1cs55j" }],
  ["path", { d: "m8.5 8.5 5 5", key: "a8mexj" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
  ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
];
const SearchX = createLucideIcon("search-x", __iconNode$z);
const __iconNode$y = [
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
];
const Search = createLucideIcon("search", __iconNode$y);
const __iconNode$x = [
  [
    "path",
    {
      d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
      key: "1ffxy3"
    }
  ],
  ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
];
const Send = createLucideIcon("send", __iconNode$x);
const __iconNode$w = [
  [
    "path",
    {
      d: "M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",
      key: "1i5ecw"
    }
  ],
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
];
const Settings = createLucideIcon("settings", __iconNode$w);
const __iconNode$v = [
  ["path", { d: "M14 17H5", key: "gfn3mx" }],
  ["path", { d: "M19 7h-9", key: "6i9tg" }],
  ["circle", { cx: "17", cy: "17", r: "3", key: "18b49y" }],
  ["circle", { cx: "7", cy: "7", r: "3", key: "dfmy0x" }]
];
const Settings2 = createLucideIcon("settings-2", __iconNode$v);
const __iconNode$u = [
  [
    "path",
    {
      d: "M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",
      key: "1bo67w"
    }
  ],
  ["rect", { x: "3", y: "14", width: "7", height: "7", rx: "1", key: "1bkyp8" }],
  ["circle", { cx: "17.5", cy: "17.5", r: "3.5", key: "w3z12y" }]
];
const Shapes = createLucideIcon("shapes", __iconNode$u);
const __iconNode$t = [
  ["circle", { cx: "18", cy: "5", r: "3", key: "gq8acd" }],
  ["circle", { cx: "6", cy: "12", r: "3", key: "w7nqdw" }],
  ["circle", { cx: "18", cy: "19", r: "3", key: "1xt0gg" }],
  ["line", { x1: "8.59", x2: "15.42", y1: "13.51", y2: "17.49", key: "47mynk" }],
  ["line", { x1: "15.41", x2: "8.59", y1: "6.51", y2: "10.49", key: "1n3mei" }]
];
const Share2 = createLucideIcon("share-2", __iconNode$t);
const __iconNode$s = [
  [
    "path",
    {
      d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
      key: "oel41y"
    }
  ],
  ["path", { d: "M12 8v4", key: "1got3b" }],
  ["path", { d: "M12 16h.01", key: "1drbdi" }]
];
const ShieldAlert = createLucideIcon("shield-alert", __iconNode$s);
const __iconNode$r = [
  [
    "path",
    {
      d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
      key: "oel41y"
    }
  ],
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
];
const ShieldCheck = createLucideIcon("shield-check", __iconNode$r);
const __iconNode$q = [
  [
    "path",
    {
      d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
      key: "oel41y"
    }
  ]
];
const Shield = createLucideIcon("shield", __iconNode$q);
const __iconNode$p = [
  ["path", { d: "m18 14 4 4-4 4", key: "10pe0f" }],
  ["path", { d: "m18 2 4 4-4 4", key: "pucp1d" }],
  ["path", { d: "M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22", key: "1ailkh" }],
  ["path", { d: "M2 6h1.972a4 4 0 0 1 3.6 2.2", key: "km57vx" }],
  ["path", { d: "M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45", key: "os18l9" }]
];
const Shuffle = createLucideIcon("shuffle", __iconNode$p);
const __iconNode$o = [
  ["path", { d: "M10 5H3", key: "1qgfaw" }],
  ["path", { d: "M12 19H3", key: "yhmn1j" }],
  ["path", { d: "M14 3v4", key: "1sua03" }],
  ["path", { d: "M16 17v4", key: "1q0r14" }],
  ["path", { d: "M21 12h-9", key: "1o4lsq" }],
  ["path", { d: "M21 19h-5", key: "1rlt1p" }],
  ["path", { d: "M21 5h-7", key: "1oszz2" }],
  ["path", { d: "M8 10v4", key: "tgpxqk" }],
  ["path", { d: "M8 12H3", key: "a7s4jb" }]
];
const SlidersHorizontal = createLucideIcon("sliders-horizontal", __iconNode$o);
const __iconNode$n = [
  [
    "path",
    {
      d: "M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",
      key: "1s2grr"
    }
  ],
  ["path", { d: "M20 2v4", key: "1rf3ol" }],
  ["path", { d: "M22 4h-4", key: "gwowj6" }],
  ["circle", { cx: "4", cy: "20", r: "2", key: "6kqj1y" }]
];
const Sparkles = createLucideIcon("sparkles", __iconNode$n);
const __iconNode$m = [
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }]
];
const Square = createLucideIcon("square", __iconNode$m);
const __iconNode$l = [
  [
    "path",
    {
      d: "M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",
      key: "r04s7s"
    }
  ]
];
const Star = createLucideIcon("star", __iconNode$l);
const __iconNode$k = [
  ["path", { d: "M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5", key: "slp6dd" }],
  [
    "path",
    {
      d: "M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",
      key: "o0xfot"
    }
  ],
  ["path", { d: "M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05", key: "wn3emo" }]
];
const Store = createLucideIcon("store", __iconNode$k);
const __iconNode$j = [
  [
    "path",
    {
      d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",
      key: "vktsd0"
    }
  ],
  ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }]
];
const Tag = createLucideIcon("tag", __iconNode$j);
const __iconNode$i = [
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
  ["circle", { cx: "12", cy: "12", r: "6", key: "1vlfrh" }],
  ["circle", { cx: "12", cy: "12", r: "2", key: "1c9p78" }]
];
const Target = createLucideIcon("target", __iconNode$i);
const __iconNode$h = [
  [
    "path",
    {
      d: "m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",
      key: "k4qptu"
    }
  ],
  ["path", { d: "m13.56 11.747 4.332-.924", key: "19l80z" }],
  ["path", { d: "m16 21-3.105-6.21", key: "7oh9d" }],
  [
    "path",
    {
      d: "M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",
      key: "m7xp4m"
    }
  ],
  ["path", { d: "m6.158 8.633 1.114 4.456", key: "74o979" }],
  ["path", { d: "m8 21 3.105-6.21", key: "1fvxut" }],
  ["circle", { cx: "12", cy: "13", r: "2", key: "1c1ljs" }]
];
const Telescope = createLucideIcon("telescope", __iconNode$h);
const __iconNode$g = [
  ["path", { d: "M12 19h8", key: "baeox8" }],
  ["path", { d: "m4 17 6-6-6-6", key: "1yngyt" }]
];
const Terminal = createLucideIcon("terminal", __iconNode$g);
const __iconNode$f = [
  ["line", { x1: "10", x2: "14", y1: "2", y2: "2", key: "14vaq8" }],
  ["line", { x1: "12", x2: "15", y1: "14", y2: "11", key: "17fdiu" }],
  ["circle", { cx: "12", cy: "14", r: "8", key: "1e1u0o" }]
];
const Timer = createLucideIcon("timer", __iconNode$f);
const __iconNode$e = [
  ["path", { d: "M10 11v6", key: "nco0om" }],
  ["path", { d: "M14 11v6", key: "outv1u" }],
  ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
  ["path", { d: "M3 6h18", key: "d0wm0j" }],
  ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
];
const Trash2 = createLucideIcon("trash-2", __iconNode$e);
const __iconNode$d = [
  ["path", { d: "M16 17h6v-6", key: "t6n2it" }],
  ["path", { d: "m22 17-8.5-8.5-5 5L2 7", key: "x473p" }]
];
const TrendingDown = createLucideIcon("trending-down", __iconNode$d);
const __iconNode$c = [
  ["path", { d: "M16 7h6v6", key: "box55l" }],
  ["path", { d: "m22 7-8.5 8.5-5-5L2 17", key: "1t1m79" }]
];
const TrendingUp = createLucideIcon("trending-up", __iconNode$c);
const __iconNode$b = [
  [
    "path",
    {
      d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
      key: "wmoenq"
    }
  ],
  ["path", { d: "M12 9v4", key: "juzpu7" }],
  ["path", { d: "M12 17h.01", key: "p32p05" }]
];
const TriangleAlert = createLucideIcon("triangle-alert", __iconNode$b);
const __iconNode$a = [
  ["path", { d: "M12 4v16", key: "1654pz" }],
  ["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
  ["path", { d: "M9 20h6", key: "s66wpe" }]
];
const Type = createLucideIcon("type", __iconNode$a);
const __iconNode$9 = [
  ["path", { d: "m19 5 3-3", key: "yk6iyv" }],
  ["path", { d: "m2 22 3-3", key: "19mgm9" }],
  [
    "path",
    { d: "M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z", key: "goz73y" }
  ],
  ["path", { d: "M7.5 13.5 10 11", key: "7xgeeb" }],
  ["path", { d: "M10.5 16.5 13 14", key: "10btkg" }],
  [
    "path",
    { d: "m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z", key: "1snsnr" }
  ]
];
const Unplug = createLucideIcon("unplug", __iconNode$9);
const __iconNode$8 = [
  ["path", { d: "m16 11 2 2 4-4", key: "9rsbq5" }],
  ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
  ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }]
];
const UserCheck = createLucideIcon("user-check", __iconNode$8);
const __iconNode$7 = [
  ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
  ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }],
  ["line", { x1: "19", x2: "19", y1: "8", y2: "14", key: "1bvyxn" }],
  ["line", { x1: "22", x2: "16", y1: "11", y2: "11", key: "1shjgl" }]
];
const UserPlus = createLucideIcon("user-plus", __iconNode$7);
const __iconNode$6 = [
  ["circle", { cx: "12", cy: "8", r: "5", key: "1hypcn" }],
  ["path", { d: "M20 21a8 8 0 0 0-16 0", key: "rfgkzh" }]
];
const UserRound = createLucideIcon("user-round", __iconNode$6);
const __iconNode$5 = [
  ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
  ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
];
const User = createLucideIcon("user", __iconNode$5);
const __iconNode$4 = [
  ["path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2", key: "1yyitq" }],
  ["path", { d: "M16 3.128a4 4 0 0 1 0 7.744", key: "16gr8j" }],
  ["path", { d: "M22 21v-2a4 4 0 0 0-3-3.87", key: "kshegd" }],
  ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }]
];
const Users = createLucideIcon("users", __iconNode$4);
const __iconNode$3 = [
  [
    "path",
    {
      d: "m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",
      key: "ul74o6"
    }
  ],
  ["path", { d: "m14 7 3 3", key: "1r5n42" }],
  ["path", { d: "M5 6v4", key: "ilb8ba" }],
  ["path", { d: "M19 14v4", key: "blhpug" }],
  ["path", { d: "M10 2v2", key: "7u0qdc" }],
  ["path", { d: "M7 8H3", key: "zfb6yr" }],
  ["path", { d: "M21 16h-4", key: "1cnmox" }],
  ["path", { d: "M11 3H9", key: "1obp7u" }]
];
const WandSparkles = createLucideIcon("wand-sparkles", __iconNode$3);
const __iconNode$2 = [
  [
    "path",
    {
      d: "M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",
      key: "q3hayz"
    }
  ],
  ["path", { d: "m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06", key: "1go1hn" }],
  ["path", { d: "m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8", key: "qlwsc0" }]
];
const Webhook = createLucideIcon("webhook", __iconNode$2);
const __iconNode$1 = [
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
];
const X = createLucideIcon("x", __iconNode$1);
const __iconNode = [
  [
    "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"
    }
  ]
];
const Zap = createLucideIcon("zap", __iconNode);
const FallbackComponent = ({ error, resetErrorBoundary }) => {
  console.error(error);
  const message = error instanceof Error ? error.message : "";
  const looksLikeConnection = /unauthor|forbidden|\b401\b|\b403\b|license|activation|workspace/i.test(message);
  return /* @__PURE__ */ window.wp.element.createElement(
    "main",
    {
      "data-testid": "app-error-boundary",
      className: "grid min-h-[60vh] place-items-center px-4 py-12"
    },
    /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "w-full max-w-md p-8! text-center shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-red-100 dark:bg-red-950/30" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { className: "h-7 w-7 text-red-500 dark:text-red-400" })), /* @__PURE__ */ window.wp.element.createElement("h1", { className: "mt-5! mb-0! text-xl font-semibold tracking-tight text-neutral-900 dark:text-white" }, looksLikeConnection ? window.wp.i18n.__("This site's connection needs attention", "structura") : window.wp.i18n.__("Unexpected error occurred", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-sm leading-relaxed break-words text-neutral-500 dark:text-neutral-400" }, looksLikeConnection ? window.wp.i18n.__(
      "Structura Cloud couldn't authenticate this site — its connection may have been removed or reset. Open Account settings to reconnect, or disconnect and start fresh.",
      "structura"
    ) : error instanceof Error ? error.message : window.wp.i18n.__("Something went wrong, sorry.", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-6 flex flex-wrap items-center justify-center gap-3" }, looksLikeConnection && /* @__PURE__ */ window.wp.element.createElement(tr$1, { href: "#/account" }, window.wp.i18n.__("Account settings", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        onClick: resetErrorBoundary,
        variant: looksLikeConnection ? "secondary" : "primary"
      },
      window.wp.i18n.__("Try again", "structura")
    ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { href: "https://www.structurawp.com/support/", target: "_blank", variant: "transparent" }, window.wp.i18n.__("Contact support", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { "aria-hidden": "true", className: "ml-2 h-4 w-4" }))))
  );
};
const AppErrorBoundary = ({ children, resetOnNavigation = false }) => {
  return resetOnNavigation ? /* @__PURE__ */ window.wp.element.createElement(RouteAwareBoundary, null, children) : /* @__PURE__ */ window.wp.element.createElement(m$5, { FallbackComponent }, children);
};
const RouteAwareBoundary = ({ children }) => {
  const location = useLocation();
  const resetKeys = [location.pathname];
  return /* @__PURE__ */ window.wp.element.createElement(m$5, { FallbackComponent, resetKeys }, children);
};
var Subscribable = class {
  constructor() {
    this.listeners = /* @__PURE__ */ new Set();
    this.subscribe = this.subscribe.bind(this);
  }
  subscribe(listener) {
    this.listeners.add(listener);
    this.onSubscribe();
    return () => {
      this.listeners.delete(listener);
      this.onUnsubscribe();
    };
  }
  hasListeners() {
    return this.listeners.size > 0;
  }
  onSubscribe() {
  }
  onUnsubscribe() {
  }
};
var FocusManager = class extends Subscribable {
  #focused;
  #cleanup;
  #setup;
  constructor() {
    super();
    this.#setup = (onFocus) => {
      if (typeof window !== "undefined" && window.addEventListener) {
        const listener = () => onFocus();
        window.addEventListener("visibilitychange", listener, false);
        return () => {
          window.removeEventListener("visibilitychange", listener);
        };
      }
      return;
    };
  }
  onSubscribe() {
    if (!this.#cleanup) {
      this.setEventListener(this.#setup);
    }
  }
  onUnsubscribe() {
    if (!this.hasListeners()) {
      this.#cleanup?.();
      this.#cleanup = void 0;
    }
  }
  setEventListener(setup) {
    this.#setup = setup;
    this.#cleanup?.();
    this.#cleanup = setup((focused) => {
      if (typeof focused === "boolean") {
        this.setFocused(focused);
      } else {
        this.onFocus();
      }
    });
  }
  setFocused(focused) {
    const changed = this.#focused !== focused;
    if (changed) {
      this.#focused = focused;
      this.onFocus();
    }
  }
  onFocus() {
    const isFocused = this.isFocused();
    this.listeners.forEach((listener) => {
      listener(isFocused);
    });
  }
  isFocused() {
    if (typeof this.#focused === "boolean") {
      return this.#focused;
    }
    return globalThis.document?.visibilityState !== "hidden";
  }
};
var focusManager = new FocusManager();
var defaultTimeoutProvider = {
  // We need the wrapper function syntax below instead of direct references to
  // global setTimeout etc.
  //
  // BAD: `setTimeout: setTimeout`
  // GOOD: `setTimeout: (cb, delay) => setTimeout(cb, delay)`
  //
  // If we use direct references here, then anything that wants to spy on or
  // replace the global setTimeout (like tests) won't work since we'll already
  // have a hard reference to the original implementation at the time when this
  // file was imported.
  setTimeout: (callback, delay) => setTimeout(callback, delay),
  clearTimeout: (timeoutId) => clearTimeout(timeoutId),
  setInterval: (callback, delay) => setInterval(callback, delay),
  clearInterval: (intervalId) => clearInterval(intervalId)
};
var TimeoutManager = class {
  // We cannot have TimeoutManager<T> as we must instantiate it with a concrete
  // type at app boot; and if we leave that type, then any new timer provider
  // would need to support the default provider's concrete timer ID, which is
  // infeasible across environments.
  //
  // We settle for type safety for the TimeoutProvider type, and accept that
  // this class is unsafe internally to allow for extension.
  #provider = defaultTimeoutProvider;
  #providerCalled = false;
  setTimeoutProvider(provider) {
    this.#provider = provider;
  }
  setTimeout(callback, delay) {
    return this.#provider.setTimeout(callback, delay);
  }
  clearTimeout(timeoutId) {
    this.#provider.clearTimeout(timeoutId);
  }
  setInterval(callback, delay) {
    return this.#provider.setInterval(callback, delay);
  }
  clearInterval(intervalId) {
    this.#provider.clearInterval(intervalId);
  }
};
var timeoutManager = new TimeoutManager();
function systemSetTimeoutZero(callback) {
  setTimeout(callback, 0);
}
var isServer = typeof window === "undefined" || "Deno" in globalThis;
function noop2() {
}
function functionalUpdate(updater, input) {
  return typeof updater === "function" ? updater(input) : updater;
}
function isValidTimeout(value) {
  return typeof value === "number" && value >= 0 && value !== Infinity;
}
function timeUntilStale(updatedAt, staleTime) {
  return Math.max(updatedAt + (staleTime || 0) - Date.now(), 0);
}
function resolveStaleTime(staleTime, query) {
  return typeof staleTime === "function" ? staleTime(query) : staleTime;
}
function resolveEnabled(enabled, query) {
  return typeof enabled === "function" ? enabled(query) : enabled;
}
function matchQuery(filters, query) {
  const {
    type = "all",
    exact,
    fetchStatus,
    predicate,
    queryKey,
    stale
  } = filters;
  if (queryKey) {
    if (exact) {
      if (query.queryHash !== hashQueryKeyByOptions(queryKey, query.options)) {
        return false;
      }
    } else if (!partialMatchKey(query.queryKey, queryKey)) {
      return false;
    }
  }
  if (type !== "all") {
    const isActive = query.isActive();
    if (type === "active" && !isActive) {
      return false;
    }
    if (type === "inactive" && isActive) {
      return false;
    }
  }
  if (typeof stale === "boolean" && query.isStale() !== stale) {
    return false;
  }
  if (fetchStatus && fetchStatus !== query.state.fetchStatus) {
    return false;
  }
  if (predicate && !predicate(query)) {
    return false;
  }
  return true;
}
function matchMutation(filters, mutation) {
  const { exact, status, predicate, mutationKey } = filters;
  if (mutationKey) {
    if (!mutation.options.mutationKey) {
      return false;
    }
    if (exact) {
      if (hashKey(mutation.options.mutationKey) !== hashKey(mutationKey)) {
        return false;
      }
    } else if (!partialMatchKey(mutation.options.mutationKey, mutationKey)) {
      return false;
    }
  }
  if (status && mutation.state.status !== status) {
    return false;
  }
  if (predicate && !predicate(mutation)) {
    return false;
  }
  return true;
}
function hashQueryKeyByOptions(queryKey, options) {
  const hashFn = options?.queryKeyHashFn || hashKey;
  return hashFn(queryKey);
}
function hashKey(queryKey) {
  return JSON.stringify(
    queryKey,
    (_2, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
      result[key] = val[key];
      return result;
    }, {}) : val
  );
}
function partialMatchKey(a3, b2) {
  if (a3 === b2) {
    return true;
  }
  if (typeof a3 !== typeof b2) {
    return false;
  }
  if (a3 && b2 && typeof a3 === "object" && typeof b2 === "object") {
    return Object.keys(b2).every((key) => partialMatchKey(a3[key], b2[key]));
  }
  return false;
}
var hasOwn = Object.prototype.hasOwnProperty;
function replaceEqualDeep(a3, b2, depth = 0) {
  if (a3 === b2) {
    return a3;
  }
  if (depth > 500) return b2;
  const array = isPlainArray(a3) && isPlainArray(b2);
  if (!array && !(isPlainObject(a3) && isPlainObject(b2))) return b2;
  const aItems = array ? a3 : Object.keys(a3);
  const aSize = aItems.length;
  const bItems = array ? b2 : Object.keys(b2);
  const bSize = bItems.length;
  const copy = array ? new Array(bSize) : {};
  let equalItems = 0;
  for (let i2 = 0; i2 < bSize; i2++) {
    const key = array ? i2 : bItems[i2];
    const aItem = a3[key];
    const bItem = b2[key];
    if (aItem === bItem) {
      copy[key] = aItem;
      if (array ? i2 < aSize : hasOwn.call(a3, key)) equalItems++;
      continue;
    }
    if (aItem === null || bItem === null || typeof aItem !== "object" || typeof bItem !== "object") {
      copy[key] = bItem;
      continue;
    }
    const v2 = replaceEqualDeep(aItem, bItem, depth + 1);
    copy[key] = v2;
    if (v2 === aItem) equalItems++;
  }
  return aSize === bSize && equalItems === aSize ? a3 : copy;
}
function shallowEqualObjects(a3, b2) {
  if (!b2 || Object.keys(a3).length !== Object.keys(b2).length) {
    return false;
  }
  for (const key in a3) {
    if (a3[key] !== b2[key]) {
      return false;
    }
  }
  return true;
}
function isPlainArray(value) {
  return Array.isArray(value) && value.length === Object.keys(value).length;
}
function isPlainObject(o4) {
  if (!hasObjectPrototype(o4)) {
    return false;
  }
  const ctor = o4.constructor;
  if (ctor === void 0) {
    return true;
  }
  const prot = ctor.prototype;
  if (!hasObjectPrototype(prot)) {
    return false;
  }
  if (!prot.hasOwnProperty("isPrototypeOf")) {
    return false;
  }
  if (Object.getPrototypeOf(o4) !== Object.prototype) {
    return false;
  }
  return true;
}
function hasObjectPrototype(o4) {
  return Object.prototype.toString.call(o4) === "[object Object]";
}
function sleep(timeout) {
  return new Promise((resolve) => {
    timeoutManager.setTimeout(resolve, timeout);
  });
}
function replaceData(prevData, data, options) {
  if (typeof options.structuralSharing === "function") {
    return options.structuralSharing(prevData, data);
  } else if (options.structuralSharing !== false) {
    return replaceEqualDeep(prevData, data);
  }
  return data;
}
function keepPreviousData(previousData) {
  return previousData;
}
function addToEnd(items, item, max2 = 0) {
  const newItems = [...items, item];
  return max2 && newItems.length > max2 ? newItems.slice(1) : newItems;
}
function addToStart(items, item, max2 = 0) {
  const newItems = [item, ...items];
  return max2 && newItems.length > max2 ? newItems.slice(0, -1) : newItems;
}
var skipToken = /* @__PURE__ */ Symbol();
function ensureQueryFn(options, fetchOptions) {
  if (!options.queryFn && fetchOptions?.initialPromise) {
    return () => fetchOptions.initialPromise;
  }
  if (!options.queryFn || options.queryFn === skipToken) {
    return () => Promise.reject(new Error(`Missing queryFn: '${options.queryHash}'`));
  }
  return options.queryFn;
}
function shouldThrowError(throwOnError, params) {
  if (typeof throwOnError === "function") {
    return throwOnError(...params);
  }
  return !!throwOnError;
}
function addConsumeAwareSignal(object, getSignal, onCancelled) {
  let consumed = false;
  let signal;
  Object.defineProperty(object, "signal", {
    enumerable: true,
    get: () => {
      signal ??= getSignal();
      if (consumed) {
        return signal;
      }
      consumed = true;
      if (signal.aborted) {
        onCancelled();
      } else {
        signal.addEventListener("abort", onCancelled, { once: true });
      }
      return signal;
    }
  });
  return object;
}
var environmentManager = /* @__PURE__ */ (() => {
  let isServerFn = () => isServer;
  return {
    /**
     * Returns whether the current runtime should be treated as a server environment.
     */
    isServer() {
      return isServerFn();
    },
    /**
     * Overrides the server check globally.
     */
    setIsServer(isServerValue) {
      isServerFn = isServerValue;
    }
  };
})();
function pendingThenable() {
  let resolve;
  let reject;
  const thenable = new Promise((_resolve, _reject) => {
    resolve = _resolve;
    reject = _reject;
  });
  thenable.status = "pending";
  thenable.catch(() => {
  });
  function finalize(data) {
    Object.assign(thenable, data);
    delete thenable.resolve;
    delete thenable.reject;
  }
  thenable.resolve = (value) => {
    finalize({
      status: "fulfilled",
      value
    });
    resolve(value);
  };
  thenable.reject = (reason) => {
    finalize({
      status: "rejected",
      reason
    });
    reject(reason);
  };
  return thenable;
}
var defaultScheduler = systemSetTimeoutZero;
function createNotifyManager() {
  let queue = [];
  let transactions = 0;
  let notifyFn = (callback) => {
    callback();
  };
  let batchNotifyFn = (callback) => {
    callback();
  };
  let scheduleFn = defaultScheduler;
  const schedule = (callback) => {
    if (transactions) {
      queue.push(callback);
    } else {
      scheduleFn(() => {
        notifyFn(callback);
      });
    }
  };
  const flush = () => {
    const originalQueue = queue;
    queue = [];
    if (originalQueue.length) {
      scheduleFn(() => {
        batchNotifyFn(() => {
          originalQueue.forEach((callback) => {
            notifyFn(callback);
          });
        });
      });
    }
  };
  return {
    batch: (callback) => {
      let result;
      transactions++;
      try {
        result = callback();
      } finally {
        transactions--;
        if (!transactions) {
          flush();
        }
      }
      return result;
    },
    /**
     * All calls to the wrapped function will be batched.
     */
    batchCalls: (callback) => {
      return (...args) => {
        schedule(() => {
          callback(...args);
        });
      };
    },
    schedule,
    /**
     * Use this method to set a custom notify function.
     * This can be used to for example wrap notifications with `React.act` while running tests.
     */
    setNotifyFunction: (fn) => {
      notifyFn = fn;
    },
    /**
     * Use this method to set a custom function to batch notifications together into a single tick.
     * By default React Query will use the batch function provided by ReactDOM or React Native.
     */
    setBatchNotifyFunction: (fn) => {
      batchNotifyFn = fn;
    },
    setScheduler: (fn) => {
      scheduleFn = fn;
    }
  };
}
var notifyManager = createNotifyManager();
var OnlineManager = class extends Subscribable {
  #online = true;
  #cleanup;
  #setup;
  constructor() {
    super();
    this.#setup = (onOnline) => {
      if (typeof window !== "undefined" && window.addEventListener) {
        const onlineListener = () => onOnline(true);
        const offlineListener = () => onOnline(false);
        window.addEventListener("online", onlineListener, false);
        window.addEventListener("offline", offlineListener, false);
        return () => {
          window.removeEventListener("online", onlineListener);
          window.removeEventListener("offline", offlineListener);
        };
      }
      return;
    };
  }
  onSubscribe() {
    if (!this.#cleanup) {
      this.setEventListener(this.#setup);
    }
  }
  onUnsubscribe() {
    if (!this.hasListeners()) {
      this.#cleanup?.();
      this.#cleanup = void 0;
    }
  }
  setEventListener(setup) {
    this.#setup = setup;
    this.#cleanup?.();
    this.#cleanup = setup(this.setOnline.bind(this));
  }
  setOnline(online) {
    const changed = this.#online !== online;
    if (changed) {
      this.#online = online;
      this.listeners.forEach((listener) => {
        listener(online);
      });
    }
  }
  isOnline() {
    return this.#online;
  }
};
var onlineManager = new OnlineManager();
function defaultRetryDelay(failureCount) {
  return Math.min(1e3 * 2 ** failureCount, 3e4);
}
function canFetch(networkMode) {
  return (networkMode ?? "online") === "online" ? onlineManager.isOnline() : true;
}
var CancelledError = class extends Error {
  constructor(options) {
    super("CancelledError");
    this.revert = options?.revert;
    this.silent = options?.silent;
  }
};
function createRetryer(config) {
  let isRetryCancelled = false;
  let failureCount = 0;
  let continueFn;
  const thenable = pendingThenable();
  const isResolved = () => thenable.status !== "pending";
  const cancel = (cancelOptions) => {
    if (!isResolved()) {
      const error = new CancelledError(cancelOptions);
      reject(error);
      config.onCancel?.(error);
    }
  };
  const cancelRetry = () => {
    isRetryCancelled = true;
  };
  const continueRetry = () => {
    isRetryCancelled = false;
  };
  const canContinue = () => focusManager.isFocused() && (config.networkMode === "always" || onlineManager.isOnline()) && config.canRun();
  const canStart = () => canFetch(config.networkMode) && config.canRun();
  const resolve = (value) => {
    if (!isResolved()) {
      continueFn?.();
      thenable.resolve(value);
    }
  };
  const reject = (value) => {
    if (!isResolved()) {
      continueFn?.();
      thenable.reject(value);
    }
  };
  const pause = () => {
    return new Promise((continueResolve) => {
      continueFn = (value) => {
        if (isResolved() || canContinue()) {
          continueResolve(value);
        }
      };
      config.onPause?.();
    }).then(() => {
      continueFn = void 0;
      if (!isResolved()) {
        config.onContinue?.();
      }
    });
  };
  const run = () => {
    if (isResolved()) {
      return;
    }
    let promiseOrValue;
    const initialPromise = failureCount === 0 ? config.initialPromise : void 0;
    try {
      promiseOrValue = initialPromise ?? config.fn();
    } catch (error) {
      promiseOrValue = Promise.reject(error);
    }
    Promise.resolve(promiseOrValue).then(resolve).catch((error) => {
      if (isResolved()) {
        return;
      }
      const retry = config.retry ?? (environmentManager.isServer() ? 0 : 3);
      const retryDelay = config.retryDelay ?? defaultRetryDelay;
      const delay = typeof retryDelay === "function" ? retryDelay(failureCount, error) : retryDelay;
      const shouldRetry = retry === true || typeof retry === "number" && failureCount < retry || typeof retry === "function" && retry(failureCount, error);
      if (isRetryCancelled || !shouldRetry) {
        reject(error);
        return;
      }
      failureCount++;
      config.onFail?.(failureCount, error);
      sleep(delay).then(() => {
        return canContinue() ? void 0 : pause();
      }).then(() => {
        if (isRetryCancelled) {
          reject(error);
        } else {
          run();
        }
      });
    });
  };
  return {
    promise: thenable,
    status: () => thenable.status,
    cancel,
    continue: () => {
      continueFn?.();
      return thenable;
    },
    cancelRetry,
    continueRetry,
    canStart,
    start: () => {
      if (canStart()) {
        run();
      } else {
        pause().then(run);
      }
      return thenable;
    }
  };
}
var Removable = class {
  #gcTimeout;
  destroy() {
    this.clearGcTimeout();
  }
  scheduleGc() {
    this.clearGcTimeout();
    if (isValidTimeout(this.gcTime)) {
      this.#gcTimeout = timeoutManager.setTimeout(() => {
        this.optionalRemove();
      }, this.gcTime);
    }
  }
  updateGcTime(newGcTime) {
    this.gcTime = Math.max(
      this.gcTime || 0,
      newGcTime ?? (environmentManager.isServer() ? Infinity : 5 * 60 * 1e3)
    );
  }
  clearGcTimeout() {
    if (this.#gcTimeout !== void 0) {
      timeoutManager.clearTimeout(this.#gcTimeout);
      this.#gcTimeout = void 0;
    }
  }
};
var Query = class extends Removable {
  #initialState;
  #revertState;
  #cache;
  #client;
  #retryer;
  #defaultOptions;
  #abortSignalConsumed;
  constructor(config) {
    super();
    this.#abortSignalConsumed = false;
    this.#defaultOptions = config.defaultOptions;
    this.setOptions(config.options);
    this.observers = [];
    this.#client = config.client;
    this.#cache = this.#client.getQueryCache();
    this.queryKey = config.queryKey;
    this.queryHash = config.queryHash;
    this.#initialState = getDefaultState$1(this.options);
    this.state = config.state ?? this.#initialState;
    this.scheduleGc();
  }
  get meta() {
    return this.options.meta;
  }
  get promise() {
    return this.#retryer?.promise;
  }
  setOptions(options) {
    this.options = { ...this.#defaultOptions, ...options };
    this.updateGcTime(this.options.gcTime);
    if (this.state && this.state.data === void 0) {
      const defaultState = getDefaultState$1(this.options);
      if (defaultState.data !== void 0) {
        this.setState(
          successState(defaultState.data, defaultState.dataUpdatedAt)
        );
        this.#initialState = defaultState;
      }
    }
  }
  optionalRemove() {
    if (!this.observers.length && this.state.fetchStatus === "idle") {
      this.#cache.remove(this);
    }
  }
  setData(newData, options) {
    const data = replaceData(this.state.data, newData, this.options);
    this.#dispatch({
      data,
      type: "success",
      dataUpdatedAt: options?.updatedAt,
      manual: options?.manual
    });
    return data;
  }
  setState(state, setStateOptions) {
    this.#dispatch({ type: "setState", state, setStateOptions });
  }
  cancel(options) {
    const promise = this.#retryer?.promise;
    this.#retryer?.cancel(options);
    return promise ? promise.then(noop2).catch(noop2) : Promise.resolve();
  }
  destroy() {
    super.destroy();
    this.cancel({ silent: true });
  }
  get resetState() {
    return this.#initialState;
  }
  reset() {
    this.destroy();
    this.setState(this.resetState);
  }
  isActive() {
    return this.observers.some(
      (observer) => resolveEnabled(observer.options.enabled, this) !== false
    );
  }
  isDisabled() {
    if (this.getObserversCount() > 0) {
      return !this.isActive();
    }
    return this.options.queryFn === skipToken || !this.isFetched();
  }
  isFetched() {
    return this.state.dataUpdateCount + this.state.errorUpdateCount > 0;
  }
  isStatic() {
    if (this.getObserversCount() > 0) {
      return this.observers.some(
        (observer) => resolveStaleTime(observer.options.staleTime, this) === "static"
      );
    }
    return false;
  }
  isStale() {
    if (this.getObserversCount() > 0) {
      return this.observers.some(
        (observer) => observer.getCurrentResult().isStale
      );
    }
    return this.state.data === void 0 || this.state.isInvalidated;
  }
  isStaleByTime(staleTime = 0) {
    if (this.state.data === void 0) {
      return true;
    }
    if (staleTime === "static") {
      return false;
    }
    if (this.state.isInvalidated) {
      return true;
    }
    return !timeUntilStale(this.state.dataUpdatedAt, staleTime);
  }
  onFocus() {
    const observer = this.observers.find((x2) => x2.shouldFetchOnWindowFocus());
    observer?.refetch({ cancelRefetch: false });
    this.#retryer?.continue();
  }
  onOnline() {
    const observer = this.observers.find((x2) => x2.shouldFetchOnReconnect());
    observer?.refetch({ cancelRefetch: false });
    this.#retryer?.continue();
  }
  addObserver(observer) {
    if (!this.observers.includes(observer)) {
      this.observers.push(observer);
      this.clearGcTimeout();
      this.#cache.notify({ type: "observerAdded", query: this, observer });
    }
  }
  removeObserver(observer) {
    if (this.observers.includes(observer)) {
      this.observers = this.observers.filter((x2) => x2 !== observer);
      if (!this.observers.length) {
        if (this.#retryer) {
          if (this.#abortSignalConsumed || this.#isInitialPausedFetch()) {
            this.#retryer.cancel({ revert: true });
          } else {
            this.#retryer.cancelRetry();
          }
        }
        this.scheduleGc();
      }
      this.#cache.notify({ type: "observerRemoved", query: this, observer });
    }
  }
  getObserversCount() {
    return this.observers.length;
  }
  #isInitialPausedFetch() {
    return this.state.fetchStatus === "paused" && this.state.status === "pending";
  }
  invalidate() {
    if (!this.state.isInvalidated) {
      this.#dispatch({ type: "invalidate" });
    }
  }
  async fetch(options, fetchOptions) {
    if (this.state.fetchStatus !== "idle" && // If the promise in the retryer is already rejected, we have to definitely
    // re-start the fetch; there is a chance that the query is still in a
    // pending state when that happens
    this.#retryer?.status() !== "rejected") {
      if (this.state.data !== void 0 && fetchOptions?.cancelRefetch) {
        this.cancel({ silent: true });
      } else if (this.#retryer) {
        this.#retryer.continueRetry();
        return this.#retryer.promise;
      }
    }
    if (options) {
      this.setOptions(options);
    }
    if (!this.options.queryFn) {
      const observer = this.observers.find((x2) => x2.options.queryFn);
      if (observer) {
        this.setOptions(observer.options);
      }
    }
    const abortController = new AbortController();
    const addSignalProperty = (object) => {
      Object.defineProperty(object, "signal", {
        enumerable: true,
        get: () => {
          this.#abortSignalConsumed = true;
          return abortController.signal;
        }
      });
    };
    const fetchFn = () => {
      const queryFn = ensureQueryFn(this.options, fetchOptions);
      const createQueryFnContext = () => {
        const queryFnContext2 = {
          client: this.#client,
          queryKey: this.queryKey,
          meta: this.meta
        };
        addSignalProperty(queryFnContext2);
        return queryFnContext2;
      };
      const queryFnContext = createQueryFnContext();
      this.#abortSignalConsumed = false;
      if (this.options.persister) {
        return this.options.persister(
          queryFn,
          queryFnContext,
          this
        );
      }
      return queryFn(queryFnContext);
    };
    const createFetchContext = () => {
      const context2 = {
        fetchOptions,
        options: this.options,
        queryKey: this.queryKey,
        client: this.#client,
        state: this.state,
        fetchFn
      };
      addSignalProperty(context2);
      return context2;
    };
    const context = createFetchContext();
    this.options.behavior?.onFetch(context, this);
    this.#revertState = this.state;
    if (this.state.fetchStatus === "idle" || this.state.fetchMeta !== context.fetchOptions?.meta) {
      this.#dispatch({ type: "fetch", meta: context.fetchOptions?.meta });
    }
    this.#retryer = createRetryer({
      initialPromise: fetchOptions?.initialPromise,
      fn: context.fetchFn,
      onCancel: (error) => {
        if (error instanceof CancelledError && error.revert) {
          this.setState({
            ...this.#revertState,
            fetchStatus: "idle"
          });
        }
        abortController.abort();
      },
      onFail: (failureCount, error) => {
        this.#dispatch({ type: "failed", failureCount, error });
      },
      onPause: () => {
        this.#dispatch({ type: "pause" });
      },
      onContinue: () => {
        this.#dispatch({ type: "continue" });
      },
      retry: context.options.retry,
      retryDelay: context.options.retryDelay,
      networkMode: context.options.networkMode,
      canRun: () => true
    });
    try {
      const data = await this.#retryer.start();
      if (data === void 0) {
        if (false) ;
        throw new Error(`${this.queryHash} data is undefined`);
      }
      this.setData(data);
      this.#cache.config.onSuccess?.(data, this);
      this.#cache.config.onSettled?.(
        data,
        this.state.error,
        this
      );
      return data;
    } catch (error) {
      if (error instanceof CancelledError) {
        if (error.silent) {
          return this.#retryer.promise;
        } else if (error.revert) {
          if (this.state.data === void 0) {
            throw error;
          }
          return this.state.data;
        }
      }
      this.#dispatch({
        type: "error",
        error
      });
      this.#cache.config.onError?.(
        error,
        this
      );
      this.#cache.config.onSettled?.(
        this.state.data,
        error,
        this
      );
      throw error;
    } finally {
      this.scheduleGc();
    }
  }
  #dispatch(action) {
    const reducer = (state) => {
      switch (action.type) {
        case "failed":
          return {
            ...state,
            fetchFailureCount: action.failureCount,
            fetchFailureReason: action.error
          };
        case "pause":
          return {
            ...state,
            fetchStatus: "paused"
          };
        case "continue":
          return {
            ...state,
            fetchStatus: "fetching"
          };
        case "fetch":
          return {
            ...state,
            ...fetchState(state.data, this.options),
            fetchMeta: action.meta ?? null
          };
        case "success":
          const newState = {
            ...state,
            ...successState(action.data, action.dataUpdatedAt),
            dataUpdateCount: state.dataUpdateCount + 1,
            ...!action.manual && {
              fetchStatus: "idle",
              fetchFailureCount: 0,
              fetchFailureReason: null
            }
          };
          this.#revertState = action.manual ? newState : void 0;
          return newState;
        case "error":
          const error = action.error;
          return {
            ...state,
            error,
            errorUpdateCount: state.errorUpdateCount + 1,
            errorUpdatedAt: Date.now(),
            fetchFailureCount: state.fetchFailureCount + 1,
            fetchFailureReason: error,
            fetchStatus: "idle",
            status: "error",
            // flag existing data as invalidated if we get a background error
            // note that "no data" always means stale so we can set unconditionally here
            isInvalidated: true
          };
        case "invalidate":
          return {
            ...state,
            isInvalidated: true
          };
        case "setState":
          return {
            ...state,
            ...action.state
          };
      }
    };
    this.state = reducer(this.state);
    notifyManager.batch(() => {
      this.observers.forEach((observer) => {
        observer.onQueryUpdate();
      });
      this.#cache.notify({ query: this, type: "updated", action });
    });
  }
};
function fetchState(data, options) {
  return {
    fetchFailureCount: 0,
    fetchFailureReason: null,
    fetchStatus: canFetch(options.networkMode) ? "fetching" : "paused",
    ...data === void 0 && {
      error: null,
      status: "pending"
    }
  };
}
function successState(data, dataUpdatedAt) {
  return {
    data,
    dataUpdatedAt: dataUpdatedAt ?? Date.now(),
    error: null,
    isInvalidated: false,
    status: "success"
  };
}
function getDefaultState$1(options) {
  const data = typeof options.initialData === "function" ? options.initialData() : options.initialData;
  const hasData = data !== void 0;
  const initialDataUpdatedAt = hasData ? typeof options.initialDataUpdatedAt === "function" ? options.initialDataUpdatedAt() : options.initialDataUpdatedAt : 0;
  return {
    data,
    dataUpdateCount: 0,
    dataUpdatedAt: hasData ? initialDataUpdatedAt ?? Date.now() : 0,
    error: null,
    errorUpdateCount: 0,
    errorUpdatedAt: 0,
    fetchFailureCount: 0,
    fetchFailureReason: null,
    fetchMeta: null,
    isInvalidated: false,
    status: hasData ? "success" : "pending",
    fetchStatus: "idle"
  };
}
var QueryObserver = class extends Subscribable {
  constructor(client, options) {
    super();
    this.options = options;
    this.#client = client;
    this.#selectError = null;
    this.#currentThenable = pendingThenable();
    this.bindMethods();
    this.setOptions(options);
  }
  #client;
  #currentQuery = void 0;
  #currentQueryInitialState = void 0;
  #currentResult = void 0;
  #currentResultState;
  #currentResultOptions;
  #currentThenable;
  #selectError;
  #selectFn;
  #selectResult;
  // This property keeps track of the last query with defined data.
  // It will be used to pass the previous data and query to the placeholder function between renders.
  #lastQueryWithDefinedData;
  #staleTimeoutId;
  #refetchIntervalId;
  #currentRefetchInterval;
  #trackedProps = /* @__PURE__ */ new Set();
  bindMethods() {
    this.refetch = this.refetch.bind(this);
  }
  onSubscribe() {
    if (this.listeners.size === 1) {
      this.#currentQuery.addObserver(this);
      if (shouldFetchOnMount(this.#currentQuery, this.options)) {
        this.#executeFetch();
      } else {
        this.updateResult();
      }
      this.#updateTimers();
    }
  }
  onUnsubscribe() {
    if (!this.hasListeners()) {
      this.destroy();
    }
  }
  shouldFetchOnReconnect() {
    return shouldFetchOn(
      this.#currentQuery,
      this.options,
      this.options.refetchOnReconnect
    );
  }
  shouldFetchOnWindowFocus() {
    return shouldFetchOn(
      this.#currentQuery,
      this.options,
      this.options.refetchOnWindowFocus
    );
  }
  destroy() {
    this.listeners = /* @__PURE__ */ new Set();
    this.#clearStaleTimeout();
    this.#clearRefetchInterval();
    this.#currentQuery.removeObserver(this);
  }
  setOptions(options) {
    const prevOptions = this.options;
    const prevQuery = this.#currentQuery;
    this.options = this.#client.defaultQueryOptions(options);
    if (this.options.enabled !== void 0 && typeof this.options.enabled !== "boolean" && typeof this.options.enabled !== "function" && typeof resolveEnabled(this.options.enabled, this.#currentQuery) !== "boolean") {
      throw new Error(
        "Expected enabled to be a boolean or a callback that returns a boolean"
      );
    }
    this.#updateQuery();
    this.#currentQuery.setOptions(this.options);
    if (prevOptions._defaulted && !shallowEqualObjects(this.options, prevOptions)) {
      this.#client.getQueryCache().notify({
        type: "observerOptionsUpdated",
        query: this.#currentQuery,
        observer: this
      });
    }
    const mounted = this.hasListeners();
    if (mounted && shouldFetchOptionally(
      this.#currentQuery,
      prevQuery,
      this.options,
      prevOptions
    )) {
      this.#executeFetch();
    }
    this.updateResult();
    if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || resolveStaleTime(this.options.staleTime, this.#currentQuery) !== resolveStaleTime(prevOptions.staleTime, this.#currentQuery))) {
      this.#updateStaleTimeout();
    }
    const nextRefetchInterval = this.#computeRefetchInterval();
    if (mounted && (this.#currentQuery !== prevQuery || resolveEnabled(this.options.enabled, this.#currentQuery) !== resolveEnabled(prevOptions.enabled, this.#currentQuery) || nextRefetchInterval !== this.#currentRefetchInterval)) {
      this.#updateRefetchInterval(nextRefetchInterval);
    }
  }
  getOptimisticResult(options) {
    const query = this.#client.getQueryCache().build(this.#client, options);
    const result = this.createResult(query, options);
    if (shouldAssignObserverCurrentProperties(this, result)) {
      this.#currentResult = result;
      this.#currentResultOptions = this.options;
      this.#currentResultState = this.#currentQuery.state;
    }
    return result;
  }
  getCurrentResult() {
    return this.#currentResult;
  }
  trackResult(result, onPropTracked) {
    return new Proxy(result, {
      get: (target, key) => {
        this.trackProp(key);
        onPropTracked?.(key);
        if (key === "promise") {
          this.trackProp("data");
          if (!this.options.experimental_prefetchInRender && this.#currentThenable.status === "pending") {
            this.#currentThenable.reject(
              new Error(
                "experimental_prefetchInRender feature flag is not enabled"
              )
            );
          }
        }
        return Reflect.get(target, key);
      }
    });
  }
  trackProp(key) {
    this.#trackedProps.add(key);
  }
  getCurrentQuery() {
    return this.#currentQuery;
  }
  refetch({ ...options } = {}) {
    return this.fetch({
      ...options
    });
  }
  fetchOptimistic(options) {
    const defaultedOptions = this.#client.defaultQueryOptions(options);
    const query = this.#client.getQueryCache().build(this.#client, defaultedOptions);
    return query.fetch().then(() => this.createResult(query, defaultedOptions));
  }
  fetch(fetchOptions) {
    return this.#executeFetch({
      ...fetchOptions,
      cancelRefetch: fetchOptions.cancelRefetch ?? true
    }).then(() => {
      this.updateResult();
      return this.#currentResult;
    });
  }
  #executeFetch(fetchOptions) {
    this.#updateQuery();
    let promise = this.#currentQuery.fetch(
      this.options,
      fetchOptions
    );
    if (!fetchOptions?.throwOnError) {
      promise = promise.catch(noop2);
    }
    return promise;
  }
  #updateStaleTimeout() {
    this.#clearStaleTimeout();
    const staleTime = resolveStaleTime(
      this.options.staleTime,
      this.#currentQuery
    );
    if (environmentManager.isServer() || this.#currentResult.isStale || !isValidTimeout(staleTime)) {
      return;
    }
    const time = timeUntilStale(this.#currentResult.dataUpdatedAt, staleTime);
    const timeout = time + 1;
    this.#staleTimeoutId = timeoutManager.setTimeout(() => {
      if (!this.#currentResult.isStale) {
        this.updateResult();
      }
    }, timeout);
  }
  #computeRefetchInterval() {
    return (typeof this.options.refetchInterval === "function" ? this.options.refetchInterval(this.#currentQuery) : this.options.refetchInterval) ?? false;
  }
  #updateRefetchInterval(nextInterval) {
    this.#clearRefetchInterval();
    this.#currentRefetchInterval = nextInterval;
    if (environmentManager.isServer() || resolveEnabled(this.options.enabled, this.#currentQuery) === false || !isValidTimeout(this.#currentRefetchInterval) || this.#currentRefetchInterval === 0) {
      return;
    }
    this.#refetchIntervalId = timeoutManager.setInterval(() => {
      if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
        this.#executeFetch();
      }
    }, this.#currentRefetchInterval);
  }
  #updateTimers() {
    this.#updateStaleTimeout();
    this.#updateRefetchInterval(this.#computeRefetchInterval());
  }
  #clearStaleTimeout() {
    if (this.#staleTimeoutId !== void 0) {
      timeoutManager.clearTimeout(this.#staleTimeoutId);
      this.#staleTimeoutId = void 0;
    }
  }
  #clearRefetchInterval() {
    if (this.#refetchIntervalId !== void 0) {
      timeoutManager.clearInterval(this.#refetchIntervalId);
      this.#refetchIntervalId = void 0;
    }
  }
  createResult(query, options) {
    const prevQuery = this.#currentQuery;
    const prevOptions = this.options;
    const prevResult = this.#currentResult;
    const prevResultState = this.#currentResultState;
    const prevResultOptions = this.#currentResultOptions;
    const queryChange = query !== prevQuery;
    const queryInitialState = queryChange ? query.state : this.#currentQueryInitialState;
    const { state } = query;
    let newState = { ...state };
    let isPlaceholderData = false;
    let data;
    if (options._optimisticResults) {
      const mounted = this.hasListeners();
      const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
      const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
      if (fetchOnMount || fetchOptionally) {
        newState = {
          ...newState,
          ...fetchState(state.data, query.options)
        };
      }
      if (options._optimisticResults === "isRestoring") {
        newState.fetchStatus = "idle";
      }
    }
    let { error, errorUpdatedAt, status } = newState;
    data = newState.data;
    let skipSelect = false;
    if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
      let placeholderData;
      if (prevResult?.isPlaceholderData && options.placeholderData === prevResultOptions?.placeholderData) {
        placeholderData = prevResult.data;
        skipSelect = true;
      } else {
        placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
          this.#lastQueryWithDefinedData?.state.data,
          this.#lastQueryWithDefinedData
        ) : options.placeholderData;
      }
      if (placeholderData !== void 0) {
        status = "success";
        data = replaceData(
          prevResult?.data,
          placeholderData,
          options
        );
        isPlaceholderData = true;
      }
    }
    if (options.select && data !== void 0 && !skipSelect) {
      if (prevResult && data === prevResultState?.data && options.select === this.#selectFn) {
        data = this.#selectResult;
      } else {
        try {
          this.#selectFn = options.select;
          data = options.select(data);
          data = replaceData(prevResult?.data, data, options);
          this.#selectResult = data;
          this.#selectError = null;
        } catch (selectError) {
          this.#selectError = selectError;
        }
      }
    }
    if (this.#selectError) {
      error = this.#selectError;
      data = this.#selectResult;
      errorUpdatedAt = Date.now();
      status = "error";
    }
    const isFetching = newState.fetchStatus === "fetching";
    const isPending = status === "pending";
    const isError = status === "error";
    const isLoading = isPending && isFetching;
    const hasData = data !== void 0;
    const result = {
      status,
      fetchStatus: newState.fetchStatus,
      isPending,
      isSuccess: status === "success",
      isError,
      isInitialLoading: isLoading,
      isLoading,
      data,
      dataUpdatedAt: newState.dataUpdatedAt,
      error,
      errorUpdatedAt,
      failureCount: newState.fetchFailureCount,
      failureReason: newState.fetchFailureReason,
      errorUpdateCount: newState.errorUpdateCount,
      isFetched: query.isFetched(),
      isFetchedAfterMount: newState.dataUpdateCount > queryInitialState.dataUpdateCount || newState.errorUpdateCount > queryInitialState.errorUpdateCount,
      isFetching,
      isRefetching: isFetching && !isPending,
      isLoadingError: isError && !hasData,
      isPaused: newState.fetchStatus === "paused",
      isPlaceholderData,
      isRefetchError: isError && hasData,
      isStale: isStale(query, options),
      refetch: this.refetch,
      promise: this.#currentThenable,
      isEnabled: resolveEnabled(options.enabled, query) !== false
    };
    const nextResult = result;
    if (this.options.experimental_prefetchInRender) {
      const hasResultData = nextResult.data !== void 0;
      const isErrorWithoutData = nextResult.status === "error" && !hasResultData;
      const finalizeThenableIfPossible = (thenable) => {
        if (isErrorWithoutData) {
          thenable.reject(nextResult.error);
        } else if (hasResultData) {
          thenable.resolve(nextResult.data);
        }
      };
      const recreateThenable = () => {
        const pending = this.#currentThenable = nextResult.promise = pendingThenable();
        finalizeThenableIfPossible(pending);
      };
      const prevThenable = this.#currentThenable;
      switch (prevThenable.status) {
        case "pending":
          if (query.queryHash === prevQuery.queryHash) {
            finalizeThenableIfPossible(prevThenable);
          }
          break;
        case "fulfilled":
          if (isErrorWithoutData || nextResult.data !== prevThenable.value) {
            recreateThenable();
          }
          break;
        case "rejected":
          if (!isErrorWithoutData || nextResult.error !== prevThenable.reason) {
            recreateThenable();
          }
          break;
      }
    }
    return nextResult;
  }
  updateResult() {
    const prevResult = this.#currentResult;
    const nextResult = this.createResult(this.#currentQuery, this.options);
    this.#currentResultState = this.#currentQuery.state;
    this.#currentResultOptions = this.options;
    if (this.#currentResultState.data !== void 0) {
      this.#lastQueryWithDefinedData = this.#currentQuery;
    }
    if (shallowEqualObjects(nextResult, prevResult)) {
      return;
    }
    this.#currentResult = nextResult;
    const shouldNotifyListeners = () => {
      if (!prevResult) {
        return true;
      }
      const { notifyOnChangeProps } = this.options;
      const notifyOnChangePropsValue = typeof notifyOnChangeProps === "function" ? notifyOnChangeProps() : notifyOnChangeProps;
      if (notifyOnChangePropsValue === "all" || !notifyOnChangePropsValue && !this.#trackedProps.size) {
        return true;
      }
      const includedProps = new Set(
        notifyOnChangePropsValue ?? this.#trackedProps
      );
      if (this.options.throwOnError) {
        includedProps.add("error");
      }
      return Object.keys(this.#currentResult).some((key) => {
        const typedKey = key;
        const changed = this.#currentResult[typedKey] !== prevResult[typedKey];
        return changed && includedProps.has(typedKey);
      });
    };
    this.#notify({ listeners: shouldNotifyListeners() });
  }
  #updateQuery() {
    const query = this.#client.getQueryCache().build(this.#client, this.options);
    if (query === this.#currentQuery) {
      return;
    }
    const prevQuery = this.#currentQuery;
    this.#currentQuery = query;
    this.#currentQueryInitialState = query.state;
    if (this.hasListeners()) {
      prevQuery?.removeObserver(this);
      query.addObserver(this);
    }
  }
  onQueryUpdate() {
    this.updateResult();
    if (this.hasListeners()) {
      this.#updateTimers();
    }
  }
  #notify(notifyOptions) {
    notifyManager.batch(() => {
      if (notifyOptions.listeners) {
        this.listeners.forEach((listener) => {
          listener(this.#currentResult);
        });
      }
      this.#client.getQueryCache().notify({
        query: this.#currentQuery,
        type: "observerResultsUpdated"
      });
    });
  }
};
function shouldLoadOnMount(query, options) {
  return resolveEnabled(options.enabled, query) !== false && query.state.data === void 0 && !(query.state.status === "error" && options.retryOnMount === false);
}
function shouldFetchOnMount(query, options) {
  return shouldLoadOnMount(query, options) || query.state.data !== void 0 && shouldFetchOn(query, options, options.refetchOnMount);
}
function shouldFetchOn(query, options, field) {
  if (resolveEnabled(options.enabled, query) !== false && resolveStaleTime(options.staleTime, query) !== "static") {
    const value = typeof field === "function" ? field(query) : field;
    return value === "always" || value !== false && isStale(query, options);
  }
  return false;
}
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
  return (query !== prevQuery || resolveEnabled(prevOptions.enabled, query) === false) && (!options.suspense || query.state.status !== "error") && isStale(query, options);
}
function isStale(query, options) {
  return resolveEnabled(options.enabled, query) !== false && query.isStaleByTime(resolveStaleTime(options.staleTime, query));
}
function shouldAssignObserverCurrentProperties(observer, optimisticResult) {
  if (!shallowEqualObjects(observer.getCurrentResult(), optimisticResult)) {
    return true;
  }
  return false;
}
function infiniteQueryBehavior(pages) {
  return {
    onFetch: (context, query) => {
      const options = context.options;
      const direction = context.fetchOptions?.meta?.fetchMore?.direction;
      const oldPages = context.state.data?.pages || [];
      const oldPageParams = context.state.data?.pageParams || [];
      let result = { pages: [], pageParams: [] };
      let currentPage = 0;
      const fetchFn = async () => {
        let cancelled = false;
        const addSignalProperty = (object) => {
          addConsumeAwareSignal(
            object,
            () => context.signal,
            () => cancelled = true
          );
        };
        const queryFn = ensureQueryFn(context.options, context.fetchOptions);
        const fetchPage = async (data, param, previous) => {
          if (cancelled) {
            return Promise.reject();
          }
          if (param == null && data.pages.length) {
            return Promise.resolve(data);
          }
          const createQueryFnContext = () => {
            const queryFnContext2 = {
              client: context.client,
              queryKey: context.queryKey,
              pageParam: param,
              direction: previous ? "backward" : "forward",
              meta: context.options.meta
            };
            addSignalProperty(queryFnContext2);
            return queryFnContext2;
          };
          const queryFnContext = createQueryFnContext();
          const page = await queryFn(queryFnContext);
          const { maxPages } = context.options;
          const addTo = previous ? addToStart : addToEnd;
          return {
            pages: addTo(data.pages, page, maxPages),
            pageParams: addTo(data.pageParams, param, maxPages)
          };
        };
        if (direction && oldPages.length) {
          const previous = direction === "backward";
          const pageParamFn = previous ? getPreviousPageParam : getNextPageParam;
          const oldData = {
            pages: oldPages,
            pageParams: oldPageParams
          };
          const param = pageParamFn(options, oldData);
          result = await fetchPage(oldData, param, previous);
        } else {
          const remainingPages = pages ?? oldPages.length;
          do {
            const param = currentPage === 0 ? oldPageParams[0] ?? options.initialPageParam : getNextPageParam(options, result);
            if (currentPage > 0 && param == null) {
              break;
            }
            result = await fetchPage(result, param);
            currentPage++;
          } while (currentPage < remainingPages);
        }
        return result;
      };
      if (context.options.persister) {
        context.fetchFn = () => {
          return context.options.persister?.(
            fetchFn,
            {
              client: context.client,
              queryKey: context.queryKey,
              meta: context.options.meta,
              signal: context.signal
            },
            query
          );
        };
      } else {
        context.fetchFn = fetchFn;
      }
    }
  };
}
function getNextPageParam(options, { pages, pageParams }) {
  const lastIndex = pages.length - 1;
  return pages.length > 0 ? options.getNextPageParam(
    pages[lastIndex],
    pages,
    pageParams[lastIndex],
    pageParams
  ) : void 0;
}
function getPreviousPageParam(options, { pages, pageParams }) {
  return pages.length > 0 ? options.getPreviousPageParam?.(pages[0], pages, pageParams[0], pageParams) : void 0;
}
var Mutation = class extends Removable {
  #client;
  #observers;
  #mutationCache;
  #retryer;
  constructor(config) {
    super();
    this.#client = config.client;
    this.mutationId = config.mutationId;
    this.#mutationCache = config.mutationCache;
    this.#observers = [];
    this.state = config.state || getDefaultState();
    this.setOptions(config.options);
    this.scheduleGc();
  }
  setOptions(options) {
    this.options = options;
    this.updateGcTime(this.options.gcTime);
  }
  get meta() {
    return this.options.meta;
  }
  addObserver(observer) {
    if (!this.#observers.includes(observer)) {
      this.#observers.push(observer);
      this.clearGcTimeout();
      this.#mutationCache.notify({
        type: "observerAdded",
        mutation: this,
        observer
      });
    }
  }
  removeObserver(observer) {
    this.#observers = this.#observers.filter((x2) => x2 !== observer);
    this.scheduleGc();
    this.#mutationCache.notify({
      type: "observerRemoved",
      mutation: this,
      observer
    });
  }
  optionalRemove() {
    if (!this.#observers.length) {
      if (this.state.status === "pending") {
        this.scheduleGc();
      } else {
        this.#mutationCache.remove(this);
      }
    }
  }
  continue() {
    return this.#retryer?.continue() ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
    this.execute(this.state.variables);
  }
  async execute(variables) {
    const onContinue = () => {
      this.#dispatch({ type: "continue" });
    };
    const mutationFnContext = {
      client: this.#client,
      meta: this.options.meta,
      mutationKey: this.options.mutationKey
    };
    this.#retryer = createRetryer({
      fn: () => {
        if (!this.options.mutationFn) {
          return Promise.reject(new Error("No mutationFn found"));
        }
        return this.options.mutationFn(variables, mutationFnContext);
      },
      onFail: (failureCount, error) => {
        this.#dispatch({ type: "failed", failureCount, error });
      },
      onPause: () => {
        this.#dispatch({ type: "pause" });
      },
      onContinue,
      retry: this.options.retry ?? 0,
      retryDelay: this.options.retryDelay,
      networkMode: this.options.networkMode,
      canRun: () => this.#mutationCache.canRun(this)
    });
    const restored = this.state.status === "pending";
    const isPaused = !this.#retryer.canStart();
    try {
      if (restored) {
        onContinue();
      } else {
        this.#dispatch({ type: "pending", variables, isPaused });
        if (this.#mutationCache.config.onMutate) {
          await this.#mutationCache.config.onMutate(
            variables,
            this,
            mutationFnContext
          );
        }
        const context = await this.options.onMutate?.(
          variables,
          mutationFnContext
        );
        if (context !== this.state.context) {
          this.#dispatch({
            type: "pending",
            context,
            variables,
            isPaused
          });
        }
      }
      const data = await this.#retryer.start();
      await this.#mutationCache.config.onSuccess?.(
        data,
        variables,
        this.state.context,
        this,
        mutationFnContext
      );
      await this.options.onSuccess?.(
        data,
        variables,
        this.state.context,
        mutationFnContext
      );
      await this.#mutationCache.config.onSettled?.(
        data,
        null,
        this.state.variables,
        this.state.context,
        this,
        mutationFnContext
      );
      await this.options.onSettled?.(
        data,
        null,
        variables,
        this.state.context,
        mutationFnContext
      );
      this.#dispatch({ type: "success", data });
      return data;
    } catch (error) {
      try {
        await this.#mutationCache.config.onError?.(
          error,
          variables,
          this.state.context,
          this,
          mutationFnContext
        );
      } catch (e2) {
        void Promise.reject(e2);
      }
      try {
        await this.options.onError?.(
          error,
          variables,
          this.state.context,
          mutationFnContext
        );
      } catch (e2) {
        void Promise.reject(e2);
      }
      try {
        await this.#mutationCache.config.onSettled?.(
          void 0,
          error,
          this.state.variables,
          this.state.context,
          this,
          mutationFnContext
        );
      } catch (e2) {
        void Promise.reject(e2);
      }
      try {
        await this.options.onSettled?.(
          void 0,
          error,
          variables,
          this.state.context,
          mutationFnContext
        );
      } catch (e2) {
        void Promise.reject(e2);
      }
      this.#dispatch({ type: "error", error });
      throw error;
    } finally {
      this.#mutationCache.runNext(this);
    }
  }
  #dispatch(action) {
    const reducer = (state) => {
      switch (action.type) {
        case "failed":
          return {
            ...state,
            failureCount: action.failureCount,
            failureReason: action.error
          };
        case "pause":
          return {
            ...state,
            isPaused: true
          };
        case "continue":
          return {
            ...state,
            isPaused: false
          };
        case "pending":
          return {
            ...state,
            context: action.context,
            data: void 0,
            failureCount: 0,
            failureReason: null,
            error: null,
            isPaused: action.isPaused,
            status: "pending",
            variables: action.variables,
            submittedAt: Date.now()
          };
        case "success":
          return {
            ...state,
            data: action.data,
            failureCount: 0,
            failureReason: null,
            error: null,
            status: "success",
            isPaused: false
          };
        case "error":
          return {
            ...state,
            data: void 0,
            error: action.error,
            failureCount: state.failureCount + 1,
            failureReason: action.error,
            isPaused: false,
            status: "error"
          };
      }
    };
    this.state = reducer(this.state);
    notifyManager.batch(() => {
      this.#observers.forEach((observer) => {
        observer.onMutationUpdate(action);
      });
      this.#mutationCache.notify({
        mutation: this,
        type: "updated",
        action
      });
    });
  }
};
function getDefaultState() {
  return {
    context: void 0,
    data: void 0,
    error: null,
    failureCount: 0,
    failureReason: null,
    isPaused: false,
    status: "idle",
    variables: void 0,
    submittedAt: 0
  };
}
var MutationCache = class extends Subscribable {
  constructor(config = {}) {
    super();
    this.config = config;
    this.#mutations = /* @__PURE__ */ new Set();
    this.#scopes = /* @__PURE__ */ new Map();
    this.#mutationId = 0;
  }
  #mutations;
  #scopes;
  #mutationId;
  build(client, options, state) {
    const mutation = new Mutation({
      client,
      mutationCache: this,
      mutationId: ++this.#mutationId,
      options: client.defaultMutationOptions(options),
      state
    });
    this.add(mutation);
    return mutation;
  }
  add(mutation) {
    this.#mutations.add(mutation);
    const scope = scopeFor(mutation);
    if (typeof scope === "string") {
      const scopedMutations = this.#scopes.get(scope);
      if (scopedMutations) {
        scopedMutations.push(mutation);
      } else {
        this.#scopes.set(scope, [mutation]);
      }
    }
    this.notify({ type: "added", mutation });
  }
  remove(mutation) {
    if (this.#mutations.delete(mutation)) {
      const scope = scopeFor(mutation);
      if (typeof scope === "string") {
        const scopedMutations = this.#scopes.get(scope);
        if (scopedMutations) {
          if (scopedMutations.length > 1) {
            const index2 = scopedMutations.indexOf(mutation);
            if (index2 !== -1) {
              scopedMutations.splice(index2, 1);
            }
          } else if (scopedMutations[0] === mutation) {
            this.#scopes.delete(scope);
          }
        }
      }
    }
    this.notify({ type: "removed", mutation });
  }
  canRun(mutation) {
    const scope = scopeFor(mutation);
    if (typeof scope === "string") {
      const mutationsWithSameScope = this.#scopes.get(scope);
      const firstPendingMutation = mutationsWithSameScope?.find(
        (m3) => m3.state.status === "pending"
      );
      return !firstPendingMutation || firstPendingMutation === mutation;
    } else {
      return true;
    }
  }
  runNext(mutation) {
    const scope = scopeFor(mutation);
    if (typeof scope === "string") {
      const foundMutation = this.#scopes.get(scope)?.find((m3) => m3 !== mutation && m3.state.isPaused);
      return foundMutation?.continue() ?? Promise.resolve();
    } else {
      return Promise.resolve();
    }
  }
  clear() {
    notifyManager.batch(() => {
      this.#mutations.forEach((mutation) => {
        this.notify({ type: "removed", mutation });
      });
      this.#mutations.clear();
      this.#scopes.clear();
    });
  }
  getAll() {
    return Array.from(this.#mutations);
  }
  find(filters) {
    const defaultedFilters = { exact: true, ...filters };
    return this.getAll().find(
      (mutation) => matchMutation(defaultedFilters, mutation)
    );
  }
  findAll(filters = {}) {
    return this.getAll().filter((mutation) => matchMutation(filters, mutation));
  }
  notify(event) {
    notifyManager.batch(() => {
      this.listeners.forEach((listener) => {
        listener(event);
      });
    });
  }
  resumePausedMutations() {
    const pausedMutations = this.getAll().filter((x2) => x2.state.isPaused);
    return notifyManager.batch(
      () => Promise.all(
        pausedMutations.map((mutation) => mutation.continue().catch(noop2))
      )
    );
  }
};
function scopeFor(mutation) {
  return mutation.options.scope?.id;
}
var MutationObserver$1 = class MutationObserver2 extends Subscribable {
  #client;
  #currentResult = void 0;
  #currentMutation;
  #mutateOptions;
  constructor(client, options) {
    super();
    this.#client = client;
    this.setOptions(options);
    this.bindMethods();
    this.#updateResult();
  }
  bindMethods() {
    this.mutate = this.mutate.bind(this);
    this.reset = this.reset.bind(this);
  }
  setOptions(options) {
    const prevOptions = this.options;
    this.options = this.#client.defaultMutationOptions(options);
    if (!shallowEqualObjects(this.options, prevOptions)) {
      this.#client.getMutationCache().notify({
        type: "observerOptionsUpdated",
        mutation: this.#currentMutation,
        observer: this
      });
    }
    if (prevOptions?.mutationKey && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {
      this.reset();
    } else if (this.#currentMutation?.state.status === "pending") {
      this.#currentMutation.setOptions(this.options);
    }
  }
  onUnsubscribe() {
    if (!this.hasListeners()) {
      this.#currentMutation?.removeObserver(this);
    }
  }
  onMutationUpdate(action) {
    this.#updateResult();
    this.#notify(action);
  }
  getCurrentResult() {
    return this.#currentResult;
  }
  reset() {
    this.#currentMutation?.removeObserver(this);
    this.#currentMutation = void 0;
    this.#updateResult();
    this.#notify();
  }
  mutate(variables, options) {
    this.#mutateOptions = options;
    this.#currentMutation?.removeObserver(this);
    this.#currentMutation = this.#client.getMutationCache().build(this.#client, this.options);
    this.#currentMutation.addObserver(this);
    return this.#currentMutation.execute(variables);
  }
  #updateResult() {
    const state = this.#currentMutation?.state ?? getDefaultState();
    this.#currentResult = {
      ...state,
      isPending: state.status === "pending",
      isSuccess: state.status === "success",
      isError: state.status === "error",
      isIdle: state.status === "idle",
      mutate: this.mutate,
      reset: this.reset
    };
  }
  #notify(action) {
    notifyManager.batch(() => {
      if (this.#mutateOptions && this.hasListeners()) {
        const variables = this.#currentResult.variables;
        const onMutateResult = this.#currentResult.context;
        const context = {
          client: this.#client,
          meta: this.options.meta,
          mutationKey: this.options.mutationKey
        };
        if (action?.type === "success") {
          try {
            this.#mutateOptions.onSuccess?.(
              action.data,
              variables,
              onMutateResult,
              context
            );
          } catch (e2) {
            void Promise.reject(e2);
          }
          try {
            this.#mutateOptions.onSettled?.(
              action.data,
              null,
              variables,
              onMutateResult,
              context
            );
          } catch (e2) {
            void Promise.reject(e2);
          }
        } else if (action?.type === "error") {
          try {
            this.#mutateOptions.onError?.(
              action.error,
              variables,
              onMutateResult,
              context
            );
          } catch (e2) {
            void Promise.reject(e2);
          }
          try {
            this.#mutateOptions.onSettled?.(
              void 0,
              action.error,
              variables,
              onMutateResult,
              context
            );
          } catch (e2) {
            void Promise.reject(e2);
          }
        }
      }
      this.listeners.forEach((listener) => {
        listener(this.#currentResult);
      });
    });
  }
};
var QueryCache = class extends Subscribable {
  constructor(config = {}) {
    super();
    this.config = config;
    this.#queries = /* @__PURE__ */ new Map();
  }
  #queries;
  build(client, options, state) {
    const queryKey = options.queryKey;
    const queryHash = options.queryHash ?? hashQueryKeyByOptions(queryKey, options);
    let query = this.get(queryHash);
    if (!query) {
      query = new Query({
        client,
        queryKey,
        queryHash,
        options: client.defaultQueryOptions(options),
        state,
        defaultOptions: client.getQueryDefaults(queryKey)
      });
      this.add(query);
    }
    return query;
  }
  add(query) {
    if (!this.#queries.has(query.queryHash)) {
      this.#queries.set(query.queryHash, query);
      this.notify({
        type: "added",
        query
      });
    }
  }
  remove(query) {
    const queryInMap = this.#queries.get(query.queryHash);
    if (queryInMap) {
      query.destroy();
      if (queryInMap === query) {
        this.#queries.delete(query.queryHash);
      }
      this.notify({ type: "removed", query });
    }
  }
  clear() {
    notifyManager.batch(() => {
      this.getAll().forEach((query) => {
        this.remove(query);
      });
    });
  }
  get(queryHash) {
    return this.#queries.get(queryHash);
  }
  getAll() {
    return [...this.#queries.values()];
  }
  find(filters) {
    const defaultedFilters = { exact: true, ...filters };
    return this.getAll().find(
      (query) => matchQuery(defaultedFilters, query)
    );
  }
  findAll(filters = {}) {
    const queries = this.getAll();
    return Object.keys(filters).length > 0 ? queries.filter((query) => matchQuery(filters, query)) : queries;
  }
  notify(event) {
    notifyManager.batch(() => {
      this.listeners.forEach((listener) => {
        listener(event);
      });
    });
  }
  onFocus() {
    notifyManager.batch(() => {
      this.getAll().forEach((query) => {
        query.onFocus();
      });
    });
  }
  onOnline() {
    notifyManager.batch(() => {
      this.getAll().forEach((query) => {
        query.onOnline();
      });
    });
  }
};
var QueryClient = class {
  #queryCache;
  #mutationCache;
  #defaultOptions;
  #queryDefaults;
  #mutationDefaults;
  #mountCount;
  #unsubscribeFocus;
  #unsubscribeOnline;
  constructor(config = {}) {
    this.#queryCache = config.queryCache || new QueryCache();
    this.#mutationCache = config.mutationCache || new MutationCache();
    this.#defaultOptions = config.defaultOptions || {};
    this.#queryDefaults = /* @__PURE__ */ new Map();
    this.#mutationDefaults = /* @__PURE__ */ new Map();
    this.#mountCount = 0;
  }
  mount() {
    this.#mountCount++;
    if (this.#mountCount !== 1) return;
    this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
      if (focused) {
        await this.resumePausedMutations();
        this.#queryCache.onFocus();
      }
    });
    this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
      if (online) {
        await this.resumePausedMutations();
        this.#queryCache.onOnline();
      }
    });
  }
  unmount() {
    this.#mountCount--;
    if (this.#mountCount !== 0) return;
    this.#unsubscribeFocus?.();
    this.#unsubscribeFocus = void 0;
    this.#unsubscribeOnline?.();
    this.#unsubscribeOnline = void 0;
  }
  isFetching(filters) {
    return this.#queryCache.findAll({ ...filters, fetchStatus: "fetching" }).length;
  }
  isMutating(filters) {
    return this.#mutationCache.findAll({ ...filters, status: "pending" }).length;
  }
  /**
   * Imperative (non-reactive) way to retrieve data for a QueryKey.
   * Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
   *
   * Hint: Do not use this function inside a component, because it won't receive updates.
   * Use `useQuery` to create a `QueryObserver` that subscribes to changes.
   */
  getQueryData(queryKey) {
    const options = this.defaultQueryOptions({ queryKey });
    return this.#queryCache.get(options.queryHash)?.state.data;
  }
  ensureQueryData(options) {
    const defaultedOptions = this.defaultQueryOptions(options);
    const query = this.#queryCache.build(this, defaultedOptions);
    const cachedData = query.state.data;
    if (cachedData === void 0) {
      return this.fetchQuery(options);
    }
    if (options.revalidateIfStale && query.isStaleByTime(resolveStaleTime(defaultedOptions.staleTime, query))) {
      void this.prefetchQuery(defaultedOptions);
    }
    return Promise.resolve(cachedData);
  }
  getQueriesData(filters) {
    return this.#queryCache.findAll(filters).map(({ queryKey, state }) => {
      const data = state.data;
      return [queryKey, data];
    });
  }
  setQueryData(queryKey, updater, options) {
    const defaultedOptions = this.defaultQueryOptions({ queryKey });
    const query = this.#queryCache.get(
      defaultedOptions.queryHash
    );
    const prevData = query?.state.data;
    const data = functionalUpdate(updater, prevData);
    if (data === void 0) {
      return void 0;
    }
    return this.#queryCache.build(this, defaultedOptions).setData(data, { ...options, manual: true });
  }
  setQueriesData(filters, updater, options) {
    return notifyManager.batch(
      () => this.#queryCache.findAll(filters).map(({ queryKey }) => [
        queryKey,
        this.setQueryData(queryKey, updater, options)
      ])
    );
  }
  getQueryState(queryKey) {
    const options = this.defaultQueryOptions({ queryKey });
    return this.#queryCache.get(
      options.queryHash
    )?.state;
  }
  removeQueries(filters) {
    const queryCache = this.#queryCache;
    notifyManager.batch(() => {
      queryCache.findAll(filters).forEach((query) => {
        queryCache.remove(query);
      });
    });
  }
  resetQueries(filters, options) {
    const queryCache = this.#queryCache;
    return notifyManager.batch(() => {
      queryCache.findAll(filters).forEach((query) => {
        query.reset();
      });
      return this.refetchQueries(
        {
          type: "active",
          ...filters
        },
        options
      );
    });
  }
  cancelQueries(filters, cancelOptions = {}) {
    const defaultedCancelOptions = { revert: true, ...cancelOptions };
    const promises = notifyManager.batch(
      () => this.#queryCache.findAll(filters).map((query) => query.cancel(defaultedCancelOptions))
    );
    return Promise.all(promises).then(noop2).catch(noop2);
  }
  invalidateQueries(filters, options = {}) {
    return notifyManager.batch(() => {
      this.#queryCache.findAll(filters).forEach((query) => {
        query.invalidate();
      });
      if (filters?.refetchType === "none") {
        return Promise.resolve();
      }
      return this.refetchQueries(
        {
          ...filters,
          type: filters?.refetchType ?? filters?.type ?? "active"
        },
        options
      );
    });
  }
  refetchQueries(filters, options = {}) {
    const fetchOptions = {
      ...options,
      cancelRefetch: options.cancelRefetch ?? true
    };
    const promises = notifyManager.batch(
      () => this.#queryCache.findAll(filters).filter((query) => !query.isDisabled() && !query.isStatic()).map((query) => {
        let promise = query.fetch(void 0, fetchOptions);
        if (!fetchOptions.throwOnError) {
          promise = promise.catch(noop2);
        }
        return query.state.fetchStatus === "paused" ? Promise.resolve() : promise;
      })
    );
    return Promise.all(promises).then(noop2);
  }
  fetchQuery(options) {
    const defaultedOptions = this.defaultQueryOptions(options);
    if (defaultedOptions.retry === void 0) {
      defaultedOptions.retry = false;
    }
    const query = this.#queryCache.build(this, defaultedOptions);
    return query.isStaleByTime(
      resolveStaleTime(defaultedOptions.staleTime, query)
    ) ? query.fetch(defaultedOptions) : Promise.resolve(query.state.data);
  }
  prefetchQuery(options) {
    return this.fetchQuery(options).then(noop2).catch(noop2);
  }
  fetchInfiniteQuery(options) {
    options.behavior = infiniteQueryBehavior(options.pages);
    return this.fetchQuery(options);
  }
  prefetchInfiniteQuery(options) {
    return this.fetchInfiniteQuery(options).then(noop2).catch(noop2);
  }
  ensureInfiniteQueryData(options) {
    options.behavior = infiniteQueryBehavior(options.pages);
    return this.ensureQueryData(options);
  }
  resumePausedMutations() {
    if (onlineManager.isOnline()) {
      return this.#mutationCache.resumePausedMutations();
    }
    return Promise.resolve();
  }
  getQueryCache() {
    return this.#queryCache;
  }
  getMutationCache() {
    return this.#mutationCache;
  }
  getDefaultOptions() {
    return this.#defaultOptions;
  }
  setDefaultOptions(options) {
    this.#defaultOptions = options;
  }
  setQueryDefaults(queryKey, options) {
    this.#queryDefaults.set(hashKey(queryKey), {
      queryKey,
      defaultOptions: options
    });
  }
  getQueryDefaults(queryKey) {
    const defaults = [...this.#queryDefaults.values()];
    const result = {};
    defaults.forEach((queryDefault) => {
      if (partialMatchKey(queryKey, queryDefault.queryKey)) {
        Object.assign(result, queryDefault.defaultOptions);
      }
    });
    return result;
  }
  setMutationDefaults(mutationKey, options) {
    this.#mutationDefaults.set(hashKey(mutationKey), {
      mutationKey,
      defaultOptions: options
    });
  }
  getMutationDefaults(mutationKey) {
    const defaults = [...this.#mutationDefaults.values()];
    const result = {};
    defaults.forEach((queryDefault) => {
      if (partialMatchKey(mutationKey, queryDefault.mutationKey)) {
        Object.assign(result, queryDefault.defaultOptions);
      }
    });
    return result;
  }
  defaultQueryOptions(options) {
    if (options._defaulted) {
      return options;
    }
    const defaultedOptions = {
      ...this.#defaultOptions.queries,
      ...this.getQueryDefaults(options.queryKey),
      ...options,
      _defaulted: true
    };
    if (!defaultedOptions.queryHash) {
      defaultedOptions.queryHash = hashQueryKeyByOptions(
        defaultedOptions.queryKey,
        defaultedOptions
      );
    }
    if (defaultedOptions.refetchOnReconnect === void 0) {
      defaultedOptions.refetchOnReconnect = defaultedOptions.networkMode !== "always";
    }
    if (defaultedOptions.throwOnError === void 0) {
      defaultedOptions.throwOnError = !!defaultedOptions.suspense;
    }
    if (!defaultedOptions.networkMode && defaultedOptions.persister) {
      defaultedOptions.networkMode = "offlineFirst";
    }
    if (defaultedOptions.queryFn === skipToken) {
      defaultedOptions.enabled = false;
    }
    return defaultedOptions;
  }
  defaultMutationOptions(options) {
    if (options?._defaulted) {
      return options;
    }
    return {
      ...this.#defaultOptions.mutations,
      ...options?.mutationKey && this.getMutationDefaults(options.mutationKey),
      ...options,
      _defaulted: true
    };
  }
  clear() {
    this.#queryCache.clear();
    this.#mutationCache.clear();
  }
};
var QueryClientContext = window.wp.element.createContext(
  void 0
);
var useQueryClient = (queryClient2) => {
  const client = window.wp.element.useContext(QueryClientContext);
  if (!client) {
    throw new Error("No QueryClient set, use QueryClientProvider to set one");
  }
  return client;
};
var QueryClientProvider = ({
  client,
  children
}) => {
  window.wp.element.useEffect(() => {
    client.mount();
    return () => {
      client.unmount();
    };
  }, [client]);
  return /* @__PURE__ */ window.wp.element.jsx(QueryClientContext.Provider, { value: client, children });
};
var IsRestoringContext = window.wp.element.createContext(false);
var useIsRestoring = () => window.wp.element.useContext(IsRestoringContext);
IsRestoringContext.Provider;
function createValue() {
  let isReset = false;
  return {
    clearReset: () => {
      isReset = false;
    },
    reset: () => {
      isReset = true;
    },
    isReset: () => {
      return isReset;
    }
  };
}
var QueryErrorResetBoundaryContext = window.wp.element.createContext(createValue());
var useQueryErrorResetBoundary = () => window.wp.element.useContext(QueryErrorResetBoundaryContext);
var ensurePreventErrorBoundaryRetry = (options, errorResetBoundary, query) => {
  const throwOnError = query?.state.error && typeof options.throwOnError === "function" ? shouldThrowError(options.throwOnError, [query.state.error, query]) : options.throwOnError;
  if (options.suspense || options.experimental_prefetchInRender || throwOnError) {
    if (!errorResetBoundary.isReset()) {
      options.retryOnMount = false;
    }
  }
};
var useClearResetErrorBoundary = (errorResetBoundary) => {
  window.wp.element.useEffect(() => {
    errorResetBoundary.clearReset();
  }, [errorResetBoundary]);
};
var getHasError = ({
  result,
  errorResetBoundary,
  throwOnError,
  query,
  suspense
}) => {
  return result.isError && !errorResetBoundary.isReset() && !result.isFetching && query && (suspense && result.data === void 0 || shouldThrowError(throwOnError, [result.error, query]));
};
var ensureSuspenseTimers = (defaultedOptions) => {
  if (defaultedOptions.suspense) {
    const MIN_SUSPENSE_TIME_MS = 1e3;
    const clamp2 = (value) => value === "static" ? value : Math.max(value ?? MIN_SUSPENSE_TIME_MS, MIN_SUSPENSE_TIME_MS);
    const originalStaleTime = defaultedOptions.staleTime;
    defaultedOptions.staleTime = typeof originalStaleTime === "function" ? (...args) => clamp2(originalStaleTime(...args)) : clamp2(originalStaleTime);
    if (typeof defaultedOptions.gcTime === "number") {
      defaultedOptions.gcTime = Math.max(
        defaultedOptions.gcTime,
        MIN_SUSPENSE_TIME_MS
      );
    }
  }
};
var willFetch = (result, isRestoring) => result.isLoading && result.isFetching && !isRestoring;
var shouldSuspend = (defaultedOptions, result) => defaultedOptions?.suspense && result.isPending;
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
  errorResetBoundary.clearReset();
});
function useBaseQuery(options, Observer, queryClient2) {
  const isRestoring = useIsRestoring();
  const errorResetBoundary = useQueryErrorResetBoundary();
  const client = useQueryClient();
  const defaultedOptions = client.defaultQueryOptions(options);
  client.getDefaultOptions().queries?._experimental_beforeQuery?.(
    defaultedOptions
  );
  const query = client.getQueryCache().get(defaultedOptions.queryHash);
  defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
  ensureSuspenseTimers(defaultedOptions);
  ensurePreventErrorBoundaryRetry(defaultedOptions, errorResetBoundary, query);
  useClearResetErrorBoundary(errorResetBoundary);
  const isNewCacheEntry = !client.getQueryCache().get(defaultedOptions.queryHash);
  const [observer] = window.wp.element.useState(
    () => new Observer(
      client,
      defaultedOptions
    )
  );
  const result = observer.getOptimisticResult(defaultedOptions);
  const shouldSubscribe = !isRestoring && options.subscribed !== false;
  window.wp.element.useSyncExternalStore(
    window.wp.element.useCallback(
      (onStoreChange) => {
        const unsubscribe = shouldSubscribe ? observer.subscribe(notifyManager.batchCalls(onStoreChange)) : noop2;
        observer.updateResult();
        return unsubscribe;
      },
      [observer, shouldSubscribe]
    ),
    () => observer.getCurrentResult(),
    () => observer.getCurrentResult()
  );
  window.wp.element.useEffect(() => {
    observer.setOptions(defaultedOptions);
  }, [defaultedOptions, observer]);
  if (shouldSuspend(defaultedOptions, result)) {
    throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary);
  }
  if (getHasError({
    result,
    errorResetBoundary,
    throwOnError: defaultedOptions.throwOnError,
    query,
    suspense: defaultedOptions.suspense
  })) {
    throw result.error;
  }
  client.getDefaultOptions().queries?._experimental_afterQuery?.(
    defaultedOptions,
    result
  );
  if (defaultedOptions.experimental_prefetchInRender && !environmentManager.isServer() && willFetch(result, isRestoring)) {
    const promise = isNewCacheEntry ? (
      // Fetch immediately on render in order to ensure `.promise` is resolved even if the component is unmounted
      fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
    ) : (
      // subscribe to the "cache promise" so that we can finalize the currentThenable once data comes in
      query?.promise
    );
    promise?.catch(noop2).finally(() => {
      observer.updateResult();
    });
  }
  return !defaultedOptions.notifyOnChangeProps ? observer.trackResult(result) : result;
}
function useQuery(options, queryClient2) {
  return useBaseQuery(options, QueryObserver);
}
function useMutation(options, queryClient2) {
  const client = useQueryClient();
  const [observer] = window.wp.element.useState(
    () => new MutationObserver$1(
      client,
      options
    )
  );
  window.wp.element.useEffect(() => {
    observer.setOptions(options);
  }, [observer, options]);
  const result = window.wp.element.useSyncExternalStore(
    window.wp.element.useCallback(
      (onStoreChange) => observer.subscribe(notifyManager.batchCalls(onStoreChange)),
      [observer]
    ),
    () => observer.getCurrentResult(),
    () => observer.getCurrentResult()
  );
  const mutate = window.wp.element.useCallback(
    (variables, mutateOptions) => {
      observer.mutate(variables, mutateOptions).catch(noop2);
    },
    [observer]
  );
  if (result.error && shouldThrowError(observer.options.throwOnError, [result.error])) {
    throw result.error;
  }
  return { ...result, mutate, mutateAsync: result.mutate };
}
const usePulseCheck = () => {
  return useMutation({
    mutationFn: () => window.wp.apiFetch({
      path: "/structura/v1/pulse/initiate",
      method: "POST"
    }),
    onSuccess: (response) => {
      if (response.success) {
        An.success(
          response.message || window.wp.i18n.__("Pulse Verified: Cloud handshake successful!", "structura")
        );
      } else {
        An.error(response.message || window.wp.i18n.__("Pulse Failed: Cloud unreachable.", "structura"));
      }
    }
    // Global error handler takes care of network/500 errors
  });
};
const DEFAULT_VIDEO_VOICE = "gemini:Zephyr";
const OPENAI_VOICES = [
  ["alloy", "Crisp · Neutral"],
  ["ash", "Grounded · Steady"],
  ["coral", "Friendly · Upbeat"],
  ["echo", "Calm · Narrative"],
  ["fable", "Expressive · Storytelling"],
  ["nova", "Warm · Conversational"],
  ["onyx", "Deep · Authoritative"],
  ["sage", "Soft · Thoughtful"],
  ["shimmer", "Bright · Energetic"]
];
const GEMINI_VOICES = [
  ["Zephyr", "Bright · Energetic"],
  ["Puck", "Upbeat · Playful"],
  ["Charon", "Informative · Steady"],
  ["Kore", "Firm · Confident"],
  ["Fenrir", "Excitable · Bold"],
  ["Leda", "Youthful · Fresh"],
  ["Orus", "Firm · Direct"],
  ["Aoede", "Breezy · Light"],
  ["Callirrhoe", "Easy-going · Relaxed"],
  ["Autonoe", "Bright · Clear"],
  ["Enceladus", "Breathy · Soft"],
  ["Iapetus", "Clear · Neutral"],
  ["Umbriel", "Easy-going · Warm"],
  ["Algieba", "Smooth · Polished"],
  ["Despina", "Smooth · Calm"],
  ["Erinome", "Clear · Precise"],
  ["Algenib", "Gravelly · Textured"],
  ["Rasalgethi", "Informative · Warm"],
  ["Laomedeia", "Upbeat · Lively"],
  ["Achernar", "Soft · Gentle"],
  ["Alnilam", "Firm · Grounded"],
  ["Schedar", "Even · Balanced"],
  ["Gacrux", "Mature · Assured"],
  ["Pulcherrima", "Forward · Expressive"],
  ["Achird", "Friendly · Open"],
  ["Zubenelgenubi", "Casual · Conversational"],
  ["Vindemiatrix", "Gentle · Measured"],
  ["Sadachbia", "Lively · Animated"],
  ["Sadaltager", "Knowledgeable · Composed"],
  ["Sulafat", "Warm · Rich"]
];
const capitalize = (s2) => s2.charAt(0).toUpperCase() + s2.slice(1);
const VIDEO_VOICE_CATALOG = [
  ...OPENAI_VOICES.map(([id, descriptor]) => ({
    id: `openai:${id}`,
    provider: "openai",
    name: capitalize(id),
    descriptor
  })),
  ...GEMINI_VOICES.map(([id, descriptor]) => ({
    id: `gemini:${id}`,
    provider: "gemini",
    name: id,
    descriptor
  }))
];
const LEGACY_VIDEO_PERSONAS = {
  ava: { label: "Ava", canonical: "openai:nova" },
  marcus: { label: "Marcus", canonical: "openai:onyx" },
  lena: { label: "Lena", canonical: "openai:shimmer" },
  oliver: { label: "Oliver", canonical: "openai:alloy" },
  priya: { label: "Priya", canonical: "openai:coral" },
  noah: { label: "Noah", canonical: "openai:echo" }
};
const SAMPLE_BASE = "https://storage.googleapis.com/structura-releases/assets/voice-samples/v2";
function videoVoiceSampleUrl(canonicalId) {
  const [provider, id] = canonicalId.split(":");
  return `${SAMPLE_BASE}/${provider}-${id}.${provider === "gemini" ? "wav" : "mp3"}`;
}
function resolveStoredVideoVoice(stored) {
  const fallback = VIDEO_VOICE_CATALOG.find((v2) => v2.id === DEFAULT_VIDEO_VOICE);
  if (!stored)
    return { option: fallback };
  const persona = LEGACY_VIDEO_PERSONAS[stored];
  if (persona) {
    const option2 = VIDEO_VOICE_CATALOG.find((v2) => v2.id === persona.canonical);
    return { option: option2, legacyPersonaLabel: persona.label };
  }
  const canonical = stored.includes(":") ? stored : `openai:${stored}`;
  const option = VIDEO_VOICE_CATALOG.find((v2) => v2.id === canonical);
  return option ? { option } : { option: fallback };
}
const isManagedPlan = (p2) => p2 === "cloud" || p2 === "cloud_pro";
const PROVIDERS_FOR_TIER = {
  none: ["openai"],
  free: ["openai", "gemini"],
  byok: ["openai", "gemini", "anthropic"],
  cloud: ["openai", "gemini", "anthropic"],
  cloud_pro: ["openai", "gemini", "anthropic"]
};
const getProvidersForTier = (plan) => {
  if (plan in PROVIDERS_FOR_TIER) {
    return PROVIDERS_FOR_TIER[plan];
  }
  return PROVIDERS_FOR_TIER.none;
};
const MAX_CAMPAIGNS_FOR_TIER = {
  none: 0,
  free: 1,
  byok: 10,
  cloud: null,
  cloud_pro: null
};
const getMaxCampaignsForTier = (plan) => {
  if (plan in MAX_CAMPAIGNS_FOR_TIER) {
    return MAX_CAMPAIGNS_FOR_TIER[plan];
  }
  return MAX_CAMPAIGNS_FOR_TIER.none;
};
const CAPABILITIES = [
  // Workspace itself
  "workspace.read",
  "workspace.update",
  "workspace.delete",
  "workspace.transfer",
  // Members management
  "members.read",
  "members.invite",
  "members.update",
  "members.remove",
  // Campaigns
  "campaigns.read",
  "campaigns.create",
  "campaigns.update",
  "campaigns.delete",
  // Campaign runs
  "runs.read",
  "runs.trigger",
  "runs.cancel",
  // Personas
  "personas.read",
  "personas.create",
  "personas.update",
  "personas.delete",
  // BYOK credentials (encrypted, admin-SDK-only at write time)
  "credentials.read",
  "credentials.write",
  // Billing — viewing invoices vs. managing the subscription
  "billing.read",
  "billing.manage"
];
const OWNER_CAPS = CAPABILITIES;
const ADMIN_CAPS = CAPABILITIES.filter((c2) => c2 !== "workspace.delete" && c2 !== "workspace.transfer" && c2 !== "billing.manage");
const EDITOR_CAPS = [
  // Read scope. No members.read — the member roster (names + emails)
  // is owner/admin-only: the portal sidebar already hides Members for
  // editors/viewers, and a site-scoped invitee must not see the full
  // team list (2026-07-11 invite incident).
  "workspace.read",
  "campaigns.read",
  "runs.read",
  "personas.read",
  // Write scope — content production
  "campaigns.create",
  "campaigns.update",
  "campaigns.delete",
  "runs.trigger",
  "runs.cancel",
  "personas.create",
  "personas.update",
  "personas.delete"
];
const VIEWER_CAPS = [
  "workspace.read",
  "campaigns.read",
  "runs.read",
  "personas.read"
  // No credentials.read — encrypted BYOK keys are sensitive even at read.
  // No billing.* — viewers shouldn't see invoices either.
  // No members.read — same rationale as EDITOR_CAPS above.
];
({
  owner: new Set(OWNER_CAPS),
  admin: new Set(ADMIN_CAPS),
  editor: new Set(EDITOR_CAPS),
  viewer: new Set(VIEWER_CAPS)
});
const PERSONA_TEMPLATES$1 = [
  {
    name: "Skeptical Tech Journalist",
    tone: "authoritative",
    reading_level: "grade_12",
    system_prompt: "You are a seasoned tech journalist who questions every marketing claim. You provide deep analysis, look for hidden trade-offs, and write with a hint of healthy cynicism. Your goal is to find the 'catch' in every new product."
  },
  {
    name: "Friendly Lifestyle Blogger",
    tone: "casual",
    reading_level: "grade_8",
    system_prompt: "You write relatable, warm, and engaging content about daily life. You use personal anecdotes, emoji-lite formatting, and focus on practical, easy-to-implement tips for busy families."
  },
  {
    name: "PhD Research Scientist",
    tone: "professional",
    reading_level: "phd",
    system_prompt: "You are a rigorous academic researcher. Your writing is dense with data citations, formal in structure, and avoids all hyperbole. You focus on evidence-based conclusions and technical accuracy above all else."
  },
  {
    name: "The Growth Hacker",
    tone: "enthusiastic",
    reading_level: "grade_8",
    system_prompt: "You are obsessed with ROI, conversion rates, and rapid scaling. Your writing is punchy, high-energy, and full of action items. You speak directly to the 'hustle' culture and focus on quick wins."
  },
  {
    name: "Humorous Social Critic",
    tone: "humorous",
    reading_level: "grade_12",
    system_prompt: "You use wit, irony, and satire to discuss modern social trends. You are observant and slightly snarky, making complex points through relatable comedic comparisons."
  },
  {
    name: "Zen Wellness Guide",
    tone: "empathetic",
    reading_level: "grade_8",
    system_prompt: "You are a calm, mindful wellness coach. Your writing uses soft language, focuses on holistic health, and encourages the reader to slow down and practice self-care."
  },
  {
    name: "No-Nonsense Financial Advisor",
    tone: "authoritative",
    reading_level: "grade_12",
    system_prompt: "You are a blunt, math-first financial expert. You hate 'get rich quick' schemes. Your writing focuses on long-term stability, risk management, and cold, hard numbers."
  },
  {
    name: "The Conspiracy Theorist",
    tone: "controversial",
    reading_level: "grade_8",
    system_prompt: "You question the mainstream narrative. You 'connect the dots' that others miss. Your writing is intense, provocative, and urges readers to 'wake up' to hidden truths."
  },
  {
    name: "Home DIY Craftsman",
    tone: "casual",
    reading_level: "grade_5",
    system_prompt: "You are a hands-on builder who explains things simply. You use 'tool-belt' metaphors and focus on step-by-step clarity. You write for people who aren't afraid to get their hands dirty."
  },
  {
    name: "Luxury Travel Concierge",
    tone: "professional",
    reading_level: "grade_12",
    system_prompt: "You represent the pinnacle of high-end travel. Your language is sophisticated and sensory, focusing on exclusivity, fine dining, and hidden five-star gems around the globe."
  },
  {
    name: "The Devil's Advocate",
    tone: "controversial",
    reading_level: "grade_12",
    system_prompt: "Your job is to take the unpopular side of any argument to spark debate. You are logical but provocative, forcing readers to defend their assumptions through Socratic questioning."
  },
  {
    name: "Compassionate Medical Expert",
    tone: "empathetic",
    reading_level: "grade_8",
    system_prompt: "You explain complex health issues with warmth and clarity. You avoid jargon where possible and focus on the patient's emotional journey alongside their physical recovery."
  },
  {
    name: "The Cyberpunk Futurist",
    tone: "authoritative",
    reading_level: "grade_12",
    system_prompt: "You live on the edge of tomorrow. Your writing is neon-soaked, focusing on AI, transhumanism, and the intersection of biology and silicon. You write as if the future is already here."
  },
  {
    name: "Eco-Warrior Activist",
    tone: "enthusiastic",
    reading_level: "grade_8",
    system_prompt: "You are passionate about the planet. Your writing is urgent, call-to-action focused, and highlights the environmental impact of every industry. You advocate for radical sustainability."
  },
  {
    name: "Boutique Fashion Critic",
    tone: "humorous",
    reading_level: "grade_12",
    system_prompt: "You have a sharp eye for style and a sharper tongue. You critique runway trends with flair, focusing on aesthetic history and the 'cultural vibe' of current silhouettes."
  },
  {
    name: "Old-School Investigative Reporter",
    tone: "authoritative",
    reading_level: "grade_12",
    system_prompt: "You follow the money. Your writing is objective, dry, and relies on deep-dive 'leaked' info and interviews. You write in a classic 'inverted pyramid' newspaper style."
  },
  {
    name: "The Stoic Philosopher",
    tone: "authoritative",
    reading_level: "phd",
    system_prompt: "You apply ancient wisdom to modern problems. Your writing is brief, impactful, and focuses on what is within our control. You value virtue and reason over emotion."
  },
  {
    name: "Foodie Storyteller",
    tone: "enthusiastic",
    reading_level: "grade_8",
    system_prompt: "You don't just write recipes; you write memories. Your language is rich with taste, smell, and texture descriptions. You believe every meal tells a story of culture and family."
  },
  {
    name: "Direct-Response Copywriter",
    tone: "enthusiastic",
    reading_level: "grade_5",
    system_prompt: "You write for the sale. Your content is full of headlines, bullet points, and psychological triggers. You focus on pain points and the immediate benefits of a solution."
  },
  {
    name: "The Minimalist Architect",
    tone: "professional",
    reading_level: "grade_12",
    system_prompt: "You believe less is more. Your writing is clean, structured, and avoids all 'fluff.' You focus on the functional beauty of design and the clarity of open space."
  }
];
const settingsKeys = {
  all: ["settings"],
  ai: () => [...settingsKeys.all, "ai"],
  seoRules: () => [...settingsKeys.all, "seo-rules"],
  /**
   * Public-site profile — separate from the main settings query because
   * its lifecycle is independent (own GET/POST endpoints, own card,
   * different staleTime). Spec: `specs/site-identity-headless.md` §5.
   */
  publicSiteProfile: () => [...settingsKeys.all, "public-site-profile"]
};
const visualKeys = {
  all: ["visual"],
  config: () => [...visualKeys.all, "config"]
};
function readBootstrapSettings() {
  if (typeof window === "undefined") return void 0;
  const raw = window.structuraConfig?.bootstrap_settings;
  if (!raw || typeof raw !== "object") return void 0;
  return raw;
}
const useSettingsQuery = (select) => {
  const bootstrap = readBootstrapSettings();
  return useQuery({
    queryKey: settingsKeys.all,
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/settings" }),
    select,
    staleTime: 1e3 * 60 * 5,
    // Settings don't change often, cache for 5 mins
    // `initialData` skips the bootstrap roundtrip on first mount.
    // `initialDataUpdatedAt: 0` makes TanStack Query treat the
    // injected payload as "infinitely stale" — first render uses it
    // for paint, but a background revalidation fires immediately to
    // fill in the cloud-derived `ai.providers[id].connected` /
    // `masked_key` fields the PHP bootstrap can't populate.
    initialData: bootstrap,
    initialDataUpdatedAt: bootstrap ? 0 : void 0
  });
};
function deriveIsActivationValid(cloudStatus) {
  if (!cloudStatus) return null;
  if (cloudStatus.transport_error) return null;
  if (cloudStatus.activationStatus === "valid") return true;
  if (cloudStatus.activationStatus === "domain_not_activated") return false;
  if (cloudStatus.plan === null && cloudStatus.status === null) {
    return false;
  }
  return true;
}
function deriveHasAnonymousActivation(config) {
  if (!config) return false;
  return config.has_workspace === true && config.plan === "none";
}
function deriveProviderCountCap(config) {
  if (!config) return 3;
  return typeof config.provider_count_cap === "number" ? config.provider_count_cap : 3;
}
function resolveProviderCountCap(license, config) {
  if (typeof license?.provider_count_cap === "number") {
    return license.provider_count_cap;
  }
  return deriveProviderCountCap(config);
}
function resolveIsAnonymous(license, config) {
  if (typeof license?.is_anonymous === "boolean") {
    return license.is_anonymous;
  }
  return config?.is_anonymous === true;
}
const shouldVerifyLicenseWithCloud = (license) => Boolean(license?.license_key && !license.license_key.includes("*"));
const useLicense = () => {
  const queryClient2 = useQueryClient();
  const { data: license, isLoading: isSettingsLoading } = useSettingsQuery((s2) => s2.license);
  const { successToast, errorToast } = Mn();
  const isSyncing = window.wp.element.useRef(false);
  const hasKey = shouldVerifyLicenseWithCloud(license);
  const hasUsableLicense = isSettingsLoading ? null : hasKey;
  const hasAnonymousActivation = typeof window !== "undefined" ? deriveHasAnonymousActivation(window.structuraConfig ?? null) : false;
  const hasWorkspace = isSettingsLoading ? null : hasKey || hasAnonymousActivation;
  const isAnonymous = resolveIsAnonymous(
    license,
    typeof window !== "undefined" ? window.structuraConfig : null
  );
  const providerCountCap = resolveProviderCountCap(
    license,
    typeof window !== "undefined" ? window.structuraConfig : null
  );
  const { data: cloudStatus, isLoading: isCloudVerifying } = useQuery({
    queryKey: ["license-cloud-verify", license?.license_key],
    queryFn: async () => {
      if (!license?.license_key || license.license_key.includes("*")) return null;
      return window.wp.apiFetch({
        path: "/structura/v1/license/cloud-status",
        method: "POST"
      }).then((json) => {
        if (!json) return null;
        return {
          ...json,
          entitlements: json.entitlements ?? {},
          graceperiods: json.graceperiods ?? {}
        };
      });
    },
    // Any bound key verifies against the cloud — including FREE. This
    // used to be paid-gated ("Free has nothing to verify"), which was
    // true until portal-side upgrades existed: a free→paid upgrade made
    // at app.structurawp.com never reached wp-admin, because the ONLY
    // path that notices a plan change is this heartbeat feeding the
    // auto-sync effect below. Round-9 QA (2026-09-03) found a freshly
    // paid BYOK customer still seeing FREE everywhere. The old flicker
    // concern doesn't apply — every derived value falls back to the PHP
    // snapshot until the heartbeat settles (`cloudStatus?.plan ||
    // license?.plan`), so nothing degrades while pending.
    enabled: hasKey,
    staleTime: 1e3 * 60 * 60
    // 1 hour
  });
  const plan = cloudStatus?.plan || license?.plan || "none";
  const status = cloudStatus?.status || (license?.is_pro ? "active" : "none");
  const maxCampaigns = cloudStatus?.maxCampaigns !== void 0 ? cloudStatus.maxCampaigns : license?.max_campaigns !== void 0 ? license.max_campaigns : getMaxCampaignsForTier(plan);
  const isPaidLicense = cloudStatus ? cloudStatus.status === "active" && ["byok", "cloud", "cloud_pro"].includes(cloudStatus.plan ?? "") : Boolean(license?.is_pro) && ["byok", "cloud", "cloud_pro"].includes(license?.plan ?? "");
  const isLicensed = plan !== "none";
  const isActivationValid = deriveIsActivationValid(cloudStatus ?? null);
  window.wp.element.useEffect(() => {
    if (!cloudStatus) return;
    if (cloudStatus.transport_error) return;
    if (cloudStatus.status !== "active") return;
    const cloudPlan = cloudStatus.plan;
    if (!cloudPlan) return;
    if (cloudPlan === license?.plan) return;
    if (isSyncing.current) return;
    isSyncing.current = true;
    window.wp.apiFetch({
      path: "/structura/v1/license/sync",
      method: "POST",
      data: { plan: cloudPlan }
    }).then(() => {
      queryClient2.invalidateQueries({ queryKey: settingsKeys.all });
      successToast(window.wp.i18n.sprintf(window.wp.i18n.__('Plan synchronized: "%s".', "structura"), cloudPlan));
    }).finally(() => {
      isSyncing.current = false;
    });
  }, [
    cloudStatus,
    cloudStatus?.plan,
    cloudStatus?.status,
    cloudStatus?.transport_error,
    license?.plan,
    queryClient2,
    successToast
  ]);
  window.wp.element.useEffect(() => {
    if (cloudStatus?.status && cloudStatus.status !== "active" && cloudStatus.status !== "none") {
      errorToast(cloudStatus.message || window.wp.i18n.__("Your license is no longer active.", "structura"));
    }
  }, [cloudStatus?.status, cloudStatus?.message, errorToast]);
  const invalidate = () => {
    queryClient2.invalidateQueries();
  };
  const activateMutation = useMutation({
    mutationFn: (key) => window.wp.apiFetch({
      path: "/structura/v1/license/activate",
      method: "POST",
      data: { key }
    }),
    onSuccess: () => {
      successToast(window.wp.i18n.__("Pro features unlocked!", "structura"));
      invalidate();
    }
  });
  const deactivateMutation = useMutation({
    // `purge` opts into a hard remove (delete the cloud activation, and the
    // workspace if it's the last site) instead of a reversible disconnect.
    mutationFn: (opts) => window.wp.apiFetch({
      path: "/structura/v1/license/deactivate",
      method: "POST",
      data: { purge: opts?.purge ?? false }
    }),
    onSuccess: (_data, opts) => {
      successToast(
        opts?.purge ? window.wp.i18n.__("Site removed.", "structura") : window.wp.i18n.__("License deactivated.", "structura")
      );
      invalidate();
    }
  });
  const isPro = license?.is_pro;
  const maskedKey = license?.license_key ? `${license.license_key.substring(0, 8)}***********${license.license_key.slice(-4)}` : "";
  return {
    isPaidLicense,
    isLicensed,
    /**
     * Tri-state license-presence gate for cloud-backed query hooks.
     * See the `hasUsableLicense` derivation above. Consumers should
     * use this on the `enabled` option of any TanStack Query that
     * eventually hits a cloud-backed endpoint:
     *
     *   const { hasUsableLicense } = useLicense();
     *   useQuery({ enabled: hasUsableLicense === true, ... });
     *
     * Treat `null` as "not yet known — don't fire" and `false` as
     * "no license bound — render the disconnected empty state."
     */
    hasUsableLicense,
    /**
     * Tri-state workspace-presence gate — Phase 1.8 §1.8.4.
     * Superset of `hasUsableLicense` that also accepts anonymous
     * shadow workspaces. See the derivation comment above for the
     * gating-table guidance. Use on `enabled:` for cloud-backed
     * query hooks whose surface is workspace-scoped (personas, AI
     * keys, available models, etc.):
     *
     *   const { hasWorkspace } = useLicense();
     *   useQuery({ enabled: hasWorkspace === true, ... });
     *
     * Surfaces that stay paid-only (campaigns, runs, dashboard
     * analytics, channels, visual presets) keep gating on
     * `hasUsableLicense`.
     */
    hasWorkspace,
    /**
     * True when the active workspace is anonymous (bootstrapped via
     * Phase 1.8 — bearer bound but no license). Drives the AI Engine
     * page's provider count cap + Anthropic-locked teaser, and the
     * Visuals page's permanent unlicensed teaser on `none` tier.
     */
    isAnonymous,
    /**
     * Maximum number of AI providers the user can configure
     * simultaneously at the calling tier. Phase 1.8 §1.8.4 + the
     * feature matrix in §Phase 1.8. Drives the AI Engine page's
     * "add provider" CTA gating and the visibility of the
     * default-for-text/images toggles (hidden when cap === 1).
     */
    providerCountCap,
    /**
     * Whether `window.location.hostname` is a registered activation of
     * this license, derived from the `checkLicenseStatus` heartbeat.
     * See the derivation comment above — in short: `null` while pending
     * or for unpaid users (no heartbeat), `false` for a confirmed host
     * mismatch (DDEV → ngrok, staging → prod hostname), `true` otherwise.
     * Consumers of activation-secret gated endpoints (e.g. Channels)
     * should gate their queries on `isActivationValid !== false` and
     * render an inline advisory when it's `false`.
     */
    isActivationValid,
    plan,
    /**
     * Per-activation campaign cap, already resolved through cloud →
     * PHP cache → tier fallback. `null` = unlimited. Drives the
     * CampaignsPage "X of Y" chip and the at-cap disabled state on
     * the New Campaign button — consumers should NOT re-resolve from
     * tier (the cap is per-license now, not per-tier).
     */
    maxCampaigns,
    // Mirrors the derived `status` above — PHP `is_pro` flag is the
    // first-paint fallback so consumers (LicenseStatusBanner, plan
    // badges, gating predicates) don't see "none" flicker through
    // before the cloud query settles.
    status,
    license: { ...license, masked_key: maskedKey },
    cloudStatus,
    /**
     * Per-add-on seat budgets + current-site assignment view, from the
     * cloud's `checkLicenseStatus` heartbeat (spec §11.6). Empty object
     * when cloudStatus isn't loaded yet — callers should treat absence
     * of a key as "license not entitled to this add-on".
     */
    entitlements: cloudStatus?.entitlements ?? {},
    /**
     * Currently-open grace periods keyed by add-on. Empty object when
     * cloudStatus isn't loaded yet. Absence of a key means no open
     * grace (the common case).
     */
    graceperiods: cloudStatus?.graceperiods ?? {},
    /**
     * Phase 3.7 — workspace summary surfaced by the heartbeat. Drives
     * the "this site is part of workspace X" indicator the AccountPage
     * shows when `activationsCount > 1`. `null` for single-activation
     * workspaces (the common case at v1) and for clouds that predate
     * Phase 3.7. Consumers should always null-check before reading.
     */
    workspace: cloudStatus?.workspace ?? null,
    loading: isSettingsLoading,
    /**
     * True while the entitlement-bearing cloud heartbeat is still in
     * flight for a paid license. `entitlements.*` (and `audience`,
     * `isActivationValid`, etc.) live ONLY on this heartbeat, not on the
     * fast-resolving PHP settings query that `loading` tracks — so any
     * gate that reads an entitlement must wait on this too. Otherwise it
     * sees `entitlements = {}` during the settings-loaded-but-cloud-
     * pending window and wrongly concludes "not entitled."
     *
     * The heartbeat is `enabled: !!license?.is_pro && hasKey`, so this is
     * `false` for Free / anonymous installs (query disabled → no hang)
     * and only meaningful for paid licensees. See the channels-route
     * guard in App.tsx, which would otherwise fire its `/channels/*` →
     * `/` redirect before the heartbeat could confirm the entitlement.
     */
    entitlementsLoading: isCloudVerifying,
    processing: activateMutation.isPending || deactivateMutation.isPending,
    activate: activateMutation.mutateAsync,
    deactivate: deactivateMutation.mutateAsync,
    gateProps: (featureName, level = "free") => {
      const hasAccess = level === "byok" ? isPro : isLicensed;
      const message = !isLicensed ? window.wp.i18n.__("Register for a Free Account to unlock %s", "structura") : window.wp.i18n.__("Upgrade to Pro to unlock %s", "structura");
      return {
        disabled: !hasAccess,
        title: !hasAccess ? window.wp.i18n.sprintf(message, featureName) : void 0
      };
    }
  };
};
const PulseDiagnostics = ({ autoRun = false }) => {
  const { hasWorkspace, hasUsableLicense } = useLicense();
  const canDiagnose = hasWorkspace === true;
  const { mutate: handleTest, isPending, status } = usePulseCheck();
  const [isTestingError, setIsTestingError] = window.wp.element.useState(false);
  const autoRanRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (autoRanRef.current || !autoRun) return;
    if (!canDiagnose || isPending) return;
    autoRanRef.current = true;
    handleTest();
  }, [autoRun, canDiagnose, isPending, handleTest]);
  const handleTestError = async () => {
    setIsTestingError(true);
    try {
      await window.wp.apiFetch({ path: "/structura/v1/pulse/test-error", method: "POST" });
      An.success(
        hasUsableLicense ? window.wp.i18n.__(
          "Test signal sent — your site verified it. A test notice will appear in Notifications shortly.",
          "structura"
        ) : window.wp.i18n.__("Test signal sent — your site verified the signed-error handshake.", "structura")
      );
    } catch (e2) {
      An.error(window.wp.i18n.__("Failed to trigger simulation.", "structura"));
    } finally {
      setIsTestingError(false);
    }
  };
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden p-0! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-start justify-between gap-6 p-6 md:flex-row md:items-center md:p-8" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "rounded-xl p-3 transition-colors duration-normal",
        isPending || isTestingError ? "animate-pulse bg-brand-100" : "bg-brand-50 dark:bg-brand-950/30",
        "text-brand-600 ring-1 ring-brand-100 dark:text-brand-400 dark:ring-brand-900/50"
      )
    },
    isPending || isTestingError ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 24, className: "animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Activity, { size: 24 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, window.wp.i18n.__("Bridge Diagnostics", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-sm text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("Test the secure handshake with Structura Cloud nodes.", "structura")))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => handleTest(),
      disabled: isPending || isTestingError || !canDiagnose,
      className: "text-emerald-700! dark:text-emerald-400!"
    },
    isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-2 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { size: 14, className: "mr-2" }),
    isPending ? window.wp.i18n.__("Handshaking...", "structura") : window.wp.i18n.__("Run Pulse Check", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: handleTestError,
      disabled: isPending || isTestingError || !canDiagnose
    },
    isTestingError ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-2 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(BellRing, { size: 14, className: "mr-2" }),
    isTestingError ? window.wp.i18n.__("Sending...", "structura") : window.wp.i18n.__("Send Test Notification", "structura")
  ))), (status === "success" || status === "error") && /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "flex items-center gap-2 border-t px-6 py-3 text-[11px] font-bold",
        status === "success" ? "border-emerald-100 bg-emerald-50/50 text-emerald-700 dark:border-emerald-900/30 dark:bg-emerald-950/10 dark:text-emerald-400" : "border-red-100 bg-red-50/50 text-red-700 dark:border-red-900/30 dark:bg-red-950/10 dark:text-red-400"
      )
    },
    status === "success" ? /* @__PURE__ */ window.wp.element.createElement(ShieldCheck, { size: 14 }) : /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 14 }),
    status === "success" ? window.wp.i18n.__("Handshake Verified: Bi-directional trust active.", "structura") : window.wp.i18n.__("Bridge Interrupted: Verify your firewall/REST API.", "structura")
  ));
};
const PageTitle = ({ children }) => {
  return /* @__PURE__ */ window.wp.element.createElement("h1", { className: "mt-0! mb-1! text-2xl font-bold tracking-tight text-neutral-900 dark:text-white" }, children);
};
const PageDescription = ({ children }) => {
  return /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-medium tracking-widest text-neutral-500 uppercase dark:text-neutral-400" }, children);
};
const VARIANT_CLASSES = {
  wide: "w-full",
  narrow: "mx-auto w-full max-w-4xl"
};
const PageContainer = ({
  variant = "wide",
  className,
  children,
  ...rest
}) => {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1(VARIANT_CLASSES[variant], className), ...rest }, children);
};
const scriptRel = "modulepreload";
const assetsURL = function(dep) {
  return "/" + dep;
};
const seen = {};
const __vitePreload = function preload(baseModule, deps, importerUrl) {
  let promise = Promise.resolve();
  if (deps && deps.length > 0) {
    let allSettled2 = function(promises$2) {
      return Promise.all(promises$2.map((p2) => Promise.resolve(p2).then((value$1) => ({
        status: "fulfilled",
        value: value$1
      }), (reason) => ({
        status: "rejected",
        reason
      }))));
    };
    var allSettled = allSettled2;
    document.getElementsByTagName("link");
    const cspNonceMeta = document.querySelector("meta[property=csp-nonce]");
    const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce");
    promise = allSettled2(deps.map((dep) => {
      dep = assetsURL(dep);
      if (dep in seen) return;
      seen[dep] = true;
      const isCss = dep.endsWith(".css");
      const cssSelector = isCss ? '[rel="stylesheet"]' : "";
      if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) return;
      const link = document.createElement("link");
      link.rel = isCss ? "stylesheet" : scriptRel;
      if (!isCss) link.as = "script";
      link.crossOrigin = "";
      link.href = dep;
      if (cspNonce) link.setAttribute("nonce", cspNonce);
      document.head.appendChild(link);
      if (isCss) return new Promise((res, rej) => {
        link.addEventListener("load", res);
        link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`)));
      });
    }));
  }
  function handlePreloadError(err$2) {
    const e$12 = new Event("vite:preloadError", { cancelable: true });
    e$12.payload = err$2;
    window.dispatchEvent(e$12);
    if (!e$12.defaultPrevented) throw err$2;
  }
  return promise.then((res) => {
    for (const item of res || []) {
      if (item.status !== "rejected") continue;
      handlePreloadError(item.reason);
    }
    return baseModule().catch(handlePreloadError);
  });
};
const PRIVACY_QUERY_KEY = ["privacy", "consent"];
function getRestConfig() {
  const restUrl = typeof window !== "undefined" && window.structuraConfig?.rest_url || "/wp-json/";
  const nonce = typeof window !== "undefined" && window.structuraConfig?.nonce || "";
  return {
    restUrl: restUrl.replace(/\/$/, ""),
    nonce
  };
}
async function fetchPrivacyConsent() {
  const { restUrl, nonce } = getRestConfig();
  const response = await fetch(`${restUrl}/structura/v1/privacy/consent`, {
    headers: { "X-WP-Nonce": nonce }
  });
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}`);
  }
  return await response.json();
}
async function postPrivacyConsent(telemetryEnabled) {
  const { restUrl, nonce } = getRestConfig();
  const response = await fetch(`${restUrl}/structura/v1/privacy/consent`, {
    method: "POST",
    headers: {
      "X-WP-Nonce": nonce,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ telemetryEnabled })
  });
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}`);
  }
  return await response.json();
}
function notifyConsumers(telemetryEnabled) {
  if (typeof window === "undefined") return;
  void __vitePreload(async () => {
    const { setConsented: setConsented2 } = await Promise.resolve().then(() => posthog);
    return { setConsented: setConsented2 };
  }, true ? [] : void 0).then(({ setConsented: setConsented2 }) => {
    setConsented2(telemetryEnabled);
  });
}
function usePrivacyConsent() {
  return useQuery({
    queryKey: PRIVACY_QUERY_KEY,
    queryFn: fetchPrivacyConsent
  });
}
function useUpdatePrivacyConsent() {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: postPrivacyConsent,
    onSuccess: (state) => {
      queryClient2.setQueryData(PRIVACY_QUERY_KEY, state);
      notifyConsumers(state.telemetryEnabled);
    }
  });
}
async function postCloudConsent() {
  const { restUrl, nonce } = getRestConfig();
  const response = await fetch(`${restUrl}/structura/v1/privacy/cloud-consent`, {
    method: "POST",
    headers: {
      "X-WP-Nonce": nonce,
      "Content-Type": "application/json"
    }
  });
  if (!response.ok) {
    throw new Error(`HTTP ${response.status}`);
  }
  return await response.json();
}
function useGrantCloudConsent() {
  return useMutation({ mutationFn: postCloudConsent });
}
let initPromise = null;
let consented = false;
function readConfig() {
  if (typeof window === "undefined") return null;
  const cfg = window.structuraConfig;
  if (!cfg) return null;
  const key = cfg.posthog_key;
  const host = cfg.posthog_host ?? "https://p.structurawp.com";
  if (!key) return null;
  return { key, host, cfg };
}
function loadPostHog() {
  if (initPromise) return initPromise;
  const conf = readConfig();
  if (!conf) return Promise.resolve(null);
  initPromise = __vitePreload(async () => {
    const { default: posthog2 } = await import("./assets/module-JzzXXoXP.js");
    return { default: posthog2 };
  }, true ? [] : void 0).then(({ default: posthog2 }) => {
    posthog2.init(conf.key, {
      api_host: conf.host,
      // Correct PostHog-app URL for toolbar/UI links whenever `conf.host`
      // is a reverse proxy. Harmless on the direct US-cloud default (the
      // SDK would derive the same value).
      ui_host: "https://us.posthog.com",
      // Pin the SDK's config-defaults generation so a future posthog-js
      // upgrade can't silently flip behavior. The options we care about
      // (pageview/autocapture/person_profiles) are set explicitly below
      // and always win over the generation's defaults.
      defaults: "2026-01-30",
      // We control the opt state ourselves via setConsented(), but the
      // default-deny here is belt-and-suspenders in case the loaded
      // callback ever races with a consent flip.
      opt_out_capturing_by_default: true,
      capture_pageview: false,
      capture_pageleave: true,
      autocapture: false,
      person_profiles: "identified_only",
      persistence: "localStorage+cookie",
      loaded: (ph) => {
        const distinct = conf.cfg.license_key || `wp-install:${conf.cfg.site_url ?? "unknown"}`;
        ph.identify(distinct, {
          site_url: conf.cfg.site_url,
          plugin_version: conf.cfg.plugin_version
        });
        if (consented) ph.opt_in_capturing();
      }
    });
    window.posthog = posthog2;
    return posthog2;
  });
  return initPromise;
}
async function setConsented(next) {
  consented = next;
  if (!next) {
    const ph2 = window.posthog;
    ph2?.opt_out_capturing();
    return;
  }
  const ph = await loadPostHog();
  ph?.opt_in_capturing();
}
function capture(event, properties) {
  if (typeof window === "undefined") return;
  const ph = window.posthog;
  if (!ph) return;
  try {
    ph.capture(event, properties);
  } catch {
  }
}
const posthog = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  capture,
  setConsented
}, Symbol.toStringTag, { value: "Module" }));
const PrivacyTelemetryCard = () => {
  const { data, isLoading } = usePrivacyConsent();
  const updateConsent = useUpdatePrivacyConsent();
  const telemetryEnabled = data?.telemetryEnabled ?? false;
  const choseAt = data?.choseAt ?? null;
  const isUpdating = updateConsent.isPending;
  const handleToggle = async (next) => {
    try {
      await updateConsent.mutateAsync(next);
      capture("privacy_consent_changed", { telemetry_enabled: next });
      An.success(
        next ? window.wp.i18n.__(
          "Anonymous usage data sharing enabled. Thanks for helping us improve Structura.",
          "structura"
        ) : window.wp.i18n.__("Anonymous usage data sharing disabled.", "structura")
      );
    } catch {
      An.error(
        window.wp.i18n.__("Could not save your privacy preference. Please try again.", "structura")
      );
    }
  };
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "h-5 w-5 animate-spin" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("Loading privacy preferences...", "structura"))));
  }
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-8 flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Shield, { className: "text-brand-500 h-5 w-5" }), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, window.wp.i18n.__("Privacy & Telemetry", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-6 max-w-2xl text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Help us improve Structura by sharing anonymous usage data. We use PostHog (United States) to understand which features you actually reach for and where the plugin trips users up. No content from your campaigns or from your site visitors' browsers is sent.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement(
    Xa,
    {
      label: window.wp.i18n.__("Share anonymous usage data", "structura"),
      hiddenLabel: true,
      id: "telemetry-enabled",
      checked: telemetryEnabled,
      onChange: (val) => handleToggle(val),
      className: "mt-1",
      disabled: isUpdating
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: `flex flex-col gap-1 ${isUpdating ? "" : "cursor-pointer"}`,
      onClick: () => {
        if (!isUpdating) handleToggle(!telemetryEnabled);
      }
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300" }, window.wp.i18n.__("Share anonymous usage data", "structura")),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "max-w-2xl text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
      "Records anonymous events about plugin features (campaign runs, channel publishes, settings changes). Tied to your license activation, never to your site visitors. Off by default; you can toggle this any time.",
      "structura"
    )),
    choseAt && /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-brand-600 dark:text-brand-400 mt-1 text-xs font-medium" }, window.wp.i18n.sprintf(
      // translators: %s is a localized date when the admin recorded their choice.
      window.wp.i18n.__("Your choice was recorded on %s.", "structura"),
      new Date(choseAt * 1e3).toLocaleDateString()
    ))
  )));
};
const useRunDiagnostics = () => {
  const qc = useQueryClient();
  return useMutation({
    mutationFn: async () => {
      return window.wp.apiFetch({
        path: "/structura/v1/diagnostics/run",
        method: "POST"
      });
    },
    onSuccess: () => {
      qc.invalidateQueries({ queryKey: ["notices"] });
    }
  });
};
const DiagnosticsCard = () => {
  const runDiagnostics = useRunDiagnostics();
  const [lastRun, setLastRun] = window.wp.element.useState(null);
  const onRun = async () => {
    try {
      const result = await runDiagnostics.mutateAsync();
      const findingsCount = result.findings.length;
      setLastRun({ checksRun: result.checksRun, findingsCount });
      if (findingsCount === 0) {
        An.success(
          window.wp.i18n.__("Diagnostics complete — no issues found.", "structura")
        );
      } else {
        An.success(
          window.wp.i18n.sprintf(
            // translators: %d is the number of issues found by the diagnostics run.
            window.wp.i18n.__(
              "Diagnostics complete — %d issue(s) reported to Notifications.",
              "structura"
            ),
            findingsCount
          )
        );
      }
    } catch (err) {
      An.error(
        err?.message || window.wp.i18n.__("Diagnostics failed — please try again.", "structura")
      );
    }
  };
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-8 flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Activity, { className: "text-brand-500 h-5 w-5" }), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, window.wp.i18n.__("Diagnostics", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "max-w-2xl" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-gray-700 dark:text-gray-300" }, window.wp.i18n.__("Run a health check on this site", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Looks for WP-Cron problems, an outdated plugin version, and known compatibility issues. Any findings are reported to your Notifications so you can act on them from one place.",
    "structura"
  )), lastRun ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-3! mb-0! text-xs text-gray-500 dark:text-gray-400" }, lastRun.findingsCount === 0 ? window.wp.i18n.sprintf(
    // translators: %d is the number of checks that ran.
    window.wp.i18n.__("Last run: %d checks, no issues.", "structura"),
    lastRun.checksRun
  ) : window.wp.i18n.sprintf(
    // translators: %1$d checks run, %2$d issues found.
    window.wp.i18n.__(
      "Last run: %1$d checks, %2$d issue(s) reported.",
      "structura"
    ),
    lastRun.checksRun,
    lastRun.findingsCount
  )) : null), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: onRun,
      disabled: runDiagnostics.isPending
    },
    runDiagnostics.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "mr-1.5 h-4 w-4 animate-spin", "aria-hidden": true }) : /* @__PURE__ */ window.wp.element.createElement(Activity, { className: "mr-1.5 h-4 w-4", "aria-hidden": true }),
    runDiagnostics.isPending ? window.wp.i18n.__("Running…", "structura") : window.wp.i18n.__("Run diagnostics", "structura")
  )));
};
const SettingsPage = () => {
  const { data: initialData, isLoading } = useSettingsQuery((s2) => s2.general);
  const { updateSettings, isUpdating } = useSettingsMutations();
  const [searchParams] = useSearchParams();
  const autoRunCheck = searchParams.get("run") === "connection-check";
  const pulseRef = window.wp.element.useRef(null);
  window.wp.element.useEffect(() => {
    if (autoRunCheck) {
      pulseRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
    }
  }, [autoRunCheck]);
  const [draft, setDraft] = window.wp.element.useState({
    delete_data_on_uninstall: false
  });
  window.wp.element.useEffect(() => {
    if (initialData) {
      setDraft({
        delete_data_on_uninstall: initialData.delete_data_on_uninstall
      });
    }
  }, [initialData]);
  const handleChange = (key, value) => {
    setDraft((prev) => ({ ...prev, [key]: value }));
  };
  const handleSave = async () => {
    await updateSettings({ slice: "general", data: draft });
  };
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Syncing preferences…", "structura"), size: "lg", padding: "lg" });
  }
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "mb-10 flex flex-col justify-between gap-6 md:flex-row md:items-center" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("General Settings", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Global Architecture Control.", "structura"))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: handleSave, disabled: isUpdating }, isUpdating ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Save, { className: "mr-2 h-4 w-4" }), isUpdating ? window.wp.i18n.__("Syncing...", "structura") : window.wp.i18n.__("Save Changes", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { ref: pulseRef }, /* @__PURE__ */ window.wp.element.createElement(PulseDiagnostics, { autoRun: autoRunCheck })), /* @__PURE__ */ window.wp.element.createElement(Vt, { variant: "danger", className: "p-8!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-8 flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(ShieldAlert, { className: "h-5 w-5 text-red-500" }), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, window.wp.i18n.__("Data Persistence", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement(
    Xa,
    {
      label: window.wp.i18n.__("Wipe all data on uninstall", "structura"),
      hiddenLabel: true,
      id: "wipe-data",
      checked: draft.delete_data_on_uninstall,
      onChange: (val) => handleChange("delete_data_on_uninstall", val),
      className: "mt-1"
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: "flex cursor-pointer flex-col gap-1",
      onClick: () => handleChange("delete_data_on_uninstall", !draft.delete_data_on_uninstall)
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-semibold text-gray-700 dark:text-gray-300" }, window.wp.i18n.__("Wipe all data on uninstall", "structura")),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "max-w-2xl text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
      "If enabled, deleting the plugin will permanently remove all Campaigns and Personas from your WordPress database. Keep this disabled if you plan to reinstall later or migrate.",
      "structura"
    ))
  ))), /* @__PURE__ */ window.wp.element.createElement(PrivacyTelemetryCard, null), /* @__PURE__ */ window.wp.element.createElement(DiagnosticsCard, null));
};
const PORTAL_BASE_URL = "https://app.structurawp.com";
function buildPortalSignupUrl(args) {
  const params = new URLSearchParams();
  params.set("intent", args.intent);
  params.set("source", "plugin");
  if (args.domain) params.set("domain", args.domain);
  if (args.plan) params.set("plan", args.plan);
  if (args.providerId) params.set("provider", args.providerId);
  if (args.fromProviderId) params.set("from_provider", args.fromProviderId);
  if (args.returnTo) params.set("returnTo", args.returnTo);
  return `${PORTAL_BASE_URL}/?${params.toString()}`;
}
const MARKETING_BASE_URL = "https://www.structurawp.com";
function resolveMarketingLocale(raw) {
  if (!raw) return "en";
  const base = raw.toLowerCase().split(/[_-]/, 1)[0];
  if (base === "de" || base === "es" || base === "fr") return base;
  return "en";
}
function readCurrentLocale() {
  if (typeof document === "undefined") return null;
  return document.documentElement.lang || null;
}
function buildMarketingPricingUrl(args) {
  const locale = resolveMarketingLocale(
    args.locale === void 0 ? readCurrentLocale() : args.locale
  );
  const params = new URLSearchParams();
  params.set("intent", args.intent);
  params.set("source", "plugin");
  if (args.domain) params.set("domain", args.domain);
  if (args.plan) params.set("plan", args.plan);
  if (args.suggest) params.set("suggest", args.suggest);
  if (args.returnTo) params.set("returnTo", args.returnTo);
  const anchor = args.anchor ? sanitizePricingAnchor(args.anchor) : "";
  return `${MARKETING_BASE_URL}/${locale}/pricing?${params.toString()}${anchor}`;
}
function sanitizePricingAnchor(raw) {
  const trimmed = raw.replace(/^#+/, "");
  return trimmed ? `#${trimmed}` : "";
}
const PROVIDER_LABELS$2 = {
  gemini: "Gemini",
  openai: "OpenAI",
  anthropic: "Claude"
};
const providerLabel = (provider) => {
  if (!provider) return window.wp.i18n.__("the AI provider", "structura");
  return PROVIDER_LABELS$2[provider] ?? provider;
};
function humanizeSuggestionError(error) {
  const e2 = error ?? {};
  const code = e2.data?.code;
  const provider = e2.data?.provider;
  if (code === "provider_transient") {
    return window.wp.i18n.sprintf(
      /* translators: %s: AI provider label, e.g. "Gemini" */
      window.wp.i18n.__(
        "%s is experiencing high demand right now. Try again in a moment, or pick a different provider in Settings.",
        "structura"
      ),
      providerLabel(provider)
    );
  }
  if (code === "provider_error") {
    return window.wp.i18n.sprintf(
      /* translators: %s: AI provider label, e.g. "OpenAI" */
      window.wp.i18n.__(
        "%s couldn't complete the request. Check your API key and provider setup, or try a different provider.",
        "structura"
      ),
      providerLabel(provider)
    );
  }
  if (typeof e2.message === "string" && e2.message.length > 0) {
    return e2.message;
  }
  if (typeof e2.data?.message === "string" && e2.data.message.length > 0) {
    return e2.data.message;
  }
  return window.wp.i18n.__("Something went wrong reaching the AI service. Please try again.", "structura");
}
const useMagicSuggest = () => {
  const [isSuggesting, setIsSuggesting] = window.wp.element.useState(false);
  const { errorToast } = Mn();
  const { isPaidLicense } = useLicense();
  const suggest = async (mode, options) => {
    if (!isPaidLicense) return null;
    setIsSuggesting(true);
    try {
      const response = await window.wp.apiFetch({
        path: "/structura/v1/suggest",
        method: "POST",
        data: {
          mode,
          provider: options.provider,
          context: options.context || [],
          ...options.medium ? { medium: options.medium } : {}
        }
      });
      const data = response.result ?? response;
      if (data?.error) {
        throw new Error(data.error);
      }
      if (!data) {
        throw new Error(window.wp.i18n.__("The AI returned an empty blueprint.", "structura"));
      }
      return data;
    } catch (e2) {
      errorToast(humanizeSuggestionError(e2));
      return null;
    } finally {
      setIsSuggesting(false);
    }
  };
  return { suggest, isSuggesting };
};
var dayjs_min$1 = { exports: {} };
var dayjs_min = dayjs_min$1.exports;
var hasRequiredDayjs_min;
function requireDayjs_min() {
  if (hasRequiredDayjs_min) return dayjs_min$1.exports;
  hasRequiredDayjs_min = 1;
  (function(module, exports$1) {
    !(function(t2, e2) {
      module.exports = e2();
    })(dayjs_min, (function() {
      var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a3 = "day", o4 = "week", c2 = "month", f2 = "quarter", h4 = "year", d2 = "date", l2 = "Invalid Date", $2 = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|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, M2 = { 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(t3) {
        var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
        return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
      } }, m3 = function(t3, e3, n3) {
        var r3 = String(t3);
        return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
      }, v2 = { s: m3, z: function(t3) {
        var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
        return (e3 <= 0 ? "+" : "-") + m3(r3, 2, "0") + ":" + m3(i3, 2, "0");
      }, m: function t3(e3, n3) {
        if (e3.date() < n3.date()) return -t3(n3, e3);
        var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u3 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
        return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0);
      }, a: function(t3) {
        return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
      }, p: function(t3) {
        return { M: c2, y: h4, w: o4, d: a3, D: d2, h: u2, m: s2, s: i2, ms: r2, Q: f2 }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
      }, u: function(t3) {
        return void 0 === t3;
      } }, g2 = "en", D2 = {};
      D2[g2] = M2;
      var p2 = "$isDayjsObject", S2 = function(t3) {
        return t3 instanceof _2 || !(!t3 || !t3[p2]);
      }, w2 = function t3(e3, n3, r3) {
        var i3;
        if (!e3) return g2;
        if ("string" == typeof e3) {
          var s3 = e3.toLowerCase();
          D2[s3] && (i3 = s3), n3 && (D2[s3] = n3, i3 = s3);
          var u3 = e3.split("-");
          if (!i3 && u3.length > 1) return t3(u3[0]);
        } else {
          var a4 = e3.name;
          D2[a4] = e3, i3 = a4;
        }
        return !r3 && i3 && (g2 = i3), i3 || !r3 && g2;
      }, O2 = function(t3, e3) {
        if (S2(t3)) return t3.clone();
        var n3 = "object" == typeof e3 ? e3 : {};
        return n3.date = t3, n3.args = arguments, new _2(n3);
      }, b2 = v2;
      b2.l = w2, b2.i = S2, b2.w = function(t3, e3) {
        return O2(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
      };
      var _2 = (function() {
        function M3(t3) {
          this.$L = w2(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p2] = true;
        }
        var m4 = M3.prototype;
        return m4.parse = function(t3) {
          this.$d = (function(t4) {
            var e3 = t4.date, n3 = t4.utc;
            if (null === e3) return /* @__PURE__ */ new Date(NaN);
            if (b2.u(e3)) return /* @__PURE__ */ new Date();
            if (e3 instanceof Date) return new Date(e3);
            if ("string" == typeof e3 && !/Z$/i.test(e3)) {
              var r3 = e3.match($2);
              if (r3) {
                var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
                return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
              }
            }
            return new Date(e3);
          })(t3), this.init();
        }, m4.init = function() {
          var t3 = this.$d;
          this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
        }, m4.$utils = function() {
          return b2;
        }, m4.isValid = function() {
          return !(this.$d.toString() === l2);
        }, m4.isSame = function(t3, e3) {
          var n3 = O2(t3);
          return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
        }, m4.isAfter = function(t3, e3) {
          return O2(t3) < this.startOf(e3);
        }, m4.isBefore = function(t3, e3) {
          return this.endOf(e3) < O2(t3);
        }, m4.$g = function(t3, e3, n3) {
          return b2.u(t3) ? this[e3] : this.set(n3, t3);
        }, m4.unix = function() {
          return Math.floor(this.valueOf() / 1e3);
        }, m4.valueOf = function() {
          return this.$d.getTime();
        }, m4.startOf = function(t3, e3) {
          var n3 = this, r3 = !!b2.u(e3) || e3, f3 = b2.p(t3), l3 = function(t4, e4) {
            var i3 = b2.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
            return r3 ? i3 : i3.endOf(a3);
          }, $3 = function(t4, e4) {
            return b2.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
          }, y3 = this.$W, M4 = this.$M, m5 = this.$D, v3 = "set" + (this.$u ? "UTC" : "");
          switch (f3) {
            case h4:
              return r3 ? l3(1, 0) : l3(31, 11);
            case c2:
              return r3 ? l3(1, M4) : l3(0, M4 + 1);
            case o4:
              var g3 = this.$locale().weekStart || 0, D3 = (y3 < g3 ? y3 + 7 : y3) - g3;
              return l3(r3 ? m5 - D3 : m5 + (6 - D3), M4);
            case a3:
            case d2:
              return $3(v3 + "Hours", 0);
            case u2:
              return $3(v3 + "Minutes", 1);
            case s2:
              return $3(v3 + "Seconds", 2);
            case i2:
              return $3(v3 + "Milliseconds", 3);
            default:
              return this.clone();
          }
        }, m4.endOf = function(t3) {
          return this.startOf(t3, false);
        }, m4.$set = function(t3, e3) {
          var n3, o5 = b2.p(t3), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n3 = {}, n3[a3] = f3 + "Date", n3[d2] = f3 + "Date", n3[c2] = f3 + "Month", n3[h4] = f3 + "FullYear", n3[u2] = f3 + "Hours", n3[s2] = f3 + "Minutes", n3[i2] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o5], $3 = o5 === a3 ? this.$D + (e3 - this.$W) : e3;
          if (o5 === c2 || o5 === h4) {
            var y3 = this.clone().set(d2, 1);
            y3.$d[l3]($3), y3.init(), this.$d = y3.set(d2, Math.min(this.$D, y3.daysInMonth())).$d;
          } else l3 && this.$d[l3]($3);
          return this.init(), this;
        }, m4.set = function(t3, e3) {
          return this.clone().$set(t3, e3);
        }, m4.get = function(t3) {
          return this[b2.p(t3)]();
        }, m4.add = function(r3, f3) {
          var d3, l3 = this;
          r3 = Number(r3);
          var $3 = b2.p(f3), y3 = function(t3) {
            var e3 = O2(l3);
            return b2.w(e3.date(e3.date() + Math.round(t3 * r3)), l3);
          };
          if ($3 === c2) return this.set(c2, this.$M + r3);
          if ($3 === h4) return this.set(h4, this.$y + r3);
          if ($3 === a3) return y3(1);
          if ($3 === o4) return y3(7);
          var M4 = (d3 = {}, d3[s2] = e2, d3[u2] = n2, d3[i2] = t2, d3)[$3] || 1, m5 = this.$d.getTime() + r3 * M4;
          return b2.w(m5, this);
        }, m4.subtract = function(t3, e3) {
          return this.add(-1 * t3, e3);
        }, m4.format = function(t3) {
          var e3 = this, n3 = this.$locale();
          if (!this.isValid()) return n3.invalidDate || l2;
          var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b2.z(this), s3 = this.$H, u3 = this.$m, a4 = this.$M, o5 = n3.weekdays, c3 = n3.months, f3 = n3.meridiem, h5 = function(t4, n4, i4, s4) {
            return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
          }, d3 = function(t4) {
            return b2.s(s3 % 12 || 12, t4, "0");
          }, $3 = f3 || function(t4, e4, n4) {
            var r4 = t4 < 12 ? "AM" : "PM";
            return n4 ? r4.toLowerCase() : r4;
          };
          return r3.replace(y2, (function(t4, r4) {
            return r4 || (function(t5) {
              switch (t5) {
                case "YY":
                  return String(e3.$y).slice(-2);
                case "YYYY":
                  return b2.s(e3.$y, 4, "0");
                case "M":
                  return a4 + 1;
                case "MM":
                  return b2.s(a4 + 1, 2, "0");
                case "MMM":
                  return h5(n3.monthsShort, a4, c3, 3);
                case "MMMM":
                  return h5(c3, a4);
                case "D":
                  return e3.$D;
                case "DD":
                  return b2.s(e3.$D, 2, "0");
                case "d":
                  return String(e3.$W);
                case "dd":
                  return h5(n3.weekdaysMin, e3.$W, o5, 2);
                case "ddd":
                  return h5(n3.weekdaysShort, e3.$W, o5, 3);
                case "dddd":
                  return o5[e3.$W];
                case "H":
                  return String(s3);
                case "HH":
                  return b2.s(s3, 2, "0");
                case "h":
                  return d3(1);
                case "hh":
                  return d3(2);
                case "a":
                  return $3(s3, u3, true);
                case "A":
                  return $3(s3, u3, false);
                case "m":
                  return String(u3);
                case "mm":
                  return b2.s(u3, 2, "0");
                case "s":
                  return String(e3.$s);
                case "ss":
                  return b2.s(e3.$s, 2, "0");
                case "SSS":
                  return b2.s(e3.$ms, 3, "0");
                case "Z":
                  return i3;
              }
              return null;
            })(t4) || i3.replace(":", "");
          }));
        }, m4.utcOffset = function() {
          return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
        }, m4.diff = function(r3, d3, l3) {
          var $3, y3 = this, M4 = b2.p(d3), m5 = O2(r3), v3 = (m5.utcOffset() - this.utcOffset()) * e2, g3 = this - m5, D3 = function() {
            return b2.m(y3, m5);
          };
          switch (M4) {
            case h4:
              $3 = D3() / 12;
              break;
            case c2:
              $3 = D3();
              break;
            case f2:
              $3 = D3() / 3;
              break;
            case o4:
              $3 = (g3 - v3) / 6048e5;
              break;
            case a3:
              $3 = (g3 - v3) / 864e5;
              break;
            case u2:
              $3 = g3 / n2;
              break;
            case s2:
              $3 = g3 / e2;
              break;
            case i2:
              $3 = g3 / t2;
              break;
            default:
              $3 = g3;
          }
          return l3 ? $3 : b2.a($3);
        }, m4.daysInMonth = function() {
          return this.endOf(c2).$D;
        }, m4.$locale = function() {
          return D2[this.$L];
        }, m4.locale = function(t3, e3) {
          if (!t3) return this.$L;
          var n3 = this.clone(), r3 = w2(t3, e3, true);
          return r3 && (n3.$L = r3), n3;
        }, m4.clone = function() {
          return b2.w(this.$d, this);
        }, m4.toDate = function() {
          return new Date(this.valueOf());
        }, m4.toJSON = function() {
          return this.isValid() ? this.toISOString() : null;
        }, m4.toISOString = function() {
          return this.$d.toISOString();
        }, m4.toString = function() {
          return this.$d.toUTCString();
        }, M3;
      })(), k2 = _2.prototype;
      return O2.prototype = k2, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a3], ["$M", c2], ["$y", h4], ["$D", d2]].forEach((function(t3) {
        k2[t3[1]] = function(e3) {
          return this.$g(e3, t3[0], t3[1]);
        };
      })), O2.extend = function(t3, e3) {
        return t3.$i || (t3(e3, _2, O2), t3.$i = true), O2;
      }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t3) {
        return O2(1e3 * t3);
      }, O2.en = D2[g2], O2.Ls = D2, O2.p = {}, O2;
    }));
  })(dayjs_min$1);
  return dayjs_min$1.exports;
}
var dayjs_minExports = requireDayjs_min();
const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
var utc$2 = { exports: {} };
var utc$1 = utc$2.exports;
var hasRequiredUtc;
function requireUtc() {
  if (hasRequiredUtc) return utc$2.exports;
  hasRequiredUtc = 1;
  (function(module, exports$1) {
    !(function(t2, i2) {
      module.exports = i2();
    })(utc$1, (function() {
      var t2 = "minute", i2 = /[+-]\d\d(?::?\d\d)?/g, e2 = /([+-]|\d\d)/g;
      return function(s2, f2, n2) {
        var u2 = f2.prototype;
        n2.utc = function(t3) {
          var i3 = { date: t3, utc: true, args: arguments };
          return new f2(i3);
        }, u2.utc = function(i3) {
          var e3 = n2(this.toDate(), { locale: this.$L, utc: true });
          return i3 ? e3.add(this.utcOffset(), t2) : e3;
        }, u2.local = function() {
          return n2(this.toDate(), { locale: this.$L, utc: false });
        };
        var r2 = u2.parse;
        u2.parse = function(t3) {
          t3.utc && (this.$u = true), this.$utils().u(t3.$offset) || (this.$offset = t3.$offset), r2.call(this, t3);
        };
        var o4 = u2.init;
        u2.init = function() {
          if (this.$u) {
            var t3 = this.$d;
            this.$y = t3.getUTCFullYear(), this.$M = t3.getUTCMonth(), this.$D = t3.getUTCDate(), this.$W = t3.getUTCDay(), this.$H = t3.getUTCHours(), this.$m = t3.getUTCMinutes(), this.$s = t3.getUTCSeconds(), this.$ms = t3.getUTCMilliseconds();
          } else o4.call(this);
        };
        var a3 = u2.utcOffset;
        u2.utcOffset = function(s3, f3) {
          var n3 = this.$utils().u;
          if (n3(s3)) return this.$u ? 0 : n3(this.$offset) ? a3.call(this) : this.$offset;
          if ("string" == typeof s3 && (s3 = (function(t3) {
            void 0 === t3 && (t3 = "");
            var s4 = t3.match(i2);
            if (!s4) return null;
            var f4 = ("" + s4[0]).match(e2) || ["-", 0, 0], n4 = f4[0], u4 = 60 * +f4[1] + +f4[2];
            return 0 === u4 ? 0 : "+" === n4 ? u4 : -u4;
          })(s3), null === s3)) return this;
          var u3 = Math.abs(s3) <= 16 ? 60 * s3 : s3;
          if (0 === u3) return this.utc(f3);
          var r3 = this.clone();
          if (f3) return r3.$offset = u3, r3.$u = false, r3;
          var o5 = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
          return (r3 = this.local().add(u3 + o5, t2)).$offset = u3, r3.$x.$localOffset = o5, r3;
        };
        var h4 = u2.format;
        u2.format = function(t3) {
          var i3 = t3 || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
          return h4.call(this, i3);
        }, u2.valueOf = function() {
          var t3 = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
          return this.$d.valueOf() - 6e4 * t3;
        }, u2.isUTC = function() {
          return !!this.$u;
        }, u2.toISOString = function() {
          return this.toDate().toISOString();
        }, u2.toString = function() {
          return this.toDate().toUTCString();
        };
        var l2 = u2.toDate;
        u2.toDate = function(t3) {
          return "s" === t3 && this.$offset ? n2(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : l2.call(this);
        };
        var c2 = u2.diff;
        u2.diff = function(t3, i3, e3) {
          if (t3 && this.$u === t3.$u) return c2.call(this, t3, i3, e3);
          var s3 = this.local(), f3 = n2(t3).local();
          return c2.call(s3, f3, i3, e3);
        };
      };
    }));
  })(utc$2);
  return utc$2.exports;
}
var utcExports = requireUtc();
const utc = /* @__PURE__ */ getDefaultExportFromCjs(utcExports);
var timezone$2 = { exports: {} };
var timezone$1 = timezone$2.exports;
var hasRequiredTimezone;
function requireTimezone() {
  if (hasRequiredTimezone) return timezone$2.exports;
  hasRequiredTimezone = 1;
  (function(module, exports$1) {
    !(function(t2, e2) {
      module.exports = e2();
    })(timezone$1, (function() {
      var t2 = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, e2 = {};
      return function(n2, i2, o4) {
        var r2, a3 = function(t3, n3, i3) {
          void 0 === i3 && (i3 = {});
          var o5 = new Date(t3), r3 = (function(t4, n4) {
            void 0 === n4 && (n4 = {});
            var i4 = n4.timeZoneName || "short", o6 = t4 + "|" + i4, r4 = e2[o6];
            return r4 || (r4 = new Intl.DateTimeFormat("en-US", { hour12: false, timeZone: t4, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: i4 }), e2[o6] = r4), r4;
          })(n3, i3);
          return r3.formatToParts(o5);
        }, u2 = function(e3, n3) {
          for (var i3 = a3(e3, n3), r3 = [], u3 = 0; u3 < i3.length; u3 += 1) {
            var f3 = i3[u3], s3 = f3.type, m3 = f3.value, c2 = t2[s3];
            c2 >= 0 && (r3[c2] = parseInt(m3, 10));
          }
          var d2 = r3[3], l2 = 24 === d2 ? 0 : d2, h4 = r3[0] + "-" + r3[1] + "-" + r3[2] + " " + l2 + ":" + r3[4] + ":" + r3[5] + ":000", v2 = +e3;
          return (o4.utc(h4).valueOf() - (v2 -= v2 % 1e3)) / 6e4;
        }, f2 = i2.prototype;
        f2.tz = function(t3, e3) {
          void 0 === t3 && (t3 = r2);
          var n3, i3 = this.utcOffset(), a4 = this.toDate(), u3 = a4.toLocaleString("en-US", { timeZone: t3 }), f3 = Math.round((a4 - new Date(u3)) / 1e3 / 60), s3 = 15 * -Math.round(a4.getTimezoneOffset() / 15) - f3;
          if (!Number(s3)) n3 = this.utcOffset(0, e3);
          else if (n3 = o4(u3, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(s3, true), e3) {
            var m3 = n3.utcOffset();
            n3 = n3.add(i3 - m3, "minute");
          }
          return n3.$x.$timezone = t3, n3;
        }, f2.offsetName = function(t3) {
          var e3 = this.$x.$timezone || o4.tz.guess(), n3 = a3(this.valueOf(), e3, { timeZoneName: t3 }).find((function(t4) {
            return "timezonename" === t4.type.toLowerCase();
          }));
          return n3 && n3.value;
        };
        var s2 = f2.startOf;
        f2.startOf = function(t3, e3) {
          if (!this.$x || !this.$x.$timezone) return s2.call(this, t3, e3);
          var n3 = o4(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
          return s2.call(n3, t3, e3).tz(this.$x.$timezone, true);
        }, o4.tz = function(t3, e3, n3) {
          var i3 = n3 && e3, a4 = n3 || e3 || r2, f3 = u2(+o4(), a4);
          if ("string" != typeof t3) return o4(t3).tz(a4);
          var s3 = (function(t4, e4, n4) {
            var i4 = t4 - 60 * e4 * 1e3, o5 = u2(i4, n4);
            if (e4 === o5) return [i4, e4];
            var r3 = u2(i4 -= 60 * (o5 - e4) * 1e3, n4);
            return o5 === r3 ? [i4, o5] : [t4 - 60 * Math.min(o5, r3) * 1e3, Math.max(o5, r3)];
          })(o4.utc(t3, i3).valueOf(), f3, a4), m3 = s3[0], c2 = s3[1], d2 = o4(m3).utcOffset(c2);
          return d2.$x.$timezone = a4, d2;
        }, o4.tz.guess = function() {
          return Intl.DateTimeFormat().resolvedOptions().timeZone;
        }, o4.tz.setDefault = function(t3) {
          r2 = t3;
        };
      };
    }));
  })(timezone$2);
  return timezone$2.exports;
}
var timezoneExports = requireTimezone();
const timezone = /* @__PURE__ */ getDefaultExportFromCjs(timezoneExports);
var localizedFormat$2 = { exports: {} };
var localizedFormat$1 = localizedFormat$2.exports;
var hasRequiredLocalizedFormat;
function requireLocalizedFormat() {
  if (hasRequiredLocalizedFormat) return localizedFormat$2.exports;
  hasRequiredLocalizedFormat = 1;
  (function(module, exports$1) {
    !(function(e2, t2) {
      module.exports = t2();
    })(localizedFormat$1, (function() {
      var e2 = { 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" };
      return function(t2, o4, n2) {
        var r2 = o4.prototype, i2 = r2.format;
        n2.en.formats = e2, r2.format = function(t3) {
          void 0 === t3 && (t3 = "YYYY-MM-DDTHH:mm:ssZ");
          var o5 = this.$locale().formats, n3 = (function(t4, o6) {
            return t4.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t5, n4, r3) {
              var i3 = r3 && r3.toUpperCase();
              return n4 || o6[r3] || e2[r3] || o6[i3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e3, t6, o7) {
                return t6 || o7.slice(1);
              }));
            }));
          })(t3, void 0 === o5 ? {} : o5);
          return i2.call(this, n3);
        };
      };
    }));
  })(localizedFormat$2);
  return localizedFormat$2.exports;
}
var localizedFormatExports = requireLocalizedFormat();
const localizedFormat = /* @__PURE__ */ getDefaultExportFromCjs(localizedFormatExports);
var relativeTime$3 = { exports: {} };
var relativeTime$2 = relativeTime$3.exports;
var hasRequiredRelativeTime;
function requireRelativeTime() {
  if (hasRequiredRelativeTime) return relativeTime$3.exports;
  hasRequiredRelativeTime = 1;
  (function(module, exports$1) {
    !(function(r2, e2) {
      module.exports = e2();
    })(relativeTime$2, (function() {
      return function(r2, e2, t2) {
        r2 = r2 || {};
        var n2 = e2.prototype, o4 = { future: "in %s", past: "%s ago", s: "a few seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", M: "a month", MM: "%d months", y: "a year", yy: "%d years" };
        function i2(r3, e3, t3, o5) {
          return n2.fromToBase(r3, e3, t3, o5);
        }
        t2.en.relativeTime = o4, n2.fromToBase = function(e3, n3, i3, d3, u2) {
          for (var f2, a3, s2, l2 = i3.$locale().relativeTime || o4, h4 = r2.thresholds || [{ l: "s", r: 44, d: "second" }, { l: "m", r: 89 }, { l: "mm", r: 44, d: "minute" }, { l: "h", r: 89 }, { l: "hh", r: 21, d: "hour" }, { l: "d", r: 35 }, { l: "dd", r: 25, d: "day" }, { l: "M", r: 45 }, { l: "MM", r: 10, d: "month" }, { l: "y", r: 17 }, { l: "yy", d: "year" }], m3 = h4.length, c2 = 0; c2 < m3; c2 += 1) {
            var y2 = h4[c2];
            y2.d && (f2 = d3 ? t2(e3).diff(i3, y2.d, true) : i3.diff(e3, y2.d, true));
            var p2 = (r2.rounding || Math.round)(Math.abs(f2));
            if (s2 = f2 > 0, p2 <= y2.r || !y2.r) {
              p2 <= 1 && c2 > 0 && (y2 = h4[c2 - 1]);
              var v2 = l2[y2.l];
              u2 && (p2 = u2("" + p2)), a3 = "string" == typeof v2 ? v2.replace("%d", p2) : v2(p2, n3, y2.l, s2);
              break;
            }
          }
          if (n3) return a3;
          var M2 = s2 ? l2.future : l2.past;
          return "function" == typeof M2 ? M2(a3) : M2.replace("%s", a3);
        }, n2.to = function(r3, e3) {
          return i2(r3, e3, this, true);
        }, n2.from = function(r3, e3) {
          return i2(r3, e3, this);
        };
        var d2 = function(r3) {
          return r3.$u ? t2.utc() : t2();
        };
        n2.toNow = function(r3) {
          return this.to(d2(this), r3);
        }, n2.fromNow = function(r3) {
          return this.from(d2(this), r3);
        };
      };
    }));
  })(relativeTime$3);
  return relativeTime$3.exports;
}
var relativeTimeExports = requireRelativeTime();
const relativeTime$1 = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(localizedFormat);
dayjs.extend(relativeTime$1);
const CONTENT_BLOCKS = [
  {
    name: "core/paragraph",
    label: window.wp.i18n.__("Paragraph", "structura"),
    isPro: false,
    isRequired: true,
    description: window.wp.i18n.__(
      "Enable generation of paragraph blocks, the fundamental building blocks for any content piece, allowing for rich text formatting and seamless integration of AI-generated content.",
      "structura"
    )
  },
  {
    name: "core/heading",
    label: window.wp.i18n.__("Heading", "structura"),
    isPro: false,
    isRequired: false,
    description: window.wp.i18n.__(
      "Allow generation of heading blocks, essential for structuring your content with clear sections and improving readability, while also enhancing SEO by organizing content hierarchy effectively.",
      "structura"
    )
  },
  {
    name: "core/list",
    label: window.wp.i18n.__("List", "structura"),
    isPro: true,
    description: window.wp.i18n.__(
      "Enable generation of list blocks, perfect for creating organized bullet points or numbered lists that enhance the clarity and scannability of your content, making it easier for readers to digest key information.",
      "structura"
    )
  },
  {
    name: "core/quote",
    label: window.wp.i18n.__("Quote", "structura"),
    isPro: true,
    description: window.wp.i18n.__(
      "Enable generation of quote blocks, ideal for highlighting key insights or statements within your content.",
      "structura"
    )
  },
  {
    name: "core/table",
    label: window.wp.i18n.__("Table", "structura"),
    isPro: true,
    description: window.wp.i18n.__(
      "Allow generation of table blocks, perfect for organizing data, comparisons, or structured information in a clear format.",
      "structura"
    )
  },
  {
    name: "core/code",
    label: window.wp.i18n.__("Code", "structura"),
    isPro: true,
    // Most blogs (recipes, travel, local business…) have no natural code
    // content — a default-on code block invites the AI to force-fit one.
    defaultOff: true,
    description: window.wp.i18n.__(
      "Enable generation of code blocks for technical posts, tutorials, and developer content. Code is rendered with monospace formatting and preserved whitespace.",
      "structura"
    )
  },
  {
    name: "core/pullquote",
    label: window.wp.i18n.__("Pull Quote", "structura"),
    isPro: true,
    // Citation support was intentionally removed — see
    // plugin/includes/Generator/Block_Serializer.php render_pullquote.
    description: window.wp.i18n.__(
      "Enable generation of pull quote blocks that visually highlight a single high-impact statement from the content.",
      "structura"
    )
  },
  {
    name: "core/details",
    label: window.wp.i18n.__("Details (Accordion)", "structura"),
    isPro: true,
    description: window.wp.i18n.__(
      "Enable generation of expandable accordion blocks, ideal for supplementary details, FAQs within sections, or collapsible technical explanations.",
      "structura"
    )
  }
];
const PROVIDER_VISUALS = {
  openai: {
    label: "OpenAI",
    icon: vn,
    color: "text-neutral-700 dark:text-neutral-300",
    border: "border-neutral-300 dark:border-neutral-600",
    glow: "hover:border-neutral-400 hover:shadow-neutral-200/40 dark:hover:border-neutral-500 dark:hover:shadow-neutral-800/40"
  },
  gemini: {
    label: "Gemini",
    icon: wn,
    color: "text-blue-500",
    border: "border-blue-200 dark:border-blue-800/50",
    glow: "hover:border-blue-300 hover:shadow-blue-200/30 dark:hover:border-blue-700 dark:hover:shadow-blue-900/30"
  },
  anthropic: {
    label: "Claude",
    icon: yn,
    color: "text-amber-600",
    border: "border-amber-200 dark:border-amber-800/50",
    glow: "hover:border-amber-300 hover:shadow-amber-200/30 dark:hover:border-amber-700 dark:hover:shadow-amber-900/30"
  }
};
const getProviderVisual = (id) => PROVIDER_VISUALS[id] ?? {
  label: id,
  icon: Bot,
  color: "text-neutral-400",
  border: "border-neutral-200 dark:border-neutral-800",
  glow: "hover:border-neutral-300 hover:shadow-md dark:hover:border-neutral-700"
};
const DEFAULT_SEO_RULES = {
  include_faq_section: true,
  include_action_steps: true,
  include_statistics: true,
  number_in_title: true,
  internal_link_optimization: true,
  outbound_link_authority: true,
  eeat_signals: true,
  entity_coverage: true
};
const DEFAULT_CAMPAIGN_FORM_DATA = {
  identity: {
    name: "",
    objective: "",
    campaignMode: "traffic_magnet"
  },
  intelligence: {
    textProvider: "gemini",
    imageProvider: "gemini",
    textModel: "",
    imageModel: "",
    // BYOK quality tier — new campaigns open on Standard (mid): the cost runs
    // on the user's own key, so Top is an explicit opt-in, never a default
    // (2026-07-23: the "top" default silently moved Anthropic campaigns from
    // Sonnet to Opus). The model row mirrors the tier's concrete model.
    // Managed tiers ignore this (model owned server-side).
    textTier: "mid",
    imageTier: "mid",
    // Fallback providers default to null ("off") — silently opting users
    // in would be surprising and costs money on transient failures; the UI
    // surfaces the choice explicitly in Advanced Settings → AI Engine.
    fallbackTextProvider: null,
    fallbackImageProvider: null,
    personaId: "random",
    language: "default",
    postLength: 2700,
    replaceLongDashes: true,
    disableEmojis: true,
    seoRules: DEFAULT_SEO_RULES
  },
  structure: {
    enabledBlocks: CONTENT_BLOCKS.filter((block) => block.isRequired).map((block) => block.name),
    featuredImage: false,
    bodyImages: false,
    disclosure: {
      enabled: false,
      // Localized default — new campaigns created by a non-English user see
      // their admin language here. Persisted on the campaign doc as soon as
      // the wizard saves, so existing campaigns keep whatever the user wrote
      // / the prior default was; only fresh campaigns pick up the current
      // locale's wording.
      text: window.wp.i18n.__("This content was assisted by AI.", "structura")
    },
    // "draft" so freshly created campaigns save for a human review pass
    // before anything goes live (2026-07-09: was "pending", but that WP
    // state read as a draft anyway and confused the "is it published?"
    // messaging, so it was removed — draft is the honest default). Only
    // affects new campaigns; existing campaigns keep their persisted value
    // (legacy "pending" normalizes to "draft" on read).
    postStatus: "draft"
  },
  taxonomy: {
    categories: { mode: "auto", list: [] },
    tags: { mode: "auto", list: [] }
  },
  schedule: {
    cron: "0 9 * * 2,4",
    // Every Tuesday and Thursday at 9:00 AM
    endCondition: {
      type: "infinite",
      value: dayjs().add(1, "month").format("YYYY-MM-DD")
    },
    // Phase 1.6 — fresh campaigns default to ON. BYOK users can opt
    // out via the toggle in the Schedule step; managed tiers always
    // run with this on (no toggle, just an info banner explaining
    // the behavior). The cloud's onCampaignCreated trigger seeds an
    // initial stock batch as soon as the doc lands.
    pregenerationEnabled: true
  }
};
const ProviderPill = ({
  provider,
  onProviderChange,
  forceInteractive = false,
  className
}) => {
  const {
    hasExplicitDefaults,
    hasMultipleProviders,
    availableProviders,
    isProviderIncomplete,
    isCloud
  } = useDefaultProviders();
  const meta = getProviderVisual(provider);
  const Icon2 = meta.icon;
  const incomplete = isProviderIncomplete(provider);
  if (hasExplicitDefaults && !isCloud && !forceInteractive) return null;
  if (!hasMultipleProviders && !forceInteractive) return null;
  const isInteractive = hasMultipleProviders && !!onProviderChange;
  if (!isInteractive) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "inline-flex items-center gap-1.5 rounded-full border border-brand-200 bg-brand-50/50 px-2.5 py-1 text-[10px] font-bold uppercase text-brand-600 dark:border-brand-800 dark:bg-brand-950/30 dark:text-brand-400",
          className
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 10 }),
      meta.label
    );
  }
  return /* @__PURE__ */ window.wp.element.createElement(
    Mo,
    {
      value: provider,
      onChange: (val) => onProviderChange?.(val)
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1("relative", className) }, /* @__PURE__ */ window.wp.element.createElement(
      Mt$2,
      {
        className: B$1(
          "inline-flex cursor-pointer items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] font-bold uppercase transition-all",
          incomplete ? "border-amber-300 bg-amber-50/50 text-amber-700 hover:bg-amber-50 dark:border-amber-700 dark:bg-amber-950/30 dark:text-amber-400 dark:hover:bg-amber-950/50" : "border-brand-200 bg-brand-50/50 text-brand-600 hover:bg-brand-50 dark:border-brand-800 dark:bg-brand-950/30 dark:text-brand-400 dark:hover:bg-brand-950/50"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 10 }),
      meta.label,
      incomplete && /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 9, className: "text-amber-500 dark:text-amber-400" }),
      /* @__PURE__ */ window.wp.element.createElement(ChevronDown, { size: 8, className: "ml-0.5 opacity-60" })
    ), /* @__PURE__ */ window.wp.element.createElement(
      Bt$2,
      {
        anchor: "bottom end",
        transition: true,
        className: "z-50 mt-1 min-w-[160px] overflow-auto rounded-xl border border-neutral-200 bg-white p-1 shadow-xl transition duration-100 ease-in focus:outline-none data-leave:data-closed:opacity-0 dark:border-neutral-700 dark:bg-neutral-900 dark:ring-1 dark:ring-white/[0.04]"
      },
      availableProviders.map((slug) => {
        const itemMeta = getProviderVisual(slug);
        const ItemIcon = itemMeta.icon;
        const itemIncomplete = isProviderIncomplete(slug);
        const option = /* @__PURE__ */ window.wp.element.createElement(
          It$1,
          {
            key: slug,
            value: slug,
            disabled: itemIncomplete,
            className: B$1(
              "group relative rounded-lg py-2 pr-4 pl-9 transition-colors select-none",
              itemIncomplete ? "cursor-not-allowed opacity-50" : "cursor-pointer text-neutral-700 data-focus:bg-neutral-100 data-focus:text-neutral-900 dark:text-neutral-300 dark:data-focus:bg-neutral-800 dark:data-focus:text-white"
            )
          },
          /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(ItemIcon, { size: 12, className: B$1("shrink-0", itemIncomplete ? "text-neutral-300 dark:text-neutral-600" : "text-neutral-400 group-data-selected:text-brand-500 dark:group-data-selected:text-brand-400") }), /* @__PURE__ */ window.wp.element.createElement("span", { className: B$1("text-xs font-bold", itemIncomplete ? "text-neutral-400 dark:text-neutral-500" : "group-data-selected:text-brand-600 dark:group-data-selected:text-brand-400") }, itemMeta.label), itemIncomplete && /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-auto inline-flex items-center gap-1 rounded-full bg-amber-100 px-1.5 py-0.5 text-[9px] font-bold text-amber-700 dark:bg-amber-900/40 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 8 }), window.wp.i18n.__("Setup", "structura"))),
          /* @__PURE__ */ window.wp.element.createElement("span", { className: "invisible absolute inset-y-0 left-0 flex items-center pl-2.5 text-brand-500 group-data-selected:visible" }, /* @__PURE__ */ window.wp.element.createElement(Check, { size: 12, strokeWidth: 3 }))
        );
        return itemIncomplete ? /* @__PURE__ */ window.wp.element.createElement(
          ce,
          {
            key: slug,
            title: window.wp.i18n.__("Complete model setup in AI Engine settings before using this provider", "structura"),
            position: "left"
          },
          option
        ) : option;
      })
    ))
  );
};
const SuggestStrategySection = ({
  isStrategizing,
  onGenerate,
  toggleButtonLabel,
  contextFieldLabel,
  addSourceLabel,
  ctaButtonLabel,
  placeholder,
  initialSources,
  mediumPicker
}) => {
  const { defaultTextProvider } = useDefaultProviders();
  const [providerOverride, setProviderOverride] = window.wp.element.useState(null);
  const [isOpen, setIsOpen] = window.wp.element.useState(false);
  const activeProvider = providerOverride ?? defaultTextProvider;
  const [contextFields, setContextFields] = window.wp.element.useState([]);
  const seededRef = window.wp.element.useRef(false);
  const { isPaidLicense } = useLicense();
  window.wp.element.useEffect(() => {
    if (!seededRef.current && initialSources && initialSources.length > 0) {
      setContextFields(initialSources);
      seededRef.current = true;
    }
  }, [initialSources]);
  const addField = () => setContextFields([...contextFields, { title: "", url: "" }]);
  const removeField = (index2) => {
    setContextFields(contextFields.filter((_2, i2) => i2 !== index2));
  };
  const updateField = (index2, key, value) => {
    const updated = [...contextFields];
    updated[index2][key] = value;
    setContextFields(updated);
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => isPaidLicense ? setIsOpen(!isOpen) : void 0,
      disabled: !isPaidLicense,
      className: B$1(
        "group flex w-full cursor-pointer items-center gap-2 rounded-xl px-3 py-2.5 text-left transition-all",
        isPaidLicense ? "hover:bg-brand-50/60 dark:hover:bg-brand-950/20" : "cursor-not-allowed opacity-50",
        isOpen && "bg-brand-50/40 dark:bg-brand-950/15"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 to-purple-500 shadow-sm shadow-brand-500/20" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 13, className: "text-white" })),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex-1 text-xs font-bold text-neutral-700 dark:text-neutral-300" }, toggleButtonLabel),
    !isPaidLicense && /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded-md bg-brand-100 px-1.5 py-0.5 text-[8px] font-black tracking-wider text-brand-600 uppercase dark:bg-brand-950/30 dark:text-brand-400" }, window.wp.i18n.__("Pro", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(
      ChevronDown,
      {
        size: 14,
        className: B$1(
          "text-neutral-400 transition-transform duration-200 dark:text-neutral-500",
          isOpen && "rotate-180"
        )
      }
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "overflow-hidden transition-all duration-300 ease-in-out",
        isOpen ? "mt-2 max-h-[500px] opacity-100" : "max-h-0 opacity-0"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 dark:border-neutral-800 dark:bg-neutral-800/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-3 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, contextFieldLabel), /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: addField,
        className: "flex cursor-pointer items-center gap-1 text-[10px] font-bold text-brand-600 transition-colors hover:text-brand-700 dark:text-brand-400 dark:hover:text-brand-300"
      },
      /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 10 }),
      addSourceLabel
    )), contextFields.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 space-y-2" }, contextFields.map((field, index2) => /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        key: index2,
        className: "group flex items-end gap-2 rounded-lg border border-neutral-100 bg-white p-2.5 dark:border-neutral-700 dark:bg-neutral-800/50"
      },
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement(
        he,
        {
          label: window.wp.i18n.__("Name", "structura"),
          placeholder: placeholder.title,
          value: field.title,
          onChange: (e2) => updateField(index2, "title", e2.target.value)
        }
      )),
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-[2]" }, /* @__PURE__ */ window.wp.element.createElement(
        he,
        {
          label: window.wp.i18n.__("URL", "structura"),
          placeholder: placeholder.url,
          value: field.url,
          onChange: (e2) => updateField(index2, "url", e2.target.value),
          leftAdornment: /* @__PURE__ */ window.wp.element.createElement(Link, { size: 13 })
        }
      )),
      /* @__PURE__ */ window.wp.element.createElement(
        "button",
        {
          type: "button",
          onClick: () => removeField(index2),
          className: "mb-0.5 flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-neutral-300 transition-colors hover:bg-red-50 hover:text-red-500 dark:text-neutral-600 dark:hover:bg-red-950/20 dark:hover:text-red-400"
        },
        /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 14 })
      )
    ))), contextFields.length === 0 && /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: addField,
        className: "mb-4 flex w-full cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed border-neutral-200 bg-white/50 px-4 py-3 text-xs text-neutral-400 transition-colors hover:border-brand-300 hover:text-brand-500 dark:border-neutral-700 dark:bg-neutral-800/30 dark:hover:border-brand-700 dark:hover:text-brand-400"
      },
      /* @__PURE__ */ window.wp.element.createElement(Link, { size: 13 }),
      window.wp.i18n.__("Add brand resources for better results", "structura")
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, mediumPicker ? /* @__PURE__ */ window.wp.element.createElement(Jn, null, /* @__PURE__ */ window.wp.element.createElement(
      Jn.Trigger,
      {
        disabled: isStrategizing,
        className: "inline-flex cursor-pointer items-center gap-1.5 rounded-lg bg-gradient-to-r from-brand-600 to-purple-600 px-3 py-1.5 text-sm font-bold text-white shadow-sm shadow-brand-600/15 disabled:opacity-60"
      },
      /* @__PURE__ */ window.wp.element.createElement(WandSparkles, { size: 14, className: B$1(isStrategizing && "animate-spin") }),
      ctaButtonLabel,
      /* @__PURE__ */ window.wp.element.createElement(ChevronDown, { size: 14 })
    ), /* @__PURE__ */ window.wp.element.createElement(
      Jn.Content,
      {
        anchor: { to: "bottom start", gap: 6 },
        className: "w-[19rem] p-1"
      },
      ({ close }) => /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-2.5 pt-1.5 pb-1 text-[10px] font-black tracking-wider text-neutral-400 uppercase" }, mediumPicker.heading), mediumPicker.options.map((opt) => {
        const Icon2 = opt.icon;
        const active = mediumPicker.current === opt.value;
        return /* @__PURE__ */ window.wp.element.createElement(
          "button",
          {
            key: opt.value,
            type: "button",
            onClick: () => {
              onGenerate(
                activeProvider,
                contextFields.filter((f2) => f2.url),
                opt.value
              );
              close();
            },
            className: "flex w-full cursor-pointer items-start gap-2.5 rounded-lg px-2.5 py-2 text-left transition-colors hover:bg-neutral-100 dark:hover:bg-neutral-800"
          },
          /* @__PURE__ */ window.wp.element.createElement(
            "span",
            {
              className: B$1(
                "flex h-7 w-7 shrink-0 items-center justify-center rounded-lg",
                active ? "bg-brand-500 text-white" : "bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"
              )
            },
            /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 14 })
          ),
          /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5 text-[13px] font-bold text-neutral-900 dark:text-white" }, opt.label, active && /* @__PURE__ */ window.wp.element.createElement(Check, { size: 12, className: "text-brand-500" })), /* @__PURE__ */ window.wp.element.createElement("span", { className: "block text-[11.5px] leading-snug text-neutral-500 dark:text-neutral-400" }, opt.desc))
        );
      }))
    )) : /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        size: "sm",
        onClick: () => onGenerate(
          activeProvider,
          contextFields.filter((f2) => f2.url)
        ),
        disabled: isStrategizing,
        className: "bg-gradient-to-r from-brand-600 to-purple-600 font-bold shadow-sm shadow-brand-600/15"
      },
      isStrategizing ? /* @__PURE__ */ window.wp.element.createElement(WandSparkles, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(WandSparkles, { size: 14, className: "mr-1.5" }),
      ctaButtonLabel
    ), /* @__PURE__ */ window.wp.element.createElement(
      ProviderPill,
      {
        provider: activeProvider,
        onProviderChange: setProviderOverride
      }
    )))
  ));
};
const MEDIUM_OPTIONS = [
  {
    value: "photography",
    icon: Camera,
    label: window.wp.i18n.__("Photography", "structura"),
    desc: window.wp.i18n.__("Realistic photos that show the actual subject.", "structura")
  },
  {
    value: "illustration",
    icon: Shapes,
    label: window.wp.i18n.__("Illustration", "structura"),
    desc: window.wp.i18n.__("Flat, editorial vector illustrations.", "structura")
  },
  {
    value: "3d_render",
    icon: Boxes,
    label: window.wp.i18n.__("3D render", "structura"),
    desc: window.wp.i18n.__("Premium 3D / abstract conceptual art.", "structura")
  }
];
const VIDEO_INTEGRATION_ID = "video";
const DEFAULT_VIDEO_STYLE = "clean";
const VIDEO_STYLE_PRESETS = [
  { id: "clean", name: "Clean", descriptor: "Minimal captions, soft fades" },
  { id: "bold", name: "Bold", descriptor: "High-contrast, punchy cuts" },
  { id: "kinetic", name: "Kinetic", descriptor: "Word-by-word motion" }
];
const videoStyleById = (id) => VIDEO_STYLE_PRESETS.find((p2) => p2.id === id) ?? VIDEO_STYLE_PRESETS.find((p2) => p2.id === DEFAULT_VIDEO_STYLE);
const resolveVideoRowState = (job, nowMs = Date.now()) => {
  if (job.status === "ready" && job.expiresAt) {
    const expires = Date.parse(job.expiresAt);
    if (Number.isFinite(expires) && expires < nowMs) return "expired";
  }
  return job.status;
};
const formatVideoDuration = (durationSec) => {
  const total = Math.max(0, Math.floor(durationSec));
  const minutes = Math.floor(total / 60);
  const seconds = total % 60;
  return `${minutes}:${String(seconds).padStart(2, "0")}`;
};
const formatVideoBytes = (bytes) => {
  const mb = bytes / (1024 * 1024);
  return `${mb.toLocaleString(void 0, {
    minimumFractionDigits: 1,
    maximumFractionDigits: 1
  })} MB`;
};
const CAPTION_LIMITS = {
  shortsTitle: 100,
  tiktokHook: 100,
  reelsHook: 125,
  /** YouTube Tags upload field — total characters across all tags. */
  shortsTags: 500
};
const parseCaptionBlocks = (raw, { hookFirst = false } = {}) => raw.split("\n\n").filter((text) => text.trim() !== "").map((text, index2) => ({
  text,
  kind: text.trimStart().startsWith("#") ? "hashtags" : hookFirst && index2 === 0 ? "hook" : "body"
}));
const captionHook = (raw) => raw.split("\n\n").find((block) => block.trim() !== "") ?? "";
const uploadTags = (raw) => parseCaptionBlocks(raw).filter((block) => block.kind === "hashtags").flatMap((block) => block.text.split(/\s+/)).map((token) => token.replace(/^#+/, "")).filter((token) => token.length > 0).join(", ");
const isSocialPackages = (value) => {
  if (typeof value !== "object" || value === null) return false;
  const v2 = value;
  return typeof v2.shorts?.title === "string" && typeof v2.shorts?.description === "string" && typeof v2.tiktok?.caption === "string" && typeof v2.reels?.caption === "string";
};
const channelKeys = {
  all: ["channels"],
  events: () => [...channelKeys.all, "events"],
  catalog: () => [...channelKeys.all, "catalog"],
  connections: () => [...channelKeys.all, "connections"],
  /**
   * IndexNow key + keyLocation. Separate cache key from `connections`
   * because the value is keyed off the WP install (not a specific
   * connection) and refetching once per InstallModal mount is plenty.
   */
  indexnowKey: () => [...channelKeys.all, "indexnow-key"],
  /**
   * Per-post GSC mirror stats, keyed by the post's permalink so two run
   * receipts pointing at the same post share one cache entry.
   */
  gscPostStats: (pageUrl) => [...channelKeys.all, "gsc-post-stats", pageUrl],
  /** Site-level GSC overview in summary mode (dashboard glance card). */
  gscOverviewSummary: () => [...channelKeys.all, "gsc-overview-summary"]
};
const FIVE_MINUTES = 5 * 60 * 1e3;
const useChannelCatalogQuery = () => {
  const { isActivationValid, hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: channelKeys.catalog(),
    staleTime: FIVE_MINUTES,
    // See useChannelConnectionsQuery for the rationale: `null` means
    // "unknown, allow" so paid users don't wait on the heartbeat before
    // the catalog loads; `false` means "confirmed host mismatch, don't
    // bother" and the page renders its advisory.
    enabled: hasUsableLicense === true && isActivationValid !== false,
    meta: { silentError: true },
    queryFn: async () => {
      const response = await window.wp.apiFetch({
        path: "/structura/v1/channels/catalog"
      });
      if (!response || !Array.isArray(response.entries)) {
        return {
          success: true,
          plan: "free",
          activeAddons: [],
          entries: []
        };
      }
      return response;
    }
  });
};
function useVideoStylingEligibility() {
  const { data: catalog } = useChannelCatalogQuery();
  const entry = catalog?.entries.find((e2) => e2.id === VIDEO_INTEGRATION_ID);
  if (!entry) return "unknown";
  if (entry.entitlement.canInstall) return "eligible";
  if (entry.entitlement.blocker === "upgrade_plan" || entry.entitlement.blocker === "add_channels") {
    return "locked";
  }
  return "unknown";
}
const OVERLINE$2 = "m-0! block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500";
const DEFAULT_PRESET_VIDEO_STYLE = "clean";
const DEFAULT_PRESET_CAPTION_PLACEMENT = "bottom";
function VideoStyleCards({
  value,
  onChange,
  accent,
  compact = false
}) {
  return /* @__PURE__ */ window.wp.element.createElement(
    Ut,
    {
      "aria-label": window.wp.i18n.__("Video style preset", "structura"),
      value,
      onValueChange: (next) => onChange(next)
    },
    VIDEO_STYLE_PRESETS.map((preset) => /* @__PURE__ */ window.wp.element.createElement(
      Fa,
      {
        key: preset.id,
        value: preset.id,
        name: preset.name,
        description: compact ? void 0 : preset.descriptor,
        thumbnail: /* @__PURE__ */ window.wp.element.createElement(
          Oa,
          {
            kind: preset.id,
            ...accent ? { accent } : {}
          }
        )
      }
    ))
  );
}
function CaptionPlacementField({
  value,
  onChange
}) {
  return /* @__PURE__ */ window.wp.element.createElement(
    Ha,
    {
      "aria-label": window.wp.i18n.__("Caption placement", "structura"),
      value,
      onValueChange: onChange,
      labels: {
        top: window.wp.i18n.__("Top", "structura"),
        middle: window.wp.i18n.__("Middle", "structura"),
        bottom: window.wp.i18n.__("Bottom", "structura")
      }
    }
  );
}
function VideoTile() {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300" }, /* @__PURE__ */ window.wp.element.createElement(Wn, { className: "h-5 w-5" }));
}
function VideoPresetSection({
  videoStyle,
  videoArtDirection,
  captionPlacement,
  palette,
  onVideoStyleChange,
  onVideoArtDirectionChange,
  onCaptionPlacementChange,
  suggestSlot
}) {
  const accent = palette?.[0];
  return /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(VideoTile, null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm font-bold tracking-tight text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Video", "structura")), /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "premium" }, window.wp.i18n.__("Cloud Pro", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-0.5! text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "How videos rendered from posts look, on every site using this preset — style, captions and motion.",
    "structura"
  )))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-5 space-y-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: OVERLINE$2 }, window.wp.i18n.__("Style preset", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    VideoStyleCards,
    {
      value: videoStyle ?? DEFAULT_PRESET_VIDEO_STYLE,
      onChange: onVideoStyleChange,
      ...accent ? { accent } : {}
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: OVERLINE$2 }, window.wp.i18n.__("Video art direction", "structura"))), suggestSlot, /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Video Art Direction", "structura"),
      hiddenLabel: true,
      rows: 5,
      value: videoArtDirection ?? "",
      onChange: (e2) => onVideoArtDirectionChange(e2.target.value),
      placeholder: window.wp.i18n.__(
        "Footage, pacing, mood and settings for rendered videos…",
        "structura"
      ),
      className: "w-full rounded-2xl border-gray-200 bg-gray-50 font-mono text-xs leading-relaxed dark:border-neutral-800 dark:bg-neutral-950"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Motion, footage and pacing — separate from the image style above. Suggest drafts it from your homepage screenshot and brand info.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: OVERLINE$2 }, window.wp.i18n.__("Caption placement", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    CaptionPlacementField,
    {
      value: captionPlacement ?? DEFAULT_PRESET_CAPTION_PLACEMENT,
      onChange: onCaptionPlacementChange
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Bottom feels native on Shorts, TikTok and Reels.", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-4 rounded-xl border border-neutral-200 bg-neutral-50/70 px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800/50" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-bold text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Brand palette in captions", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-0.5! text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Caption accents automatically use this preset's palette — the previews above show the result.",
    "structura"
  ))), palette && palette.length > 0 && /* @__PURE__ */ window.wp.element.createElement(
    Wa,
    {
      colors: palette,
      label: window.wp.i18n.__("Preset palette", "structura")
    }
  ))));
}
function VideoStylingGateTeaser({ plan }) {
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  return /* @__PURE__ */ window.wp.element.createElement(
    Ga,
    {
      className: "[&_p]:m-0!",
      title: window.wp.i18n.__("Video styling", "structura"),
      badge: window.wp.i18n.__("Cloud Pro", "structura"),
      line: window.wp.i18n.__(
        "Style presets, caption placement and brand-palette captions for every rendered video.",
        "structura"
      ),
      cta: /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(
        "a",
        {
          href: buildMarketingPricingUrl({ intent: "unlock_video", domain, plan }),
          target: "_blank",
          rel: "noreferrer"
        },
        /* @__PURE__ */ window.wp.element.createElement(ArrowUpRight, { size: 14, className: "mr-1.5", "aria-hidden": true }),
        window.wp.i18n.__("Upgrade plan", "structura")
      ))
    }
  );
}
const aspectRatioOptions = [
  { value: "1:1", label: window.wp.i18n.__("1:1 Square Format", "structura") },
  { value: "4:3", label: window.wp.i18n.__("4:3 Classic Professional", "structura") },
  { value: "3:4", label: window.wp.i18n.__("3:4 Standard Portrait", "structura") },
  { value: "16:9", label: window.wp.i18n.__("16:9 Cinematic Landscape", "structura") },
  { value: "9:16", label: window.wp.i18n.__("9:16 Vertical Portrait", "structura") }
];
const assetFormatOptions = [
  { value: "webp", label: window.wp.i18n.__("WebP (Smallest File)", "structura") },
  { value: "jpeg", label: window.wp.i18n.__("JPEG (Standard Compatibility)", "structura") },
  { value: "png", label: window.wp.i18n.__("PNG (Lossless)", "structura") }
];
function presetToDraft(p2, fallbackFormat) {
  return {
    label: p2.label,
    global_art_direction: p2.globalArtDirection,
    aspect_ratio: p2.aspectRatio,
    format: p2.format || fallbackFormat,
    optimize_on_upload: !!p2.optimizeOnUpload,
    medium: p2.medium ?? "photography",
    // Video fields ride verbatim — including `undefined`. The UI applies
    // the render defaults (clean / bottom) at display time only, so a
    // save can't materialize defaults onto a preset that never had the
    // fields (rollout back-compat, see VisualContent's docblock).
    video_style: p2.videoStyle,
    video_art_direction: p2.videoArtDirection,
    caption_placement: p2.captionPlacement,
    palette: p2.palette
  };
}
function emptyDraft(fallbackFormat, paid) {
  return {
    label: window.wp.i18n.__("Site default", "structura"),
    global_art_direction: "",
    aspect_ratio: "16:9",
    format: paid ? fallbackFormat || "webp" : "png",
    optimize_on_upload: paid,
    medium: "photography"
  };
}
const VisualsPage = () => {
  const { plan, isPaidLicense } = useLicense();
  const { data: presetsData, isLoading: isLoadingPresets } = useVisualPresetsQuery();
  const { data: legacyConfig } = useVisualQuery();
  const {
    create: create2,
    update,
    fork,
    remove,
    bind,
    isCreating,
    isUpdating,
    isForking,
    isRemoving,
    isBinding
  } = useVisualPresetMutations();
  const { suggest, isSuggesting } = useMagicSuggest();
  const { defaultImageProvider } = useDefaultProviders();
  const boundPreset = window.wp.element.useMemo(() => {
    if (!presetsData) return null;
    return presetsData.presets.find((p2) => p2.presetId === presetsData.boundPresetId) ?? null;
  }, [presetsData]);
  const otherPresets = window.wp.element.useMemo(() => {
    if (!presetsData) return [];
    return presetsData.presets.filter((p2) => p2.presetId !== presetsData.boundPresetId);
  }, [presetsData]);
  const [draft, setDraft] = window.wp.element.useState(null);
  const [isPristine, setIsPristine] = window.wp.element.useState(true);
  const [confirmDelete, setConfirmDelete] = window.wp.element.useState(null);
  window.wp.element.useEffect(() => {
    if (!presetsData || isPaidLicense === void 0) return;
    if (!isPristine) return;
    if (boundPreset) {
      setDraft(presetToDraft(boundPreset, isPaidLicense ? "webp" : "png"));
    } else {
      setDraft((prev) => prev ?? emptyDraft("webp", !!isPaidLicense));
    }
  }, [presetsData, boundPreset, isPaidLicense, isPristine]);
  const videoEligibility = useVideoStylingEligibility();
  const [searchParams] = useSearchParams();
  const videoSectionRef = window.wp.element.useRef(null);
  const [videoHighlight, setVideoHighlight] = window.wp.element.useState(false);
  const wantsVideoAnchor = searchParams.get("section") === "video";
  const videoSectionMounted = videoEligibility !== "unknown" && !!draft;
  window.wp.element.useEffect(() => {
    if (!wantsVideoAnchor || !videoSectionMounted) return;
    videoSectionRef.current?.scrollIntoView({
      behavior: "smooth",
      block: "center"
    });
    const highlightOn = setTimeout(() => setVideoHighlight(true), 150);
    const highlightOff = setTimeout(() => setVideoHighlight(false), 2150);
    return () => {
      clearTimeout(highlightOn);
      clearTimeout(highlightOff);
    };
  }, [wantsVideoAnchor, videoSectionMounted]);
  const showOpenAIRatioHint = defaultImageProvider === "openai" && (draft?.aspect_ratio === "16:9" || draft?.aspect_ratio === "9:16");
  const isShared = (boundPreset?.boundActivationCount ?? 0) > 1;
  const isBusy = isCreating || isUpdating || isForking || isRemoving || isBinding;
  const updateDraft = (patch) => {
    setIsPristine(false);
    setDraft((prev) => prev ? { ...prev, ...patch } : null);
  };
  const buildContent = (d2) => ({
    global_art_direction: d2.global_art_direction,
    aspect_ratio: d2.aspect_ratio,
    format: d2.format,
    optimize_on_upload: d2.optimize_on_upload,
    medium: d2.medium ?? "photography",
    // Video keys are omitted (not defaulted) when the draft carries
    // nothing — an untouched or plan-locked section must never overwrite
    // a preset's saved video styling. See VisualContent's docblock.
    ...d2.video_style !== void 0 ? { video_style: d2.video_style } : {},
    ...d2.video_art_direction !== void 0 ? { video_art_direction: d2.video_art_direction } : {},
    ...d2.caption_placement !== void 0 ? { caption_placement: d2.caption_placement } : {},
    ...d2.palette !== void 0 ? { palette: d2.palette } : {}
  });
  const handleSaveBound = async () => {
    if (!draft) return;
    if (!boundPreset) {
      await create2({
        label: draft.label || window.wp.i18n.__("Site default", "structura"),
        content: buildContent(draft),
        bind_to_activation: true
      });
      setIsPristine(true);
      return;
    }
    await update({
      preset_id: boundPreset.presetId,
      label: draft.label,
      content: buildContent(draft)
    });
    setIsPristine(true);
  };
  const handleSaveAsNew = async () => {
    if (!draft || !boundPreset) return;
    const result = await fork({
      preset_id: boundPreset.presetId,
      label: draft.label || `${boundPreset.label} (this site)`,
      bind_to_activation: true
    });
    if (result?.preset?.presetId) {
      await update({
        preset_id: result.preset.presetId,
        content: buildContent(draft)
      });
    }
    setIsPristine(true);
  };
  const handleUseHere = async (presetId) => {
    await bind({ preset_id: presetId });
    setIsPristine(true);
  };
  const handleDuplicate = async (presetId) => {
    await fork({ preset_id: presetId, bind_to_activation: true });
    setIsPristine(true);
  };
  const handleDeleteConfirmed = async () => {
    if (!confirmDelete) return;
    try {
      await remove(confirmDelete.presetId);
    } finally {
      setConfirmDelete(null);
    }
  };
  const videoPatchFromSuggestion = (data) => {
    if (!data) return {};
    return {
      ...typeof data.videoArtDirection === "string" && data.videoArtDirection ? { video_art_direction: data.videoArtDirection } : {},
      ...Array.isArray(data.palette) && data.palette.every((c2) => typeof c2 === "string") ? { palette: data.palette } : {}
    };
  };
  const handleMagicStyle = async (provider, context, medium) => {
    const picked = medium ?? draft?.medium ?? "photography";
    updateDraft({ medium: picked });
    const data = await suggest("visual", {
      provider,
      context,
      medium: picked
    });
    if (data?.prompt) {
      updateDraft({
        global_art_direction: data.prompt,
        ...videoPatchFromSuggestion(data)
      });
    }
  };
  const handleMagicVideoStyle = async (provider, context) => {
    const data = await suggest("visual", {
      provider,
      context,
      medium: draft?.medium ?? "photography"
    });
    const patch = videoPatchFromSuggestion(data);
    if (Object.keys(patch).length > 0) {
      updateDraft(patch);
    }
  };
  if (plan === "none") {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "mb-10 flex flex-col justify-between gap-6 md:flex-row md:items-end" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Visuals", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Image Generation & Optimization Engine", "structura")))), /* @__PURE__ */ window.wp.element.createElement(UnlicensedTeaser$1, null));
  }
  if (isLoadingPresets || !draft) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Calibrating Optics…", "structura"), size: "lg", padding: "lg" });
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "mb-10 flex flex-col justify-between gap-6 md:flex-row md:items-end" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Visuals", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, boundPreset ? window.wp.i18n.sprintf(
    /* translators: %s: preset label */
    window.wp.i18n.__("Active preset · %s", "structura"),
    boundPreset.label
  ) : window.wp.i18n.__("Image Generation & Optimization Engine", "structura"))), !isShared && /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: handleSaveBound, disabled: isBusy, loading: isUpdating || isCreating }, /* @__PURE__ */ window.wp.element.createElement(Save, { className: "size-4" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2" }, window.wp.i18n.__("Save Changes", "structura")))), !boundPreset && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50/60 p-4 dark:border-amber-900/30 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-amber-900 dark:text-amber-300" }, window.wp.i18n.__("No visual preset bound to this site", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-amber-900/80 dark:text-amber-300/80" }, window.wp.i18n.__(
    "Image generation will fail until a preset is bound. Configure one below or pick an existing preset from the workspace library.",
    "structura"
  )))), boundPreset && isShared && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50/60 p-4 dark:border-amber-900/30 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-amber-900 dark:text-amber-300" }, window.wp.i18n.sprintf(
    /* translators: %d: number of other sites */
    window.wp.i18n.__("Used by %d other site(s) in this workspace", "structura"),
    boundPreset.boundActivationCount - 1
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-amber-900/80 dark:text-amber-300/80" }, window.wp.i18n.__(
    'Saving will update the preset for every site that uses it. Pick "Save as new for this site only" to fork into an independent preset bound to this site.',
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3 flex flex-wrap gap-2" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: handleSaveBound, disabled: isBusy, loading: isUpdating }, /* @__PURE__ */ window.wp.element.createElement(Save, { className: "size-4" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2" }, window.wp.i18n.__("Save (update for all sites)", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: handleSaveAsNew,
      disabled: isBusy,
      loading: isForking,
      variant: "secondary"
    },
    /* @__PURE__ */ window.wp.element.createElement(Copy, { className: "size-4" }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2" }, window.wp.i18n.__("Save as new for this site only", "structura"))
  )))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-8 lg:grid-cols-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6 lg:col-span-2" }, /* @__PURE__ */ window.wp.element.createElement(Vt, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! mb-6! flex! items-center gap-2 text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, /* @__PURE__ */ window.wp.element.createElement(Palette, { className: "text-brand-500 h-4 w-4" }), window.wp.i18n.__("Global Image Style", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    SuggestStrategySection,
    {
      isStrategizing: isSuggesting,
      onGenerate: async (provider, context, medium) => {
        await handleMagicStyle(provider, context, medium);
      },
      mediumPicker: {
        heading: window.wp.i18n.__("Image medium", "structura"),
        current: draft.medium ?? "photography",
        options: MEDIUM_OPTIONS
      },
      toggleButtonLabel: window.wp.i18n.__("Suggest Image Style", "structura"),
      contextFieldLabel: window.wp.i18n.__(
        "Brand Resources (logo, guidelines, design system URL…)",
        "structura"
      ),
      addSourceLabel: window.wp.i18n.__("Add Resource", "structura"),
      ctaButtonLabel: window.wp.i18n.__("Generate Image Style", "structura"),
      placeholder: {
        title: window.wp.i18n.__("Company logo", "structura"),
        url: `${window.location.origin}/logo.png`
      },
      initialSources: legacyConfig?.logo_url ? [{ title: window.wp.i18n.__("Site Logo", "structura"), url: legacyConfig.logo_url }] : void 0
    }
  )), /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Preset name", "structura"),
      value: draft.label,
      onChange: (e2) => updateDraft({ label: e2.target.value }),
      placeholder: window.wp.i18n.__("Site default", "structura"),
      className: "mb-6"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium tracking-widest text-gray-400 uppercase dark:text-gray-500" }, window.wp.i18n.__("Image medium", "structura")), /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "secondary" }, MEDIUM_OPTIONS.find((o4) => o4.value === (draft.medium ?? "photography"))?.label ?? window.wp.i18n.__("Photography", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-4! text-xs font-medium tracking-widest text-gray-400 uppercase dark:text-gray-500" }, window.wp.i18n.__(
    "Inject a consistent visual style into every image generated across this site.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Global Art Direction", "structura"),
      rows: 14,
      value: draft.global_art_direction,
      onChange: (e2) => updateDraft({ global_art_direction: e2.target.value }),
      placeholder: window.wp.i18n.__("Enter global art direction directives...", "structura"),
      className: "w-full rounded-2xl border-gray-200 bg-gray-50 font-mono text-sm leading-relaxed dark:border-neutral-800 dark:bg-neutral-950",
      hiddenLabel: true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-brand-100 bg-brand-50/50 dark:border-brand-900/30 dark:bg-brand-950/20 mt-6 flex items-start gap-3 rounded-xl border p-4" }, /* @__PURE__ */ window.wp.element.createElement(Info, { className: "text-brand-500 mt-0.5 h-4 w-4" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-brand-900 dark:text-brand-300 m-0! text-xs leading-relaxed italic" }, window.wp.i18n.__(
    "This directive is injected into the latent space of every generation to maintain a cohesive visual identity for this site.",
    "structura"
  ))), videoEligibility !== "unknown" && /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      id: "video",
      ref: videoSectionRef,
      className: B$1(
        "duration-normal mt-6 border-t border-gray-200 pt-6 transition-shadow dark:border-neutral-800",
        videoHighlight && "ring-brand-400/60 rounded-xl ring-2"
      )
    },
    videoEligibility === "eligible" ? /* @__PURE__ */ window.wp.element.createElement(
      VideoPresetSection,
      {
        videoStyle: draft.video_style,
        videoArtDirection: draft.video_art_direction,
        captionPlacement: draft.caption_placement,
        palette: draft.palette,
        onVideoStyleChange: (style) => updateDraft({ video_style: style }),
        onVideoArtDirectionChange: (value) => updateDraft({ video_art_direction: value }),
        onCaptionPlacementChange: (placement) => updateDraft({ caption_placement: placement }),
        suggestSlot: /* @__PURE__ */ window.wp.element.createElement(
          SuggestStrategySection,
          {
            isStrategizing: isSuggesting,
            onGenerate: async (provider, context) => {
              await handleMagicVideoStyle(provider, context);
            },
            toggleButtonLabel: window.wp.i18n.__("Suggest Video Style", "structura"),
            contextFieldLabel: window.wp.i18n.__(
              "Brand Resources (logo, guidelines, design system URL…)",
              "structura"
            ),
            addSourceLabel: window.wp.i18n.__("Add Resource", "structura"),
            ctaButtonLabel: window.wp.i18n.__("Generate Video Style", "structura"),
            placeholder: {
              title: window.wp.i18n.__("Company logo", "structura"),
              url: `${window.location.origin}/logo.png`
            },
            initialSources: legacyConfig?.logo_url ? [
              {
                title: window.wp.i18n.__("Site Logo", "structura"),
                url: legacyConfig.logo_url
              }
            ] : void 0
          }
        )
      }
    ) : /* @__PURE__ */ window.wp.element.createElement(VideoStylingGateTeaser, { plan })
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-6!" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mt-0! mb-4! flex! items-center gap-2 text-[10px] font-bold text-gray-400 uppercase dark:text-gray-500" }, /* @__PURE__ */ window.wp.element.createElement(Maximize, { className: "h-3.5 w-3.5" }), window.wp.i18n.__("Output Dimensions", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      options: aspectRatioOptions,
      onValueChange: (val) => updateDraft({ aspect_ratio: val }),
      value: draft.aspect_ratio
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select dimensions...", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, aspectRatioOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  ), showOpenAIRatioHint && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3 flex items-start gap-2 rounded-lg border border-amber-200 bg-amber-50/60 p-3 dark:border-amber-900/30 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement(Info, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-amber-900 dark:text-amber-300" }, draft.aspect_ratio === "16:9" ? window.wp.i18n.__(
    "OpenAI image models don't support 16:9 natively — your images will be rendered at 3:2 (1536×1024), the closest landscape size. For exact 16:9, switch the image provider to Gemini.",
    "structura"
  ) : window.wp.i18n.__(
    "OpenAI image models don't support 9:16 natively — your images will be rendered at 2:3 (1024×1536), the closest portrait size. For exact 9:16, switch the image provider to Gemini.",
    "structura"
  )))), /* @__PURE__ */ window.wp.element.createElement(
    Vt,
    {
      className: B$1(
        "duration-normal p-6! transition-all",
        !isPaidLicense && "pointer-events-none border-dashed border-gray-300 opacity-60 grayscale-[0.5]"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-[10px] font-bold text-gray-400 uppercase dark:text-gray-500" }, /* @__PURE__ */ window.wp.element.createElement(FileCode, { className: "h-3.5 w-3.5 text-emerald-500" }), window.wp.i18n.__("Format Encoding", "structura")), !isPaidLicense && /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "premium", variant: "solid", className: "px-2 text-[8px]" }, window.wp.i18n.__("Pro", "structura"))),
    /* @__PURE__ */ window.wp.element.createElement(
      Zn,
      {
        disabled: !isPaidLicense,
        onValueChange: (val) => updateDraft({ format: val }),
        value: draft.format,
        options: assetFormatOptions
      },
      /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select encoding...", "structura") }),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, assetFormatOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
    )
  ), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-6!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-[10px] font-bold text-gray-400 uppercase dark:text-gray-500" }, /* @__PURE__ */ window.wp.element.createElement(SearchCheck, { className: "text-brand-500 h-3.5 w-3.5" }), window.wp.i18n.__("SEO Automation", "structura")), /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success", variant: "solid", className: "px-2 text-[8px]" }, window.wp.i18n.__("Always on", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-0! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Every generated image automatically gets accessible alt-text and a human-friendly, SEO-ready filename. No setup required.",
    "structura"
  ))))), otherPresets.length > 0 && /* @__PURE__ */ window.wp.element.createElement(Vt, null, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! mb-4! flex! items-center gap-2 text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, /* @__PURE__ */ window.wp.element.createElement(Palette, { className: "text-brand-500 h-4 w-4" }), window.wp.i18n.__("Other presets in this workspace", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-6! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Use here binds this site to that preset (edits will propagate). Duplicate clones it into a new preset bound only to this site.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "list-none space-y-3 p-0" }, otherPresets.map((p2) => /* @__PURE__ */ window.wp.element.createElement(
    "li",
    {
      key: p2.presetId,
      className: "flex flex-col gap-3 rounded-xl border border-gray-200 bg-gray-50 p-4 sm:flex-row sm:items-center sm:justify-between dark:border-neutral-800 dark:bg-neutral-950"
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "truncate text-sm font-medium text-gray-900 dark:text-white" }, p2.label), /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "outline", className: "text-[10px]" }, window.wp.i18n.sprintf(
      /* translators: %d: number of sites */
      window.wp.i18n.__("Used by %d site(s)", "structura"),
      p2.boundActivationCount
    ))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1!line-clamp-2 mb-0! text-xs text-gray-500 dark:text-gray-400" }, p2.globalArtDirection || window.wp.i18n.__("(no art direction)", "structura"))),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", onClick: () => handleUseHere(p2.presetId), disabled: isBusy }, window.wp.i18n.__("Use here", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        size: "sm",
        variant: "secondary",
        onClick: () => handleDuplicate(p2.presetId),
        disabled: isBusy
      },
      /* @__PURE__ */ window.wp.element.createElement(Copy, { className: "size-3.5" }),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1.5" }, window.wp.i18n.__("Duplicate to this site", "structura"))
    ), p2.boundActivationCount === 0 && /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        size: "sm",
        variant: "transparent",
        onClick: () => setConfirmDelete(p2),
        disabled: isBusy
      },
      /* @__PURE__ */ window.wp.element.createElement(Trash2, { className: "size-3.5" })
    ))
  )))), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: !!confirmDelete,
      onClose: () => setConfirmDelete(null),
      onConfirm: handleDeleteConfirmed,
      title: window.wp.i18n.__("Delete preset?", "structura"),
      description: confirmDelete ? window.wp.i18n.sprintf(
        /* translators: %s: preset label */
        window.wp.i18n.__('Delete "%s"? This is only allowed when no site is bound to it.', "structura"),
        confirmDelete.label
      ) : "",
      variant: "danger",
      loading: isRemoving,
      confirmButtonProps: { label: window.wp.i18n.__("Delete", "structura") },
      cancelButtonProps: { label: window.wp.i18n.__("Cancel", "structura") }
    }
  ));
};
const UnlicensedTeaser$1 = () => {
  const { plan } = useLicense();
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center gap-6 rounded-3xl border-2 border-dashed border-neutral-200 bg-neutral-50 px-8 py-20 text-center dark:border-neutral-700 dark:bg-neutral-900/50" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-100 text-brand-600 dark:bg-brand-950/30 dark:text-brand-400 flex size-16 items-center justify-center rounded-2xl" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 28 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-lg font-black tracking-tight text-neutral-900 dark:text-white" }, window.wp.i18n.__("Style Every Image Consistently", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mx-auto max-w-sm text-sm leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Connect a free account to define a Global Art Direction that gets injected into every AI image generation across this site.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-3 sm:flex-row" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildPortalSignupUrl({
        intent: "unlock_visuals",
        domain,
        plan
      }),
      target: "_blank",
      rel: "noreferrer",
      className: "text-white!"
    },
    window.wp.i18n.__("Get Free License", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 16, className: "ml-2", strokeWidth: 2.5 })
  )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildMarketingPricingUrl({
        intent: "unlock_visuals",
        domain,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    window.wp.i18n.__("View Pricing", "structura")
  ))));
};
const useSettingsMutations = () => {
  const queryClient2 = useQueryClient();
  const updateSettings = useMutation({
    mutationFn: async ({ slice, data }) => window.wp.apiFetch({
      path: "/structura/v1/settings",
      method: "POST",
      data: { [slice]: data }
    }),
    onSuccess: (_data, vars) => {
      capture("settings_saved", { slice: vars.slice });
      An.success(window.wp.i18n.__("Settings synchronized.", "structura"));
      queryClient2.invalidateQueries({ queryKey: settingsKeys.all });
    }
  });
  const saveKey = useMutation({
    mutationFn: (vars) => window.wp.apiFetch({ path: "/structura/v1/keys", method: "POST", data: vars }),
    onSuccess: (_data, vars) => {
      capture("ai_key_saved", { provider: vars.provider });
      An.success(window.wp.i18n.__("API key secured.", "structura"));
      queryClient2.invalidateQueries({ queryKey: settingsKeys.all });
    }
  });
  return {
    isUpdating: updateSettings.isPending,
    updateSettings: updateSettings.mutateAsync,
    saveKey: saveKey.mutateAsync
  };
};
const useAiConnections = () => {
  const { data: settings, isLoading, isFetching } = useSettingsQuery();
  const ai = settings?.ai;
  const activeProviders = ai?.providers ? Object.entries(ai.providers).filter(([_2, p2]) => p2.connected).map(([slug]) => slug) : [];
  const getProvidersByCapability = (capability) => ai?.providers ? Object.entries(ai.providers).filter(([_2, p2]) => p2.connected && p2.capabilities.includes(capability)).map(([slug]) => slug) : [];
  const incompleteProviders = ai?.providers ? Object.entries(ai.providers).filter(([_2, p2]) => {
    if (!p2.connected) return false;
    const needsText = p2.capabilities.includes("text") && !p2.text_model;
    const needsImage = p2.capabilities.includes("image") && !p2.image_model;
    return needsText || needsImage;
  }).map(([slug]) => slug) : [];
  return {
    activeProviders,
    textProviders: getProvidersByCapability("text"),
    imageProviders: getProvidersByCapability("image"),
    incompleteProviders,
    isLoading,
    /**
     * True while the background revalidation against
     * `/structura/v1/settings` is in flight. Combine with
     * `isLoading` when deciding whether to render UI that depends
     * on the cloud-derived `connected` / `masked_key` fields — on
     * first paint those fields are absent (the wp_localize
     * bootstrap omits them) and only land after the
     * revalidation settles. `DisconnectedProvidersBanner` reads
     * this to skip its first-paint flash.
     */
    isFetching,
    isProviderActive: (slug) => activeProviders.includes(slug),
    isProviderIncomplete: (slug) => incompleteProviders.includes(slug)
  };
};
({
  label: window.wp.i18n.__("AI", "structura")
});
const looksLikeUrlNotApiKey = (value) => /^([a-z][a-z0-9+.-]*:\/\/|www\.)/i.test(value.trim());
const useProviderPulse = (providerId, isConnected) => {
  const { data, isFetching, refetch, isSuccess } = useQuery({
    queryKey: ["provider-heartbeat", providerId],
    queryFn: () => window.wp.apiFetch({
      path: `/structura/v1/heartbeat/${providerId}`
    }),
    enabled: isConnected,
    staleTime: 0,
    gcTime: 1e3 * 60 * 5
  });
  const handleCheck = () => {
    if (!isConnected) return;
    refetch();
  };
  return {
    isOnline: isSuccess && data?.status === "online",
    latency: typeof data?.latency === "number" && data.latency > 0 ? data.latency : null,
    isChecking: isFetching,
    checkPulse: handleCheck
  };
};
const useDisconnectProvider = () => {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: (provider) => window.wp.apiFetch({
      path: `/structura/v1/engine/disconnect/${provider}`,
      method: "DELETE"
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Provider disconnected successfully.", "structura"));
      queryClient2.invalidateQueries({ queryKey: settingsKeys.all });
    }
  });
};
const CAPABILITY_CONFIG$1 = {
  text: {
    label: "Text",
    icon: Type,
    classes: "bg-blue-50 text-blue-600 border-blue-200 dark:bg-blue-950/30 dark:text-blue-400 dark:border-blue-800"
  },
  image: {
    label: "Image",
    icon: Image,
    classes: "bg-purple-50 text-purple-600 border-purple-200 dark:bg-purple-950/30 dark:text-purple-400 dark:border-purple-800"
  }
};
const InstalledProviderCard = ({
  id,
  name,
  description,
  capabilities,
  maskedKey,
  isCloud,
  isDefaultText,
  isDefaultImage,
  hideDefaultBadges = false,
  incomplete = false,
  onManage
}) => {
  const { latency, isChecking, checkPulse } = useProviderPulse(id, true);
  const { mutateAsync: disconnect, isPending: isDisconnecting } = useDisconnectProvider();
  const [confirmOpen, setConfirmOpen] = window.wp.element.useState(false);
  const providerVis = getProviderVisual(id);
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "group relative flex flex-col rounded-2xl border bg-white shadow-sm transition-all dark:bg-neutral-900",
        incomplete ? "border-amber-300/60 dark:border-amber-700/40" : B$1(providerVis.border, providerVis.glow)
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-1 flex-col gap-4 p-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "flex size-11 shrink-0 items-center justify-center rounded-xl",
          "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500"
        )
      },
      (() => {
        const Icon2 = providerVis.icon;
        return /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 22 });
      })()
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! truncate text-sm leading-tight font-bold text-neutral-900 dark:text-neutral-100" }, name), incomplete ? /* @__PURE__ */ window.wp.element.createElement(
      ce,
      {
        title: window.wp.i18n.__(
          "Setup incomplete — select models in the provider settings",
          "structura"
        ),
        position: "top"
      },
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 14, className: "text-amber-500" }))
    ) : /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { size: 14, className: "shrink-0 text-emerald-500" })), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5!line-clamp-2 mb-0! text-[11px] leading-relaxed text-neutral-400 dark:text-neutral-500" }, description))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center gap-1.5" }, capabilities.map((cap) => {
      const cfg = CAPABILITY_CONFIG$1[cap];
      if (!cfg) return null;
      const Icon2 = cfg.icon;
      return /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          key: cap,
          className: B$1(
            "inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[9px] font-bold uppercase",
            cfg.classes
          )
        },
        /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 10 }),
        cfg.label
      );
    }), incomplete && /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1 rounded-md border border-amber-300 bg-amber-50 px-2 py-0.5 text-[9px] font-bold text-amber-700 uppercase dark:border-amber-700 dark:bg-amber-950/30 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 9 }), window.wp.i18n.__("Incomplete Setup", "structura")), isDefaultText && !hideDefaultBadges && /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1 rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-[9px] font-bold text-amber-600 uppercase dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(Star, { size: 9 }), window.wp.i18n.__("Default Text", "structura")), isDefaultImage && !hideDefaultBadges && /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1 rounded-md border border-amber-200 bg-amber-50 px-2 py-0.5 text-[9px] font-bold text-amber-600 uppercase dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(Star, { size: 9 }), window.wp.i18n.__("Default Image", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-t border-neutral-100 pt-3 dark:border-neutral-800" }, isCloud ? /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400" }, /* @__PURE__ */ window.wp.element.createElement(ShieldCheck, { size: 12 }), window.wp.i18n.__("Managed by Structura Cloud", "structura")) : /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[10px] text-neutral-300 dark:text-neutral-600" }, maskedKey), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1" }, latency !== null && /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "outline", intent: "secondary", className: "py-0 font-mono text-[9px]" }, latency, "ms"), !isCloud && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        onClick: () => checkPulse(),
        loading: isChecking,
        title: window.wp.i18n.__("Check connection", "structura")
      },
      /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 12, className: isChecking ? "animate-spin" : "" })
    ), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        onClick: onManage,
        title: window.wp.i18n.__("Manage", "structura")
      },
      /* @__PURE__ */ window.wp.element.createElement(Settings2, { size: 12 })
    ), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        onClick: () => setConfirmOpen(true),
        title: window.wp.i18n.__("Disconnect", "structura")
      },
      /* @__PURE__ */ window.wp.element.createElement(Trash2, { className: "size-3 text-red-500" })
    )))))
  ), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: confirmOpen,
      variant: "danger",
      loading: isDisconnecting,
      onClose: () => setConfirmOpen(false),
      onConfirm: async () => {
        await disconnect(id);
        setConfirmOpen(false);
      },
      title: window.wp.i18n.__("Disconnect Provider", "structura"),
      description: window.wp.i18n.__(
        "This will remove your API key. Campaigns using this provider will not be able to generate content until a new key is connected.",
        "structura"
      ),
      confirmButtonProps: { label: window.wp.i18n.__("Disconnect", "structura") }
    }
  ));
};
const CAPABILITY_CONFIG = {
  text: {
    labelKey: "text",
    icon: Type,
    classes: "bg-blue-50 text-blue-600 border-blue-200 dark:bg-blue-950/30 dark:text-blue-400 dark:border-blue-800"
  },
  image: {
    labelKey: "image",
    icon: Image,
    classes: "bg-purple-50 text-purple-600 border-purple-200 dark:bg-purple-950/30 dark:text-purple-400 dark:border-purple-800"
  }
};
const capabilityLabel$1 = (key) => key === "text" ? window.wp.i18n.__("Text", "structura") : window.wp.i18n.__("Image", "structura");
const tierLabel$1 = (tier) => {
  switch (tier) {
    case "none":
      return window.wp.i18n.__("Starter", "structura");
    case "free":
      return window.wp.i18n.__("Free License", "structura");
    case "byok":
      return window.wp.i18n.__("Pro License", "structura");
    case "cloud":
      return window.wp.i18n.__("Cloud License", "structura");
    case "cloud_pro":
      return window.wp.i18n.__("Agency License", "structura");
    default:
      return tier;
  }
};
const AvailableProviderCard = ({
  id,
  name,
  description,
  capabilities,
  available,
  minTier,
  onSetUp,
  lockReason = "tier"
}) => {
  const isLocked = !available;
  const isCapLock = isLocked && lockReason === "cap";
  const badgeTier = isCapLock ? "free" : minTier;
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "group relative flex flex-col rounded-2xl border bg-white shadow-sm transition-all",
        "dark:bg-neutral-900",
        isLocked ? "border-neutral-200/60 dark:border-neutral-700/60" : "border-neutral-200 hover:border-neutral-300 hover:shadow-md dark:border-neutral-700 dark:hover:border-neutral-600"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-1 flex-col gap-4 p-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "flex size-11 shrink-0 items-center justify-center rounded-xl",
          "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500"
        )
      },
      (() => {
        const Icon2 = getProviderVisual(id).icon;
        return /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 22 });
      })()
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! truncate text-sm leading-tight font-bold text-neutral-900 dark:text-neutral-100" }, name), isLocked && /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex shrink-0 items-center gap-1 rounded-full border border-amber-200 bg-amber-50 px-2 py-0.5 text-[9px] font-bold text-amber-600 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 8 }), tierLabel$1(badgeTier))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5 mb-0! line-clamp-2 text-[11px] leading-relaxed text-neutral-400 dark:text-neutral-500" }, description))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center gap-1.5" }, capabilities.map((cap) => {
      const cfg = CAPABILITY_CONFIG[cap];
      if (!cfg) return null;
      const Icon2 = cfg.icon;
      return /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          key: cap,
          className: B$1(
            "inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[9px] font-bold uppercase",
            isLocked ? "border-neutral-200 bg-neutral-50 text-neutral-400 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500" : cfg.classes
          )
        },
        /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 10 }),
        capabilityLabel$1(cfg.labelKey)
      );
    })), isCapLock && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
      "You've connected the maximum number of providers for your plan. Get a Free license to add another.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        onClick: onSetUp,
        className: "mt-auto w-full justify-center"
      },
      isCapLock ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 14, className: "mr-2", strokeWidth: 2 }), window.wp.i18n.__("Get Free License", "structura")) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 14, className: "mr-2", strokeWidth: 2 }), window.wp.i18n.__("Connect", "structura"))
    ))
  );
};
const useSaveKey = () => {
  const queryClient2 = useQueryClient();
  const { successToast } = Mn();
  return useMutation({
    mutationFn: (data) => window.wp.apiFetch({
      path: "/structura/v1/keys",
      method: "POST",
      data
    }),
    onSuccess: () => {
      successToast(window.wp.i18n.__("Key authenticated and encrypted.", "structura"));
      queryClient2.invalidateQueries({ queryKey: settingsKeys.all });
    }
  });
};
const useAvailableModelsQuery = () => {
  return useQuery({
    queryKey: ["models"],
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/models" }),
    staleTime: 1e3 * 60 * 60
  });
};
const useRefreshModels = () => {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: () => window.wp.apiFetch({ path: "/structura/v1/models/refresh", method: "POST" }),
    onSuccess: () => {
      queryClient2.invalidateQueries({ queryKey: ["models"] });
    }
  });
};
const useUpdateAiSettings = () => {
  const queryClient2 = useQueryClient();
  const { successToast, errorToast } = Mn();
  return useMutation({
    mutationFn: (data) => window.wp.apiFetch({
      path: "/structura/v1/settings",
      method: "POST",
      data
    }),
    onSuccess: () => {
      successToast(window.wp.i18n.__("Processor configuration updated.", "structura"));
      queryClient2.invalidateQueries({ queryKey: settingsKeys.all });
    },
    onError: () => {
      errorToast(window.wp.i18n.__("Failed to update configuration.", "structura"));
    }
  });
};
const STEPS = ["intro", "key", "test", "models"];
const STEP_LABELS = {
  intro: window.wp.i18n.__("Overview", "structura"),
  key: window.wp.i18n.__("API Key", "structura"),
  test: window.wp.i18n.__("Connection", "structura"),
  models: window.wp.i18n.__("Configure", "structura")
};
const CAPABILITY_META = {
  text: {
    label: window.wp.i18n.__("Text Generation", "structura"),
    icon: Type,
    color: "text-blue-500",
    description: window.wp.i18n.__(
      "Generate blog posts, articles, meta descriptions, and other written content.",
      "structura"
    )
  },
  image: {
    label: window.wp.i18n.__("Image Generation", "structura"),
    icon: Image,
    color: "text-purple-500",
    description: window.wp.i18n.__(
      "Create featured images, body illustrations, and other visual content.",
      "structura"
    )
  }
};
const ProviderSetupWizard = ({
  open,
  onClose,
  providerId,
  providerName,
  description,
  capabilities,
  keyUrl,
  keyPrefix,
  isConnected = false,
  currentTextModel,
  currentImageModel,
  isDefaultText = false,
  isDefaultImage = false,
  providerCountCap = 3
}) => {
  const forceDefaults = providerCountCap === 1;
  const [step, setStep] = window.wp.element.useState(isConnected ? "models" : "intro");
  const [keyInput, setKeyInput] = window.wp.element.useState("");
  const [keySubmitted, setKeySubmitted] = window.wp.element.useState(isConnected);
  const urlPasted = looksLikeUrlNotApiKey(keyInput);
  const [selectedTextModel, setSelectedTextModel] = window.wp.element.useState(currentTextModel ?? "");
  const [selectedImageModel, setSelectedImageModel] = window.wp.element.useState(currentImageModel ?? "");
  const [setDefaultText, setSetDefaultText] = window.wp.element.useState(!isConnected || isDefaultText);
  const [setDefaultImage, setSetDefaultImage] = window.wp.element.useState(!isConnected || isDefaultImage);
  const effectiveDefaultText = forceDefaults ? true : setDefaultText;
  const effectiveDefaultImage = forceDefaults ? true : setDefaultImage;
  const { mutate: saveKey, isPending: isSavingKey } = useSaveKey();
  const { isOnline, latency, isChecking, checkPulse } = useProviderPulse(providerId, keySubmitted);
  const { data: modelsData } = useAvailableModelsQuery();
  const { mutate: refreshModels, isPending: isRefreshing } = useRefreshModels();
  const { mutate: updateSettings, isPending: isSavingModels } = useUpdateAiSettings();
  const currentStepIndex = STEPS.indexOf(step);
  const textModels = (modelsData?.text ?? []).filter((m3) => m3.provider === providerId && !m3.fast);
  const imageModels = (modelsData?.image ?? []).filter((m3) => m3.provider === providerId && !m3.fast);
  const defaultModels = modelsData?.defaults?.[providerId];
  const recommendedTextModelId = textModels.find((m3) => m3.recommended)?.id;
  const recommendedImageModelId = imageModels.find((m3) => m3.recommended)?.id;
  const hasText = capabilities.includes("text");
  const hasImage = capabilities.includes("image");
  window.wp.element.useEffect(() => {
    if (hasText && !selectedTextModel && textModels.length > 0) {
      const initial = recommendedTextModelId || defaultModels?.text;
      if (initial) setSelectedTextModel(initial);
    }
    if (hasImage && !selectedImageModel && imageModels.length > 0) {
      const initial = recommendedImageModelId || defaultModels?.image;
      if (initial) setSelectedImageModel(initial);
    }
  }, [
    hasText,
    hasImage,
    selectedTextModel,
    selectedImageModel,
    textModels.length,
    imageModels.length,
    recommendedTextModelId,
    recommendedImageModelId,
    defaultModels?.text,
    defaultModels?.image
  ]);
  const effectiveTextModel = selectedTextModel || recommendedTextModelId || defaultModels?.text || "";
  const effectiveImageModel = selectedImageModel || recommendedImageModelId || defaultModels?.image || "";
  const missingRequiredModels = hasText && textModels.length > 0 && !effectiveTextModel || hasImage && imageModels.length > 0 && !effectiveImageModel;
  const [hasAutoRefreshed, setHasAutoRefreshed] = window.wp.element.useState(false);
  const noModelsAvailable = textModels.length === 0 && imageModels.length === 0;
  window.wp.element.useEffect(() => {
    if (step === "models" && noModelsAvailable && modelsData && !hasAutoRefreshed && !isRefreshing) {
      setHasAutoRefreshed(true);
      refreshModels();
    }
  }, [step, noModelsAvailable, modelsData, hasAutoRefreshed, isRefreshing, refreshModels]);
  const handleSubmitKey = window.wp.element.useCallback(() => {
    if (!keyInput.trim() || urlPasted) return;
    saveKey(
      { provider: providerId, key: keyInput.trim() },
      {
        onSuccess: () => {
          setKeySubmitted(true);
          setKeyInput("");
          setStep("test");
        }
      }
    );
  }, [keyInput, urlPasted, providerId, saveKey]);
  const handleTestConnection = window.wp.element.useCallback(() => {
    checkPulse();
  }, [checkPulse]);
  const handleFinish = window.wp.element.useCallback(() => {
    const data = { ai: {} };
    if (effectiveTextModel || effectiveImageModel) {
      data.ai[providerId] = {
        ...effectiveTextModel && { text_model: effectiveTextModel },
        ...effectiveImageModel && { image_model: effectiveImageModel }
      };
    }
    const defaults = {};
    if (hasText && effectiveDefaultText) defaults.text_provider = providerId;
    if (hasText && !effectiveDefaultText && isDefaultText) defaults.text_provider = "";
    if (hasImage && effectiveDefaultImage) defaults.image_provider = providerId;
    if (hasImage && !effectiveDefaultImage && isDefaultImage) defaults.image_provider = "";
    if (Object.keys(defaults).length > 0) {
      data.ai.defaults = defaults;
    }
    if (Object.keys(data.ai).length > 0) {
      updateSettings(data, { onSuccess: () => onClose() });
    } else {
      onClose();
    }
  }, [
    effectiveTextModel,
    effectiveImageModel,
    effectiveDefaultText,
    effectiveDefaultImage,
    hasText,
    hasImage,
    providerId,
    isDefaultText,
    isDefaultImage,
    updateSettings,
    onClose
  ]);
  const goNext = () => {
    const next = STEPS[currentStepIndex + 1];
    if (next) setStep(next);
  };
  const goBack = () => {
    const prev = STEPS[currentStepIndex - 1];
    if (prev) setStep(prev);
  };
  const handleClose = () => {
    setStep(isConnected ? "models" : "intro");
    setKeyInput("");
    setKeySubmitted(isConnected);
    onClose();
  };
  return /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open, onClose: handleClose, size: "lg" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-center justify-center gap-1" }, STEPS.map((s2, i2) => {
    const isActive = s2 === step;
    const isComplete = i2 < currentStepIndex;
    return /* @__PURE__ */ window.wp.element.createElement("div", { key: s2, className: "flex items-center gap-1" }, i2 > 0 && /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "h-px w-8 transition-colors",
          isComplete ? "bg-emerald-400" : "bg-neutral-200 dark:bg-neutral-700"
        )
      }
    ), /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "flex items-center gap-1.5 rounded-full px-3 py-1 text-[10px] font-bold uppercase transition-all",
          isActive ? "bg-neutral-900 text-white dark:bg-white dark:text-neutral-900" : isComplete ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-950/30 dark:text-emerald-400" : "text-neutral-400 dark:text-neutral-500"
        )
      },
      isComplete && /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { size: 10 }),
      STEP_LABELS[s2]
    ));
  })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-h-75" }, step === "intro" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6 text-center" }, (() => {
    const visual = getProviderVisual(providerId);
    const Icon2 = visual.icon;
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "mx-auto flex size-16 items-center justify-center rounded-2xl shadow-sm",
          "bg-neutral-100 dark:bg-neutral-800",
          visual.color
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 32 })
    );
  })(), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-md text-center" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-xl font-bold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Set up", "structura"), " ", providerName), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mx-auto mt-2 text-sm text-neutral-500 dark:text-neutral-400" }, description)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto flex max-w-md flex-col gap-3" }, capabilities.map((cap) => {
    const capMeta = CAPABILITY_META[cap];
    if (!capMeta) return null;
    const Icon2 = capMeta.icon;
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        key: cap,
        className: "flex items-start gap-3 rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 text-left dark:border-neutral-800 dark:bg-neutral-800/30"
      },
      /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 18, className: B$1("mt-0.5 shrink-0", capMeta.color) }),
      /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-bold text-neutral-900 dark:text-neutral-100" }, capMeta.label), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-[11px] leading-relaxed text-neutral-400" }, capMeta.description))
    );
  }))), step === "key" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-md space-y-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto mb-4 flex size-12 items-center justify-center rounded-xl bg-amber-50 dark:bg-amber-950/30" }, /* @__PURE__ */ window.wp.element.createElement(Key, { size: 20, className: "text-amber-500" })), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-lg font-bold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Enter your API key", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Your key is encrypted with AES-256-CBC and never leaves your server.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("API Key", "structura"),
      type: "password",
      value: keyInput,
      onChange: (e2) => setKeyInput(e2.target.value),
      placeholder: keyPrefix ?? window.wp.i18n.__("Enter API key...", "structura"),
      autoComplete: "off",
      onKeyDown: (e2) => {
        if (e2.key === "Enter") handleSubmitKey();
      },
      error: urlPasted ? keyPrefix ? window.wp.i18n.sprintf(
        /* translators: %s: the provider's API key prefix, e.g. "sk-" */
        window.wp.i18n.__(
          'That looks like a web address, not an API key. Paste the key itself — it starts with "%s".',
          "structura"
        ),
        keyPrefix
      ) : window.wp.i18n.__(
        "That looks like a web address, not an API key. Paste the key itself from your provider's dashboard.",
        "structura"
      ) : void 0
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: keyUrl,
      target: "_blank",
      rel: "noopener noreferrer",
      className: "hover:text-brand-600 inline-flex items-center gap-1.5 text-xs font-medium text-neutral-400 no-underline transition-colors dark:text-neutral-500"
    },
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 12 }),
    window.wp.i18n.__("Get your API key from", "structura"),
    " ",
    providerName
  )), step === "test" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-md space-y-6 text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto mb-4 flex size-12 items-center justify-center rounded-xl bg-emerald-50 dark:bg-emerald-950/30" }, isChecking ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 20, className: "animate-spin text-emerald-500" }) : isOnline ? /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { size: 20, className: "text-emerald-500" }) : /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 20, className: "text-emerald-500" })), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-lg font-bold text-neutral-900 dark:text-white" }, isOnline ? window.wp.i18n.__("Connection successful", "structura") : isChecking ? window.wp.i18n.__("Testing connection...", "structura") : window.wp.i18n.__("Test your connection", "structura")), isOnline && latency !== null && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-sm text-neutral-500" }, window.wp.i18n.__("Response time:", "structura"), " ", /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono font-bold text-emerald-600" }, latency, "ms"))), !isOnline && !isChecking && /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "accent", onClick: handleTestConnection, className: "mx-auto" }, /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Test Connection", "structura")), isOnline && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-emerald-100 bg-emerald-50/50 p-4 dark:border-emerald-900/30 dark:bg-emerald-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs leading-relaxed text-emerald-700 dark:text-emerald-300" }, window.wp.i18n.__(
    "Your API key is valid and the provider is responding. Next, choose your preferred models.",
    "structura"
  )))), step === "models" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-md space-y-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto mb-4 flex size-12 items-center justify-center rounded-xl bg-violet-50 dark:bg-violet-950/30" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 20, className: "text-violet-500" })), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-lg font-bold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Configure provider", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Pick models and set this provider as your default.", "structura"))), hasText && textModels.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(Type, { size: 12, className: "text-blue-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Text Model", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: selectedTextModel || recommendedTextModelId || defaultModels?.text || "",
      onValueChange: (val) => setSelectedTextModel(val),
      options: textModels.map((m3) => ({ value: m3.id, label: m3.name }))
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select model...", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, textModels.map((m3) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: m3.id, value: m3.id }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", null, m3.name), m3.recommended && /* @__PURE__ */ window.wp.element.createElement("span", { className: "bg-brand-100 text-brand-700 dark:bg-brand-950/50 dark:text-brand-300 inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-bold tracking-wider uppercase" }, window.wp.i18n.__("Recommended", "structura"))))))
  )), hasImage && imageModels.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(Image, { size: 12, className: "text-purple-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Image Model", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: selectedImageModel || recommendedImageModelId || defaultModels?.image || "",
      onValueChange: (val) => setSelectedImageModel(val),
      options: imageModels.map((m3) => ({ value: m3.id, label: m3.name }))
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select model...", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, imageModels.map((m3) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: m3.id, value: m3.id }, m3.name)))
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3 rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 dark:border-neutral-800 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(Star, { size: 12, className: "text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Default Provider", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! text-[11px] leading-relaxed text-neutral-400" }, forceDefaults ? window.wp.i18n.__(
    "Your plan supports one provider at a time, so this provider is automatically your default. The setting is saved and will carry over if you add more providers later.",
    "structura"
  ) : window.wp.i18n.__(
    "New campaigns will use default providers automatically. You can override per campaign.",
    "structura"
  )), hasText && /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Default for text generation", "structura"),
      checked: effectiveDefaultText,
      onChange: forceDefaults ? () => {
      } : setSetDefaultText,
      disabled: forceDefaults
    }
  ), hasImage && /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Default for image generation", "structura"),
      checked: effectiveDefaultImage,
      onChange: forceDefaults ? () => {
      } : setSetDefaultImage,
      disabled: forceDefaults
    }
  )), noModelsAvailable && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-amber-100 bg-amber-50/50 p-4 text-center dark:border-amber-900/30 dark:bg-amber-950/20" }, isRefreshing ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mx-auto mb-1.5 animate-spin text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-600 dark:text-amber-400" }, window.wp.i18n.__("Refreshing model catalog…", "structura"))) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-2 text-xs text-amber-600 dark:text-amber-400" }, window.wp.i18n.__(
    "No models available for this provider yet. The model catalog may need to sync.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", onClick: () => refreshModels() }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 12, className: "mr-1.5" }), window.wp.i18n.__("Refresh Models", "structura")))))), /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex w-full items-center justify-between" }, currentStepIndex > 0 && !isConnected ? /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: goBack }, /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Back", "structura")) : /* @__PURE__ */ window.wp.element.createElement("div", null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: handleClose }, window.wp.i18n.__("Cancel", "structura")), step === "intro" && /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "accent", onClick: goNext }, window.wp.i18n.__("Get Started", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })), step === "key" && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "accent",
      onClick: handleSubmitKey,
      loading: isSavingKey,
      disabled: !keyInput.trim() || urlPasted
    },
    window.wp.i18n.__("Save & Test", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })
  ), step === "test" && /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "accent", onClick: goNext, disabled: !isOnline }, window.wp.i18n.__("Configure", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })), step === "models" && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "accent",
      onClick: handleFinish,
      loading: isSavingModels,
      disabled: missingRequiredModels || textModels.length === 0 && imageModels.length === 0
    },
    /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { size: 14, className: "mr-1.5" }),
    isConnected ? window.wp.i18n.__("Save Changes", "structura") : window.wp.i18n.__("Finish Setup", "structura")
  ))))));
};
const TIER_LABELS = {
  none: "Starter",
  free: "Free",
  byok: "Pro",
  cloud: "Cloud",
  cloud_pro: "Agency"
};
const TIER_FEATURES = {
  free: [
    window.wp.i18n.__("Connect your own API keys", "structura"),
    window.wp.i18n.__("Text generation with any supported provider", "structura"),
    window.wp.i18n.__("Basic SEO optimization rules", "structura")
  ],
  // Same Wave-2 slug rename — feature list is keyed by the actual
  // plan slug surfaced from the catalog (anthropic.min_tier === "byok").
  byok: [
    window.wp.i18n.__("Everything in Free, plus:", "structura"),
    window.wp.i18n.__("Image generation (featured & body images)", "structura"),
    window.wp.i18n.__("Advanced SEO directives", "structura"),
    window.wp.i18n.__("All content block types", "structura"),
    window.wp.i18n.__("Priority support", "structura")
  ]
};
const CAP_LOCK_FEATURES = [
  window.wp.i18n.__("Connect a second AI provider on this site", "structura"),
  window.wp.i18n.__("Switch between providers per campaign without disconnecting", "structura"),
  window.wp.i18n.__("Keep all your existing settings, personas, and visuals", "structura")
];
const ProviderUpgradeDialog = ({
  open,
  onClose,
  providerName,
  providerId,
  description,
  capabilities,
  minTier,
  lockReason = "tier",
  fromProviderId,
  plan
}) => {
  const providerVisual = getProviderVisual(providerId);
  const ProviderIcon = providerVisual.icon;
  const isCapLock = lockReason === "cap";
  const targetTier = isCapLock ? "free" : minTier;
  const tierLabel2 = TIER_LABELS[targetTier] ?? targetTier;
  const features = isCapLock ? CAP_LOCK_FEATURES : TIER_FEATURES[minTier] ?? TIER_FEATURES.free;
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  const portalUrl = isCapLock ? buildPortalSignupUrl({
    intent: "connect_more_providers",
    domain,
    plan,
    providerId,
    fromProviderId
  }) : buildPortalSignupUrl({
    intent: "unlock_provider",
    domain,
    plan,
    providerId
  });
  return /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open, onClose, size: "md" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6 text-center" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "mx-auto flex size-16 items-center justify-center rounded-2xl shadow-sm",
        "bg-neutral-100 dark:bg-neutral-800",
        providerVisual.color
      )
    },
    /* @__PURE__ */ window.wp.element.createElement(ProviderIcon, { size: 32 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-xl font-bold text-neutral-900 dark:text-white" }, providerName), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mx-auto mt-2 max-w-sm text-sm text-neutral-500 dark:text-neutral-400" }, description)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-sm rounded-xl border border-amber-200 bg-amber-50/50 p-4 dark:border-amber-800/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-3 flex items-center justify-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 14, className: "text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-bold text-amber-700 dark:text-amber-400" }, isCapLock ? window.wp.i18n.__("One provider per Starter site", "structura") : `${window.wp.i18n.__("Requires", "structura")} ${tierLabel2} ${window.wp.i18n.__("License", "structura")}`)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-amber-600 dark:text-amber-400/80" }, isCapLock ? window.wp.i18n.__(
    "Get a Free license to connect a second provider alongside the one you already have. Your existing setup stays in place.",
    "structura"
  ) : window.wp.i18n.__(
    "Upgrade your license to connect this provider and unlock its full capabilities for your content campaigns.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-sm text-left" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-2 block text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, tierLabel2, " ", window.wp.i18n.__("includes", "structura")), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0! list-none space-y-2 p-0!" }, features.map((feature, i2) => /* @__PURE__ */ window.wp.element.createElement(
    "li",
    {
      key: i2,
      className: "flex items-start gap-2 text-xs text-neutral-600 dark:text-neutral-400"
    },
    /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 12, className: "text-brand-500 mt-0.5 shrink-0" }),
    feature
  ))))), /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex w-full items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: onClose }, window.wp.i18n.__("Maybe later", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, targetTier === "free" ? /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: portalUrl,
      target: "_blank",
      rel: "noreferrer",
      className: "text-white!"
    },
    window.wp.i18n.__("Get Free License", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5", strokeWidth: 2.5 })
  )) : /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildMarketingPricingUrl({
        intent: "unlock_provider",
        domain,
        plan,
        // Suggest the tier that unlocks the requested provider.
        // `targetTier` mirrors the catalog's `min_tier` so the
        // marketing page can scroll-highlight the right card.
        suggest: targetTier === "byok" || targetTier === "cloud" || targetTier === "cloud_pro" ? targetTier : void 0
      }),
      target: "_blank",
      rel: "noreferrer",
      className: "text-white!"
    },
    window.wp.i18n.__("Upgrade to", "structura"),
    " ",
    tierLabel2,
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5", strokeWidth: 2.5 })
  )))))));
};
const workspaceKeysQueryKey = ["workspace-keys"];
const useWorkspaceKeysQuery = () => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: workspaceKeysQueryKey,
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/keys/workspace" }),
    enabled: hasUsableLicense === true,
    staleTime: 1e3 * 60 * 2
  });
};
const useBindWorkspaceKey = () => {
  const queryClient2 = useQueryClient();
  const { successToast } = Mn();
  return useMutation({
    mutationFn: (data) => window.wp.apiFetch({
      path: "/structura/v1/keys/bind",
      method: "POST",
      data
    }),
    onSuccess: () => {
      successToast(window.wp.i18n.__("Bound this site to the existing workspace key.", "structura"));
      queryClient2.invalidateQueries({ queryKey: workspaceKeysQueryKey });
      queryClient2.invalidateQueries({ queryKey: settingsKeys.all });
    }
  });
};
const getBadgeIntentByCampaignStatus = (status) => {
  switch (status) {
    case "active":
      return "success";
    case "completed":
      return "premium";
    default:
      return "default";
  }
};
function decodeEntities(input) {
  if (!input || input.indexOf("&") === -1 || typeof document === "undefined") {
    return input;
  }
  const el = document.createElement("textarea");
  el.innerHTML = input;
  return el.value;
}
const PROVIDER_DOMAIN = {
  openai: "openai.com",
  gemini: "gemini.google.com",
  anthropic: "anthropic.com"
};
const faviconFor = (provider) => {
  const domain = PROVIDER_DOMAIN[provider];
  if (!domain) return null;
  return `https://www.google.com/s2/favicons?domain=${domain}&sz=64`;
};
const WorkspaceKeysPicker = ({ providerLabels }) => {
  const { data, isLoading } = useWorkspaceKeysQuery();
  const bindMutation = useBindWorkspaceKey();
  const { activeProviders, imageProviders } = useAiConnections();
  const { hasExplicitTextDefault, hasExplicitImageDefault } = useDefaultProviders();
  const { mutate: updateAiSettings } = useUpdateAiSettings();
  const pendingAutoDefault = window.wp.element.useRef(null);
  window.wp.element.useEffect(() => {
    const provider = pendingAutoDefault.current;
    if (!provider) return;
    if (!activeProviders.includes(provider)) return;
    pendingAutoDefault.current = null;
    if (activeProviders.length !== 1) return;
    const defaults = {};
    if (!hasExplicitTextDefault) defaults.text_provider = provider;
    if (!hasExplicitImageDefault && imageProviders.includes(provider)) {
      defaults.image_provider = provider;
    }
    if (Object.keys(defaults).length > 0) {
      updateAiSettings({ ai: { defaults } });
    }
  }, [
    activeProviders,
    imageProviders,
    hasExplicitTextDefault,
    hasExplicitImageDefault,
    updateAiSettings
  ]);
  const credentials = data?.credentials ?? [];
  const candidates = credentials.filter((c2) => !c2.boundToCallingActivation);
  if (isLoading) return null;
  if (candidates.length === 0) return null;
  const inFlightCredId = bindMutation.isPending ? bindMutation.variables?.cred_id : void 0;
  const labelFor = (provider) => providerLabels?.[provider] ?? provider;
  return /* @__PURE__ */ window.wp.element.createElement("section", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Library, { size: 14, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-[11px] font-black tracking-widest text-neutral-500 uppercase" }, window.wp.i18n.__("Use a key from this workspace", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    'Keys saved on other sites in this workspace. Click "Use here" to bind one of them to this site without re-entering the key.',
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "divide-y divide-neutral-100 p-0! dark:divide-neutral-800" }, candidates.map((c2) => /* @__PURE__ */ window.wp.element.createElement(
    CandidateRow,
    {
      key: c2.credId,
      credential: c2,
      providerName: labelFor(c2.provider),
      isBinding: inFlightCredId === c2.credId,
      isAnyBinding: bindMutation.isPending,
      onBind: () => bindMutation.mutate(
        { cred_id: c2.credId, provider: c2.provider },
        {
          // Arm the auto-default effect for this provider; it
          // fires once the refetched settings show it connected.
          onSuccess: () => {
            pendingAutoDefault.current = c2.provider;
          }
        }
      )
    }
  ))));
};
const CandidateRow = ({
  credential,
  providerName,
  isBinding,
  isAnyBinding,
  onBind
}) => {
  const visual = getProviderVisual(credential.provider);
  const Logo = visual.icon;
  const favicon = faviconFor(credential.provider);
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3 px-5 py-4 sm:flex-row sm:items-center sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 space-y-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: `inline-flex shrink-0 items-center gap-1.5 rounded-full border bg-white/50 px-2.5 py-1 text-[10px] font-bold tracking-wide uppercase dark:bg-neutral-900/50 ${visual.border} ${visual.color}`
    },
    favicon ? /* @__PURE__ */ window.wp.element.createElement(
      "img",
      {
        src: favicon,
        alt: "",
        width: 14,
        height: 14,
        className: "size-3.5 rounded-sm",
        "aria-hidden": true,
        loading: "lazy"
      }
    ) : /* @__PURE__ */ window.wp.element.createElement(Logo, { size: 12, className: visual.color }),
    providerName
  ), /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, decodeEntities(credential.label)), credential.boundActivationCount > 0 && /* @__PURE__ */ window.wp.element.createElement(
    Me,
    { variant: "outline", className: "shrink-0 text-[10px]" },
    /* translators: %d: number of sites */
    window.wp.i18n.__("Used on", "structura"),
    " ",
    credential.boundActivationCount,
    " ",
    window.wp.i18n.__("site(s)", "structura")
  )), credential.maskedKey && /* @__PURE__ */ window.wp.element.createElement("div", { className: "font-mono text-[11px] text-neutral-500 dark:text-neutral-400" }, credential.maskedKey)), /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", onClick: onBind, disabled: isAnyBinding, loading: isBinding }, /* @__PURE__ */ window.wp.element.createElement(Link, { className: "size-3.5" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1.5" }, window.wp.i18n.__("Use here", "structura"))));
};
function capsForTier$1(capabilities, plan) {
  if (plan !== "none") return capabilities;
  return capabilities.filter((c2) => c2 !== "image");
}
const AiEngine = () => {
  const { data: settings, isLoading } = useAiSettingsQuery();
  const { plan, providerCountCap } = useLicense();
  const isCloud = isManagedPlan(plan);
  const isSingleProviderTier = providerCountCap === 1;
  const providers = settings?.providers;
  const catalog = settings?.catalog;
  const defaults = settings?.defaults;
  const [wizardTarget, setWizardTarget] = window.wp.element.useState(null);
  const [upgradeTarget, setUpgradeTarget] = window.wp.element.useState(null);
  const { installed, available } = window.wp.element.useMemo(() => {
    if (!catalog || !providers) return { installed: [], available: [] };
    const inst = [];
    const avail = [];
    for (const id of Object.keys(catalog)) {
      if (providers[id]?.connected) {
        inst.push(id);
      } else {
        avail.push(id);
      }
    }
    return { installed: inst, available: avail };
  }, [catalog, providers]);
  const connectedTextCount = window.wp.element.useMemo(() => {
    if (!providers) return 0;
    return Object.values(providers).filter((p2) => p2.connected && p2.capabilities.includes("text")).length;
  }, [providers]);
  const connectedImageCount = window.wp.element.useMemo(() => {
    if (!providers) return 0;
    return Object.values(providers).filter((p2) => p2.connected && p2.capabilities.includes("image")).length;
  }, [providers]);
  if (isLoading || !settings || !catalog || !providers || !defaults) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Syncing AI Vault…", "structura"), size: "lg", padding: "lg" });
  }
  const slotsLeft = Math.max(0, providerCountCap - installed.length);
  const capLockedIds = /* @__PURE__ */ new Set();
  {
    let slot = 0;
    for (const id of available) {
      if (!providers[id]) continue;
      if (slot >= slotsLeft) capLockedIds.add(id);
      slot++;
    }
  }
  const openWizard = (id, reconfigure = false) => {
    const meta = catalog[id];
    const status = providers[id];
    if (!meta) return;
    setWizardTarget({
      id,
      name: meta.name,
      description: meta.description,
      // Phase 1.8 — strip image cap on `none` tier so the wizard's
      // image-model picker + "Default for image" toggle don't render.
      capabilities: capsForTier$1(meta.capabilities, plan),
      keyUrl: meta.key_url,
      keyPrefix: meta.key_prefix,
      isConnected: reconfigure && !!status?.connected,
      textModel: status?.text_model,
      imageModel: status?.image_model,
      isDefaultText: defaults.text_provider === id,
      isDefaultImage: defaults.image_provider === id
    });
  };
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("AI Engine", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Provider Management", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "hidden items-center gap-2 sm:flex" }, /* @__PURE__ */ window.wp.element.createElement(
    Me,
    {
      variant: "outline",
      intent: connectedTextCount > 0 ? "success" : "secondary",
      className: "gap-1 py-1"
    },
    /* @__PURE__ */ window.wp.element.createElement(Type, { size: 12 }),
    /* @__PURE__ */ window.wp.element.createElement("span", null, connectedTextCount, " ", window.wp.i18n.__("Text", "structura"))
  ), /* @__PURE__ */ window.wp.element.createElement(
    Me,
    {
      variant: "outline",
      intent: connectedImageCount > 0 ? "success" : "secondary",
      className: "gap-1 py-1"
    },
    /* @__PURE__ */ window.wp.element.createElement(Image, { size: 12 }),
    /* @__PURE__ */ window.wp.element.createElement("span", null, connectedImageCount, " ", window.wp.i18n.__("Image", "structura"))
  )), !isCloud && /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "success", className: "py-1" }, /* @__PURE__ */ window.wp.element.createElement(ShieldCheck, { className: "mr-2 size-4" }), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__("AES-256-CBC Encrypted", "structura"))))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("section", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, className: "text-emerald-500" }), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-[11px] font-black tracking-widest text-neutral-500 uppercase" }, window.wp.i18n.__("Your Providers", "structura"))), installed.length > 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, installed.map((id) => {
    const meta = catalog[id];
    const status = providers[id];
    if (!meta || !status) return null;
    const needsText = status.capabilities.includes("text") && !status.text_model;
    const needsImage = status.capabilities.includes("image") && !status.image_model;
    const isIncomplete = needsText || needsImage;
    return /* @__PURE__ */ window.wp.element.createElement(
      InstalledProviderCard,
      {
        key: id,
        id,
        name: meta.name,
        description: meta.description,
        capabilities: capsForTier$1(meta.capabilities, plan),
        maskedKey: status.masked_key,
        isCloud,
        isDefaultText: defaults.text_provider === id,
        isDefaultImage: defaults.image_provider === id,
        incomplete: isIncomplete,
        onManage: () => openWizard(id, true),
        hideDefaultBadges: isSingleProviderTier
      }
    );
  })) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-3 rounded-2xl border border-dashed border-neutral-200 py-12 dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(Unplug, { size: 28, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "text-center" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("No providers connected yet", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("Set up a provider below to start generating content with AI.", "structura"))))), available.length > 0 && /* @__PURE__ */ window.wp.element.createElement("section", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-[11px] font-black tracking-widest text-neutral-500 uppercase" }, window.wp.i18n.__("Available Providers", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2" }, available.map((id) => {
    const meta = catalog[id];
    if (!meta) return null;
    const isAvailableForTier = !!providers[id];
    const isCapLocked = isAvailableForTier && capLockedIds.has(id);
    const cardAvailable = isAvailableForTier && !isCapLocked;
    return /* @__PURE__ */ window.wp.element.createElement(
      AvailableProviderCard,
      {
        key: id,
        id,
        name: meta.name,
        description: meta.description,
        capabilities: capsForTier$1(meta.capabilities, plan),
        available: cardAvailable,
        minTier: meta.min_tier,
        lockReason: isCapLocked ? "cap" : "tier",
        onSetUp: () => {
          if (cardAvailable) {
            openWizard(id);
            return;
          }
          setUpgradeTarget({
            id,
            name: meta.name,
            description: meta.description,
            capabilities: meta.capabilities,
            minTier: meta.min_tier,
            lockReason: isCapLocked ? "cap" : "tier",
            fromProviderId: isCapLocked ? installed[0] : void 0
          });
        }
      }
    );
  }))), /* @__PURE__ */ window.wp.element.createElement(
    WorkspaceKeysPicker,
    {
      providerLabels: catalog ? Object.fromEntries(Object.entries(catalog).map(([id, meta]) => [id, meta.name])) : void 0
    }
  ), settings.models_fallback && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-200 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-800/50" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Model catalog is currently using bundled defaults — the remote catalog couldn't be reached. Models will refresh automatically when you connect or reconnect a provider.",
    "structura"
  ))), !settings.has_text && !isCloud && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-amber-200 bg-amber-50 p-5 dark:border-amber-800/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed font-bold text-amber-700 dark:text-amber-400" }, window.wp.i18n.__(
    "Connect at least one text provider to start generating content. Image providers are optional — without one, image generation will be disabled.",
    "structura"
  )))), wizardTarget && /* @__PURE__ */ window.wp.element.createElement(
    ProviderSetupWizard,
    {
      open: !!wizardTarget,
      onClose: () => setWizardTarget(null),
      providerId: wizardTarget.id,
      providerName: wizardTarget.name,
      description: wizardTarget.description,
      capabilities: wizardTarget.capabilities,
      keyUrl: wizardTarget.keyUrl,
      keyPrefix: wizardTarget.keyPrefix,
      isConnected: wizardTarget.isConnected,
      currentTextModel: wizardTarget.textModel,
      currentImageModel: wizardTarget.imageModel,
      isDefaultText: wizardTarget.isDefaultText,
      isDefaultImage: wizardTarget.isDefaultImage,
      providerCountCap
    }
  ), upgradeTarget && /* @__PURE__ */ window.wp.element.createElement(
    ProviderUpgradeDialog,
    {
      open: !!upgradeTarget,
      onClose: () => setUpgradeTarget(null),
      providerId: upgradeTarget.id,
      providerName: upgradeTarget.name,
      description: upgradeTarget.description,
      capabilities: upgradeTarget.capabilities,
      minTier: upgradeTarget.minTier,
      lockReason: upgradeTarget.lockReason,
      fromProviderId: upgradeTarget.fromProviderId,
      plan
    }
  ));
};
const useAiSettingsQuery = () => {
  return useSettingsQuery((s2) => s2.ai);
};
const useDefaultProviders = () => {
  const { data: ai } = useAiSettingsQuery();
  const { textProviders, imageProviders, activeProviders, incompleteProviders, isProviderIncomplete } = useAiConnections();
  const { plan } = useLicense();
  const isCloud = isManagedPlan(plan);
  const defaults = ai?.defaults;
  ai?.providers;
  const isValidProvider = (slug, connectedList) => {
    if (!slug) return false;
    if (isCloud) return true;
    return connectedList.includes(slug);
  };
  const hasExplicitTextDefault = isValidProvider(defaults?.text_provider, textProviders);
  const hasExplicitImageDefault = isValidProvider(defaults?.image_provider, imageProviders);
  const resolveProvider = (hasExplicit, explicitSlug, capabilityProviders) => {
    if (hasExplicit) return explicitSlug;
    if (isCloud) return "gemini";
    return capabilityProviders[0] ?? activeProviders[0] ?? "gemini";
  };
  const defaultTextProvider = resolveProvider(hasExplicitTextDefault, defaults?.text_provider, textProviders);
  const defaultImageProvider = resolveProvider(hasExplicitImageDefault, defaults?.image_provider, imageProviders);
  const tierAllowed = getProvidersForTier(plan);
  const tierAllowedSet = new Set(tierAllowed);
  const connectivityProviders = isCloud ? ["gemini", "openai", "anthropic"] : activeProviders;
  const availableProviders = connectivityProviders.filter(
    (p2) => tierAllowedSet.has(p2)
  );
  const TEXT_ONLY_PROVIDERS2 = ["anthropic"];
  const availableImageProviders = availableProviders.filter(
    (p2) => !TEXT_ONLY_PROVIDERS2.includes(p2)
  );
  const hasExplicitDefaults = hasExplicitTextDefault;
  const hasMultipleProviders = availableProviders.length > 1;
  const isAutoResolved = !hasExplicitTextDefault && activeProviders.length > 0;
  const isFullyConfigured = isCloud || hasExplicitTextDefault && hasExplicitImageDefault;
  return {
    defaultTextProvider,
    defaultImageProvider,
    availableProviders,
    availableImageProviders,
    incompleteProviders,
    isProviderIncomplete,
    hasExplicitDefaults,
    hasExplicitTextDefault,
    hasExplicitImageDefault,
    hasMultipleProviders,
    isAutoResolved,
    isFullyConfigured,
    isCloud
  };
};
const usePublicSiteProfile = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: settingsKeys.publicSiteProfile(),
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/site-profile" }),
    enabled: hasWorkspace === true,
    // Profile rarely changes — same staleTime as the main settings query.
    staleTime: 1e3 * 60 * 5
  });
};
const usePublicSiteProfileMutation = () => {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: async (draft) => window.wp.apiFetch({
      path: "/structura/v1/site-profile",
      method: "POST",
      data: draft
    }),
    onSuccess: (data) => {
      queryClient2.setQueryData(settingsKeys.publicSiteProfile(), data);
      An.success(window.wp.i18n.__("Public website settings saved.", "structura"));
    },
    onError: (err) => {
      An.error(
        err?.message ?? window.wp.i18n.__("Could not save public website settings. Please try again.", "structura")
      );
    }
  });
};
const useQuickSetup = () => {
  return useMutation({
    mutationFn: async (publicUrl) => window.wp.apiFetch({
      path: "/structura/v1/site-profile/quick-setup",
      method: "POST",
      data: { publicUrl }
    })
  });
};
const useSeoRules = () => {
  const { hasWorkspace } = useLicense();
  const query = useQuery({
    queryKey: settingsKeys.seoRules(),
    queryFn: () => window.wp.apiFetch({
      path: "/structura/v1/settings/seo-rules"
    }),
    enabled: hasWorkspace === true,
    staleTime: 1e3 * 60 * 30
  });
  return {
    rules: query.data,
    isLoading: query.isLoading
  };
};
const useVisualQuery = () => {
  const { hasUsableLicense, isLicensed } = useLicense();
  return useQuery({
    queryKey: visualKeys.config(),
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/visual" }),
    // `isLicensed` (plan !== "none") mirrors the VisualsPage locked-teaser
    // gate. Without it, a plan-"none" install that still carries a
    // license_key (the licensed-but-cloud-pending / cancelled-key window,
    // or an anonymous key-shaped bearer) satisfies `hasUsableLicense` and
    // this fetch fires anyway — surfacing a stray "Data Fetch Error:
    // Cookie check failed" toast under the teaser (Yurii 2026-07-09).
    enabled: hasUsableLicense === true && isLicensed,
    staleTime: 1e3 * 60 * 10
  });
};
const presetsKey = ["visual-presets"];
function useVisualPresetsQuery() {
  const { hasUsableLicense, isLicensed } = useLicense();
  return useQuery({
    queryKey: presetsKey,
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/visual-presets" }),
    // `isLicensed` (plan !== "none") mirrors the VisualsPage locked-teaser
    // gate so a plan-"none" install that still carries a license_key
    // doesn't fire this fetch under the teaser and surface a stray
    // "Cookie check failed" toast (Yurii 2026-07-09). See useVisualQuery.
    enabled: hasUsableLicense === true && isLicensed,
    staleTime: 1e3 * 60 * 2
  });
}
function useVisualPresetMutations() {
  const queryClient2 = useQueryClient();
  const invalidate = () => {
    queryClient2.invalidateQueries({ queryKey: presetsKey });
    queryClient2.invalidateQueries({ queryKey: visualKeys.config() });
  };
  const create2 = useMutation({
    mutationFn: (data) => window.wp.apiFetch({
      path: "/structura/v1/visual-presets",
      method: "POST",
      data
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Visual preset created.", "structura"));
      invalidate();
    }
  });
  const update = useMutation({
    mutationFn: ({ preset_id, ...rest }) => window.wp.apiFetch({
      path: `/structura/v1/visual-presets/${encodeURIComponent(preset_id)}`,
      method: "POST",
      data: rest
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Visual preset updated.", "structura"));
      invalidate();
    }
  });
  const fork = useMutation({
    mutationFn: ({ preset_id, ...rest }) => window.wp.apiFetch({
      path: `/structura/v1/visual-presets/${encodeURIComponent(preset_id)}/fork`,
      method: "POST",
      data: rest
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Preset forked for this site.", "structura"));
      invalidate();
    }
  });
  const remove = useMutation({
    mutationFn: (preset_id) => window.wp.apiFetch({
      path: `/structura/v1/visual-presets/${encodeURIComponent(preset_id)}`,
      method: "DELETE"
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Visual preset deleted.", "structura"));
      invalidate();
    },
    onError: (err) => {
      const message = err instanceof Error ? err.message : String(err);
      An.error(message);
    }
  });
  const bind = useMutation({
    mutationFn: (data) => window.wp.apiFetch({
      path: "/structura/v1/visual-presets/bind",
      method: "POST",
      data
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Bound visual preset for this site.", "structura"));
      invalidate();
    }
  });
  return {
    create: create2.mutateAsync,
    update: update.mutateAsync,
    fork: fork.mutateAsync,
    remove: remove.mutateAsync,
    bind: bind.mutateAsync,
    isCreating: create2.isPending,
    isUpdating: update.isPending,
    isForking: fork.isPending,
    isRemoving: remove.isPending,
    isBinding: bind.isPending
  };
}
const GSC_INTEGRATION_ID = "google-search-console";
const useChannelEventsQuery = (options = {}) => {
  const { isActivationValid, hasUsableLicense } = useLicense();
  const limit = options.limit ?? 25;
  return useQuery({
    queryKey: [...channelKeys.events(), { limit }],
    enabled: hasUsableLicense === true && isActivationValid !== false,
    meta: { silentError: true },
    queryFn: () => window.wp.apiFetch({
      path: `/structura/v1/channels/events?limit=${limit}`
    })
  });
};
const useChannelConnectionsQuery = () => {
  const { isActivationValid, hasUsableLicense } = useLicense();
  const query = useQuery({
    queryKey: channelKeys.connections(),
    // Skip the network round-trip when useLicense has already told us
    // the current host isn't a registered activation — the handshake
    // would fail every time. `null` (pending/unknown) is treated as
    // "allow" so we don't delay first paint for paid users whose
    // heartbeat hasn't landed yet.
    enabled: hasUsableLicense === true && isActivationValid !== false,
    meta: { silentError: true },
    queryFn: async () => {
      const response = await window.wp.apiFetch({
        path: "/structura/v1/channels/connections"
      });
      const connections = Array.isArray(response?.connections) ? response.connections : Array.isArray(response) ? response : [];
      const rawQuota = response?.videoQuota;
      const videoQuota = rawQuota && typeof rawQuota.used === "number" && typeof rawQuota.cap === "number" ? { used: rawQuota.used, cap: rawQuota.cap } : void 0;
      const rawPreset = response?.boundVisualPreset;
      const boundVisualPreset = rawPreset === null ? null : rawPreset && typeof rawPreset.presetId === "string" && typeof rawPreset.label === "string" ? rawPreset : void 0;
      const rawTts = response?.videoTts;
      const videoTts = rawTts && typeof rawTts.managed === "boolean" && typeof rawTts.providers?.openai === "boolean" && typeof rawTts.providers?.gemini === "boolean" ? {
        managed: rawTts.managed,
        providers: {
          openai: rawTts.providers.openai,
          gemini: rawTts.providers.gemini
        }
      } : void 0;
      return { connections, videoQuota, boundVisualPreset, videoTts };
    }
  });
  return {
    ...query,
    /** The connection summaries — the shape every consumer always read. */
    data: query.data?.connections,
    /** Monthly video quota, when the cloud sent it (see ListConnectionsResponse). */
    videoQuota: query.data?.videoQuota,
    /** Bound-preset digest for the Video dialog (see ListConnectionsResponse). */
    boundVisualPreset: query.data?.boundVisualPreset,
    /** TTS provider availability for the voice picker's BYOK gating. */
    videoTts: query.data?.videoTts
  };
};
const useVideoRetryMutation = () => {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: (jobId) => window.wp.apiFetch({
      path: "/structura/v1/channels/video/retry",
      method: "POST",
      data: { job_id: jobId }
    }),
    onSuccess: () => {
      An.success(
        window.wp.i18n.__("Render restarted — it will appear here in a few minutes.", "structura")
      );
      void queryClient2.invalidateQueries({ queryKey: channelKeys.events() });
    },
    onError: (error) => {
      An.error(
        error instanceof Error && error.message ? error.message : window.wp.i18n.__("Could not restart the render. Please try again.", "structura")
      );
    }
  });
};
const CaptionPackage = ({ packages }) => {
  const [active, setActive] = window.wp.element.useState("yt");
  return (
    // The outer div only declares the size container: Tailwind's
    // `@max-[…]` variants respond to the nearest ANCESTOR container, so
    // the queried element can't be the container itself.
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "@container mt-3 min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl bg-neutral-50 p-3.5 ring-1 ring-neutral-200/60 @max-[480px]:p-3 dark:bg-white/[.03] dark:ring-white/[.06]" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Suggested captions", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      Qn,
      {
        size: "xs",
        value: active,
        onChange: (id) => setActive(id),
        "aria-label": window.wp.i18n.__("Platform", "structura"),
        className: "@max-[480px]:w-full @max-[480px]:[&>button]:flex-1 @max-[480px]:[&>button]:justify-center",
        items: [
          // Platform short names are proper nouns (handoff
          // "Switcher"): untranslated by design so de/es/fr expansion
          // can't distort the switcher; full names ride the tooltip.
          {
            id: "yt",
            label: "Shorts",
            title: "YouTube Shorts",
            icon: /* @__PURE__ */ window.wp.element.createElement(Play, { size: 12, "aria-hidden": true })
          },
          {
            id: "tt",
            label: "TikTok",
            title: "TikTok",
            icon: /* @__PURE__ */ window.wp.element.createElement(Music2, { size: 12, "aria-hidden": true })
          },
          {
            id: "ig",
            label: "Reels",
            title: "Instagram Reels",
            icon: /* @__PURE__ */ window.wp.element.createElement(Film, { size: 12, "aria-hidden": true })
          }
        ]
      }
    )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3" }, active === "yt" && /* @__PURE__ */ window.wp.element.createElement(ShortsBody, { shorts: packages.shorts }), active === "tt" && /* @__PURE__ */ window.wp.element.createElement(TikTokBody, { tiktok: packages.tiktok }), active === "ig" && /* @__PURE__ */ window.wp.element.createElement(ReelsBody, { reels: packages.reels }))))
  );
};
function ShortsBody({ shorts }) {
  const tags = uploadTags(shorts.description);
  const copyAll = [
    `${window.wp.i18n.__("Title", "structura")}:
${shorts.title}`,
    `${window.wp.i18n.__("Description", "structura")}:
${shorts.description}`,
    ...tags ? [`${window.wp.i18n.__("Tags", "structura")}:
${tags}`] : []
  ].join("\n\n");
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement(
    Field$2,
    {
      label: window.wp.i18n.__("Title", "structura"),
      meta: /* @__PURE__ */ window.wp.element.createElement(Counter, { count: shorts.title.length, max: CAPTION_LIMITS.shortsTitle }),
      copyText: shorts.title,
      copyAria: window.wp.i18n.__("Copy title", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-medium text-neutral-800 dark:text-neutral-100" }, shorts.title)
  ), /* @__PURE__ */ window.wp.element.createElement(
    Field$2,
    {
      label: window.wp.i18n.__("Description", "structura"),
      copyText: shorts.description,
      copyAria: window.wp.i18n.__("Copy description", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(CaptionValue, { raw: shorts.description })
  ), tags.length > 0 && /* @__PURE__ */ window.wp.element.createElement(
    Field$2,
    {
      label: window.wp.i18n.__("Tags", "structura"),
      meta: /* @__PURE__ */ window.wp.element.createElement(Counter, { count: tags.length, max: CAPTION_LIMITS.shortsTags }),
      copyText: tags,
      copyAria: window.wp.i18n.__("Copy tags", "structura")
    },
    tags
  ), /* @__PURE__ */ window.wp.element.createElement(InfoRow$1, null, window.wp.i18n.__(
    "Links in Shorts descriptions aren’t clickable — the URL still helps search and viewers can copy it.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-end border-t border-neutral-200/70 pt-2 dark:border-white/[.06]" }, /* @__PURE__ */ window.wp.element.createElement(
    CopyButton,
    {
      text: copyAll,
      label: window.wp.i18n.__("Copy all", "structura"),
      ariaLabel: window.wp.i18n.__("Copy all fields", "structura")
    }
  )));
}
function TikTokBody({ tiktok }) {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement(
    Field$2,
    {
      label: window.wp.i18n.__("Caption", "structura"),
      meta: /* @__PURE__ */ window.wp.element.createElement(HookCounter, { hook: captionHook(tiktok.caption), max: CAPTION_LIMITS.tiktokHook }),
      copyText: tiktok.caption,
      copyAria: window.wp.i18n.__("Copy caption", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(CaptionValue, { raw: tiktok.caption, hookFirst: true })
  ), /* @__PURE__ */ window.wp.element.createElement(InfoRow$1, null, window.wp.i18n.__(
    "Enable TikTok’s ‘AI-generated content’ toggle when uploading — this video uses an AI voiceover.",
    "structura"
  )));
}
function ReelsBody({ reels }) {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement(
    Field$2,
    {
      label: window.wp.i18n.__("Caption", "structura"),
      meta: /* @__PURE__ */ window.wp.element.createElement(HookCounter, { hook: captionHook(reels.caption), max: CAPTION_LIMITS.reelsHook }),
      copyText: reels.caption,
      copyAria: window.wp.i18n.__("Copy caption", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(CaptionValue, { raw: reels.caption, hookFirst: true })
  ));
}
function Field$2({
  label,
  meta,
  copyText,
  copyAria,
  children
}) {
  return /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0 text-[11px] font-bold text-neutral-700 dark:text-neutral-200" }, label), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-1.5" }, meta, /* @__PURE__ */ window.wp.element.createElement(CopyButton, { text: copyText, label: window.wp.i18n.__("Copy", "structura"), ariaLabel: copyAria }))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-1 min-w-0 rounded-lg bg-white px-2.5 py-2 text-xs leading-relaxed break-words whitespace-pre-line text-neutral-600 ring-1 ring-neutral-200/80 dark:bg-neutral-900/60 dark:text-neutral-300 dark:ring-white/[.08]" }, children));
}
const BLOCK_CLASSES = {
  hook: "font-medium text-neutral-800 dark:text-neutral-100",
  hashtags: "font-semibold text-brand-600 dark:text-brand-300"
};
function CaptionValue({ raw, hookFirst = false }) {
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, parseCaptionBlocks(raw, { hookFirst }).map((block, index2) => /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, { key: index2 }, index2 > 0 && "\n\n", /* @__PURE__ */ window.wp.element.createElement("span", { className: BLOCK_CLASSES[block.kind] }, block.text))));
}
function Counter({ count: count2, max: max2 }) {
  const over = count2 > max2;
  return /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      title: over ? window.wp.i18n.__("Over the recommended limit", "structura") : window.wp.i18n.__("Within limit", "structura"),
      className: "font-mono text-[10px] tabular-nums " + (over ? "font-semibold text-amber-600 dark:text-amber-400" : "text-neutral-400 dark:text-neutral-500")
    },
    count2,
    "/",
    max2
  );
}
function HookCounter({ hook, max: max2 }) {
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[10px] text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("hook", "structura")), /* @__PURE__ */ window.wp.element.createElement(Counter, { count: hook.length, max: max2 }));
}
function InfoRow$1({ children }) {
  return /* @__PURE__ */ window.wp.element.createElement("div", { role: "note", className: "flex items-start gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
    Info,
    {
      size: 13,
      "aria-hidden": true,
      className: "mt-px shrink-0 text-neutral-400 dark:text-neutral-500"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, children));
}
function CopyButton({
  text,
  label,
  ariaLabel
}) {
  const [copied, setCopied] = window.wp.element.useState(false);
  const resetTimer = window.wp.element.useRef();
  window.wp.element.useEffect(() => () => clearTimeout(resetTimer.current), []);
  const onCopy = () => {
    void navigator.clipboard?.writeText(text).catch(() => void 0);
    setCopied(true);
    clearTimeout(resetTimer.current);
    resetTimer.current = setTimeout(() => setCopied(false), 1400);
  };
  return /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: onCopy,
      "aria-label": ariaLabel,
      className: "inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] font-bold transition-all " + (copied ? "text-emerald-600 dark:text-emerald-400" : "text-neutral-500 hover:bg-neutral-200/70 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-white/10 dark:hover:text-neutral-200")
    },
    copied ? /* @__PURE__ */ window.wp.element.createElement(Check, { size: 12, "aria-hidden": true }) : /* @__PURE__ */ window.wp.element.createElement(Copy, { size: 12, "aria-hidden": true }),
    copied ? window.wp.i18n.__("Copied", "structura") : label
  );
}
const useChannelConnectionMutations = () => {
  const queryClient2 = useQueryClient();
  const invalidate = () => queryClient2.invalidateQueries({ queryKey: channelKeys.connections() });
  const saveWebhookMutation = useMutation({
    mutationFn: (input) => window.wp.apiFetch({
      path: "/structura/v1/channels/connections/webhook",
      method: "POST",
      data: input
    }),
    onSuccess: (_data, input) => {
      capture("channel_connected", {
        integration_id: input.integration_id,
        auth_type: "webhook"
      });
      An.success(window.wp.i18n.__("Channel connected.", "structura"));
      invalidate();
    }
  });
  const saveCredentialMutation = useMutation({
    mutationFn: (input) => window.wp.apiFetch({
      path: "/structura/v1/channels/connections/credential",
      method: "POST",
      data: input
    }),
    onSuccess: (_data, input) => {
      capture("channel_connected", {
        integration_id: input.integration_id,
        auth_type: "credential"
      });
      An.success(window.wp.i18n.__("Channel connected.", "structura"));
      invalidate();
    }
  });
  const initOAuthMutation = useMutation({
    mutationFn: ({ integrationId, postAsOrg, returnHash }) => window.wp.apiFetch({
      path: "/structura/v1/channels/oauth/init",
      method: "POST",
      data: {
        integration_id: integrationId,
        ...postAsOrg ? { post_as: "organization" } : {},
        // Optional post-bounce SPA hash route (see OAuthInitInput.returnHash).
        // Omitted → the proxy's `#/channels/connections` default applies.
        ...returnHash ? { return_hash: returnHash } : {}
      }
    }),
    onSuccess: (_data, input) => {
      capture("channel_oauth_initiated", {
        integration_id: input.integrationId,
        post_as: input.postAsOrg ? "organization" : "personal"
      });
    }
  });
  const updateSettingsMutation = useMutation({
    mutationFn: (input) => window.wp.apiFetch({
      path: "/structura/v1/channels/connections/settings",
      method: "POST",
      data: input
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Settings saved.", "structura"));
      invalidate();
    }
  });
  const deleteMutation = useMutation({
    mutationFn: (connectionKey) => window.wp.apiFetch({
      path: `/structura/v1/channels/connections/${encodeURIComponent(connectionKey)}`,
      method: "DELETE"
    }),
    onSuccess: () => {
      capture("channel_disconnected");
      An.success(window.wp.i18n.__("Channel disconnected.", "structura"));
      invalidate();
    }
  });
  return {
    saveWebhook: saveWebhookMutation.mutateAsync,
    saveCredential: saveCredentialMutation.mutateAsync,
    initOAuth: initOAuthMutation.mutateAsync,
    updateSettings: updateSettingsMutation.mutateAsync,
    deleteConnection: deleteMutation.mutateAsync,
    isSaving: saveWebhookMutation.isPending || saveCredentialMutation.isPending || initOAuthMutation.isPending || updateSettingsMutation.isPending,
    isDeleting: deleteMutation.isPending,
    saveError: saveWebhookMutation.error instanceof Error ? saveWebhookMutation.error.message : saveCredentialMutation.error instanceof Error ? saveCredentialMutation.error.message : initOAuthMutation.error instanceof Error ? initOAuthMutation.error.message : updateSettingsMutation.error instanceof Error ? updateSettingsMutation.error.message : null
  };
};
const useGscRefreshProperties = () => {
  const queryClient2 = useQueryClient();
  const mutation = useMutation({
    mutationFn: () => window.wp.apiFetch({
      path: "/structura/v1/gsc/refresh-properties",
      method: "POST"
    }),
    onSuccess: () => {
      void queryClient2.invalidateQueries({
        queryKey: channelKeys.connections()
      });
    }
  });
  return {
    refreshProperties: mutation.mutateAsync,
    isRefreshing: mutation.isPending
  };
};
const GSC_UNVERIFIED_PERMISSION = "siteUnverifiedUser";
const GSC_DOMAIN_PREFIX = "sc-domain:";
function usableGscProperties(properties) {
  return properties.filter(
    (p2) => p2.permissionLevel !== GSC_UNVERIFIED_PERMISSION
  );
}
function deriveGscConnectView(property, properties) {
  if (property) return "auto_matched";
  if (usableGscProperties(properties).length > 0) return "picker";
  if (properties.length > 0) return "insufficient_permission";
  return "no_property";
}
function gscPropertyKind(siteUrl) {
  return siteUrl.startsWith(GSC_DOMAIN_PREFIX) ? "domain" : "prefix";
}
const PERMISSION_RANK = {
  siteOwner: 3,
  siteFullUser: 2,
  siteRestrictedUser: 1
};
function coverageRank(host, property) {
  const raw = property.siteUrl;
  if (raw.startsWith(GSC_DOMAIN_PREFIX)) {
    const domain = raw.slice(GSC_DOMAIN_PREFIX.length).toLowerCase().trim();
    if (!domain) return 0;
    const covers = host === domain || host.endsWith(`.${domain}`);
    return covers ? 1e6 + domain.length : 0;
  }
  let url;
  try {
    url = new URL(raw);
  } catch {
    return 0;
  }
  if (url.host.toLowerCase() !== host) return 0;
  return 2e6 + url.pathname.length;
}
function bestGscPropertyMatch(siteHost, properties) {
  const host = siteHost.trim().toLowerCase();
  let best = null;
  let bestScore = -1;
  for (const property of usableGscProperties(properties)) {
    const coverage = host ? coverageRank(host, property) : 0;
    const score = coverage * 8 + (PERMISSION_RANK[property.permissionLevel] ?? 0);
    if (score > bestScore) {
      bestScore = score;
      best = { siteUrl: property.siteUrl, covers: coverage > 0 };
    }
  }
  return best;
}
function gscPropertyToRequest(siteHost, properties) {
  const host = siteHost.trim().toLowerCase();
  if (host) {
    const covering = properties.find((p2) => coverageRank(host, p2) > 0);
    if (covering) return covering.siteUrl;
  }
  return properties[0]?.siteUrl ?? null;
}
const GSC_WELCOME_URL = "https://search.google.com/search-console/welcome";
const GoogleGGlyph = ({ size: size2 = 20, className }) => /* @__PURE__ */ window.wp.element.createElement("svg", { width: size2, height: size2, viewBox: "0 0 48 48", "aria-hidden": true, className }, /* @__PURE__ */ window.wp.element.createElement(
  "path",
  {
    fill: "#EA4335",
    d: "M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"
  }
), /* @__PURE__ */ window.wp.element.createElement(
  "path",
  {
    fill: "#4285F4",
    d: "M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"
  }
), /* @__PURE__ */ window.wp.element.createElement(
  "path",
  {
    fill: "#FBBC05",
    d: "M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"
  }
), /* @__PURE__ */ window.wp.element.createElement(
  "path",
  {
    fill: "#34A853",
    d: "M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"
  }
));
function sprintfNodes(format, ...values) {
  const out = [];
  const re2 = /%(?:(\d+)\$)?s/g;
  let last = 0;
  let auto = 0;
  let key = 0;
  let match;
  while ((match = re2.exec(format)) !== null) {
    if (match.index > last) out.push(format.slice(last, match.index));
    const idx = match[1] ? Number(match[1]) - 1 : auto++;
    out.push(/* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, { key: key++ }, values[idx]));
    last = match.index + match[0].length;
  }
  if (last < format.length) out.push(format.slice(last));
  return out;
}
const Mono = ({ children }) => /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono" }, children);
function PropertyTypeLine({
  siteUrl,
  siteHost,
  withMatch = false
}) {
  const kind = gscPropertyKind(siteUrl);
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("strong", { className: "font-semibold text-neutral-600 dark:text-neutral-300" }, kind === "domain" ? window.wp.i18n.__("Domain property.", "structura") : window.wp.i18n.__("URL-prefix property.", "structura")), " ", kind === "domain" ? window.wp.i18n.__("Covers the whole domain — every subdomain and protocol.", "structura") : window.wp.i18n.__("Covers only pages under this exact address.", "structura"), withMatch && siteHost ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, " ", sprintfNodes(
    /* translators: %s = the site's host name (e.g. "acme-blog.com"), rendered verbatim. */
    window.wp.i18n.__("It matches your site %s.", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(Mono, null, siteHost)
  )) : null);
}
function GscPermissionBadge({ level }) {
  if (level === "siteOwner") {
    return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success" }, /* @__PURE__ */ window.wp.element.createElement(ShieldCheck, { size: 10, "aria-hidden": true }), window.wp.i18n.__("Owner", "structura"));
  }
  if (level === "siteFullUser") {
    return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success" }, /* @__PURE__ */ window.wp.element.createElement(Check, { size: 10, "aria-hidden": true }), window.wp.i18n.__("Full access", "structura"));
  }
  return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "default" }, /* @__PURE__ */ window.wp.element.createElement(Eye, { size: 10, "aria-hidden": true }), window.wp.i18n.__("Restricted — read-only, enough for Structura", "structura"));
}
function GscAccountRow({
  email,
  onSwitch,
  disabled
}) {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-3 rounded-xl bg-neutral-50 px-3.5 py-2.5 ring-1 ring-neutral-200/60 dark:bg-white/[.04] dark:ring-white/[.06]" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-center gap-2.5" }, /* @__PURE__ */ window.wp.element.createElement(
    UserRound,
    {
      size: 14,
      className: "shrink-0 text-neutral-400 dark:text-neutral-500",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("span", { className: "truncate font-mono text-[11px] text-neutral-600 dark:text-neutral-300" }, email)), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: onSwitch,
      disabled,
      className: "text-brand-600 focus-visible:ring-brand-400 dark:text-brand-300 m-0! shrink-0 cursor-pointer border-0 bg-transparent p-0! text-[11px] font-bold hover:underline focus:outline-none focus-visible:ring-2 disabled:cursor-default disabled:opacity-60"
    },
    window.wp.i18n.__("Switch account", "structura")
  ));
}
const GscConnectModal = ({ connection, open, onClose }) => {
  const siteHost = typeof window === "undefined" ? "" : window.structuraConfig?.domain ?? window.location.hostname;
  const meta = connection.externalAccountMeta ?? {};
  const [flow, setFlow] = window.wp.element.useState(() => ({
    // displayName is set to the Google email at connect, so it covers the
    // (rare) case where the userinfo lookup failed and the meta is null.
    googleEmail: meta.googleEmail || connection.displayName || "",
    // Older clouds mirrored the active property only into
    // externalAccountId — read both so back-compat rows still confirm.
    property: meta.property || connection.externalAccountId || null,
    properties: meta.availableProperties ?? []
  }));
  const usable = usableGscProperties(flow.properties);
  const best = bestGscPropertyMatch(siteHost, flow.properties);
  const [view, setView] = window.wp.element.useState(
    () => deriveGscConnectView(flow.property, flow.properties)
  );
  const [selected, setSelected] = window.wp.element.useState(
    () => flow.property || best?.siteUrl || usable[0]?.siteUrl || ""
  );
  const [inlineError, setInlineError] = window.wp.element.useState(null);
  const [notFoundYet, setNotFoundYet] = window.wp.element.useState(false);
  const [pickerFromConfirm, setPickerFromConfirm] = window.wp.element.useState(false);
  const { updateSettings, initOAuth, isSaving } = useChannelConnectionMutations();
  const { refreshProperties, isRefreshing } = useGscRefreshProperties();
  const busy = isSaving || isRefreshing;
  const fallbackError = window.wp.i18n.__(
    "Something went wrong talking to Google. Please try again.",
    "structura"
  );
  const saveProperty = async (siteUrl) => {
    if (!connection.connectionId || !siteUrl) return;
    setInlineError(null);
    try {
      await updateSettings({
        connection_id: connection.connectionId,
        selected_gsc_property: siteUrl
      });
      onClose();
    } catch (err) {
      setInlineError(err instanceof Error ? err.message : fallbackError);
    }
  };
  const refresh = async () => {
    setInlineError(null);
    setNotFoundYet(false);
    let response;
    try {
      response = await refreshProperties();
    } catch (err) {
      setInlineError(err instanceof Error ? err.message : fallbackError);
      return;
    }
    if (!response.ok) {
      setInlineError(response.error || fallbackError);
      return;
    }
    const properties = response.properties ?? [];
    const property = response.selected ?? null;
    setFlow((prev) => ({
      googleEmail: response.googleEmail || prev.googleEmail,
      property,
      properties
    }));
    const next = deriveGscConnectView(property, properties);
    setView(next);
    setPickerFromConfirm(false);
    if (next === "picker") {
      const freshBest = bestGscPropertyMatch(siteHost, properties);
      setSelected(freshBest?.siteUrl ?? usableGscProperties(properties)[0]?.siteUrl ?? "");
    }
    if (next === "no_property") setNotFoundYet(true);
  };
  const switchAccount = async () => {
    setInlineError(null);
    try {
      const result = await initOAuth({ integrationId: GSC_INTEGRATION_ID });
      window.location.href = result.authorizeUrl;
    } catch (err) {
      setInlineError(err instanceof Error ? err.message : fallbackError);
    }
  };
  const copyOwnerRequest = async () => {
    const property = gscPropertyToRequest(siteHost, flow.properties) ?? "";
    const request = window.wp.i18n.sprintf(
      /* translators: %1$s = the Search Console property id (e.g. "sc-domain:acme-blog.com"), %2$s = the requester's Google account email. "Search Console" and "Restricted" are Google product terms. */
      window.wp.i18n.__(
        'Hi! Could you add me as a user on the Search Console property %1$s? My Google account is %2$s. "Restricted" permission is enough — I only need read access to search stats. You can add me in Search Console under Settings → Users and permissions. Thanks!',
        "structura"
      ),
      property,
      flow.googleEmail
    );
    try {
      await navigator.clipboard.writeText(request);
      An.success(window.wp.i18n.__("Request copied to your clipboard.", "structura"));
    } catch {
      An.error(window.wp.i18n.__("Couldn't copy to the clipboard — please try again.", "structura"));
    }
  };
  const title = view === "auto_matched" ? window.wp.i18n.__("Connect Search Console", "structura") : view === "picker" ? window.wp.i18n.__("Choose your property", "structura") : view === "no_property" ? window.wp.i18n.__("One step first: verify your site with Google", "structura") : window.wp.i18n.__("You need more access to this property", "structura");
  const description = view === "auto_matched" ? window.wp.i18n.__("We found the Search Console property for this site.", "structura") : view === "picker" ? sprintfNodes(
    window.wp.i18n.sprintf(
      /* translators: %2$s stays a literal placeholder for the site host (styled separately); %1$d = number of candidate properties. */
      window.wp.i18n._n(
        "Your Google account has %1$d property that could match %2$s. Pick the one Structura should read.",
        "Your Google account has %1$d properties that could match %2$s. Pick the one Structura should read.",
        usable.length,
        "structura"
      ),
      usable.length,
      "%s"
    ),
    /* @__PURE__ */ window.wp.element.createElement(Mono, null, siteHost)
  ) : view === "no_property" ? sprintfNodes(
    /* translators: %1$s = the connected Google account email, %2$s = the site's host name — both rendered verbatim. */
    window.wp.i18n.__(
      "%1$s has no verified Search Console property for %2$s. Verification is Google's proof you own the site — it takes about 5 minutes, and only Google can do it.",
      "structura"
    ),
    /* @__PURE__ */ window.wp.element.createElement(Mono, null, flow.googleEmail),
    /* @__PURE__ */ window.wp.element.createElement(Mono, null, siteHost)
  ) : window.wp.i18n.__("This property exists, but your account can't read its data yet.", "structura");
  const errorAlert = inlineError ? /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { "aria-hidden": true }), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, inlineError)) : null;
  const accountRow = flow.googleEmail ? /* @__PURE__ */ window.wp.element.createElement(GscAccountRow, { email: flow.googleEmail, onSwitch: () => void switchAccount(), disabled: busy }) : null;
  const spinnerBody = /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-3 py-10", role: "status" }, /* @__PURE__ */ window.wp.element.createElement($e, { size: "md" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Checking your Search Console properties…", "structura")));
  const confirmBody = /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3" }, accountRow, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-200 px-3.5 py-3 dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    CircleCheck,
    {
      size: 15,
      className: "shrink-0 text-emerald-600 dark:text-emerald-400",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-xs font-semibold text-neutral-800 dark:text-neutral-200" }, flow.property)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-1! pl-[23px] text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, flow.property && /* @__PURE__ */ window.wp.element.createElement(PropertyTypeLine, { siteUrl: flow.property, siteHost, withMatch: true }))), errorAlert, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "Read-only — Structura can see search stats, and nothing else. Disconnect anytime.",
    "structura"
  )));
  const pickerBody = /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3" }, accountRow, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      role: "radiogroup",
      "aria-label": window.wp.i18n.__("Search Console property", "structura"),
      className: "flex max-h-[45vh] flex-col gap-2 overflow-y-auto pr-1"
    },
    usable.map((property) => {
      const checked = property.siteUrl === selected;
      const isBest = best?.covers === true && best.siteUrl === property.siteUrl;
      return /* @__PURE__ */ window.wp.element.createElement(
        "label",
        {
          key: property.siteUrl,
          className: B$1(
            "m-0! flex cursor-pointer items-start gap-3 rounded-xl border px-3.5 py-3 transition-all",
            checked ? "border-brand-300 bg-brand-50/50 ring-brand-300 dark:border-brand-500/50 dark:bg-brand-500/[.08] dark:ring-brand-500/50 ring-1" : "border-neutral-200 hover:border-neutral-300 dark:border-neutral-700 dark:hover:border-neutral-600"
          )
        },
        /* @__PURE__ */ window.wp.element.createElement(
          "input",
          {
            type: "radio",
            name: "gsc-connect-property",
            checked,
            onChange: () => setSelected(property.siteUrl),
            className: "mt-0.5!size-4 checked:border-brand-600 checked:bg-brand-600 focus-visible:ring-brand-500 dark:checked:border-brand-400 dark:checked:bg-brand-400 mb-0! shrink-0 appearance-none rounded-full border-2 border-neutral-300 bg-white focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none dark:border-neutral-600 dark:bg-neutral-800"
          }
        ),
        /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex flex-wrap items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-xs font-semibold text-neutral-800 dark:text-neutral-200" }, property.siteUrl), isBest && /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "indigo" }, window.wp.i18n.__("Best match", "structura"))), /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-1 block text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(PropertyTypeLine, { siteUrl: property.siteUrl, siteHost })), /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-1.5 block" }, /* @__PURE__ */ window.wp.element.createElement(GscPermissionBadge, { level: property.permissionLevel })))
      );
    })
  ), errorAlert);
  const noPropertyBody = /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ window.wp.element.createElement("ol", { className: "m-0! flex list-none flex-col gap-2.5 rounded-xl bg-neutral-50 p-4! ring-1 ring-neutral-200/60 dark:bg-white/[.04] dark:ring-white/[.06]" }, [
    sprintfNodes(
      /* translators: %1$s = "Google Search Console" (product name, bolded), %2$s = the site's host name, rendered verbatim. */
      window.wp.i18n.__("Open %1$s and add %2$s as a property.", "structura"),
      /* @__PURE__ */ window.wp.element.createElement("strong", { className: "font-semibold" }, "Google Search Console"),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[11px]" }, siteHost)
    ),
    window.wp.i18n.__(
      "Follow Google's steps to verify — for most sites, adding one DNS record where you bought your domain.",
      "structura"
    ),
    window.wp.i18n.__("Come back here — we'll find it automatically.", "structura")
  ].map((step, index2) => /* @__PURE__ */ window.wp.element.createElement("li", { key: index2, className: "m-0! flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-px flex size-5 shrink-0 items-center justify-center rounded-full bg-neutral-100 font-mono text-[10px] font-bold text-neutral-600 dark:bg-white/[.08] dark:text-neutral-300" }, index2 + 1), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs leading-relaxed text-neutral-600 dark:text-neutral-300" }, step)))), notFoundYet && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-amber-700 dark:text-amber-300" }, window.wp.i18n.__(
    "Not found yet — Google verification can take a few minutes to propagate.",
    "structura"
  )), errorAlert, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "Wrong Google account? Properties belong to accounts — verify with this one, or switch.",
    "structura"
  )), accountRow);
  const insufficientProperty = gscPropertyToRequest(siteHost, flow.properties) ?? "";
  const insufficientBody = /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3 rounded-xl border border-amber-100 bg-amber-50 p-3.5 dark:border-amber-900/50 dark:bg-amber-950/30" }, /* @__PURE__ */ window.wp.element.createElement(
    ShieldAlert,
    {
      size: 16,
      className: "mt-0.5 shrink-0 text-amber-600 dark:text-amber-400",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs leading-relaxed text-amber-900 dark:text-amber-200" }, sprintfNodes(
    /* translators: %1$s = the connected Google account email, %2$s = the Search Console property id — both rendered verbatim; %3$s = the bolded "'Restricted' is enough" phrase; %4$s = the bolded "Settings → Users and permissions" menu path. */
    window.wp.i18n.__(
      "%1$s doesn't have permission on %2$s. Ask the property owner to add you as a user — %3$s — in Search Console under %4$s.",
      "structura"
    ),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[11px]" }, flow.googleEmail),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[11px]" }, insufficientProperty),
    /* @__PURE__ */ window.wp.element.createElement("strong", { className: "font-semibold" }, window.wp.i18n.__("“Restricted” is enough", "structura")),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-semibold" }, window.wp.i18n.__("Settings → Users and permissions", "structura"))
  ))), errorAlert, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("Or connect with a Google account that already has access.", "structura")), accountRow);
  const body = busy ? spinnerBody : view === "auto_matched" ? confirmBody : view === "picker" ? pickerBody : view === "no_property" ? noPropertyBody : insufficientBody;
  const footer = view === "auto_matched" ? /* @__PURE__ */ window.wp.element.createElement(Y.Footer, { className: "sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      disabled: busy,
      onClick: () => {
        setInlineError(null);
        setSelected(flow.property || best?.siteUrl || "");
        setPickerFromConfirm(true);
        setView("picker");
      }
    },
    window.wp.i18n.__("Choose a different property", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "primary",
      size: "sm",
      disabled: busy,
      onClick: () => void saveProperty(flow.property ?? "")
    },
    /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14, "aria-hidden": true }),
    window.wp.i18n.__("Confirm & connect", "structura")
  )) : view === "picker" ? /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      disabled: busy,
      onClick: () => {
        setInlineError(null);
        if (pickerFromConfirm) {
          setPickerFromConfirm(false);
          setView("auto_matched");
        } else {
          onClose();
        }
      }
    },
    window.wp.i18n.__("Cancel", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "primary",
      size: "sm",
      disabled: busy || selected === "",
      onClick: () => void saveProperty(selected)
    },
    /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14, "aria-hidden": true }),
    window.wp.i18n.__("Connect property", "structura")
  )) : view === "no_property" ? /* @__PURE__ */ window.wp.element.createElement(Y.Footer, { className: "sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      href: GSC_WELCOME_URL,
      target: "_blank",
      rel: "noreferrer"
    },
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14, "aria-hidden": true }),
    window.wp.i18n.__("Open Search Console", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "primary", size: "sm", disabled: busy, onClick: () => void refresh() }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, "aria-hidden": true }), window.wp.i18n.__("I've verified — check again", "structura"))) : /* @__PURE__ */ window.wp.element.createElement(Y.Footer, { className: "sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      disabled: busy,
      onClick: () => void copyOwnerRequest()
    },
    /* @__PURE__ */ window.wp.element.createElement(Copy, { size: 14, "aria-hidden": true }),
    window.wp.i18n.__("Copy request for the owner", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col-reverse gap-3 sm:flex-row" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", disabled: busy, onClick: onClose }, window.wp.i18n.__("Cancel", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "primary", size: "sm", disabled: busy, onClick: () => void refresh() }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, "aria-hidden": true }), window.wp.i18n.__("Try again", "structura"))));
  return /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open, onClose, size: "md" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: onClose,
      "aria-label": window.wp.i18n.__("Close", "structura"),
      className: "focus-visible:ring-brand-400 absolute top-4 right-4 inline-flex size-8 items-center justify-center rounded-full text-neutral-500 transition-colors hover:bg-neutral-100 hover:text-neutral-700 focus:outline-none focus-visible:ring-2 dark:text-neutral-400 dark:hover:bg-neutral-700/60 dark:hover:text-neutral-200"
    },
    /* @__PURE__ */ window.wp.element.createElement(X, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement(Y.Header, null, /* @__PURE__ */ window.wp.element.createElement(Y.Title, { className: "flex items-center gap-2 text-base!" }, /* @__PURE__ */ window.wp.element.createElement(GoogleGGlyph, { size: 20, className: "shrink-0" }), title), /* @__PURE__ */ window.wp.element.createElement(Y.Description, { className: "mt-1.5 text-[13px] leading-relaxed" }, description)), /* @__PURE__ */ window.wp.element.createElement(Y.Body, null, body), footer));
};
const BRAND_MONOGRAMS = {
  "slack-webhook": {
    // Slack's brand purple (aubergine). Keep the monogram two-letter so it
    // doesn't collide with the Stripe "S" people already associate with that
    // specific purple.
    label: "Sl",
    bg: "#4A154B",
    fg: "#FFFFFF"
  },
  linkedin: {
    // LinkedIn's corporate blue. "in" mirrors their lowercase monogram.
    label: "in",
    bg: "#0A66C2",
    fg: "#FFFFFF"
  },
  indexnow: {
    // IndexNow's protocol green — teal-adjacent, used on indexnow.org.
    // "IN" so it reads as a crawler-family mark without being a sign-in icon.
    label: "IN",
    bg: "#00897B",
    fg: "#FFFFFF"
  },
  // Future-proofing: if we later add a "bing" catalog entry (IndexNow uses
  // the bing mark today in the catalog), surface it here too.
  bing: {
    label: "b",
    bg: "#008373",
    fg: "#FFFFFF"
  },
  "webhook-ping": {
    // Webhooks aren't a vendor brand, they're a protocol — so there's no
    // logo to license. The catalog previously pointed at simple-icons'
    // `webhook` slug which doesn't exist there, producing the broken-image
    // glyph in the store tile (see screenshot, 2026-04-22). Use Lucide's
    // hexagon-with-dots `Webhook` glyph (the same mark most webhook
    // providers use in their own UIs) over a neutral slate tile so it
    // reads as "generic HTTP endpoint" rather than imitating any one
    // vendor. `label: "W"` is the fallback for `renderRawIntegrationMark`.
    label: "W",
    bg: "#475569",
    fg: "#FFFFFF",
    icon: Webhook
  }
};
const IntegrationIcon = ({
  integrationId,
  iconUrl,
  sizeClassName = "size-10",
  className
}) => {
  const override = BRAND_MONOGRAMS[integrationId];
  const baseClass = B$1(
    sizeClassName,
    "shrink-0 rounded-xl overflow-hidden",
    className
  );
  if (integrationId === VIDEO_INTEGRATION_ID) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          baseClass,
          "flex items-center justify-center bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300"
        ),
        "aria-hidden": true
      },
      /* @__PURE__ */ window.wp.element.createElement(Wn, { className: "h-[55%] w-[55%]" })
    );
  }
  if (integrationId === GSC_INTEGRATION_ID) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          baseClass,
          "flex items-center justify-center bg-white ring-1 ring-neutral-200 dark:ring-neutral-700"
        ),
        "aria-hidden": true
      },
      /* @__PURE__ */ window.wp.element.createElement(GoogleGGlyph, { className: "h-[75%] w-[75%]" })
    );
  }
  if (override) {
    const OverrideIcon = override.icon;
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          baseClass,
          "flex items-center justify-center text-sm font-bold tracking-tight"
        ),
        style: { backgroundColor: override.bg, color: override.fg },
        "aria-hidden": true
      },
      OverrideIcon ? (
        // `size` is wired through the default `size-*` Tailwind class on
        // the wrapper — the icon itself just needs a concrete pixel size
        // that matches the tile's optical weight. 18 matches the Plug
        // fallback below so the two look balanced side by side.
        /* @__PURE__ */ window.wp.element.createElement(OverrideIcon, { size: 18 })
      ) : override.label
    );
  }
  if (iconUrl) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "img",
      {
        src: iconUrl,
        alt: "",
        className: B$1(
          baseClass,
          "bg-white object-contain p-1 ring-1 ring-neutral-200 dark:ring-neutral-700"
        )
      }
    );
  }
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        baseClass,
        "bg-brand-50 text-brand-600 dark:bg-brand-900/30 dark:text-brand-300 flex items-center justify-center"
      ),
      "aria-hidden": true
    },
    /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 18 })
  );
};
Object.freeze(
  Object.keys(BRAND_MONOGRAMS)
);
const shortDate = (iso) => {
  const parsed = new Date(iso);
  return Number.isNaN(parsed.getTime()) ? iso : parsed.toLocaleDateString(void 0, { month: "short", day: "numeric" });
};
const upgradeHref = () => buildMarketingPricingUrl({
  intent: "unlock_video",
  domain: typeof window !== "undefined" ? window.location.hostname : void 0
});
const VideoEventRow = ({ event }) => {
  const job = event.videoJob;
  if (!job) return null;
  const state = resolveVideoRowState(job);
  return (
    // aria-live on the row: Rendering → Ready flips announce politely
    // when the events query refetches (handoff §7).
    /* @__PURE__ */ window.wp.element.createElement(
      "li",
      {
        role: "status",
        "aria-live": "polite",
        className: "flex items-start gap-3 rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm dark:border-neutral-700 dark:bg-neutral-800 dark:ring-1 dark:ring-white/[.04]"
      },
      /* @__PURE__ */ window.wp.element.createElement(
        IntegrationIcon,
        {
          integrationId: "video",
          sizeClassName: "size-9",
          className: "mt-0.5"
        }
      ),
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! truncate text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, event.postTitle || window.wp.i18n.sprintf(window.wp.i18n.__("Post #%d", "structura"), event.postId)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(StateBadge, { state }))), /* @__PURE__ */ window.wp.element.createElement(StateBody, { state, job, event }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-xs text-neutral-400 dark:text-neutral-500" }, new Date(event.createdAt).toLocaleString()))
    )
  );
};
function StateBadge({
  state
}) {
  switch (state) {
    case "rendering":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "indigo", variant: "solid", dotPulse: true }, window.wp.i18n.__("Rendering", "structura"));
    case "ready":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success", variant: "solid" }, window.wp.i18n.__("Ready", "structura"));
    case "expired":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "default", variant: "solid" }, window.wp.i18n.__("Expired", "structura"));
    case "skipped_quota":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "warning", variant: "solid" }, window.wp.i18n.__("Skipped", "structura"));
    case "failed":
    default:
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "destructive", variant: "solid" }, window.wp.i18n.__("Failed", "structura"));
  }
}
function StateBody({
  state,
  job,
  event
}) {
  switch (state) {
    case "rendering":
      return /* @__PURE__ */ window.wp.element.createElement(RenderingBody, { job });
    case "ready":
      return /* @__PURE__ */ window.wp.element.createElement(ReadyBody, { job, event });
    case "expired":
      return /* @__PURE__ */ window.wp.element.createElement(ExpiredBody, { job });
    case "skipped_quota":
      return /* @__PURE__ */ window.wp.element.createElement(SkippedBody, { job });
    case "failed":
    default:
      return /* @__PURE__ */ window.wp.element.createElement(FailedBody, { job, event });
  }
}
function RenderingBody({ job }) {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2.5 max-w-md" }, /* @__PURE__ */ window.wp.element.createElement(Fe, { className: "bg-brand-100 dark:bg-brand-500/20" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-1.5 flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Rendering your video — usually takes a few minutes.",
    "structura"
  )), job.stage && // Pipeline stage strings come from the render pipeline verbatim
  // (mono, technical) — not translated by design.
  /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[10px] text-neutral-400 dark:text-neutral-500" }, job.stage)));
}
function VideoThumb({
  job,
  dimmed = false,
  onClick
}) {
  const OverlayIcon = dimmed ? Clock : Play;
  const classes = "relative h-[100px] w-14 shrink-0 overflow-hidden rounded-lg bg-gradient-to-b from-neutral-200 to-neutral-300 dark:from-neutral-700 dark:to-neutral-800" + (dimmed ? " opacity-50 grayscale" : "") + // Neutralize wp-admin's default button chrome (border/padding)
  // alongside the pointer/hover/focus affordances.
  (onClick ? " group cursor-pointer appearance-none border-0 p-0 transition hover:ring-2 hover:ring-brand-400/60 focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:outline-none" : "");
  const content = /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, job.thumbnailUrl && /* @__PURE__ */ window.wp.element.createElement(
    "img",
    {
      src: job.thumbnailUrl,
      alt: "",
      className: "absolute inset-0 h-full w-full object-cover"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "absolute inset-0 flex items-center justify-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-7 items-center justify-center rounded-full bg-neutral-950/60 text-white backdrop-blur-sm transition-transform group-hover:scale-110" }, /* @__PURE__ */ window.wp.element.createElement(OverlayIcon, { size: 13, "aria-hidden": true }))), job.durationSec != null && /* @__PURE__ */ window.wp.element.createElement("span", { className: "absolute right-1 bottom-1 rounded bg-neutral-950/75 px-1 py-0.5 font-mono text-[9px] font-semibold text-white" }, formatVideoDuration(job.durationSec)));
  return onClick ? /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      "aria-label": window.wp.i18n.__("Preview", "structura"),
      onClick,
      className: classes
    },
    content
  ) : /* @__PURE__ */ window.wp.element.createElement("div", { className: classes }, content);
}
function ReadyBody({ job, event }) {
  const [previewOpen, setPreviewOpen] = window.wp.element.useState(false);
  const [regenerateOpen, setRegenerateOpen] = window.wp.element.useState(false);
  const retry = useVideoRetryMutation();
  const { videoQuota } = useChannelConnectionsQuery();
  const metaParts = [
    job.durationSec != null ? formatVideoDuration(job.durationSec) : null,
    job.bytes != null ? formatVideoBytes(job.bytes) : null,
    job.expiresAt ? window.wp.i18n.sprintf(
      /* translators: %s = short date, e.g. "Jul 9". */
      window.wp.i18n.__("link expires %s", "structura"),
      shortDate(job.expiresAt)
    ) : null
  ].filter(Boolean);
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2.5 flex gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    VideoThumb,
    {
      job,
      onClick: job.downloadUrl ? () => setPreviewOpen(true) : void 0
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, metaParts.length > 0 && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, metaParts.join(" · ")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Ready to upload to YouTube Shorts or TikTok.", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3 flex flex-wrap items-center gap-2" }, job.downloadUrl && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "primary",
      size: "sm",
      href: job.downloadUrl,
      download: true
    },
    /* @__PURE__ */ window.wp.element.createElement(Download, { size: 14, className: "mr-1.5", "aria-hidden": true }),
    window.wp.i18n.__("Download video", "structura")
  ), job.downloadUrl && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => setPreviewOpen(true)
    },
    /* @__PURE__ */ window.wp.element.createElement(Play, { size: 14, className: "mr-1.5", "aria-hidden": true }),
    window.wp.i18n.__("Preview", "structura")
  ), job.srtUrl && /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "transparent", size: "sm", href: job.srtUrl, download: true }, /* @__PURE__ */ window.wp.element.createElement(Captions, { size: 14, className: "mr-1.5", "aria-hidden": true }), window.wp.i18n.__("Captions (.srt)", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: () => setRegenerateOpen(true),
      disabled: retry.isPending
    },
    /* @__PURE__ */ window.wp.element.createElement(RotateCcw, { size: 14, className: "mr-1.5", "aria-hidden": true }),
    retry.isPending ? window.wp.i18n.__("Regenerating…", "structura") : window.wp.i18n.__("Regenerate", "structura")
  )), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: regenerateOpen,
      onClose: () => setRegenerateOpen(false),
      onConfirm: () => {
        setRegenerateOpen(false);
        retry.mutate(job.jobId);
      },
      variant: "primary",
      title: window.wp.i18n.__("Regenerate this video?", "structura"),
      description: videoQuota ? window.wp.i18n.sprintf(
        /* translators: 1: monthly video cap, 2: videos used this month. */
        window.wp.i18n.__(
          "This will use 1 of your %1$d monthly videos (%2$d of %1$d used). The same script is re-rendered with the latest visuals and voice.",
          "structura"
        ),
        videoQuota.cap,
        videoQuota.used
      ) : window.wp.i18n.__(
        "This will use 1 video from your monthly quota. The same script is re-rendered with the latest visuals and voice.",
        "structura"
      ),
      confirmButtonProps: { label: window.wp.i18n.__("Regenerate", "structura") }
    }
  ), job.downloadUrl && /* @__PURE__ */ window.wp.element.createElement(
    Sa,
    {
      open: previewOpen,
      onClose: () => setPreviewOpen(false),
      src: job.downloadUrl,
      poster: job.thumbnailUrl,
      closeLabel: window.wp.i18n.__("Close preview", "structura"),
      videoProps: { preload: "metadata" }
    },
    /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Now previewing", "structura")),
    /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mt-2! mb-0! text-lg leading-snug font-bold tracking-tight text-white" }, event.postTitle),
    /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-xs text-neutral-400" }, [
      job.durationSec != null ? formatVideoDuration(job.durationSec) : null,
      job.bytes != null ? formatVideoBytes(job.bytes) : null,
      // Output format is fixed (9:16 @ 1080×1920) — a spec, not copy.
      "1080×1920"
    ].filter(Boolean).join(" · ")),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-5 flex flex-col items-start gap-2.5" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "primary", size: "sm", href: job.downloadUrl, download: true }, /* @__PURE__ */ window.wp.element.createElement(Download, { size: 14, className: "mr-1.5", "aria-hidden": true }), window.wp.i18n.__("Download video", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs leading-relaxed text-neutral-400" }, window.wp.i18n.__(
      "Upload it to YouTube Shorts or TikTok. Auto-publish is on the roadmap.",
      "structura"
    )), job.expiresAt && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] text-neutral-500" }, window.wp.i18n.sprintf(
      /* translators: %s = short date, e.g. "Jul 9". */
      window.wp.i18n.__("Download link expires %s.", "structura"),
      shortDate(job.expiresAt)
    )))
  ))), isSocialPackages(job.socialPackages) && /* @__PURE__ */ window.wp.element.createElement(CaptionPackage, { packages: job.socialPackages }));
}
function FailedBody({ job, event }) {
  const retry = useVideoRetryMutation();
  const reason = job.error?.message?.trim();
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2.5 max-w-md space-y-2.5" }, /* @__PURE__ */ window.wp.element.createElement(
    "p",
    {
      role: "alert",
      className: "m-0! rounded-lg bg-red-50 px-2.5 py-1.5 text-xs leading-relaxed text-red-700 dark:bg-red-950/40 dark:text-red-300"
    },
    reason ? `${reason} ` : "",
    window.wp.i18n.__("Nothing was used from your quota.", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => retry.mutate(job.jobId),
      disabled: retry.isPending
    },
    /* @__PURE__ */ window.wp.element.createElement(RotateCcw, { size: 14, className: "mr-1.5", "aria-hidden": true }),
    retry.isPending ? window.wp.i18n.__("Retrying…", "structura") : window.wp.i18n.__("Retry render", "structura")
  ), event.postUrl && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      href: event.postUrl,
      target: "_blank",
      rel: "noreferrer"
    },
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14, className: "mr-1.5", "aria-hidden": true }),
    window.wp.i18n.__("View post", "structura")
  )));
}
function ExpiredBody({ job }) {
  const retry = useVideoRetryMutation();
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2.5 flex gap-3" }, /* @__PURE__ */ window.wp.element.createElement(VideoThumb, { job, dimmed: true }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, job.expiresAt ? window.wp.i18n.sprintf(
    /* translators: %s = short date, e.g. "Jul 1". */
    window.wp.i18n.__(
      "This download link expired %s — videos are kept for 7 days.",
      "structura"
    ),
    shortDate(job.expiresAt)
  ) : window.wp.i18n.__(
    "This download link expired — videos are kept for 7 days.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3 flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => retry.mutate(job.jobId),
      disabled: retry.isPending
    },
    /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5", "aria-hidden": true }),
    retry.isPending ? window.wp.i18n.__("Regenerating…", "structura") : window.wp.i18n.__("Regenerate", "structura")
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-[11px] text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("Regenerating uses 1 video from your monthly quota.", "structura"))));
}
function SkippedBody({ job }) {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2.5 max-w-md space-y-2.5" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-lg bg-amber-50 px-2.5 py-1.5 text-xs leading-relaxed text-amber-900 dark:bg-amber-950/40 dark:text-amber-200" }, job.quotaUsed != null && job.quotaCap != null ? window.wp.i18n.sprintf(
    /* translators: %1$d = videos used, %2$d = monthly cap. */
    window.wp.i18n.__(
      "Monthly video limit reached (%1$d of %2$d), so this post was skipped. Renders resume when your quota resets.",
      "structura"
    ),
    job.quotaUsed,
    job.quotaCap
  ) : window.wp.i18n.__(
    "Monthly video limit reached, so this post was skipped. Renders resume when your quota resets.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      href: upgradeHref(),
      target: "_blank",
      rel: "noreferrer"
    },
    /* @__PURE__ */ window.wp.element.createElement(ArrowUpRight, { size: 14, className: "mr-1.5", "aria-hidden": true }),
    window.wp.i18n.__("Upgrade for more videos", "structura")
  )));
}
const statusIntent = (status) => {
  switch (status) {
    case "ok":
      return "success";
    case "skipped":
    // Anti-spam throttle — a benign skip, not a failure. Neutral, like skipped.
    case "rate_limited":
      return "secondary";
    case "transient_error":
    case "timeout":
      return "warning";
    case "permanent_error":
    default:
      return "destructive";
  }
};
const statusLabel = (status) => {
  switch (status) {
    case "ok":
      return window.wp.i18n.__("Delivered", "structura");
    case "skipped":
      return window.wp.i18n.__("Skipped", "structura");
    case "rate_limited":
      return window.wp.i18n.__("Skipped (recently posted)", "structura");
    case "transient_error":
      return window.wp.i18n.__("Retrying", "structura");
    case "timeout":
      return window.wp.i18n.__("Timed out", "structura");
    case "permanent_error":
    default:
      return window.wp.i18n.__("Failed", "structura");
  }
};
const ChannelEventRow = ({ event }) => {
  if (event.videoJob) {
    return /* @__PURE__ */ window.wp.element.createElement(VideoEventRow, { event });
  }
  const resultEntries = Object.entries(event.results ?? {});
  const hasResults = resultEntries.length > 0;
  const fallbackLabel = event.dispatchedTo.length === 0 ? window.wp.i18n.__("No integrations connected yet", "structura") : window.wp.i18n.sprintf(
    // translators: %s is a comma-separated list of integration ids (e.g. "slack, indexnow")
    window.wp.i18n.__("Dispatched to: %s", "structura"),
    event.dispatchedTo.join(", ")
  );
  return /* @__PURE__ */ window.wp.element.createElement("li", { className: "flex items-start gap-3 rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-xl bg-brand-50 text-brand-600" }, /* @__PURE__ */ window.wp.element.createElement(Radio, { size: 16 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "truncate text-sm font-semibold text-neutral-900" }, event.postTitle || window.wp.i18n.sprintf(window.wp.i18n.__("Post #%d", "structura"), event.postId)), event.postUrl && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: event.postUrl,
      target: "_blank",
      rel: "noreferrer",
      className: "inline-flex shrink-0 items-center gap-1 text-xs font-medium text-brand-600 hover:underline"
    },
    window.wp.i18n.__("Open", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 12 })
  )), hasResults ? /* @__PURE__ */ window.wp.element.createElement("ul", { className: "mt-2 flex flex-wrap items-center gap-2" }, resultEntries.map(([rowKey, result]) => {
    const integrationId = result.integrationId ?? rowKey;
    return /* @__PURE__ */ window.wp.element.createElement("li", { key: rowKey, className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: statusIntent(result.status), variant: "solid" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-semibold" }, integrationId), /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1 opacity-80" }, statusLabel(result.status))), result.externalUrl && /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: result.externalUrl,
        target: "_blank",
        rel: "noreferrer",
        className: "inline-flex items-center gap-1 text-xs text-neutral-500 hover:text-brand-600 hover:underline",
        "aria-label": window.wp.i18n.sprintf(
          // translators: %s is the integration id (e.g. "slack")
          window.wp.i18n.__("Open the message in %s", "structura"),
          integrationId
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 11 })
    ), result.error && /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: "text-xs text-red-700",
        title: result.error.code
      },
      result.error.message
    ));
  })) : /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 text-xs text-neutral-500" }, fallbackLabel), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 text-xs text-neutral-400" }, new Date(event.createdAt).toLocaleString())));
};
const Tab$1 = ({ to, icon, children, end }) => /* @__PURE__ */ window.wp.element.createElement(
  NavLink,
  {
    to,
    end,
    className: ({ isActive }) => B$1(
      "-mb-px inline-flex items-center gap-2 border-b-2 px-1 pb-3 text-sm font-medium transition-colors",
      isActive ? "border-brand-500 text-brand-600!" : "border-transparent text-neutral-500! hover:border-neutral-300 hover:text-neutral-800!"
    )
  },
  /* @__PURE__ */ window.wp.element.createElement("span", { "aria-hidden": "true", className: "inline-flex items-center" }, icon),
  children
);
const ChannelsSubNav = () => /* @__PURE__ */ window.wp.element.createElement(
  "nav",
  {
    "aria-label": window.wp.i18n.__("Channels sections", "structura"),
    className: "flex items-center gap-6 border-b border-neutral-200"
  },
  /* @__PURE__ */ window.wp.element.createElement(Tab$1, { to: "/channels/connections", icon: /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14 }) }, window.wp.i18n.__("Connections", "structura")),
  /* @__PURE__ */ window.wp.element.createElement(Tab$1, { to: "/channels/store", icon: /* @__PURE__ */ window.wp.element.createElement(Store, { size: 14 }) }, window.wp.i18n.__("Store", "structura")),
  /* @__PURE__ */ window.wp.element.createElement(Tab$1, { to: "/channels/activity", icon: /* @__PURE__ */ window.wp.element.createElement(Activity, { size: 14 }) }, window.wp.i18n.__("Activity", "structura"))
);
const VideoFirstRunEmptyState = () => /* @__PURE__ */ window.wp.element.createElement(
  Ea,
  {
    icon: /* @__PURE__ */ window.wp.element.createElement(Wn, { className: "h-6 w-6" }),
    title: window.wp.i18n.__("Your first video is on its way", "structura"),
    description: window.wp.i18n.__(
      "It will appear here after your next post publishes. Rendering takes a few minutes — you’ll see live progress.",
      "structura"
    ),
    action: /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/connections" }, window.wp.i18n.__("Configure Video", "structura")))
  }
);
const VideoUpgradeGate = () => {
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  return /* @__PURE__ */ window.wp.element.createElement(
    Ea,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 22 }),
      title: window.wp.i18n.__("Video is a Cloud Pro feature", "structura"),
      description: window.wp.i18n.__(
        "This link points to the Video channel, which isn’t included in your plan. Upgrade to turn every post into a vertical video for Shorts and TikTok.",
        "structura"
      ),
      action: /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center justify-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
        tr$1,
        {
          variant: "primary",
          size: "sm",
          href: buildMarketingPricingUrl({ intent: "unlock_video", domain }),
          target: "_blank",
          rel: "noreferrer"
        },
        /* @__PURE__ */ window.wp.element.createElement(ArrowUpRight, { size: 14, className: "mr-1.5", "aria-hidden": true }),
        window.wp.i18n.__("Upgrade plan", "structura")
      ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "transparent", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/store" }, window.wp.i18n.__("Back to Store", "structura"))))
    }
  );
};
const ChannelsActivityPage = () => {
  const { data: events, isLoading, isError, error } = useChannelEventsQuery();
  const { data: connections } = useChannelConnectionsQuery();
  const hasVideoConnection = (connections ?? []).some(
    (connection) => connection.integrationId === VIDEO_INTEGRATION_ID && connection.status === "connected"
  );
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(ChannelsSubNav, null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-6 w-48" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-4 w-80" })), /* @__PURE__ */ window.wp.element.createElement(
      "ul",
      {
        className: "m-0! list-none space-y-3 p-0!",
        "aria-label": window.wp.i18n.__("Loading channel activity", "structura"),
        "aria-busy": true
      },
      [0, 1, 2, 3, 4].map((i2) => /* @__PURE__ */ window.wp.element.createElement(
        "li",
        {
          key: i2,
          className: "rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm dark:border-neutral-700 dark:bg-neutral-800"
        },
        /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1 space-y-2" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-4 w-2/3" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-1/3" })), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-5 w-16 rounded-full" }))
      ))
    )));
  }
  if (isError) {
    return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(ChannelsSubNav, null), /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        role: "alert",
        className: "rounded-2xl border border-red-200 bg-red-50 p-4 text-sm text-red-900"
      },
      window.wp.i18n.__("We couldn't load channel activity.", "structura"),
      error instanceof Error && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 text-xs text-red-700" }, error.message)
    ));
  }
  const list = events ?? [];
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(ChannelsSubNav, null), /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "text-xl font-bold tracking-tight text-neutral-900" }, window.wp.i18n.__("Channel Activity", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 text-sm text-neutral-500" }, window.wp.i18n.__(
    "Every time Structura publishes a post, the cloud dispatcher records what it sent to each connected channel. The 25 most recent events are shown here.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "primary", size: "sm", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/connections" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Connect a channel", "structura")))), list.length === 0 && hasVideoConnection ? /* @__PURE__ */ window.wp.element.createElement(VideoFirstRunEmptyState, null) : list.length === 0 ? /* @__PURE__ */ window.wp.element.createElement(
    Ea,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Inbox, { size: 22 }),
      title: window.wp.i18n.__("No channel events yet", "structura"),
      description: window.wp.i18n.__(
        "Once a Structura campaign publishes a post, it will appear here with the channels it was dispatched to.",
        "structura"
      ),
      action: /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "primary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/connections" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Connect a channel", "structura")))
    }
  ) : /* @__PURE__ */ window.wp.element.createElement("ul", { className: "space-y-3" }, list.map((event) => /* @__PURE__ */ window.wp.element.createElement(ChannelEventRow, { key: event.id, event }))));
};
const connectionStatusLabel = (status) => {
  switch (status) {
    case "connected":
      return window.wp.i18n.__("Connected", "structura");
    case "expired":
      return window.wp.i18n.__("Expired", "structura");
    case "revoked":
      return window.wp.i18n.__("Revoked", "structura");
    case "error":
      return window.wp.i18n.__("Error", "structura");
    default:
      return String(status);
  }
};
const capabilityLabel = (capability) => {
  switch (capability) {
    case "insights":
      return window.wp.i18n.__("Read-only insights", "structura");
    default:
      return null;
  }
};
const useIndexNowKey = (enabled = true) => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: channelKeys.indexnowKey(),
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/channels/indexnow/key" }),
    enabled: hasUsableLicense === true && enabled,
    staleTime: 1e3 * 60 * 5
  });
};
const useVerifyIndexNowKeyfile = () => {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: async (connectionId) => window.wp.apiFetch({
      path: `/structura/v1/channels/indexnow/${connectionId}/verify`,
      method: "POST"
    }),
    onSuccess: () => {
      queryClient2.invalidateQueries({ queryKey: channelKeys.connections() });
    }
  });
};
const statusBadgeIntent$1 = (status) => {
  switch (status) {
    case "connected":
      return "success";
    case "expired":
      return "warning";
    case "revoked":
    case "error":
    default:
      return "destructive";
  }
};
const notificationLocaleLabel = (code) => {
  switch (code) {
    case "en":
      return "English";
    case "de":
      return "Deutsch";
    case "es":
      return "Español";
    case "fr":
      return "Français";
    case "system":
    case void 0:
    case "":
    default:
      return window.wp.i18n.__("System language", "structura");
  }
};
const ChannelConnectionRow = ({
  connection,
  catalogEntry,
  onDelete,
  onEdit,
  isDeleting = false,
  videoQuota,
  boundVisualPreset
}) => {
  const [confirmOpen, setConfirmOpen] = window.wp.element.useState(false);
  const isVideo = connection.integrationId === VIDEO_INTEGRATION_ID;
  const effectiveVideoStyle = boundVisualPreset !== void 0 ? boundVisualPreset?.videoStyle : connection.videoStyle;
  const quotaExhausted = isVideo && !!videoQuota && videoQuota.used >= videoQuota.cap;
  const intent = statusBadgeIntent$1(connection.status);
  const StatusIcon2 = connection.status === "connected" && !quotaExhausted ? CircleCheck : CircleAlert;
  const primaryLabel = connection.displayName?.trim() || catalogEntry?.name || connection.integrationId;
  const providerLabel2 = catalogEntry?.name || connection.integrationId;
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("li", { className: "flex items-start gap-3 rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm dark:border-neutral-700 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    IntegrationIcon,
    {
      integrationId: connection.integrationId,
      iconUrl: catalogEntry?.iconUrl,
      sizeClassName: "size-9",
      className: "mt-0.5"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "truncate text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, primaryLabel), /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 text-[11px] font-medium text-neutral-500 dark:text-neutral-400" }, providerLabel2)), connection.externalAccountId && /* @__PURE__ */ window.wp.element.createElement("p", { className: "truncate text-xs text-neutral-500 dark:text-neutral-400" }, connection.externalAccountId), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 flex items-center gap-1.5 text-xs text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(
    StatusIcon2,
    {
      size: 12,
      className: quotaExhausted ? "text-amber-500" : intent === "success" ? "text-emerald-500" : "text-red-500",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("span", null, connection.integrationId === GSC_INTEGRATION_ID ? (
    // GSC never notifies or publishes — "Notifications in …"
    // would wrongly imply outbound behaviour, so its meta
    // line states the read-only nature instead.
    window.wp.i18n.__("Read-only insights", "structura")
  ) : isVideo ? window.wp.i18n.sprintf(
    /* translators: %1$s = voice name (e.g. "Nova"), %2$s = visual preset name (e.g. "Clean"), %3$s = cadence ("every post" / "every 3th post"). */
    window.wp.i18n.__("Voice %1$s · %2$s preset · %3$s", "structura"),
    // Stored value may be canonical ("gemini:Zephyr") or a
    // legacy persona id ("ava") — resolve to the real
    // voice name so the row matches what the picker shows.
    resolveStoredVideoVoice(connection.videoVoice).option.name,
    videoStyleById(effectiveVideoStyle).name,
    (connection.postCadenceN ?? 1) <= 1 ? window.wp.i18n.__("every post", "structura") : window.wp.i18n.sprintf(
      /* translators: %d = "every Nth" cadence number, e.g. 3. */
      window.wp.i18n.__("every %dth post", "structura"),
      connection.postCadenceN ?? 1
    )
  ) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, window.wp.i18n.__("Notifications in", "structura"), " ", /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-medium text-neutral-700 dark:text-neutral-200" }, notificationLocaleLabel(connection.notificationLocale)))))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, quotaExhausted && connection.status === "connected" ? (
    // The exhausted state outranks the green "Connected" pill —
    // the row's most useful fact is now "why did my post get
    // skipped". Real error statuses still win over quota.
    /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "warning", variant: "solid" }, window.wp.i18n.__("Quota reached", "structura"))
  ) : /* @__PURE__ */ window.wp.element.createElement(Me, { intent, variant: "solid" }, connectionStatusLabel(connection.status)), onEdit && connection.connectionId && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: () => onEdit(connection),
      disabled: isDeleting,
      "aria-label": window.wp.i18n.__("Edit", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(Pencil, { size: 14 }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1" }, window.wp.i18n.__("Edit", "structura"))
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: () => setConfirmOpen(true),
      disabled: isDeleting,
      "aria-label": window.wp.i18n.__("Disconnect", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 14 }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1" }, window.wp.i18n.__("Disconnect", "structura"))
  ))), connection.lastError && /* @__PURE__ */ window.wp.element.createElement(
    "p",
    {
      role: "alert",
      className: "mt-2 rounded-md bg-red-50 px-2 py-1 text-xs text-red-700 dark:bg-red-900/30 dark:text-red-300"
    },
    connection.lastError.message
  ), isVideo && videoQuota && /* @__PURE__ */ window.wp.element.createElement(
    qa,
    {
      className: "mt-4 max-w-xs",
      used: videoQuota.used,
      total: videoQuota.cap,
      label: window.wp.i18n.sprintf(
        /* translators: %1$d = videos used, %2$d = monthly cap. */
        window.wp.i18n.__("%1$d of %2$d videos this month", "structura"),
        videoQuota.used,
        videoQuota.cap
      )
    }
  ), quotaExhausted && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! rounded-lg bg-amber-50 px-2.5 py-1.5 text-xs leading-relaxed text-amber-900 dark:bg-amber-950/40 dark:text-amber-200" }, window.wp.i18n.__(
    "New posts are skipped until your quota resets.",
    "structura"
  ), " ", /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildMarketingPricingUrl({
        intent: "unlock_video",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0
      }),
      target: "_blank",
      rel: "noreferrer",
      className: "font-semibold underline underline-offset-2 hover:text-amber-950 dark:hover:text-amber-100"
    },
    window.wp.i18n.__("Upgrade for more videos", "structura")
  )), connection.integrationId === "indexnow" && /* @__PURE__ */ window.wp.element.createElement(IndexNowVerifyRow, { connection }))), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: confirmOpen,
      onClose: () => setConfirmOpen(false),
      onConfirm: () => {
        setConfirmOpen(false);
        onDelete(connection.connectionId ?? connection.integrationId);
      },
      title: window.wp.i18n.__("Disconnect this channel?", "structura"),
      description: window.wp.i18n.__(
        // Named with the destination so multi-connection setups
        // (e.g. a Slack to #deploys and another to #alerts) disambiguate.
        /* translators: %1$s is the provider (Slack, Discord…), %2$s is the destination name */
        "This will remove your %1$s connection to %2$s. Structura will stop posting notifications to this channel until you reconnect.",
        "structura"
      ).replace("%1$s", providerLabel2).replace("%2$s", primaryLabel),
      variant: "danger",
      loading: isDeleting,
      confirmButtonProps: {
        label: window.wp.i18n.__("Disconnect", "structura"),
        icon: /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 14 })
      },
      cancelButtonProps: {
        label: window.wp.i18n.__("Keep connected", "structura")
      }
    }
  ));
};
function IndexNowVerifyRow({ connection }) {
  const meta = connection.externalAccountMeta ?? {};
  const connectionId = connection.connectionId ?? "";
  const verify = useVerifyIndexNowKeyfile();
  const handleVerify = async () => {
    if (!connectionId) {
      An.error(
        window.wp.i18n.__("This connection is missing its id. Reconnect IndexNow.", "structura")
      );
      return;
    }
    try {
      const result = await verify.mutateAsync(connectionId);
      if (result.verified) {
        An.success(window.wp.i18n.__("IndexNow keyfile verified.", "structura"));
      } else {
        An.error(
          result.error?.message ?? window.wp.i18n.__("Could not verify the IndexNow keyfile.", "structura")
        );
      }
    } catch (err) {
      const message = err?.message ?? window.wp.i18n.__("Verification request failed.", "structura");
      An.error(message);
    }
  };
  const verifiedAt = typeof meta.verifiedAt === "string" && meta.verifiedAt ? meta.verifiedAt : null;
  const verifyError = meta.verifyError && typeof meta.verifyError === "object" ? meta.verifyError : null;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3 flex flex-wrap items-center gap-2 rounded-md border border-neutral-200 bg-neutral-50 px-2 py-1.5 dark:border-neutral-700 dark:bg-neutral-900/40" }, verifiedAt && /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1.5 text-xs text-emerald-700 dark:text-emerald-400" }, /* @__PURE__ */ window.wp.element.createElement(ShieldCheck, { size: 14, "aria-hidden": true }), window.wp.i18n.sprintf(
    // translators: %s is a localized date/time
    window.wp.i18n.__("Keyfile verified %s", "structura"),
    new Date(verifiedAt).toLocaleString(void 0, {
      dateStyle: "medium",
      timeStyle: "short"
    })
  )), !verifiedAt && verifyError && /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1.5 text-xs text-red-700 dark:text-red-400" }, /* @__PURE__ */ window.wp.element.createElement(ShieldAlert, { size: 14, "aria-hidden": true }), window.wp.i18n.__("Keyfile not reachable", "structura"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1 font-mono text-[10px] text-red-600/70 dark:text-red-300/70" }, verifyError.code)), !verifiedAt && !verifyError && /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1.5 text-xs text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(ShieldAlert, { size: 14, "aria-hidden": true }), window.wp.i18n.__("Keyfile not yet verified", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      type: "button",
      variant: "transparent",
      size: "sm",
      onClick: handleVerify,
      disabled: verify.isPending || !connectionId,
      className: "ml-auto"
    },
    verify.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 12, className: "mr-1 animate-spin", "aria-hidden": true }) : null,
    verifiedAt ? window.wp.i18n.__("Re-verify", "structura") : window.wp.i18n.__("Verify", "structura")
  ));
}
const MIN_CADENCE = 1;
const MAX_CADENCE = 50;
const CadencePicker = ({
  value,
  onChange,
  label,
  helper: helperOverride,
  id = "structura-cadence-picker"
}) => {
  const display = Math.max(MIN_CADENCE, Math.min(MAX_CADENCE, Math.floor(value || MIN_CADENCE)));
  const helper = helperOverride ?? (display <= 1 ? window.wp.i18n.__(
    "Every published post fans out to this channel. Pick a higher number to throttle bursty campaigns.",
    "structura"
  ) : window.wp.i18n.sprintf(
    /* translators: %d = "every Nth" cadence number, e.g. 3. */
    window.wp.i18n.__(
      "Posts every %dth time a qualifying campaign publishes. A 4-hour minimum gap also applies so a single burst can’t flood your feed.",
      "structura"
    ),
    display
  ));
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      id,
      type: "number",
      label: label ?? window.wp.i18n.__("Post on every Nth post", "structura"),
      value: String(display),
      min: MIN_CADENCE,
      max: MAX_CADENCE,
      step: 1,
      onChange: (e2) => {
        const raw = e2.target.value;
        const parsed = parseInt(raw, 10);
        if (Number.isNaN(parsed)) return;
        onChange(Math.max(MIN_CADENCE, Math.min(MAX_CADENCE, parsed)));
      }
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-xs text-neutral-500 dark:text-neutral-400" }, helper));
};
const campaignKeys = {
  all: ["campaigns"],
  lists: () => [...campaignKeys.all, "list"],
  // `id` accepts both legacy numeric WP post IDs and cloud string IDs
  // (Firestore auto-IDs). Concrete typing avoids accidental NaN keys
  // from upstream Number() coercion of non-numeric IDs.
  detail: (id) => [...campaignKeys.all, "detail", id],
  // Phase 1.6 follow-up — per-campaign stock-state summary for the
  // dashboard chip. Lives under `campaignKeys.all` so a generic
  // campaign-cache invalidation refreshes it alongside list/detail.
  stockSummary: (id) => [...campaignKeys.all, "stock-summary", id],
  // Stock tab (2026-06-05) — full live-entry list for one campaign.
  // Sibling of stockSummary so both refresh on stock mutations.
  stock: (id) => [...campaignKeys.all, "stock", id]
};
const jobKeys = {
  all: ["jobs"],
  lists: () => [...jobKeys.all, "list"],
  list: (params) => [...jobKeys.lists(), params]
};
const CampaignBindingsPicker = ({
  value,
  onChange
}) => {
  const { hasUsableLicense } = useLicense();
  const isAllMode = value === null;
  const selectedIds = value ?? [];
  const { data: campaigns, isLoading, error } = useQuery({
    queryKey: campaignKeys.lists(),
    queryFn: async () => await window.wp.apiFetch({ path: "/structura/v1/scheduler/campaigns" }),
    enabled: hasUsableLicense === true && !isAllMode,
    staleTime: 1e4
  });
  const toggle = (id, checked) => {
    const next = checked ? Array.from(/* @__PURE__ */ new Set([...selectedIds, id])) : selectedIds.filter((existing) => existing !== id);
    onChange(next);
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-semibold text-neutral-700 dark:text-neutral-200" }, window.wp.i18n.__("Campaigns", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => onChange(null),
      className: B$1(
        "rounded-lg px-3 py-1 text-[10px] font-black transition-all",
        isAllMode ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : "cursor-pointer text-neutral-400"
      )
    },
    window.wp.i18n.__("All campaigns", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => onChange(selectedIds),
      className: B$1(
        "rounded-lg px-3 py-1 text-[10px] font-black transition-all",
        !isAllMode ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : "cursor-pointer text-neutral-400"
      )
    },
    window.wp.i18n.__("Selected only", "structura")
  ))), isAllMode ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "This channel fires for every campaign on this site. Switch to “Selected only” to scope it to specific campaigns.",
    "structura"
  )) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Only publishes from the ticked campaigns will trigger this channel. Leaving all boxes empty silences the channel entirely.",
    "structura"
  )), isLoading && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Loading campaigns…", "structura")), error && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] text-red-600 dark:text-red-400" }, window.wp.i18n.__(
    "Couldn’t load campaigns — try again in a moment.",
    "structura"
  )), !isLoading && !error && campaigns && campaigns.length === 0 && // Zero-campaign fallback — the user reached the install modal
  // without ever creating a campaign. Rather than dropping a silent
  // empty list, call it out explicitly and nudge back to the All
  // mode so they don't accidentally save a "silence everything"
  // empty allowlist.
  /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-900 dark:bg-amber-900/30 dark:text-amber-200" }, window.wp.i18n.__(
    "No campaigns exist yet. This channel will stay silent until you create one — switch to “All campaigns” to have it fire for every future campaign.",
    "structura"
  )), !isLoading && !error && campaigns && campaigns.length > 0 && // Same visual vocabulary as TaxonomySection's checkbox grid —
  // bounded height + internal scroll so a large campaign list
  // doesn't push the modal's primary actions off-screen.
  /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid max-h-40 grid-cols-1 gap-2 overflow-y-auto rounded-lg border border-neutral-200 p-2 sm:grid-cols-2 dark:border-neutral-700" }, campaigns.map((campaign) => {
    const checked = selectedIds.includes(campaign.id);
    return /* @__PURE__ */ window.wp.element.createElement(
      "label",
      {
        key: campaign.id,
        className: B$1(
          "flex cursor-pointer items-center gap-2 rounded-lg border p-2 text-[11px] transition-colors",
          checked ? "border-brand-200 bg-brand-50/60 dark:border-brand-800 dark:bg-brand-900/20" : "border-transparent hover:bg-neutral-50 dark:hover:bg-neutral-800"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(
        "input",
        {
          type: "checkbox",
          checked,
          onChange: (e2) => toggle(campaign.id, e2.target.checked),
          className: "rounded border-neutral-300 text-brand-600 dark:border-neutral-600 dark:bg-neutral-800"
        }
      ),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "truncate font-bold text-neutral-700 dark:text-neutral-200" }, campaign.identity?.name || window.wp.i18n.__("Untitled campaign", "structura"))
    );
  }))));
};
const VISUALS_VIDEO_ROUTE = "/visuals?section=video";
const NOTIFICATION_LOCALE_OPTIONS$2 = [
  { value: "system", labelKey: "System (use post locale)" },
  { value: "en", label: "English" },
  { value: "de", label: "Deutsch" },
  { value: "es", label: "Español" },
  { value: "fr", label: "Français" }
];
const ConfigureConnectionModal = (props) => {
  if (props.connection.integrationId === GSC_INTEGRATION_ID) {
    return /* @__PURE__ */ window.wp.element.createElement(
      GscConnectModal,
      {
        connection: props.connection,
        open: props.open,
        onClose: props.onClose
      }
    );
  }
  return /* @__PURE__ */ window.wp.element.createElement(StandardConfigureConnectionModal, { ...props });
};
const StandardConfigureConnectionModal = ({
  connection,
  open,
  onClose,
  videoQuota,
  boundVisualPreset,
  videoTts
}) => {
  const isVideo = connection.integrationId === VIDEO_INTEGRATION_ID;
  const presetOwnsStyle = boundVisualPreset !== void 0;
  const [notificationLocale, setNotificationLocale] = window.wp.element.useState(
    connection.notificationLocale ?? "system"
  );
  const [boundCampaignIds, setBoundCampaignIds] = window.wp.element.useState(connection.boundCampaignIds ?? null);
  const [postCadenceN, setPostCadenceN] = window.wp.element.useState(
    connection.postCadenceN ?? 1
  );
  const [attachFeaturedImage, setAttachFeaturedImage] = window.wp.element.useState(
    connection.attachFeaturedImage ?? true
  );
  const storedVoice = resolveStoredVideoVoice(connection.videoVoice);
  const [videoVoice, setVideoVoice] = window.wp.element.useState(storedVoice.option.id);
  const [videoStyle, setVideoStyle] = window.wp.element.useState(
    connection.videoStyle ?? DEFAULT_VIDEO_STYLE
  );
  const supportsFeaturedImage = connection.integrationId === "linkedin";
  const supportsNotificationLocale = !isVideo && connection.integrationId !== "linkedin";
  const linkedInMeta = connection.integrationId === "linkedin" ? connection.externalAccountMeta : void 0;
  const availableOrgs = linkedInMeta?.availableOrganizations ?? [];
  const supportsTargetPicker = availableOrgs.length > 0;
  const PERSONAL_TARGET = "personal";
  const canPostPersonal = Boolean(linkedInMeta?.personUrn);
  const [postingTarget, setPostingTarget] = window.wp.element.useState(
    linkedInMeta?.organizationUrn || (canPostPersonal ? PERSONAL_TARGET : availableOrgs[0]?.organizationUrn ?? PERSONAL_TARGET)
  );
  const { updateSettings, isSaving } = useChannelConnectionMutations();
  const handleSave = async () => {
    if (!connection.connectionId) return;
    try {
      await updateSettings({
        connection_id: connection.connectionId,
        // Video isn't a notifier — it never renders the locale select, so
        // sending the untouched default would be noise on the wire (and
        // the cloud ignores it anyway). Omission = "leave untouched" per
        // the settings endpoint contract.
        ...isVideo ? {} : { notification_locale: notificationLocale },
        // Pass the bindings array verbatim — including an empty list
        // (which the cloud normalizes back to `null` = unbound). The
        // settings endpoint treats `undefined` as "leave untouched" and
        // `null` / `[]` as "clear binding," so being explicit here makes
        // the wire intent unambiguous.
        bound_campaign_ids: boundCampaignIds,
        post_cadence_n: postCadenceN,
        // Voice rides the wire ONLY for video connections — always the
        // canonical `provider:id` (the picker resolves legacy persona
        // values on open, and the cloud canonicalizes too); the cloud
        // validates the id against its own catalog. Style is only sent
        // while an older cloud still owns it per-connection — once the
        // boundVisualPreset digest arrives, styling lives on the visual
        // preset and this dialog stops writing it (handoff §3).
        ...isVideo ? {
          video_voice: videoVoice,
          ...presetOwnsStyle ? {} : { video_style: videoStyle }
        } : {},
        // Only forward the toggle for integrations that actually
        // use it. Omitting on others keeps the wire shape unchanged
        // for Slack/Discord/IndexNow/webhook-ping connections.
        ...supportsFeaturedImage ? { attach_featured_image: attachFeaturedImage } : {},
        // LinkedIn posting target — only forward when the picker is shown
        // (i.e. the connection can post to a Page). The cloud reads the
        // "personal" sentinel as "post to the personal profile" and any other
        // value as an org URN it validates against the administered Pages.
        ...supportsTargetPicker ? { selected_organization_urn: postingTarget } : {}
      });
      onClose();
    } catch (err) {
      if (err instanceof Error) An.error(err.message);
    }
  };
  const localeOptions = NOTIFICATION_LOCALE_OPTIONS$2.map(
    (opt) => "labelKey" in opt ? { value: opt.value, label: window.wp.i18n.__(opt.labelKey, "structura") } : { value: opt.value, label: opt.label }
  );
  const targetOptions = [
    ...canPostPersonal ? [{ value: PERSONAL_TARGET, label: window.wp.i18n.__("Personal profile", "structura") }] : [],
    ...availableOrgs.map((org) => ({
      value: org.organizationUrn,
      label: org.name || org.organizationUrn
    }))
  ];
  const footerButtons = /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 flex-col-reverse gap-3 sm:flex-row" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: onClose,
      disabled: isSaving
    },
    window.wp.i18n.__("Cancel", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "primary",
      size: "sm",
      onClick: () => {
        void handleSave();
      },
      disabled: isSaving
    },
    isSaving ? window.wp.i18n.__("Saving…", "structura") : window.wp.i18n.__("Save settings", "structura")
  ));
  return /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open, onClose, size: "md" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: onClose,
      "aria-label": window.wp.i18n.__("Close", "structura"),
      className: "absolute top-4 right-4 inline-flex size-8 items-center justify-center rounded-full text-neutral-500 transition-colors hover:bg-neutral-100 hover:text-neutral-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-400 dark:text-neutral-400 dark:hover:bg-neutral-700/60 dark:hover:text-neutral-200"
    },
    /* @__PURE__ */ window.wp.element.createElement(X, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement(Y.Header, null, /* @__PURE__ */ window.wp.element.createElement(Y.Title, null, window.wp.i18n.sprintf(
    /* translators: %s = integration display name, e.g. "LinkedIn". */
    window.wp.i18n.__("Configure %s", "structura"),
    connection.displayName || connection.integrationId
  )), /* @__PURE__ */ window.wp.element.createElement(Y.Description, null, isVideo ? (
    // Sets the fixed-format expectation up front — there is no
    // aspect-ratio control anywhere in the modal (handoff §2).
    window.wp.i18n.__(
      "Every published post becomes a 30–60 second vertical video (9:16) — ready to upload to YouTube Shorts or TikTok.",
      "structura"
    )
  ) : window.wp.i18n.__(
    "Choose which campaigns this channel posts for and how often you’d like it to share. Changes apply to your next published post.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(Y.Body, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-5" }, isVideo && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(
    VideoVoiceSection,
    {
      value: videoVoice,
      onChange: setVideoVoice,
      legacyPersonaLabel: storedVoice.legacyPersonaLabel,
      legacyResolvedName: storedVoice.option.name,
      videoTts
    }
  ), presetOwnsStyle ? /* @__PURE__ */ window.wp.element.createElement(BoundPresetStyleSummary, { digest: boundVisualPreset ?? null }) : (
    // Back-compat (one release window): the cloud hasn't
    // shipped the boundVisualPreset digest yet, so styling
    // is still a per-connection setting — render today's
    // radio section unchanged.
    /* @__PURE__ */ window.wp.element.createElement(VideoStyleSection, { value: videoStyle, onChange: setVideoStyle })
  )), supportsTargetPicker && /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: postingTarget,
      onValueChange: (val) => setPostingTarget(String(val)),
      options: targetOptions
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Posting target", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(
      Zn.Trigger,
      {
        placeholder: window.wp.i18n.__("Choose where to post…", "structura")
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, targetOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  ), supportsNotificationLocale && /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: notificationLocale,
      onValueChange: (val) => setNotificationLocale(String(val)),
      options: localeOptions
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Notification language", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(
      Zn.Trigger,
      {
        placeholder: window.wp.i18n.__("Choose a language…", "structura")
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, localeOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  ), /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: isVideo ? "space-y-5 border-t border-neutral-200 pt-5 dark:border-neutral-700" : "space-y-5"
    },
    /* @__PURE__ */ window.wp.element.createElement(
      CampaignBindingsPicker,
      {
        value: boundCampaignIds,
        onChange: setBoundCampaignIds
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      CadencePicker,
      {
        value: postCadenceN,
        onChange: setPostCadenceN,
        ...isVideo ? {
          label: window.wp.i18n.__("Render a video every Nth post", "structura"),
          helper: window.wp.i18n.__(
            "Every published post gets a video while your monthly quota lasts.",
            "structura"
          )
        } : {}
      }
    )
  ), supportsFeaturedImage && /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Attach featured image", "structura"),
      description: window.wp.i18n.__(
        "When on, your post's featured image is uploaded alongside the social post. Turn this off to share a text-only update.",
        "structura"
      ),
      checked: attachFeaturedImage,
      onChange: setAttachFeaturedImage
    }
  ))), isVideo && videoQuota ? (
    // Video footer: quota meter left (decision context — "do I have
    // renders left this month?"), actions right. `items-end` keeps
    // the buttons baseline-aligned with the meter's bar; flex-wrap
    // lets the pair stack under German text expansion (<420px).
    /* @__PURE__ */ window.wp.element.createElement(Y.Footer, { className: "flex-wrap items-end sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement(
      qa,
      {
        used: videoQuota.used,
        total: videoQuota.cap,
        label: window.wp.i18n.sprintf(
          /* translators: %1$d = videos used, %2$d = monthly cap. */
          window.wp.i18n.__("%1$d of %2$d videos this month", "structura"),
          videoQuota.used,
          videoQuota.cap
        ),
        barClassName: "w-44"
      }
    ), footerButtons)
  ) : /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, footerButtons)));
};
function useVoicePreview() {
  const [playingVoiceId, setPlayingVoiceId] = window.wp.element.useState(null);
  const audioRef = window.wp.element.useRef(null);
  const stop = () => {
    const audio = audioRef.current;
    audioRef.current = null;
    setPlayingVoiceId(null);
    if (audio) {
      try {
        audio.pause();
      } catch {
      }
    }
  };
  window.wp.element.useEffect(() => stop, []);
  const toggle = (voiceId) => {
    if (playingVoiceId === voiceId) {
      stop();
      return;
    }
    stop();
    const audio = new Audio(videoVoiceSampleUrl(voiceId));
    audioRef.current = audio;
    setPlayingVoiceId(voiceId);
    const clear = () => {
      if (audioRef.current === audio) {
        audioRef.current = null;
        setPlayingVoiceId(null);
      }
    };
    audio.onended = clear;
    audio.onerror = clear;
    try {
      const maybePromise = audio.play();
      if (maybePromise && typeof maybePromise.catch === "function") {
        maybePromise.catch(clear);
      }
    } catch {
      clear();
    }
  };
  return { playingVoiceId, toggle };
}
function VoicePreviewButton({
  voiceName,
  playing,
  onToggle
}) {
  return /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      "aria-pressed": playing,
      "aria-label": playing ? window.wp.i18n.__("Stop voice preview", "structura") : window.wp.i18n.sprintf(
        /* translators: %s = voice name, e.g. "Ava". */
        window.wp.i18n.__("Play sample of %s", "structura"),
        voiceName
      ),
      onClick: (event) => {
        event.preventDefault();
        event.stopPropagation();
        onToggle();
      },
      className: playing ? "flex size-7 shrink-0 items-center justify-center rounded-full bg-brand-600 text-white shadow-lg shadow-brand-600/30 transition-all duration-fast ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-400 dark:bg-brand-500" : "flex size-7 shrink-0 items-center justify-center rounded-full border border-neutral-200 bg-white text-neutral-500 shadow-sm transition-all duration-fast ease-out hover:border-brand-300 hover:text-brand-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-400 dark:border-neutral-600 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:text-brand-300"
    },
    playing ? /* @__PURE__ */ window.wp.element.createElement(Square, { size: 11, className: "fill-current", "aria-hidden": true }) : /* @__PURE__ */ window.wp.element.createElement(Play, { size: 11, className: "ml-px fill-current", "aria-hidden": true })
  );
}
function VoiceWaveform() {
  return /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1 inline-flex items-end gap-[2px]", "aria-hidden": "true" }, [7, 12, 9, 13].map((height, i2) => /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      key: i2,
      className: "w-[3px] animate-pulse rounded-full bg-brand-500 motion-reduce:animate-none dark:bg-brand-400",
      style: { height: `${height}px`, animationDelay: `${i2 * 0.12}s` }
    }
  )));
}
const VIDEO_TTS_PROVIDER_LABELS = {
  openai: "OpenAI",
  gemini: "Gemini"
};
const AI_KEYS_ROUTE = "/ai-engine";
function VideoVoiceSection({
  value,
  onChange,
  legacyPersonaLabel,
  legacyResolvedName,
  videoTts
}) {
  const { playingVoiceId, toggle } = useVoicePreview();
  const selected = resolveStoredVideoVoice(value).option;
  const providerUnlocked = (provider) => videoTts === void 0 || videoTts.managed || videoTts.providers[provider];
  const fullyBlocked = !providerUnlocked("openai") && !providerUnlocked("gemini");
  const overline = /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-2 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Voice", "structura"));
  const helper = /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Voiceover and captions follow each post’s language.", "structura"));
  if (fullyBlocked) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, overline, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3 rounded-xl border border-dashed border-neutral-300 px-3.5 py-3 dark:border-neutral-600" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-neutral-100 text-neutral-400 dark:bg-white/[.06] dark:text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement(KeyRound, { size: 16, "aria-hidden": true })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Voiceover needs an AI key", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-0.5! text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.sprintf(
      /* translators: %d = total number of available voices. "OpenAI" / "Gemini" are product names — do not translate them. */
      window.wp.i18n.__(
        "Videos are narrated with OpenAI or Gemini text-to-speech. Connect either key to choose from %d voices — video rendering stays paused until then.",
        "structura"
      ),
      VIDEO_VOICE_CATALOG.length
    ))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: AI_KEYS_ROUTE }, window.wp.i18n.__("Connect an AI key", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 13, className: "ml-1", "aria-hidden": true })))), helper);
  }
  const groups = ["openai", "gemini"].map(
    (provider) => {
      const voices = VIDEO_VOICE_CATALOG.filter((v2) => v2.provider === provider);
      const unlocked = providerUnlocked(provider);
      return {
        id: provider,
        label: VIDEO_TTS_PROVIDER_LABELS[provider],
        options: voices.map((voice) => ({
          id: voice.id,
          label: voice.name,
          // Descriptors are tone words — untranslated by the same rule as
          // the voice names (see @structura/types videoVoices.ts).
          description: voice.descriptor,
          ...voice.id === DEFAULT_VIDEO_VOICE ? { badge: window.wp.i18n.__("Default", "structura") } : {},
          trailing: /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, playingVoiceId === voice.id && /* @__PURE__ */ window.wp.element.createElement(VoiceWaveform, null), /* @__PURE__ */ window.wp.element.createElement(
            VoicePreviewButton,
            {
              voiceName: voice.name,
              playing: playingVoiceId === voice.id,
              onToggle: () => toggle(voice.id)
            }
          ))
        })),
        // Locked group: header (lock icon + full count) + teaser row
        // instead of options — never hidden (discovery), never selectable.
        ...unlocked ? {} : {
          gate: {
            text: window.wp.i18n.sprintf(
              /* translators: %1$s = TTS provider name ("OpenAI" / "Gemini" — do not translate), %2$d = number of voices it unlocks. */
              window.wp.i18n.__(
                "Connect a %1$s API key to unlock %2$d more voices.",
                "structura"
              ),
              VIDEO_TTS_PROVIDER_LABELS[provider],
              voices.length
            ),
            cta: {
              label: window.wp.i18n.__("Open AI keys", "structura"),
              // Plain href (the SPA is hash-routed) — the Combobox
              // gate CTA is an anchor, not a router Link.
              href: `#${AI_KEYS_ROUTE}`
            }
          }
        }
      };
    }
  );
  const unlockedCount = groups.reduce(
    (n2, group) => n2 + (group.gate ? 0 : group.options.length),
    0
  );
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, overline, /* @__PURE__ */ window.wp.element.createElement(
    qn,
    {
      value: selected.id,
      onChange,
      groups,
      placeholder: window.wp.i18n.sprintf(
        /* translators: %d = number of selectable voices. */
        window.wp.i18n.__("Search %d voices…", "structura"),
        unlockedCount
      ),
      footnote: window.wp.i18n.__(
        "Samples are English; videos follow your post language.",
        "structura"
      ),
      noMatchesLabel: (query) => window.wp.i18n.sprintf(
        /* translators: %s = the search text that matched no voices. */
        window.wp.i18n.__("No voices match “%s”", "structura"),
        query
      ),
      clearSearchLabel: window.wp.i18n.__("Clear search", "structura"),
      searchCountLabel: (matched, total) => window.wp.i18n.sprintf(
        /* translators: group-header count while searching. %1$d = matching voices, %2$d = total voices in the group. */
        window.wp.i18n.__("%1$d of %2$d", "structura"),
        matched,
        total
      ),
      leadingAdornment: /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded-md bg-neutral-100 px-1.5 py-0.5 text-[10px] font-bold text-neutral-500 dark:bg-white/10 dark:text-neutral-400" }, VIDEO_TTS_PROVIDER_LABELS[selected.provider]),
      trailingAdornment: /* @__PURE__ */ window.wp.element.createElement(
        VoicePreviewButton,
        {
          voiceName: selected.name,
          playing: playingVoiceId === selected.id,
          onToggle: () => toggle(selected.id)
        }
      ),
      onOptionAction: toggle
    }
  ), legacyPersonaLabel != null && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex items-start gap-1.5 text-xs text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(
    Info,
    {
      size: 13,
      className: "mt-0.5 shrink-0 text-brand-500 dark:text-brand-400",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.sprintf(
    /* translators: %1$s = the retired persona name (e.g. "Ava"), %2$s = the real voice name it maps to (e.g. "Nova"). */
    window.wp.i18n.__(
      "Your voice ‘%1$s’ now appears under its real name, %2$s. It’s the same voice — nothing about your videos changes.",
      "structura"
    ),
    legacyPersonaLabel,
    legacyResolvedName
  ))), helper);
}
function PresetThumb({ presetId }) {
  if (presetId === "bold") {
    return /* @__PURE__ */ window.wp.element.createElement("span", { className: "relative block h-full w-full bg-neutral-950" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "absolute inset-0 bg-gradient-to-b from-neutral-500/20 to-neutral-800/20" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "absolute inset-x-1 bottom-2 text-center" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] leading-none font-black tracking-tight text-amber-300 uppercase" }, "GROWS", /* @__PURE__ */ window.wp.element.createElement("br", null), "3× FASTER")));
  }
  if (presetId === "kinetic") {
    return /* @__PURE__ */ window.wp.element.createElement("span", { className: "relative block h-full w-full bg-gradient-to-b from-neutral-200 to-neutral-300 dark:from-neutral-700 dark:to-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "absolute inset-x-1 bottom-2 flex flex-wrap justify-center gap-[3px]" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded-sm bg-brand-600 px-1 py-0.5 text-[8px] leading-none font-extrabold text-white" }, "3×"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded-sm bg-neutral-950/80 px-1 py-0.5 text-[8px] leading-none font-bold text-white" }, "faster")));
  }
  return /* @__PURE__ */ window.wp.element.createElement("span", { className: "relative block h-full w-full bg-gradient-to-b from-neutral-200 to-neutral-300 dark:from-neutral-700 dark:to-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "absolute inset-x-2 bottom-2 flex justify-center" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded-md bg-white/95 px-1.5 py-1 text-center text-[8px] leading-tight font-semibold text-neutral-900 shadow-sm" }, "grows 3× faster")));
}
function BoundPresetStyleSummary({
  digest
}) {
  const overline = /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-2 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Visual style", "structura"));
  if (digest === null) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, overline, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3 rounded-xl border border-dashed border-neutral-300 px-3.5 py-3 dark:border-neutral-600" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-neutral-100 text-neutral-400 dark:bg-white/[.06] dark:text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement(Palette, { size: 16, "aria-hidden": true })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("No visual preset bound yet", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-0.5! text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "Bind a preset in Visuals to control how this site's videos look.",
      "structura"
    ))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: VISUALS_VIDEO_ROUTE }, window.wp.i18n.__("Open Visuals", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 13, className: "ml-1", "aria-hidden": true })))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Until then, videos render with the stock Clean style.", "structura")));
  }
  const placementLabel = {
    top: window.wp.i18n.__("Captions top", "structura"),
    middle: window.wp.i18n.__("Captions middle", "structura"),
    bottom: window.wp.i18n.__("Captions bottom", "structura")
  }[digest.captionPlacement];
  const meta = [
    videoStyleById(digest.videoStyle).name,
    placementLabel,
    digest.hasPalette ? window.wp.i18n.__("Brand palette", "structura") : null
  ].filter(Boolean).join(" · ");
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, overline, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3 rounded-xl border border-neutral-200 bg-neutral-50/70 px-3.5 py-3 dark:border-neutral-700 dark:bg-neutral-800/40" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300" }, /* @__PURE__ */ window.wp.element.createElement(Palette, { size: 16, "aria-hidden": true })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! truncate text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, digest.label, " ", /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-normal text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("— visual preset", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-0.5! truncate text-xs text-neutral-500 dark:text-neutral-400" }, meta)), /* @__PURE__ */ window.wp.element.createElement(
    Link$2,
    {
      to: VISUALS_VIDEO_ROUTE,
      className: "inline-flex shrink-0 items-center gap-1 text-xs font-bold text-brand-600 hover:text-brand-700 dark:text-brand-400 dark:hover:text-brand-300"
    },
    window.wp.i18n.__("Edit in Visuals", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 13, "aria-hidden": true })
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Video styling follows the visual preset bound to this site.", "structura")));
}
function VideoStyleSection({
  value,
  onChange
}) {
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-2 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Visual style", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Ut,
    {
      "aria-label": window.wp.i18n.__("Visual style", "structura"),
      value,
      onValueChange: onChange
    },
    VIDEO_STYLE_PRESETS.map((preset) => /* @__PURE__ */ window.wp.element.createElement(
      Fa,
      {
        key: preset.id,
        value: preset.id,
        name: preset.name,
        description: preset.descriptor,
        thumbnail: /* @__PURE__ */ window.wp.element.createElement(PresetThumb, { presetId: preset.id })
      }
    ))
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Presets set caption typography and transition feel. Fine-tuning arrives in a later release.",
    "structura"
  )));
}
const siteIndexingStatusKey = ["site", "indexing-status"];
const useSiteIndexingStatusQuery = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: siteIndexingStatusKey,
    queryFn: () => window.wp.apiFetch({
      path: "/structura/v1/site/indexing-status"
    }),
    enabled: hasWorkspace === true,
    // Matches useSettingsQuery — the flag is a site setting, it doesn't
    // need to be refetched on every navigation.
    staleTime: 1e3 * 60 * 5
  });
};
const DOCS_BASE = "https://docs.structurawp.com";
const DOCS_LOCALE = "en";
function docsUrl(slug = "") {
  const path = slug.replace(/^\/+/, "");
  return path ? `${DOCS_BASE}/${DOCS_LOCALE}/${path}` : `${DOCS_BASE}/${DOCS_LOCALE}`;
}
const CREDENTIAL_FIELDS = {
  // IndexNow needs no credentials — the integration fires an auth-less HTTP
  // ping. The user only picks a display name + notification locale.
  indexnow: [],
  // Video renders happen entirely cloud-side — nothing to authenticate.
  // Install just creates the connection with the cloud defaults (voice
  // Ava, style Clean); the post-install configure hand-off (InstallModal)
  // opens the settings modal where voice/style/cadence live.
  video: [],
  "email-owner": [
    {
      key: "recipientEmail",
      label: window.wp.i18n.__("Recipient email", "structura"),
      placeholder: "you@example.com",
      type: "email",
      help: window.wp.i18n.__("The email address that receives publish notifications.", "structura")
    }
  ],
  telegram: [
    {
      key: "botToken",
      label: window.wp.i18n.__("Bot token", "structura"),
      placeholder: "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
      type: "password",
      help: window.wp.i18n.sprintf(
        // translators: %s is the BotFather username
        window.wp.i18n.__("Create a bot via %s on Telegram to get this token.", "structura"),
        "@BotFather"
      )
    },
    {
      key: "chatId",
      label: window.wp.i18n.__("Chat ID", "structura"),
      placeholder: "-1001234567890",
      type: "text",
      help: window.wp.i18n.__(
        "Numeric chat/group ID, or @channel username. Use @userinfobot to find yours.",
        "structura"
      )
    }
  ],
  whatsapp: [
    {
      key: "phoneNumberId",
      label: window.wp.i18n.__("Phone number ID", "structura"),
      placeholder: "1234567890123456",
      type: "text",
      help: window.wp.i18n.__(
        "From your WhatsApp Business Platform dashboard (API Setup page).",
        "structura"
      )
    },
    {
      key: "accessToken",
      label: window.wp.i18n.__("Access token", "structura"),
      placeholder: "EAABsbCS1iZA8BO…",
      type: "password",
      help: window.wp.i18n.__(
        "A permanent or temporary access token from Meta for Developers.",
        "structura"
      )
    },
    {
      key: "recipientPhone",
      label: window.wp.i18n.__("Recipient phone", "structura"),
      placeholder: "+14155238886",
      type: "text",
      help: window.wp.i18n.__(
        "The phone number to receive notifications, in E.164 format (e.g. +14155238886).",
        "structura"
      )
    }
  ]
};
const NOTIFICATION_LOCALE_OPTIONS$1 = [
  { value: "system", labelKey: "System language" },
  { value: "en", label: "English" },
  { value: "de", label: "Deutsch" },
  { value: "es", label: "Español" },
  { value: "fr", label: "Français" }
];
const AddCredentialForm = ({
  entry,
  editingConnection,
  onSuccess,
  onCancel
}) => {
  const isEdit = Boolean(editingConnection);
  const fields = CREDENTIAL_FIELDS[entry.id] ?? [];
  const isVideo = entry.id === "video";
  const emptyCredentials = () => Object.fromEntries(fields.map((f2) => [f2.key, ""]));
  const [credentials, setCredentials] = window.wp.element.useState(
    emptyCredentials
  );
  const [displayName, setDisplayName] = window.wp.element.useState(
    editingConnection?.displayName ?? ""
  );
  const [notificationLocale, setNotificationLocale] = window.wp.element.useState(
    editingConnection?.notificationLocale ?? "system"
  );
  const [boundCampaignIds, setBoundCampaignIds] = window.wp.element.useState(
    editingConnection?.boundCampaignIds ?? null
  );
  const [postCadenceN, setPostCadenceN] = window.wp.element.useState(
    editingConnection?.postCadenceN ?? 1
  );
  const { saveCredential, isSaving, saveError } = useChannelConnectionMutations();
  const isIndexNow = entry.id === "indexnow";
  const indexnow = useIndexNowKey(isIndexNow);
  const notificationLocaleOptions = window.wp.element.useMemo(
    () => NOTIFICATION_LOCALE_OPTIONS$1.map(
      (opt) => "labelKey" in opt ? { value: opt.value, label: window.wp.i18n.__(opt.labelKey, "structura") } : { value: opt.value, label: opt.label }
    ),
    []
  );
  const allFilled = fields.every(
    (f2) => (credentials[f2.key] ?? "").trim() !== ""
  );
  const setField = (key, value) => setCredentials((prev) => ({ ...prev, [key]: value }));
  const handleSubmit = async (event) => {
    event.preventDefault();
    if (!allFilled) return;
    if (isIndexNow && !indexnow.data) return;
    const trimmed = {};
    for (const f2 of fields) {
      trimmed[f2.key] = (credentials[f2.key] ?? "").trim();
    }
    if (isIndexNow && indexnow.data) {
      trimmed.key = indexnow.data.key;
      trimmed.keyLocation = indexnow.data.keyLocation;
    }
    try {
      const result = await saveCredential({
        integration_id: entry.id,
        connection_id: editingConnection?.connectionId,
        credentials: trimmed,
        display_name: displayName.trim() || void 0,
        // Video hides the locale select entirely — omit the field so the
        // wire shape carries only what the user could actually choose.
        ...isVideo ? {} : { notification_locale: notificationLocale },
        // See AddWebhookForm — `null` is the "all campaigns" wire default;
        // an explicit empty array round-trips safely because the cloud
        // normalizes it back to `null`.
        bound_campaign_ids: boundCampaignIds,
        post_cadence_n: postCadenceN
      });
      if (!isEdit) {
        setCredentials(emptyCredentials());
        setDisplayName("");
        setNotificationLocale("system");
        setBoundCampaignIds(null);
        setPostCadenceN(1);
      }
      onSuccess?.(result?.connection);
    } catch {
    }
  };
  const renderIndexNowSetup = () => {
    if (!isIndexNow) return null;
    if (indexnow.isLoading) {
      return /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-dashed border-neutral-300 p-4 text-xs text-neutral-500 dark:border-neutral-700 dark:text-neutral-400" }, window.wp.i18n.__("Preparing your IndexNow keyfile…", "structura"));
    }
    if (!indexnow.data) return null;
    const { key, keyLocation, isHeadless } = indexnow.data;
    const fileName = `${key}.txt`;
    const handleDownload = () => {
      const dataUrl = `data:text/plain;charset=utf-8,${encodeURIComponent(key)}`;
      const a3 = document.createElement("a");
      a3.href = dataUrl;
      a3.download = fileName;
      document.body.appendChild(a3);
      a3.click();
      document.body.removeChild(a3);
    };
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3 rounded-xl border border-neutral-300 bg-neutral-50 p-4 dark:border-neutral-700 dark:bg-neutral-900/40" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-semibold tracking-wider text-neutral-700 uppercase dark:text-neutral-300" }, window.wp.i18n.__("Keyfile setup", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-700 dark:text-neutral-300" }, isHeadless ? window.wp.i18n.__(
      "IndexNow needs a verification file at the URL below. Download it and upload it to the root of your public website.",
      "structura"
    ) : window.wp.i18n.__(
      "Structura serves the IndexNow verification file automatically — no upload needed. The URL below is what the IndexNow aggregator will check.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-lg border border-neutral-200 bg-white p-3 font-mono text-xs break-all dark:border-neutral-800 dark:bg-neutral-900" }, keyLocation), isHeadless && /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        type: "button",
        variant: "secondary",
        size: "sm",
        onClick: handleDownload
      },
      /* @__PURE__ */ window.wp.element.createElement(Download, { className: "mr-1.5 h-4 w-4" }),
      window.wp.i18n.sprintf(
        // translators: %s is the keyfile filename, e.g. "abc123.txt"
        window.wp.i18n.__("Download %s", "structura"),
        fileName
      )
    ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "After connecting, you can run “Verify” on the connection row to check that IndexNow can reach your keyfile.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: docsUrl("channels/indexnow"),
        target: "_blank",
        rel: "noopener noreferrer",
        className: "inline-flex items-center gap-1 text-xs text-neutral-500 underline-offset-2 hover:text-neutral-700 hover:underline dark:text-neutral-400 dark:hover:text-neutral-200"
      },
      window.wp.i18n.__("Read the IndexNow guide", "structura"),
      /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3 w-3" })
    ));
  };
  return /* @__PURE__ */ window.wp.element.createElement("form", { onSubmit: handleSubmit, className: "space-y-4" }, renderIndexNowSetup(), fields.map((field, idx) => /* @__PURE__ */ window.wp.element.createElement("div", { key: field.key, className: "space-y-1" }, isEdit && field.type === "password" && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-900 dark:bg-amber-900/30 dark:text-amber-200" }, window.wp.i18n.__(
    "Paste the value again to save changes — we never display saved secrets for security.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: field.label,
      placeholder: field.placeholder,
      value: credentials[field.key] ?? "",
      onChange: (e2) => setField(field.key, e2.target.value),
      type: field.type ?? "text",
      required: true
    }
  ), field.help && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, field.help))), saveError && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-red-600 dark:text-red-400" }, saveError), /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Display name (optional)", "structura"),
      placeholder: entry.name,
      value: displayName,
      onChange: (e2) => setDisplayName(e2.target.value)
    }
  ), !isVideo && /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: notificationLocale,
      onValueChange: (val) => setNotificationLocale(String(val)),
      options: notificationLocaleOptions
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Notification language", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(
      Zn.Trigger,
      {
        placeholder: window.wp.i18n.__("Choose a language…", "structura")
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, notificationLocaleOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  ), /* @__PURE__ */ window.wp.element.createElement(
    CampaignBindingsPicker,
    {
      value: boundCampaignIds,
      onChange: setBoundCampaignIds
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    CadencePicker,
    {
      value: postCadenceN,
      onChange: setPostCadenceN,
      ...isVideo ? {
        label: window.wp.i18n.__("Render a video every Nth post", "structura"),
        helper: window.wp.i18n.__(
          "Every published post gets a video while your monthly quota lasts.",
          "structura"
        )
      } : {}
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-end gap-2" }, onCancel && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      type: "button",
      variant: "secondary",
      onClick: onCancel,
      disabled: isSaving
    },
    window.wp.i18n.__("Cancel", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      type: "submit",
      loading: isSaving,
      disabled: !allFilled || isIndexNow && !indexnow.data
    },
    isEdit ? /* @__PURE__ */ window.wp.element.createElement(Save, { size: 14 }) : /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 14 }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1" }, isEdit ? window.wp.i18n.__("Save changes", "structura") : window.wp.i18n.__("Connect channel", "structura"))
  )));
};
const DEFAULT_INTEGRATIONS = [
  {
    id: "slack-webhook",
    label: "Slack",
    webhookUrlPlaceholder: "https://hooks.slack.com/services/…",
    displayNamePlaceholder: "#deploys"
  },
  {
    id: "discord-webhook",
    label: "Discord",
    webhookUrlPlaceholder: "https://discord.com/api/webhooks/…",
    displayNamePlaceholder: "#general"
  },
  {
    id: "webhook-ping",
    label: "Webhook",
    // Generic consumer — any HTTPS endpoint. The placeholder shows a
    // revalidator-style path because that's the canonical first use case
    // (Next.js / Astro headless frontends calling back into WP for fresh
    // content); users with a different consumer will replace the whole URL.
    webhookUrlPlaceholder: "https://example.com/api/revalidate",
    displayNamePlaceholder: "Next.js revalidator",
    requireSigningSecret: true
  }
];
function generateSigningSecret() {
  const bytes = new Uint8Array(32);
  crypto.getRandomValues(bytes);
  return Array.from(bytes, (b2) => b2.toString(16).padStart(2, "0")).join("");
}
const NOTIFICATION_LOCALE_OPTIONS = [
  // `__()`ing only the System label keeps "English / Deutsch / Español /
  // Français" in their native form; the System entry follows the WP admin
  // language because that's what a single-site user actually reads the list
  // in.
  { value: "system", labelKey: "System language" },
  { value: "en", label: "English" },
  { value: "de", label: "Deutsch" },
  { value: "es", label: "Español" },
  { value: "fr", label: "Français" }
];
const AddWebhookForm = ({
  availableIntegrations = DEFAULT_INTEGRATIONS,
  variant = "standalone",
  onSuccess,
  onCancel,
  editingConnection
}) => {
  const isEdit = Boolean(editingConnection);
  const [integrationId, setIntegrationId] = window.wp.element.useState(
    editingConnection?.integrationId ?? availableIntegrations[0]?.id ?? ""
  );
  const [webhookUrl, setWebhookUrl] = window.wp.element.useState("");
  const [signingSecret, setSigningSecret] = window.wp.element.useState("");
  const [displayName, setDisplayName] = window.wp.element.useState(
    editingConnection?.displayName ?? ""
  );
  const [notificationLocale, setNotificationLocale] = window.wp.element.useState(
    editingConnection?.notificationLocale ?? "system"
  );
  const [boundCampaignIds, setBoundCampaignIds] = window.wp.element.useState(
    editingConnection?.boundCampaignIds ?? null
  );
  const [postCadenceN, setPostCadenceN] = window.wp.element.useState(
    editingConnection?.postCadenceN ?? 1
  );
  const { saveWebhook, isSaving, saveError } = useChannelConnectionMutations();
  const selectOptions = window.wp.element.useMemo(
    () => availableIntegrations.map((opt) => ({ value: opt.id, label: opt.label })),
    [availableIntegrations]
  );
  const notificationLocaleOptions = window.wp.element.useMemo(
    () => NOTIFICATION_LOCALE_OPTIONS.map(
      (opt) => "labelKey" in opt ? { value: opt.value, label: window.wp.i18n.__(opt.labelKey, "structura") } : { value: opt.value, label: opt.label }
    ),
    []
  );
  const showIntegrationSelect = availableIntegrations.length > 1;
  const selectedOption = availableIntegrations.find((opt) => opt.id === integrationId);
  const webhookUrlPlaceholder = selectedOption?.webhookUrlPlaceholder ?? "https://hooks.example.com/…";
  const displayNamePlaceholder = selectedOption?.displayNamePlaceholder ?? window.wp.i18n.__("#general", "structura");
  const requiresSigningSecret = Boolean(selectedOption?.requireSigningSecret);
  const handleSubmit = async (event) => {
    event.preventDefault();
    if (!integrationId || !webhookUrl) return;
    const trimmedSecret = signingSecret.trim();
    if (requiresSigningSecret) {
      if (!isEdit && trimmedSecret.length < 16) return;
      if (isEdit && trimmedSecret !== "" && trimmedSecret.length < 16) return;
    }
    try {
      await saveWebhook({
        integration_id: integrationId,
        // When editing, pass the existing UUID through so the cloud updates
        // in place rather than minting a sibling doc. On fresh install we
        // omit this and the cloud mints a new UUID.
        connection_id: editingConnection?.connectionId,
        webhook_url: webhookUrl.trim(),
        // Only attach the secret when the integration declares it AND the
        // user actually supplied one. In edit mode an empty string means
        // "keep existing" — we send `undefined` so the cloud's preserve path
        // kicks in rather than submitting a would-be-rejected empty value.
        // Slack/Discord never forward the field either way.
        signing_secret: requiresSigningSecret && trimmedSecret !== "" ? trimmedSecret : void 0,
        display_name: displayName.trim() || void 0,
        // Always post the locale — the cloud normalizes unknown/empty to
        // "system" so sending it unconditionally keeps the wire payload
        // explicit about user intent.
        notification_locale: notificationLocale,
        // Bindings: `null` = "all campaigns" (the default). An explicit empty
        // array means the user toggled into "Selected only" without ticking
        // anything — cloud normalizes it back to `null`, so either shape is
        // safe, but we pass the array through so the intent is preserved on
        // the wire for dispatcher logs + auditability.
        bound_campaign_ids: boundCampaignIds,
        post_cadence_n: postCadenceN
      });
      if (!isEdit) {
        setWebhookUrl("");
        setSigningSecret("");
        setDisplayName("");
        setNotificationLocale("system");
        setBoundCampaignIds(null);
        setPostCadenceN(1);
      } else {
        setWebhookUrl("");
        setSigningSecret("");
      }
      onSuccess?.();
    } catch {
    }
  };
  const isModal = variant === "modal";
  return /* @__PURE__ */ window.wp.element.createElement(
    "form",
    {
      onSubmit: handleSubmit,
      className: B$1(
        "space-y-4",
        !isModal && "rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm dark:border-neutral-700 dark:bg-neutral-800"
      )
    },
    !isModal && /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Add a webhook channel", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "Paste an incoming-webhook URL from Slack or Discord. Structura will post a notification each time a campaign publishes.",
      "structura"
    ))),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1("grid gap-3", showIntegrationSelect && "sm:grid-cols-2") }, showIntegrationSelect && /* @__PURE__ */ window.wp.element.createElement(
      Zn,
      {
        value: integrationId,
        onValueChange: (val) => setIntegrationId(String(val)),
        options: selectOptions,
        disabled: isEdit
      },
      /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Channel type", "structura")),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Choose an integration…", "structura") }),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, selectOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
    ), /* @__PURE__ */ window.wp.element.createElement(
      he,
      {
        label: window.wp.i18n.__("Display name (optional)", "structura"),
        placeholder: displayNamePlaceholder,
        value: displayName,
        onChange: (event) => setDisplayName(event.target.value)
      }
    )),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, isEdit && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-900 dark:bg-amber-900/30 dark:text-amber-200" }, window.wp.i18n.__(
      "Paste the webhook URL again to save changes — we never display your saved URL for security.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      he,
      {
        label: window.wp.i18n.__("Webhook URL", "structura"),
        placeholder: webhookUrlPlaceholder,
        value: webhookUrl,
        onChange: (event) => setWebhookUrl(event.target.value),
        type: "url",
        required: true,
        error: saveError ?? void 0
      }
    )),
    requiresSigningSecret && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, isEdit && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-900 dark:bg-amber-900/30 dark:text-amber-200" }, window.wp.i18n.__(
      "Leave this blank to keep your current signing secret. Click Generate to rotate — your consumer will need the new value too.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      he,
      {
        label: window.wp.i18n.__("Signing secret", "structura"),
        placeholder: window.wp.i18n.__(
          "64 hex characters — click Generate to mint",
          "structura"
        ),
        value: signingSecret,
        onChange: (event) => setSigningSecret(event.target.value),
        type: "text",
        required: !isEdit
      }
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-2" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "Your consumer verifies each delivery against this secret. At least 16 characters; Generate mints 32 bytes of random.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        type: "button",
        variant: "secondary",
        size: "sm",
        onClick: () => setSigningSecret(generateSigningSecret())
      },
      /* @__PURE__ */ window.wp.element.createElement(RefreshCcw, { size: 14, className: "mr-1" }),
      window.wp.i18n.__("Generate", "structura")
    ))),
    /* @__PURE__ */ window.wp.element.createElement(
      Zn,
      {
        value: notificationLocale,
        onValueChange: (val) => setNotificationLocale(String(val)),
        options: notificationLocaleOptions
      },
      /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Notification language", "structura")),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Choose a language…", "structura") }),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, notificationLocaleOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      CampaignBindingsPicker,
      {
        value: boundCampaignIds,
        onChange: setBoundCampaignIds
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(CadencePicker, { value: postCadenceN, onChange: setPostCadenceN }),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-end gap-2" }, isModal && onCancel && /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        type: "button",
        variant: "secondary",
        onClick: onCancel,
        disabled: isSaving
      },
      window.wp.i18n.__("Cancel", "structura")
    ), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        type: "submit",
        loading: isSaving,
        disabled: !webhookUrl || !integrationId || // Fresh installs must clear the 16-char floor before the button
        // activates. Edit mode allows an empty secret (preserve path) but
        // still gates rotation attempts shorter than 16 chars so the user
        // sees an inert button instead of submitting a would-be-rejected
        // rotation.
        requiresSigningSecret && !isEdit && signingSecret.trim().length < 16 || requiresSigningSecret && isEdit && signingSecret.trim() !== "" && signingSecret.trim().length < 16
      },
      isEdit ? /* @__PURE__ */ window.wp.element.createElement(Save, { size: 14 }) : /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 14 }),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-1" }, isEdit ? window.wp.i18n.__("Save changes", "structura") : window.wp.i18n.__("Connect channel", "structura"))
    ))
  );
};
const InstallModal = ({
  entry,
  open,
  onClose,
  editingConnection
}) => {
  const isEdit = Boolean(editingConnection);
  const title = isEdit ? window.wp.i18n.sprintf(
    // translators: %s is the integration name, e.g. "Edit Slack"
    window.wp.i18n.__("Edit %s", "structura"),
    entry.name
  ) : window.wp.i18n.sprintf(
    // translators: %s is the integration name, e.g. "Install Slack"
    window.wp.i18n.__("Install %s", "structura"),
    entry.name
  );
  return (
    // `size="lg"` (max-w-2xl) reads better than `md` for the install
    // flow — the IndexNow body in particular has a long verification
    // URL + download button + warning + form, and a 448px column
    // makes the modal taller than tall and wraps the URL awkwardly.
    // 672px gives the URL room to breathe in one line. (Yurii
    // feedback 2026-05-01.)
    /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open, onClose, size: "lg" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: onClose,
        "aria-label": window.wp.i18n.__("Close", "structura"),
        className: "absolute top-4 right-4 inline-flex size-8 items-center justify-center rounded-full text-neutral-500 transition-colors hover:bg-neutral-100 hover:text-neutral-700 focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-400 dark:text-neutral-400 dark:hover:bg-neutral-700/60 dark:hover:text-neutral-200"
      },
      /* @__PURE__ */ window.wp.element.createElement(X, { size: 16 })
    ), /* @__PURE__ */ window.wp.element.createElement(Y.Header, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3 pr-8" }, /* @__PURE__ */ window.wp.element.createElement(
      IntegrationIcon,
      {
        integrationId: entry.id,
        iconUrl: entry.iconUrl,
        sizeClassName: "size-10"
      }
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement(Y.Title, null, title), /* @__PURE__ */ window.wp.element.createElement(Y.Description, null, entry.description)))), /* @__PURE__ */ window.wp.element.createElement(Y.Body, null, /* @__PURE__ */ window.wp.element.createElement(
      InstallBody,
      {
        entry,
        onClose,
        editingConnection
      }
    ))))
  );
};
function InstallBody({
  entry,
  onClose,
  editingConnection
}) {
  const navigate = useNavigate();
  const handleCredentialSuccess = (connection) => {
    onClose();
    if (entry.id === "video" && !editingConnection && connection?.connectionId) {
      navigate(
        `/channels/connections?configure=${encodeURIComponent(connection.connectionId)}`
      );
    }
  };
  switch (entry.authType) {
    case "webhook":
      return /* @__PURE__ */ window.wp.element.createElement(
        AddWebhookForm,
        {
          variant: "modal",
          availableIntegrations: [webhookOptionForEntry(entry)],
          editingConnection,
          onSuccess: onClose,
          onCancel: onClose
        }
      );
    case "oauth2":
      return /* @__PURE__ */ window.wp.element.createElement(OAuthConnectPanel, { entry, onClose });
    case "apikey":
    case "none":
      return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4" }, entry.id === "indexnow" && /* @__PURE__ */ window.wp.element.createElement(IndexNowVisibilityWarning, null), /* @__PURE__ */ window.wp.element.createElement(
        AddCredentialForm,
        {
          entry,
          editingConnection,
          onSuccess: handleCredentialSuccess,
          onCancel: onClose
        }
      ));
  }
}
function IndexNowVisibilityWarning() {
  const { data: indexing } = useSiteIndexingStatusQuery();
  const { data: profile } = usePublicSiteProfile();
  if (!indexing || !profile) return null;
  const isHeadless = profile.isHeadless;
  const isDiscouraging = indexing.discourageSearchEngines;
  if (!isHeadless && isDiscouraging) {
    return /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(EyeOff, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("This site is hidden from search engines", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, /* @__PURE__ */ window.wp.element.createElement("p", null, window.wp.i18n.__(
      "WordPress is currently set to discourage search engines from indexing this site, so IndexNow pings will be ignored.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2" }, window.wp.i18n.__(
      "To fix this, go to Settings → Reading and uncheck “Discourage search engines from indexing this site”.",
      "structura"
    ))));
  }
  if (isHeadless && !isDiscouraging) {
    return /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(EyeOff, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__(
      "Your WordPress install is exposed to search engines",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, /* @__PURE__ */ window.wp.element.createElement("p", null, window.wp.i18n.__(
      "You’re running in headless mode, so your public website lives elsewhere — but this WordPress install isn’t currently set to discourage indexing. Search engines may crawl your CMS alongside your public site and split SEO authority between the two.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2" }, window.wp.i18n.__(
      "To fix this, go to Settings → Reading and check “Discourage search engines from indexing this site”.",
      "structura"
    ))));
  }
  return null;
}
function OAuthConnectPanel({
  entry,
  onClose
}) {
  const { initOAuth } = useChannelConnectionMutations();
  const [isConnecting, setIsConnecting] = window.wp.element.useState(false);
  const [error, setError] = window.wp.element.useState(null);
  const supportsCompanyPage = entry.id === "linkedin";
  const [postAsOrg, setPostAsOrg] = window.wp.element.useState(false);
  const isReadOnlySource = entry.id === GSC_INTEGRATION_ID;
  const handleConnect = async () => {
    setIsConnecting(true);
    setError(null);
    try {
      const result = await initOAuth({
        integrationId: entry.id,
        postAsOrg: supportsCompanyPage && postAsOrg
      });
      if (result.authorizeUrl) {
        window.location.href = result.authorizeUrl;
      } else {
        setError(window.wp.i18n.__("Failed to get authorization URL. Please try again.", "structura"));
        setIsConnecting(false);
      }
    } catch (err) {
      const message = err instanceof Error ? err.message : window.wp.i18n.__("Connection failed.", "structura");
      setError(message);
      setIsConnecting(false);
      An.error(message);
    }
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-600 dark:text-neutral-300" }, window.wp.i18n.sprintf(
    // translators: %s is the integration name, e.g. "LinkedIn"
    window.wp.i18n.__(
      "Click the button below to connect your %s account. You’ll be redirected to authorize Structura, then brought back here automatically.",
      "structura"
    ),
    entry.name
  )), isReadOnlySource && /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-600 dark:text-neutral-300" }, window.wp.i18n.__(
    "Access is read-only and free on every plan — Structura only reads your search performance data and never posts or changes anything.",
    "structura"
  )), supportsCompanyPage && // Explicit choice rather than a single opt-in toggle: posting as a
  // Page vs. a personal profile flips which LinkedIn app (and scopes)
  // the OAuth uses, and the old toggle was easy to skip \u2014 leaving users
  // unable to post to their company Page without reconnecting. Mirrors
  // the portal connect dialog.
  /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-2 block text-sm font-medium text-neutral-700 dark:text-neutral-200" }, window.wp.i18n.__("How should Structura post?", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      role: "radiogroup",
      "aria-label": window.wp.i18n.__("Posting target", "structura"),
      className: "space-y-2"
    },
    [
      { org: false, label: window.wp.i18n.__("Your personal profile", "structura") },
      {
        org: true,
        label: window.wp.i18n.__("A company Page you manage", "structura")
      }
    ].map((opt) => {
      const checked = opt.org === postAsOrg;
      return /* @__PURE__ */ window.wp.element.createElement(
        "label",
        {
          key: opt.label,
          className: B$1(
            "flex cursor-pointer items-center gap-3 rounded-xl border px-3 py-2.5 text-sm transition-colors",
            checked ? "border-brand-500 bg-brand-50 text-neutral-900 dark:border-brand-400 dark:bg-brand-950/40 dark:text-neutral-100" : "border-neutral-200 text-neutral-600 hover:border-neutral-300 dark:border-neutral-700 dark:text-neutral-300 dark:hover:border-neutral-600"
          )
        },
        /* @__PURE__ */ window.wp.element.createElement(
          "input",
          {
            type: "radio",
            name: "linkedin-post-as",
            checked,
            onChange: () => setPostAsOrg(opt.org),
            className: "m-0! size-4 shrink-0 appearance-none rounded-full border border-neutral-300 bg-white checked:border-brand-600 checked:bg-brand-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500 focus-visible:ring-offset-1 dark:border-neutral-600 dark:bg-neutral-800 dark:checked:border-brand-500 dark:checked:bg-brand-500"
          }
        ),
        /* @__PURE__ */ window.wp.element.createElement("span", null, opt.label)
      );
    })
  )), error && /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-red-600 dark:text-red-400" }, error), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-2" }, entry.docsUrl ? /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "link",
      size: "sm",
      href: entry.docsUrl,
      target: "_blank",
      rel: "noreferrer"
    },
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Read the docs", "structura")
  ) : /* @__PURE__ */ window.wp.element.createElement("span", null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", onClick: onClose }, window.wp.i18n.__("Cancel", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "primary",
      size: "sm",
      onClick: handleConnect,
      disabled: isConnecting
    },
    isConnecting && /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }),
    window.wp.i18n.sprintf(
      // translators: %s is the integration name, e.g. "LinkedIn"
      window.wp.i18n.__("Connect %s", "structura"),
      entry.name
    )
  ))));
}
function webhookOptionForEntry(entry) {
  if (entry.id === "discord-webhook") {
    return {
      id: entry.id,
      label: entry.name,
      webhookUrlPlaceholder: "https://discord.com/api/webhooks/…",
      displayNamePlaceholder: window.wp.i18n.__("e.g. #general channel", "structura")
    };
  }
  if (entry.id === "slack-webhook") {
    return {
      id: entry.id,
      label: entry.name,
      webhookUrlPlaceholder: "https://hooks.slack.com/services/…",
      displayNamePlaceholder: window.wp.i18n.__("e.g. #deploys channel", "structura")
    };
  }
  if (entry.id === "webhook-ping") {
    return {
      id: entry.id,
      label: entry.name,
      webhookUrlPlaceholder: "https://example.com/api/revalidate",
      displayNamePlaceholder: window.wp.i18n.__("e.g. Next.js revalidator", "structura"),
      requireSigningSecret: true
    };
  }
  return { id: entry.id, label: entry.name };
}
const ChannelsConnectionsPage = () => {
  const {
    data: connections,
    videoQuota,
    boundVisualPreset,
    videoTts,
    isLoading,
    isError,
    error
  } = useChannelConnectionsQuery();
  const { deleteConnection, isDeleting } = useChannelConnectionMutations();
  const { data: catalog } = useChannelCatalogQuery();
  const catalogById = window.wp.element.useMemo(() => {
    const map = /* @__PURE__ */ new Map();
    catalog?.entries.forEach((entry) => map.set(entry.id, entry));
    return map;
  }, [catalog]);
  const [editingState, setEditingState] = window.wp.element.useState(null);
  const [configuringConnection, setConfiguringConnection] = window.wp.element.useState(null);
  const [showVideoGate, setShowVideoGate] = window.wp.element.useState(false);
  const [searchParams, setSearchParams] = useSearchParams();
  const configureParam = searchParams.get("configure");
  window.wp.element.useEffect(() => {
    if (!configureParam || !connections) return;
    const target = connections.find(
      (c2) => c2.connectionId === configureParam
    );
    if (target?.integrationId === VIDEO_INTEGRATION_ID) {
      if (catalog === void 0) return;
      const videoEntry = catalogById.get(VIDEO_INTEGRATION_ID);
      if (videoEntry?.entitlement.blocker === "upgrade_plan") {
        setShowVideoGate(true);
      } else {
        setConfiguringConnection(target);
      }
    } else if (target) {
      setConfiguringConnection(target);
    }
    const next = new URLSearchParams(searchParams);
    next.delete("configure");
    setSearchParams(next, { replace: true });
  }, [
    configureParam,
    connections,
    catalog,
    catalogById,
    searchParams,
    setSearchParams
  ]);
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(ChannelsSubNav, null), /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-xl font-bold tracking-tight text-neutral-900" }, window.wp.i18n.__("Channel Connections", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-sm text-neutral-500" }, window.wp.i18n.__(
    "Your installed integrations. Browse the Store to add more — Structura supports Slack, Discord, LinkedIn, IndexNow, and email notifications.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/store" }, /* @__PURE__ */ window.wp.element.createElement(Store, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Browse Store", "structura")))), showVideoGate && /* @__PURE__ */ window.wp.element.createElement(VideoUpgradeGate, null), !showVideoGate && isLoading && // Three skeleton rows whose layout mirrors ChannelConnectionRow so
  // the real rows slot in without a layout jump when the query lands.
  // Three is a compromise: one feels like a "nothing is happening"
  // stub, five looks busy when the user has two connections. Most
  // activations end up with 1–3 channels.
  /* @__PURE__ */ window.wp.element.createElement(
    "ul",
    {
      className: "m-0! list-none space-y-3 p-0!",
      "aria-label": window.wp.i18n.__("Loading connected channels", "structura"),
      "aria-busy": true
    },
    [0, 1, 2].map((i2) => /* @__PURE__ */ window.wp.element.createElement(
      "li",
      {
        key: i2,
        className: "flex items-start gap-3 rounded-2xl border border-neutral-200 bg-white p-4 shadow-sm dark:border-neutral-700 dark:bg-neutral-800"
      },
      /* @__PURE__ */ window.wp.element.createElement(wa, { className: "mt-0.5 size-9 shrink-0 rounded-xl" }),
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1 space-y-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-4 w-32" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-12" })), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-48" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-40" })),
      /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-7 w-24 rounded-full" })
    ))
  ), !showVideoGate && isError && /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      role: "alert",
      className: "rounded-2xl border border-red-200 bg-red-50 p-4 text-sm text-red-900"
    },
    window.wp.i18n.__("We couldn't load your channel connections.", "structura"),
    error instanceof Error && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-red-700" }, error.message)
  ), !showVideoGate && !isLoading && !isError && (connections?.length ?? 0) === 0 && /* @__PURE__ */ window.wp.element.createElement(
    Ea,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 22 }),
      title: window.wp.i18n.__("No channels connected yet", "structura"),
      description: window.wp.i18n.__(
        "Head to the Store to pick an integration — email, WhatsApp, Slack, Discord, LinkedIn, and more.",
        "structura"
      ),
      action: /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "primary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/store" }, /* @__PURE__ */ window.wp.element.createElement(Store, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Browse Store", "structura")))
    }
  ), !showVideoGate && !isLoading && !isError && (connections?.length ?? 0) > 0 && /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0! list-none space-y-3 p-0!" }, connections.map((connection) => {
    const catalogEntry = catalogById.get(connection.integrationId);
    const canEdit = !!catalogEntry && !!connection.connectionId;
    const isOAuthEdit = catalogEntry?.authType === "oauth2";
    return (
      // Key on connectionId (UUID) when present so two Slack webhooks
      // pointing at different channels render as two rows; fall back
      // to integrationId for legacy 1-per-integration docs that
      // haven't been rewritten yet — their summaries have no UUID
      // but are unique anyway because the old invariant held.
      /* @__PURE__ */ window.wp.element.createElement(
        ChannelConnectionRow,
        {
          key: connection.connectionId ?? connection.integrationId,
          connection,
          catalogEntry,
          videoQuota,
          boundVisualPreset,
          onDelete: (connectionKey) => {
            void deleteConnection(connectionKey).catch(() => {
            });
          },
          onEdit: canEdit ? (conn) => {
            if (isOAuthEdit) {
              setConfiguringConnection(conn);
            } else {
              setEditingState({
                connection: conn,
                entry: catalogEntry
              });
            }
          } : void 0,
          isDeleting
        }
      )
    );
  })), editingState && /* @__PURE__ */ window.wp.element.createElement(
    InstallModal,
    {
      entry: editingState.entry,
      editingConnection: editingState.connection,
      open: true,
      onClose: () => setEditingState(null)
    }
  ), configuringConnection && /* @__PURE__ */ window.wp.element.createElement(
    ConfigureConnectionModal,
    {
      connection: configuringConnection,
      videoQuota,
      boundVisualPreset,
      videoTts,
      open: true,
      onClose: () => setConfiguringConnection(null)
    }
  ));
};
const CATEGORY_PILL_CLASSES = {
  notify: "bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-200",
  email: "bg-blue-100 text-blue-800 dark:bg-blue-900/40 dark:text-blue-200",
  social: "bg-violet-100 text-violet-800 dark:bg-violet-900/40 dark:text-violet-200",
  seo: "bg-emerald-100 text-emerald-800 dark:bg-emerald-900/40 dark:text-emerald-200",
  ads: "bg-rose-100 text-rose-800 dark:bg-rose-900/40 dark:text-rose-200",
  crm: "bg-cyan-100 text-cyan-800 dark:bg-cyan-900/40 dark:text-cyan-200",
  video: "bg-fuchsia-100 text-fuchsia-800 dark:bg-fuchsia-900/40 dark:text-fuchsia-200"
};
const VIDEO_CAPABILITY_CHIPS = () => [
  window.wp.i18n.__("AI voiceover", "structura"),
  window.wp.i18n.__("Animated captions", "structura"),
  window.wp.i18n.__("9:16 vertical", "structura")
];
const CatalogEntryCard = ({ entry }) => {
  const { entitlement } = entry;
  const [installOpen, setInstallOpen] = window.wp.element.useState(false);
  const isVideo = entry.id === VIDEO_INTEGRATION_ID;
  const capabilityChips = entry.capabilities.map(capabilityLabel).filter((label) => label !== null);
  const tierBadge = renderTierBadge(entry);
  const cta = renderCta$1(entry, () => setInstallOpen(true));
  const body = /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    IntegrationIcon,
    {
      integrationId: entry.id,
      iconUrl: entry.iconUrl,
      sizeClassName: "size-10"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm leading-tight font-bold text-neutral-900 dark:text-neutral-100" }, entry.name), /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: B$1(
        "mt-1 inline-block rounded-full px-2 py-0.5 text-[10px] font-semibold tracking-wide uppercase",
        CATEGORY_PILL_CLASSES[entry.category]
      )
    },
    categoryLabel$1(entry.category)
  ))), tierBadge), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! line-clamp-3 text-xs leading-relaxed text-neutral-600 dark:text-neutral-300" }, entry.description), isVideo && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap gap-1.5" }, VIDEO_CAPABILITY_CHIPS().map((label) => /* @__PURE__ */ window.wp.element.createElement(Me, { key: label, size: "sm" }, label))), capabilityChips.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap gap-1.5" }, capabilityChips.map((label) => /* @__PURE__ */ window.wp.element.createElement(Me, { key: label, size: "sm" }, label))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-auto flex items-center justify-between gap-2 pt-2" }, /* @__PURE__ */ window.wp.element.createElement(GatingHint, { entry }), cta), entitlement.canInstall && /* @__PURE__ */ window.wp.element.createElement(
    InstallModal,
    {
      entry,
      open: installOpen,
      onClose: () => setInstallOpen(false)
    }
  ));
  if (isVideo) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        "data-testid": "video-premium-ring",
        className: B$1(
          "rounded-2xl bg-linear-135 from-brand-400 via-brand-600 via-45% to-fuchsia-600 p-px shadow-sm",
          !entitlement.canInstall && "opacity-95"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative flex h-full flex-col gap-4 overflow-hidden rounded-[15px] bg-white p-5 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          "aria-hidden": true,
          className: "pointer-events-none absolute -top-10 left-1/2 h-16 w-3/4 -translate-x-1/2 rounded-full bg-brand-500/15 blur-2xl dark:bg-brand-400/15"
        }
      ), body)
    );
  }
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: B$1("flex flex-col gap-4 p-5", !entitlement.canInstall && "opacity-95") }, body);
};
function renderTierBadge(entry) {
  if (entry.comingSoon) {
    return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "secondary", variant: "solid" }, window.wp.i18n.__("Coming soon", "structura"));
  }
  if (entry.gating.requiredAddon === "channels") {
    return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "indigo", variant: "solid" }, window.wp.i18n.__("Channels", "structura"));
  }
  if (entry.gating.requiredPlan !== "free") {
    return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "premium", variant: "solid" }, window.wp.i18n.__("Pro", "structura"));
  }
  return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success", variant: "solid" }, window.wp.i18n.__("Free", "structura"));
}
function renderCta$1(entry, openInstall) {
  const { entitlement } = entry;
  if (entitlement.canInstall) {
    return /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "primary", size: "sm", onClick: openInstall }, window.wp.i18n.__("Install", "structura"));
  }
  if (entitlement.blocker === "coming_soon") {
    return /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", disabled: true }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Coming soon", "structura"));
  }
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  if (entitlement.blocker === "add_channels") {
    return /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        href: buildMarketingPricingUrl({
          intent: "unlock_channels",
          domain
        }),
        target: "_blank",
        rel: "noreferrer"
      },
      /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 14, className: "mr-1.5" }),
      window.wp.i18n.__("Add Channels", "structura")
    );
  }
  return /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      href: buildMarketingPricingUrl({
        intent: "general_upgrade",
        domain
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Upgrade plan", "structura")
  );
}
function GatingHint({ entry }) {
  const { entitlement, gating } = entry;
  const isVideo = entry.id === VIDEO_INTEGRATION_ID;
  if (entitlement.canInstall) {
    if (isVideo) {
      return /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Includes 40 videos/mo", "structura"));
    }
    return null;
  }
  if (entitlement.blocker === "coming_soon") return null;
  let label;
  if (entitlement.blocker === "upgrade_plan") {
    if (isVideo) {
      label = window.wp.i18n.__("Requires Cloud Pro", "structura");
    } else {
      label = gating.requiredPlan === "byok" ? window.wp.i18n.__("Requires Pro plan", "structura") : window.wp.i18n.__("Requires higher plan", "structura");
    }
  } else {
    label = window.wp.i18n.__("Requires Channels add-on", "structura");
  }
  return /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[11px] text-neutral-500 dark:text-neutral-400" }, label);
}
function categoryLabel$1(c2) {
  switch (c2) {
    case "notify":
      return window.wp.i18n.__("Notifications", "structura");
    case "email":
      return window.wp.i18n.__("Email", "structura");
    case "social":
      return window.wp.i18n.__("Social", "structura");
    case "seo":
      return window.wp.i18n.__("SEO", "structura");
    case "ads":
      return window.wp.i18n.__("Ads", "structura");
    case "crm":
      return window.wp.i18n.__("CRM", "structura");
    case "video":
      return window.wp.i18n.__("Video", "structura");
  }
}
const ChannelsStorePage = () => {
  const { data, isLoading, isError, error } = useChannelCatalogQuery();
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(ChannelsSubNav, null), /* @__PURE__ */ window.wp.element.createElement("header", null, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-xl font-bold tracking-tight text-neutral-900" }, window.wp.i18n.__("Store", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-sm text-neutral-500" }, window.wp.i18n.__(
    "Browse integrations and connect the ones you need. Items available on your current plan show an Install button; the rest link out to upgrade.",
    "structura"
  ))), isLoading && // Six skeleton cards mirror the six-ish catalog entries typical for
  // MVP so the grid doesn't reflow when the real response arrives. Card
  // shape copies CatalogEntryCard: icon + title + pill + three-line
  // description + bottom CTA row.
  /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
      "aria-label": window.wp.i18n.__("Loading the integration catalog", "structura"),
      "aria-busy": true
    },
    [0, 1, 2, 3, 4, 5].map((i2) => /* @__PURE__ */ window.wp.element.createElement(Vt, { key: i2, className: "flex flex-col gap-4 p-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "size-10 shrink-0 rounded-xl" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-4 w-24" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-16 rounded-full" }))), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-5 w-14 rounded-full" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-full" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-11/12" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-2/3" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-auto flex items-center justify-between gap-2 pt-2" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-20" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-8 w-20 rounded-md" }))))
  ), isError && /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      role: "alert",
      className: "rounded-2xl border border-red-200 bg-red-50 p-4 text-sm text-red-900"
    },
    window.wp.i18n.__("We couldn't load the integration catalog.", "structura"),
    error instanceof Error && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-red-700" }, error.message)
  ), !isLoading && !isError && data && data.entries.length === 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center gap-4 rounded-3xl border-2 border-dashed border-neutral-200 bg-neutral-50 px-8 py-16 text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-12 items-center justify-center rounded-2xl bg-brand-100 text-brand-600" }, /* @__PURE__ */ window.wp.element.createElement(Store, { size: 22 })), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-base font-bold tracking-tight text-neutral-900" }, window.wp.i18n.__("The catalog is empty right now", "structura"))), !isLoading && !isError && data && data.entries.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2" }, data.entries.map((entry) => /* @__PURE__ */ window.wp.element.createElement(CatalogEntryCard, { key: entry.id, entry }))));
};
const hasChannelsAccess = (plan, hasChannelsEntitlement) => {
  if (plan !== "byok" && plan !== "cloud" && plan !== "cloud_pro") {
    return false;
  }
  return hasChannelsEntitlement;
};
const useChannelsVisibility = () => {
  const { plan, entitlements, loading } = useLicense();
  if (loading) return false;
  return hasChannelsAccess(plan, Boolean(entitlements?.channels));
};
const resolveChannelsRouteState = (licenseLoading, entitlementsLoading, channelsVisible) => {
  if (licenseLoading || entitlementsLoading) return "pending";
  return channelsVisible ? "mounted" : "redirect";
};
const POLL_INTERVAL_MS = 6e4;
const useNoticesQuery = (options = {}) => {
  const { statuses, limit, cursor } = options;
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: ["notices", { statuses, limit, cursor }],
    enabled: hasUsableLicense === true,
    queryFn: async () => {
      const params = new URLSearchParams();
      if (statuses && statuses.length > 0) {
        params.append("statuses", statuses.join(","));
      }
      if (limit) params.append("limit", String(limit));
      if (cursor) params.append("cursor", cursor);
      const qs = params.toString();
      return window.wp.apiFetch({
        path: `/structura/v1/notices${qs ? `?${qs}` : ""}`
      });
    },
    placeholderData: keepPreviousData,
    staleTime: 3e4,
    refetchInterval: POLL_INTERVAL_MS
  });
};
const buildMutation = (path) => async ({ noticeId }) => {
  return window.wp.apiFetch({
    path,
    method: "POST",
    data: { noticeId }
  });
};
const useAcknowledgeNoticeMutation = () => {
  const qc = useQueryClient();
  return useMutation({
    mutationFn: buildMutation("/structura/v1/notices/acknowledge"),
    onSuccess: () => {
      qc.invalidateQueries({ queryKey: ["notices"] });
    }
  });
};
const useDismissNoticeMutation = () => {
  const qc = useQueryClient();
  return useMutation({
    mutationFn: buildMutation("/structura/v1/notices/dismiss"),
    onSuccess: () => {
      qc.invalidateQueries({ queryKey: ["notices"] });
    }
  });
};
const SEVERITY_INTENT = {
  warning: "warning",
  error: "destructive"
};
function copyDict() {
  return {
    "notices.byok.credentials_missing.title": window.wp.i18n.__("Add a {{provider}} API key", "structura"),
    "notices.byok.credentials_missing.body": window.wp.i18n.__(
      "Structura tried to generate content for you but no {{provider}} API key is connected to this workspace. Add a key in AI Settings and we'll pick up where we left off on the next run.",
      "structura"
    ),
    "notices.byok.credentials_missing.cta": window.wp.i18n.__("Open AI Settings", "structura"),
    "notices.byok.key_rejected.title": window.wp.i18n.__("Your {{provider}} key was rejected", "structura"),
    "notices.byok.key_rejected.body": window.wp.i18n.__(
      "Your {{provider}} API key was refused by the provider. The key may have been revoked, rotated, or its billing is suspended. Update or replace it to resume generation.",
      "structura"
    ),
    "notices.byok.key_rejected.cta": window.wp.i18n.__("Update key", "structura"),
    "notices.quota.managed.title": window.wp.i18n.__("You've reached your generation quota", "structura"),
    "notices.quota.managed.body": window.wp.i18n.__(
      "This site has used all of the included posts and images for this billing cycle. The quota refills at the start of the next cycle, or you can upgrade for a larger allowance now.",
      "structura"
    ),
    "notices.quota.managed.cta": window.wp.i18n.__("Manage plan", "structura"),
    "notices.quota.single_gen_weekly.title": window.wp.i18n.__("Weekly post limit reached", "structura"),
    "notices.quota.single_gen_weekly.body": window.wp.i18n.__(
      "This site has used all {{cap}} of its one-off generated posts for this week. The allowance resets on Monday (UTC) — or upgrade your plan to generate more.",
      "structura"
    ),
    "notices.quota.single_gen_weekly.cta": window.wp.i18n.__("See upgrade options", "structura"),
    "notices.pluginHealth.diagnostics_test.title": window.wp.i18n.__("Test notification delivered", "structura"),
    "notices.pluginHealth.diagnostics_test.body": window.wp.i18n.__(
      "This is the test notice you asked for from Bridge Diagnostics — your site's error-notification pipeline works end to end. You can dismiss it.",
      "structura"
    ),
    "notices.billing.payment_failed.title": window.wp.i18n.__("Your last payment failed", "structura"),
    "notices.billing.payment_failed.body": window.wp.i18n.__(
      "Stripe couldn't charge your card for the most recent invoice. We'll retry automatically, but you can avoid an interruption by updating your payment method now.",
      "structura"
    ),
    "notices.billing.payment_failed.cta": window.wp.i18n.__("Update payment method", "structura"),
    "notices.billing.dunning.title": window.wp.i18n.__("Your subscription is past due", "structura"),
    "notices.billing.dunning.body": window.wp.i18n.__(
      "After several failed payment attempts your subscription has been marked past due. Service may be downgraded soon. Update your payment method to restore your plan.",
      "structura"
    ),
    "notices.billing.dunning.cta": window.wp.i18n.__("Update payment method", "structura"),
    "notices.license.activation_failed.title": window.wp.i18n.__("We couldn't activate your license", "structura"),
    "notices.license.activation_failed.body": window.wp.i18n.__(
      "Structura tried to activate this site against your license but the cloud refused. This usually means the license expired, the seat limit was reached, or the payment status changed.",
      "structura"
    ),
    "notices.license.activation_failed.cta": window.wp.i18n.__("Open account", "structura"),
    "notices.connection.oauth_broken.title": window.wp.i18n.__("{{integrationId}} disconnected", "structura"),
    "notices.connection.oauth_broken.body": window.wp.i18n.__(
      "Structura's connection to {{integrationId}} stopped working — the access token couldn't be refreshed. Reconnect this channel to resume publishing.",
      "structura"
    ),
    "notices.connection.oauth_broken.cta": window.wp.i18n.__("Reconnect", "structura"),
    "notices.connection.webhook_unreachable.title": window.wp.i18n.__("{{integrationId}} webhook unreachable", "structura"),
    "notices.connection.webhook_unreachable.body": window.wp.i18n.__(
      "We couldn't reach the webhook URL configured for {{integrationId}}. The endpoint may be offline, the URL may have changed, or your firewall may be blocking us.",
      "structura"
    ),
    "notices.connection.webhook_unreachable.cta": window.wp.i18n.__("Open channel settings", "structura"),
    "notices.generation.failed.title": window.wp.i18n.__("A post couldn't be generated", "structura"),
    "notices.generation.failed.body": window.wp.i18n.__(
      "Structura hit an error while generating content for this site. We'll automatically try again on the next scheduled run — open your campaigns to review the failed run or start a new one.",
      "structura"
    ),
    "notices.generation.failed.cta": window.wp.i18n.__("View campaigns", "structura"),
    "notices.pluginHealth.compat.title": window.wp.i18n.__("Plugin compatibility check failed", "structura"),
    "notices.pluginHealth.compat.body": window.wp.i18n.__(
      "Diagnostics on this site detected a compatibility issue with another plugin or theme that may affect Structura. Review the diagnostics report and apply the suggested fix.",
      "structura"
    ),
    "notices.pluginHealth.compat.cta": window.wp.i18n.__("Open diagnostics", "structura"),
    "notices.pluginHealth.connectivity.title": window.wp.i18n.__("Structura Cloud can't reach your site", "structura"),
    "notices.pluginHealth.connectivity.body": window.wp.i18n.__(
      "Posts are generated in the cloud and delivered back over a webhook. The last connection check couldn't reach your site, so generated posts have nowhere to land. This usually means a local or staging URL, a private network address, or a firewall blocking incoming requests. Diagnostics has the details and a fix.",
      "structura"
    ),
    "notices.pluginHealth.connectivity.cta": window.wp.i18n.__("Open diagnostics", "structura"),
    "notices.pluginHealth.scheduler.title": window.wp.i18n.__("Scheduler isn't running on time", "structura"),
    "notices.pluginHealth.scheduler.body": window.wp.i18n.__(
      "WordPress cron hasn't fired the scheduler heartbeat recently. Posts and images may be delayed. Diagnostics has the details and a fix.",
      "structura"
    ),
    "notices.pluginHealth.scheduler.cta": window.wp.i18n.__("Open diagnostics", "structura"),
    "notices.pluginHealth.version.title": window.wp.i18n.__("Update Structura", "structura"),
    "notices.pluginHealth.version.body": window.wp.i18n.__(
      "This site is running an older Structura version that's missing fixes the cloud relies on. Update the plugin to keep everything working smoothly.",
      "structura"
    ),
    "notices.pluginHealth.version.cta": window.wp.i18n.__("Open Plugins", "structura"),
    "notices.seoIntel.refreshed.title": window.wp.i18n.__("Fresh keyword opportunities found", "structura"),
    "notices.seoIntel.refreshed.body": window.wp.i18n.__(
      "The monthly keyword refresh for {{campaignName}} surfaced {{newCount}} new opportunities. They've been added to the campaign's keyword bank and will feed upcoming posts.",
      "structura"
    ),
    "notices.seoIntel.refreshed.cta": window.wp.i18n.__("View campaign", "structura"),
    "notices.seoIntel.noKeywords.title": window.wp.i18n.__("Campaign is running without keywords", "structura"),
    "notices.seoIntel.noKeywords.body": window.wp.i18n.__(
      "{{campaignName}} has an empty keyword bank — new posts fall back to a generic topic instead of a targeted keyphrase. This usually happens after changing the campaign language. Re-run keyword discovery to fix it.",
      "structura"
    ),
    "notices.seoIntel.noKeywords.cta": window.wp.i18n.__("Re-discover keywords", "structura"),
    "notices.seoIntel.bankExhausted.title": window.wp.i18n.__(
      "Campaign has covered every keyword",
      "structura"
    ),
    "notices.seoIntel.bankExhausted.body": window.wp.i18n.__(
      "{{campaignName}} has already published a post for every keyword in its bank, so scheduled posts are paused rather than repeating a topic. Add or re-discover keywords to start it up again.",
      "structura"
    ),
    "notices.seoIntel.bankExhausted.cta": window.wp.i18n.__("Add keywords", "structura"),
    "notices.seoIntel.bankRefreshed.title": window.wp.i18n.__(
      "We added new keywords to your campaign",
      "structura"
    ),
    "notices.seoIntel.bankRefreshed.body": window.wp.i18n.__(
      "{{campaignName}} was running low on fresh topics, so we researched its niche and added {{newCount}} new keywords to its keyword bank. Upcoming posts will use them.",
      "structura"
    ),
    "notices.seoIntel.bankRefreshed.cta": window.wp.i18n.__("Review keywords", "structura"),
    "notices.seoIntel.duplicateTopicSkipped.title": window.wp.i18n.__(
      "We skipped a duplicate post",
      "structura"
    ),
    "notices.seoIntel.duplicateTopicSkipped.body": window.wp.i18n.__(
      "A scheduled post for {{campaignName}} would have used the web address “{{slug}}”, which you already publish under — so we stopped it instead of putting two near-identical pages in competition. Add or re-discover keywords so the next post covers something new.",
      "structura"
    ),
    "notices.seoIntel.duplicateTopicSkipped.cta": window.wp.i18n.__("Add keywords", "structura"),
    "notices.seoIntel.budgetSoftLimit.title": window.wp.i18n.__("Search data budget almost used up", "structura"),
    "notices.seoIntel.budgetSoftLimit.body": window.wp.i18n.__(
      "This workspace has used 80% of its monthly search-data allowance. Keyword refreshes keep running until the cap is reached, then pause until next month.",
      "structura"
    ),
    "notices.seoIntel.budgetSoftLimit.cta": window.wp.i18n.__("Learn more", "structura"),
    "notices.seoIntel.budgetHardLimit.title": window.wp.i18n.__("Search data paused until next month", "structura"),
    "notices.seoIntel.budgetHardLimit.body": window.wp.i18n.__(
      "This workspace has used its full monthly search-data allowance. Keyword refreshes continue with AI-only discovery, and enriched search data resumes at the start of next month.",
      "structura"
    ),
    "notices.seoIntel.budgetHardLimit.cta": window.wp.i18n.__("Learn more", "structura")
  };
}
function interpolate(template, params) {
  if (!params) return template;
  return template.replace(
    /\{\{(\w+)\}\}/g,
    (m3, name) => Object.prototype.hasOwnProperty.call(params, name) ? params[name] : m3
  );
}
function resolveCopy(key, params) {
  const tpl = copyDict()[key] ?? key;
  return interpolate(tpl, params);
}
function categoryLabel(category) {
  switch (category) {
    case "billing":
      return window.wp.i18n.__("Billing", "structura");
    case "license":
      return window.wp.i18n.__("License", "structura");
    case "connection":
      return window.wp.i18n.__("Connection", "structura");
    case "quota":
      return window.wp.i18n.__("Quota", "structura");
    case "byok":
      return window.wp.i18n.__("AI key", "structura");
    case "generation":
      return window.wp.i18n.__("Generation", "structura");
    case "plugin-health":
      return window.wp.i18n.__("Plugin health", "structura");
    case "seo-intel":
      return window.wp.i18n.__("SEO intelligence", "structura");
  }
}
function resolveCta(cta) {
  if (!cta) return null;
  const href = cta.href;
  switch (href.kind) {
    case "wp-admin":
      return { href: hashFromWpAdminRoute(href.route), external: false };
    case "both":
      return { href: hashFromWpAdminRoute(href.wpAdmin), external: false };
    case "portal":
      return { href: `https://app.structurawp.com${href.route}`, external: true };
    case "external":
      return { href: href.url, external: true };
  }
}
function hashFromWpAdminRoute(route) {
  const idx = route.indexOf("#");
  if (idx >= 0) return `#${route.slice(idx + 1)}`;
  return route;
}
function formatRelative(ts) {
  const deltaMs = Date.now() - ts;
  const minutes = Math.floor(deltaMs / 6e4);
  if (minutes < 1) return window.wp.i18n.__("just now", "structura");
  if (minutes < 60) return window.wp.i18n.sprintf(window.wp.i18n.__("%dm ago", "structura"), minutes);
  const hours = Math.floor(minutes / 60);
  if (hours < 24) return window.wp.i18n.sprintf(window.wp.i18n.__("%dh ago", "structura"), hours);
  const days = Math.floor(hours / 24);
  return window.wp.i18n.sprintf(window.wp.i18n.__("%dd ago", "structura"), days);
}
const Notices = () => {
  const { data, isLoading, isFetching } = useNoticesQuery();
  const acknowledge = useAcknowledgeNoticeMutation();
  const dismiss = useDismissNoticeMutation();
  const sorted = window.wp.element.useMemo(() => {
    if (!data?.notices) return [];
    return [...data.notices].sort((a3, b2) => {
      if (a3.status !== b2.status) return a3.status === "open" ? -1 : 1;
      return b2.lastSeenAt - a3.lastSeenAt;
    });
  }, [data]);
  return /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Notices", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__(
    "Account, billing, and connection issues that need your attention.",
    "structura"
  )), isLoading ? /* @__PURE__ */ window.wp.element.createElement(Fn, null) : sorted.length === 0 ? /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "mt-6 p-6 text-center" }, /* @__PURE__ */ window.wp.element.createElement(CircleCheckBig, { className: "mx-auto h-8 w-8 text-emerald-500", "aria-hidden": true }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-3 text-base font-semibold" }, window.wp.i18n.__("All clear.", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 text-sm text-zinc-500" }, isFetching ? window.wp.i18n.__("Refreshing…", "structura") : window.wp.i18n.__("No active notices for this workspace right now.", "structura"))) : /* @__PURE__ */ window.wp.element.createElement("ul", { className: "mt-6 space-y-3" }, sorted.map((notice) => {
    const cta = resolveCta(notice.cta);
    const isPending = acknowledge.isPending && acknowledge.variables?.noticeId === notice.noticeId || dismiss.isPending && dismiss.variables?.noticeId === notice.noticeId;
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { key: notice.noticeId, className: "p-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-2 flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: SEVERITY_INTENT[notice.severity] }, categoryLabel(notice.category)), notice.status === "acknowledged" ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "default" }, window.wp.i18n.__("Acknowledged", "structura")) : null), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "text-base font-semibold" }, resolveCopy(notice.titleKey, notice.bodyParams)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 text-sm text-zinc-600 dark:text-zinc-300" }, resolveCopy(notice.bodyKey, notice.bodyParams)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2 text-xs text-zinc-500" }, window.wp.i18n.sprintf(
      // translators: %1$s is a localized "Xm ago" / "Xh ago"
      // / "Xd ago" string; %2$d is the integer count of times
      // the notice has been re-upserted (occurrences).
      window.wp.i18n.__("Last seen %1$s · %2$d occurrences", "structura"),
      formatRelative(notice.lastSeenAt),
      notice.occurrences
    ), notice.domain ? ` · ${notice.domain}` : null)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 flex-col items-end gap-2" }, cta ? /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: cta.href,
        target: cta.external ? "_blank" : void 0,
        rel: cta.external ? "noreferrer noopener" : void 0,
        className: "inline-flex items-center gap-1 rounded-md bg-brand-600 px-3 py-1.5 text-xs font-medium text-white! transition hover:bg-brand-500"
      },
      resolveCopy(notice.cta.labelKey),
      cta.external ? /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3 w-3", "aria-hidden": true }) : null
    ) : null, notice.status === "open" ? /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        disabled: isPending,
        onClick: () => acknowledge.mutate({ noticeId: notice.noticeId })
      },
      window.wp.i18n.__("Acknowledge", "structura")
    ) : null, /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "transparent",
        size: "sm",
        disabled: isPending,
        onClick: () => dismiss.mutate({ noticeId: notice.noticeId })
      },
      window.wp.i18n.__("Dismiss", "structura")
    ))));
  })));
};
const POPOVER_LIMIT = 5;
const BellTrigger = ({ openCount }) => /* @__PURE__ */ window.wp.element.createElement(
  "button",
  {
    type: "button",
    className: "relative inline-flex h-9 w-9 cursor-pointer items-center justify-center rounded-md text-neutral-600 transition-colors hover:bg-neutral-100 hover:text-neutral-900 focus-visible:ring-2 focus-visible:ring-brand-500/40 focus-visible:outline-none dark:text-neutral-300 dark:hover:bg-neutral-800 dark:hover:text-white",
    "aria-label": window.wp.i18n.__("Notifications", "structura")
  },
  /* @__PURE__ */ window.wp.element.createElement(Bell, { className: "h-5 w-5", "aria-hidden": true }),
  openCount > 0 ? /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: "absolute -top-0.5 -right-0.5 flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white",
      "aria-label": openCount === 1 ? window.wp.i18n.__("1 open notice", "structura") : (
        // translators: %d is the number of open notices.
        `${openCount} ${window.wp.i18n.__("open notices", "structura")}`
      )
    },
    openCount > 9 ? "9+" : openCount
  ) : null
);
const PopoverNoticeRow = ({ notice, isPending, onAcknowledge, onDismiss }) => {
  const cta = resolveCta(notice.cta);
  return /* @__PURE__ */ window.wp.element.createElement("li", { className: "border-b border-neutral-200 px-3 py-3 last:border-b-0 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-1 flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: SEVERITY_INTENT[notice.severity] }, categoryLabel(notice.category)), notice.status === "acknowledged" ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "default" }, window.wp.i18n.__("Acknowledged", "structura")) : null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-auto text-[11px] text-neutral-500" }, formatRelative(notice.lastSeenAt))), /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, resolveCopy(notice.titleKey, notice.bodyParams)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, resolveCopy(notice.bodyKey, notice.bodyParams)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 flex flex-wrap items-center gap-2" }, cta ? /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: cta.href,
      target: cta.external ? "_blank" : void 0,
      rel: cta.external ? "noreferrer noopener" : void 0,
      className: "inline-flex items-center gap-1 rounded-md bg-brand-600 px-2.5 py-1 text-[11px] font-medium text-white! transition hover:bg-brand-500"
    },
    resolveCopy(notice.cta.labelKey),
    cta.external ? /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3 w-3", "aria-hidden": true }) : null
  ) : null, notice.status === "open" ? /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      disabled: isPending,
      onClick: onAcknowledge
    },
    window.wp.i18n.__("Acknowledge", "structura")
  ) : null, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      disabled: isPending,
      onClick: onDismiss
    },
    window.wp.i18n.__("Dismiss", "structura")
  )));
};
const NoticesBell = () => {
  const { data } = useNoticesQuery();
  const acknowledge = useAcknowledgeNoticeMutation();
  const dismiss = useDismissNoticeMutation();
  const openCount = window.wp.element.useMemo(
    () => (data?.notices ?? []).filter((n2) => n2.status === "open").length,
    [data]
  );
  const top = window.wp.element.useMemo(() => {
    const all = [...data?.notices ?? []].sort((a3, b2) => {
      if (a3.status !== b2.status) return a3.status === "open" ? -1 : 1;
      return b2.lastSeenAt - a3.lastSeenAt;
    });
    return all.slice(0, POPOVER_LIMIT);
  }, [data]);
  return /* @__PURE__ */ window.wp.element.createElement(Jn, null, /* @__PURE__ */ window.wp.element.createElement(Jn.Trigger, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex" }, /* @__PURE__ */ window.wp.element.createElement(BellTrigger, { openCount }))), /* @__PURE__ */ window.wp.element.createElement(
    Jn.Content,
    {
      anchor: { to: "bottom end", gap: 8 },
      className: "w-[360px] max-w-[calc(100vw-2rem)]"
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-b border-neutral-200 px-3 py-2 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Notifications", "structura"))),
    top.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-3 py-6 text-center" }, /* @__PURE__ */ window.wp.element.createElement(
      CircleCheckBig,
      {
        className: "mx-auto h-6 w-6 text-emerald-500",
        "aria-hidden": true
      }
    ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("No active notices.", "structura"))) : /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0 max-h-[60vh] list-none overflow-y-auto p-0" }, top.map((notice) => {
      const isPending = acknowledge.isPending && acknowledge.variables?.noticeId === notice.noticeId || dismiss.isPending && dismiss.variables?.noticeId === notice.noticeId;
      return /* @__PURE__ */ window.wp.element.createElement(
        PopoverNoticeRow,
        {
          key: notice.noticeId,
          notice,
          isPending,
          onAcknowledge: () => acknowledge.mutate({ noticeId: notice.noticeId }),
          onDismiss: () => dismiss.mutate({ noticeId: notice.noticeId })
        }
      );
    })),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-t border-neutral-200 px-3 py-2 text-right dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
      NavLink,
      {
        to: "/notices",
        className: "text-xs font-medium text-brand-600 hover:text-brand-500 dark:text-brand-400"
      },
      window.wp.i18n.__("See all", "structura")
    ))
  ));
};
function planName(planId) {
  switch (planId) {
    case "free":
      return window.wp.i18n.__("Free", "structura");
    case "byok":
      return window.wp.i18n.__("BYOK", "structura");
    case "cloud":
      return window.wp.i18n.__("Cloud", "structura");
    case "cloud_pro":
      return window.wp.i18n.__("Cloud Pro", "structura");
    default:
      return planId;
  }
}
function formatPlanName(planId) {
  return planName(planId);
}
function buildPrimaryNavLinks(opts) {
  const { channelsVisible, plan } = opts;
  return [
    { to: "/", label: window.wp.i18n.__("Dashboard", "structura") },
    { to: "/campaigns", label: window.wp.i18n.__("Campaigns", "structura") },
    { to: "/personas", label: window.wp.i18n.__("Personas", "structura") },
    { to: "/visuals", label: window.wp.i18n.__("Visuals", "structura") },
    // `/site` sits after content destinations so the primary content
    // flow (Dashboard → Campaigns → Personas → Visuals) stays the
    // reading path. Site is the identity/intelligence surface — useful
    // but not the daily-work entry point. Spec/seo-intelligence-plan.md §4.
    { to: "/site", label: window.wp.i18n.__("Site", "structura") },
    // Channels is rollout-gated + plan-gated + entitlement-gated — see
    // `useChannelsVisibility` for the full decision tree. Agency sees it
    // bundled, Pro/Cloud only after purchasing the add-on SKU, Free never.
    ...channelsVisible ? [{ to: "/channels", label: window.wp.i18n.__("Channels", "structura") }] : [],
    // Managed plans (Cloud, Agency) don't surface AI Engine — they can't
    // connect their own provider keys because we run the infra for them.
    ...!isManagedPlan(plan) ? [{ to: "/ai-engine", label: window.wp.i18n.__("AI Engine", "structura") }] : []
  ];
}
function getAccountMenuModel(opts) {
  const { loading, isLicensed, plan } = opts;
  if (loading) {
    return {
      showUpgrade: false,
      upgradeTarget: "portal",
      showManage: false,
      showCreateAccount: false
    };
  }
  if (!isLicensed) {
    return {
      showUpgrade: true,
      upgradeTarget: "pricing",
      showManage: false,
      showCreateAccount: true
    };
  }
  return {
    // Upgrade is an entry-tier CTA: only Free has an obvious next step we
    // surface here. Paid tiers (BYOK/Cloud/Cloud Pro) manage plan changes
    // in the portal, so no Upgrade row for them.
    showUpgrade: plan === "free",
    upgradeTarget: "portal",
    showManage: true,
    showCreateAccount: false
  };
}
const Header = () => {
  const [isMobileMenuOpen, setIsMobileMenuOpen] = window.wp.element.useState(false);
  const { isLicensed, plan, loading } = useLicense();
  const channelsVisible = useChannelsVisibility();
  const getNavClass = ({ isActive }) => `nav-item ${isActive ? "nav-item-active" : ""}`;
  const getPlanBadgeConfig = () => {
    if (loading) return { label: "---", intent: "default" };
    if (plan === "none" || plan === "") {
      return { label: window.wp.i18n.__("Anonymous", "structura"), intent: "default" };
    }
    const intent = plan === "byok" ? "success" : plan === "cloud" || plan === "cloud_pro" ? "premium" : plan === "free" ? "info" : "default";
    return { label: formatPlanName(plan), intent };
  };
  const badge = getPlanBadgeConfig();
  const navLinks = buildPrimaryNavLinks({ channelsVisible, plan });
  const menu = getAccountMenuModel({ loading, isLicensed, plan });
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  const portalHref = buildPortalSignupUrl({
    intent: "manage_account",
    domain,
    plan
  });
  const upgradeHref2 = menu.upgradeTarget === "pricing" ? buildMarketingPricingUrl({ intent: "general_upgrade", domain, plan }) : buildPortalSignupUrl({ intent: "general_upgrade", domain, plan });
  return /* @__PURE__ */ window.wp.element.createElement("nav", { className: "sticky top-0 z-50 border-b border-neutral-200 bg-white sm:top-11.5 md:top-8 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-16 justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex" }, /* @__PURE__ */ window.wp.element.createElement(al, null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "s-hidden items-center md:ml-8 md:flex md:space-x-1.5" }, navLinks.map((link) => /* @__PURE__ */ window.wp.element.createElement(NavLink, { key: link.to, to: link.to, className: getNavClass }, link.label)))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ window.wp.element.createElement(NoticesBell, null), /* @__PURE__ */ window.wp.element.createElement(Jn, null, /* @__PURE__ */ window.wp.element.createElement(Jn.Trigger, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      className: B$1(
        "flex cursor-pointer items-center gap-1.5 rounded-full",
        "focus-visible:ring-brand-500/40 focus-visible:ring-2 focus-visible:outline-none"
      ),
      "aria-label": window.wp.i18n.__("Account menu", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(
      Me,
      {
        variant: "solid",
        intent: badge.intent,
        className: loading ? "animate-pulse opacity-50" : "px-2.5 font-black uppercase"
      },
      badge.label
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      ChevronDown,
      {
        size: 14,
        className: "text-neutral-400 dark:text-neutral-500",
        "aria-hidden": true
      }
    )
  )), /* @__PURE__ */ window.wp.element.createElement(
    Jn.Content,
    {
      anchor: { to: "bottom end", gap: 8 },
      className: "min-w-[14rem]"
    },
    ({ close }) => /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-3 pt-2 pb-1 text-[10px] font-bold tracking-wider text-neutral-400 uppercase" }, badge.label), /* @__PURE__ */ window.wp.element.createElement(
      NavLink,
      {
        to: "/account",
        onClick: () => close(),
        className: ACCOUNT_MENU_ROW_CLASS
      },
      /* @__PURE__ */ window.wp.element.createElement(CircleUser, { className: "h-4 w-4 shrink-0", "aria-hidden": true }),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex-1 text-left" }, window.wp.i18n.__("Account & License", "structura"))
    ), /* @__PURE__ */ window.wp.element.createElement(
      NavLink,
      {
        to: "/settings",
        onClick: () => close(),
        className: ACCOUNT_MENU_ROW_CLASS
      },
      /* @__PURE__ */ window.wp.element.createElement(Settings, { className: "h-4 w-4 shrink-0", "aria-hidden": true }),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex-1 text-left" }, window.wp.i18n.__("Settings", "structura"))
    ), (menu.showUpgrade || menu.showManage || menu.showCreateAccount) && /* @__PURE__ */ window.wp.element.createElement("div", { className: "my-1 h-px bg-neutral-200 dark:bg-neutral-800" }), menu.showUpgrade && /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: upgradeHref2,
        target: "_blank",
        rel: "noreferrer",
        onClick: () => close(),
        className: ACCOUNT_MENU_UPGRADE_CLASS
      },
      /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "h-4 w-4 shrink-0", "aria-hidden": true }),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex-1 text-left" }, window.wp.i18n.__("Upgrade", "structura"))
    ), menu.showManage && /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: portalHref,
        target: "_blank",
        rel: "noreferrer",
        onClick: () => close(),
        className: ACCOUNT_MENU_ROW_CLASS
      },
      /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-4 w-4 shrink-0", "aria-hidden": true }),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex-1 text-left" }, window.wp.i18n.__("Manage account", "structura"))
    ), menu.showCreateAccount && /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: portalHref,
        target: "_blank",
        rel: "noreferrer",
        onClick: () => close(),
        className: ACCOUNT_MENU_ROW_CLASS
      },
      /* @__PURE__ */ window.wp.element.createElement(UserPlus, { className: "h-4 w-4 shrink-0", "aria-hidden": true }),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex-1 text-left" }, window.wp.i18n.__("Create a free account", "structura"))
    ))
  )), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setIsMobileMenuOpen((prev) => !prev),
      className: B$1(
        "inline-flex items-center justify-center rounded-lg p-2 md:hidden",
        "text-neutral-500 hover:bg-neutral-100 hover:text-neutral-900",
        "transition-all duration-150 ease-out",
        "focus-visible:ring-brand-500/40 focus:outline-none focus-visible:shadow-[0_0_0_4px_rgba(99,102,241,0.15)] focus-visible:ring-2",
        "dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-white"
      ),
      "aria-label": isMobileMenuOpen ? window.wp.i18n.__("Close menu", "structura") : window.wp.i18n.__("Open menu", "structura"),
      "aria-expanded": isMobileMenuOpen
    },
    isMobileMenuOpen ? /* @__PURE__ */ window.wp.element.createElement(X, { size: 20 }) : /* @__PURE__ */ window.wp.element.createElement(Menu, { size: 20 })
  )))), isMobileMenuOpen && /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-t border-neutral-200 bg-neutral-50 md:hidden dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1 px-2 pt-2 pb-3" }, navLinks.map((link) => /* @__PURE__ */ window.wp.element.createElement(MobileLink, { key: link.to, to: link.to, onClick: () => setIsMobileMenuOpen(false) }, link.label)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "my-2 h-px bg-neutral-200 dark:bg-neutral-800" }), /* @__PURE__ */ window.wp.element.createElement(MobileLink, { to: "/account", onClick: () => setIsMobileMenuOpen(false) }, window.wp.i18n.__("Account & License", "structura")), /* @__PURE__ */ window.wp.element.createElement(MobileLink, { to: "/settings", onClick: () => setIsMobileMenuOpen(false) }, window.wp.i18n.__("Settings", "structura")), (menu.showUpgrade || menu.showManage || menu.showCreateAccount) && /* @__PURE__ */ window.wp.element.createElement("div", { className: "my-2 h-px bg-neutral-200 dark:bg-neutral-800" }), menu.showUpgrade && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: upgradeHref2,
      target: "_blank",
      rel: "noreferrer",
      onClick: () => setIsMobileMenuOpen(false),
      className: MOBILE_UPGRADE_CLASS
    },
    window.wp.i18n.__("Upgrade", "structura")
  ), menu.showManage && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: portalHref,
      target: "_blank",
      rel: "noreferrer",
      onClick: () => setIsMobileMenuOpen(false),
      className: MOBILE_EXTERNAL_LINK_CLASS
    },
    window.wp.i18n.__("Manage account", "structura")
  ), menu.showCreateAccount && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: portalHref,
      target: "_blank",
      rel: "noreferrer",
      onClick: () => setIsMobileMenuOpen(false),
      className: MOBILE_EXTERNAL_LINK_CLASS
    },
    window.wp.i18n.__("Create a free account", "structura")
  ))));
};
const ACCOUNT_MENU_ROW_CLASS = B$1(
  "flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm no-underline select-none",
  "text-neutral-700! transition-colors hover:bg-neutral-100 hover:text-neutral-900!",
  "focus-visible:bg-neutral-100 focus-visible:text-neutral-900! focus-visible:outline-none",
  "dark:text-neutral-200! dark:hover:bg-neutral-800 dark:hover:text-white! dark:focus-visible:bg-neutral-800 dark:focus-visible:text-white!"
);
const ACCOUNT_MENU_UPGRADE_CLASS = B$1(
  "flex w-full cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm font-bold no-underline select-none",
  "text-brand-600! transition-colors hover:bg-brand-50 hover:text-brand-700!",
  "focus-visible:bg-brand-50 focus-visible:text-brand-700! focus-visible:outline-none",
  "dark:text-brand-400! dark:hover:bg-brand-950/30 dark:hover:text-brand-300! dark:focus-visible:bg-brand-950/30 dark:focus-visible:text-brand-300!"
);
const MOBILE_UPGRADE_CLASS = B$1(
  "block w-full rounded-lg px-3 py-2 text-left text-base font-bold no-underline",
  "text-brand-600! transition-colors hover:bg-brand-50 hover:text-brand-700!",
  "dark:text-brand-400! dark:hover:bg-brand-950/30 dark:hover:text-brand-300!"
);
const MOBILE_EXTERNAL_LINK_CLASS = B$1(
  "block w-full rounded-lg px-3 py-2 text-left text-base font-medium",
  "text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900",
  "dark:text-neutral-300 dark:hover:bg-neutral-800 dark:hover:text-white"
);
const MobileLink = ({ to, children, onClick }) => /* @__PURE__ */ window.wp.element.createElement(
  NavLink,
  {
    to,
    onClick,
    className: ({ isActive }) => B$1(
      "block w-full rounded-lg px-3 py-2 text-left text-base font-medium",
      isActive ? "bg-brand-50 text-brand-700 dark:bg-brand-950/30 dark:text-brand-300" : "text-neutral-700 hover:bg-neutral-100 hover:text-neutral-900 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:hover:text-white"
    )
  },
  children
);
const dashboardKeys = {
  all: ["dashboard"],
  stats: () => [...dashboardKeys.all, "stats"],
  /**
   * Needs Attention widget list query — `failed` +
   * `succeeded_with_warnings` runs that haven't been acknowledged yet.
   * Spec: `specs/run-detail-view.md` §6.
   */
  attentionRuns: () => [...dashboardKeys.all, "attention-runs"]
};
const useStatsQuery = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: dashboardKeys.stats(),
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/stats" }),
    enabled: hasWorkspace === true,
    refetchInterval: 6e4,
    staleTime: 3e4
  });
};
const useJobsQuery = (status, page, search) => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: jobKeys.list({ status, page, search }),
    enabled: hasUsableLicense === true,
    queryFn: async () => {
      const params = new URLSearchParams({ status, page: page.toString(), search });
      return window.wp.apiFetch({
        path: `/structura/v1/jobs?${params.toString()}`
      });
    },
    // Keep data fresh while debouncing or navigating pages
    placeholderData: (previousData) => previousData,
    staleTime: 5e3
  });
};
const StatCard$1 = ({ label, value, subtext, variant, trend }) => {
  const borderColors = {
    brand: "border-l-brand-600",
    emerald: "border-l-emerald-500",
    purple: "border-l-purple-500"
  };
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: B$1("rounded-lg border-l-4 p-6! shadow-sm", borderColors[variant]) }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-1! text-[10px] font-bold tracking-widest text-gray-400 uppercase" }, label), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-baseline gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-3xl! font-black! text-neutral-900 dark:text-white" }, value), trend && /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded-full bg-brand-50 px-2 py-0.5 text-xs font-medium text-brand-600 dark:bg-brand-900/30 dark:text-brand-300" }, trend)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-4! mb-0! font-mono text-xs text-gray-500 dark:text-gray-400" }, subtext));
};
function formatMetricCount(value, locale) {
  if (Math.abs(value) >= 1e4) {
    return new Intl.NumberFormat(locale, {
      notation: "compact",
      maximumFractionDigits: 1
    }).format(value);
  }
  return new Intl.NumberFormat(locale).format(value);
}
function formatCtr(fraction, locale) {
  return new Intl.NumberFormat(locale, {
    style: "percent",
    minimumFractionDigits: 1,
    maximumFractionDigits: 1
  }).format(fraction);
}
function formatPosition(position, locale) {
  if (position <= 0) return "—";
  return new Intl.NumberFormat(locale, {
    minimumFractionDigits: 1,
    maximumFractionDigits: 1
  }).format(position);
}
const FLAT_THRESHOLD = 0.05;
const MIN_BASE = 10;
function countDelta(current, previous, locale) {
  if (previous < MIN_BASE) return { tone: "flat", label: null };
  const ratio = (current - previous) / previous;
  const label = new Intl.NumberFormat(locale, {
    style: "percent",
    maximumFractionDigits: 0,
    signDisplay: "always"
  }).format(ratio);
  if (Math.abs(ratio) < FLAT_THRESHOLD) return { tone: "flat", label };
  return { tone: ratio > 0 ? "good" : "bad", label };
}
const POSITION_FLAT_THRESHOLD = 0.3;
function positionDelta(current, previous, locale) {
  if (current <= 0 || previous <= 0) return { direction: "flat", magnitude: null };
  const change = previous - current;
  if (Math.abs(change) < POSITION_FLAT_THRESHOLD) {
    return { direction: "flat", magnitude: null };
  }
  return {
    direction: change > 0 ? "better" : "worse",
    magnitude: new Intl.NumberFormat(locale, {
      minimumFractionDigits: 1,
      maximumFractionDigits: 1
    }).format(Math.abs(change))
  };
}
const PULLING_POLL_MS$1 = 5e3;
const gscOverviewPollInterval = (state) => state === "pulling" ? PULLING_POLL_MS$1 : false;
const useGscOverviewSummaryQuery = () => {
  const { isActivationValid, hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: channelKeys.gscOverviewSummary(),
    enabled: hasUsableLicense === true && isActivationValid !== false,
    meta: { silentError: true },
    refetchInterval: (query) => gscOverviewPollInterval(query.state.data?.state),
    queryFn: () => window.wp.apiFetch({
      path: "/structura/v1/gsc/overview?summary=1"
    })
  });
};
const PULLING_POLL_MS = 5e3;
const useGscPostStatsQuery = (pageUrl) => {
  const { isActivationValid, hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: channelKeys.gscPostStats(pageUrl ?? ""),
    enabled: Boolean(pageUrl) && hasUsableLicense === true && isActivationValid !== false,
    meta: { silentError: true },
    refetchInterval: (query) => query.state.data?.state === "pulling" ? PULLING_POLL_MS : false,
    queryFn: async () => {
      if (!pageUrl) {
        throw new Error("useGscPostStatsQuery called without a pageUrl");
      }
      return window.wp.apiFetch({
        path: `/structura/v1/gsc/post-stats?page_url=${encodeURIComponent(pageUrl)}`
      });
    }
  });
};
const COLLECTING_WINDOW_MS = 3 * 24 * 60 * 60 * 1e3;
const TOP_QUERY_ROWS = 3;
const SearchPerformanceSection = ({
  pageUrl,
  publishedAt,
  className
}) => {
  const query = useGscPostStatsQuery(pageUrl);
  const locale = resolveIntlLocale();
  if (query.isPending && !query.isFetching) return null;
  if (query.isLoading || query.data?.state === "pulling") {
    return /* @__PURE__ */ window.wp.element.createElement(LoadingSkeleton, { className });
  }
  if (query.isError || !query.data) {
    return /* @__PURE__ */ window.wp.element.createElement(QuietRow, { className }, /* @__PURE__ */ window.wp.element.createElement(
      CircleAlert,
      {
        size: 16,
        className: "shrink-0 text-neutral-400 dark:text-neutral-500",
        "aria-hidden": true
      }
    ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 flex-1 text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Couldn't load search data for this post.", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        className: "shrink-0",
        onClick: () => void query.refetch()
      },
      /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, "aria-hidden": true }),
      window.wp.i18n.__("Retry", "structura")
    ));
  }
  const { state, page, freshThrough } = query.data;
  const freshDate = freshThrough ? formatShortDate(freshThrough, locale) : null;
  if (state === "not_connected") {
    return /* @__PURE__ */ window.wp.element.createElement(QuietRow, { className }, /* @__PURE__ */ window.wp.element.createElement(
      Search,
      {
        size: 16,
        className: "shrink-0 text-neutral-400 dark:text-neutral-500",
        "aria-hidden": true
      }
    ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 flex-1 text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "See this post's Google Search clicks and queries here.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        href: "#/channels/store",
        className: "shrink-0"
      },
      /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, "aria-hidden": true }),
      window.wp.i18n.__("Connect Search Console", "structura")
    ));
  }
  if (state === "property_pending") {
    const configureHref = query.data.connectionId ? `#/channels/connections?configure=${encodeURIComponent(query.data.connectionId)}` : "#/channels/connections";
    return /* @__PURE__ */ window.wp.element.createElement(QuietRow, { className }, /* @__PURE__ */ window.wp.element.createElement(
      Search,
      {
        size: 16,
        className: "shrink-0 text-neutral-400 dark:text-neutral-500",
        "aria-hidden": true
      }
    ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 flex-1 text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "Search Console is connected — one step left: choose the property this site reads.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", href: configureHref, className: "shrink-0" }, window.wp.i18n.__("Choose property", "structura")));
  }
  if (state === "expired") {
    return /* @__PURE__ */ window.wp.element.createElement(
      "section",
      {
        className: B$1(
          "flex flex-wrap items-center gap-3 rounded-2xl border border-amber-200/70 bg-amber-50/40 p-5 dark:border-amber-900/40 dark:bg-amber-950/20",
          className
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(
        TriangleAlert,
        {
          size: 16,
          className: "shrink-0 text-amber-600 dark:text-amber-400",
          "aria-hidden": true
        }
      ),
      /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 flex-1 text-sm text-amber-800 dark:text-amber-200" }, freshDate ? (
        // translators: %s is a date like "Jul 9, 2026".
        window.wp.i18n.sprintf(
          window.wp.i18n.__(
            "Google connection expired — search stats paused %s. Your history is safe.",
            "structura"
          ),
          freshDate
        )
      ) : window.wp.i18n.__(
        "Google connection expired — search stats are paused. Your history is safe.",
        "structura"
      )),
      /* @__PURE__ */ window.wp.element.createElement(
        tr$1,
        {
          variant: "secondary",
          size: "sm",
          href: "#/channels/connections",
          className: "shrink-0"
        },
        /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, "aria-hidden": true }),
        window.wp.i18n.__("Reconnect", "structura")
      )
    );
  }
  if (page && page.last28.impressions > 0) {
    return /* @__PURE__ */ window.wp.element.createElement(
      PopulatedSection,
      {
        page,
        freshDate,
        locale,
        className
      }
    );
  }
  const publishedMs = publishedAt ? Date.parse(publishedAt) : NaN;
  const isCollecting = Number.isFinite(publishedMs) && Date.now() - publishedMs < COLLECTING_WINDOW_MS;
  if (isCollecting) {
    return /* @__PURE__ */ window.wp.element.createElement(QuietRow, { className }, /* @__PURE__ */ window.wp.element.createElement(
      Hourglass,
      {
        size: 16,
        className: "shrink-0 text-neutral-400 dark:text-neutral-500",
        "aria-hidden": true
      }
    ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 flex-1 text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "Collecting search data — Google reports lag about 2 days. First numbers usually appear within a few days of publishing.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(FreshnessCue, { date: freshDate }));
  }
  return /* @__PURE__ */ window.wp.element.createElement(QuietRow, { className }, /* @__PURE__ */ window.wp.element.createElement(
    Telescope,
    {
      size: 16,
      className: "shrink-0 text-neutral-400 dark:text-neutral-500",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 flex-1 text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "No search traffic yet — that's normal, most posts take a few weeks to start ranking. We check every day.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(FreshnessCue, { date: freshDate }));
};
const PopulatedSection = ({
  page,
  freshDate,
  locale,
  className
}) => {
  const { last28, prev28 } = page;
  const clicksDelta = countDelta(last28.clicks, prev28.clicks, locale);
  const impressionsDelta = countDelta(
    last28.impressions,
    prev28.impressions,
    locale
  );
  const posDelta = positionDelta(last28.position, prev28.position, locale);
  const topQueries = [...page.topQueries].sort((a3, b2) => b2.clicks - a3.clicks).slice(0, TOP_QUERY_ROWS);
  const clicksSeries = page.series.map((p2) => p2.clicks);
  return /* @__PURE__ */ window.wp.element.createElement(
    "section",
    {
      className: B$1(
        "rounded-2xl border border-neutral-200 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",
        className
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-sm font-semibold uppercase tracking-wide text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Search performance · last 28 days", "structura"))),
    /* @__PURE__ */ window.wp.element.createElement("dl", { className: "m-0! mt-4! grid grid-cols-2 gap-4 lg:grid-cols-4" }, /* @__PURE__ */ window.wp.element.createElement(
      Stat,
      {
        label: window.wp.i18n.__("Clicks", "structura"),
        value: formatMetricCount(last28.clicks, locale),
        chip: /* @__PURE__ */ window.wp.element.createElement(CountDeltaChip, { delta: clicksDelta })
      }
    ), /* @__PURE__ */ window.wp.element.createElement(
      Stat,
      {
        label: window.wp.i18n.__("Impressions", "structura"),
        value: formatMetricCount(last28.impressions, locale),
        chip: /* @__PURE__ */ window.wp.element.createElement(CountDeltaChip, { delta: impressionsDelta })
      }
    ), /* @__PURE__ */ window.wp.element.createElement(
      Stat,
      {
        label: window.wp.i18n.__("CTR", "structura"),
        value: formatCtr(last28.ctr, locale),
        chip: /* @__PURE__ */ window.wp.element.createElement(CtrDeltaChip, { last28, prev28, locale })
      }
    ), /* @__PURE__ */ window.wp.element.createElement(
      Stat,
      {
        label: window.wp.i18n.__("Position", "structura"),
        value: formatPosition(last28.position, locale),
        chip: /* @__PURE__ */ window.wp.element.createElement(PositionDeltaChip, { delta: posDelta })
      }
    )),
    clicksSeries.length > 1 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-4 rounded-xl bg-neutral-50 p-2 ring-1 ring-neutral-200/60 dark:bg-white/[.04] dark:ring-white/[.06]" }, /* @__PURE__ */ window.wp.element.createElement(ClicksSparkline, { points: clicksSeries })),
    topQueries.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-5" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Top queries", "structura")), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0! mt-1! list-none divide-y divide-neutral-100 p-0! dark:divide-neutral-800" }, topQueries.map((row) => /* @__PURE__ */ window.wp.element.createElement(QueryRow, { key: row.q, row, locale })))),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-4 flex flex-wrap items-center justify-between gap-2 border-t border-neutral-100 pt-3 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(FreshnessCue, { date: freshDate }))
  );
};
const Stat = ({
  label,
  value,
  chip
}) => /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "text-xs uppercase tracking-wide text-neutral-500 dark:text-neutral-400" }, label), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "m-0! mt-1! flex items-baseline gap-2 text-lg font-bold tracking-tight text-neutral-900 dark:text-neutral-100" }, value, chip));
const CHIP_TONE_CLASSES = {
  good: "bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",
  bad: "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-300",
  flat: "bg-neutral-100 text-neutral-500 dark:bg-white/[.07] dark:text-neutral-400"
};
const DeltaChip = ({
  tone,
  icon: Icon2,
  children
}) => /* @__PURE__ */ window.wp.element.createElement(
  "span",
  {
    className: B$1(
      "inline-flex items-center gap-1 rounded-full px-2 py-0.5 font-mono text-[10px] font-semibold leading-none",
      CHIP_TONE_CLASSES[tone]
    )
  },
  Icon2 && /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 10, "aria-hidden": true }),
  children
);
const CountDeltaChip = ({
  delta
}) => {
  if (delta.label == null) return null;
  const Icon2 = delta.tone === "good" ? TrendingUp : delta.tone === "bad" ? TrendingDown : void 0;
  return /* @__PURE__ */ window.wp.element.createElement(DeltaChip, { tone: delta.tone, icon: Icon2 }, delta.label);
};
const CtrDeltaChip = ({
  last28,
  prev28,
  locale
}) => {
  if (prev28.impressions <= 0) return null;
  const pts = (last28.ctr - prev28.ctr) * 100;
  const label = new Intl.NumberFormat(locale, {
    minimumFractionDigits: 1,
    maximumFractionDigits: 1,
    signDisplay: "always"
  }).format(pts);
  return /* @__PURE__ */ window.wp.element.createElement(
    DeltaChip,
    { tone: "flat" },
    // translators: %s is a signed number of percentage points, e.g. "+0.1". "pt" = percentage points.
    window.wp.i18n.sprintf(window.wp.i18n.__("%s pt", "structura"), label)
  );
};
const PositionDeltaChip = ({
  delta
}) => {
  if (delta.direction === "flat" || delta.magnitude == null) return null;
  const better = delta.direction === "better";
  return /* @__PURE__ */ window.wp.element.createElement(DeltaChip, { tone: better ? "good" : "bad", icon: better ? ArrowUp : ArrowDown }, better ? (
    // translators: %s is a number of ranking positions gained, e.g. "2.1".
    window.wp.i18n.sprintf(window.wp.i18n.__("%s better", "structura"), delta.magnitude)
  ) : (
    // translators: %s is a number of ranking positions lost, e.g. "1.4".
    window.wp.i18n.sprintf(window.wp.i18n.__("%s worse", "structura"), delta.magnitude)
  ));
};
const QueryRow = ({ row, locale }) => /* @__PURE__ */ window.wp.element.createElement("li", { className: "m-0! flex items-center gap-2 py-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex w-9 shrink-0 justify-center rounded-md bg-neutral-100 px-1 py-0.5 font-mono text-[10px] font-semibold text-neutral-500 dark:bg-white/[.07] dark:text-neutral-400" }, "#", formatPosition(row.position, locale)), /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0 flex-1 truncate text-xs font-medium text-neutral-800 dark:text-neutral-200" }, row.q), /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 font-mono text-[10px] text-neutral-400 dark:text-neutral-500" }, formatMetricCount(row.clicks, locale)), /* @__PURE__ */ window.wp.element.createElement(CopyQueryButton, { query: row.q }));
const CopyQueryButton = ({ query }) => {
  const [copied, setCopied] = window.wp.element.useState(false);
  const resetTimer = window.wp.element.useRef();
  window.wp.element.useEffect(() => () => clearTimeout(resetTimer.current), []);
  const onCopy = () => {
    void navigator.clipboard?.writeText(query).catch(() => void 0);
    setCopied(true);
    clearTimeout(resetTimer.current);
    resetTimer.current = setTimeout(() => setCopied(false), 1400);
  };
  return /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: onCopy,
      "aria-label": window.wp.i18n.sprintf(window.wp.i18n.__("Copy query: %s", "structura"), query),
      className: "shrink-0 cursor-pointer border-0 bg-transparent p-0.5 text-neutral-300 transition-colors hover:text-neutral-600 dark:text-neutral-600 dark:hover:text-neutral-300"
    },
    copied ? /* @__PURE__ */ window.wp.element.createElement(Check, { size: 12, className: "text-emerald-500", "aria-hidden": true }) : /* @__PURE__ */ window.wp.element.createElement(Copy, { size: 12, "aria-hidden": true })
  );
};
const ClicksSparkline = ({ points }) => {
  const W2 = 100;
  const H2 = 20;
  const max2 = Math.max(...points, 1);
  const step = W2 / (points.length - 1);
  const coords = points.map((v2, i2) => [
    i2 * step,
    H2 - 1 - v2 / max2 * (H2 - 2)
  ]);
  const line = coords.map(([x2, y2], i2) => `${i2 === 0 ? "M" : "L"}${x2.toFixed(2)} ${y2.toFixed(2)}`).join(" ");
  const area = `${line} L${W2} ${H2} L0 ${H2} Z`;
  return /* @__PURE__ */ window.wp.element.createElement(
    "svg",
    {
      viewBox: `0 0 ${W2} ${H2}`,
      preserveAspectRatio: "none",
      "aria-hidden": "true",
      "data-testid": "gsc-clicks-sparkline",
      className: "text-brand-600 dark:text-brand-400 block h-[52px] w-full"
    },
    /* @__PURE__ */ window.wp.element.createElement("path", { d: area, fill: "currentColor", opacity: 0.08 }),
    /* @__PURE__ */ window.wp.element.createElement(
      "path",
      {
        d: line,
        fill: "none",
        stroke: "currentColor",
        strokeWidth: 2,
        strokeLinejoin: "round",
        strokeLinecap: "round",
        vectorEffect: "non-scaling-stroke"
      }
    )
  );
};
const QuietRow = ({
  className,
  children
}) => /* @__PURE__ */ window.wp.element.createElement(
  "section",
  {
    className: B$1(
      "flex flex-wrap items-center gap-3 rounded-2xl border border-neutral-200 bg-white p-5 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",
      className
    )
  },
  children
);
const FreshnessCue = ({ date }) => /* @__PURE__ */ window.wp.element.createElement(
  "span",
  { className: "inline-flex shrink-0 items-center gap-1.5 font-mono text-[10px] tracking-wide text-neutral-400 dark:text-neutral-500" },
  /* @__PURE__ */ window.wp.element.createElement(History, { size: 11, "aria-hidden": true }),
  // translators: %s is a date like "Jul 16, 2026" (or "—" when unknown).
  window.wp.i18n.sprintf(
    window.wp.i18n.__("Data through %s · Google reports lag ~2 days", "structura"),
    date ?? "—"
  )
);
const LoadingSkeleton = ({ className }) => /* @__PURE__ */ window.wp.element.createElement(
  "section",
  {
    role: "status",
    className: B$1(
      "rounded-2xl border border-neutral-200 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",
      className
    )
  },
  /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-sm font-semibold uppercase tracking-wide text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Search performance · last 28 days", "structura")),
  /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-4 animate-pulse", "aria-hidden": true }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-2 gap-4 lg:grid-cols-4" }, [0, 1, 2, 3].map((i2) => /* @__PURE__ */ window.wp.element.createElement("div", { key: i2 }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "h-3 w-16 rounded bg-neutral-100 dark:bg-neutral-800" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 h-5 w-20 rounded bg-neutral-100 dark:bg-neutral-800" })))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-4 h-[52px] rounded-xl bg-neutral-50 ring-1 ring-neutral-200/60 dark:bg-white/[.04] dark:ring-white/[.06]" })),
  /* @__PURE__ */ window.wp.element.createElement("span", { className: "sr-only" }, window.wp.i18n.__("Loading search data…", "structura"))
);
function resolveIntlLocale() {
  const raw = typeof document !== "undefined" ? document.documentElement.lang : "";
  const candidate = (raw || "en").replace(/_/g, "-");
  try {
    new Intl.NumberFormat(candidate);
    return candidate;
  } catch {
    return "en";
  }
}
function formatShortDate(ymd, locale) {
  const parsed = /* @__PURE__ */ new Date(`${ymd}T00:00:00`);
  if (Number.isNaN(parsed.getTime())) return ymd;
  try {
    return new Intl.DateTimeFormat(locale, {
      month: "short",
      day: "numeric",
      year: "numeric"
    }).format(parsed);
  } catch {
    return ymd;
  }
}
const SHELL = "rounded-lg border-l-4 p-6! shadow-sm";
const OVERLINE$1 = "mt-0! mb-1! text-[10px] font-bold tracking-widest text-gray-400 uppercase";
const GscSummaryCard = () => {
  const query = useGscOverviewSummaryQuery();
  const locale = resolveIntlLocale();
  if (query.isPending && !query.isFetching) return null;
  if (query.isLoading || query.data?.state === "pulling") {
    return /* @__PURE__ */ window.wp.element.createElement(SkeletonCard, null);
  }
  if (query.isError || !query.data) return null;
  const data = query.data;
  if (data.state === "not_connected") {
    return /* @__PURE__ */ window.wp.element.createElement(
      TeaserCard,
      {
        cta: window.wp.i18n.__("Connect", "structura"),
        href: "#/channels/store"
      }
    );
  }
  if (data.state === "property_pending") {
    return /* @__PURE__ */ window.wp.element.createElement(
      TeaserCard,
      {
        cta: window.wp.i18n.__("Finish setup", "structura"),
        href: data.connectionId ? `#/channels/connections?configure=${encodeURIComponent(data.connectionId)}` : "#/channels/connections"
      }
    );
  }
  if (data.state === "expired") {
    return /* @__PURE__ */ window.wp.element.createElement(ExpiredCard, { freshThrough: data.freshThrough, locale });
  }
  if (!data.totals28 || data.totals28.clicks === 0) {
    return /* @__PURE__ */ window.wp.element.createElement(CollectingCard, null);
  }
  return /* @__PURE__ */ window.wp.element.createElement(PopulatedCard, { data, locale });
};
const PopulatedCard = ({
  data,
  locale
}) => {
  const totals28 = data.totals28;
  const delta = countDelta(totals28.clicks, data.prev28?.clicks ?? 0, locale);
  const topMover = data.topMover ?? null;
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: B$1(SHELL, "border-l-emerald-500") }, /* @__PURE__ */ window.wp.element.createElement("p", { className: OVERLINE$1 }, window.wp.i18n.__("Search Clicks · 28d", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-baseline gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-3xl! font-black! text-neutral-900 dark:text-white" }, formatMetricCount(totals28.clicks, locale)), delta.label && /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: B$1(
        "rounded-full px-2 py-0.5 text-xs font-medium",
        // Emerald only when positive; flat AND negative render the
        // neutral pill — never red (handoff delta-pill rule).
        delta.tone === "good" ? "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300" : "bg-neutral-100 text-neutral-500 dark:bg-white/[.07] dark:text-neutral-400"
      )
    },
    delta.label
  )), topMover && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-4! mb-0! truncate font-mono text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.sprintf(
    // translators: %1$s is a post title, %2$s is a signed percent like "+31%".
    window.wp.i18n.__("Top mover: “%1$s” %2$s", "structura"),
    topMover.title ?? topMover.url,
    formatMoverDelta(topMover.deltaPercent, locale)
  )), /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: data.portalReportUrl,
      target: "_blank",
      rel: "noreferrer",
      className: "mt-2 inline-flex items-center gap-1 text-xs font-bold text-brand-600 hover:underline dark:text-brand-300"
    },
    window.wp.i18n.__("Full report in your customer portal", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowUpRight, { size: 12, "aria-hidden": true })
  ));
};
function formatMoverDelta(deltaPercent, locale) {
  return new Intl.NumberFormat(locale, {
    style: "percent",
    signDisplay: "always",
    maximumFractionDigits: 0
  }).format(deltaPercent / 100);
}
const TeaserCard = ({ cta, href }) => /* @__PURE__ */ window.wp.element.createElement(Vt, { className: B$1(SHELL, "border-l-neutral-300 dark:border-l-neutral-600") }, /* @__PURE__ */ window.wp.element.createElement("p", { className: OVERLINE$1 }, window.wp.i18n.__("Search Clicks", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-1 flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex! min-w-0 items-center gap-2 text-[13px] text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(GoogleGGlyph, { size: 14, className: "shrink-0" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "truncate" }, window.wp.i18n.__("See your posts' Google Search clicks here.", "structura"))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", href, className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, "aria-hidden": true, className: "mr-1.5" }), cta)));
const CollectingCard = () => /* @__PURE__ */ window.wp.element.createElement(Vt, { className: B$1(SHELL, "border-l-emerald-500") }, /* @__PURE__ */ window.wp.element.createElement("p", { className: OVERLINE$1 }, window.wp.i18n.__("Search Clicks · 28d", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-baseline gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-3xl! font-black! text-neutral-300 dark:text-neutral-600" }, "—")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-4! mb-0! font-mono text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("Collecting — first numbers within a couple of days", "structura")));
const ExpiredCard = ({
  freshThrough,
  locale
}) => {
  const freshDate = freshThrough ? formatShortDate(freshThrough, locale) : null;
  return /* @__PURE__ */ window.wp.element.createElement("section", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-l-4 border-amber-200/70 border-l-amber-500 bg-amber-50/40 p-5 dark:border-amber-900/40 dark:border-l-amber-500 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement(
    TriangleAlert,
    {
      size: 16,
      className: "shrink-0 text-amber-600 dark:text-amber-400",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! min-w-0 flex-1 text-sm text-amber-800 dark:text-amber-200" }, freshDate ? (
    // translators: %s is a date like "Jul 9, 2026".
    window.wp.i18n.sprintf(
      window.wp.i18n.__(
        "Google connection expired — search stats paused %s. Your history is safe.",
        "structura"
      ),
      freshDate
    )
  ) : window.wp.i18n.__(
    "Google connection expired — search stats are paused. Your history is safe.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      href: "#/channels/connections",
      className: "shrink-0"
    },
    /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, "aria-hidden": true }),
    window.wp.i18n.__("Reconnect", "structura")
  ));
};
const SkeletonCard = () => /* @__PURE__ */ window.wp.element.createElement(Vt, { className: B$1(SHELL, "border-l-emerald-500") }, /* @__PURE__ */ window.wp.element.createElement("div", { role: "status" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: OVERLINE$1 }, window.wp.i18n.__("Search Clicks · 28d", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-pulse", "aria-hidden": true }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "h-9 w-24 rounded bg-neutral-100 dark:bg-neutral-800" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-4 h-4 w-40 rounded bg-neutral-100 dark:bg-neutral-800" })), /* @__PURE__ */ window.wp.element.createElement("span", { className: "sr-only" }, window.wp.i18n.__("Loading search data…", "structura"))));
const DISMISS_KEY$2 = "structura-gsc-connect-banner-dismissed";
const GscConnectBanner = () => {
  const { isPaidLicense } = useLicense();
  const query = useGscOverviewSummaryQuery();
  const [dismissed, setDismissed] = window.wp.element.useState(false);
  window.wp.element.useEffect(() => {
    try {
      if (typeof window !== "undefined" && window.localStorage.getItem(DISMISS_KEY$2) === "1") {
        setDismissed(true);
      }
    } catch {
    }
  }, []);
  const dismiss = () => {
    setDismissed(true);
    try {
      window.localStorage.setItem(DISMISS_KEY$2, "1");
    } catch {
    }
  };
  if (!isPaidLicense || dismissed) return null;
  if (query.data?.state !== "not_connected") return null;
  return /* @__PURE__ */ window.wp.element.createElement("section", { className: "flex flex-wrap items-center gap-3 rounded-xl border border-neutral-200 bg-white px-5 py-4 shadow-sm dark:border-neutral-700 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(GoogleGGlyph, { size: 18 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Connect Google Search Console", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-[13px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "See what each post earns from Google Search — free, read-only, and your posts report from day one.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", href: "#/channels/store" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, "aria-hidden": true, className: "mr-1.5" }), window.wp.i18n.__("Connect", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: dismiss,
      "aria-label": window.wp.i18n.__("Dismiss", "structura"),
      className: "flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-600 dark:hover:bg-neutral-800 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(X, { size: 16 })
  )));
};
function selectOwnActivationUsage(cycle, activationId) {
  if (!activationId) return null;
  return cycle.activations.find((a3) => a3.activationId === activationId) ?? null;
}
const useUsageAnalytics = (campaignId) => {
  const { isPaidLicense, hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: ["analytics", "usage", { campaignId }],
    queryFn: async () => {
      const params = new URLSearchParams(
        {}
      );
      const qs = params.toString();
      return window.wp.apiFetch({
        path: `/structura/v1/analytics/usage${qs ? `?${qs}` : ""}`
      });
    },
    enabled: hasUsableLicense === true && !!isPaidLicense,
    staleTime: 1e3 * 60 * 10
  });
};
dayjs.extend(relativeTime$1);
const IntelligenceUsage = () => {
  const { data: usageData, isLoading } = useUsageAnalytics();
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "animate-pulse rounded-lg border-l-4 border-l-gray-200 p-6! shadow-sm dark:border-l-neutral-700 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 h-3 w-24 rounded bg-gray-200 dark:bg-neutral-700" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "h-8 w-48 rounded bg-gray-200 dark:bg-neutral-700" }));
  }
  if (!usageData?.cycleUsage) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "rounded-lg border-l-4 border-l-red-500 p-6! shadow-sm dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-red-600 dark:text-red-400" }, window.wp.i18n.__("Unable to load usage data. Please try again later.", "structura")));
  }
  const cycle = usageData.cycleUsage;
  if (cycle.kind === "managed") return /* @__PURE__ */ window.wp.element.createElement(ManagedCycleCard, { cycle });
  if (cycle.kind === "byok") return /* @__PURE__ */ window.wp.element.createElement(ByokCycleCard, { cycle });
  return /* @__PURE__ */ window.wp.element.createElement(NoneCycleCard, { reason: cycle.reason });
};
const ManagedCycleCard = ({
  cycle
}) => {
  const own = selectOwnActivationUsage(
    cycle,
    typeof window !== "undefined" ? window.structuraConfig?.activation_id : void 0
  );
  const usage = own ?? cycle.workspace;
  const isAtLimit = usage.utilizationPercent >= 100;
  const isNearingLimit = usage.utilizationPercent >= 80 && !isAtLimit;
  const cycleEndsAt = dayjs(cycle.cycleResetsAt);
  return /* @__PURE__ */ window.wp.element.createElement(
    Vt,
    {
      className: B$1(
        "rounded-lg border-l-4 p-6! shadow-sm transition-all duration-500 dark:bg-neutral-900",
        isAtLimit ? "border-l-red-500" : isNearingLimit ? "border-l-amber-500" : "border-l-purple-500"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-end justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[10px] font-bold tracking-widest text-gray-400 uppercase" }, window.wp.i18n.__("Cycle Usage", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[10px] font-medium text-purple-600/60 lowercase italic" }, window.wp.i18n.sprintf(
      /* translators: %s = humanized time until cycle reset, e.g. "in 12 days". */
      window.wp.i18n.__("Resets %s", "structura"),
      cycleEndsAt.fromNow()
    ))), /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "rounded-full px-2 py-0.5 text-[10px] font-bold uppercase",
          isAtLimit ? "bg-red-100 text-red-700" : isNearingLimit ? "bg-amber-100 text-amber-700" : "bg-purple-50 text-purple-700"
        )
      },
      window.wp.i18n.sprintf(
        /* translators: %d = utilization percent, 0–100. */
        window.wp.i18n.__("%d%% Used", "structura"),
        usage.utilizationPercent
      )
    )), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "mt-0! text-3xl font-black tracking-tight text-gray-900 dark:text-white" }, formatTokens$1(usage.tokensUsed), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-gray-400" }, " ", "/", " ", formatTokens$1(usage.tokensIncluded), " ", window.wp.i18n.__("tokens", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative h-2 w-full overflow-hidden rounded-full bg-gray-100 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "h-full rounded-full transition-all duration-1000 ease-out",
          isAtLimit ? "bg-red-500" : isNearingLimit ? "bg-amber-500" : "bg-purple-500"
        ),
        style: { width: `${Math.min(100, usage.utilizationPercent)}%` }
      }
    )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-gray-400" }, window.wp.i18n.sprintf(
      /* translators: 1: images used, 2: images included */
      window.wp.i18n.__("%1$d / %2$d images this cycle", "structura"),
      usage.imagesUsed,
      usage.imagesIncluded
    )))
  );
};
function formatTokens$1(n2) {
  if (n2 >= 1e6) {
    return (n2 / 1e6).toFixed(n2 >= 1e7 ? 0 : 1).replace(/\.0$/, "") + "M";
  }
  if (n2 >= 1e3) {
    return (n2 / 1e3).toFixed(n2 >= 1e4 ? 0 : 1).replace(/\.0$/, "") + "K";
  }
  return n2.toLocaleString();
}
const ByokCycleCard = ({
  cycle
}) => {
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "rounded-lg border-l-4 border-l-brand-500 p-6! shadow-sm dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-1! text-[10px] font-bold tracking-widest text-gray-400 uppercase" }, window.wp.i18n.__("Cycle Usage", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-baseline gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-3xl! font-black! text-neutral-900 dark:text-white" }, cycle.postsUsed.toLocaleString()), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm text-gray-400" }, window.wp.i18n.__("posts this cycle", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded-full bg-brand-50 px-2 py-0.5 text-xs font-medium text-brand-600 dark:bg-brand-900/30 dark:text-brand-300" }, window.wp.i18n.__("BYOK", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-4! mb-0! font-mono text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.sprintf(
    /* translators: 1: token count, 2: image count. */
    window.wp.i18n.__("%1$s tokens · %2$s images this cycle", "structura"),
    cycle.tokensUsed.toLocaleString(),
    cycle.imagesUsed.toLocaleString()
  )));
};
const NoneCycleCard = ({ reason: _reason }) => {
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "rounded-lg border-l-4 border-l-gray-300 p-6! shadow-sm dark:border-l-neutral-700 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[10px] font-bold tracking-widest text-gray-400 uppercase" }, window.wp.i18n.__("Cycle Usage", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-sm text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Connect a license to start tracking your monthly usage.",
    "structura"
  )));
};
const campaignStatusLabel = (status) => {
  switch (status) {
    case "active":
      return window.wp.i18n.__("Active", "structura");
    case "paused":
      return window.wp.i18n.__("Paused", "structura");
    case "completed":
      return window.wp.i18n.__("Completed", "structura");
    default:
      return String(status);
  }
};
const postStatusLabel = (status) => {
  switch (status) {
    case "publish":
      return window.wp.i18n.__("Published", "structura");
    case "draft":
    // "pending" was removed as a campaign option (2026-07-09); a legacy
    // persisted value reads as a draft (which is how WP treated it).
    case "pending":
      return window.wp.i18n.__("Draft", "structura");
    case "future":
      return window.wp.i18n.__("Scheduled", "structura");
    case "private":
      return window.wp.i18n.__("Private", "structura");
    case "trash":
      return window.wp.i18n.__("Trash", "structura");
    default:
      return String(status);
  }
};
const jobStatusLabel = (status) => {
  switch (status) {
    case "pending":
      return window.wp.i18n.__("Pending", "structura");
    case "generating":
      return window.wp.i18n.__("Generating", "structura");
    case "published":
      return window.wp.i18n.__("Published", "structura");
    case "failed":
      return window.wp.i18n.__("Failed", "structura");
    default:
      return String(status);
  }
};
const ActiveQueue = ({ jobs }) => {
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden p-0! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-gray-100 bg-white px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-xs font-bold tracking-widest text-gray-900 uppercase" }, /* @__PURE__ */ window.wp.element.createElement(CalendarClock, { className: "h-4 w-4 text-amber-500" }), window.wp.i18n.__("Active Generation Queue", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-bold text-gray-400 uppercase" }, window.wp.i18n.sprintf(window.wp.i18n.__("%d Tasks Remaining", "structura"), jobs.length))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "overflow-x-auto" }, /* @__PURE__ */ window.wp.element.createElement("table", { className: "w-full text-left text-sm" }, /* @__PURE__ */ window.wp.element.createElement("thead", { className: "border-b border-gray-100 bg-gray-50 text-[10px] font-bold tracking-widest text-gray-400 uppercase" }, /* @__PURE__ */ window.wp.element.createElement("tr", null, /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-4" }, window.wp.i18n.__("Blueprint Topic", "structura")), /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-4" }, window.wp.i18n.__("Intelligence", "structura")), /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-4" }, window.wp.i18n.__("Status", "structura")), /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-4 text-right" }, window.wp.i18n.__("Scheduled", "structura")))), /* @__PURE__ */ window.wp.element.createElement("tbody", { className: "divide-y divide-gray-100" }, jobs.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("tr", null, /* @__PURE__ */ window.wp.element.createElement("td", { colSpan: 4, className: "px-6 py-12 text-center text-xs text-gray-400 italic" }, window.wp.i18n.__("Queue is currently empty.", "structura"))) : jobs.map((item) => /* @__PURE__ */ window.wp.element.createElement("tr", { key: item.id, className: "transition-colors hover:bg-amber-50/30" }, /* @__PURE__ */ window.wp.element.createElement("td", { className: "px-6 py-4 font-bold text-gray-900" }, item.campaign_name), /* @__PURE__ */ window.wp.element.createElement("td", { className: "px-6 py-4 font-mono text-[10px] text-gray-500" }, item.model_slug), /* @__PURE__ */ window.wp.element.createElement("td", { className: "px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "info" }, jobStatusLabel(item.status))), /* @__PURE__ */ window.wp.element.createElement("td", { className: "px-6 py-4 text-right text-xs font-medium text-gray-500" }, item.formatted_date)))))));
};
const useRecentPostsQuery = () => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: ["dashboard", "recent-posts"],
    queryFn: async () => {
      const res = await window.wp.apiFetch({
        path: "/structura/v1/analytics/recent-blueprints"
      });
      return res.data;
    },
    enabled: hasUsableLicense === true,
    // Data remains "fresh" for 2 minutes to reduce DB load on the home page
    staleTime: 1e3 * 60 * 2,
    // Keep in cache for 10 minutes
    gcTime: 1e3 * 60 * 10,
    // Optionally retry once if the WP REST API is temporarily busy
    retry: 1
  });
};
const RecentBlueprints = () => {
  const { data: posts = [], isLoading } = useRecentPostsQuery();
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden p-0! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-gray-100 bg-white px-6 py-4 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-xs font-bold tracking-widest text-gray-900 uppercase dark:text-white" }, /* @__PURE__ */ window.wp.element.createElement(PanelsTopLeft, { className: "text-brand-600 dark:text-brand-400 h-4 w-4" }), window.wp.i18n.__("Recently Architected", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "overflow-x-auto" }, /* @__PURE__ */ window.wp.element.createElement("table", { className: "w-full text-left text-sm" }, /* @__PURE__ */ window.wp.element.createElement("thead", { className: "border-b border-gray-100 bg-gray-50 text-[10px] font-bold tracking-widest text-gray-400 uppercase dark:border-neutral-700 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("tr", null, /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-3" }, window.wp.i18n.__("Blueprint / Topic", "structura")), /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-3" }, window.wp.i18n.__("Persona", "structura")), /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-3" }, window.wp.i18n.__("Intelligence", "structura")), /* @__PURE__ */ window.wp.element.createElement("th", { className: "px-6 py-3 text-right" }, window.wp.i18n.__("Actions", "structura")))), /* @__PURE__ */ window.wp.element.createElement("tbody", { className: "divide-y divide-gray-100 dark:divide-neutral-800" }, posts.length === 0 && !isLoading ? /* @__PURE__ */ window.wp.element.createElement("tr", null, /* @__PURE__ */ window.wp.element.createElement("td", { colSpan: 4, className: "px-6 py-12 text-center text-xs text-gray-400 italic" }, window.wp.i18n.__("No blueprints found in the database.", "structura"))) : posts.map((post) => /* @__PURE__ */ window.wp.element.createElement(
    "tr",
    {
      key: post.id,
      className: "transition-colors hover:bg-gray-50 dark:hover:bg-neutral-800/50"
    },
    /* @__PURE__ */ window.wp.element.createElement("td", { className: "px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-gray-200 bg-gray-100 dark:border-neutral-700 dark:bg-neutral-800" }, post.thumbnail ? /* @__PURE__ */ window.wp.element.createElement("img", { src: post.thumbnail, className: "h-full w-full object-cover", alt: "" }) : /* @__PURE__ */ window.wp.element.createElement(FileText, { className: "h-4 w-4 text-gray-400" })), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "leading-tight font-bold text-gray-900 dark:text-white" }, post.title, post.status !== "publish" && /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2 rounded bg-amber-100 px-1 text-[8px] font-black text-amber-700 uppercase" }, postStatusLabel(post.status))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-0.5 font-mono text-[10px] text-gray-400 uppercase" }, post.date)))),
    /* @__PURE__ */ window.wp.element.createElement("td", { className: "min-w-30 px-6 py-4" }, post.author),
    /* @__PURE__ */ window.wp.element.createElement("td", { className: "px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "indigo" }, post.model)),
    /* @__PURE__ */ window.wp.element.createElement("td", { className: "px-6 py-4 text-right" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-end gap-1" }, /* @__PURE__ */ window.wp.element.createElement(ce, { title: window.wp.i18n.__("Edit Post", "structura") }, /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: post.edit_link,
        className: "hover:text-brand-600! dark:hover:text-brand-400! p-2 text-gray-400! transition dark:text-neutral-500!"
      },
      /* @__PURE__ */ window.wp.element.createElement(PenLine, { className: "h-4 w-4" })
    )), post.status === "publish" && /* @__PURE__ */ window.wp.element.createElement(ce, { title: window.wp.i18n.__("View Live", "structura") }, /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: post.permalink,
        target: "_blank",
        rel: "noreferrer",
        className: "p-2 text-gray-400! transition hover:text-emerald-600! dark:text-neutral-500!"
      },
      /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-4 w-4" })
    ))))
  ))))));
};
const progressKeys = {
  all: ["progress"],
  run: (runId) => [...progressKeys.all, "run", runId],
  /**
   * Cache key for the Campaign detail "Runs" tab — one entry per campaign.
   * Invalidation happens when the user re-opens the tab or when a run that
   * started from this campaign terminates (the inline strip invalidates
   * this key on terminal status so the tab refreshes without a manual
   * refetch).
   */
  campaignRuns: (campaignId) => [...progressKeys.all, "campaignRuns", campaignId],
  /**
   * Cache key for the SPA refresh-recovery query — "which runs are
   * currently in flight ANYWHERE on this site?". Feeds the
   * `RunsProvider`-level rehydration hook that repopulates
   * `RunsContext.activeRunId` after a page reload. Single-entry
   * (no scoping argument) because this is a per-site question.
   */
  activeRuns: () => [...progressKeys.all, "activeRuns"],
  /**
   * Cache key for the dashboard "Recent generations" widget — lists the
   * most recent ephemeral runs (one-off `/generate` submissions). The
   * generate-post mutation invalidates this key on success so a brand-
   * new submission appears at the top of the widget without waiting for
   * the next poll tick.
   */
  singlePostRuns: () => [...progressKeys.all, "singlePostRuns"]
};
const REFETCH_INTERVAL_MS$2 = 3e4;
const useActiveRunsQuery = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: progressKeys.activeRuns(),
    enabled: hasWorkspace === true,
    // Opt out of the global QueryCache `onError` toast. Refresh-recovery
    // is a best-effort convenience: a cloud blip here shouldn't surface
    // a red toast on every SPA mount — the worst case is "the strip
    // doesn't light up automatically", which the user can resolve by
    // navigating to the campaign view (the per-run poll will still
    // work).
    meta: { silentError: true },
    queryFn: async () => {
      return window.wp.apiFetch({
        path: `/structura/v1/runs/active?limit=10`
      });
    },
    // Pause polling when there are no in-flight rows. The hook is
    // mounted for the full SPA lifetime via `RunsProvider`; polling
    // an empty list every 30s would be pure waste. The generate-now
    // mutation invalidates this key, so a brand-new run reloads the
    // cache immediately without waiting for the next tick.
    refetchInterval: (query) => {
      const data = query.state.data;
      if (!data || data.length === 0) return false;
      return REFETCH_INTERVAL_MS$2;
    },
    // No automatic retry — see the meta.silentError rationale. A
    // transient blip gets picked up on the next poll once any row is
    // seen, and navigating into a specific campaign's detail view
    // still populates the context via the Generate-Now mutation or
    // the campaign-scoped query.
    retry: false,
    // Treat the list as fresh for a full poll interval — re-mounting
    // the provider (e.g. a React Fast Refresh cycle) shouldn't trigger
    // an immediate refetch.
    staleTime: REFETCH_INTERVAL_MS$2
  });
};
const useRehydrateActiveRun = () => {
  const { activeRunId, setActiveRun } = useRuns();
  const { data } = useActiveRunsQuery();
  window.wp.element.useEffect(() => {
    if (activeRunId) return;
    if (!data || data.length === 0) return;
    const inflight = data[0];
    if (!inflight) return;
    setActiveRun({
      runId: inflight.runId,
      campaignId: inflight.campaignId
    });
  }, [activeRunId, data, setActiveRun]);
};
const RunsContext = window.wp.element.createContext(null);
const RunsProvider = ({ children }) => {
  const [active, setActive] = window.wp.element.useState(null);
  const setActiveRun = window.wp.element.useCallback(
    (run) => setActive(run),
    []
  );
  const dismiss = window.wp.element.useCallback(() => setActive(null), []);
  const value = window.wp.element.useMemo(
    () => ({
      activeRunId: active?.runId ?? null,
      activeCampaignId: active?.campaignId ?? null,
      setActiveRun,
      dismiss
    }),
    [active, setActiveRun, dismiss]
  );
  return /* @__PURE__ */ window.wp.element.createElement(RunsContext.Provider, { value }, /* @__PURE__ */ window.wp.element.createElement(RehydrationGate, null), children);
};
const RehydrationGate = () => {
  useRehydrateActiveRun();
  return null;
};
const NOOP_RUNS_VALUE = Object.freeze({
  activeRunId: null,
  activeCampaignId: null,
  setActiveRun: () => {
  },
  dismiss: () => {
  }
});
const useRuns = () => {
  return window.wp.element.useContext(RunsContext) ?? NOOP_RUNS_VALUE;
};
const NON_TERMINAL_STATUSES$2 = /* @__PURE__ */ new Set(["queued", "running", "awaiting_pull"]);
const TERMINAL_STATUSES$1 = /* @__PURE__ */ new Set([
  "succeeded",
  "succeeded_with_warnings",
  "failed",
  "cancelled"
]);
const POLL_FAST_MS = 1e3;
const POLL_SLOW_MS = 5e3;
const POLL_BACKOFF_AFTER_MS = 6e4;
const MAX_POLL_ATTEMPTS_BEFORE_GIVEUP = 30;
const useCampaignRunQuery = (runId) => {
  const { hasWorkspace } = useLicense();
  let slowPollAttemptCount = 0;
  return useQuery({
    queryKey: runId ? progressKeys.run(runId) : progressKeys.all,
    enabled: hasWorkspace === true && Boolean(runId),
    // Opt out of the global QueryCache `onError` toast. The progress
    // poll is expected to 404 in two normal cases: (a) the brief window
    // between Generate-Now returning a runId and Action Scheduler firing
    // the cloud dispatcher (up to ~10s while the async job is queued),
    // and (b) after the 24h run-doc TTL. In both cases the inline
    // `CampaignRunProgress` strip already handles the missing data
    // gracefully — showing "Starting…" during (a) and silently
    // disappearing after (b) — so the global red "Data Fetch Error:
    // run_not_found" toast is pure noise and used to storm the screen
    // with one toast per 1s poll. Silencing here keeps the strip's own
    // placeholder / receipt as the single source of truth.
    meta: { silentError: true },
    queryFn: async () => {
      if (!runId) {
        throw new Error("useCampaignRunQuery called without a runId");
      }
      return window.wp.apiFetch({
        path: `/structura/v1/runs/${encodeURIComponent(runId)}`
      });
    },
    // Terminal status freezes the query — return false to stop polling.
    // Non-terminal status keeps polling at 1s, slowing to 5s after 60s
    // of no status change (spec §7.3 back-off). After 30 slow attempts
    // (150s total) AT THE QUEUED STAGE, auto-cancel — the dispatch
    // never reached the cloud and the user shouldn't watch a phantom
    // run forever.
    refetchInterval: (query) => {
      const data = query.state.data;
      if (!data?.run) {
        return POLL_FAST_MS;
      }
      const status = data.run.status;
      if (TERMINAL_STATUSES$1.has(status)) return false;
      if (!NON_TERMINAL_STATUSES$2.has(status)) return false;
      const updatedAt = Date.parse(data.run.updatedAt);
      const isStale2 = Number.isFinite(updatedAt) && Date.now() - updatedAt > POLL_BACKOFF_AFTER_MS;
      if (isStale2 && status === "queued") {
        slowPollAttemptCount++;
        if (slowPollAttemptCount >= MAX_POLL_ATTEMPTS_BEFORE_GIVEUP) {
          void window.wp.apiFetch({
            path: "/structura/v1/scheduler/runs/cancel",
            method: "POST",
            data: {
              run_id: runId,
              cancelled_by: "system",
              cancel_reason: "Run did not start within 150 seconds"
            }
          }).catch(() => {
          });
          return false;
        }
        return POLL_SLOW_MS;
      }
      if (isStale2) return POLL_SLOW_MS;
      return POLL_FAST_MS;
    },
    // 404 from TTL / kill-switch is a terminal condition — no point
    // retrying. Other transport errors get one retry on the 2-second
    // poll cadence anyway.
    retry: false,
    // Keep the last-good value visible after status becomes terminal
    // so the drawer can show the receipt indefinitely until dismissed.
    staleTime: Infinity
  });
};
const MILESTONE_HEADLINES = {
  queued: () => window.wp.i18n.__("Queued — starting soon", "structura"),
  // Stock-served runs only. The cloud holds the run in this state
  // while the dispatcher consumes the next ready entry from the
  // campaign's stock buffer. See functions/src/stock/serve.ts.
  stock_check: () => window.wp.i18n.__("Pulling pre-generated draft", "structura"),
  research: () => window.wp.i18n.__("Researching your topic", "structura"),
  competitor_analysis: () => window.wp.i18n.__("Analyzing top-ranking competitors", "structura"),
  authority: () => window.wp.i18n.__("Finding authoritative sources", "structura"),
  outlining: () => window.wp.i18n.__("Planning the outline", "structura"),
  drafting: () => window.wp.i18n.__("Writing the draft", "structura"),
  link_validation: () => window.wp.i18n.__("Validating links", "structura"),
  // Legacy single-bucket label. Runs created before 2026-05-22
  // stamped `images` as one milestone; we still render their
  // duration here on the run-detail view. New runs split into
  // image_featured + image_body below.
  images: () => window.wp.i18n.__("Generating images", "structura"),
  image_featured: () => window.wp.i18n.__("Generating featured image", "structura"),
  image_body: () => window.wp.i18n.__("Generating body image", "structura"),
  assembling: () => window.wp.i18n.__("Assembling the final post", "structura"),
  publishing: () => window.wp.i18n.__("Publishing to WordPress", "structura"),
  channels: () => window.wp.i18n.__("Sharing to channels", "structura"),
  done: () => window.wp.i18n.__("Post published", "structura"),
  error: () => window.wp.i18n.__("Generation stopped", "structura")
};
const MILESTONE_SUBTEXTS = {
  queued: () => window.wp.i18n.__("Reserving a spot in the queue", "structura"),
  stock_check: () => window.wp.i18n.__("From your campaign's stock buffer", "structura"),
  research: () => window.wp.i18n.__("Expanding keywords and intent", "structura"),
  competitor_analysis: () => window.wp.i18n.__("Studying the pages you're up against", "structura"),
  authority: () => window.wp.i18n.__("Vetting references worth citing", "structura"),
  outlining: () => window.wp.i18n.__("Ordering for flow and SEO", "structura"),
  drafting: () => void 0,
  link_validation: () => window.wp.i18n.__("Checking that every link the AI wrote actually resolves", "structura"),
  images: () => void 0,
  image_featured: () => window.wp.i18n.__("The post's hero visual", "structura"),
  image_body: () => window.wp.i18n.__("Inline visual that breaks up the copy", "structura"),
  assembling: () => window.wp.i18n.__("Stitching copy, images, metadata", "structura"),
  publishing: () => window.wp.i18n.__("Pushing the post into WordPress", "structura"),
  channels: () => window.wp.i18n.__("LinkedIn, Slack, IndexNow, and the rest", "structura"),
  done: () => void 0,
  error: () => void 0
};
const MILESTONE_ORDER = [
  "queued",
  "stock_check",
  "research",
  // Research sub-phases — only emitted on paid runs where the work runs
  // (Pro-gated in the cloud's `gatherResearch`). Hidden on Free tier via
  // FREE_TIER_HIDDEN_MILESTONES, same as `research`/`link_validation`.
  "competitor_analysis",
  "authority",
  "outlining",
  "drafting",
  "link_validation",
  // Legacy single-bucket `images` deliberately omitted from the
  // visible order on new runs — its slot is taken by the per-image
  // milestones below. Old runs (created before 2026-05-22) that
  // stamped `images` instead still render correctly on the
  // run-detail page: the per-step duration chip resolver checks
  // `stepDurationsMs.images` and the headline resolver maps the
  // id through `MILESTONE_HEADLINES.images`. The cost of the gap
  // is one less row on those archived runs — acceptable.
  "image_featured",
  "image_body",
  "assembling",
  "publishing",
  // Channels fan-out runs after the post is inserted into WordPress.
  // The run is technically `succeeded` before this step starts; the
  // dispatcher patches `stepDurationsMs.channels` + `channelsResolvedCount`
  // post-hoc. Showing it on the timeline closes the loop visually so
  // the user sees the full story end-to-end instead of stopping at
  // "Publishing to WordPress" while the dispatcher is still running.
  "channels"
];
const STOCK_MILESTONE_ORDER = [
  "queued",
  "stock_check",
  "publishing",
  // Same post-publish fan-out as the sync flow — stock-served runs
  // also trip the `structura/post/inserted` hook and reach the
  // dispatcher. See `MILESTONE_ORDER` for the full rationale.
  "channels"
];
const milestoneOrderForFlow = (flow) => flow === "stock" ? STOCK_MILESTONE_ORDER : MILESTONE_ORDER;
const FREE_TIER_HIDDEN_MILESTONES = /* @__PURE__ */ new Set([
  "research",
  // Both research sub-phases are Pro-gated in `gatherResearch` (the
  // effective rule set drops Pro rules for free/none), so they never
  // run — and never get emitted — on Free. Hiding them keeps the
  // timeline honest, same rationale as `research` above.
  "competitor_analysis",
  "authority",
  "link_validation"
]);
const milestoneOrderForFlowAndTier = (flow, isPaidTier) => {
  const base = milestoneOrderForFlow(flow);
  if (isPaidTier) return base;
  return base.filter((m3) => !FREE_TIER_HIDDEN_MILESTONES.has(m3));
};
const milestoneHeadline = (m3, postStatus = "publish") => {
  if (postStatus === "draft") {
    if (m3 === "publishing") return window.wp.i18n.__("Saving to WordPress", "structura");
    if (m3 === "done") return window.wp.i18n.__("Draft saved", "structura");
  }
  const resolver = MILESTONE_HEADLINES[m3];
  if (!resolver) {
    return window.wp.i18n.__("Working on your post", "structura");
  }
  return resolver();
};
const resolveRunPostStatus = (run) => {
  const actual = run.outputs?.post?.status;
  if (actual === "draft") return "draft";
  if (actual === "publish") return "publish";
  const inputs = run.inputSnapshot;
  const requested = inputs?.structure?.postStatus;
  if (requested === "draft" || requested === "pending") return "draft";
  return "publish";
};
const milestoneSubtext = (m3, postStatus = "publish") => {
  if (postStatus === "draft" && m3 === "publishing") {
    return window.wp.i18n.__("Saving the draft to WordPress", "structura");
  }
  const resolver = MILESTONE_SUBTEXTS[m3];
  if (!resolver) return void 0;
  return resolver();
};
const MILESTONE_ICONS = {
  queued: Timer,
  stock_check: PackageOpen,
  research: Search,
  competitor_analysis: Telescope,
  authority: BookOpenCheck,
  outlining: PanelsTopLeft,
  drafting: PenTool,
  link_validation: Link2,
  images: Image,
  image_featured: Image,
  image_body: Image,
  assembling: Layers,
  publishing: Globe,
  channels: Share2,
  done: CircleCheck,
  error: TriangleAlert
};
const milestoneIcon = (m3) => MILESTONE_ICONS[m3] ?? Timer;
const formatDuration = (ms) => {
  const totalSeconds = Math.max(0, Math.round(ms / 1e3));
  const minutes = Math.floor(totalSeconds / 60);
  const seconds = totalSeconds % 60;
  if (minutes === 0) {
    return window.wp.i18n.sprintf(window.wp.i18n.__("%ds", "structura"), seconds);
  }
  return window.wp.i18n.sprintf(window.wp.i18n.__("%1$dm %2$ds", "structura"), minutes, seconds);
};
const SKIP_INFERENCE_EXEMPT = /* @__PURE__ */ new Set(["queued", "publishing"]);
const IMAGE_MILESTONE_SLOT = {
  image_featured: "featured",
  image_body: "body"
};
function imageSlotFailed(run, milestone) {
  const slot = IMAGE_MILESTONE_SLOT[milestone];
  if (!slot) return false;
  return (run.outputs?.imageFailures ?? []).some((f2) => f2.slot === slot);
}
const TIER_LOCK_LABELS = {
  // Pre-generation only runs for scheduled campaigns; campaigns are
  // a Free-License-and-up feature, but the more honest framing on a
  // single-post run is "this is what you'd get with a Pro/scheduled
  // setup," matching the Yurii copy direction (2026-05-10).
  stock_check: "Pro",
  // Featured images unlock at Free License; body images unlock at
  // Pro. The single badge has to pick one — Free License is the
  // strictly accurate floor (the more-restrictive Pro requirement
  // for body images shows on the GeneratePostPage block toggles).
  //
  // Legacy `images` retained for archived runs; new per-slot
  // milestones below carry their own floor. Featured image is the
  // Free License floor; body image is the Pro floor.
  images: "Free License",
  image_featured: "Free License",
  image_body: "Pro",
  // The `link_validation` server-side rule lives in the BYOK / Cloud /
  // Cloud Pro `ALWAYS_ON_RULES_BY_TIER` lists — Free + None never
  // run it. Pro is the floor.
  link_validation: "Pro",
  // Channels (the Integrations Store) is a paid-tier feature — the
  // cloud's `requireChannelsEntitlement` gate rejects Free / None
  // calls outright. Showing the locked chip on these tiers
  // doubles as the upgrade-path teaser.
  channels: "Pro"
};
function resolveInapplicableMilestones(run, isPaidLicense, isLicensed) {
  const tierConditional = /* @__PURE__ */ new Set();
  const alwaysFiltered = /* @__PURE__ */ new Set();
  const isSinglePost = run.isEphemeral === true || run.campaignId === 0 || run.campaignId === "";
  if (isSinglePost) {
    tierConditional.add("stock_check");
  }
  const isNone = !isLicensed;
  const snapshot = run.inputSnapshot;
  const featuredField = snapshot?.structure?.featuredImage;
  const bodyField = snapshot?.structure?.bodyImages;
  if (isNone) {
    tierConditional.add("image_featured");
    tierConditional.add("image_body");
  } else if (!isPaidLicense) {
    tierConditional.add("image_body");
    if (featuredField === false) {
      alwaysFiltered.add("image_featured");
    }
  } else {
    if (featuredField === false) {
      alwaysFiltered.add("image_featured");
    }
    if (bodyField === false) {
      alwaysFiltered.add("image_body");
    }
  }
  alwaysFiltered.add("images");
  if (!isPaidLicense) {
    const linkRulesOn = snapshot?.intelligence?.seoRules?.outbound_link_authority === true || snapshot?.intelligence?.seoRules?.internal_link_optimization === true;
    const linkValidationRecorded = run.stepDurationsMs?.link_validation != null;
    if (!linkValidationRecorded && !linkRulesOn) {
      tierConditional.add("link_validation");
    }
    tierConditional.add("channels");
  }
  return { tierConditional, alwaysFiltered };
}
function resolveCurrentIndexForRender(run, milestoneOrder) {
  const direct = milestoneOrder.indexOf(run.currentStep);
  if (direct !== -1) return direct;
  if (run.status === "failed" && run.failedAtStep) {
    const explicit = milestoneOrder.indexOf(run.failedAtStep);
    if (explicit !== -1) return explicit;
  }
  const durations = run.stepDurationsMs ?? {};
  for (let i2 = milestoneOrder.length - 1; i2 >= 0; i2 -= 1) {
    if (durations[milestoneOrder[i2]] != null) {
      if (run.status === "failed") return i2;
      return Math.min(milestoneOrder.length - 1, i2 + 1);
    }
  }
  return -1;
}
function stateFor(index2, currentIndex, run, milestoneOrder, tierLocked) {
  const milestone = milestoneOrder[index2];
  if (tierLocked.has(milestone)) return "tier_locked";
  if (run.status === "failed" || run.status === "cancelled") {
    if (currentIndex === -1) return "not_reached";
    if (index2 === currentIndex) return run.status === "failed" ? "failed" : "cancelled";
    return index2 < currentIndex ? "done" : "not_reached";
  }
  if (run.status === "succeeded" || run.status === "succeeded_with_warnings") {
    const hasDuration = run.stepDurationsMs?.[milestone] != null;
    if (!hasDuration && !SKIP_INFERENCE_EXEMPT.has(milestone)) {
      return "skipped";
    }
    if (milestone === "channels" && (run.outputs?.channelsSummary?.failed?.length ?? 0) > 0) {
      return "warning";
    }
    if (imageSlotFailed(run, milestone)) return "warning";
    return "done";
  }
  if (currentIndex === -1 || index2 === -1) return "not_reached";
  if (index2 < currentIndex) return "done";
  if (index2 > currentIndex) return "not_reached";
  return "active";
}
function useActiveStepElapsedMs(run) {
  const isInFlight = run.status === "queued" || run.status === "running";
  const [now, setNow] = window.wp.element.useState(() => Date.now());
  window.wp.element.useEffect(() => {
    if (!isInFlight) return;
    const id = window.setInterval(() => setNow(Date.now()), 1e3);
    return () => window.clearInterval(id);
  }, [isInFlight]);
  if (!isInFlight) return void 0;
  const startedAtMs = Date.parse(run.startedAt);
  if (!Number.isFinite(startedAtMs)) return void 0;
  const completedTotal = Object.values(run.stepDurationsMs ?? {}).reduce(
    (sum, ms) => sum + (typeof ms === "number" ? ms : 0),
    0
  );
  return Math.max(0, now - startedAtMs - completedTotal);
}
const RunTimeline = ({
  run,
  density = "standard",
  className,
  withCard = true
}) => {
  const { isPaidLicense, isLicensed } = useLicense();
  const isPaid = !!isPaidLicense;
  const baseOrder = milestoneOrderForFlowAndTier(run.flow, isPaid);
  const { tierConditional, alwaysFiltered } = resolveInapplicableMilestones(
    run,
    isPaid,
    !!isLicensed
  );
  const milestoneOrder = baseOrder.filter((m3) => !alwaysFiltered.has(m3)).filter((m3) => isPaid ? !tierConditional.has(m3) : true);
  const tierLocked = isPaid ? /* @__PURE__ */ new Set() : tierConditional;
  const currentIndex = resolveCurrentIndexForRender(run, milestoneOrder);
  const activeElapsedMs = useActiveStepElapsedMs(run);
  const isCompact = density === "compact";
  const isTerminalSuccess = run.status === "succeeded" || run.status === "succeeded_with_warnings";
  const isFailed = run.status === "failed";
  const isCancelled = run.status === "cancelled";
  const postStatus = resolveRunPostStatus(run);
  const fillHeightPercent = isTerminalSuccess ? 100 : currentIndex === -1 ? 0 : currentIndex / Math.max(1, milestoneOrder.length - 1) * 100;
  const redSegmentStartPercent = isFailed && currentIndex > 0 ? (currentIndex - 1) / Math.max(1, milestoneOrder.length - 1) * 100 : 0;
  const railWrapperRef = window.wp.element.useRef(null);
  const listRef = window.wp.element.useRef(null);
  const [railHeightPx, setRailHeightPx] = window.wp.element.useState(null);
  window.wp.element.useLayoutEffect(() => {
    const measure = () => {
      const railEl = railWrapperRef.current;
      const listEl = listRef.current;
      if (!railEl || !listEl) return;
      const avatars = listEl.querySelectorAll("[data-avatar]");
      if (avatars.length === 0) return;
      const lastAvatar = avatars[avatars.length - 1];
      if (!lastAvatar) return;
      const railTop = railEl.getBoundingClientRect().top;
      const avatarRect = lastAvatar.getBoundingClientRect();
      const avatarCenter = avatarRect.top + avatarRect.height / 2;
      setRailHeightPx(Math.max(0, Math.floor(avatarCenter - railTop)));
    };
    measure();
    if (typeof ResizeObserver === "undefined") return;
    const ro = new ResizeObserver(measure);
    if (railWrapperRef.current) ro.observe(railWrapperRef.current);
    if (listRef.current) ro.observe(listRef.current);
    return () => ro.disconnect();
  }, [milestoneOrder.length, run.status]);
  const stepper = /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      ref: railWrapperRef,
      "aria-hidden": true,
      className: B$1(
        "absolute w-0.5",
        isCompact ? "top-[14px] left-3.25" : "top-[18px] left-4.25",
        // Only the bottom-* utility is conditional — when the
        // measurement is available we drop it and the inline
        // `height` style takes over.
        railHeightPx === null && (isCompact ? "bottom-[14px]" : "bottom-[18px]")
      ),
      style: railHeightPx !== null ? { height: railHeightPx } : void 0
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "absolute inset-0 bg-neutral-100 dark:bg-neutral-800" }),
    /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "absolute top-0 left-0 w-full origin-top transition-[height] duration-1000 ease-out",
          isCancelled ? "bg-amber-500/70" : "bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]"
        ),
        style: {
          height: `${isFailed ? redSegmentStartPercent : fillHeightPercent}%`
        }
      }
    ),
    isFailed && /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: "absolute left-0 w-full origin-top bg-red-500/70 transition-[height] duration-1000 ease-out",
        style: {
          top: `${redSegmentStartPercent}%`,
          height: `${Math.max(0, fillHeightPercent - redSegmentStartPercent)}%`
        }
      }
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    "ol",
    {
      ref: listRef,
      className: B$1("relative ml-0! list-none!", isCompact ? "space-y-4!" : "space-y-6!")
    },
    milestoneOrder.map((milestone, index2) => {
      const state = stateFor(index2, currentIndex, run, milestoneOrder, tierLocked);
      const elapsedMs = state === "active" ? activeElapsedMs : run.stepDurationsMs?.[milestone];
      const channelsCount = milestone === "channels" && typeof run.channelsResolvedCount === "number" ? run.channelsResolvedCount : void 0;
      const channelsFailed = milestone === "channels" ? run.outputs?.channelsSummary?.failed ?? [] : [];
      const warningMessage = state !== "warning" ? void 0 : channelsFailed.length > 0 ? window.wp.i18n.sprintf(
        window.wp.i18n.__("Couldn't post to %s", "structura"),
        channelsFailed.join(", ")
      ) : imageSlotFailed(run, milestone) ? window.wp.i18n.__("Couldn't generate this image", "structura") : void 0;
      return /* @__PURE__ */ window.wp.element.createElement(
        TimelineRow,
        {
          key: milestone,
          milestoneId: milestone,
          postStatus,
          state,
          density,
          elapsedMs,
          errorUserMessage: state === "failed" ? run.error?.userMessage : void 0,
          warningMessage,
          tierLockLabel: state === "tier_locked" ? TIER_LOCK_LABELS[milestone] : void 0,
          channelsResolvedCount: channelsCount
        }
      );
    })
  ));
  if (!withCard) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className }, stepper);
  }
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "relative overflow-hidden rounded-2xl border border-neutral-300/50 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-900",
        isCompact ? "p-5" : "p-6",
        className
      )
    },
    /* @__PURE__ */ window.wp.element.createElement(SectionLabel, null, window.wp.i18n.__("Process Timeline", "structura")),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: isCompact ? "mt-5" : "mt-8" }, stepper)
  );
};
const SectionLabel = ({ children }) => /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! flex! items-center gap-2 text-[10px] font-black tracking-[0.2em] text-neutral-400 uppercase" }, /* @__PURE__ */ window.wp.element.createElement(
  "svg",
  {
    width: "14",
    height: "14",
    viewBox: "0 0 24 24",
    fill: "none",
    stroke: "currentColor",
    strokeWidth: "2",
    strokeLinecap: "round",
    strokeLinejoin: "round",
    "aria-hidden": true
  },
  /* @__PURE__ */ window.wp.element.createElement("path", { d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.5.5 0 0 1-.96 0L9.68 3.18a.5.5 0 0 0-.96 0l-2.35 8.36A2 2 0 0 1 4.44 13H2" })
), children);
const TimelineRow = ({
  milestoneId,
  postStatus,
  state,
  density,
  elapsedMs,
  errorUserMessage,
  warningMessage,
  tierLockLabel,
  channelsResolvedCount
}) => {
  const isDone = state === "done";
  const isActive = state === "active";
  const isFailed = state === "failed";
  const isCancelled = state === "cancelled";
  const isWarning = state === "warning";
  const isNotReached = state === "not_reached";
  const isTierLocked = state === "tier_locked";
  const isSkipped = state === "skipped";
  const isCompact = density === "compact";
  const MilestoneIcon = milestoneIcon(milestoneId);
  const avatarSize = isCompact ? 28 : 36;
  const iconSize = isCompact ? 14 : 16;
  return /* @__PURE__ */ window.wp.element.createElement("li", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative flex items-start gap-5" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      "data-avatar": "",
      className: B$1(
        "relative z-10 flex shrink-0 items-center justify-center rounded-full border-2 transition-colors duration-500",
        isDone ? "border-emerald-200 bg-emerald-50 dark:border-emerald-800/60 dark:bg-emerald-950/20" : isActive ? "border-brand-200 bg-brand-50 dark:border-brand-800 dark:bg-brand-950/20" : isFailed ? "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950/20" : isCancelled || isWarning ? "border-amber-200 bg-amber-50 dark:border-amber-800/60 dark:bg-amber-950/20" : isTierLocked || isSkipped ? "border-neutral-200 bg-neutral-50 dark:border-neutral-800 dark:bg-neutral-900/40" : "border-neutral-100 bg-white dark:border-neutral-800 dark:bg-neutral-900"
      ),
      style: { height: avatarSize, width: avatarSize },
      "aria-hidden": true
    },
    isDone ? /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { size: iconSize, className: "text-emerald-600 dark:text-emerald-400" }) : isWarning ? /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: iconSize, className: "text-amber-600 dark:text-amber-400" }) : /* @__PURE__ */ window.wp.element.createElement(
      MilestoneIcon,
      {
        width: iconSize,
        height: iconSize,
        className: B$1(
          isActive ? "text-brand-600 dark:text-brand-400" : isFailed ? "text-red-600 dark:text-red-400" : isCancelled ? "text-amber-600 dark:text-amber-400" : isTierLocked || isSkipped ? "text-neutral-400 dark:text-neutral-500" : "text-neutral-300 dark:text-neutral-600"
        )
      }
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "flex-1 pt-1 transition-colors duration-300",
        isActive && "bg-brand-50/30 dark:bg-brand-950/10 -mx-4 rounded-lg px-4"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-col" }, /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "truncate text-sm font-bold tracking-tight",
          isNotReached || isTierLocked || isSkipped ? "text-neutral-400 dark:text-neutral-500" : "text-neutral-900 dark:text-neutral-100",
          isActive && "text-brand-700 dark:text-brand-400",
          isFailed && "text-red-700 dark:text-red-300",
          (isCancelled || isWarning) && "text-amber-700 dark:text-amber-300"
        )
      },
      milestoneHeadline(milestoneId, postStatus)
    ), isFailed && errorUserMessage && /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-0.5 text-xs font-medium text-red-600 dark:text-red-400" }, errorUserMessage), isCancelled && /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-0.5 text-xs font-medium text-amber-600 dark:text-amber-400" }, window.wp.i18n.__("Stopped on this step", "structura")), isWarning && warningMessage && /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-0.5 text-xs font-medium text-amber-600 dark:text-amber-400" }, warningMessage)), isTierLocked && tierLockLabel ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "shrink-0 rounded border border-neutral-200 bg-neutral-100 px-2 py-0.5 text-[10px] font-bold tracking-wide text-neutral-500 uppercase dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400" }, tierLockLabel) : isSkipped ? (
      // Skipped rows on a terminal-success run — typically the
      // AI pipeline steps a stock-buffer pull bypassed. Visually
      // identical to the tier-lock chip so the timeline reads as
      // "this step was not part of this run" without implying
      // any failure or upgrade prompt.
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "shrink-0 rounded border border-neutral-200 bg-neutral-100 px-2 py-0.5 text-[10px] font-bold tracking-wide text-neutral-500 uppercase dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400" }, window.wp.i18n.__("Skipped", "structura"))
    ) : milestoneId === "channels" && typeof channelsResolvedCount === "number" ? (
      // Channels chip carries the fan-out count instead of a
      // duration. Pluralised inline rather than via @wordpress/i18n's
      // `_n` because the surrounding numbers are intentionally
      // arabic in every locale (matches the duration chip's
      // `formatDuration` output convention).
      /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          className: B$1(
            "shrink-0 rounded border px-2 py-0.5 text-[10px] font-bold tracking-wide uppercase",
            isWarning ? "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-300" : channelsResolvedCount > 0 ? "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-300" : "border-neutral-200 bg-neutral-100 text-neutral-500 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400"
          )
        },
        channelsResolvedCount === 0 ? window.wp.i18n.__("No channels", "structura") : channelsResolvedCount === 1 ? window.wp.i18n.__("1 channel", "structura") : `${channelsResolvedCount} ${window.wp.i18n.__("channels", "structura")}`
      )
    ) : elapsedMs != null && !isNotReached && /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "shrink-0 rounded border px-2 py-0.5 font-mono text-[10px] font-bold tabular-nums transition-colors duration-300",
          isDone && "border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-800/60 dark:bg-emerald-950/30 dark:text-emerald-300",
          isActive && "border-brand-200 bg-brand-50 text-brand-700 dark:border-brand-800/60 dark:bg-brand-950/30 dark:text-brand-300",
          isFailed && "border-red-200 bg-red-50 text-red-700 dark:border-red-800/60 dark:bg-red-950/30 dark:text-red-300",
          (isCancelled || isWarning) && "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-800/60 dark:bg-amber-950/30 dark:text-amber-300",
          // Defensive fallback — any state we haven't enumerated
          // (or `not_reached` slipping past the outer guard)
          // keeps the original neutral chip so the chip doesn't
          // disappear into the background.
          !isDone && !isActive && !isFailed && !isCancelled && !isWarning && "border-neutral-200 bg-neutral-50 text-neutral-500 dark:border-neutral-800 dark:bg-neutral-800 dark:text-neutral-400"
        )
      },
      formatDuration(elapsedMs)
    ))
  )));
};
const IN_FLIGHT_STATUSES = /* @__PURE__ */ new Set(["queued", "running", "awaiting_pull"]);
const SUCCESS_LINGER_MS = 4e3;
const MILESTONE_THRESHOLDS = {
  queued: 2,
  stock_check: 5,
  research: 10,
  outlining: 22,
  drafting: 55,
  link_validation: 75,
  images: 88,
  assembling: 94,
  publishing: 98
};
const CampaignRunProgress = (props) => {
  const { activeRunId, activeCampaignId } = useRuns();
  if (!activeRunId) return null;
  if (activeCampaignId !== null && activeCampaignId !== props.campaignId) {
    return null;
  }
  return /* @__PURE__ */ window.wp.element.createElement(CampaignRunProgressMatcher, { ...props, activeRunId });
};
const CampaignRunProgressMatcher = ({
  campaignId,
  variant = "card",
  texture = "lines",
  className,
  expandable = false,
  activeRunId
}) => {
  const { data } = useCampaignRunQuery(activeRunId);
  const [lingerExpired, setLingerExpired] = window.wp.element.useState(false);
  const [timelineExpanded, setTimelineExpanded] = window.wp.element.useState(false);
  const runStatus = data?.run?.status ?? null;
  const runIdKey = data?.run?.runId ?? null;
  window.wp.element.useEffect(() => {
    if (runStatus !== "succeeded" && runStatus !== "succeeded_with_warnings") {
      setLingerExpired(false);
      return;
    }
    const t2 = window.setTimeout(() => setLingerExpired(true), SUCCESS_LINGER_MS);
    return () => window.clearTimeout(t2);
  }, [runStatus, runIdKey]);
  window.wp.element.useEffect(() => {
    if (runStatus === "succeeded" || runStatus === "succeeded_with_warnings" || runStatus === "failed" || runStatus === "cancelled") {
      setTimelineExpanded(false);
    }
  }, [runStatus, runIdKey]);
  const { dismiss } = useRuns();
  window.wp.element.useEffect(() => {
    if ((runStatus === "succeeded" || runStatus === "succeeded_with_warnings") && lingerExpired) {
      dismiss();
    }
  }, [runStatus, lingerExpired, dismiss]);
  const { isPaidLicense } = useLicense();
  const run = data?.run;
  if (!run) {
    return /* @__PURE__ */ window.wp.element.createElement(StartingStrip, { variant, texture, className });
  }
  if (run.campaignId !== campaignId) return null;
  if (runStatus === "succeeded" && lingerExpired) return null;
  const isPage = variant === "page";
  const isSuccess = runStatus === "succeeded" || runStatus === "succeeded_with_warnings";
  const isFailure = runStatus === "failed" || runStatus === "cancelled";
  const isInFlight = IN_FLIGHT_STATUSES.has(runStatus ?? "");
  const isAwaitingPull = runStatus === "awaiting_pull";
  const percent = Math.max(0, Math.min(100, Math.round(run.progressPercent)));
  const StepIcon = isSuccess ? CircleCheck : isFailure ? TriangleAlert : milestoneIcon(run.currentStep);
  const postStatus = resolveRunPostStatus(run);
  const label = isSuccess ? postStatus === "draft" ? window.wp.i18n.__("Draft saved", "structura") : window.wp.i18n.__("Post published", "structura") : isFailure ? window.wp.i18n.__("Generation stopped", "structura") : isAwaitingPull ? window.wp.i18n.__("Delivering via a backup method", "structura") : milestoneHeadline(run.currentStep, postStatus) || run.headline;
  const subtext = !isSuccess && !isFailure ? isAwaitingPull ? window.wp.i18n.__(
    "Your site blocked direct delivery, so we're delivering this post another way. It may take a few minutes.",
    "structura"
  ) : milestoneSubtext(run.currentStep, postStatus) ?? run.subtext : void 0;
  const trailing = isInFlight ? /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: B$1(
        "font-black tabular-nums",
        isPage ? "text-brand-700 dark:text-brand-400 text-[13px]" : "text-brand-700 dark:text-brand-400 text-xs"
      )
    },
    percent,
    "%"
  ) : null;
  const fillBackground = isFailure ? "rgba(239, 68, 68, 0.08)" : isSuccess ? "rgba(16, 185, 129, 0.08)" : "rgba(99, 102, 241, 0.06)";
  const fillBorderColor = isFailure ? "rgba(239, 68, 68, 0.2)" : isSuccess ? "rgba(16, 185, 129, 0.2)" : "rgba(99, 102, 241, 0.25)";
  const strip = /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "relative isolate w-full overflow-hidden transition-all duration-500",
        isPage ? "h-auto rounded-xl border border-neutral-300/50 bg-white p-5 shadow-sm dark:border-neutral-800/40 dark:bg-neutral-900" : "h-11 border-t border-neutral-200/60 bg-neutral-50/40 dark:border-neutral-800/40 dark:bg-neutral-950",
        // When expandable + expanded, the strip's rounded bottom merges
        // into the reveal panel below. Killing the bottom rounding here
        // makes the transition read as "one continuous surface".
        expandable && timelineExpanded && isPage && "rounded-b-none",
        !expandable && className
      ),
      role: "progressbar",
      "aria-valuemin": 0,
      "aria-valuemax": 100,
      "aria-valuenow": percent,
      "aria-label": window.wp.i18n.__("Campaign run progress", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        "aria-hidden": true,
        className: B$1(
          "absolute inset-y-0 left-0 z-10 transition-[width] duration-700 ease-out",
          !isSuccess && !isFailure && "border-r"
        ),
        style: {
          width: isSuccess || isFailure ? "100%" : `${percent}%`,
          background: fillBackground,
          borderColor: fillBorderColor
        }
      },
      isInFlight && /* @__PURE__ */ window.wp.element.createElement(TextureOverlay, { texture })
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        "aria-hidden": true,
        className: "pointer-events-none absolute inset-x-0 bottom-0 z-20 flex h-0.5 gap-0.5 px-0.5 opacity-20"
      },
      milestoneOrderForFlowAndTier(run.flow, !!isPaidLicense).map((step) => {
        const threshold = MILESTONE_THRESHOLDS[step] ?? 0;
        const isPassed = isSuccess || percent >= threshold;
        return /* @__PURE__ */ window.wp.element.createElement(
          "div",
          {
            key: step,
            className: B$1(
              "h-full flex-1 transition-all duration-1000",
              isPassed ? "bg-brand-500" : "bg-neutral-300 dark:bg-neutral-700"
            )
          }
        );
      })
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "relative z-30 flex h-full items-center justify-between gap-3",
          isPage ? "" : "px-4"
        ),
        "aria-live": "polite",
        "aria-atomic": "true"
      },
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-col" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
        StepIcon,
        {
          className: B$1(
            "h-3.5 w-3.5 shrink-0 transition-colors duration-500",
            isInFlight ? "text-brand-500/70 dark:text-brand-400/70" : isSuccess ? "text-emerald-600 dark:text-emerald-500" : "text-red-600 dark:text-red-500"
          ),
          "aria-hidden": true
        }
      ), /* @__PURE__ */ window.wp.element.createElement(
        "h4",
        {
          key: `crp-label-${run.currentStep}-${runStatus}`,
          className: B$1(
            "animate-fade-in m-0! truncate leading-tight font-bold tracking-tight",
            isPage ? "text-base" : "text-[12.5px]",
            isFailure ? "text-red-900 dark:text-red-300" : isSuccess ? "text-emerald-900 dark:text-emerald-300" : "text-neutral-900 dark:text-neutral-100"
          )
        },
        label
      )), subtext && /* @__PURE__ */ window.wp.element.createElement(
        "p",
        {
          key: `crp-subtext-${subtext}`,
          className: B$1(
            "mt-0.5!animate-fade-in mb-0! truncate font-medium",
            // Dimmed per 2026-04-23 review: the subtext is ambient
            // context ("Writing section 2 of 4"), not information the
            // eye needs to race to. Keeping it the same weight as the
            // headline made the strip feel busy; dropping one neutral
            // step down restores the hierarchy the Gemini mockup
            // intended.
            isPage ? "text-sm text-neutral-500 dark:text-neutral-400" : "hidden text-[11px] text-neutral-500 sm:block dark:text-neutral-400"
          )
        },
        subtext
      )),
      trailing && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-3" }, trailing, expandable && isPage && /* @__PURE__ */ window.wp.element.createElement(
        ChevronDown,
        {
          className: B$1(
            "h-4 w-4 shrink-0 text-neutral-400 transition-transform duration-300 dark:text-neutral-500",
            timelineExpanded && "rotate-180"
          ),
          "aria-hidden": true
        }
      ))
    )
  );
  if (!expandable) return strip;
  const toggleLabel = timelineExpanded ? window.wp.i18n.__("Hide steps", "structura") : window.wp.i18n.__("Show all steps", "structura");
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1("space-y-0", className) }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setTimelineExpanded((v2) => !v2),
      "aria-expanded": timelineExpanded,
      "aria-controls": "crp-timeline-reveal",
      "aria-label": toggleLabel,
      className: B$1(
        "group relative block w-full rounded-xl text-left transition-all duration-200",
        // Subtle visual affordance: on hover the whole card lifts its
        // shadow a touch and the border reads slightly warmer. Cursor
        // pointer reinforces clickability the moment the user's mouse
        // enters the bar.
        "cursor-pointer hover:shadow-md",
        // Keyboard focus ring — required per a11y spec since the
        // clickable surface is large and has no other focus treatment.
        "focus-visible:ring-brand-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-neutral-950",
        // Kill bottom rounding when expanded so the strip merges
        // visually into the reveal panel below.
        timelineExpanded && "rounded-b-none"
      )
    },
    strip,
    /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        "aria-hidden": true,
        className: B$1(
          "pointer-events-none absolute -top-3 left-1/2 z-40 flex -translate-x-1/2 items-center gap-1 rounded-full px-3 py-1",
          "bg-neutral-900 text-[11px] font-semibold tracking-wide text-white shadow-lg",
          "opacity-0 transition-all duration-200 group-hover:opacity-100 group-focus-visible:opacity-100",
          "group-hover:-translate-y-0 group-focus-visible:-translate-y-0",
          "dark:bg-neutral-50 dark:text-neutral-900"
        )
      },
      timelineExpanded ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(ChevronUp, { className: "h-3 w-3", "aria-hidden": true }), window.wp.i18n.__("Hide steps", "structura")) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(ChevronDown, { className: "h-3 w-3", "aria-hidden": true }), window.wp.i18n.__("Show all steps", "structura"))
    )
  ), timelineExpanded && /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      id: "crp-timeline-reveal",
      className: B$1(
        "overflow-hidden rounded-b-xl border border-t-0 border-neutral-300/50 bg-white shadow-sm dark:border-neutral-800/40 dark:bg-neutral-900",
        "animate-fade-in"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-t border-neutral-200/60 px-5 pt-5 pb-5 dark:border-neutral-800/60" }, /* @__PURE__ */ window.wp.element.createElement(RunTimeline, { run, density: "compact", withCard: false }))
  ));
};
const TextureOverlay = ({ texture }) => {
  switch (texture) {
    case "grid":
      return /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          "data-testid": "crp-texture-grid",
          className: "animate-progress-grid absolute inset-0 opacity-[0.1] dark:opacity-[0.15]",
          style: {
            backgroundImage: "radial-gradient(#6366f1 1px, transparent 0)",
            backgroundSize: "8px 8px"
          }
        }
      );
    case "pulse":
      return /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          "data-testid": "crp-texture-pulse",
          className: "animate-pulse-subtle bg-brand-500/10 absolute inset-0"
        }
      );
    case "flow":
      return /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          "data-testid": "crp-texture-flow",
          className: "animate-progress-flow absolute inset-0 opacity-20",
          style: {
            background: "linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.3) 50%, transparent 100%)",
            backgroundSize: "200% 100%"
          }
        }
      );
    case "lines":
    default:
      return /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          "data-testid": "crp-texture-lines",
          className: "animate-progress-lines absolute inset-0 opacity-[0.08] dark:opacity-[0.12]",
          style: {
            backgroundImage: "linear-gradient(45deg, #6366f1 25%, transparent 25%, transparent 50%, #6366f1 50%, #6366f1 75%, transparent 75%, transparent)",
            backgroundSize: "32px 32px"
          }
        }
      );
  }
};
const StartingStrip = ({
  variant = "card",
  texture = "lines",
  className
}) => {
  const isPage = variant === "page";
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "relative isolate w-full overflow-hidden",
        isPage ? "h-auto rounded-xl border border-neutral-300/50 bg-white p-5 shadow-sm dark:border-neutral-800/40 dark:bg-neutral-900" : "h-11 border-t border-neutral-200/60 bg-neutral-50/40 dark:border-neutral-800/40 dark:bg-neutral-950",
        className
      ),
      role: "progressbar",
      "aria-valuemin": 0,
      "aria-valuemax": 100,
      "aria-valuenow": 0,
      "aria-label": window.wp.i18n.__("Campaign run starting", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        "aria-hidden": true,
        className: "absolute inset-y-0 left-0 z-10 border-r transition-[width] duration-700 ease-out",
        style: {
          width: "4%",
          background: "rgba(99, 102, 241, 0.06)",
          borderColor: "rgba(99, 102, 241, 0.25)"
        }
      },
      /* @__PURE__ */ window.wp.element.createElement(TextureOverlay, { texture })
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "relative z-30 flex h-full items-center justify-between gap-3",
          isPage ? "" : "px-4"
        ),
        "aria-live": "polite",
        "aria-atomic": "true"
      },
      /* @__PURE__ */ window.wp.element.createElement(
        "p",
        {
          className: B$1(
            "animate-fade-in m-0! truncate font-bold tracking-tight text-neutral-900 dark:text-neutral-100",
            isPage ? "text-base" : "text-[12.5px]"
          )
        },
        window.wp.i18n.__("Connecting to cloud — first run can take up to 30 seconds…", "structura")
      )
    )
  );
};
const useRunStatusToasts = () => {
  const { activeRunId } = useRuns();
  const { data } = useCampaignRunQuery(activeRunId);
  const runIdForToast = data?.run?.runId ?? null;
  const statusForToast = data?.run?.status ?? null;
  const toastedRef = window.wp.element.useRef(/* @__PURE__ */ new Set());
  window.wp.element.useEffect(() => {
    if (!runIdForToast || !statusForToast) return;
    if (statusForToast !== "failed" && statusForToast !== "succeeded" && statusForToast !== "succeeded_with_warnings") {
      return;
    }
    const dedupeKey = `${runIdForToast}:${statusForToast}`;
    if (toastedRef.current.has(dedupeKey)) return;
    toastedRef.current.add(dedupeKey);
    const run = data?.run;
    const campaignName = run?.campaignName ?? "";
    const isDraft = run ? resolveRunPostStatus(run) === "draft" : false;
    if (statusForToast === "failed") {
      const userMessage = run?.error?.userMessage ?? window.wp.i18n.__("Generation stopped.", "structura");
      const title = campaignName ? (
        // translators: %s is a campaign name
        window.wp.i18n.sprintf(window.wp.i18n.__("%s failed", "structura"), campaignName)
      ) : window.wp.i18n.__("Campaign run failed", "structura");
      An.error(userMessage, {
        title,
        duration: 12e3,
        action: {
          label: window.wp.i18n.__("View details", "structura"),
          onClick: () => {
            window.location.hash = `#/runs/${encodeURIComponent(runIdForToast)}`;
          }
        }
      });
      return;
    }
    if (statusForToast === "succeeded") {
      const title = campaignName ? isDraft ? (
        // translators: %s is a campaign name
        window.wp.i18n.sprintf(window.wp.i18n.__("%s — draft saved", "structura"), campaignName)
      ) : (
        // translators: %s is a campaign name
        window.wp.i18n.sprintf(window.wp.i18n.__("%s — post published", "structura"), campaignName)
      ) : isDraft ? window.wp.i18n.__("Draft saved", "structura") : window.wp.i18n.__("Post published", "structura");
      An.success(
        isDraft ? window.wp.i18n.__("Your new draft is ready to review.", "structura") : window.wp.i18n.__("Your new post is live.", "structura"),
        {
          title,
          action: run?.resultPostUrl ? {
            label: isDraft ? window.wp.i18n.__("Review draft", "structura") : window.wp.i18n.__("View post", "structura"),
            onClick: () => {
              window.open(run.resultPostUrl, "_blank", "noopener");
            }
          } : {
            label: window.wp.i18n.__("View details", "structura"),
            onClick: () => {
              window.location.hash = `#/runs/${encodeURIComponent(runIdForToast)}`;
            }
          }
        }
      );
      return;
    }
    if (statusForToast === "succeeded_with_warnings") {
      const title = campaignName ? isDraft ? (
        // translators: %s is a campaign name
        window.wp.i18n.sprintf(window.wp.i18n.__("%s — draft saved with warnings", "structura"), campaignName)
      ) : (
        // translators: %s is a campaign name
        window.wp.i18n.sprintf(window.wp.i18n.__("%s — published with warnings", "structura"), campaignName)
      ) : isDraft ? window.wp.i18n.__("Draft saved with warnings", "structura") : window.wp.i18n.__("Post published with warnings", "structura");
      An.warning(
        isDraft ? window.wp.i18n.__(
          "The draft was saved, but one or more steps reported a problem.",
          "structura"
        ) : window.wp.i18n.__(
          "The post went live, but one or more steps reported a problem.",
          "structura"
        ),
        {
          title,
          duration: 1e4,
          action: {
            label: window.wp.i18n.__("View details", "structura"),
            onClick: () => {
              window.location.hash = `#/runs/${encodeURIComponent(runIdForToast)}`;
            }
          }
        }
      );
      return;
    }
  }, [runIdForToast, statusForToast]);
};
const RunStatusToastHost = () => {
  useRunStatusToasts();
  return null;
};
const REFETCH_INTERVAL_MS$1 = 3e4;
const NON_TERMINAL_STATUSES$1 = /* @__PURE__ */ new Set([
  "queued",
  "running",
  // Webhook-delivery fallback parked state — keep the list refreshing until
  // the plugin's poller pulls the post and it flips to succeeded.
  "awaiting_pull"
]);
const useCampaignRunsQuery = (campaignId, limit = 20) => {
  const { hasUsableLicense } = useLicense();
  const isValid = campaignId !== null && campaignId !== void 0 && (typeof campaignId === "string" || campaignId > 0);
  return useQuery({
    queryKey: progressKeys.campaignRuns(campaignId),
    enabled: hasUsableLicense === true && isValid,
    // Opt out of the global QueryCache `onError` toast. The tab is an
    // at-a-glance surface; a transient network blip or a cloud-side 5xx
    // should render inline (the Runs tab's "Couldn't load run history"
    // card with a retry button) rather than surface a red toast every
    // 30s. Same reasoning as the drawer's `useCampaignRunQuery` hook —
    // the tab owns its own error copy.
    meta: { silentError: true },
    queryFn: async () => {
      if (!isValid) {
        throw new Error("useCampaignRunsQuery called without a valid campaignId");
      }
      return window.wp.apiFetch({
        path: `/structura/v1/campaigns/${encodeURIComponent(
          String(campaignId)
        )}/runs?limit=${encodeURIComponent(String(limit))}`
      });
    },
    // Pause polling once the list is all-terminal. An empty list also
    // pauses — there's no reason to probe a campaign that has never run.
    // The moment a new run starts, the campaign view's mutation handler
    // invalidates this key and the tab reloads immediately.
    refetchInterval: (query) => {
      const data = query.state.data;
      if (!data || data.length === 0) return false;
      const hasInFlight = data.some(
        (run) => NON_TERMINAL_STATUSES$1.has(run.status)
      );
      return hasInFlight ? REFETCH_INTERVAL_MS$1 : false;
    },
    // No automatic retry. The Runs tab renders errors inline with an
    // explicit "Try again" button, so the UX contract is "one attempt,
    // surface the failure, let the user retry". Silent background
    // retries would mask the failure for the 30s poll window and hide
    // cloud-side 5xx spikes that the user should see in the UI. A
    // transient blip will get picked up on the next poll anyway once
    // the list has at least one in-flight row.
    retry: false,
    // Treat the list as fresh for a full poll interval — tab-switching
    // back onto the Runs tab within that window shouldn't trigger a
    // refetch. The list doesn't stream new rows mid-poll; the next
    // tick will catch any new terminal state.
    staleTime: REFETCH_INTERVAL_MS$1
  });
};
const NON_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
  "queued",
  "running",
  // Webhook-delivery fallback parked state — keep the list refreshing until
  // the plugin's poller pulls the post and it flips to succeeded.
  "awaiting_pull"
]);
const REFETCH_INTERVAL_MS = 3e4;
const useSinglePostRunsQuery = (limit = 5) => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: [...progressKeys.singlePostRuns(), limit],
    enabled: hasWorkspace === true,
    meta: { silentError: true },
    queryFn: async () => {
      return window.wp.apiFetch({
        path: `/structura/v1/runs/single?limit=${encodeURIComponent(String(limit))}`
      });
    },
    refetchInterval: (query) => {
      const data = query.state.data;
      if (!data || data.length === 0) return false;
      const hasInFlight = data.some(
        (run) => NON_TERMINAL_STATUSES.has(run.status)
      );
      return hasInFlight ? REFETCH_INTERVAL_MS : false;
    },
    retry: false,
    staleTime: REFETCH_INTERVAL_MS
  });
};
const personaKeys = {
  all: ["personas"],
  lists: () => [...personaKeys.all, "list"],
  users: () => ["wp-users"]
  // Separate root key for WP users
};
async function fetchPersonas() {
  const raw = await window.wp.apiFetch({ path: "/structura/v1/personas" });
  if (Array.isArray(raw)) return raw;
  const env = raw;
  return Array.isArray(env?.personas) ? env.personas : [];
}
const usePersonasQuery = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: personaKeys.lists(),
    queryFn: fetchPersonas,
    enabled: hasWorkspace === true,
    staleTime: 1e3 * 60 * 5
  });
};
async function fetchMemberPersonaIds() {
  const raw = await window.wp.apiFetch({ path: "/structura/v1/personas" });
  if (Array.isArray(raw)) return [];
  const env = raw;
  return Array.isArray(env?.memberPersonaIds) ? env.memberPersonaIds : [];
}
const useMemberPersonaIdsQuery = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: [...personaKeys.lists(), "memberships"],
    queryFn: fetchMemberPersonaIds,
    enabled: hasWorkspace === true,
    staleTime: 1e3 * 60 * 5
  });
};
const useWpUsersQuery = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: personaKeys.users(),
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/users" }),
    enabled: hasWorkspace === true,
    staleTime: 1e3 * 60 * 60
    // 1 hour
  });
};
const usePersonaMutations = () => {
  const queryClient2 = useQueryClient();
  const invalidate = () => queryClient2.invalidateQueries({ queryKey: personaKeys.lists() });
  const saveMutation = useMutation({
    mutationFn: (persona) => window.wp.apiFetch({ path: "/structura/v1/personas", method: "POST", data: persona }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Persona configuration saved.", "structura"));
      invalidate();
    }
  });
  const deleteMutation = useMutation({
    mutationFn: (id) => window.wp.apiFetch({ path: "/structura/v1/personas/delete", method: "POST", data: { id } }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Persona removed.", "structura"));
      invalidate();
    },
    // We can still override the global error handler for specific logic
    onError: () => {
      An.error(window.wp.i18n.__("Cannot delete the primary architect.", "structura"));
    }
  });
  const forkMutation = useMutation({
    mutationFn: ({ id, label_suffix }) => window.wp.apiFetch({
      path: `/structura/v1/personas/${encodeURIComponent(id)}/fork`,
      method: "POST",
      data: label_suffix ? { label_suffix } : {}
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Persona forked for this site.", "structura"));
      invalidate();
    }
  });
  const setDefaultMutation = useMutation({
    mutationFn: (personaId) => window.wp.apiFetch({
      path: "/structura/v1/personas/set-default",
      method: "POST",
      data: { persona_id: personaId }
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Default persona updated for this site.", "structura"));
      invalidate();
    }
  });
  const addMembershipMutation = useMutation({
    mutationFn: (personaId) => window.wp.apiFetch({
      path: "/structura/v1/personas/membership/add",
      method: "POST",
      data: { persona_id: personaId }
    }),
    onSuccess: () => invalidate()
  });
  const removeMembershipMutation = useMutation({
    mutationFn: (personaId) => window.wp.apiFetch({
      path: "/structura/v1/personas/membership/remove",
      method: "POST",
      data: { persona_id: personaId }
    }),
    onSuccess: () => invalidate()
  });
  return {
    savePersona: saveMutation.mutateAsync,
    deletePersona: deleteMutation.mutateAsync,
    forkPersona: forkMutation.mutateAsync,
    setDefaultPersona: setDefaultMutation.mutateAsync,
    addMembership: addMembershipMutation.mutateAsync,
    removeMembership: removeMembershipMutation.mutateAsync,
    isPending: saveMutation.isPending || deleteMutation.isPending || forkMutation.isPending || setDefaultMutation.isPending,
    isForking: forkMutation.isPending,
    isSettingDefault: setDefaultMutation.isPending,
    isBinding: addMembershipMutation.isPending || removeMembershipMutation.isPending
  };
};
const TONE_OPTIONS = [
  { value: "professional", label: window.wp.i18n.__("Professional", "structura") },
  { value: "casual", label: window.wp.i18n.__("Casual", "structura") },
  { value: "humorous", label: window.wp.i18n.__("Humorous", "structura") },
  { value: "authoritative", label: window.wp.i18n.__("Authoritative", "structura") },
  { value: "enthusiastic", label: window.wp.i18n.__("Enthusiastic", "structura") },
  { value: "empathetic", label: window.wp.i18n.__("Empathetic", "structura") },
  { value: "controversial", label: window.wp.i18n.__("Controversial", "structura") }
];
const READING_LEVEL_OPTIONS = [
  { value: "grade_5", label: window.wp.i18n.__("Grade 5 (Simple)", "structura") },
  { value: "grade_8", label: window.wp.i18n.__("Grade 8 (Standard)", "structura") },
  { value: "grade_12", label: window.wp.i18n.__("Grade 12 (Complex)", "structura") },
  { value: "phd", label: window.wp.i18n.__("PhD (Academic)", "structura") }
];
const PERSONA_TEMPLATES = [...PERSONA_TEMPLATES$1];
const getToneColor = (tone) => {
  switch (tone.toLowerCase()) {
    case "professional":
      return {
        background: "bg-blue-100 dark:bg-blue-900/10",
        text: "text-blue-800 dark:text-blue-200",
        border: "border-blue-200 dark:border-blue-700/50",
        progress: "bg-blue-500/80"
      };
    case "casual":
      return {
        background: "bg-green-100 dark:bg-green-900/10",
        text: "text-green-800 dark:text-green-200",
        border: "border-green-200 dark:border-green-700/50",
        progress: "bg-green-500/80"
      };
    case "humorous":
      return {
        background: "bg-yellow-100 dark:bg-yellow-900/10",
        text: "text-yellow-800 dark:text-yellow-200",
        border: "border-yellow-200 dark:border-yellow-700/50",
        progress: "bg-yellow-500/80"
      };
    case "authoritative":
      return {
        background: "bg-red-100 dark:bg-red-900/10",
        text: "text-red-800 dark:text-red-200",
        border: "border-red-200 dark:border-red-700/50",
        progress: "bg-red-500/80"
      };
    case "enthusiastic":
      return {
        background: "bg-purple-100 dark:bg-purple-900/10",
        text: "text-purple-800 dark:text-purple-200",
        border: "border-purple-200 dark:border-purple-700/50",
        progress: "bg-purple-500/80"
      };
    case "empathetic":
      return {
        background: "bg-pink-100 dark:bg-pink-900/10",
        text: "text-pink-800 dark:text-pink-200",
        border: "border-pink-200 dark:border-pink-700/50",
        progress: "bg-pink-500/80"
      };
    case "controversial":
      return {
        background: "bg-gray-100 dark:bg-gray-900/10",
        text: "text-gray-800 dark:text-gray-200",
        border: "border-gray-200 dark:border-gray-700/50",
        progress: "bg-gray-500/80"
      };
    default:
      return {
        background: "bg-gray-100 dark:bg-gray-900/10",
        text: "text-gray-800 dark:text-gray-200",
        border: "border-gray-200 dark:border-gray-700/50",
        progress: "bg-gray-500/80"
      };
  }
};
const getReadingLevelColor = (level) => {
  switch (level.toLowerCase()) {
    case "grade_5":
      return {
        background: "bg-blue-100 dark:bg-blue-900/10",
        text: "text-blue-800 dark:text-blue-200",
        border: "border-blue-200 dark:border-blue-700/50",
        progress: "bg-blue-500/80"
      };
    case "grade_8":
      return {
        background: "bg-green-100 dark:bg-green-900/10",
        text: "text-green-800 dark:text-green-200",
        border: "border-green-200 dark:border-green-700/50",
        progress: "bg-green-500/80"
      };
    case "grade_12":
      return {
        background: "bg-yellow-100 dark:bg-yellow-900/10",
        text: "text-yellow-800 dark:text-yellow-200",
        border: "border-yellow-200 dark:border-yellow-700/50",
        progress: "bg-yellow-500/80"
      };
    case "phd":
      return {
        background: "bg-pink-100 dark:bg-pink-900/10",
        text: "text-pink-800 dark:text-pink-200",
        border: "border-pink-200 dark:border-pink-700/50",
        progress: "bg-pink-500/80"
      };
    default:
      return {
        background: "bg-gray-100 dark:bg-gray-900/10",
        text: "text-gray-800 dark:text-gray-200",
        border: "border-gray-200 dark:border-gray-700/50",
        progress: "bg-gray-500/80"
      };
  }
};
const getReadingLevelLabel = (level) => READING_LEVEL_OPTIONS.find((l2) => l2.value === level)?.label || level;
const getToneLabel = (tone) => TONE_OPTIONS.find((t2) => t2.value === tone)?.label || tone;
const getReadingLevelProgress = (level) => {
  switch (level.toLowerCase()) {
    case "grade_5":
      return 25;
    case "grade_8":
      return 50;
    case "grade_12":
      return 75;
    case "phd":
      return 100;
    default:
      return 0;
  }
};
const PersonaCard = ({ persona, author, onEdit }) => {
  const { deletePersona, isPending } = usePersonaMutations();
  const { data: wpUsers } = useWpUsersQuery();
  const [isConfirmOpen, setIsConfirmOpen] = window.wp.element.useState(false);
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "group relative flex flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white transition-all hover:-translate-y-1 hover:border-brand-500 hover:shadow-xl" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "p-6 pb-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-start justify-between" }, author?.avatarUrl ? /* @__PURE__ */ window.wp.element.createElement(
    "img",
    {
      src: author.avatarUrl,
      className: "h-11 w-11 rounded-xl border-2 border-white object-cover shadow-sm",
      alt: author.name
    }
  ) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid h-11 w-11 grid-cols-2 gap-0.5 rounded-xl border border-brand-100 bg-brand-50 p-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-lg bg-brand-400" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-lg bg-brand-600" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "col-span-2 rounded-lg bg-brand-200" })), /* @__PURE__ */ window.wp.element.createElement(
    Me,
    {
      variant: "solid",
      className: `${getToneColor(persona.tone).text} ${getToneColor(persona.tone).background} ${getToneColor(persona.tone).border}`
    },
    getToneLabel(persona.tone)
  )), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-xl leading-tight font-extrabold text-gray-900" }, persona.name), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-1 text-xs font-bold tracking-wider text-gray-400 uppercase" }, author ? wpUsers?.find((u2) => u2.id === persona.author_id)?.name || "Unknown" : "No Author")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-y border-gray-100 bg-gray-50/50 px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-2 font-mono text-[9px] font-black tracking-[0.2em] text-gray-400 uppercase" }, window.wp.i18n.__("System Directive", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "line-clamp-3 font-mono text-xs leading-relaxed text-gray-600 italic" }, '"', persona.system_prompt, '"')), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1 p-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-1.5 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black tracking-widest text-gray-400 uppercase" }, window.wp.i18n.__("Reading Level", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-bold text-gray-700" }, getReadingLevelLabel(persona.reading_level))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-gray-100" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: `${getReadingLevelColor(persona.reading_level).progress} h-full transition-all duration-1000`,
      style: { width: `${getReadingLevelProgress(persona.reading_level)}%` }
    }
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-t border-gray-100 bg-gray-50 px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      onClick: onEdit,
      className: "flex cursor-pointer items-center gap-2 text-[10px]! font-bold! tracking-widest text-gray-600 uppercase hover:text-brand-600"
    },
    /* @__PURE__ */ window.wp.element.createElement(Settings2, { size: 14, strokeWidth: 2.5 }),
    window.wp.i18n.__("Configure", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      onClick: () => setIsConfirmOpen(true),
      className: "cursor-pointer text-neutral-400 uppercase hover:text-red-600/80 dark:hover:text-red-400/80",
      "aria-label": `Delete persona ${persona.name}`
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "sr-only" }, window.wp.i18n.__("Delete", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 14, strokeWidth: 2.5 })
  ))), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: isConfirmOpen,
      loading: isPending,
      variant: "danger",
      onClose: () => setIsConfirmOpen(false),
      onConfirm: async () => {
        await deletePersona(persona.id);
        setIsConfirmOpen(false);
      },
      confirmButtonProps: {
        label: window.wp.i18n.__("Yes, Delete", "structura")
      },
      title: window.wp.i18n.__("Confirm Deletion", "structura"),
      description: window.wp.i18n.__(
        `Are you sure you want to delete "${persona.name}"? This action cannot be undone.`,
        "structura"
      )
    }
  ));
};
const DEFAULT_STAGES = [
  window.wp.i18n.__("Reading your site…", "structura"),
  window.wp.i18n.__("Studying your value proposition…", "structura"),
  window.wp.i18n.__("Detecting topical patterns…", "structura"),
  window.wp.i18n.__("Composing suggestions…", "structura")
];
const STAGE_DURATION_MS = 3e3;
const MagicSuggestProgress = ({
  isLoading,
  stages = DEFAULT_STAGES,
  variant = "panel",
  className
}) => {
  const [stageIndex, setStageIndex] = window.wp.element.useState(0);
  window.wp.element.useEffect(() => {
    if (!isLoading) {
      setStageIndex(0);
      return;
    }
    const id = setInterval(() => {
      setStageIndex((i2) => Math.min(i2 + 1, stages.length - 1));
    }, STAGE_DURATION_MS);
    return () => clearInterval(id);
  }, [isLoading, stages.length]);
  if (!isLoading) return null;
  if (variant === "inline") {
    return /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "inline-flex items-center gap-1.5 text-[11px] text-brand-600 dark:text-brand-400",
          className
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 12, className: "animate-pulse" }),
      /* @__PURE__ */ window.wp.element.createElement("span", { "aria-live": "polite" }, stages[stageIndex])
    );
  }
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      role: "status",
      "aria-live": "polite",
      className: B$1(
        "flex items-center gap-3 rounded-xl border border-dashed border-brand-200 bg-brand-50/40 px-4 py-3 dark:border-brand-800 dark:bg-brand-950/20",
        className
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br from-brand-500 to-purple-500 shadow-sm shadow-brand-500/20" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 13, className: "animate-pulse text-white" })),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium text-brand-700 dark:text-brand-300" }, stages[stageIndex])
  );
};
const PersonaEditor = ({ persona, users, onClose, onSave }) => {
  const [current, setCurrent] = window.wp.element.useState({
    id: 0,
    name: "",
    system_prompt: "",
    tone: "professional",
    reading_level: "grade_8",
    author_id: 0
  });
  const [isSaving, setIsSaving] = window.wp.element.useState(false);
  const { suggest, isSuggesting } = useMagicSuggest();
  const { isPaidLicense } = useLicense();
  window.wp.element.useEffect(() => {
    if (persona) {
      setCurrent(persona);
    }
  }, [persona]);
  const { defaultTextProvider } = useDefaultProviders();
  const [providerOverride, setProviderOverride] = window.wp.element.useState(null);
  const activeProvider = providerOverride ?? defaultTextProvider;
  const handleMagicSuggest = async () => {
    const data = await suggest("persona", {
      provider: activeProvider
    });
    if (data) {
      setCurrent((prev) => ({
        ...prev,
        ...data
      }));
      An.success(window.wp.i18n.__("Persona optimized by AI.", "structura"));
    }
  };
  return /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open: true, onClose, size: "lg" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement(Y.Header, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement(Y.Title, null, current.id === 0 ? window.wp.i18n.__("Create New Persona", "structura") : window.wp.i18n.__("Edit Persona", "structura")), isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(MagicSuggestProgress, { isLoading: isSuggesting, variant: "inline" }), /* @__PURE__ */ window.wp.element.createElement(
    ProviderPill,
    {
      provider: activeProvider,
      onProviderChange: setProviderOverride
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: handleMagicSuggest,
      disabled: isSuggesting || isSaving
    },
    isSuggesting ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "size-4 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "size-4" }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2 text-[10px] font-bold tracking-wider uppercase" }, isSuggesting ? window.wp.i18n.__("Architecting…", "structura") : window.wp.i18n.__("Magic Suggest", "structura"))
  )) : (
    // Non-paid: keep the affordance discoverable but locked, so
    // the upsell is visible without exposing the cloud call.
    /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", disabled: true }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "size-4" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2 text-[10px] font-bold tracking-wider uppercase" }, window.wp.i18n.__("Magic Suggest", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2 rounded-md bg-brand-100 px-1.5 py-0.5 text-[8px] font-black tracking-wider text-brand-600 uppercase dark:bg-brand-950/30 dark:text-brand-400" }, window.wp.i18n.__("Pro", "structura")))
  ))), /* @__PURE__ */ window.wp.element.createElement(Y.Body, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-8" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Identity Name", "structura"),
      value: current.name,
      placeholder: window.wp.i18n.__("e.g. Technical Reviewer", "structura"),
      onChange: (e2) => setCurrent({ ...current, name: e2.target.value })
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: current.author_id,
      onValueChange: (val) => setCurrent({ ...current, author_id: parseInt(val) }),
      options: users.map((u2) => ({ label: u2.name, value: u2.id }))
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Publishing Author", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select an author...", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, users.map((u2) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: u2.id, value: u2.id }, u2.name)))
  )), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Intelligence Directive (System Prompt)", "structura"),
      rows: 5,
      className: "font-mono text-xs leading-relaxed",
      value: current.system_prompt,
      onChange: (e2) => setCurrent({ ...current, system_prompt: e2.target.value }),
      placeholder: window.wp.i18n.__("You are a rigorous academic...", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: current.tone,
      onValueChange: (val) => setCurrent({ ...current, tone: val }),
      options: TONE_OPTIONS
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Linguistic Tone", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select a tone...", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, TONE_OPTIONS.map((u2) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: u2.value, value: u2.value }, u2.label)))
  ), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: current.reading_level,
      onValueChange: (val) => setCurrent({ ...current, reading_level: val }),
      options: READING_LEVEL_OPTIONS
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Reading Level", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select a level...", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, READING_LEVEL_OPTIONS.map((u2) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: u2.value, value: u2.value }, u2.label)))
  )))), /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: onClose, size: "sm" }, window.wp.i18n.__("Cancel", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      disabled: isSaving || !current.author_id || !current.name.trim() || !current.system_prompt.trim(),
      onClick: async () => {
        setIsSaving(true);
        await onSave(current);
        setIsSaving(false);
      }
    },
    isSaving ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "mr-2 size-4 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Zap, { className: "mr-2 size-4" }),
    current.id === 0 ? window.wp.i18n.__("Create Persona", "structura") : window.wp.i18n.__("Save Changes", "structura")
  ))));
};
const TemplateLibrary = ({ isOpen, onClose, onSelect }) => {
  return /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open: isOpen, onClose, size: "xl" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement(Y.Header, { className: "flex items-center justify-between border-b border-gray-200 px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement(Y.Title, null, window.wp.i18n.__("Persona Templates", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      onClick: onClose,
      className: "cursor-pointer rounded-full p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:ring-2 focus:ring-brand-500 focus:outline-none"
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "sr-only" }, window.wp.i18n.__("Close Persona Templates", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(X, { strokeWidth: 2, className: "size-5" })
  )), /* @__PURE__ */ window.wp.element.createElement(Y.Body, { className: "max-h-[70vh] overflow-y-auto" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" }, PERSONA_TEMPLATES.map((t2, i2) => /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      key: i2,
      className: "group relative flex cursor-pointer flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white transition-all hover:-translate-y-1 hover:border-brand-500 hover:shadow-xl",
      onClick: () => onSelect(t2)
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "p-6 pb-4" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-base! leading-tight font-extrabold text-gray-900" }, t2.name), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2" }, /* @__PURE__ */ window.wp.element.createElement(
      Me,
      {
        variant: "solid",
        className: `text-[9px]! uppercase ${getToneColor(t2.tone).text} ${getToneColor(t2.tone).background} ${getToneColor(t2.tone).border}`
      },
      getToneLabel(t2.tone)
    ))),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-y border-gray-100 bg-gray-50/50 px-6 py-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-2 font-mono text-[9px] font-black tracking-[0.2em] text-gray-400 uppercase" }, window.wp.i18n.__("System Directive", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "line-clamp-3 font-mono text-xs leading-relaxed text-gray-600 italic" }, '"', t2.system_prompt, '"')),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1 p-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-1.5 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black tracking-widest text-gray-400 uppercase" }, window.wp.i18n.__("Reading Level", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-bold text-gray-700" }, getReadingLevelLabel(t2.reading_level))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "h-1.5 w-full overflow-hidden rounded-full bg-gray-100" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: `${getReadingLevelColor(t2.reading_level).progress} h-full transition-all duration-1000`,
        style: { width: `${getReadingLevelProgress(t2.reading_level)}%` }
      }
    )))
  ))))));
};
function usePersonaLibraryControls() {
  const [isEditing, setIsEditing] = window.wp.element.useState(false);
  const [showTemplates, setShowTemplates] = window.wp.element.useState(false);
  const [selectedPersona, setSelectedPersona] = window.wp.element.useState(null);
  return {
    isEditing,
    setIsEditing,
    showTemplates,
    setShowTemplates,
    selectedPersona,
    setSelectedPersona,
    openNew: () => {
      setSelectedPersona(null);
      setIsEditing(true);
    },
    openTemplates: () => setShowTemplates(true)
  };
}
const PersonaManager = ({
  emptyState,
  controls: externalControls,
  hideActions,
  memberIds,
  onBind,
  onUnbind,
  binding
}) => {
  const { data: personas = [], isLoading: loadingPersonas } = usePersonasQuery();
  const { data: wpUsers = [], isLoading: loadingUsers } = useWpUsersQuery();
  const { savePersona } = usePersonaMutations();
  const internalControls = usePersonaLibraryControls();
  const c2 = externalControls ?? internalControls;
  if (loadingPersonas || loadingUsers) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Syncing personas…", "structura"), size: "md", padding: "md" });
  }
  const perSite = memberIds !== void 0;
  const memberSet = new Set(memberIds ?? []);
  const gridPersonas = perSite ? personas.filter((p2) => memberSet.has(String(p2.id))) : personas;
  const bindable = perSite ? personas.filter((p2) => !memberSet.has(String(p2.id))) : [];
  const showEmptyState = gridPersonas.length === 0 && bindable.length === 0;
  const handleSave = async (data) => {
    const res = await savePersona(data);
    if (perSite && onBind && res?.id != null && String(res.id) !== "0") {
      onBind(String(res.id));
    }
    c2.setIsEditing(false);
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, !hideActions && !showEmptyState && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end gap-3" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: c2.openTemplates, className: "shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement(BookOpen, { className: "mr-2 size-4" }), " ", window.wp.i18n.__("Templates", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: c2.openNew, className: "shadow-brand-600/20 shadow-lg" }, /* @__PURE__ */ window.wp.element.createElement(Plus, { className: "mr-2 size-4" }), " ", window.wp.i18n.__("New Persona", "structura"))), showEmptyState ? emptyState ?? /* @__PURE__ */ window.wp.element.createElement(
    Ea,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Users, { size: 28 }),
      title: window.wp.i18n.__("No Personas Yet", "structura"),
      description: window.wp.i18n.__(
        "Personas define the voice, tone, and writing style of your AI content. Create your first one or start from a template.",
        "structura"
      ),
      action: /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-3 sm:flex-row" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: c2.openNew }, /* @__PURE__ */ window.wp.element.createElement(Plus, { className: "mr-2 size-4" }), window.wp.i18n.__("New Persona", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: c2.openTemplates }, /* @__PURE__ */ window.wp.element.createElement(BookOpen, { className: "mr-2 size-4" }), window.wp.i18n.__("Browse Templates", "structura")))
    }
  ) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, perSite && gridPersonas.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-2xl border-2 border-dashed border-neutral-200 px-6 py-8 text-center text-sm text-neutral-500 dark:border-neutral-800 dark:text-neutral-400" }, window.wp.i18n.__(
    "No voice is writing for this site yet. Bind one from your workspace below, or create a new persona.",
    "structura"
  )) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-3" }, gridPersonas.map((p2) => /* @__PURE__ */ window.wp.element.createElement("div", { key: p2.id, className: "flex flex-col gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    PersonaCard,
    {
      persona: p2,
      author: wpUsers.find((u2) => u2.id === p2.author_id),
      onEdit: () => {
        c2.setSelectedPersona(p2);
        c2.setIsEditing(true);
      }
    }
  ), perSite && onUnbind && /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      disabled: binding,
      onClick: () => onUnbind(String(p2.id)),
      className: "cursor-pointer self-start text-xs font-semibold text-neutral-400 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400"
    },
    window.wp.i18n.__("Remove from this site", "structura")
  )))), perSite && bindable.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-200 bg-neutral-50/60 p-4 dark:border-neutral-800 dark:bg-neutral-900/40" }, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "mt-0! mb-3! text-[11px] font-black tracking-[0.14em] text-neutral-400 uppercase" }, window.wp.i18n.__("Available in your workspace", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-2" }, bindable.map((p2) => /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      key: p2.id,
      className: "flex items-center justify-between gap-3 rounded-lg border border-neutral-200 bg-white px-3 py-2 dark:border-neutral-800 dark:bg-neutral-900"
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "block truncate text-sm font-semibold text-neutral-800 dark:text-neutral-100" }, p2.name), p2.tone && /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-400 capitalize" }, String(p2.tone))),
    /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "secondary",
        size: "sm",
        disabled: binding,
        onClick: () => onBind?.(String(p2.id))
      },
      /* @__PURE__ */ window.wp.element.createElement(Plus, { className: "mr-1 size-3.5" }),
      window.wp.i18n.__("Bind", "structura")
    )
  ))))), c2.isEditing && /* @__PURE__ */ window.wp.element.createElement(
    PersonaEditor,
    {
      persona: c2.selectedPersona,
      users: wpUsers,
      onClose: () => c2.setIsEditing(false),
      onSave: handleSave
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    TemplateLibrary,
    {
      isOpen: c2.showTemplates,
      onClose: () => c2.setShowTemplates(false),
      onSelect: (template) => {
        c2.setSelectedPersona({ ...template, id: 0, author_id: 0 });
        c2.setShowTemplates(false);
        c2.setIsEditing(true);
      }
    }
  ));
};
const PersonasPage = () => {
  const controls = usePersonaLibraryControls();
  const memberIds = useMemberPersonaIdsQuery().data ?? [];
  const { addMembership, removeMembership, isBinding } = usePersonaMutations();
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col justify-between gap-4 md:flex-row md:items-center" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Personas", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Persona & Author Management", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: controls.openTemplates, className: "shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement(BookOpen, { className: "mr-2 size-4" }), " ", window.wp.i18n.__("Templates", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: controls.openNew, className: "shadow-lg shadow-brand-600/20" }, /* @__PURE__ */ window.wp.element.createElement(Plus, { className: "mr-2 size-4" }), " ", window.wp.i18n.__("New Persona", "structura")))), /* @__PURE__ */ window.wp.element.createElement(
    PersonaManager,
    {
      controls,
      hideActions: true,
      memberIds,
      onBind: (id) => void addMembership(id),
      onUnbind: (id) => void removeMembership(id),
      binding: isBinding
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-12 flex items-center gap-4 rounded-2xl border border-gray-200 bg-white p-6 shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-12 w-12 items-center justify-center rounded-xl bg-brand-50 text-brand-600" }, /* @__PURE__ */ window.wp.element.createElement(Layers, { className: "h-6 w-6" })), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm font-bold text-gray-900" }, window.wp.i18n.__("Persona Modularization", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! max-w-xl text-xs text-gray-500" }, window.wp.i18n.__(
    "All Personas operate as independent architectural modules. You can select any Persona when initiating a Campaign or a One-Time post deployment.",
    "structura"
  )))));
};
const RunDetailPage = () => {
  const { runId } = useParams();
  const { data, isError, isLoading } = useCampaignRunQuery(runId ?? null);
  if (!runId) {
    return /* @__PURE__ */ window.wp.element.createElement(NotFoundState$1, null);
  }
  if (isError) {
    return /* @__PURE__ */ window.wp.element.createElement(NotFoundState$1, null);
  }
  if (isLoading || !data?.run) {
    return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow" }, /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading run…", "structura"), size: "lg", padding: "lg" }));
  }
  return /* @__PURE__ */ window.wp.element.createElement(RunDetailLoaded, { run: data.run });
};
const NotFoundState$1 = () => /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-300/50 bg-white p-8 text-center shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement(
  CircleAlert,
  {
    className: "mx-auto mb-3 h-8 w-8 text-neutral-400 dark:text-neutral-500",
    "aria-hidden": true
  }
), /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Run not found", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! text-sm text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
  "This run's details are no longer available. Runs are kept for 30 days after they finish.",
  "structura"
)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-6 flex justify-center" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", href: "#/" }, /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { className: "h-4 w-4", "aria-hidden": true }), window.wp.i18n.__("Back to Overview", "structura")))));
const RunDetailLoaded = ({ run }) => {
  const isSuccess = run.status === "succeeded" || run.status === "succeeded_with_warnings";
  const isLivePost = isSuccess && Boolean(run.resultPostUrl) && (run.outputs?.post?.status ?? "publish") === "publish";
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow" }, /* @__PURE__ */ window.wp.element.createElement(RunDetailHeader, { run }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(RunTimeline, { run }), /* @__PURE__ */ window.wp.element.createElement(RunInputsCard, { run }), /* @__PURE__ */ window.wp.element.createElement(RunOutputsCard, { run }), isLivePost && /* @__PURE__ */ window.wp.element.createElement(
    SearchPerformanceSection,
    {
      pageUrl: run.resultPostUrl,
      publishedAt: run.endedAt ?? run.startedAt
    }
  ), /* @__PURE__ */ window.wp.element.createElement(RunTechnicalInspector, { run })));
};
const RunDetailHeader = ({ run }) => {
  const startedAt = new Date(run.startedAt);
  const isSuccess = run.status === "succeeded" || run.status === "succeeded_with_warnings";
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement(
    Link$2,
    {
      to: `/campaigns/${run.campaignId}`,
      className: "mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-neutral-400 transition-colors hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { className: "h-3 w-3", "aria-hidden": true }),
    window.wp.i18n.sprintf(window.wp.i18n.__("Back to %s", "structura"), run.campaignName)
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-start gap-3 md:flex-row md:items-center md:justify-between md:gap-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1 space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! truncate text-2xl leading-tight font-black tracking-tight text-[#1d2327] dark:text-white" }, run.campaignName), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-4 flex flex-wrap items-center gap-x-3 gap-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement(RunStatusBadge, { status: run.status }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 text-xs font-medium text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement(Clock, { className: "h-3 w-3 opacity-60", "aria-hidden": true }), /* @__PURE__ */ window.wp.element.createElement("span", null, formatAbsoluteTime$1(startedAt))), run.durationMs != null && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 border-l border-neutral-200 pl-3 text-xs font-medium text-neutral-500 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(Timer, { className: "h-3 w-3 opacity-60", "aria-hidden": true }), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.sprintf(window.wp.i18n.__("Finished in %s", "structura"), formatDuration(run.durationMs)))), run.servedFromStock && /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-l border-neutral-200 pl-3 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "bg-brand-50 text-brand-700 dark:bg-brand-950/40 dark:text-brand-300 inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[10px] font-bold tracking-wider uppercase" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "h-3 w-3", "aria-hidden": true }), window.wp.i18n.__("Pre-generated", "structura"))))), isSuccess && run.resultPostUrl && // Use the @structura/ui Button primitive instead of a hand-rolled
  // anchor. The previous version was px-6 py-3 rounded-xl with a
  // heavy `shadow-lg` — too chunky next to the slim badge + meta
  // row, and inconsistent with every other CTA in the SPA which
  // goes through `Button`. `size="sm"` resolves to px-3 py-1.5
  // text-xs rounded-lg per `packages/ui/src/variants/button.ts`,
  // and `variant="primary"` already includes the WP-admin link-
  // cascade overrides (text-white!, hover:text-white!, etc.) so
  // the manual cascade-busting on the old anchor is no longer
  // needed.
  /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      href: run.resultPostUrl,
      target: "_blank",
      rel: "noopener noreferrer",
      variant: "primary",
      size: "sm",
      className: "shrink-0"
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "m-0!" }, window.wp.i18n.__("View Published Post", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "ml-1.5 h-3.5 w-3.5", "aria-hidden": true })
  )));
};
const RunStatusBadge = ({ status }) => {
  const variants = {
    succeeded: {
      label: window.wp.i18n.__("Succeeded", "structura"),
      intent: "success",
      Icon: CircleCheck
    },
    succeeded_with_warnings: {
      label: window.wp.i18n.__("Warnings", "structura"),
      intent: "warning",
      Icon: CircleAlert
    },
    failed: {
      label: window.wp.i18n.__("Stopped", "structura"),
      intent: "destructive",
      Icon: TriangleAlert
    },
    cancelled: {
      label: window.wp.i18n.__("Cancelled", "structura"),
      intent: "default",
      Icon: Minus
    },
    running: {
      label: window.wp.i18n.__("In Progress", "structura"),
      intent: "indigo",
      Icon: LoaderCircle,
      spin: true
    },
    awaiting_pull: {
      // The cloud finished but couldn't reach the site directly, so the post
      // is being delivered via the backup pull path — still in flight.
      label: window.wp.i18n.__("Delivering", "structura"),
      intent: "indigo",
      Icon: LoaderCircle,
      spin: true
    },
    queued: {
      label: window.wp.i18n.__("Queued", "structura"),
      intent: "default",
      Icon: Timer
    }
  };
  const variant = variants[status] ?? variants.queued;
  const Icon2 = variant.Icon;
  return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: variant.intent, variant: "solid" }, /* @__PURE__ */ window.wp.element.createElement(Icon2, { className: B$1("h-3 w-3", variant.spin && "animate-spin") }), variant.label);
};
function authorityChipLabel(a3) {
  if (typeof a3.title === "string" && a3.title) return a3.title;
  const t2 = a3.title;
  if (t2 && typeof t2 === "object" && typeof t2.domain === "string") {
    return t2.domain;
  }
  if (typeof a3.url === "string") {
    return a3.url.replace(/^https?:\/\//, "").replace(/\/.*$/, "") || a3.url;
  }
  return "";
}
const RunInputsCard = ({ run }) => {
  const inputs = run.inputs;
  if (!inputs) {
    return /* @__PURE__ */ window.wp.element.createElement(SectionCard, { label: window.wp.i18n.__("Run Configuration", "structura"), Icon: Cpu }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "This run predates the inputs snapshot, so its request details aren't available.",
      "structura"
    )));
  }
  const personaId = inputs.persona?.personaId;
  const { data: personas = [] } = usePersonasQuery();
  const personaName = personaId ? personas.find((p2) => String(p2.id) === personaId)?.name ?? null : null;
  const hasKeywords = (inputs.keywords?.length ?? 0) > 0;
  const hasPersona = !!personaId;
  const textProvider = inputs.providers?.text;
  const imageProvider = inputs.providers?.image;
  const textFallback = inputs.fallbackProviders?.text;
  const imageFallback = inputs.fallbackProviders?.image;
  const hasAnyProvider = textProvider || imageProvider || textFallback || imageFallback;
  const hasAudience = !!inputs.targetAudience;
  const hasRhythm = !!inputs.rhythm;
  const hasAuthorities = (inputs.authorities?.length ?? 0) > 0;
  return /* @__PURE__ */ window.wp.element.createElement(SectionCard, { label: window.wp.i18n.__("Run Configuration", "structura"), Icon: Cpu }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-8 md:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, hasKeywords && /* @__PURE__ */ window.wp.element.createElement(FieldBlock, { label: window.wp.i18n.__("Target Keywords", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap gap-2" }, inputs.keywords.map((kw) => /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      key: kw,
      className: "rounded-lg border border-neutral-200 bg-neutral-50 px-2.5 py-1 text-xs font-bold text-neutral-700 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-300"
    },
    kw
  )))), hasAuthorities && /* @__PURE__ */ window.wp.element.createElement(FieldBlock, { label: window.wp.i18n.__("Authorities", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap gap-2" }, inputs.authorities.map((a3, i2) => /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      key: typeof a3.url === "string" ? a3.url : i2,
      className: "rounded-lg border border-neutral-200 bg-neutral-50 px-2.5 py-1 text-xs font-bold text-neutral-700 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-300"
    },
    authorityChipLabel(a3)
  )))), hasPersona && /* @__PURE__ */ window.wp.element.createElement(FieldBlock, { label: window.wp.i18n.__("Content Persona", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3 rounded-xl border border-neutral-100 bg-neutral-50/50 p-3 dark:border-neutral-800 dark:bg-neutral-950/30" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-100 text-brand-600 dark:bg-brand-900/30 flex h-10 w-10 shrink-0 items-center justify-center rounded-full" }, /* @__PURE__ */ window.wp.element.createElement(UserCheck, { size: 20, "aria-hidden": true })), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-bold dark:text-white" }, personaName ?? window.wp.i18n.__("Persona deleted", "structura"))))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, hasAnyProvider && /* @__PURE__ */ window.wp.element.createElement(FieldBlock, { label: window.wp.i18n.__("AI Intelligence", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "divide-y divide-neutral-100 overflow-hidden rounded-xl border border-neutral-200 dark:divide-neutral-800 dark:border-neutral-800" }, textProvider && /* @__PURE__ */ window.wp.element.createElement(
    ProviderRow,
    {
      slotLabel: window.wp.i18n.__("Text Provider", "structura"),
      providerId: textProvider.id,
      model: textProvider.model
    }
  ), imageProvider && /* @__PURE__ */ window.wp.element.createElement(
    ProviderRow,
    {
      slotLabel: window.wp.i18n.__("Image Provider", "structura"),
      providerId: imageProvider.id,
      model: imageProvider.model
    }
  ), textFallback && /* @__PURE__ */ window.wp.element.createElement(
    ProviderRow,
    {
      slotLabel: window.wp.i18n.__("Text Fallback (used)", "structura"),
      providerId: textFallback.id,
      model: textFallback.model,
      secondary: true
    }
  ), imageFallback && /* @__PURE__ */ window.wp.element.createElement(
    ProviderRow,
    {
      slotLabel: window.wp.i18n.__("Image Fallback (used)", "structura"),
      providerId: imageFallback.id,
      model: imageFallback.model,
      secondary: true
    }
  ))), (hasAudience || hasRhythm) && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex gap-4" }, hasAudience && /* @__PURE__ */ window.wp.element.createElement(FieldBlock, { className: "flex-1", label: window.wp.i18n.__("Audience", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-200 bg-neutral-50/30 p-3 dark:border-neutral-800 dark:bg-neutral-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-bold dark:text-neutral-200" }, inputs.targetAudience))), hasRhythm && /* @__PURE__ */ window.wp.element.createElement(FieldBlock, { className: "flex-1", label: window.wp.i18n.__("Rhythm", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-200 bg-neutral-50/30 p-3 dark:border-neutral-800 dark:bg-neutral-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! font-mono text-xs font-bold dark:text-neutral-200" }, inputs.rhythm)))))));
};
const FieldBlock = ({
  label,
  children,
  className
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1("space-y-2", className) }, /* @__PURE__ */ window.wp.element.createElement("label", { className: "text-xs font-bold text-neutral-400" }, label), children);
const PROVIDER_LABELS$1 = {
  openai: "OpenAI",
  gemini: "Gemini",
  anthropic: "Anthropic"
};
const ProviderRow = ({
  slotLabel,
  providerId,
  model,
  secondary
}) => {
  const name = PROVIDER_LABELS$1[providerId] ?? providerId;
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "flex items-center justify-between bg-neutral-50/30 p-3 dark:bg-neutral-950/20",
        secondary && "opacity-80"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium text-neutral-500" }, slotLabel),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-bold dark:text-neutral-200" }, name, " ", /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[11px] font-normal text-neutral-500 dark:text-neutral-400" }, "(", model, ")"))
  );
};
const RunOutputsCard = ({ run }) => {
  const isSuccess = run.status === "succeeded" || run.status === "succeeded_with_warnings";
  const isFailed = run.status === "failed";
  return /* @__PURE__ */ window.wp.element.createElement(SectionCard, { label: window.wp.i18n.__("Production Results", "structura"), Icon: Share2 }, isFailed && /* @__PURE__ */ window.wp.element.createElement(FailureOutputs, { run }), isSuccess && /* @__PURE__ */ window.wp.element.createElement(SuccessOutputs, { run }), !isSuccess && !isFailed && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center py-8 text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-neutral-100 text-neutral-400 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(FileText, { size: 24, "aria-hidden": true })), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Output will appear here once the run reaches completion.", "structura"))));
};
function hasAnyOutputContent(outputs) {
  if (!outputs) return false;
  if (outputs.post?.id) return true;
  if (outputs.images && outputs.images.length > 0) return true;
  return false;
}
const FailureOutputs = ({ run }) => {
  const stoppedAt = milestoneHeadline(run.currentStep);
  const hasPartial = hasAnyOutputContent(run.outputs);
  const imageCount = run.outputs?.images?.length ?? 0;
  const userMessage = run.error?.userMessage?.trim();
  const stoppedAtHint = window.wp.i18n.sprintf(window.wp.i18n.__("Stopped at %s.", "structura"), stoppedAt);
  if (!hasPartial) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-red-200 bg-red-50/40 p-4 dark:border-red-900/40 dark:bg-red-950/20" }, userMessage ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-red-900 dark:text-red-200" }, userMessage), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-red-700/80 dark:text-red-300/70" }, stoppedAtHint)) : /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-red-800 dark:text-red-300" }, window.wp.i18n.sprintf(
      window.wp.i18n.__("This run stopped at %s, before producing output.", "structura"),
      stoppedAt
    )));
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-amber-200 bg-amber-50/40 p-4 dark:border-amber-900/40 dark:bg-amber-950/20" }, userMessage ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-amber-900 dark:text-amber-100" }, userMessage), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-amber-800/80 dark:text-amber-200/70" }, stoppedAtHint)) : /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-amber-800 dark:text-amber-200" }, window.wp.i18n.sprintf(
    window.wp.i18n.__("This run stopped at %s before the post was published.", "structura"),
    stoppedAt
  ))), imageCount > 0 && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-600 dark:text-neutral-300" }, window.wp.i18n.sprintf(
    window.wp.i18n.__(
      "Generated %d image(s) before stopping — they weren't attached to a post.",
      "structura"
    ),
    imageCount
  )));
};
const SuccessOutputs = ({ run }) => {
  const channelsSummary = run.outputs?.channelsSummary;
  const imageFailures = run.outputs?.imageFailures;
  const showWarningsNote = run.status === "succeeded_with_warnings";
  const hasChannels = channelsSummary && (channelsSummary.succeeded.length > 0 || channelsSummary.failed.length > 0 || channelsSummary.skipped.length > 0);
  const hasImageFailures = !!imageFailures && imageFailures.length > 0;
  const warningHeadline = hasImageFailures && !channelsSummary?.failed?.length ? window.wp.i18n.__(
    "The post was published, but one or more images couldn't be generated. Details below.",
    "structura"
  ) : hasImageFailures && channelsSummary?.failed?.length ? window.wp.i18n.__(
    "The post was published, but some images and distribution channels had a problem. Details below.",
    "structura"
  ) : window.wp.i18n.__(
    "The post was published, but one or more distribution channels had a problem. Details below.",
    "structura"
  );
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-8" }, showWarningsNote && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-amber-200 bg-amber-50/40 p-4 text-sm text-amber-800 dark:border-amber-900/40 dark:bg-amber-950/20 dark:text-amber-200" }, warningHeadline), run.resultPostUrl ? /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: run.resultPostUrl,
      target: "_blank",
      rel: "noopener noreferrer",
      className: "border-brand-100 bg-brand-50/20 dark:border-brand-900/30 dark:bg-brand-950/10 hover:border-brand-200 flex items-center justify-between gap-4 rounded-xl border-2 p-4 transition-colors"
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-center gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "text-brand-600 flex h-12 w-12 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-white shadow-sm dark:border-neutral-700 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(Globe, { size: 24, "aria-hidden": true })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-bold dark:text-white" }, window.wp.i18n.__("WordPress Published Post", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! truncate text-xs text-neutral-500" }, run.resultPostUrl))),
    /* @__PURE__ */ window.wp.element.createElement(
      ChevronRight,
      {
        className: "hover:text-brand-600 h-5 w-5 shrink-0 text-neutral-400 transition-colors",
        "aria-hidden": true
      }
    )
  ) : /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Waiting for WordPress to confirm the published post.", "structura")), hasChannels && /* @__PURE__ */ window.wp.element.createElement(ChannelsGrid, { summary: channelsSummary }), hasImageFailures && /* @__PURE__ */ window.wp.element.createElement(ImageFailuresList, { failures: imageFailures }));
};
const ImageFailuresList = ({
  failures
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold text-neutral-700 dark:text-neutral-200" }, window.wp.i18n.__("Image generation issues", "structura")), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0! list-none space-y-2 p-0!" }, failures.map((failure) => /* @__PURE__ */ window.wp.element.createElement(
  "li",
  {
    key: failure.slot,
    className: "rounded-xl border border-amber-200 bg-amber-50/40 p-4 text-sm dark:border-amber-900/40 dark:bg-amber-950/20"
  },
  /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! font-bold text-amber-900 dark:text-amber-200" }, failure.slot === "featured" ? window.wp.i18n.__("Featured image", "structura") : window.wp.i18n.__("Body image", "structura")),
  /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-amber-800 dark:text-amber-200/80" }, failure.reason)
))));
const ChannelsGrid = ({
  summary
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("label", { className: "text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Distribution Channels", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3" }, summary.succeeded.map((id) => /* @__PURE__ */ window.wp.element.createElement(ChannelChip, { key: `ok-${id}`, id, intent: "success" })), summary.failed.map((id) => /* @__PURE__ */ window.wp.element.createElement(ChannelChip, { key: `fail-${id}`, id, intent: "failure" })), summary.skipped.map((id) => /* @__PURE__ */ window.wp.element.createElement(ChannelChip, { key: `skip-${id}`, id, intent: "skipped" }))));
const ChannelChip = ({ id, intent }) => {
  const dotClass = intent === "success" ? "bg-emerald-500 shadow-[0_0_8px_rgba(16,185,129,0.5)]" : intent === "failure" ? "bg-red-500 shadow-[0_0_8px_rgba(239,68,68,0.5)]" : "bg-neutral-400";
  const textClass = intent === "skipped" ? "text-neutral-500 dark:text-neutral-400" : "dark:text-neutral-200";
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 rounded-xl border border-neutral-200 bg-neutral-50/30 p-3 dark:border-neutral-800 dark:bg-neutral-950/20" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: B$1("h-2 w-2 shrink-0 rounded-full", dotClass) }), /* @__PURE__ */ window.wp.element.createElement("span", { className: B$1("truncate text-xs font-bold", textClass) }, id));
};
const RunTechnicalInspector = ({ run }) => {
  const [expanded, setExpanded] = window.wp.element.useState(false);
  const truncatedRunId = run.runId.length > 12 ? `${run.runId.substring(0, 12)}…` : run.runId;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "overflow-hidden rounded-2xl border border-neutral-300/50 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setExpanded((v2) => !v2),
      "aria-expanded": expanded,
      className: "group flex w-full items-center justify-between p-5 transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-800/50"
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "group-hover:text-brand-500 flex h-8 w-8 items-center justify-center rounded-lg bg-neutral-100 text-neutral-500 transition-colors dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(Terminal, { size: 16, "aria-hidden": true })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-start text-left" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm leading-tight font-bold text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Technical Inspector", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-mono text-[10px] tracking-tighter text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.sprintf(window.wp.i18n.__("ID: %s", "structura"), truncatedRunId)))),
    /* @__PURE__ */ window.wp.element.createElement(
      ChevronDown,
      {
        size: 18,
        className: B$1(
          "text-neutral-400 transition-transform duration-300",
          expanded && "rotate-180"
        ),
        "aria-hidden": true
      }
    )
  ), expanded && /* @__PURE__ */ window.wp.element.createElement(TechnicalInspectorBody, { run }));
};
const TechnicalInspectorBody = ({ run }) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6 border-t border-neutral-100 bg-neutral-50/30 p-6 dark:border-neutral-800 dark:bg-[#0c0c0c]" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid gap-6 font-mono text-[11px] sm:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-1! font-bold text-neutral-400 uppercase" }, window.wp.i18n.__("Correlation Trace", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded border border-neutral-200 bg-white p-2 break-all dark:border-neutral-800 dark:bg-neutral-900" }, run.runId)), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-1! font-bold text-neutral-400 uppercase" }, window.wp.i18n.__("System Error Reference", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded border border-neutral-200 bg-white p-2 dark:border-neutral-800 dark:bg-neutral-900" }, run.error?.code ?? "null", run.error?.errorKind && /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2 text-neutral-400" }, "· ", run.error.errorKind)), run.error?.devMessage && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1.5 mb-0! text-[11px] leading-snug text-neutral-500 dark:text-neutral-400" }, run.error.devMessage))), run.stepDurationsMs && Object.keys(run.stepDurationsMs).length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-2! text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Step Timings", "structura")), /* @__PURE__ */ window.wp.element.createElement("dl", { className: "space-y-1" }, milestoneOrderForFlow(run.flow).filter((m3) => run.stepDurationsMs?.[m3] != null).map((m3) => /* @__PURE__ */ window.wp.element.createElement("div", { key: m3, className: "grid grid-cols-[140px_1fr] items-baseline gap-4" }, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "font-mono text-xs text-neutral-500 dark:text-neutral-400" }, m3), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "font-mono text-xs text-neutral-800 dark:text-neutral-200" }, formatDuration(run.stepDurationsMs?.[m3] ?? 0)))))));
const SectionCard = ({
  label,
  Icon: Icon2,
  children
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-300/50 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "mt-0! mb-6! flex! items-center gap-2 text-[10px] font-black tracking-[0.2em] text-neutral-400 uppercase" }, /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 14 }), label), children);
function formatAbsoluteTime$1(d2) {
  try {
    return new Intl.DateTimeFormat(void 0, {
      dateStyle: "medium",
      timeStyle: "short"
    }).format(d2);
  } catch {
    return d2.toISOString();
  }
}
const MAX_VISIBLE_ROWS = 5;
const FALLBACK_TITLE = () => window.wp.i18n.__("Single-post generation", "structura");
const deriveTitle = (run) => {
  const snapshot = run.inputSnapshot;
  if (snapshot && typeof snapshot === "object") {
    const identity2 = snapshot.identity;
    if (identity2 && typeof identity2 === "object") {
      const objective = identity2.objective;
      if (typeof objective === "string" && objective.trim()) {
        return objective.length > 80 ? objective.slice(0, 77) + "…" : objective;
      }
    }
  }
  return FALLBACK_TITLE();
};
const StatusIcon = ({ status }) => {
  if (status === "succeeded" || status === "succeeded_with_warnings") {
    return /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
  }
  if (status === "failed") {
    return /* @__PURE__ */ window.wp.element.createElement(CircleAlert, { className: "h-4 w-4 text-red-600 dark:text-red-400" });
  }
  if (status === "cancelled") {
    return /* @__PURE__ */ window.wp.element.createElement(CircleX, { className: "h-4 w-4 text-neutral-400" });
  }
  return /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "h-4 w-4 animate-spin text-blue-600 dark:text-blue-400" });
};
const relativeTime = (iso) => {
  if (!iso) return "";
  try {
    const then = new Date(iso).getTime();
    const now = Date.now();
    const diffMs = then - now;
    const absMs = Math.abs(diffMs);
    const rtf = new Intl.RelativeTimeFormat(void 0, { numeric: "auto" });
    if (absMs < 6e4) return rtf.format(Math.round(diffMs / 1e3), "second");
    if (absMs < 36e5) return rtf.format(Math.round(diffMs / 6e4), "minute");
    if (absMs < 864e5) return rtf.format(Math.round(diffMs / 36e5), "hour");
    return rtf.format(Math.round(diffMs / 864e5), "day");
  } catch {
    return iso;
  }
};
const RecentSinglePostRuns = () => {
  const { data: runs = [], isLoading } = useSinglePostRunsQuery(MAX_VISIBLE_ROWS);
  if (isLoading || runs.length === 0) {
    return null;
  }
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden p-0! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-gray-100 bg-white px-6 py-4 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-xs font-bold tracking-widest text-gray-900 uppercase dark:text-white" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "text-brand-600 dark:text-brand-400 h-4 w-4" }), window.wp.i18n.__("Recent Generations", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Link$2,
    {
      to: "/generate",
      className: "text-brand-600 hover:text-brand-700 dark:text-brand-400 dark:hover:text-brand-300 inline-flex items-center gap-1.5 text-xs font-semibold"
    },
    /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 12 }),
    window.wp.i18n.__("Generate Post", "structura")
  )), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "divide-y divide-gray-100 dark:divide-neutral-800" }, runs.map((run) => {
    const title = deriveTitle(run);
    const isInFlight = run.status === "queued" || run.status === "running";
    return /* @__PURE__ */ window.wp.element.createElement(
      "li",
      {
        key: run.runId,
        className: "transition-colors hover:bg-gray-50/60 dark:hover:bg-neutral-800/40"
      },
      /* @__PURE__ */ window.wp.element.createElement(
        Link$2,
        {
          to: `/generate/runs/${run.runId}`,
          className: "flex items-center justify-between gap-4 px-6 py-3"
        },
        /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(StatusIcon, { status: run.status })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! truncate text-sm font-medium text-neutral-900 dark:text-neutral-100" }, title), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-[11px] text-neutral-500 dark:text-neutral-400" }, relativeTime(run.startedAt), run.headline && isInFlight ? ` • ${run.headline}` : ""))),
        /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, run.status === "succeeded" || run.status === "succeeded_with_warnings" ? /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "success" }, window.wp.i18n.__("Done", "structura")) : run.status === "failed" ? /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "destructive" }, window.wp.i18n.__("Failed", "structura")) : run.status === "cancelled" ? /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "secondary" }, window.wp.i18n.__("Cancelled", "structura")) : /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "info" }, window.wp.i18n.__("Running", "structura")), run.resultPostUrl && (run.status === "succeeded" || run.status === "succeeded_with_warnings") && /* @__PURE__ */ window.wp.element.createElement(
          "a",
          {
            href: run.resultPostUrl,
            target: "_blank",
            rel: "noopener noreferrer",
            onClick: (e2) => e2.stopPropagation(),
            className: "text-neutral-400 transition-colors hover:text-emerald-600 dark:hover:text-emerald-400",
            "aria-label": window.wp.i18n.__("View live post", "structura")
          },
          /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14 })
        ))
      )
    );
  })));
};
const UpgradeCard = () => {
  const { plan, loading } = useLicense();
  if (loading) return null;
  const isAnonymous = plan === "none";
  const content = isAnonymous ? {
    eyebrow: window.wp.i18n.__("Get started", "structura"),
    title: window.wp.i18n.__("Create your free account", "structura"),
    body: window.wp.i18n.__(
      "Register a free license to unlock featured images, the full Gutenberg block library, and one-click activation across your sites.",
      "structura"
    ),
    // Same label + translation as the former upgrade banner — keeps
    // the CTA wording consistent and reuses the existing string.
    cta: window.wp.i18n.__("Get Free License", "structura")
  } : {
    eyebrow: window.wp.i18n.__("Go Pro", "structura"),
    title: window.wp.i18n.__("Unlock the full engine", "structura"),
    body: window.wp.i18n.__(
      "The 20-point SEO protocol, live SERP research, Keyword Bank & authority links — on every post.",
      "structura"
    ),
    cta: window.wp.i18n.__("See Pro plans", "structura")
  };
  const href = buildPortalSignupUrl({
    intent: "general_upgrade",
    domain: typeof window !== "undefined" ? window.location.hostname : void 0,
    plan
  });
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "relative flex h-full flex-col overflow-hidden rounded-lg border-l-4 border-l-purple-500 bg-linear-to-br from-purple-50/60 to-white p-6! shadow-sm dark:border-l-purple-500 dark:from-purple-950/20 dark:to-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement(
    Sparkles,
    {
      "aria-hidden": "true",
      className: "pointer-events-none absolute -right-3 -bottom-3 h-20 w-20 rotate-12 text-purple-500/10"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { "aria-hidden": "true", size: 12, className: "text-purple-500" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[10px] font-bold tracking-widest text-purple-600 uppercase dark:text-purple-300" }, content.eyebrow)), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mt-2! mb-1! text-lg font-black text-neutral-900 dark:text-white" }, content.title), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm leading-relaxed text-neutral-500 dark:text-neutral-400" }, content.body), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, size: "sm", className: "mt-4 self-start" }, /* @__PURE__ */ window.wp.element.createElement("a", { href, target: "_blank", rel: "noreferrer", className: "text-white!" }, content.cta, /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" }))));
};
const WIZARD_QUERY_KEY = ["onboarding", "wizard", "state"];
function useWizardStateQuery(opts = {}) {
  return useQuery({
    queryKey: WIZARD_QUERY_KEY,
    enabled: opts.enabled ?? true,
    // The wizard state is a background nudge (auto-redirect + resume
    // tile), not user-requested data — a failure must never produce
    // the global "Data Fetch Error" toast. This was THE toast every
    // fresh keyless install saw on first load: the query fired
    // without an activation bearer and the proxy rejected it.
    meta: { silentError: true },
    staleTime: 30 * 1e3,
    queryFn: async () => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/state",
        method: "POST",
        data: {}
      });
    }
  });
}
function useSaveWizardStepMutation() {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: async (step) => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/step",
        method: "POST",
        data: { step }
      });
    },
    onSuccess: (result) => {
      queryClient2.setQueryData(
        WIZARD_QUERY_KEY,
        (prev) => ({
          state: result.state,
          // Once the wizard has been mutated by the user, the
          // `justCreated` flag from the initial GET is stale; clear
          // it so the SPA doesn't keep showing fresh-start animations.
          justCreated: prev?.justCreated ?? false
        })
      );
    }
  });
}
function useResetWizardMutation() {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: async () => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/reset",
        method: "POST",
        data: {}
      });
    },
    onSuccess: (result) => {
      queryClient2.setQueryData(
        WIZARD_QUERY_KEY,
        { state: result.state, justCreated: false }
      );
    }
  });
}
function useDismissOnboardingMutation() {
  return useMutation({
    meta: { silentError: true },
    mutationFn: async () => {
      const res = await window.wp.apiFetch({
        path: "/structura/v1/onboarding/dismiss",
        method: "POST",
        data: {}
      });
      if (typeof window !== "undefined" && window.structuraConfig) {
        window.structuraConfig.onboarding_dismissed = true;
      }
      return res;
    }
  });
}
function perActivationStorageKey(base) {
  if (typeof window === "undefined") return `${base}:default`;
  const cfg = window.structuraConfig;
  const discriminator = cfg?.activation_id || cfg?.domain || "default";
  return `${base}:${discriminator}`;
}
const KEY_BASE = "structura-onboarding-dismissed";
function markOnboardingDismissed() {
  try {
    localStorage.setItem(perActivationStorageKey(KEY_BASE), "1");
  } catch {
  }
}
function clearOnboardingDismissed() {
  try {
    localStorage.removeItem(perActivationStorageKey(KEY_BASE));
  } catch {
  }
}
function isOnboardingDismissed() {
  try {
    return localStorage.getItem(perActivationStorageKey(KEY_BASE)) === "1";
  } catch {
    return false;
  }
}
function clearAllOnboardingStorage() {
  try {
    const doomed = [];
    for (let i2 = 0; i2 < localStorage.length; i2++) {
      const key = localStorage.key(i2);
      if (key && (key.startsWith(KEY_BASE) || key.startsWith("structura-onboarding-wizard"))) {
        doomed.push(key);
      }
    }
    doomed.forEach((k2) => localStorage.removeItem(k2));
  } catch {
  }
}
const useFullScreenLockBody = () => {
  window.wp.element.useEffect(() => {
    const body = document.body;
    const previousOverflow = body.style.overflow;
    body.style.overflow = "hidden";
    body.classList.add("structura-wizard-open");
    const spaRoot = document.querySelector(
      ".structura-app-wrapper"
    );
    const isDark = !!spaRoot?.closest(".dark");
    if (isDark) body.classList.add("dark");
    return () => {
      body.style.overflow = previousOverflow;
      body.classList.remove("structura-wizard-open");
      if (isDark) body.classList.remove("dark");
    };
  }, []);
};
function getStepDescriptors() {
  return [
    { id: 1, label: window.wp.i18n.__("Site info", "structura") },
    { id: 2, label: window.wp.i18n.__("AI engine", "structura") },
    { id: 3, label: window.wp.i18n.__("SEO intelligence", "structura") },
    { id: 4, label: window.wp.i18n.__("Visuals", "structura") },
    { id: 5, label: window.wp.i18n.__("Personas", "structura") },
    { id: 6, label: window.wp.i18n.__("Done", "structura") }
  ];
}
const WizardShell = ({
  activeStep,
  completedSteps,
  skippedSteps,
  hiddenSteps,
  hideStepStrip,
  onBack,
  onSkip,
  onContinue,
  onStepClick,
  reachableSteps,
  continueLabel,
  continueHint,
  hideContinue,
  contentClassName,
  isBusy,
  children
}) => {
  const steps = getStepDescriptors().filter(
    (s2) => !hiddenSteps?.includes(s2.id)
  );
  const activeIdx = Math.max(
    0,
    steps.findIndex((s2) => s2.id === activeStep)
  );
  useFullScreenLockBody();
  const dismissOnboarding = useDismissOnboardingMutation();
  const handleExit = () => {
    markOnboardingDismissed();
    void dismissOnboarding.mutateAsync().catch(() => {
    });
  };
  return window.wp.element.createPortal(
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "fixed inset-0 z-[100000] flex flex-col bg-neutral-50 text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "grid shrink-0 grid-cols-[1fr_auto_1fr] items-center gap-4 border-b border-neutral-200 bg-white px-6 py-4 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-self-start" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "contents dark:hidden" }, /* @__PURE__ */ window.wp.element.createElement(al, { view: "full", variant: "dark" })), /* @__PURE__ */ window.wp.element.createElement("span", { className: "hidden dark:contents" }, /* @__PURE__ */ window.wp.element.createElement(al, { view: "full", variant: "mono" }))), /* @__PURE__ */ window.wp.element.createElement("span", { className: "justify-self-center text-sm font-semibold text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Setup wizard", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      Link$2,
      {
        to: "/",
        onClick: handleExit,
        className: "flex items-center gap-1 justify-self-end text-xs text-neutral-500! hover:text-neutral-700! dark:text-neutral-400! dark:hover:text-neutral-200!",
        "aria-label": window.wp.i18n.__("Exit setup wizard", "structura")
      },
      /* @__PURE__ */ window.wp.element.createElement(X, { size: 14 }),
      /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__("Exit", "structura"))
    )), hideStepStrip ? null : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center justify-center gap-2 border-b border-neutral-200 bg-white px-6 py-3 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("ol", { className: "flex items-center justify-center gap-2" }, steps.map((s2, idx) => {
      const isActive = s2.id === activeStep;
      const isDone = completedSteps.includes(s2.id);
      const isSkipped = skippedSteps.includes(s2.id);
      const displayNumber = idx + 1;
      const isReachable = !reachableSteps || reachableSteps.includes(s2.id);
      const clickable = !!onStepClick && isReachable;
      const PillTag = clickable ? "button" : "div";
      return /* @__PURE__ */ window.wp.element.createElement("li", { key: s2.id, className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
        PillTag,
        {
          type: clickable ? "button" : void 0,
          onClick: clickable ? () => onStepClick(s2.id) : void 0,
          disabled: clickable ? isBusy : void 0,
          className: [
            "flex items-center gap-2 rounded-full px-1.5 py-0.5 transition-colors",
            clickable ? "cursor-pointer hover:bg-neutral-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-500 dark:hover:bg-neutral-800" : onStepClick ? "cursor-not-allowed opacity-50" : ""
          ].join(" "),
          "aria-current": isActive ? "step" : void 0,
          "aria-label": clickable ? `${window.wp.i18n.__("Go to step", "structura")} ${displayNumber}: ${s2.label}` : `${window.wp.i18n.__("Step", "structura")} ${displayNumber}: ${s2.label}`
        },
        /* @__PURE__ */ window.wp.element.createElement(
          "span",
          {
            className: [
              "flex h-6 w-6 items-center justify-center rounded-full text-xs font-semibold",
              isActive ? "bg-brand-500 text-white" : isDone ? "bg-emerald-500 text-white" : isSkipped ? "border border-dashed border-neutral-300 text-neutral-400 dark:border-neutral-700" : "border border-neutral-200 text-neutral-400 dark:border-neutral-800"
            ].join(" ")
          },
          isDone ? /* @__PURE__ */ window.wp.element.createElement(Check, { size: 12 }) : displayNumber
        ),
        /* @__PURE__ */ window.wp.element.createElement(
          "span",
          {
            className: [
              "text-xs",
              isActive ? "font-medium text-neutral-900 dark:text-neutral-100" : "text-neutral-500 dark:text-neutral-400"
            ].join(" ")
          },
          s2.label
        )
      ), idx < steps.length - 1 ? /* @__PURE__ */ window.wp.element.createElement("span", { className: "mx-1 h-px w-6 bg-neutral-200 dark:bg-neutral-800" }) : null);
    }))), hideStepStrip ? null : /* @__PURE__ */ window.wp.element.createElement("div", { className: "h-1 shrink-0 bg-neutral-200 md:hidden dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: "h-full bg-brand-500 transition-all duration-300",
        style: {
          width: `${Math.round(activeIdx / (steps.length - 1) * 100)}%`
        }
      }
    )), /* @__PURE__ */ window.wp.element.createElement("main", { className: "flex-1 overflow-y-auto px-4 py-12 sm:px-6 lg:px-8" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: `mx-auto ${contentClassName ?? "max-w-3xl"}` }, children)), /* @__PURE__ */ window.wp.element.createElement("footer", { className: "flex shrink-0 items-center justify-between border-t border-neutral-200 bg-white px-6 py-4 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", null, onBack ? /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "transparent",
        size: "sm",
        onClick: onBack,
        disabled: isBusy
      },
      /* @__PURE__ */ window.wp.element.createElement(ChevronLeft, { size: 14, className: "mr-1" }),
      window.wp.i18n.__("Back", "structura")
    ) : /* @__PURE__ */ window.wp.element.createElement("span", { "aria-hidden": "true" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-6" }, onSkip ? /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: onSkip,
        disabled: isBusy,
        className: "text-xs text-neutral-500 hover:text-neutral-700 disabled:opacity-50 dark:text-neutral-400 dark:hover:text-neutral-200"
      },
      window.wp.i18n.__("Skip for now", "structura")
    ) : null, !hideContinue && !onContinue && !isBusy && continueHint ? /* @__PURE__ */ window.wp.element.createElement("span", { className: "hidden text-xs text-neutral-400 sm:inline dark:text-neutral-500" }, continueHint) : null, !hideContinue ? /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "primary",
        size: "sm",
        onClick: onContinue ?? void 0,
        disabled: !onContinue || isBusy
      },
      isBusy ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : null,
      continueLabel ?? window.wp.i18n.__("Continue", "structura"),
      !isBusy ? /* @__PURE__ */ window.wp.element.createElement(ChevronRight, { size: 14, className: "ml-1" }) : null
    ) : null))),
    document.body
  );
};
const WizardLicenseGate = ({
  canContinueWithoutKey,
  onContinueWithoutKey
}) => {
  const { activate, processing, plan } = useLicense();
  const [licenseKey, setLicenseKey] = window.wp.element.useState("");
  const [connected, setConnected] = window.wp.element.useState(false);
  const handleConnect = async () => {
    if (!licenseKey.trim() || processing) return;
    try {
      await activate(licenseKey.trim());
      setConnected(true);
      setLicenseKey("");
    } catch {
    }
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col items-center gap-4 text-center" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-gradient-to-br from-brand-400 to-brand-600 text-white shadow-lg shadow-brand-500/30" }, /* @__PURE__ */ window.wp.element.createElement(KeyRound, { size: 24 })), /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50 sm:text-4xl" }, window.wp.i18n.__("Welcome to Structura", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! max-w-xl text-base text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
    "Connect your account to get started — paste the license key from your purchase or sign-up email and we'll take it from there.",
    "structura"
  ))), connected ? (
    /* Post-activation bridge — the gate unmounts once the settings
       refetch lands; until then, say so instead of going blank. */
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto flex w-full max-w-xl flex-col items-center gap-3 py-4 text-center" }, /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { size: 32, className: "text-emerald-500" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-base font-semibold text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("License connected!", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex! items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "animate-spin" }), window.wp.i18n.__("Starting the wizard…", "structura")))
  ) : (
    /* Submit-on-Enter without a visible form chrome. Centered as a
       block — the row hugs the content width so the input + button
       sit visually under the headline instead of off to a side. */
    /* @__PURE__ */ window.wp.element.createElement(
      "form",
      {
        className: "mx-auto flex w-full max-w-xl flex-col items-center gap-3",
        onSubmit: (e2) => {
          e2.preventDefault();
          void handleConnect();
        }
      },
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex w-full flex-col items-stretch justify-center gap-3 sm:flex-row sm:items-end" }, /* @__PURE__ */ window.wp.element.createElement(
        he,
        {
          label: window.wp.i18n.__("License Key", "structura"),
          placeholder: "ST-XXXX-XXXX-XXXX",
          className: "flex-1 font-mono tracking-tighter",
          value: licenseKey,
          onChange: (e2) => setLicenseKey(e2.target.value)
        }
      ), /* @__PURE__ */ window.wp.element.createElement(
        tr$1,
        {
          type: "submit",
          disabled: processing || !licenseKey.trim(),
          loading: processing
        },
        /* @__PURE__ */ window.wp.element.createElement(Zap, { className: "size-4" }),
        /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2" }, window.wp.i18n.__("Connect", "structura"))
      )),
      /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-center text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Don't have a key yet?", "structura"), " ", /* @__PURE__ */ window.wp.element.createElement(
        "a",
        {
          href: buildPortalSignupUrl({
            intent: "general_upgrade",
            domain: typeof window !== "undefined" ? window.location.hostname : void 0,
            plan
          }),
          target: "_blank",
          rel: "noreferrer",
          className: "inline-flex items-center gap-1 font-medium text-brand-600! hover:text-brand-700! dark:text-brand-400! dark:hover:text-brand-300!"
        },
        window.wp.i18n.__("Create your free account", "structura"),
        /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 12 })
      ))
    )
  ), !connected && canContinueWithoutKey ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-center border-t border-neutral-100 pt-6 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: onContinueWithoutKey,
      className: "cursor-pointer text-xs text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200"
    },
    window.wp.i18n.__("Continue without an account for now", "structura")
  )) : null);
};
const DISMISS_KEY$1 = "structura-onboarding-downgrade-banner-dismissed";
const DowngradeBanner = ({ previousPlanLabel }) => {
  const [dismissed, setDismissed] = window.wp.element.useState(false);
  window.wp.element.useEffect(() => {
    try {
      if (typeof window !== "undefined") {
        setDismissed(window.sessionStorage.getItem(DISMISS_KEY$1) === "1");
      }
    } catch {
    }
  }, []);
  if (dismissed) return null;
  const handleDismiss = () => {
    try {
      window.sessionStorage.setItem(DISMISS_KEY$1, "1");
    } catch {
    }
    setDismissed(true);
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-4 rounded-md border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-900/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 16, className: "mt-0.5 shrink-0 text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-amber-900 dark:text-amber-100" }, previousPlanLabel ? window.wp.i18n.__("Your paid features are paused", "structura") : window.wp.i18n.__("Your saved setup is preserved", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-800 dark:text-amber-200" }, window.wp.i18n.__(
    "Your previous setup answers are still here, but won't power campaigns on this plan. They'll re-engage automatically when you upgrade.",
    "structura"
  )))), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: handleDismiss,
      className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-amber-600 hover:bg-amber-100 hover:text-amber-800 dark:text-amber-400 dark:hover:bg-amber-900/40 dark:hover:text-amber-200",
      "aria-label": window.wp.i18n.__("Dismiss notice", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(X, { size: 12 })
  ));
};
const createStoreImpl = (createState) => {
  let state;
  const listeners = /* @__PURE__ */ new Set();
  const setState = (partial, replace) => {
    const nextState = typeof partial === "function" ? partial(state) : partial;
    if (!Object.is(nextState, state)) {
      const previousState = state;
      state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
      listeners.forEach((listener) => listener(state, previousState));
    }
  };
  const getState = () => state;
  const getInitialState = () => initialState;
  const subscribe = (listener) => {
    listeners.add(listener);
    return () => listeners.delete(listener);
  };
  const api = { setState, getState, getInitialState, subscribe };
  const initialState = state = createState(setState, getState, api);
  return api;
};
const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
const identity = (arg) => arg;
function useStore(api, selector = identity) {
  const slice = window.wp.element.useSyncExternalStore(
    api.subscribe,
    window.wp.element.useCallback(() => selector(api.getState()), [api, selector]),
    window.wp.element.useCallback(() => selector(api.getInitialState()), [api, selector])
  );
  window.wp.element.useDebugValue(slice);
  return slice;
}
const createImpl = (createState) => {
  const api = createStore(createState);
  const useBoundStore = (selector) => useStore(api, selector);
  Object.assign(useBoundStore, api);
  return useBoundStore;
};
const create = ((createState) => createImpl);
function createJSONStorage(getStorage, options) {
  let storage;
  try {
    storage = getStorage();
  } catch (e2) {
    return;
  }
  const persistStorage = {
    getItem: (name) => {
      var _a2;
      const parse = (str2) => {
        if (str2 === null) {
          return null;
        }
        return JSON.parse(str2, void 0);
      };
      const str = (_a2 = storage.getItem(name)) != null ? _a2 : null;
      if (str instanceof Promise) {
        return str.then(parse);
      }
      return parse(str);
    },
    setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, void 0)),
    removeItem: (name) => storage.removeItem(name)
  };
  return persistStorage;
}
const toThenable = (fn) => (input) => {
  try {
    const result = fn(input);
    if (result instanceof Promise) {
      return result;
    }
    return {
      then(onFulfilled) {
        return toThenable(onFulfilled)(result);
      },
      catch(_onRejected) {
        return this;
      }
    };
  } catch (e2) {
    return {
      then(_onFulfilled) {
        return this;
      },
      catch(onRejected) {
        return toThenable(onRejected)(e2);
      }
    };
  }
};
const persistImpl = (config, baseOptions) => (set, get, api) => {
  let options = {
    storage: createJSONStorage(() => window.localStorage),
    partialize: (state) => state,
    version: 0,
    merge: (persistedState, currentState) => ({
      ...currentState,
      ...persistedState
    }),
    ...baseOptions
  };
  let hasHydrated = false;
  let hydrationVersion = 0;
  const hydrationListeners = /* @__PURE__ */ new Set();
  const finishHydrationListeners = /* @__PURE__ */ new Set();
  let storage = options.storage;
  if (!storage) {
    return config(
      (...args) => {
        console.warn(
          `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`
        );
        set(...args);
      },
      get,
      api
    );
  }
  const setItem = () => {
    const state = options.partialize({ ...get() });
    return storage.setItem(options.name, {
      state,
      version: options.version
    });
  };
  const savedSetState = api.setState;
  api.setState = (state, replace) => {
    savedSetState(state, replace);
    return setItem();
  };
  const configResult = config(
    (...args) => {
      set(...args);
      return setItem();
    },
    get,
    api
  );
  api.getInitialState = () => configResult;
  let stateFromStorage;
  const hydrate = () => {
    var _a2, _b;
    if (!storage) return;
    const currentVersion = ++hydrationVersion;
    hasHydrated = false;
    hydrationListeners.forEach((cb) => {
      var _a22;
      return cb((_a22 = get()) != null ? _a22 : configResult);
    });
    const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a2 = get()) != null ? _a2 : configResult)) || void 0;
    return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {
      if (deserializedStorageValue) {
        if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) {
          if (options.migrate) {
            const migration = options.migrate(
              deserializedStorageValue.state,
              deserializedStorageValue.version
            );
            if (migration instanceof Promise) {
              return migration.then((result) => [true, result]);
            }
            return [true, migration];
          }
          console.error(
            `State loaded from storage couldn't be migrated since no migrate function was provided`
          );
        } else {
          return [false, deserializedStorageValue.state];
        }
      }
      return [false, void 0];
    }).then((migrationResult) => {
      var _a22;
      if (currentVersion !== hydrationVersion) {
        return;
      }
      const [migrated, migratedState] = migrationResult;
      stateFromStorage = options.merge(
        migratedState,
        (_a22 = get()) != null ? _a22 : configResult
      );
      set(stateFromStorage, true);
      if (migrated) {
        return setItem();
      }
    }).then(() => {
      if (currentVersion !== hydrationVersion) {
        return;
      }
      postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);
      stateFromStorage = get();
      hasHydrated = true;
      finishHydrationListeners.forEach((cb) => cb(stateFromStorage));
    }).catch((e2) => {
      if (currentVersion !== hydrationVersion) {
        return;
      }
      postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e2);
    });
  };
  api.persist = {
    setOptions: (newOptions) => {
      options = {
        ...options,
        ...newOptions
      };
      if (newOptions.storage) {
        storage = newOptions.storage;
      }
    },
    clearStorage: () => {
      storage == null ? void 0 : storage.removeItem(options.name);
    },
    getOptions: () => options,
    rehydrate: () => hydrate(),
    hasHydrated: () => hasHydrated,
    onHydrate: (cb) => {
      hydrationListeners.add(cb);
      return () => {
        hydrationListeners.delete(cb);
      };
    },
    onFinishHydration: (cb) => {
      finishHydrationListeners.add(cb);
      return () => {
        finishHydrationListeners.delete(cb);
      };
    }
  };
  if (!options.skipHydration) {
    hydrate();
  }
  return stateFromStorage || configResult;
};
const persist = persistImpl;
const initialValidity = {
  1: false,
  2: false,
  3: false,
  4: false,
  5: false,
  6: false
};
const useWizardStore = create()(
  persist(
    (set) => ({
      activeStep: 1,
      setActiveStep: (step) => set((s2) => ({
        activeStep: step,
        visitedSteps: s2.visitedSteps.includes(step) ? s2.visitedSteps : [...s2.visitedSteps, step]
      })),
      drafts: {},
      setStep1Draft: (draft) => set((s2) => ({ drafts: { ...s2.drafts, step1: draft } })),
      setStep2Draft: (draft) => set((s2) => ({ drafts: { ...s2.drafts, step2: draft } })),
      setStep3Draft: (draft) => set((s2) => ({ drafts: { ...s2.drafts, step3: draft } })),
      setStep4Draft: (draft) => set((s2) => ({ drafts: { ...s2.drafts, step4: draft } })),
      setStep5Draft: (draft) => set((s2) => ({ drafts: { ...s2.drafts, step5: draft } })),
      stepValidity: initialValidity,
      setStepValid: (step, valid) => set(
        (s2) => s2.stepValidity[step] === valid ? s2 : { stepValidity: { ...s2.stepValidity, [step]: valid } }
      ),
      visitedSteps: [1],
      markVisited: (step) => set(
        (s2) => s2.visitedSteps.includes(step) ? s2 : { visitedSteps: [...s2.visitedSteps, step] }
      ),
      licenseGateSkipped: false,
      setLicenseGateSkipped: (skipped) => set({ licenseGateSkipped: skipped }),
      personaSeeded: false,
      setPersonaSeeded: (seeded) => set({ personaSeeded: seeded }),
      gscSkipped: false,
      setGscSkipped: (skipped) => set({ gscSkipped: skipped }),
      gscConnectPending: false,
      setGscConnectPending: (pending) => set({ gscConnectPending: pending }),
      prewarmedPositioning: null,
      setPrewarmedPositioning: (p2) => set({ prewarmedPositioning: p2 }),
      reset: () => set({
        activeStep: 1,
        drafts: {},
        stepValidity: initialValidity,
        visitedSteps: [1],
        licenseGateSkipped: false,
        personaSeeded: false,
        gscSkipped: false,
        gscConnectPending: false,
        prewarmedPositioning: null
      })
    }),
    {
      // Per-activation key: a fixed name leaked one site's wizard draft
      // into every other site opened in the same browser (e.g. DDEV data
      // on a live install). See `perActivationStorageKey`.
      name: perActivationStorageKey("structura-onboarding-wizard"),
      storage: createJSONStorage(() => localStorage),
      // v1: step5 became an array. (An earlier draft of v1 also moved a
      // brand `logoUrl` into step1, but the logo upload was since
      // removed — any persisted logoUrl is now simply ignored.)
      // `migrate` reshapes any localStorage written by the old
      // (object step5) layout so a returning tester doesn't crash on the
      // new accessors.
      version: 1,
      migrate: (persisted, version) => {
        const state = persisted ?? {};
        if (version < 1 && state.drafts) {
          const d2 = state.drafts;
          if (d2.step5 && !Array.isArray(d2.step5)) d2.step5 = [d2.step5];
        }
        return state;
      },
      // Persist drafts + navigation + per-step validity. We DO persist
      // stepValidity (despite the staleness caveat) because otherwise a
      // reload that lands on a later step leaves steps 1–4 unmounted →
      // their validity resets to false → `canFinish` is false → "Finish
      // setup" silently dead-ends. Each step still recomputes its own
      // validity on mount and overwrites, so the persisted value only
      // bridges UNMOUNTED steps (whose drafts are likewise persisted and
      // unchanged) — keeping it consistent. The only staleness window is
      // an unmounted step across a validation-rule code change, which a
      // re-visit fixes.
      partialize: (state) => ({
        activeStep: state.activeStep,
        drafts: state.drafts,
        visitedSteps: state.visitedSteps,
        stepValidity: state.stepValidity,
        licenseGateSkipped: state.licenseGateSkipped,
        gscSkipped: state.gscSkipped,
        gscConnectPending: state.gscConnectPending,
        prewarmedPositioning: state.prewarmedPositioning
      })
    }
  )
);
async function uploadLogoToMediaLibrary(file) {
  const form = new FormData();
  form.append("file", file, file.name);
  const media = await window.wp.apiFetch({
    path: "/wp/v2/media",
    method: "POST",
    body: form
  });
  if (!media?.source_url) {
    throw new Error(
      window.wp.i18n.__("Upload finished but no URL came back. Please try again.", "structura")
    );
  }
  return media.source_url;
}
const WizardStep1Identity = () => {
  const { data: profile, isLoading } = usePublicSiteProfile();
  const { isPaidLicense } = useLicense();
  const step1Draft = useWizardStore((s2) => s2.drafts.step1);
  const setStep1Draft = useWizardStore((s2) => s2.setStep1Draft);
  const setStepValid = useWizardStore((s2) => s2.setStepValid);
  const [draft, setDraft] = window.wp.element.useState(
    step1Draft ?? null
  );
  window.wp.element.useEffect(() => {
    if (draft) return;
    if (step1Draft) {
      setDraft(step1Draft);
      return;
    }
    if (profile) {
      setDraft({
        publicUrl: profile.publicUrl,
        isHeadless: profile.isHeadless,
        description: profile.description,
        logoUrl: profile.logoUrl ?? ""
      });
    }
  }, [profile, step1Draft, draft]);
  window.wp.element.useEffect(() => {
    if (!draft) return;
    if (draft.logoUrl) return;
    if (!profile?.logoUrl) return;
    update({ logoUrl: profile.logoUrl });
  }, [profile?.logoUrl, draft]);
  window.wp.element.useEffect(() => {
    if (!draft) return;
    setStep1Draft(draft);
    setStepValid(1, true);
  }, [draft, setStep1Draft, setStepValid]);
  const update = (patch) => setDraft((d2) => ({
    ...d2 ?? {
      publicUrl: "",
      isHeadless: false,
      description: "",
      logoUrl: ""
    },
    ...patch
  }));
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-3 text-center" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Quick site check", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-base text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
    "We pulled these details from WordPress. Confirm they're right — anything read-only here comes straight from your WordPress settings.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-6 p-8" }, isLoading || !profile || !draft ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-24 items-center justify-center" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm text-neutral-500" }, window.wp.i18n.__("Reading site identity…", "structura"))) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-6" }, /* @__PURE__ */ window.wp.element.createElement("dl", { className: "grid grid-cols-1 gap-6 sm:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement(
    Field$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Globe, { size: 14, className: "text-brand-500" }),
      label: window.wp.i18n.__("Site name", "structura"),
      value: profile.name || window.wp.i18n.__("Not provided", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    Field$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14, className: "text-brand-500" }),
      label: window.wp.i18n.__("Tagline", "structura"),
      value: profile.tagline || window.wp.i18n.__("Not provided", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    Field$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Languages, { size: 14, className: "text-brand-500" }),
      label: window.wp.i18n.__("Language", "structura"),
      value: profile.language || window.wp.i18n.__("Site default", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    Field$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Globe, { size: 14, className: "text-brand-500" }),
      label: window.wp.i18n.__("WordPress home URL", "structura"),
      value: profile.homeUrl || window.wp.i18n.__("Not provided", "structura")
    }
  )), isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(
    rn,
    {
      label: window.wp.i18n.__("Logo", "structura"),
      accept: "image/*",
      maxSize: 5 * 1024 * 1024,
      allowUrl: true,
      value: draft.logoUrl,
      onChange: (url) => update({ logoUrl: url }),
      onUpload: uploadLogoToMediaLibrary,
      hint: window.wp.i18n.__(
        "Upload your logo (or paste a URL). We use it to match the suggested image style to your brand on the Visuals step.",
        "structura"
      )
    }
  ) : null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-4 border-t border-neutral-200 pt-6 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Headless mode", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Enable when WordPress isn't the public website (e.g. Next.js front-end pulling content via REST/GraphQL).",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Headless mode", "structura"),
      hiddenLabel: true,
      checked: draft.isHeadless,
      onChange: (checked) => update({ isHeadless: checked })
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Public website URL", "structura"),
      value: draft.publicUrl,
      onChange: (e2) => update({ publicUrl: e2.target.value }),
      placeholder: draft.isHeadless ? "https://www.example.com" : profile.homeUrl
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, draft.isHeadless ? window.wp.i18n.__(
    "Where readers actually visit — used for SEO calls and image references.",
    "structura"
  ) : window.wp.i18n.__(
    "Defaults to your WordPress home URL. Leave blank to use it.",
    "structura"
  ))))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-md border border-neutral-200 bg-neutral-50 px-4 py-3 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex! items-center gap-2 text-xs text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "info" }, window.wp.i18n.__("Tip", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__(
    "Everything saves at the end of setup. Need to change something later? Edit it under Site → Info.",
    "structura"
  ))))));
};
const Field$1 = ({
  icon,
  label,
  value
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "m-0! flex! items-center gap-2 text-xs uppercase tracking-wider text-neutral-500 dark:text-neutral-400" }, icon, label), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "m-0! text-sm font-medium text-neutral-900 dark:text-neutral-100" }, value));
function capsForTier(capabilities, plan) {
  if (plan !== "none") return capabilities;
  return capabilities.filter((c2) => c2 !== "image");
}
const WizardStep2AiEngine = () => {
  const { data: settings, isLoading } = useAiSettingsQuery();
  const { plan, providerCountCap } = useLicense();
  const setStepValid = useWizardStore((s2) => s2.setStepValid);
  const setStep2Draft = useWizardStore((s2) => s2.setStep2Draft);
  const isCloud = isManagedPlan(plan);
  const isSingleProviderTier = providerCountCap === 1;
  const providers = settings?.providers;
  const catalog = settings?.catalog;
  const defaults = settings?.defaults;
  const [wizardTarget, setWizardTarget] = window.wp.element.useState(null);
  const [upgradeTarget, setUpgradeTarget] = window.wp.element.useState(null);
  const { installed, available } = window.wp.element.useMemo(() => {
    if (!catalog || !providers) {
      return { installed: [], available: [] };
    }
    const inst = [];
    const avail = [];
    for (const id of Object.keys(catalog)) {
      if (providers[id]?.connected) inst.push(id);
      else avail.push(id);
    }
    return { installed: inst, available: avail };
  }, [catalog, providers]);
  const hasWorkingProvider = window.wp.element.useMemo(() => {
    if (isCloud) return true;
    if (!providers) return false;
    return Object.values(providers).some(
      (p2) => p2.connected && p2.capabilities.includes("text")
    );
  }, [isCloud, providers]);
  window.wp.element.useEffect(() => {
    setStepValid(2, hasWorkingProvider);
    if (hasWorkingProvider && defaults) {
      setStep2Draft({
        textProvider: defaults.text_provider || void 0,
        textModel: providers?.[defaults.text_provider]?.text_model,
        imageProvider: defaults.image_provider || void 0,
        imageModel: providers?.[defaults.image_provider]?.image_model
      });
    }
  }, [hasWorkingProvider, defaults, providers, setStepValid, setStep2Draft]);
  if (isLoading || !settings || !catalog || !providers || !defaults) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "py-16" }, /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Syncing AI providers…", "structura"), size: "md" }));
  }
  const slotsLeft = Math.max(0, providerCountCap - installed.length);
  const capLockedIds = /* @__PURE__ */ new Set();
  {
    let slot = 0;
    for (const id of available) {
      if (!providers[id]) continue;
      if (slot >= slotsLeft) capLockedIds.add(id);
      slot++;
    }
  }
  const openWizard = (id, reconfigure = false) => {
    const meta = catalog[id];
    const status = providers[id];
    if (!meta) return;
    setWizardTarget({
      id,
      name: meta.name,
      description: meta.description,
      capabilities: capsForTier(meta.capabilities, plan),
      keyUrl: meta.key_url,
      keyPrefix: meta.key_prefix,
      isConnected: reconfigure && !!status?.connected,
      textModel: status?.text_model,
      imageModel: status?.image_model,
      isDefaultText: defaults.text_provider === id,
      isDefaultImage: defaults.image_provider === id
    });
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-3 text-center" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Connect your AI engine", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-base text-neutral-600 dark:text-neutral-400" }, isCloud ? window.wp.i18n.__(
    "Your plan runs on Structura's managed AI. Pick the models you'd like as defaults — you can swap per post later.",
    "structura"
  ) : window.wp.i18n.__(
    "Connect at least one provider so the rest of setup can use AI. Pick a model and we'll handle the provider.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("section", { className: "flex flex-col gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, className: "text-emerald-500" }), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! flex! items-center text-[11px] font-black uppercase tracking-widest text-neutral-500" }, window.wp.i18n.__("Your providers", "structura"))), installed.length > 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3" }, installed.map((id) => {
    const meta = catalog[id];
    const status = providers[id];
    if (!meta || !status) return null;
    const needsText = status.capabilities.includes("text") && !status.text_model;
    const needsImage = status.capabilities.includes("image") && !status.image_model;
    return /* @__PURE__ */ window.wp.element.createElement(
      InstalledProviderCard,
      {
        key: id,
        id,
        name: meta.name,
        description: meta.description,
        capabilities: capsForTier(meta.capabilities, plan),
        maskedKey: status.masked_key,
        isCloud,
        isDefaultText: defaults.text_provider === id,
        isDefaultImage: defaults.image_provider === id,
        incomplete: needsText || needsImage,
        onManage: () => openWizard(id, true),
        hideDefaultBadges: isSingleProviderTier
      }
    );
  })) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-3 rounded-2xl border border-dashed border-neutral-200 py-10 dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(Unplug, { size: 26, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("No providers connected yet", "structura")))), available.length > 0 ? /* @__PURE__ */ window.wp.element.createElement("section", { className: "flex flex-col gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 14, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! flex! items-center text-[11px] font-black uppercase tracking-widest text-neutral-500" }, window.wp.i18n.__("Available providers", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2" }, available.map((id) => {
    const meta = catalog[id];
    if (!meta) return null;
    const isAvailableForTier = !!providers[id];
    const isCapLocked = isAvailableForTier && capLockedIds.has(id);
    const cardAvailable = isAvailableForTier && !isCapLocked;
    return /* @__PURE__ */ window.wp.element.createElement(
      AvailableProviderCard,
      {
        key: id,
        id,
        name: meta.name,
        description: meta.description,
        capabilities: capsForTier(meta.capabilities, plan),
        available: cardAvailable,
        minTier: meta.min_tier,
        lockReason: isCapLocked ? "cap" : "tier",
        onSetUp: () => {
          if (cardAvailable) {
            openWizard(id);
            return;
          }
          setUpgradeTarget({
            id,
            name: meta.name,
            description: meta.description,
            capabilities: meta.capabilities,
            minTier: meta.min_tier,
            lockReason: isCapLocked ? "cap" : "tier",
            fromProviderId: isCapLocked ? installed[0] : void 0
          });
        }
      }
    );
  }))) : null, /* @__PURE__ */ window.wp.element.createElement(
    WorkspaceKeysPicker,
    {
      providerLabels: catalog ? Object.fromEntries(
        Object.entries(catalog).map(([id, meta]) => [id, meta.name])
      ) : void 0
    }
  ), !hasWorkingProvider ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-amber-200 bg-amber-50 p-4 dark:border-amber-800/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-semibold text-amber-700 dark:text-amber-400" }, window.wp.i18n.__(
    "Connect at least one text provider to continue — the rest of the setup needs it to generate suggestions.",
    "structura"
  ))) : null, wizardTarget ? /* @__PURE__ */ window.wp.element.createElement(
    ProviderSetupWizard,
    {
      open: !!wizardTarget,
      onClose: () => setWizardTarget(null),
      providerId: wizardTarget.id,
      providerName: wizardTarget.name,
      description: wizardTarget.description,
      capabilities: wizardTarget.capabilities,
      keyUrl: wizardTarget.keyUrl,
      keyPrefix: wizardTarget.keyPrefix,
      isConnected: wizardTarget.isConnected,
      currentTextModel: wizardTarget.textModel,
      currentImageModel: wizardTarget.imageModel,
      isDefaultText: wizardTarget.isDefaultText,
      isDefaultImage: wizardTarget.isDefaultImage,
      providerCountCap
    }
  ) : null, upgradeTarget ? /* @__PURE__ */ window.wp.element.createElement(
    ProviderUpgradeDialog,
    {
      open: !!upgradeTarget,
      onClose: () => setUpgradeTarget(null),
      providerId: upgradeTarget.id,
      providerName: upgradeTarget.name,
      description: upgradeTarget.description,
      capabilities: upgradeTarget.capabilities,
      minTier: upgradeTarget.minTier,
      lockReason: upgradeTarget.lockReason,
      fromProviderId: upgradeTarget.fromProviderId,
      plan
    }
  ) : null);
};
const SITE_STATE_KEY = ["site", "analysis"];
function useSiteAnalysisQuery(opts = {}) {
  return useQuery({
    queryKey: SITE_STATE_KEY,
    enabled: opts.enabled ?? true,
    staleTime: 5 * 60 * 1e3,
    queryFn: async () => {
      return window.wp.apiFetch({
        path: "/structura/v1/site/state",
        method: "POST",
        data: {}
      });
    }
  });
}
function useAnalyzeSiteMutation() {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: async (input) => {
      return window.wp.apiFetch({
        path: "/structura/v1/site/analyze",
        method: "POST",
        data: input ?? {}
      });
    },
    onSuccess: (result) => {
      queryClient2.setQueryData(SITE_STATE_KEY, result);
    }
  });
}
function useUpdateSiteSeoSettingsMutation() {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: async (input) => {
      return window.wp.apiFetch({
        path: "/structura/v1/site/seo-settings",
        method: "POST",
        data: input
      });
    },
    onSuccess: (result) => {
      queryClient2.setQueryData(SITE_STATE_KEY, (prev) => {
        if (!prev) {
          return {
            success: true,
            capturedAt: null,
            seoIntelSettings: result.seoIntelSettings
          };
        }
        return { ...prev, seoIntelSettings: result.seoIntelSettings };
      });
    }
  });
}
function buildReferralLabels() {
  return {
    sectionTitle: window.wp.i18n.__("Referral links", "structura"),
    optionalTag: window.wp.i18n.__("optional", "structura"),
    siteHelper: window.wp.i18n.__(
      "Your tracking links, woven into posts where they fit. Links added here seed every new campaign on this site.",
      "structura"
    ),
    campaignHelper: window.wp.i18n.__(
      "Your tracking links, woven into posts where they fit. Seeded from Site SEO — edits apply to this campaign only; site defaults stay unchanged.",
      "structura"
    ),
    labelLabel: window.wp.i18n.__("Label", "structura"),
    labelPlaceholder: window.wp.i18n.__("Product or brand name", "structura"),
    urlLabel: window.wp.i18n.__("Destination URL", "structura"),
    urlPlaceholder: window.wp.i18n.__("https://…", "structura"),
    keywordsLabel: window.wp.i18n.__("Relevance keywords", "structura"),
    keywordsOptionalTag: window.wp.i18n.__("optional", "structura"),
    keywordsPlaceholder: window.wp.i18n.__(
      "Topics where this link belongs — press Enter to add",
      "structura"
    ),
    keywordsAddAria: window.wp.i18n.__("Add a relevance keyword", "structura"),
    anchorToggle: window.wp.i18n.__("Exact anchor text", "structura"),
    anchorToggleQualifier: window.wp.i18n.__("— only if your program requires it", "structura"),
    anchorLabel: window.wp.i18n.__("Exact anchor text", "structura"),
    anchorPlaceholder: window.wp.i18n.__("e.g. TrailPass Pro app", "structura"),
    anchorHint: window.wp.i18n.__(
      "Used verbatim wherever this link appears. Leave empty and Structura writes a natural anchor for each post.",
      "structura"
    ),
    anchorClear: window.wp.i18n.__("Clear", "structura"),
    addLink: window.wp.i18n.__("Add referral link", "structura"),
    emptyText: window.wp.i18n.__(
      "No referral links yet — add one to have Structura mention it in relevant posts.",
      "structura"
    ),
    ftcBefore: window.wp.i18n.__(
      "Referral links are usually affiliate relationships. Review the ",
      "structura"
    ),
    ftcLink: window.wp.i18n.__("affiliate disclosure setting", "structura"),
    ftcAfter: window.wp.i18n.__(
      " for this content — Structura won't switch it on for you.",
      "structura"
    ),
    /* translators: %s is the referral link's label. */
    removeRow: (label) => window.wp.i18n.sprintf(window.wp.i18n.__("Remove %s", "structura"), label),
    /* translators: %s is a relevance keyword. */
    removeKeyword: (keyword) => window.wp.i18n.sprintf(window.wp.i18n.__("Remove %s", "structura"), keyword),
    errorLabelRequired: window.wp.i18n.__(
      "Label is required — it seeds the anchor text.",
      "structura"
    ),
    errorUrlInvalid: window.wp.i18n.__(
      "Enter a full URL, including https://. Tracking parameters are kept as-is.",
      "structura"
    )
  };
}
const POSITIONING_QUERY_KEY = ["onboarding", "wizard", "positioning"];
function useWizardPositioningQuery(opts = {}) {
  return useQuery({
    queryKey: POSITIONING_QUERY_KEY,
    enabled: opts.enabled ?? true,
    staleTime: 60 * 1e3,
    queryFn: async () => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/positioning",
        method: "POST",
        data: {}
      });
    }
  });
}
function useSaveWizardPositioningMutation() {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: async (input) => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/positioning/save",
        method: "POST",
        data: input
      });
    },
    onSuccess: (result) => {
      queryClient2.setQueryData(
        POSITIONING_QUERY_KEY,
        result
      );
    }
  });
}
function useSuggestWizardPositioningMutation() {
  return useMutation({
    mutationFn: async () => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/positioning/suggest",
        method: "POST",
        data: {}
      });
    }
  });
}
const AI_COMPETITORS_QUERY_KEY = [
  "onboarding",
  "wizard",
  "ai-competitors"
];
function useWizardAiCompetitorsQuery(input) {
  return useQuery({
    queryKey: AI_COMPETITORS_QUERY_KEY,
    enabled: input.enabled,
    staleTime: Infinity,
    // Background auto-suggest — a failure must not raise the global
    // "Data Fetch Error" toast; manual add remains available.
    meta: { silentError: true },
    queryFn: async () => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/competitors/suggest",
        method: "POST",
        data: {
          positioning: input.positioning,
          excludeDomains: input.excludeDomains
        }
      });
    }
  });
}
function useSuggestWizardCompetitorsMutation() {
  return useMutation({
    mutationFn: async (input) => {
      return window.wp.apiFetch({
        path: "/structura/v1/wizard/competitors/suggest",
        method: "POST",
        data: input
      });
    }
  });
}
const WizardMagicLoader = ({
  icon: Icon2,
  title,
  stages,
  cadenceMs = 1600
}) => {
  const [idx, setIdx] = window.wp.element.useState(0);
  window.wp.element.useEffect(() => {
    const t2 = setInterval(
      () => setIdx((i2) => Math.min(i2 + 1, stages.length - 1)),
      cadenceMs
    );
    return () => clearInterval(t2);
  }, [stages.length, cadenceMs]);
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      role: "status",
      "aria-live": "polite",
      className: "flex flex-col items-center justify-center gap-7 py-16"
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-50 to-purple-50 shadow-lg shadow-brand-100/50 dark:from-brand-950/50 dark:to-purple-950/50 dark:shadow-brand-900/20" }, /* @__PURE__ */ window.wp.element.createElement(Icon2, { className: "h-7 w-7 text-brand-600 dark:text-brand-400" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "absolute -right-1 -top-1 h-3 w-3 animate-pulse rounded-full bg-brand-400 shadow-lg shadow-brand-400/50" })),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "m-0! text-lg font-semibold text-neutral-900 dark:text-neutral-50" }, title), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-neutral-600 dark:text-neutral-300" }, stages[idx])),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex w-full max-w-md items-center justify-center" }, stages.map((stage, i2) => {
      const isDone = i2 < idx;
      const isActive = i2 === idx;
      return /* @__PURE__ */ window.wp.element.createElement("div", { key: stage, className: "flex items-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          className: B$1(
            "flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-bold transition-all duration-500",
            isDone && "bg-emerald-100 text-emerald-600 dark:bg-emerald-950 dark:text-emerald-400",
            isActive && "bg-brand-100 text-brand-600 shadow-md shadow-brand-200/50 dark:bg-brand-950 dark:text-brand-400 dark:shadow-brand-900/30",
            !isDone && !isActive && "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-600"
          )
        },
        isDone ? /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14 }) : isActive ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement("span", null, i2 + 1)
      )), i2 < stages.length - 1 ? /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "mx-2 h-px w-8 transition-colors duration-500 sm:w-12",
            i2 < idx ? "bg-emerald-300 dark:bg-emerald-800" : "bg-neutral-200 dark:bg-neutral-800"
          )
        }
      ) : null);
    }))
  );
};
const EMPTY_POSITIONING = { what: "", who: "", problem: "" };
const WizardStep3SeoIntelligence = () => {
  const { data: siteAnalysis } = useSiteAnalysisQuery();
  const suggestedCompetitors = siteAnalysis?.suggestedCompetitors ?? [];
  const { successToast, errorToast } = Mn();
  const { isPaidLicense } = useLicense();
  const step3 = useWizardStore((s2) => s2.drafts.step3);
  const setStep3Draft = useWizardStore((s2) => s2.setStep3Draft);
  const setStepValid = useWizardStore((s2) => s2.setStepValid);
  const prewarmedPositioning = useWizardStore((s2) => s2.prewarmedPositioning);
  const seededRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (seededRef.current) return;
    if (step3) {
      seededRef.current = true;
      return;
    }
    seededRef.current = true;
    setStep3Draft({
      positioning: prewarmedPositioning ?? EMPTY_POSITIONING,
      positioningSource: prewarmedPositioning ? "ai_draft" : "user",
      competitorUrls: siteAnalysis?.seoIntelSettings?.competitorUrls ?? [],
      referralLinks: siteAnalysis?.seoIntelSettings?.referralLinks ?? []
    });
  }, [step3, siteAnalysis, setStep3Draft, prewarmedPositioning]);
  const positioning = step3?.positioning ?? EMPTY_POSITIONING;
  const positioningSource = step3?.positioningSource ?? "user";
  const savedCompetitors = step3?.competitorUrls ?? [];
  const savedReferralLinks = step3?.referralLinks ?? [];
  const patch = (p2) => setStep3Draft({
    positioning,
    positioningSource,
    competitorUrls: savedCompetitors,
    referralLinks: savedReferralLinks,
    ...p2
  });
  window.wp.element.useEffect(() => {
    const positioningComplete2 = positioning.what.trim().length > 0 && positioning.who.trim().length > 0 && positioning.problem.trim().length > 0;
    setStepValid(3, positioningComplete2);
  }, [positioning, setStepValid]);
  const suggestPositioning = useSuggestWizardPositioningMutation();
  const setPositioning = (next) => patch({ positioning: next, positioningSource: positioningSource === "ai_draft" ? "edited" : positioningSource });
  const handleAiDraftPositioning = async () => {
    try {
      const res = await suggestPositioning.mutateAsync();
      if (res.suggestion) {
        patch({
          positioning: {
            what: res.suggestion.what,
            who: res.suggestion.who,
            problem: res.suggestion.problem
          },
          positioningSource: "ai_draft"
        });
        successToast(
          window.wp.i18n.__("Drafted from your homepage — edit anything below.", "structura")
        );
        return;
      }
      errorToast(
        res.reason === "missing_domain" ? window.wp.i18n.__(
          "We couldn't find a public homepage to read. Add your website URL on the Site info step, or just fill the answers in yourself.",
          "structura"
        ) : window.wp.i18n.__(
          "AI couldn't draft this right now. Try again in a moment, or fill the answers in yourself.",
          "structura"
        )
      );
    } catch {
      errorToast(
        window.wp.i18n.__(
          "Something went wrong drafting from your homepage. Please try again.",
          "structura"
        )
      );
    }
  };
  const addCompetitor = (raw) => {
    const trimmed = raw.trim();
    if (!trimmed) return;
    patch({
      competitorUrls: Array.from(/* @__PURE__ */ new Set([...savedCompetitors, trimmed]))
    });
  };
  const removeCompetitor = (url) => patch({ competitorUrls: savedCompetitors.filter((c2) => c2 !== url) });
  const suggestedNotAdopted = window.wp.element.useMemo(() => {
    const savedHosts = new Set(
      savedCompetitors.map((c2) => hostnameOf(c2)).filter(Boolean)
    );
    return suggestedCompetitors.filter(
      (s2) => !savedHosts.has(s2.domain.replace(/^www\./, ""))
    );
  }, [savedCompetitors, suggestedCompetitors]);
  const competitorSuggested = window.wp.element.useMemo(
    () => suggestedNotAdopted.slice(0, 6).map((s2) => ({
      value: `https://${s2.domain}`,
      label: s2.domain,
      count: s2.intersections
    })),
    [suggestedNotAdopted]
  );
  const dfsAutoAddedRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (dfsAutoAddedRef.current) return;
    if (!step3 || !isPaidLicense) return;
    if (savedCompetitors.length > 0) return;
    if (suggestedNotAdopted.length === 0) return;
    dfsAutoAddedRef.current = true;
    patch({
      competitorUrls: suggestedNotAdopted.slice(0, 6).map((s2) => `https://${s2.domain}`)
    });
  }, [step3, isPaidLicense, savedCompetitors.length, suggestedNotAdopted]);
  const positioningComplete = positioning.what.trim().length > 0 && positioning.who.trim().length > 0 && positioning.problem.trim().length > 0;
  const aiCompetitorsQuery = useWizardAiCompetitorsQuery({
    positioning: {
      what: positioning.what,
      who: positioning.who,
      problem: positioning.problem
    },
    excludeDomains: savedCompetitors.map((c2) => hostnameOf(c2)).filter(Boolean),
    enabled: isPaidLicense && suggestedCompetitors.length === 0 && positioningComplete
  });
  const aiCompetitors = aiCompetitorsQuery.data?.suggestions ?? [];
  const aiCompetitorsNotAdopted = window.wp.element.useMemo(() => {
    const savedHosts = new Set(
      savedCompetitors.map((c2) => hostnameOf(c2)).filter(Boolean)
    );
    return aiCompetitors.filter(
      (s2) => !savedHosts.has(s2.domain.replace(/^www\./, ""))
    );
  }, [savedCompetitors, aiCompetitors]);
  const [autoSuggesting, setAutoSuggesting] = window.wp.element.useState(false);
  const autoRanRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (autoRanRef.current) return;
    if (!step3) return;
    if (!isPaidLicense) return;
    const positioningBlank = !positioning.what.trim() && !positioning.who.trim() && !positioning.problem.trim();
    if (!positioningBlank) {
      autoRanRef.current = true;
      return;
    }
    autoRanRef.current = true;
    setAutoSuggesting(true);
    void (async () => {
      try {
        let res = await suggestPositioning.mutateAsync();
        if (!res.suggestion) {
          await new Promise((r2) => setTimeout(r2, 2e3));
          res = await suggestPositioning.mutateAsync();
        }
        const p2 = res.suggestion;
        if (!p2) return;
        const next = {
          what: p2.what,
          who: p2.who,
          problem: p2.problem
        };
        patch({ positioning: next, positioningSource: "ai_draft" });
      } catch {
      } finally {
        setAutoSuggesting(false);
      }
    })();
  }, [step3, isPaidLicense]);
  const AUTO_STAGES = window.wp.element.useMemo(
    () => [
      window.wp.i18n.__("Reading your homepage…", "structura"),
      window.wp.i18n.__("Drafting your positioning…", "structura"),
      window.wp.i18n.__("Scouting competitors…", "structura")
    ],
    []
  );
  const competitorChips = competitorSuggested.length > 0 ? competitorSuggested : aiCompetitorsNotAdopted.slice(0, 6).map((s2) => ({
    value: `https://${s2.domain}`,
    label: s2.domain,
    tooltip: s2.rationale || void 0
  }));
  const addAllCompetitorChips = () => patch({
    competitorUrls: Array.from(
      /* @__PURE__ */ new Set([...savedCompetitors, ...competitorChips.map((c2) => c2.value)])
    )
  });
  if (autoSuggesting) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-3 text-center" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Tell us about your business", "structura"))), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8" }, /* @__PURE__ */ window.wp.element.createElement(
      WizardMagicLoader,
      {
        icon: Search,
        title: window.wp.i18n.__("Researching your business", "structura"),
        stages: AUTO_STAGES,
        cadenceMs: 2400
      }
    )));
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-3 text-center" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Tell us about your business", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-base text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
    "Three quick questions and a couple of competitors. We'll do the heavy lifting from there — each campaign discovers its own keywords and sources.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-5 p-8" }, /* @__PURE__ */ window.wp.element.createElement(
    SectionHeader,
    {
      number: 1,
      label: window.wp.i18n.__("About your business", "structura"),
      action: /* @__PURE__ */ window.wp.element.createElement(
        tr$1,
        {
          variant: "transparent",
          size: "sm",
          onClick: handleAiDraftPositioning,
          disabled: suggestPositioning.isPending
        },
        suggestPositioning.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14, className: "mr-1.5" }),
        window.wp.i18n.__("Draft from my homepage", "structura")
      )
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("In one sentence, what does your business do?", "structura"),
      value: positioning.what,
      onChange: (e2) => setPositioning({ ...positioning, what: e2.target.value }),
      rows: 2,
      placeholder: window.wp.i18n.__(
        "We help remote design teams ship Figma faster…",
        "structura"
      ),
      maxLength: 280
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Who's your typical customer?", "structura"),
      value: positioning.who,
      onChange: (e2) => setPositioning({ ...positioning, who: e2.target.value }),
      rows: 2,
      placeholder: window.wp.i18n.__(
        "Senior designers at 20–200-person companies…",
        "structura"
      ),
      maxLength: 280
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("What problem do you solve for them?", "structura"),
      value: positioning.problem,
      onChange: (e2) => setPositioning({ ...positioning, problem: e2.target.value }),
      rows: 2,
      placeholder: window.wp.i18n.__(
        "Async handoff between designers and engineers breaks down…",
        "structura"
      ),
      maxLength: 280
    }
  ), positioningSource === "ai_draft" ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex! items-center gap-2 text-xs text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "info" }, window.wp.i18n.__("AI draft", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__(
    "Edit anything that doesn't feel right — your changes overwrite the draft.",
    "structura"
  ))) : null), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-5 p-8" }, /* @__PURE__ */ window.wp.element.createElement(
    SectionHeader,
    {
      number: 2,
      icon: /* @__PURE__ */ window.wp.element.createElement(Users, { size: 14, className: "text-brand-500" }),
      label: window.wp.i18n.__("Sites you compete with", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    Bn,
    {
      kind: "domain",
      labels: {
        remove: (l2) => window.wp.i18n.sprintf(window.wp.i18n.__("Remove %s", "structura"), l2),
        addAll: window.wp.i18n.__("Add all", "structura"),
        add: window.wp.i18n.__("Add", "structura")
      },
      ariaLabel: window.wp.i18n.__("Competitors", "structura"),
      added: savedCompetitors.map((url) => ({
        value: url,
        label: hostnameOf(url) || url
      })),
      suggested: competitorChips,
      onAdd: addCompetitor,
      onRemove: removeCompetitor,
      onAddAll: competitorChips.length > 0 ? addAllCompetitorChips : void 0,
      onDiscover: () => {
        void aiCompetitorsQuery.refetch();
      },
      discoverLabel: window.wp.i18n.__("Suggest competitors", "structura"),
      discovering: aiCompetitorsQuery.isFetching,
      suggestedLabel: competitorSuggested.length > 0 ? window.wp.i18n.__("Auto-detected from your site", "structura") : window.wp.i18n.__("AI-suggested — tap to add", "structura"),
      suggestedNotice: aiCompetitorsQuery.isFetching && competitorChips.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2 text-xs text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 12, className: "animate-spin" }), window.wp.i18n.__("Looking for likely competitors…", "structura")) : void 0,
      inputPlaceholder: "https://example.com",
      onAddManual: addCompetitor
    }
  )), /* @__PURE__ */ window.wp.element.createElement(
    Un,
    {
      binding: "site",
      value: savedReferralLinks,
      onChange: (referralLinks) => patch({ referralLinks }),
      labels: buildReferralLabels(),
      disabled: !isPaidLicense
    }
  ));
};
const SectionHeader = ({
  number,
  label,
  icon,
  action
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-4 border-b border-neutral-100 pb-3 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-7 w-7 items-center justify-center rounded-full bg-brand-50 text-xs font-semibold text-brand-700 dark:bg-brand-950/30 dark:text-brand-300" }, number), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-sm font-semibold uppercase tracking-wider text-neutral-700 dark:text-neutral-300" }, icon, label)), action);
function hostnameOf(raw) {
  try {
    const u2 = new URL(raw.startsWith("http") ? raw : `https://${raw}`);
    return u2.hostname.replace(/^www\./, "");
  } catch {
    return null;
  }
}
const ASPECT_RATIOS = [
  { value: "16:9", label: window.wp.i18n.__("16:9 — Hero / wide", "structura") },
  { value: "1:1", label: window.wp.i18n.__("1:1 — Social square", "structura") },
  { value: "4:3", label: window.wp.i18n.__("4:3 — Standard", "structura") },
  { value: "3:2", label: window.wp.i18n.__("3:2 — Editorial", "structura") },
  { value: "9:16", label: window.wp.i18n.__("9:16 — Story / vertical", "structura") },
  { value: "3:4", label: window.wp.i18n.__("3:4 — Portrait", "structura") },
  { value: "2:3", label: window.wp.i18n.__("2:3 — Tall portrait", "structura") }
];
const FORMATS = [
  { value: "webp", label: window.wp.i18n.__("WebP — recommended", "structura") },
  { value: "jpeg", label: window.wp.i18n.__("JPEG", "structura") },
  { value: "png", label: window.wp.i18n.__("PNG", "structura") }
];
const DEFAULT_DRAFT = {
  globalArtDirection: "",
  aspectRatio: "16:9",
  format: "webp",
  optimizeOnUpload: true,
  medium: "photography"
};
const WizardStep4Visuals = () => {
  const { isPaidLicense } = useLicense();
  const { defaultTextProvider } = useDefaultProviders();
  const { suggest, isSuggesting } = useMagicSuggest();
  const { successToast, errorToast } = Mn();
  const { data: profile } = usePublicSiteProfile();
  const publicUrl = useWizardStore((s2) => s2.drafts.step1?.publicUrl ?? "");
  const logoUrl = useWizardStore((s2) => s2.drafts.step1?.logoUrl ?? "");
  const step4 = useWizardStore((s2) => s2.drafts.step4);
  const setStep4Draft = useWizardStore((s2) => s2.setStep4Draft);
  const setStepValid = useWizardStore((s2) => s2.setStepValid);
  const { data: presetsData } = useVisualPresetsQuery();
  const seededRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (seededRef.current) return;
    if (isPaidLicense === void 0) return;
    if (isPaidLicense && presetsData === void 0) return;
    seededRef.current = true;
    if (step4 && step4.globalArtDirection.trim().length > 0) return;
    const bound = presetsData?.boundPresetId ? presetsData.presets.find((p2) => p2.presetId === presetsData.boundPresetId) : void 0;
    if (bound) {
      setStep4Draft({
        globalArtDirection: bound.globalArtDirection ?? "",
        aspectRatio: bound.aspectRatio || DEFAULT_DRAFT.aspectRatio,
        format: bound.format || (isPaidLicense ? "webp" : "png"),
        optimizeOnUpload: bound.optimizeOnUpload ?? Boolean(isPaidLicense),
        medium: bound.medium ?? DEFAULT_DRAFT.medium,
        // Video styling hydrates too (video-visuals handoff §4) — a site
        // whose preset already carries a video look must show it (and
        // Finish must update, not replace it). Absent fields stay absent;
        // the eligible-plan defaults effect below fills those.
        ...bound.videoStyle ? { videoStyle: bound.videoStyle } : {},
        ...bound.videoArtDirection ? { videoArtDirection: bound.videoArtDirection } : {},
        ...bound.captionPlacement ? { captionPlacement: bound.captionPlacement } : {},
        ...Array.isArray(bound.palette) && bound.palette.length > 0 ? { palette: bound.palette } : {}
      });
    } else if (!step4) {
      setStep4Draft({
        ...DEFAULT_DRAFT,
        format: isPaidLicense ? "webp" : "png",
        optimizeOnUpload: Boolean(isPaidLicense)
      });
    }
  }, [step4, setStep4Draft, isPaidLicense, presetsData]);
  const draft = step4 ?? DEFAULT_DRAFT;
  const update = (p2) => {
    const current = useWizardStore.getState().drafts.step4 ?? draft;
    setStep4Draft({ ...current, ...p2 });
  };
  window.wp.element.useEffect(() => {
    setStepValid(4, draft.globalArtDirection.trim().length > 0);
  }, [draft.globalArtDirection, setStepValid]);
  const videoEligibility = useVideoStylingEligibility();
  const [videoOpen, setVideoOpen] = window.wp.element.useState(false);
  window.wp.element.useEffect(() => {
    if (videoEligibility !== "eligible") return;
    if (!step4) return;
    if (step4.videoStyle !== void 0 && step4.captionPlacement !== void 0) {
      return;
    }
    setStep4Draft({
      ...step4,
      videoStyle: step4.videoStyle ?? "kinetic",
      captionPlacement: step4.captionPlacement ?? "bottom"
    });
  }, [videoEligibility, step4, setStep4Draft]);
  const GEN_STAGES = window.wp.element.useMemo(
    () => [
      window.wp.i18n.__("Reading your homepage…", "structura"),
      window.wp.i18n.__("Studying your brand's look…", "structura"),
      window.wp.i18n.__("Composing a visual direction…", "structura"),
      window.wp.i18n.__("Finishing the style…", "structura")
    ],
    []
  );
  const handleGenerate = async (provider, context, medium) => {
    if (!provider) return;
    const picked = medium ?? draft.medium ?? "photography";
    const data = await suggest("visual", {
      provider,
      context,
      medium: picked
    });
    if (data?.prompt) {
      const videoPatch = videoEligibility === "eligible" ? {
        ...typeof data.videoArtDirection === "string" && data.videoArtDirection ? { videoArtDirection: data.videoArtDirection } : {},
        ...Array.isArray(data.palette) && data.palette.every((c2) => typeof c2 === "string") ? { palette: data.palette } : {}
      } : {};
      update({ medium: picked, globalArtDirection: data.prompt, ...videoPatch });
      successToast(window.wp.i18n.__("Drafted a visual style from your brand.", "structura"));
    } else {
      update({ medium: picked });
      if (data !== null) {
        errorToast(
          window.wp.i18n.__(
            "We couldn't draft a style this time. Write your own below, or try again.",
            "structura"
          )
        );
      }
    }
  };
  const runAutoSuggest = async () => {
    const sources = [];
    const home = publicUrl || profile?.publicUrl || profile?.homeUrl || "";
    if (home) sources.push({ title: profile?.name || "Homepage", url: home });
    if (logoUrl) sources.push({ title: "Brand logo", url: logoUrl });
    await handleGenerate(defaultTextProvider ?? "", sources, draft.medium);
  };
  const autoFiredRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (autoFiredRef.current) return;
    if (!isPaidLicense || !defaultTextProvider) return;
    if (isPaidLicense && presetsData === void 0) return;
    const bound = presetsData?.boundPresetId ? presetsData.presets.find((p2) => p2.presetId === presetsData.boundPresetId) : void 0;
    if (bound?.globalArtDirection?.trim()) {
      autoFiredRef.current = true;
      return;
    }
    if (step4 && step4.globalArtDirection.trim().length > 0) {
      autoFiredRef.current = true;
      return;
    }
    autoFiredRef.current = true;
    void runAutoSuggest();
  }, [isPaidLicense, defaultTextProvider, presetsData, step4]);
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-3 text-center" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Your visual style", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-base text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
    "How every post's images should look. We draft a starting style from your brand — tweak anything.",
    "structura"
  ))), isSuggesting ? /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8" }, /* @__PURE__ */ window.wp.element.createElement(
    WizardMagicLoader,
    {
      icon: Image,
      title: window.wp.i18n.__("Designing your visual style", "structura"),
      stages: GEN_STAGES
    }
  )) : /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-6 p-8" }, /* @__PURE__ */ window.wp.element.createElement(
    SuggestStrategySection,
    {
      isStrategizing: isSuggesting,
      onGenerate: handleGenerate,
      mediumPicker: {
        heading: window.wp.i18n.__("Image medium", "structura"),
        current: draft.medium ?? "photography",
        options: MEDIUM_OPTIONS
      },
      toggleButtonLabel: window.wp.i18n.__("Suggest Image Style", "structura"),
      contextFieldLabel: window.wp.i18n.__(
        "Brand Resources (logo, guidelines, design system URL…)",
        "structura"
      ),
      addSourceLabel: window.wp.i18n.__("Add Resource", "structura"),
      ctaButtonLabel: window.wp.i18n.__("Generate Image Style", "structura"),
      placeholder: {
        title: window.wp.i18n.__("Company logo", "structura"),
        url: `${window.location.origin}/logo.png`
      },
      initialSources: logoUrl ? [{ title: window.wp.i18n.__("Site Logo", "structura"), url: logoUrl }] : void 0
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Visual prompt template", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Visual prompt template", "structura"),
      hiddenLabel: true,
      value: draft.globalArtDirection,
      onChange: (e2) => update({ globalArtDirection: e2.target.value }),
      rows: 4,
      placeholder: window.wp.i18n.__(
        "E.g. Clean editorial photography, soft natural light, muted earthy palette, shallow depth of field.",
        "structura"
      )
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "This anchors every image we generate. Be specific about palette, mood, and style.",
    "structura"
  ))), videoEligibility === "eligible" && /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      "aria-expanded": videoOpen,
      onClick: () => setVideoOpen((open) => !open),
      className: videoOpen ? "flex w-full cursor-pointer items-center gap-3 rounded-xl rounded-b-none border border-b-0 border-neutral-200 bg-neutral-50/70 px-4 py-3 text-left transition-all dark:border-neutral-700 dark:bg-neutral-800/40" : "flex w-full cursor-pointer items-center gap-3 rounded-xl border border-neutral-200 bg-white px-4 py-3 text-left transition-all hover:border-neutral-300 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:border-neutral-600"
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300" }, /* @__PURE__ */ window.wp.element.createElement(Wn, { className: "h-4.5 w-4.5" })),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[13px] font-bold text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Video styling", "structura")), /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "primary" }, window.wp.i18n.__("Suggested for you", "structura"))), /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-0.5 block truncate text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.sprintf(
      /* translators: %s: style summary, e.g. "Kinetic · captions bottom · brand-palette accents" */
      window.wp.i18n.__("%s — edit anytime in Visuals.", "structura"),
      [
        // Style names are the presets' proper names —
        // untranslated by design (videoChannel.ts).
        videoStyleById(draft.videoStyle).name,
        {
          top: window.wp.i18n.__("captions top", "structura"),
          middle: window.wp.i18n.__("captions middle", "structura"),
          bottom: window.wp.i18n.__("captions bottom", "structura")
        }[draft.captionPlacement ?? "bottom"],
        draft.palette && draft.palette.length > 0 ? window.wp.i18n.__("brand-palette accents", "structura") : null
      ].filter(Boolean).join(" · ")
    ))),
    videoOpen ? /* @__PURE__ */ window.wp.element.createElement(ChevronUp, { size: 16, className: "shrink-0 text-neutral-400", "aria-hidden": true }) : /* @__PURE__ */ window.wp.element.createElement(ChevronDown, { size: 16, className: "shrink-0 text-neutral-400", "aria-hidden": true })
  ), videoOpen && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4 rounded-b-xl border border-t-0 border-neutral-200 bg-neutral-50/70 px-4 pt-3 pb-4 dark:border-neutral-700 dark:bg-neutral-800/40" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Style preset", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    VideoStyleCards,
    {
      compact: true,
      value: draft.videoStyle ?? "kinetic",
      onChange: (style) => update({ videoStyle: style }),
      ...draft.palette?.[0] ? { accent: draft.palette[0] } : {}
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Caption placement", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    CaptionPlacementField,
    {
      value: draft.captionPlacement ?? "bottom",
      onChange: (placement) => update({ captionPlacement: placement })
    }
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex! items-start gap-1.5 text-[11px] leading-relaxed text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(
    Sparkles,
    {
      size: 12,
      className: "mt-px shrink-0 text-brand-500 dark:text-brand-400",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__(
    "Video art direction was drafted from your homepage — fine-tune it under Visuals after setup.",
    "structura"
  ))))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-4 border-t border-neutral-100 pt-6 sm:grid-cols-2 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement("label", { className: "text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Default aspect ratio", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: draft.aspectRatio,
      onValueChange: (val) => update({ aspectRatio: String(val) }),
      options: ASPECT_RATIOS
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, ASPECT_RATIOS.map((r2) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: r2.value, value: r2.value }, r2.label)))
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement("label", { className: "flex items-center gap-2 text-xs font-medium uppercase tracking-wider text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Image format", "structura"), !isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "premium" }, window.wp.i18n.__("Pro", "structura")) : null), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: draft.format,
      onValueChange: (val) => update({ format: String(val) }),
      options: FORMATS,
      disabled: !isPaidLicense
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, FORMATS.map((f2) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: f2.value, value: f2.value }, f2.label)))
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-4 border-t border-neutral-100 pt-6 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2 text-sm font-medium text-neutral-900 dark:text-neutral-100" }, window.wp.i18n.__("Optimize images on upload", "structura"), !isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "premium" }, window.wp.i18n.__("Pro", "structura")) : null), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Re-encode and resize generated images for fast page loads.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Optimize images on upload", "structura"),
      hiddenLabel: true,
      checked: draft.optimizeOnUpload,
      onChange: (checked) => update({ optimizeOnUpload: checked }),
      disabled: !isPaidLicense
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-md border border-neutral-200 bg-neutral-50 px-4 py-3 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex! items-center gap-2 text-xs text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "info" }, window.wp.i18n.__("Tip", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__(
    "Everything saves at the end. Edit later under Settings → Visuals.",
    "structura"
  ))))));
};
const WizardStep5Persona = () => {
  const { isPaidLicense } = useLicense();
  const { defaultTextProvider } = useDefaultProviders();
  const personasQuery = usePersonasQuery();
  const personas = personasQuery.data ?? [];
  const personasLoading = personasQuery.isLoading;
  const membersQuery = useMemberPersonaIdsQuery();
  const memberIds = membersQuery.data ?? [];
  const { data: wpUsers = [] } = useWpUsersQuery();
  const { data: positioningData } = useWizardPositioningQuery();
  const { suggest } = useMagicSuggest();
  const { savePersona, addMembership, removeMembership, isBinding } = usePersonaMutations();
  const setStepValid = useWizardStore((s2) => s2.setStepValid);
  const personaSeeded = useWizardStore((s2) => s2.personaSeeded);
  const setPersonaSeeded = useWizardStore((s2) => s2.setPersonaSeeded);
  const [autoDrafting, setAutoDrafting] = window.wp.element.useState(false);
  const [autoBinding, setAutoBinding] = window.wp.element.useState(false);
  const canAiDraft = isPaidLicense && Boolean(defaultTextProvider);
  window.wp.element.useEffect(() => {
    setStepValid(5, memberIds.length > 0);
  }, [memberIds.length, setStepValid]);
  const autoFiredRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (autoFiredRef.current) return;
    if (!personasQuery.isSuccess) return;
    if (personaSeeded) {
      autoFiredRef.current = true;
      return;
    }
    if (canAiDraft) {
      autoFiredRef.current = true;
      setPersonaSeeded(true);
      const p2 = positioningData?.positioning;
      const context = p2 && (p2.what || p2.who || p2.problem) ? { what: p2.what, who: p2.who, problem: p2.problem } : void 0;
      setAutoDrafting(true);
      void (async () => {
        try {
          const data = await suggest("persona", {
            provider: defaultTextProvider,
            context
          });
          if (data && (data.name || data.system_prompt)) {
            const res = await savePersona({
              id: "",
              name: data.name ?? window.wp.i18n.__("Your first persona", "structura"),
              system_prompt: data.system_prompt ?? "",
              tone: data.tone ?? "professional",
              reading_level: data.reading_level ?? "grade_8",
              author_id: wpUsers[0]?.id ?? 0
            });
            if (res?.id != null && String(res.id) !== "0") {
              await addMembership(String(res.id));
            }
          }
        } catch {
        } finally {
          setAutoDrafting(false);
        }
      })();
      return;
    }
    if (memberIds.length > 0) {
      autoFiredRef.current = true;
      return;
    }
    const seeded = personas[0];
    if (!seeded) return;
    autoFiredRef.current = true;
    setPersonaSeeded(true);
    setAutoBinding(true);
    void addMembership(String(seeded.id)).finally(() => setAutoBinding(false));
  }, [
    personasQuery.isSuccess,
    canAiDraft,
    defaultTextProvider,
    personaSeeded,
    memberIds.length,
    personas
  ]);
  const stages = window.wp.element.useMemo(
    () => [
      window.wp.i18n.__("Reading your positioning…", "structura"),
      window.wp.i18n.__("Shaping a distinct voice…", "structura"),
      window.wp.i18n.__("Tuning tone and audience…", "structura"),
      window.wp.i18n.__("Writing the persona…", "structura")
    ],
    []
  );
  const showLoader = personasLoading || membersQuery.isLoading || autoDrafting || autoBinding;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-3 text-center" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Your personas", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-base text-neutral-600 dark:text-neutral-400" }, canAiDraft ? window.wp.i18n.__(
    "Personas are the voices that write your posts. We draft one tailored to this site to start you off. Bind more from your workspace library, pull from templates, or add new ones — campaigns rotate through the voices writing for this site.",
    "structura"
  ) : window.wp.i18n.__(
    "Personas are the voices that write your posts. We've set you up with a House voice to start. Tailor it, pull more from templates, or add your own — campaigns rotate through the voices writing for this site.",
    "structura"
  ))), showLoader ? /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8" }, /* @__PURE__ */ window.wp.element.createElement(
    WizardMagicLoader,
    {
      icon: Users,
      title: autoDrafting ? window.wp.i18n.__("Drafting your first persona", "structura") : autoBinding ? window.wp.i18n.__("Setting up your House voice", "structura") : window.wp.i18n.__("Loading your personas", "structura"),
      stages
    }
  )) : /* @__PURE__ */ window.wp.element.createElement(
    PersonaManager,
    {
      memberIds,
      onBind: (id) => void addMembership(id),
      onUnbind: (id) => void removeMembership(id),
      binding: isBinding
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-md border border-neutral-200 bg-neutral-50 px-4 py-3 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! flex! items-center gap-2 text-xs text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "info" }, window.wp.i18n.__("Tip", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__(
    "Two or three distinct voices keep a blog from sounding repetitive. Only voices bound to this site write for it; the rest stay in your workspace library to bind whenever you want.",
    "structura"
  )))));
};
const WizardStep6Done = ({
  completedSteps,
  onNavigate,
  canCreateCampaign = true
}) => {
  const navigate = useNavigate();
  const resetMutation = useResetWizardMutation();
  const setActiveStep = useWizardStore((s2) => s2.setActiveStep);
  const resetStore = useWizardStore((s2) => s2.reset);
  const handleRestart = async () => {
    await resetMutation.mutateAsync();
    resetStore();
    setActiveStep(1);
    navigate("/onboarding");
  };
  const inputStepCount = 5;
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-10 p-8 sm:p-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col items-center gap-4 text-center" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-14 w-14 items-center justify-center rounded-full bg-gradient-to-br from-brand-400 to-brand-600 text-white shadow-lg shadow-brand-500/30" }, /* @__PURE__ */ window.wp.element.createElement(PartyPopper, { size: 24 })), /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50 sm:text-4xl" }, window.wp.i18n.__("You're all set", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! max-w-xl text-base text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
    "Your setup is saved and Structura is ready to start writing. Pick where to begin — you can edit any of these choices later.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium uppercase tracking-wider text-emerald-600 dark:text-emerald-400" }, completedSteps.filter((s2) => s2 <= inputStepCount).length, " /", " ", inputStepCount, " ", window.wp.i18n.__("steps configured", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-4" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: `grid grid-cols-1 gap-3 ${canCreateCampaign ? "sm:grid-cols-2" : ""}`
    },
    canCreateCampaign ? /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => onNavigate("/campaigns/new"),
        className: "group flex cursor-pointer items-center justify-between gap-3 rounded-xl bg-brand-500 px-5 py-4 text-left text-white shadow-lg shadow-brand-500/30 transition-all hover:bg-brand-600 hover:shadow-brand-500/40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-500"
      },
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-white/15 ring-1 ring-white/20" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 16 })), /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex flex-col" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-semibold" }, window.wp.i18n.__("Create your first campaign", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-white/80" }, window.wp.i18n.__("Recurring posts on a schedule.", "structura")))),
      /* @__PURE__ */ window.wp.element.createElement(
        ChevronRight,
        {
          size: 16,
          className: "text-white/70 transition-transform group-hover:translate-x-0.5"
        }
      )
    ) : null,
    /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => onNavigate("/generate"),
        className: "group flex cursor-pointer items-center justify-between gap-3 rounded-xl border border-neutral-200 bg-white px-5 py-4 text-left transition-all hover:border-neutral-300 hover:shadow-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-500 dark:border-neutral-700 dark:bg-neutral-900 dark:hover:border-neutral-600"
      },
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-brand-50 text-brand-600 ring-1 ring-brand-100 dark:bg-brand-950/40 dark:text-brand-300 dark:ring-brand-900/40" }, /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 16 })), /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex flex-col" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-semibold text-neutral-900 dark:text-neutral-50" }, window.wp.i18n.__("Generate a single post", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("One-off, no schedule needed.", "structura")))),
      /* @__PURE__ */ window.wp.element.createElement(
        ChevronRight,
        {
          size: 16,
          className: "text-neutral-400 transition-transform group-hover:translate-x-0.5 dark:text-neutral-500"
        }
      )
    )
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-center" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => onNavigate("/"),
      className: "cursor-pointer text-xs text-neutral-500 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-200"
    },
    window.wp.i18n.__("Go to the dashboard", "structura")
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-center border-t border-neutral-100 pt-6 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: handleRestart,
      disabled: resetMutation.isPending
    },
    resetMutation.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(RotateCcw, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Restart setup from step 1", "structura")
  )));
};
const LockedStepCard = ({
  step,
  title,
  valueStatement,
  detail,
  upgradeHref: upgradeHref2
}) => {
  const setStepValid = useWizardStore((s2) => s2.setStepValid);
  window.wp.element.useEffect(() => {
    setStepValid(step, true);
  }, [step, setStepValid]);
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex flex-col gap-3 text-center" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-semibold tracking-tight text-neutral-900 dark:text-neutral-50" }, title)), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col items-center gap-6 p-12" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-brand-50 text-brand-500 dark:bg-brand-950/30" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 18 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-2 text-center" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-lg font-medium text-neutral-900 dark:text-neutral-50" }, valueStatement), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! max-w-md text-sm text-neutral-600 dark:text-neutral-400" }, detail)), /* @__PURE__ */ window.wp.element.createElement("a", { href: upgradeHref2, target: "_blank", rel: "noreferrer", className: "contents" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "primary", size: "md" }, window.wp.i18n.__("Upgrade to unlock", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Continue past this step for now — you can come back any time.",
    "structura"
  ))));
};
function useFinishWizard() {
  const { data: profile } = usePublicSiteProfile();
  const saveProfile = usePublicSiteProfileMutation();
  const saveAiSettings = useUpdateAiSettings();
  const savePositioning = useSaveWizardPositioningMutation();
  const saveSeoSettings = useUpdateSiteSeoSettingsMutation();
  const { create: createPreset, update: updatePreset } = useVisualPresetMutations();
  const { data: presetsData } = useVisualPresetsQuery();
  const markStepComplete = useSaveWizardStepMutation();
  const dismissOnboarding = useDismissOnboardingMutation();
  return useMutation({
    mutationFn: async () => {
      const { drafts } = useWizardStore.getState();
      if (drafts.step1 && profile) {
        try {
          await saveProfile.mutateAsync({
            publicUrl: drafts.step1.publicUrl,
            isHeadless: drafts.step1.isHeadless,
            description: drafts.step1.description,
            keyPages: profile.keyPages,
            permalinkStrategy: profile.permalinkStrategy,
            permalinkTemplate: profile.permalinkTemplate,
            defaultPermalinkLang: profile.defaultPermalinkLang
          });
        } catch (e2) {
          console.warn("Wizard finish: site profile save failed", e2);
        }
      }
      if (drafts.step2?.textProvider) {
        try {
          await saveAiSettings.mutateAsync({
            ai: {
              defaults: {
                text_provider: drafts.step2.textProvider,
                text_model: drafts.step2.textModel,
                image_provider: drafts.step2.imageProvider,
                image_model: drafts.step2.imageModel
              }
            }
          });
        } catch (e2) {
          console.warn("Wizard finish: AI defaults save failed", e2);
        }
      }
      if (drafts.step3) {
        const { positioning, positioningSource, competitorUrls, referralLinks } = drafts.step3;
        if (positioning.what || positioning.who || positioning.problem) {
          try {
            await savePositioning.mutateAsync({
              what: positioning.what,
              who: positioning.who,
              problem: positioning.problem,
              source: positioningSource
            });
          } catch (e2) {
            console.warn("Wizard finish: positioning save failed", e2);
          }
        }
        try {
          await saveSeoSettings.mutateAsync({
            competitorUrls,
            ...referralLinks?.length ? { referralLinks } : {}
          });
        } catch (e2) {
          console.warn("Wizard finish: SEO settings save failed", e2);
        }
      }
      if (drafts.step4) {
        const content = {
          global_art_direction: drafts.step4.globalArtDirection,
          aspect_ratio: drafts.step4.aspectRatio,
          format: drafts.step4.format,
          optimize_on_upload: drafts.step4.optimizeOnUpload,
          // Persist the rendering medium picked in the AI-suggest dropdown
          // so the preset (and every generated image) matches it.
          medium: drafts.step4.medium,
          // Video styling (video-visuals handoff §4) — keys are OMITTED
          // (not defaulted) when the draft carries none: the video row
          // only writes them on eligible plans, and a pre-video draft
          // restored from localStorage must never clobber a preset's
          // saved video styling with defaults.
          ...drafts.step4.videoStyle !== void 0 ? { video_style: drafts.step4.videoStyle } : {},
          ...drafts.step4.videoArtDirection !== void 0 ? { video_art_direction: drafts.step4.videoArtDirection } : {},
          ...drafts.step4.captionPlacement !== void 0 ? { caption_placement: drafts.step4.captionPlacement } : {},
          ...drafts.step4.palette !== void 0 ? { palette: drafts.step4.palette } : {}
        };
        const boundId = presetsData?.boundPresetId ?? null;
        try {
          if (boundId) {
            await updatePreset({ preset_id: boundId, content });
          } else {
            await createPreset({
              label: "Default",
              content,
              bind_to_activation: true
            });
          }
        } catch (e2) {
          console.warn("Wizard finish: visual preset save failed", e2);
        }
      }
      try {
        await markStepComplete.mutateAsync(6);
      } catch (e2) {
        console.warn("Wizard finish: completion flag failed", e2);
      }
      try {
        await dismissOnboarding.mutateAsync();
      } catch (e2) {
        console.warn("Wizard finish: dismiss flag failed", e2);
      }
      clearOnboardingDismissed();
    }
  });
}
const TIER_ORDER$1 = [
  "none",
  "free",
  "byok",
  "cloud",
  "cloud_pro"
];
function tierLevel$1(planId) {
  if (!planId) return -1;
  return TIER_ORDER$1.indexOf(planId);
}
const OnboardingPage = () => {
  const navigate = useNavigate();
  const {
    isPaidLicense,
    plan: currentPlan,
    hasUsableLicense,
    hasWorkspace
  } = useLicense();
  const { data, isLoading } = useWizardStateQuery({
    enabled: hasWorkspace === true
  });
  const resetMutation = useResetWizardMutation();
  const finishWizard = useFinishWizard();
  const activeStep = useWizardStore((s2) => s2.activeStep);
  const setActiveStep = useWizardStore((s2) => s2.setActiveStep);
  const stepValidity = useWizardStore((s2) => s2.stepValidity);
  const setStepValid = useWizardStore((s2) => s2.setStepValid);
  const resetStore = useWizardStore((s2) => s2.reset);
  const licenseGateSkipped = useWizardStore((s2) => s2.licenseGateSkipped);
  const setLicenseGateSkipped = useWizardStore(
    (s2) => s2.setLicenseGateSkipped
  );
  const isCloud = isManagedPlan(currentPlan);
  const hiddenSteps = window.wp.element.useMemo(
    () => [
      ...isCloud ? [2] : [],
      ...currentPlan === "none" ? [4] : []
    ],
    [isCloud, currentPlan]
  );
  const isHiddenStep = (step) => hiddenSteps.includes(step);
  const nextVisibleStep = (from) => {
    let n2 = from + 1;
    while (n2 <= 6 && isHiddenStep(n2)) n2++;
    return Math.min(n2, 6);
  };
  const prevVisibleStep = (from) => {
    let p2 = from - 1;
    while (p2 >= 1 && isHiddenStep(p2)) p2--;
    return Math.max(p2, 1);
  };
  window.wp.element.useEffect(() => {
    let bounced = false;
    for (const s2 of hiddenSteps) {
      setStepValid(s2, true);
      if (activeStep === s2 && !bounced) {
        setActiveStep(nextVisibleStep(s2));
        bounced = true;
      }
    }
  }, [hiddenSteps, activeStep, setStepValid, setActiveStep]);
  const finishedRef = window.wp.element.useRef(false);
  const restartFiredRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (restartFiredRef.current) return;
    if (typeof window === "undefined") return;
    const hash = window.location.hash;
    const queryIdx = hash.indexOf("?");
    if (queryIdx === -1) return;
    const params = new URLSearchParams(hash.slice(queryIdx + 1));
    if (params.get("restart") !== "1") return;
    restartFiredRef.current = true;
    void resetMutation.mutateAsync().then(() => {
      resetStore();
      setActiveStep(1);
      window.location.hash = "#/onboarding";
    }).catch(() => {
      restartFiredRef.current = false;
    });
  }, [resetMutation, resetStore, setActiveStep]);
  if (hasUsableLicense === false && (!licenseGateSkipped || hasWorkspace !== true)) {
    return /* @__PURE__ */ window.wp.element.createElement(
      WizardShell,
      {
        activeStep: 1,
        completedSteps: [],
        skippedSteps: [],
        hideStepStrip: true,
        hideContinue: true,
        onSkip: null
      },
      /* @__PURE__ */ window.wp.element.createElement(
        WizardLicenseGate,
        {
          canContinueWithoutKey: hasWorkspace === true,
          onContinueWithoutKey: () => setLicenseGateSkipped(true)
        }
      )
    );
  }
  if (isLoading || !data) {
    return window.wp.element.createPortal(
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "fixed inset-0 z-[100000] flex items-center justify-center bg-neutral-50 text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Loading setup…", "structura"))),
      document.body
    );
  }
  const { state } = data;
  const isStepReachable = (step) => {
    if (step === 1) return true;
    for (let s2 = 1; s2 < step; s2++) {
      if (!stepValidity[s2]) return false;
    }
    return true;
  };
  const completedSteps = [1, 2, 3, 4, 5, 6].filter((s2) => stepValidity[s2]);
  const canFinish = [1, 2, 3, 4, 5].every(
    (s2) => stepValidity[s2]
  );
  const isBusy = finishWizard.isPending;
  const goToConfirmation = async () => {
    if (!canFinish) return;
    if (!finishedRef.current) {
      await finishWizard.mutateAsync();
      finishedRef.current = true;
    }
    setActiveStep(6);
  };
  const handleContinue = async () => {
    if (activeStep === 5) {
      await goToConfirmation();
      return;
    }
    if (activeStep < 5) {
      setActiveStep(nextVisibleStep(activeStep));
    }
  };
  const handleLeave = (destination) => {
    resetStore();
    navigate(destination);
  };
  const handleBack = () => {
    if (activeStep === 1) return;
    setActiveStep(prevVisibleStep(activeStep));
  };
  const currentStepValid = activeStep >= 5 ? canFinish : stepValidity[activeStep];
  const renderStep = () => {
    if (isHiddenStep(activeStep)) return null;
    if (!isPaidLicense && activeStep === 3) {
      return /* @__PURE__ */ window.wp.element.createElement(
        LockedStepCard,
        {
          step: 3,
          title: window.wp.i18n.__("SEO intelligence", "structura"),
          valueStatement: window.wp.i18n.__("Real keyword data, not guesses.", "structura"),
          detail: window.wp.i18n.__(
            "Paid plans pull live ranking + competitor data and suggest target keywords from what you do.",
            "structura"
          ),
          upgradeHref: buildMarketingPricingUrl({
            intent: "unlock_seo",
            domain: typeof window !== "undefined" ? window.location.hostname : void 0,
            plan: currentPlan ?? void 0
          })
        }
      );
    }
    switch (activeStep) {
      case 1:
        return /* @__PURE__ */ window.wp.element.createElement(WizardStep1Identity, null);
      case 2:
        return isCloud ? null : /* @__PURE__ */ window.wp.element.createElement(WizardStep2AiEngine, null);
      case 3:
        return /* @__PURE__ */ window.wp.element.createElement(WizardStep3SeoIntelligence, null);
      case 4:
        return /* @__PURE__ */ window.wp.element.createElement(WizardStep4Visuals, null);
      case 5:
        return /* @__PURE__ */ window.wp.element.createElement(WizardStep5Persona, null);
      case 6:
        return /* @__PURE__ */ window.wp.element.createElement(
          WizardStep6Done,
          {
            completedSteps,
            onNavigate: handleLeave,
            canCreateCampaign: (currentPlan ?? "none") !== "none"
          }
        );
      default:
        return null;
    }
  };
  const isDowngraded = !!state.completedAtPlanId && tierLevel$1(state.completedAtPlanId) > tierLevel$1(currentPlan ?? null);
  return /* @__PURE__ */ window.wp.element.createElement(
    WizardShell,
    {
      activeStep,
      completedSteps,
      skippedSteps: [],
      hiddenSteps,
      reachableSteps: [1, 2, 3, 4, 5, 6].filter(
        isStepReachable
      ),
      onBack: activeStep > 1 ? handleBack : void 0,
      onStepClick: (step) => {
        if (step === 6) {
          void goToConfirmation();
          return;
        }
        if (isStepReachable(step)) setActiveStep(step);
      },
      onSkip: null,
      onContinue: activeStep < 6 && currentStepValid ? handleContinue : null,
      continueLabel: activeStep === 5 ? window.wp.i18n.__("Finish setup", "structura") : void 0,
      continueHint: activeStep < 6 && !currentStepValid ? activeStep === 5 ? window.wp.i18n.__("Complete every step to finish", "structura") : window.wp.i18n.__("Complete this step to continue", "structura") : void 0,
      hideContinue: activeStep === 6,
      contentClassName: activeStep === 5 ? "max-w-5xl" : void 0,
      isBusy
    },
    isDowngraded ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement(DowngradeBanner, { previousPlanLabel: state.completedAtPlanId ?? void 0 })) : null,
    renderStep()
  );
};
const useOnboardingAutoRedirect = () => {
  const navigate = useNavigate();
  const location = useLocation();
  const { hasUsableLicense, hasWorkspace, isPaidLicense } = useLicense();
  const { data } = useWizardStateQuery({ enabled: hasWorkspace === true });
  const onboardingDismissedServer = typeof window !== "undefined" && window.structuraConfig?.onboarding_dismissed === true || Boolean(data?.state?.completedAt);
  const hasRedirectedRef = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (!onboardingDismissedServer) return;
    if (location.pathname === "/onboarding") return;
    clearAllOnboardingStorage();
  }, [onboardingDismissedServer, location.pathname]);
  window.wp.element.useEffect(() => {
    if (hasRedirectedRef.current) return;
    if (onboardingDismissedServer) return;
    const needsPositioningNudge = data?.activationNeedsPositioning && isPaidLicense && !isOnboardingDismissed();
    const hadPriorActivation = typeof window !== "undefined" ? window.structuraConfig?.had_prior_activation ?? true : true;
    const freshUnconnected = hasUsableLicense === false && !hadPriorActivation && !isOnboardingDismissed();
    if (!data?.justCreated && !needsPositioningNudge && !freshUnconnected)
      return;
    if (location.pathname !== "/") return;
    hasRedirectedRef.current = true;
    navigate("/onboarding");
  }, [
    data?.justCreated,
    data?.activationNeedsPositioning,
    onboardingDismissedServer,
    hasUsableLicense,
    isPaidLicense,
    location.pathname,
    navigate
  ]);
};
const OnboardingAutoRedirectBridge = () => {
  useOnboardingAutoRedirect();
  return null;
};
const DISMISS_KEY = "structura-onboarding-resume-tile-dismissed";
const TIER_ORDER = [
  "none",
  "free",
  "byok",
  "cloud",
  "cloud_pro"
];
function tierLevel(planId) {
  if (!planId) return -1;
  return TIER_ORDER.indexOf(planId);
}
const OnboardingResumeTile = () => {
  const navigate = useNavigate();
  const { plan: currentPlan, hasWorkspace } = useLicense();
  const { data } = useWizardStateQuery({ enabled: hasWorkspace === true });
  const [dismissed, setDismissed] = window.wp.element.useState(false);
  window.wp.element.useEffect(() => {
    try {
      if (typeof window !== "undefined") {
        setDismissed(window.sessionStorage.getItem(DISMISS_KEY) === "1");
      }
    } catch {
    }
  }, []);
  const mode = window.wp.element.useMemo(() => {
    if (!data) return null;
    if (!data.state.completedAt) return "incomplete";
    const completedLevel = tierLevel(data.state.completedAtPlanId);
    const currentLevel = tierLevel(currentPlan ?? null);
    if (completedLevel >= 0 && currentLevel > completedLevel) {
      return "upgraded";
    }
    return null;
  }, [data, currentPlan]);
  if (!mode || dismissed) return null;
  if (!data) return null;
  const { state } = data;
  const totalSteps = 6;
  const resolvedCount = state.completedSteps.length + state.skippedSteps.length;
  const remaining = Math.max(0, totalSteps - resolvedCount);
  const handleDismiss = () => {
    try {
      window.sessionStorage.setItem(DISMISS_KEY, "1");
    } catch {
    }
    setDismissed(true);
  };
  const copy = mode === "incomplete" ? {
    icon: /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14 }),
    title: resolvedCount === 0 ? window.wp.i18n.__("Finish your Structura setup", "structura") : window.wp.i18n.__("Pick up where you left off", "structura"),
    subtitle: remaining === 1 ? window.wp.i18n.__("One step left — a few minutes.", "structura") : window.wp.i18n.sprintf(
      /* translators: %d = number of remaining setup steps */
      window.wp.i18n.__("%d steps left — a few minutes.", "structura"),
      remaining
    ),
    cta: window.wp.i18n.__("Resume setup", "structura")
  } : {
    icon: /* @__PURE__ */ window.wp.element.createElement(PartyPopper, { size: 14 }),
    title: window.wp.i18n.__("New options unlocked", "structura"),
    subtitle: window.wp.i18n.__(
      "Your plan upgrade enables paid-tier setup steps — refresh your wizard to take advantage.",
      "structura"
    ),
    cta: window.wp.i18n.__("Refresh setup", "structura")
  };
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex items-center justify-between gap-6 border-brand-200 bg-brand-50 p-5 dark:border-brand-900/40 dark:bg-brand-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-brand-500 text-white" }, copy.icon), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-col gap-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-900 dark:text-neutral-50" }, copy.title), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-600 dark:text-neutral-400" }, copy.subtitle))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "primary",
      size: "sm",
      onClick: () => navigate("/onboarding")
    },
    copy.cta,
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })
  ), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: handleDismiss,
      className: "flex h-8 w-8 items-center justify-center rounded-md text-neutral-500 hover:bg-brand-100 hover:text-neutral-700 dark:hover:bg-brand-900/40 dark:hover:text-neutral-200",
      "aria-label": window.wp.i18n.__("Dismiss setup reminder", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(X, { size: 14 })
  )));
};
const RestartWizardCard = () => {
  const navigate = useNavigate();
  const resetMutation = useResetWizardMutation();
  const resetStore = useWizardStore((s2) => s2.reset);
  const setActiveStep = useWizardStore((s2) => s2.setActiveStep);
  const handleRestart = async () => {
    try {
      await resetMutation.mutateAsync();
    } catch {
    }
    resetStore();
    setActiveStep(1);
    navigate("/onboarding");
  };
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-4 p-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-col gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(WandSparkles, { size: 14, className: "text-brand-500" }), window.wp.i18n.__("Setup wizard", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Walk through guided setup again — site info, AI engine, SEO, visuals, and personas. Your saved settings are kept; you'll just step through them from the start.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: handleRestart,
      disabled: resetMutation.isPending
    },
    resetMutation.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(RotateCcw, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Restart setup wizard", "structura")
  )));
};
const EMPTY = { what: "", who: "", problem: "" };
const PositioningCard = () => {
  const { data, isLoading } = useWizardPositioningQuery();
  const save = useSaveWizardPositioningMutation();
  const suggest = useSuggestWizardPositioningMutation();
  const { successToast, errorToast } = Mn();
  const [draft, setDraft] = window.wp.element.useState(null);
  window.wp.element.useEffect(() => {
    if (draft) return;
    if (isLoading) return;
    const p2 = data?.positioning;
    setDraft(p2 ? { what: p2.what, who: p2.who, problem: p2.problem } : EMPTY);
  }, [data, isLoading, draft]);
  const update = (patch) => setDraft((d2) => ({ ...d2 ?? EMPTY, ...patch }));
  const handleSave = async () => {
    if (!draft) return;
    await save.mutateAsync({ ...draft, source: "edited" });
    successToast(window.wp.i18n.__("Positioning saved.", "structura"));
  };
  const handleAiDraft = async () => {
    try {
      const res = await suggest.mutateAsync();
      if (res.suggestion) {
        setDraft({
          what: res.suggestion.what,
          who: res.suggestion.who,
          problem: res.suggestion.problem
        });
        successToast(
          window.wp.i18n.__("Drafted from your homepage — review and Save.", "structura")
        );
        return;
      }
      errorToast(
        res.reason === "missing_domain" ? window.wp.i18n.__(
          "We couldn't find a public homepage to read. Set the public website on the Info card, or write the answers in yourself.",
          "structura"
        ) : window.wp.i18n.__(
          "AI couldn't draft this right now. Try again in a moment, or write the answers in yourself.",
          "structura"
        )
      );
    } catch {
      errorToast(
        window.wp.i18n.__("Something went wrong drafting from your homepage.", "structura")
      );
    }
  };
  const loading = isLoading || draft === null;
  const value = draft ?? EMPTY;
  const dirty = !!data?.positioning && (value.what !== data.positioning.what || value.who !== data.positioning.who || value.problem !== data.positioning.problem);
  const canSave = !!draft && (value.what.trim() || value.who.trim() || value.problem.trim()) && (dirty || !data?.positioning);
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-6 p-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-col gap-1" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! flex! items-center gap-2 text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Target, { size: 14, className: "text-brand-500" }), window.wp.i18n.__("Positioning", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "What you do, who you serve, and the problem you solve. Steers every campaign Structura writes.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: handleAiDraft,
      disabled: suggest.isPending || loading
    },
    suggest.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Draft from my homepage", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "primary",
      size: "sm",
      onClick: handleSave,
      disabled: save.isPending || !canSave || loading
    },
    save.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Save, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Save", "structura")
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-4" }, loading ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(PositioningFieldSkeleton, null), /* @__PURE__ */ window.wp.element.createElement(PositioningFieldSkeleton, null), /* @__PURE__ */ window.wp.element.createElement(PositioningFieldSkeleton, null)) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("What does your business do?", "structura"),
      value: value.what,
      onChange: (e2) => update({ what: e2.target.value }),
      rows: 2,
      maxLength: 280,
      placeholder: window.wp.i18n.__(
        "We help remote design teams ship Figma faster…",
        "structura"
      )
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Who's your typical customer?", "structura"),
      value: value.who,
      onChange: (e2) => update({ who: e2.target.value }),
      rows: 2,
      maxLength: 280,
      placeholder: window.wp.i18n.__(
        "Senior designers at 20–200-person companies…",
        "structura"
      )
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("What problem do you solve for them?", "structura"),
      value: value.problem,
      onChange: (e2) => update({ problem: e2.target.value }),
      rows: 2,
      maxLength: 280,
      placeholder: window.wp.i18n.__(
        "Async handoff between designers and engineers breaks down…",
        "structura"
      )
    }
  ))));
};
const PositioningFieldSkeleton = () => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-3 w-44" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-[60px] w-full" }));
const DashboardPage = () => {
  const navigate = useNavigate();
  const { data: stats, isLoading: loadingStats } = useStatsQuery();
  const { isLicensed, isPaidLicense, plan } = useLicense();
  const { activeProviders } = useAiConnections();
  const { data: personas = [] } = usePersonasQuery();
  const { data: jobsResponse, isLoading: loadingJobs } = useJobsQuery("pending", 1, "");
  const isManagedAiPlan = isManagedPlan(plan);
  const hasPersona = personas.length > 0;
  const hasApiKey = activeProviders.length > 0;
  const isEngineReady = hasPersona && (isManagedAiPlan || hasApiKey);
  const isGlobalLoading = loadingStats || isLicensed && loadingJobs;
  if (isGlobalLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading dashboard…", "structura"), size: "lg", padding: "lg" });
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Overview", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Your content at a glance.", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => navigate("/generate"),
      disabled: !isEngineReady
    },
    /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Generate Post", "structura")
  ), isLicensed && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      onClick: () => navigate("/campaigns/new"),
      disabled: !isEngineReady
    },
    /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 16, className: "mr-1.5" }),
    window.wp.i18n.__("New Campaign", "structura")
  ))), /* @__PURE__ */ window.wp.element.createElement(OnboardingResumeTile, null), /* @__PURE__ */ window.wp.element.createElement(GscConnectBanner, null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-3" }, /* @__PURE__ */ window.wp.element.createElement(
    StatCard$1,
    {
      label: window.wp.i18n.__("Posts Created", "structura"),
      value: stats?.content.posts ?? 0,
      subtext: window.wp.i18n.sprintf(window.wp.i18n.__("%d content blocks", "structura"), stats?.content.blocks ?? 0),
      variant: "brand"
    }
  ), /* @__PURE__ */ window.wp.element.createElement(GscSummaryCard, null), /* @__PURE__ */ window.wp.element.createElement(
    StatCard$1,
    {
      label: window.wp.i18n.__("Images Generated", "structura"),
      value: stats?.visual.optimized ?? 0,
      subtext: window.wp.i18n.sprintf(
        window.wp.i18n.__("%s storage reclaimed", "structura"),
        stats?.visual.space_saved ?? "0MB"
      ),
      variant: "emerald"
    }
  ), isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(IntelligenceUsage, null) : /* @__PURE__ */ window.wp.element.createElement(UpgradeCard, null)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-8" }, isLicensed && /* @__PURE__ */ window.wp.element.createElement(ActiveQueue, { jobs: jobsResponse?.data ?? [] }), /* @__PURE__ */ window.wp.element.createElement(RecentSinglePostRuns, null), /* @__PURE__ */ window.wp.element.createElement(RecentBlueprints, null)));
};
const useCampaignsQuery = () => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: campaignKeys.lists(),
    queryFn: async () => {
      return await window.wp.apiFetch({
        path: "/structura/v1/scheduler/campaigns"
      });
    },
    enabled: hasUsableLicense === true,
    // A just-created campaign has no `stats.nextRun` until the plugin's
    // Action Scheduler computes its first occurrence (a beat after create).
    // Poll fast until every active campaign has one — so the card flips from
    // "Not scheduled" to the real date on its own — then settle back to the
    // 30s ambient refresh.
    refetchInterval: (query) => {
      const campaigns = query.state.data ?? [];
      const awaitingSchedule = campaigns.some(
        (c2) => c2.status === "active" && !c2.stats?.nextRun
      );
      return awaitingSchedule ? 5e3 : 3e4;
    },
    staleTime: 1e4
  });
};
const useAcknowledgeRunMutation = () => {
  const queryClient2 = useQueryClient();
  return useMutation({
    mutationFn: (runId) => window.wp.apiFetch({
      path: `/structura/v1/runs/${encodeURIComponent(runId)}/acknowledge`,
      method: "POST"
    }),
    onMutate: async (runId) => {
      await Promise.all([
        queryClient2.cancelQueries({ queryKey: dashboardKeys.attentionRuns() }),
        queryClient2.cancelQueries({ queryKey: campaignKeys.lists() })
      ]);
      const previousRuns = queryClient2.getQueryData(
        dashboardKeys.attentionRuns()
      );
      const previousCampaigns = queryClient2.getQueryData(
        campaignKeys.lists()
      );
      if (previousRuns) {
        queryClient2.setQueryData(
          dashboardKeys.attentionRuns(),
          previousRuns.filter((r2) => r2.runId !== runId)
        );
      }
      if (previousCampaigns) {
        queryClient2.setQueryData(
          campaignKeys.lists(),
          previousCampaigns.map(
            (c2) => c2.lastRun && c2.lastRun.runId === runId ? { ...c2, lastRun: void 0 } : c2
          )
        );
      }
      return { previousRuns, previousCampaigns };
    },
    onError: (_err, _runId, ctx) => {
      if (ctx?.previousRuns) {
        queryClient2.setQueryData(dashboardKeys.attentionRuns(), ctx.previousRuns);
      }
      if (ctx?.previousCampaigns) {
        queryClient2.setQueryData(campaignKeys.lists(), ctx.previousCampaigns);
      }
    },
    onSettled: () => {
      queryClient2.invalidateQueries({ queryKey: dashboardKeys.attentionRuns() });
      queryClient2.invalidateQueries({ queryKey: campaignKeys.lists() });
    }
  });
};
const useStockSummaryQuery = (campaignId, options) => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: campaignKeys.stockSummary(campaignId),
    enabled: hasUsableLicense === true && (options?.enabled ?? true),
    staleTime: 3e4,
    queryFn: async () => {
      const response = await window.wp.apiFetch({
        path: `/structura/v1/scheduler/campaign/${campaignId}/stock-summary`
      });
      return response?.summary ?? {
        pending: 0,
        ready: 0,
        consumed: 0,
        failed: 0,
        stale: 0,
        total: 0
      };
    },
    // Stock summary failures shouldn't trigger toasts — the chip
    // rendering already gracefully handles undefined data.
    meta: { silentError: true }
  });
};
const StockSummaryChip = ({
  campaignId,
  pregenerationEnabled,
  className
}) => {
  const { data: summary, isLoading } = useStockSummaryQuery(campaignId, {
    enabled: pregenerationEnabled
  });
  if (!pregenerationEnabled) return null;
  if (isLoading || !summary) return null;
  if (summary.total === 0) return null;
  const inFlight = summary.pending;
  if (summary.ready > 0) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "bg-brand-50 text-brand-700 dark:bg-brand-950/40 dark:text-brand-300 inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-bold tracking-wider uppercase",
          className
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 10, "aria-hidden": true }),
      window.wp.i18n.sprintf(window.wp.i18n.__("%d ready", "structura"), summary.ready)
    );
  }
  if (inFlight > 0) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "inline-flex items-center gap-1.5 rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-bold tracking-wider text-amber-700 uppercase dark:bg-amber-950/30 dark:text-amber-300",
          className
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 10, className: "animate-spin", "aria-hidden": true }),
      window.wp.i18n.__("Pre-generating", "structura")
    );
  }
  return null;
};
const STORE_VERSION = 1;
const STORAGE_KEY_PREFIX = "structura-campaign-draft";
const getStorageKey = () => perActivationStorageKey(STORAGE_KEY_PREFIX);
const buildInitialState = () => ({
  formData: DEFAULT_CAMPAIGN_FORM_DATA,
  activeStep: "interview",
  completedSteps: [],
  skippedSteps: [],
  lastUpdatedAt: null
});
const touch = () => (/* @__PURE__ */ new Date()).toISOString();
const useCampaignDraftStore = create()(
  persist(
    (set, get) => ({
      ...buildInitialState(),
      updateForm: (cluster, data, options) => set((state) => ({
        formData: {
          ...state.formData,
          [cluster]: { ...state.formData[cluster], ...data }
        },
        lastUpdatedAt: options?.markTouched === false ? state.lastUpdatedAt : touch()
      })),
      replaceForm: (data, options) => set({
        formData: data,
        // The license-defaults bootstrap calls this with markTouched:false
        // so applying defaults to an empty draft doesn't trip the
        // "user has a draft to resume" banner.
        lastUpdatedAt: options?.markTouched === false ? get().lastUpdatedAt : touch()
      }),
      setActiveStep: (step) => set({ activeStep: step, lastUpdatedAt: touch() }),
      markComplete: (step) => set(
        (state) => state.completedSteps.includes(step) ? state : { completedSteps: [...state.completedSteps, step], lastUpdatedAt: touch() }
      ),
      markSkipped: (step) => set(
        (state) => state.skippedSteps.includes(step) ? state : { skippedSteps: [...state.skippedSteps, step], lastUpdatedAt: touch() }
      ),
      clearStepFlag: (step) => set((state) => ({
        completedSteps: state.completedSteps.filter((s2) => s2 !== step),
        skippedSteps: state.skippedSteps.filter((s2) => s2 !== step)
      })),
      discardDraft: () => {
        set({ ...buildInitialState() });
        void useCampaignDraftStore.persist.clearStorage();
      }
    }),
    {
      name: getStorageKey(),
      version: STORE_VERSION,
      storage: createJSONStorage(() => localStorage),
      // On version mismatch we drop the draft. Migrating between
      // arbitrary CampaignFormData shapes isn't worth the complexity —
      // a discarded draft is a one-time inconvenience; a crash on rehydrate
      // is a recurring one.
      migrate: () => buildInitialState()
    }
  )
);
const STEP_LABEL = {
  interview: window.wp.i18n.__("Interview", "structura"),
  strategy: window.wp.i18n.__("Strategy", "structura"),
  keywords: window.wp.i18n.__("Keywords", "structura"),
  authority: window.wp.i18n.__("Authority", "structura"),
  rhythm: window.wp.i18n.__("Rhythm", "structura"),
  summary: window.wp.i18n.__("Summary", "structura")
};
const CampaignDraftBanner = () => {
  const navigate = useNavigate();
  const lastUpdatedAt = useCampaignDraftStore((s2) => s2.lastUpdatedAt);
  const formData = useCampaignDraftStore((s2) => s2.formData);
  const activeStep = useCampaignDraftStore((s2) => s2.activeStep);
  const discardDraft = useCampaignDraftStore((s2) => s2.discardDraft);
  if (lastUpdatedAt === null) return null;
  const name = formData.identity.name?.trim();
  const displayName = name && name.length > 0 ? name : window.wp.i18n.__("Untitled draft", "structura");
  const stepLabel = STEP_LABEL[activeStep] ?? activeStep;
  const relative = dayjs(lastUpdatedAt).fromNow();
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-start justify-between gap-4 rounded-2xl border border-brand-200/70 bg-gradient-to-r from-brand-50/70 to-purple-50/50 px-5 py-4 sm:flex-row sm:items-center dark:border-brand-900/40 dark:from-brand-950/20 dark:to-purple-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-full bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-300" }, /* @__PURE__ */ window.wp.element.createElement(FilePen, { size: 16 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 space-y-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! truncate text-sm font-semibold text-neutral-900 dark:text-white" }, window.wp.i18n.sprintf(
    /* translators: %s: draft campaign name (or "Untitled draft") */
    window.wp.i18n.__("You have a draft campaign: %s", "structura"),
    displayName
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.sprintf(
    /* translators: 1: step label (e.g. "Keywords"), 2: relative time (e.g. "5 minutes ago") */
    window.wp.i18n.__("Stopped at %1$s · last edited %2$s", "structura"),
    stepLabel,
    relative
  )))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      variant: "transparent",
      onClick: discardDraft,
      "aria-label": window.wp.i18n.__("Discard draft", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Discard", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", onClick: () => navigate("/campaigns/new") }, window.wp.i18n.__("Resume", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" }))));
};
var cronstrueI18n = { exports: {} };
var hasRequiredCronstrueI18n;
function requireCronstrueI18n() {
  if (hasRequiredCronstrueI18n) return cronstrueI18n.exports;
  hasRequiredCronstrueI18n = 1;
  (function(module, exports$1) {
    (function webpackUniversalModuleDefinition(root, factory) {
      module.exports = factory();
    })(globalThis, () => {
      return (
        /******/
        (() => {
          var __webpack_modules__ = {
            /***/
            949(__unused_webpack_module, exports$12, __webpack_require__2) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.CronParser = void 0;
              var rangeValidator_1 = __webpack_require__2(515);
              var CronParser = (function() {
                function CronParser2(expression, dayOfWeekStartIndexZero, monthStartIndexZero) {
                  if (dayOfWeekStartIndexZero === void 0) {
                    dayOfWeekStartIndexZero = true;
                  }
                  if (monthStartIndexZero === void 0) {
                    monthStartIndexZero = false;
                  }
                  this.expression = expression;
                  this.dayOfWeekStartIndexZero = dayOfWeekStartIndexZero;
                  this.monthStartIndexZero = monthStartIndexZero;
                }
                CronParser2.prototype.parse = function() {
                  var _a2;
                  var parsed;
                  var expression = (_a2 = this.expression) !== null && _a2 !== void 0 ? _a2 : "";
                  if (expression === "@reboot") {
                    parsed = ["@reboot", "", "", "", "", "", ""];
                    return parsed;
                  } else if (expression.startsWith("@")) {
                    var special = this.parseSpecial(this.expression);
                    parsed = this.extractParts(special);
                  } else {
                    parsed = this.extractParts(this.expression);
                  }
                  this.normalize(parsed);
                  this.validate(parsed);
                  return parsed;
                };
                CronParser2.prototype.parseSpecial = function(expression) {
                  var specialExpressions = {
                    "@yearly": "0 0 1 1 *",
                    "@annually": "0 0 1 1 *",
                    "@monthly": "0 0 1 * *",
                    "@weekly": "0 0 * * 0",
                    "@daily": "0 0 * * *",
                    "@midnight": "0 0 * * *",
                    "@hourly": "0 * * * *",
                    "@reboot": "@reboot"
                  };
                  var special = specialExpressions[expression];
                  if (!special) {
                    throw new Error("Unknown special expression.");
                  }
                  return special;
                };
                CronParser2.prototype.extractParts = function(expression) {
                  if (!this.expression) {
                    throw new Error("cron expression is empty");
                  }
                  var parsed = expression.trim().split(/[ ]+/);
                  for (var i2 = 0; i2 < parsed.length; i2++) {
                    if (parsed[i2].includes(",")) {
                      var arrayElement = parsed[i2].split(",").map(function(item) {
                        return item.trim();
                      }).filter(function(item) {
                        return item !== "";
                      }).map(function(item) {
                        return !isNaN(Number(item)) ? Number(item) : item;
                      }).filter(function(item) {
                        return item !== null && item !== "";
                      });
                      if (arrayElement.length === 0) {
                        arrayElement.push("*");
                      }
                      arrayElement.sort(function(a3, b2) {
                        return a3 !== null && b2 !== null ? a3 - b2 : 0;
                      });
                      parsed[i2] = arrayElement.map(function(item) {
                        return item !== null ? item.toString() : "";
                      }).join(",");
                    }
                  }
                  if (parsed.length < 5) {
                    throw new Error("Expression has only ".concat(parsed.length, " part").concat(parsed.length == 1 ? "" : "s", ". At least 5 parts are required."));
                  } else if (parsed.length == 5) {
                    parsed.unshift("");
                    parsed.push("");
                  } else if (parsed.length == 6) {
                    var isYearWithNoSecondsPart = /\d{4}$/.test(parsed[5]) || parsed[4] == "?" || parsed[2] == "?";
                    if (isYearWithNoSecondsPart) {
                      parsed.unshift("");
                    } else {
                      parsed.push("");
                    }
                  } else if (parsed.length > 7) {
                    throw new Error("Expression has ".concat(parsed.length, " parts; too many!"));
                  }
                  return parsed;
                };
                CronParser2.prototype.normalize = function(expressionParts) {
                  var _this = this;
                  expressionParts[3] = expressionParts[3].replace("?", "*");
                  expressionParts[5] = expressionParts[5].replace("?", "*");
                  expressionParts[2] = expressionParts[2].replace("?", "*");
                  if (expressionParts[0].indexOf("0/") == 0) {
                    expressionParts[0] = expressionParts[0].replace("0/", "*/");
                  }
                  if (expressionParts[1].indexOf("0/") == 0) {
                    expressionParts[1] = expressionParts[1].replace("0/", "*/");
                  }
                  if (expressionParts[2].indexOf("0/") == 0) {
                    expressionParts[2] = expressionParts[2].replace("0/", "*/");
                  }
                  if (expressionParts[3].indexOf("1/") == 0) {
                    expressionParts[3] = expressionParts[3].replace("1/", "*/");
                  }
                  if (expressionParts[4].indexOf("1/") == 0) {
                    expressionParts[4] = expressionParts[4].replace("1/", "*/");
                  }
                  if (expressionParts[6].indexOf("1/") == 0) {
                    expressionParts[6] = expressionParts[6].replace("1/", "*/");
                  }
                  expressionParts[5] = expressionParts[5].replace(/(^\d)|([^#/\s]\d)/g, function(t2) {
                    var dowDigits = t2.replace(/\D/, "");
                    var dowDigitsAdjusted = dowDigits;
                    if (_this.dayOfWeekStartIndexZero) {
                      if (dowDigits == "7") {
                        dowDigitsAdjusted = "0";
                      }
                    } else {
                      dowDigitsAdjusted = (parseInt(dowDigits) - 1).toString();
                    }
                    return t2.replace(dowDigits, dowDigitsAdjusted);
                  });
                  if (expressionParts[5] == "L") {
                    expressionParts[5] = "6";
                  }
                  if (expressionParts[3] == "?") {
                    expressionParts[3] = "*";
                  }
                  if (expressionParts[3].indexOf("W") > -1 && (expressionParts[3].indexOf(",") > -1 || expressionParts[3].indexOf("-") > -1)) {
                    throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");
                  }
                  var days = {
                    SUN: 0,
                    MON: 1,
                    TUE: 2,
                    WED: 3,
                    THU: 4,
                    FRI: 5,
                    SAT: 6
                  };
                  for (var day in days) {
                    expressionParts[5] = expressionParts[5].replace(new RegExp(day, "gi"), days[day].toString());
                  }
                  expressionParts[4] = expressionParts[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g, function(t2) {
                    var dowDigits = t2.replace(/\D/, "");
                    var dowDigitsAdjusted = dowDigits;
                    if (_this.monthStartIndexZero) {
                      dowDigitsAdjusted = (parseInt(dowDigits) + 1).toString();
                    }
                    return t2.replace(dowDigits, dowDigitsAdjusted);
                  });
                  var months = {
                    JAN: 1,
                    FEB: 2,
                    MAR: 3,
                    APR: 4,
                    MAY: 5,
                    JUN: 6,
                    JUL: 7,
                    AUG: 8,
                    SEP: 9,
                    OCT: 10,
                    NOV: 11,
                    DEC: 12
                  };
                  for (var month in months) {
                    expressionParts[4] = expressionParts[4].replace(new RegExp(month, "gi"), months[month].toString());
                  }
                  if (expressionParts[0] == "0") {
                    expressionParts[0] = "";
                  }
                  if (!/\*|\-|\,|\//.test(expressionParts[2]) && (/\*|\//.test(expressionParts[1]) || /\*|\//.test(expressionParts[0]))) {
                    expressionParts[2] += "-".concat(expressionParts[2]);
                  }
                  for (var i2 = 0; i2 < expressionParts.length; i2++) {
                    if (expressionParts[i2].indexOf(",") != -1) {
                      expressionParts[i2] = expressionParts[i2].split(",").filter(function(str) {
                        return str !== "";
                      }).join(",") || "*";
                    }
                    if (expressionParts[i2] == "*/1") {
                      expressionParts[i2] = "*";
                    }
                    if (expressionParts[i2].indexOf("/") > -1 && !/^\*|\-|\,/.test(expressionParts[i2])) {
                      var stepRangeThrough = null;
                      switch (i2) {
                        case 4:
                          stepRangeThrough = "12";
                          break;
                        case 5:
                          stepRangeThrough = "6";
                          break;
                        case 6:
                          stepRangeThrough = "9999";
                          break;
                        default:
                          stepRangeThrough = null;
                          break;
                      }
                      if (stepRangeThrough !== null) {
                        var parts = expressionParts[i2].split("/");
                        expressionParts[i2] = "".concat(parts[0], "-").concat(stepRangeThrough, "/").concat(parts[1]);
                      }
                    }
                  }
                };
                CronParser2.prototype.validate = function(parsed) {
                  var standardCronPartCharacters = "0-9,\\-*/";
                  this.validateOnlyExpectedCharactersFound(parsed[0], standardCronPartCharacters);
                  this.validateOnlyExpectedCharactersFound(parsed[1], standardCronPartCharacters);
                  this.validateOnlyExpectedCharactersFound(parsed[2], standardCronPartCharacters);
                  this.validateOnlyExpectedCharactersFound(parsed[3], "0-9,\\-*/LW");
                  this.validateOnlyExpectedCharactersFound(parsed[4], standardCronPartCharacters);
                  this.validateOnlyExpectedCharactersFound(parsed[5], "0-9,\\-*/L#");
                  this.validateOnlyExpectedCharactersFound(parsed[6], standardCronPartCharacters);
                  this.validateAnyRanges(parsed);
                };
                CronParser2.prototype.validateAnyRanges = function(parsed) {
                  rangeValidator_1.default.secondRange(parsed[0]);
                  rangeValidator_1.default.minuteRange(parsed[1]);
                  rangeValidator_1.default.hourRange(parsed[2]);
                  rangeValidator_1.default.dayOfMonthRange(parsed[3]);
                  rangeValidator_1.default.monthRange(parsed[4], this.monthStartIndexZero);
                  rangeValidator_1.default.dayOfWeekRange(parsed[5], this.dayOfWeekStartIndexZero);
                };
                CronParser2.prototype.validateOnlyExpectedCharactersFound = function(cronPart, allowedCharsExpression) {
                  var invalidChars = cronPart.match(new RegExp("[^".concat(allowedCharsExpression, "]+"), "gi"));
                  if (invalidChars && invalidChars.length) {
                    throw new Error("Expression contains invalid values: '".concat(invalidChars.toString(), "'"));
                  }
                };
                return CronParser2;
              })();
              exports$12.CronParser = CronParser;
            },
            /***/
            333(__unused_webpack_module, exports$12, __webpack_require__2) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.ExpressionDescriptor = void 0;
              var stringUtilities_1 = __webpack_require__2(823);
              var cronParser_1 = __webpack_require__2(949);
              var ExpressionDescriptor = (function() {
                function ExpressionDescriptor2(expression, options) {
                  this.expression = expression;
                  this.options = options;
                  this.expressionParts = new Array(5);
                  if (!this.options.locale && ExpressionDescriptor2.defaultLocale) {
                    this.options.locale = ExpressionDescriptor2.defaultLocale;
                  }
                  if (!ExpressionDescriptor2.locales[this.options.locale]) {
                    var fallBackLocale = Object.keys(ExpressionDescriptor2.locales)[0];
                    console.warn("Locale '".concat(this.options.locale, "' could not be found; falling back to '").concat(fallBackLocale, "'."));
                    this.options.locale = fallBackLocale;
                  }
                  this.i18n = ExpressionDescriptor2.locales[this.options.locale];
                  if (options.use24HourTimeFormat === void 0) {
                    options.use24HourTimeFormat = this.i18n.use24HourTimeFormatByDefault();
                  }
                }
                ExpressionDescriptor2.toString = function(expression, _a2) {
                  var _b = _a2 === void 0 ? {} : _a2, _c = _b.throwExceptionOnParseError, throwExceptionOnParseError = _c === void 0 ? true : _c, _d = _b.verbose, verbose = _d === void 0 ? false : _d, _e2 = _b.dayOfWeekStartIndexZero, dayOfWeekStartIndexZero = _e2 === void 0 ? true : _e2, _f = _b.monthStartIndexZero, monthStartIndexZero = _f === void 0 ? false : _f, use24HourTimeFormat = _b.use24HourTimeFormat, _g = _b.trimHoursLeadingZero, trimHoursLeadingZero = _g === void 0 ? false : _g, _h = _b.locale, locale = _h === void 0 ? null : _h, _j = _b.logicalAndDayFields, logicalAndDayFields = _j === void 0 ? false : _j;
                  var options = {
                    throwExceptionOnParseError,
                    verbose,
                    dayOfWeekStartIndexZero,
                    monthStartIndexZero,
                    use24HourTimeFormat,
                    trimHoursLeadingZero,
                    locale,
                    logicalAndDayFields
                  };
                  if (options.tzOffset) {
                    console.warn("'tzOffset' option has been deprecated and is no longer supported.");
                  }
                  var descripter = new ExpressionDescriptor2(expression, options);
                  return descripter.getFullDescription();
                };
                ExpressionDescriptor2.initialize = function(localesLoader, defaultLocale) {
                  if (defaultLocale === void 0) {
                    defaultLocale = "en";
                  }
                  ExpressionDescriptor2.specialCharacters = ["/", "-", ",", "*"];
                  ExpressionDescriptor2.defaultLocale = defaultLocale;
                  localesLoader.load(ExpressionDescriptor2.locales);
                };
                ExpressionDescriptor2.prototype.getFullDescription = function() {
                  var _a2, _b;
                  var description = "";
                  try {
                    var parser = new cronParser_1.CronParser(this.expression, this.options.dayOfWeekStartIndexZero, this.options.monthStartIndexZero);
                    this.expressionParts = parser.parse();
                    if (this.expressionParts[0] === "@reboot") {
                      return ((_b = (_a2 = this.i18n).atReboot) === null || _b === void 0 ? void 0 : _b.call(_a2)) || "Run once, at startup";
                    }
                    var timeSegment = this.getTimeOfDayDescription();
                    var dayOfMonthDesc = this.getDayOfMonthDescription();
                    var monthDesc = this.getMonthDescription();
                    var dayOfWeekDesc = this.getDayOfWeekDescription();
                    var yearDesc = this.getYearDescription();
                    description += timeSegment + dayOfMonthDesc + dayOfWeekDesc + monthDesc + yearDesc;
                    description = this.transformVerbosity(description, !!this.options.verbose);
                    description = description.charAt(0).toLocaleUpperCase() + description.substr(1);
                  } catch (ex) {
                    if (!this.options.throwExceptionOnParseError) {
                      description = this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();
                    } else {
                      throw "".concat(ex);
                    }
                  }
                  return description;
                };
                ExpressionDescriptor2.prototype.getTimeOfDayDescription = function() {
                  var secondsExpression = this.expressionParts[0];
                  var minuteExpression = this.expressionParts[1];
                  var hourExpression = this.expressionParts[2];
                  var description = "";
                  if (!stringUtilities_1.StringUtilities.containsAny(minuteExpression, ExpressionDescriptor2.specialCharacters) && !stringUtilities_1.StringUtilities.containsAny(hourExpression, ExpressionDescriptor2.specialCharacters) && !stringUtilities_1.StringUtilities.containsAny(secondsExpression, ExpressionDescriptor2.specialCharacters)) {
                    description += this.i18n.atSpace() + this.formatTime(hourExpression, minuteExpression, secondsExpression);
                  } else if (!secondsExpression && minuteExpression.indexOf("-") > -1 && !(minuteExpression.indexOf(",") > -1) && !(minuteExpression.indexOf("/") > -1) && !stringUtilities_1.StringUtilities.containsAny(hourExpression, ExpressionDescriptor2.specialCharacters)) {
                    var minuteParts = minuteExpression.split("-");
                    description += stringUtilities_1.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(), this.formatTime(hourExpression, minuteParts[0], ""), this.formatTime(hourExpression, minuteParts[1], ""));
                  } else if (!secondsExpression && hourExpression.indexOf(",") > -1 && hourExpression.indexOf("-") == -1 && hourExpression.indexOf("/") == -1 && !stringUtilities_1.StringUtilities.containsAny(minuteExpression, ExpressionDescriptor2.specialCharacters)) {
                    var hourParts = hourExpression.split(",");
                    description += this.i18n.at();
                    for (var i2 = 0; i2 < hourParts.length; i2++) {
                      description += " ";
                      description += this.formatTime(hourParts[i2], minuteExpression, "");
                      if (i2 < hourParts.length - 2) {
                        description += ",";
                      }
                      if (i2 == hourParts.length - 2) {
                        description += this.i18n.spaceAnd();
                      }
                    }
                  } else {
                    var secondsDescription = this.getSecondsDescription();
                    var minutesDescription = this.getMinutesDescription();
                    var hoursDescription = this.getHoursDescription();
                    description += secondsDescription;
                    if (description && minutesDescription) {
                      description += ", ";
                    }
                    description += minutesDescription;
                    if (minutesDescription === hoursDescription) {
                      return description;
                    }
                    if (description && hoursDescription) {
                      description += ", ";
                    }
                    description += hoursDescription;
                  }
                  return description;
                };
                ExpressionDescriptor2.prototype.getSecondsDescription = function() {
                  var _this = this;
                  var description = this.getSegmentDescription(this.expressionParts[0], this.i18n.everySecond(), function(s2) {
                    return s2;
                  }, function(s2) {
                    return stringUtilities_1.StringUtilities.format(_this.i18n.everyX0Seconds(s2), s2);
                  }, function(s2) {
                    return _this.i18n.secondsX0ThroughX1PastTheMinute();
                  }, function(s2) {
                    return s2 == "0" ? "" : parseInt(s2) < 20 ? _this.i18n.atX0SecondsPastTheMinute(s2) : _this.i18n.atX0SecondsPastTheMinuteGt20() || _this.i18n.atX0SecondsPastTheMinute(s2);
                  });
                  return description;
                };
                ExpressionDescriptor2.prototype.getMinutesDescription = function() {
                  var _this = this;
                  var secondsExpression = this.expressionParts[0];
                  var hourExpression = this.expressionParts[2];
                  var description = this.getSegmentDescription(this.expressionParts[1], this.i18n.everyMinute(), function(s2) {
                    return s2;
                  }, function(s2) {
                    return stringUtilities_1.StringUtilities.format(_this.i18n.everyX0Minutes(s2), s2);
                  }, function(s2) {
                    return _this.i18n.minutesX0ThroughX1PastTheHour();
                  }, function(s2) {
                    var _a2, _b;
                    try {
                      return s2 == "0" && hourExpression.indexOf("/") == -1 && secondsExpression == "" ? _this.i18n.everyHour() : s2 == "0" ? ((_b = (_a2 = _this.i18n).onTheHour) === null || _b === void 0 ? void 0 : _b.call(_a2)) || _this.i18n.atX0MinutesPastTheHour(s2) : parseInt(s2) < 20 ? _this.i18n.atX0MinutesPastTheHour(s2) : _this.i18n.atX0MinutesPastTheHourGt20() || _this.i18n.atX0MinutesPastTheHour(s2);
                    } catch (e2) {
                      return _this.i18n.atX0MinutesPastTheHour(s2);
                    }
                  });
                  return description;
                };
                ExpressionDescriptor2.prototype.getHoursDescription = function() {
                  var _this = this;
                  var expression = this.expressionParts[2];
                  var hourIndex = 0;
                  var rangeEndValues = [];
                  expression.split("/")[0].split(",").forEach(function(range) {
                    var rangeParts = range.split("-");
                    if (rangeParts.length === 2) {
                      rangeEndValues.push({ value: rangeParts[1], index: hourIndex + 1 });
                    }
                    hourIndex += rangeParts.length;
                  });
                  var evaluationIndex = 0;
                  var description = this.getSegmentDescription(expression, this.i18n.everyHour(), function(s2) {
                    var match = rangeEndValues.find(function(r2) {
                      return r2.value === s2 && r2.index === evaluationIndex;
                    });
                    var isRangeEndWithNonZeroMinute = match && _this.expressionParts[1] !== "0";
                    evaluationIndex++;
                    return isRangeEndWithNonZeroMinute ? _this.formatTime(s2, "59", "") : _this.formatTime(s2, "0", "");
                  }, function(s2) {
                    return stringUtilities_1.StringUtilities.format(_this.i18n.everyX0Hours(s2), s2);
                  }, function(s2) {
                    return _this.i18n.betweenX0AndX1();
                  }, function(s2) {
                    return _this.i18n.atX0();
                  });
                  return description;
                };
                ExpressionDescriptor2.prototype.getDayOfWeekDescription = function() {
                  var _this = this;
                  var daysOfWeekNames = this.i18n.daysOfTheWeek();
                  var description = null;
                  if (this.expressionParts[5] == "*") {
                    description = "";
                  } else {
                    description = this.getSegmentDescription(this.expressionParts[5], this.i18n.commaEveryDay(), function(s2, form) {
                      var exp = s2;
                      if (s2.indexOf("#") > -1) {
                        exp = s2.substring(0, s2.indexOf("#"));
                      } else if (s2.indexOf("L") > -1) {
                        exp = exp.replace("L", "");
                      }
                      var parsedExp = parseInt(exp);
                      var description2 = _this.i18n.daysOfTheWeekInCase ? _this.i18n.daysOfTheWeekInCase(form)[parsedExp] : daysOfWeekNames[parsedExp];
                      if (s2.indexOf("#") > -1) {
                        var dayOfWeekOfMonthDescription = null;
                        var dayOfWeekOfMonthNumber = s2.substring(s2.indexOf("#") + 1);
                        var dayOfWeekNumber = s2.substring(0, s2.indexOf("#"));
                        switch (dayOfWeekOfMonthNumber) {
                          case "1":
                            dayOfWeekOfMonthDescription = _this.i18n.first(dayOfWeekNumber);
                            break;
                          case "2":
                            dayOfWeekOfMonthDescription = _this.i18n.second(dayOfWeekNumber);
                            break;
                          case "3":
                            dayOfWeekOfMonthDescription = _this.i18n.third(dayOfWeekNumber);
                            break;
                          case "4":
                            dayOfWeekOfMonthDescription = _this.i18n.fourth(dayOfWeekNumber);
                            break;
                          case "5":
                            dayOfWeekOfMonthDescription = _this.i18n.fifth(dayOfWeekNumber);
                            break;
                        }
                        description2 = dayOfWeekOfMonthDescription + " " + description2;
                      }
                      return description2;
                    }, function(s2) {
                      if (parseInt(s2) == 1) {
                        return "";
                      } else {
                        return stringUtilities_1.StringUtilities.format(_this.i18n.commaEveryX0DaysOfTheWeek(s2), s2);
                      }
                    }, function(s2) {
                      var beginFrom = s2.substring(0, s2.indexOf("-"));
                      var domSpecified = _this.expressionParts[3] != "*";
                      return domSpecified ? _this.i18n.commaAndX0ThroughX1(beginFrom) : _this.i18n.commaX0ThroughX1(beginFrom);
                    }, function(s2) {
                      var format = null;
                      if (s2.indexOf("#") > -1) {
                        var dayOfWeekOfMonthNumber = s2.substring(s2.indexOf("#") + 1);
                        var dayOfWeek = s2.substring(0, s2.indexOf("#"));
                        format = _this.i18n.commaOnThe(dayOfWeekOfMonthNumber, dayOfWeek).trim() + _this.i18n.spaceX0OfTheMonth();
                      } else if (s2.indexOf("L") > -1) {
                        format = _this.i18n.commaOnTheLastX0OfTheMonth(s2.replace("L", ""));
                      } else {
                        var domSpecified = _this.expressionParts[3] != "*";
                        if (!domSpecified) {
                          format = _this.i18n.commaOnlyOnX0(s2);
                        } else if (_this.options.logicalAndDayFields) {
                          format = _this.i18n.commaOnlyOnX0(s2);
                        } else {
                          format = _this.i18n.commaAndOnX0();
                        }
                      }
                      return format;
                    });
                  }
                  return description;
                };
                ExpressionDescriptor2.prototype.getMonthDescription = function() {
                  var _this = this;
                  var monthNames = this.i18n.monthsOfTheYear();
                  var description = this.getSegmentDescription(this.expressionParts[4], "", function(s2, form) {
                    return form && _this.i18n.monthsOfTheYearInCase ? _this.i18n.monthsOfTheYearInCase(form)[parseInt(s2) - 1] : monthNames[parseInt(s2) - 1];
                  }, function(s2) {
                    if (parseInt(s2) == 1) {
                      return "";
                    } else {
                      return stringUtilities_1.StringUtilities.format(_this.i18n.commaEveryX0Months(s2), s2);
                    }
                  }, function(s2) {
                    return _this.i18n.commaMonthX0ThroughMonthX1() || _this.i18n.commaX0ThroughX1();
                  }, function(s2) {
                    return _this.i18n.commaOnlyInMonthX0 ? _this.i18n.commaOnlyInMonthX0() : _this.i18n.commaOnlyInX0();
                  });
                  return description;
                };
                ExpressionDescriptor2.prototype.getDayOfMonthDescription = function() {
                  var _this = this;
                  var description = null;
                  var expression = this.expressionParts[3];
                  switch (expression) {
                    case "L":
                      description = this.i18n.commaOnTheLastDayOfTheMonth();
                      break;
                    case "WL":
                    case "LW":
                      description = this.i18n.commaOnTheLastWeekdayOfTheMonth();
                      break;
                    default:
                      var weekDayNumberMatches = expression.match(/(\d{1,2}W)|(W\d{1,2})/);
                      if (weekDayNumberMatches) {
                        var dayNumber = parseInt(weekDayNumberMatches[0].replace("W", ""));
                        var dayString = dayNumber == 1 ? this.i18n.firstWeekday() : stringUtilities_1.StringUtilities.format(this.i18n.weekdayNearestDayX0(), dayNumber.toString());
                        description = stringUtilities_1.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(), dayString);
                        break;
                      } else {
                        var lastDayOffSetMatches = expression.match(/L-(\d{1,2})/);
                        if (lastDayOffSetMatches) {
                          var offSetDays = lastDayOffSetMatches[1];
                          description = stringUtilities_1.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(offSetDays), offSetDays);
                          break;
                        } else if (expression == "*" && this.expressionParts[5] != "*") {
                          return "";
                        } else {
                          description = this.getSegmentDescription(expression, this.i18n.commaEveryDay(), function(s2) {
                            return s2 == "L" ? _this.i18n.lastDay() : _this.i18n.dayX0 ? stringUtilities_1.StringUtilities.format(_this.i18n.dayX0(), s2) : s2;
                          }, function(s2) {
                            return s2 == "1" ? _this.i18n.commaEveryDay() : _this.i18n.commaEveryX0Days(s2);
                          }, function(s2) {
                            return _this.i18n.commaBetweenDayX0AndX1OfTheMonth(s2);
                          }, function(s2) {
                            return _this.i18n.commaOnDayX0OfTheMonth(s2);
                          });
                        }
                        break;
                      }
                  }
                  return description;
                };
                ExpressionDescriptor2.prototype.getYearDescription = function() {
                  var _this = this;
                  var description = this.getSegmentDescription(this.expressionParts[6], "", function(s2) {
                    return /^\d+$/.test(s2) ? new Date(parseInt(s2), 1).getFullYear().toString() : s2;
                  }, function(s2) {
                    return stringUtilities_1.StringUtilities.format(_this.i18n.commaEveryX0Years(s2), s2);
                  }, function(s2) {
                    return _this.i18n.commaYearX0ThroughYearX1() || _this.i18n.commaX0ThroughX1();
                  }, function(s2) {
                    return _this.i18n.commaOnlyInYearX0 ? _this.i18n.commaOnlyInYearX0() : _this.i18n.commaOnlyInX0();
                  });
                  return description;
                };
                ExpressionDescriptor2.prototype.getSegmentDescription = function(expression, allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat) {
                  var description = null;
                  var doesExpressionContainIncrement = expression.indexOf("/") > -1;
                  var doesExpressionContainRange = expression.indexOf("-") > -1;
                  var doesExpressionContainMultipleValues = expression.indexOf(",") > -1;
                  if (!expression) {
                    description = "";
                  } else if (expression === "*") {
                    description = allDescription;
                  } else if (!doesExpressionContainIncrement && !doesExpressionContainRange && !doesExpressionContainMultipleValues) {
                    description = stringUtilities_1.StringUtilities.format(getDescriptionFormat(expression), getSingleItemDescription(expression));
                  } else if (doesExpressionContainMultipleValues) {
                    var segments = expression.split(",");
                    var descriptionContent = "";
                    for (var i2 = 0; i2 < segments.length; i2++) {
                      if (i2 > 0 && segments.length > 2) {
                        descriptionContent += ",";
                        if (i2 < segments.length - 1) {
                          descriptionContent += " ";
                        }
                      }
                      if (i2 > 0 && segments.length > 1 && (i2 == segments.length - 1 || segments.length == 2)) {
                        descriptionContent += "".concat(this.i18n.spaceAnd(), " ");
                      }
                      if (segments[i2].indexOf("/") > -1 || segments[i2].indexOf("-") > -1) {
                        var isSegmentRangeWithoutIncrement = segments[i2].indexOf("-") > -1 && segments[i2].indexOf("/") == -1;
                        var currentDescriptionContent = this.getSegmentDescription(segments[i2], allDescription, getSingleItemDescription, getIncrementDescriptionFormat, isSegmentRangeWithoutIncrement ? this.i18n.commaX0ThroughX1 : getRangeDescriptionFormat, getDescriptionFormat);
                        if (isSegmentRangeWithoutIncrement) {
                          currentDescriptionContent = currentDescriptionContent.replace(", ", "");
                        }
                        descriptionContent += currentDescriptionContent;
                      } else if (!doesExpressionContainIncrement) {
                        descriptionContent += getSingleItemDescription(segments[i2]);
                      } else {
                        var segmentDescription = this.getSegmentDescription(segments[i2], allDescription, getSingleItemDescription, getIncrementDescriptionFormat, getRangeDescriptionFormat, getDescriptionFormat);
                        if (segmentDescription && segmentDescription.startsWith(", ")) {
                          segmentDescription = segmentDescription.substring(2);
                        }
                        descriptionContent += segmentDescription;
                      }
                    }
                    if (!doesExpressionContainIncrement) {
                      description = stringUtilities_1.StringUtilities.format(getDescriptionFormat(expression), descriptionContent);
                    } else {
                      description = descriptionContent;
                    }
                  } else if (doesExpressionContainIncrement) {
                    var segments = expression.split("/");
                    description = stringUtilities_1.StringUtilities.format(getIncrementDescriptionFormat(segments[1]), segments[1]);
                    if (segments[0].indexOf("-") > -1) {
                      var rangeSegmentDescription = this.generateRangeSegmentDescription(segments[0], getRangeDescriptionFormat, getSingleItemDescription);
                      if (rangeSegmentDescription.indexOf(", ") != 0) {
                        description += ", ";
                      }
                      description += rangeSegmentDescription;
                    } else if (segments[0].indexOf("*") == -1) {
                      var rangeItemDescription = stringUtilities_1.StringUtilities.format(getDescriptionFormat(segments[0]), getSingleItemDescription(segments[0]));
                      rangeItemDescription = rangeItemDescription.replace(", ", "");
                      description += stringUtilities_1.StringUtilities.format(this.i18n.commaStartingX0(), rangeItemDescription);
                    }
                  } else if (doesExpressionContainRange) {
                    description = this.generateRangeSegmentDescription(expression, getRangeDescriptionFormat, getSingleItemDescription);
                  }
                  return description;
                };
                ExpressionDescriptor2.prototype.generateRangeSegmentDescription = function(rangeExpression, getRangeDescriptionFormat, getSingleItemDescription) {
                  var description = "";
                  var rangeSegments = rangeExpression.split("-");
                  var rangeSegment1Description = getSingleItemDescription(rangeSegments[0], 1);
                  var rangeSegment2Description = getSingleItemDescription(rangeSegments[1], 2);
                  var rangeDescriptionFormat = getRangeDescriptionFormat(rangeExpression);
                  description += stringUtilities_1.StringUtilities.format(rangeDescriptionFormat, rangeSegment1Description, rangeSegment2Description);
                  return description;
                };
                ExpressionDescriptor2.prototype.formatTime = function(hourExpression, minuteExpression, secondExpression) {
                  var hourOffset = 0;
                  var minuteOffset = 0;
                  var hour = parseInt(hourExpression) + hourOffset;
                  var minute = parseInt(minuteExpression) + minuteOffset;
                  if (minute >= 60) {
                    minute -= 60;
                    hour += 1;
                  } else if (minute < 0) {
                    minute += 60;
                    hour -= 1;
                  }
                  if (hour >= 24) {
                    hour = hour - 24;
                  } else if (hour < 0) {
                    hour = 24 + hour;
                  }
                  var period = "";
                  var setPeriodBeforeTime = false;
                  if (!this.options.use24HourTimeFormat) {
                    setPeriodBeforeTime = !!(this.i18n.setPeriodBeforeTime && this.i18n.setPeriodBeforeTime());
                    period = setPeriodBeforeTime ? "".concat(this.getPeriod(hour), " ") : " ".concat(this.getPeriod(hour));
                    if (hour > 12) {
                      hour -= 12;
                    }
                    if (hour === 0) {
                      hour = 12;
                    }
                  }
                  var second = "";
                  if (secondExpression) {
                    second = ":".concat(("00" + secondExpression).substring(secondExpression.length));
                  }
                  var hourStr = hour.toString();
                  var paddedHour = ("00" + hourStr).substring(hourStr.length);
                  var minuteStr = minute.toString();
                  var paddedMinute = ("00" + minuteStr).substring(minuteStr.length);
                  var displayHour = this.options.trimHoursLeadingZero ? hourStr : paddedHour;
                  return "".concat(setPeriodBeforeTime ? period : "").concat(displayHour, ":").concat(paddedMinute).concat(second).concat(!setPeriodBeforeTime ? period : "");
                };
                ExpressionDescriptor2.prototype.transformVerbosity = function(description, useVerboseFormat) {
                  if (!useVerboseFormat) {
                    description = description.replace(new RegExp(", ".concat(this.i18n.everyMinute()), "g"), "");
                    description = description.replace(new RegExp(", ".concat(this.i18n.everyHour()), "g"), "");
                    description = description.replace(new RegExp(this.i18n.commaEveryDay(), "g"), "");
                    description = description.replace(/\, ?$/, "");
                    if (this.i18n.conciseVerbosityReplacements) {
                      for (var _i = 0, _a2 = Object.entries(this.i18n.conciseVerbosityReplacements()); _i < _a2.length; _i++) {
                        var _b = _a2[_i], key = _b[0], value = _b[1];
                        description = description.replace(new RegExp(key, "g"), value);
                      }
                    }
                  }
                  return description;
                };
                ExpressionDescriptor2.prototype.getPeriod = function(hour) {
                  return hour >= 12 ? this.i18n.pm && this.i18n.pm() || "PM" : this.i18n.am && this.i18n.am() || "AM";
                };
                ExpressionDescriptor2.locales = {};
                return ExpressionDescriptor2;
              })();
              exports$12.ExpressionDescriptor = ExpressionDescriptor;
            },
            /***/
            99(__unused_webpack_module, exports$12, __webpack_require__2) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.sr = exports$12.hr = exports$12.bg = exports$12.my = exports$12.vi = exports$12.ar = exports$12.th = exports$12.af = exports$12.hu = exports$12.be = exports$12.ca = exports$12.fa = exports$12.sw = exports$12.sl = exports$12.fi = exports$12.sk = exports$12.cs = exports$12.he = exports$12.ja = exports$12.zh_TW = exports$12.zh_CN = exports$12.uk = exports$12.tr = exports$12.ru = exports$12.ro = exports$12.pt_PT = exports$12.pt_BR = exports$12.pl = exports$12.sv = exports$12.nb = exports$12.nl = exports$12.ko = exports$12.id = exports$12.it = exports$12.fr = exports$12.es = exports$12.de = exports$12.da = exports$12.en = void 0;
              var en_1 = __webpack_require__2(486);
              Object.defineProperty(exports$12, "en", { enumerable: true, get: function() {
                return en_1.en;
              } });
              var da_1 = __webpack_require__2(506);
              Object.defineProperty(exports$12, "da", { enumerable: true, get: function() {
                return da_1.da;
              } });
              var de_1 = __webpack_require__2(230);
              Object.defineProperty(exports$12, "de", { enumerable: true, get: function() {
                return de_1.de;
              } });
              var es_1 = __webpack_require__2(153);
              Object.defineProperty(exports$12, "es", { enumerable: true, get: function() {
                return es_1.es;
              } });
              var fr_1 = __webpack_require__2(517);
              Object.defineProperty(exports$12, "fr", { enumerable: true, get: function() {
                return fr_1.fr;
              } });
              var it_1 = __webpack_require__2(488);
              Object.defineProperty(exports$12, "it", { enumerable: true, get: function() {
                return it_1.it;
              } });
              var id_1 = __webpack_require__2(72);
              Object.defineProperty(exports$12, "id", { enumerable: true, get: function() {
                return id_1.id;
              } });
              var ko_1 = __webpack_require__2(839);
              Object.defineProperty(exports$12, "ko", { enumerable: true, get: function() {
                return ko_1.ko;
              } });
              var nl_1 = __webpack_require__2(647);
              Object.defineProperty(exports$12, "nl", { enumerable: true, get: function() {
                return nl_1.nl;
              } });
              var nb_1 = __webpack_require__2(957);
              Object.defineProperty(exports$12, "nb", { enumerable: true, get: function() {
                return nb_1.nb;
              } });
              var sv_1 = __webpack_require__2(544);
              Object.defineProperty(exports$12, "sv", { enumerable: true, get: function() {
                return sv_1.sv;
              } });
              var pl_1 = __webpack_require__2(905);
              Object.defineProperty(exports$12, "pl", { enumerable: true, get: function() {
                return pl_1.pl;
              } });
              var pt_BR_1 = __webpack_require__2(556);
              Object.defineProperty(exports$12, "pt_BR", { enumerable: true, get: function() {
                return pt_BR_1.pt_BR;
              } });
              var pt_PT_1 = __webpack_require__2(163);
              Object.defineProperty(exports$12, "pt_PT", { enumerable: true, get: function() {
                return pt_PT_1.pt_PT;
              } });
              var ro_1 = __webpack_require__2(614);
              Object.defineProperty(exports$12, "ro", { enumerable: true, get: function() {
                return ro_1.ro;
              } });
              var ru_1 = __webpack_require__2(892);
              Object.defineProperty(exports$12, "ru", { enumerable: true, get: function() {
                return ru_1.ru;
              } });
              var tr_1 = __webpack_require__2(631);
              Object.defineProperty(exports$12, "tr", { enumerable: true, get: function() {
                return tr_1.tr;
              } });
              var uk_1 = __webpack_require__2(225);
              Object.defineProperty(exports$12, "uk", { enumerable: true, get: function() {
                return uk_1.uk;
              } });
              var zh_CN_1 = __webpack_require__2(571);
              Object.defineProperty(exports$12, "zh_CN", { enumerable: true, get: function() {
                return zh_CN_1.zh_CN;
              } });
              var zh_TW_1 = __webpack_require__2(983);
              Object.defineProperty(exports$12, "zh_TW", { enumerable: true, get: function() {
                return zh_TW_1.zh_TW;
              } });
              var ja_1 = __webpack_require__2(904);
              Object.defineProperty(exports$12, "ja", { enumerable: true, get: function() {
                return ja_1.ja;
              } });
              var he_1 = __webpack_require__2(82);
              Object.defineProperty(exports$12, "he", { enumerable: true, get: function() {
                return he_1.he;
              } });
              var cs_1 = __webpack_require__2(651);
              Object.defineProperty(exports$12, "cs", { enumerable: true, get: function() {
                return cs_1.cs;
              } });
              var sk_1 = __webpack_require__2(923);
              Object.defineProperty(exports$12, "sk", { enumerable: true, get: function() {
                return sk_1.sk;
              } });
              var fi_1 = __webpack_require__2(964);
              Object.defineProperty(exports$12, "fi", { enumerable: true, get: function() {
                return fi_1.fi;
              } });
              var sl_1 = __webpack_require__2(474);
              Object.defineProperty(exports$12, "sl", { enumerable: true, get: function() {
                return sl_1.sl;
              } });
              var sw_1 = __webpack_require__2(799);
              Object.defineProperty(exports$12, "sw", { enumerable: true, get: function() {
                return sw_1.sw;
              } });
              var fa_1 = __webpack_require__2(804);
              Object.defineProperty(exports$12, "fa", { enumerable: true, get: function() {
                return fa_1.fa;
              } });
              var ca_1 = __webpack_require__2(845);
              Object.defineProperty(exports$12, "ca", { enumerable: true, get: function() {
                return ca_1.ca;
              } });
              var be_1 = __webpack_require__2(348);
              Object.defineProperty(exports$12, "be", { enumerable: true, get: function() {
                return be_1.be;
              } });
              var hu_1 = __webpack_require__2(194);
              Object.defineProperty(exports$12, "hu", { enumerable: true, get: function() {
                return hu_1.hu;
              } });
              var af_1 = __webpack_require__2(810);
              Object.defineProperty(exports$12, "af", { enumerable: true, get: function() {
                return af_1.af;
              } });
              var th_1 = __webpack_require__2(33);
              Object.defineProperty(exports$12, "th", { enumerable: true, get: function() {
                return th_1.th;
              } });
              var ar_1 = __webpack_require__2(574);
              Object.defineProperty(exports$12, "ar", { enumerable: true, get: function() {
                return ar_1.ar;
              } });
              var vi_1 = __webpack_require__2(292);
              Object.defineProperty(exports$12, "vi", { enumerable: true, get: function() {
                return vi_1.vi;
              } });
              var my_1 = __webpack_require__2(919);
              Object.defineProperty(exports$12, "my", { enumerable: true, get: function() {
                return my_1.my;
              } });
              var bg_1 = __webpack_require__2(622);
              Object.defineProperty(exports$12, "bg", { enumerable: true, get: function() {
                return bg_1.bg;
              } });
              var hr_1 = __webpack_require__2(131);
              Object.defineProperty(exports$12, "hr", { enumerable: true, get: function() {
                return hr_1.hr;
              } });
              var sr_1 = __webpack_require__2(716);
              Object.defineProperty(exports$12, "sr", { enumerable: true, get: function() {
                return sr_1.sr;
              } });
            },
            /***/
            420(__unused_webpack_module, exports$12, __webpack_require__2) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.allLocalesLoader = void 0;
              var allLocales = __webpack_require__2(99);
              var allLocalesLoader = (function() {
                function allLocalesLoader2() {
                }
                allLocalesLoader2.prototype.load = function(availableLocales) {
                  for (var property in allLocales) {
                    if (allLocales.hasOwnProperty(property)) {
                      availableLocales[property] = new allLocales[property]();
                    }
                  }
                };
                return allLocalesLoader2;
              })();
              exports$12.allLocalesLoader = allLocalesLoader;
            },
            /***/
            810(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.af = void 0;
              var af = (function() {
                function af2() {
                }
                af2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                af2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                af2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                af2.prototype.commaYearX0ThroughYearX1 = function() {
                  return ", jaar %s na %s";
                };
                af2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                af2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Daar was 'n fout om die tydsuitdrukking the genereer. Raadpleeg asb die uitdrukking formaat.";
                };
                af2.prototype.everyMinute = function() {
                  return "elke minuut";
                };
                af2.prototype.everyHour = function() {
                  return "elke uur";
                };
                af2.prototype.atSpace = function() {
                  return "Teen ";
                };
                af2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Elke minuut tussen %s en %s";
                };
                af2.prototype.at = function() {
                  return "Teen";
                };
                af2.prototype.spaceAnd = function() {
                  return " en";
                };
                af2.prototype.everySecond = function() {
                  return "elke sekonde";
                };
                af2.prototype.everyX0Seconds = function() {
                  return "elke %s sekonde";
                };
                af2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekonde %s deur na %s na die minuut";
                };
                af2.prototype.atX0SecondsPastTheMinute = function() {
                  return "teen %s sekondes na die minuut";
                };
                af2.prototype.everyX0Minutes = function() {
                  return "elke %s minute";
                };
                af2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minute %s deur na %s na die uur";
                };
                af2.prototype.atX0MinutesPastTheHour = function() {
                  return "teen %s minute na die uur";
                };
                af2.prototype.everyX0Hours = function() {
                  return "elke %s ure";
                };
                af2.prototype.betweenX0AndX1 = function() {
                  return "tussen %s en %s";
                };
                af2.prototype.atX0 = function() {
                  return "teen %s";
                };
                af2.prototype.commaEveryDay = function() {
                  return ", elke dag";
                };
                af2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", elke %s dae van die week";
                };
                af2.prototype.commaX0ThroughX1 = function() {
                  return ", %s deur na %s";
                };
                af2.prototype.commaAndX0ThroughX1 = function() {
                  return ", en %s deur na %s";
                };
                af2.prototype.first = function() {
                  return "eerste";
                };
                af2.prototype.second = function() {
                  return "tweede";
                };
                af2.prototype.third = function() {
                  return "derde";
                };
                af2.prototype.fourth = function() {
                  return "vierde";
                };
                af2.prototype.fifth = function() {
                  return "vyfde";
                };
                af2.prototype.commaOnThe = function() {
                  return ", op die ";
                };
                af2.prototype.spaceX0OfTheMonth = function() {
                  return " %s van die maand";
                };
                af2.prototype.lastDay = function() {
                  return "die laaste dag";
                };
                af2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", op die laaste %s van die maand";
                };
                af2.prototype.commaOnlyOnX0 = function() {
                  return ", net op %s";
                };
                af2.prototype.commaAndOnX0 = function() {
                  return ", en op %s";
                };
                af2.prototype.commaEveryX0Months = function() {
                  return ", elke %s maande";
                };
                af2.prototype.commaOnlyInX0 = function() {
                  return ", net in %s";
                };
                af2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", op die laaste dag van die maand";
                };
                af2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", op die laaste weeksdag van die maand";
                };
                af2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dae voor die laaste dag van die maand";
                };
                af2.prototype.firstWeekday = function() {
                  return "eerste weeksdag";
                };
                af2.prototype.weekdayNearestDayX0 = function() {
                  return "weeksdag naaste aan dag %s";
                };
                af2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", op die %s van die maande";
                };
                af2.prototype.commaEveryX0Days = function() {
                  return ", elke %s dae";
                };
                af2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", tussen dag %s en %s van die maand";
                };
                af2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", op dag %s van die maand";
                };
                af2.prototype.commaEveryHour = function() {
                  return ", elke uur";
                };
                af2.prototype.commaEveryX0Years = function() {
                  return ", elke %s jare";
                };
                af2.prototype.commaStartingX0 = function() {
                  return ", beginnende %s";
                };
                af2.prototype.daysOfTheWeek = function() {
                  return ["Sondag", "Maandag", "Dinsdag", "Woensdag", "Donderdag", "Vrydag", "Saterdag"];
                };
                af2.prototype.monthsOfTheYear = function() {
                  return [
                    "Januarie",
                    "Februarie",
                    "Maart",
                    "April",
                    "Mei",
                    "Junie",
                    "Julie",
                    "Augustus",
                    "September",
                    "Oktober",
                    "November",
                    "Desember"
                  ];
                };
                af2.prototype.onTheHour = function() {
                  return "op die uur";
                };
                return af2;
              })();
              exports$12.af = af;
            },
            /***/
            574(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.ar = void 0;
              var ar2 = (function() {
                function ar3() {
                }
                ar3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                ar3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                ar3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                ar3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                ar3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                ar3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "حدث خطأ في إنشاء وصف المصطلح٠ تأكد من تركيب مصطلح الكرون";
                };
                ar3.prototype.everyMinute = function() {
                  return "كل دقيقة";
                };
                ar3.prototype.everyHour = function() {
                  return "كل ساعة";
                };
                ar3.prototype.atSpace = function() {
                  return " ";
                };
                ar3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "كل دقيقة بين %s و %s";
                };
                ar3.prototype.at = function() {
                  return "";
                };
                ar3.prototype.spaceAnd = function() {
                  return " و";
                };
                ar3.prototype.everySecond = function() {
                  return "كل ثانية";
                };
                ar3.prototype.everyX0Seconds = function() {
                  return "كل %s ثواني";
                };
                ar3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "الثواني %s حتى %s من بداية الدقيقة";
                };
                ar3.prototype.atX0SecondsPastTheMinute = function() {
                  return "الثانية %s من بداية الدقيقة";
                };
                ar3.prototype.everyX0Minutes = function() {
                  return "كل %s دقائق";
                };
                ar3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "الدقائق %s حتى %s من بداية الساعة";
                };
                ar3.prototype.atX0MinutesPastTheHour = function() {
                  return "الدقيقة %s من بداية الساعة";
                };
                ar3.prototype.everyX0Hours = function() {
                  return "كل %s ساعات";
                };
                ar3.prototype.betweenX0AndX1 = function() {
                  return "بين %s و %s";
                };
                ar3.prototype.atX0 = function() {
                  return "%s";
                };
                ar3.prototype.commaEveryDay = function() {
                  return "، كل يوم";
                };
                ar3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return "، كل %s من أيام الأسبوع";
                };
                ar3.prototype.commaX0ThroughX1 = function() {
                  return "، %s حتى %s";
                };
                ar3.prototype.commaAndX0ThroughX1 = function() {
                  return "، و %s حتى %s";
                };
                ar3.prototype.first = function() {
                  return "أول";
                };
                ar3.prototype.second = function() {
                  return "ثاني";
                };
                ar3.prototype.third = function() {
                  return "ثالث";
                };
                ar3.prototype.fourth = function() {
                  return "رابع";
                };
                ar3.prototype.fifth = function() {
                  return "خامس";
                };
                ar3.prototype.commaOnThe = function() {
                  return "، في ال";
                };
                ar3.prototype.spaceX0OfTheMonth = function() {
                  return " %s من الشهر";
                };
                ar3.prototype.lastDay = function() {
                  return "اليوم الأخير";
                };
                ar3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return "، في اخر %s من الشهر";
                };
                ar3.prototype.commaOnlyOnX0 = function() {
                  return "، %s فقط";
                };
                ar3.prototype.commaAndOnX0 = function() {
                  return "، وفي %s";
                };
                ar3.prototype.commaEveryX0Months = function() {
                  return "، كل %s أشهر";
                };
                ar3.prototype.commaOnlyInX0 = function() {
                  return "، %s فقط";
                };
                ar3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return "، في اخر يوم من الشهر";
                };
                ar3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return "، في اخر يوم أسبوع من الشهر";
                };
                ar3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return "، %s أيام قبل اخر يوم من الشهر";
                };
                ar3.prototype.firstWeekday = function() {
                  return "اول ايام الأسبوع";
                };
                ar3.prototype.weekdayNearestDayX0 = function() {
                  return "يوم الأسبوع الأقرب ليوم %s";
                };
                ar3.prototype.commaOnTheX0OfTheMonth = function() {
                  return "، في %s من الشهر";
                };
                ar3.prototype.commaEveryX0Days = function() {
                  return "، كل %s أيام";
                };
                ar3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return "، بين يوم %s و %s من الشهر";
                };
                ar3.prototype.commaOnDayX0OfTheMonth = function() {
                  return "، في اليوم %s من الشهر";
                };
                ar3.prototype.commaEveryHour = function() {
                  return "، كل ساعة";
                };
                ar3.prototype.commaEveryX0Years = function() {
                  return "، كل %s سنوات";
                };
                ar3.prototype.commaStartingX0 = function() {
                  return "، بداية من %s";
                };
                ar3.prototype.daysOfTheWeek = function() {
                  return ["الأحد", "الإثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت"];
                };
                ar3.prototype.monthsOfTheYear = function() {
                  return [
                    "يناير",
                    "فبراير",
                    "مارس",
                    "ابريل",
                    "مايو",
                    "يونيو",
                    "يوليو",
                    "أغسطس",
                    "سبتمبر",
                    "أكتوبر",
                    "نوفمبر",
                    "ديسمبر"
                  ];
                };
                ar3.prototype.onTheHour = function() {
                  return "في تمام الساعة";
                };
                return ar3;
              })();
              exports$12.ar = ar2;
            },
            /***/
            348(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.be = void 0;
              var be2 = (function() {
                function be3() {
                }
                be3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                be3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                be3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                be3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                be3.prototype.use24HourTimeFormatByDefault = function() {
                  return false;
                };
                be3.prototype.everyMinute = function() {
                  return "кожную хвіліну";
                };
                be3.prototype.everyHour = function() {
                  return "кожную гадзіну";
                };
                be3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Адбылася памылка падчас генерацыі апісання выразы. Праверце сінтаксіс крон-выразы.";
                };
                be3.prototype.atSpace = function() {
                  return "У ";
                };
                be3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Кожную хвіліну з %s да %s";
                };
                be3.prototype.at = function() {
                  return "У";
                };
                be3.prototype.spaceAnd = function() {
                  return " і";
                };
                be3.prototype.everySecond = function() {
                  return "кожную секунду";
                };
                be3.prototype.everyX0Seconds = function() {
                  return "кожныя %s секунд";
                };
                be3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "секунды з %s па %s";
                };
                be3.prototype.atX0SecondsPastTheMinute = function() {
                  return "у %s секунд";
                };
                be3.prototype.everyX0Minutes = function() {
                  return "кожныя %s хвілін";
                };
                be3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "хвіліны з %s па %s";
                };
                be3.prototype.atX0MinutesPastTheHour = function() {
                  return "у %s хвілін";
                };
                be3.prototype.everyX0Hours = function() {
                  return "кожныя %s гадзін";
                };
                be3.prototype.betweenX0AndX1 = function() {
                  return "з %s па %s";
                };
                be3.prototype.atX0 = function() {
                  return "у %s";
                };
                be3.prototype.commaEveryDay = function() {
                  return ", кожны дзень";
                };
                be3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", кожныя %s дзён тыдня";
                };
                be3.prototype.commaX0ThroughX1 = function() {
                  return ", %s па %s";
                };
                be3.prototype.commaAndX0ThroughX1 = function() {
                  return ", і %s па %s";
                };
                be3.prototype.first = function() {
                  return "першы";
                };
                be3.prototype.second = function() {
                  return "другі";
                };
                be3.prototype.third = function() {
                  return "трэці";
                };
                be3.prototype.fourth = function() {
                  return "чацвёрты";
                };
                be3.prototype.fifth = function() {
                  return "пяты";
                };
                be3.prototype.commaOnThe = function() {
                  return ", у ";
                };
                be3.prototype.spaceX0OfTheMonth = function() {
                  return " %s месяца";
                };
                be3.prototype.lastDay = function() {
                  return "апошні дзень";
                };
                be3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", у апошні %s месяца";
                };
                be3.prototype.commaOnlyOnX0 = function() {
                  return ", толькі ў %s";
                };
                be3.prototype.commaAndOnX0 = function() {
                  return ", і ў %s";
                };
                be3.prototype.commaEveryX0Months = function() {
                  return ", кожныя %s месяцаў";
                };
                be3.prototype.commaOnlyInX0 = function() {
                  return ", толькі ў %s";
                };
                be3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", у апошні дзень месяца";
                };
                be3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", у апошні будні дзень месяца";
                };
                be3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s дзён да апошняга дня месяца";
                };
                be3.prototype.firstWeekday = function() {
                  return "першы будны дзень";
                };
                be3.prototype.weekdayNearestDayX0 = function() {
                  return "найбліжэйшы будны дзень да %s";
                };
                be3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", у %s месяцы";
                };
                be3.prototype.commaEveryX0Days = function() {
                  return ", кожныя %s дзён";
                };
                be3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", з %s па %s лік месяца";
                };
                be3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", у %s лік месяца";
                };
                be3.prototype.commaEveryX0Years = function() {
                  return ", кожныя %s гадоў";
                };
                be3.prototype.commaStartingX0 = function() {
                  return ", пачатак %s";
                };
                be3.prototype.daysOfTheWeek = function() {
                  return ["нядзеля", "панядзелак", "аўторак", "серада", "чацвер", "пятніца", "субота"];
                };
                be3.prototype.monthsOfTheYear = function() {
                  return [
                    "студзень",
                    "люты",
                    "сакавік",
                    "красавік",
                    "травень",
                    "чэрвень",
                    "ліпень",
                    "жнівень",
                    "верасень",
                    "кастрычнік",
                    "лістапад",
                    "снежань"
                  ];
                };
                be3.prototype.onTheHour = function() {
                  return "роўна ў гадзіну";
                };
                return be3;
              })();
              exports$12.be = be2;
            },
            /***/
            622(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.bg = void 0;
              var getPhraseByPlural = function(str, words) {
                var strAsNumber = str != null ? Number(str) : 0;
                return strAsNumber < 2 ? words[0] : words[1];
              };
              var getPhraseByDayOfWeek = function(str, words) {
                var strAsNumber = str != null ? Number(str) : 0;
                return words[[1, 0, 0, 1, 0, 0, 1][strAsNumber]];
              };
              var getNumberEnding = function(str, gender) {
                var strAsNumber = str != null ? Number(str) : 1;
                strAsNumber = Math.max(Math.min(strAsNumber < 10 || strAsNumber > 20 && strAsNumber % 10 !== 0 ? strAsNumber % 10 : 3, 3), 1) - 1;
                var genderIndex = ["м", "ж", "ср"].indexOf(gender);
                return ["в", "р", "т"][strAsNumber] + ["и", "а", "о"][genderIndex];
              };
              var bg = (function() {
                function bg2() {
                }
                bg2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                bg2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                bg2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                bg2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                bg2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                bg2.prototype.everyMinute = function() {
                  return "всяка минута";
                };
                bg2.prototype.everyHour = function() {
                  return "всеки час";
                };
                bg2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Възникна грешка при генериране на описанието на израза. Проверете синтаксиса на cron израза.";
                };
                bg2.prototype.atSpace = function() {
                  return "В ";
                };
                bg2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Всяка минута от %s до %s";
                };
                bg2.prototype.at = function() {
                  return "В";
                };
                bg2.prototype.spaceAnd = function() {
                  return " и";
                };
                bg2.prototype.everySecond = function() {
                  return "всяка секунда";
                };
                bg2.prototype.everyX0Seconds = function(s2) {
                  return "всеки %s секунди";
                };
                bg2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "секунди от %s до %s";
                };
                bg2.prototype.atX0SecondsPastTheMinute = function(s2) {
                  return "%s-".concat(getNumberEnding(s2, "ж"), " секунда");
                };
                bg2.prototype.everyX0Minutes = function(s2) {
                  return "всеки %s минути";
                };
                bg2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "минути от %s до %s";
                };
                bg2.prototype.atX0MinutesPastTheHour = function(s2) {
                  return "%s-".concat(getNumberEnding(s2, "ж"), " минутa");
                };
                bg2.prototype.everyX0Hours = function(s2) {
                  return "всеки %s часа";
                };
                bg2.prototype.betweenX0AndX1 = function() {
                  return "от %s до %s";
                };
                bg2.prototype.atX0 = function() {
                  return "в %s";
                };
                bg2.prototype.commaEveryDay = function() {
                  return ", всеки ден";
                };
                bg2.prototype.commaEveryX0DaysOfTheWeek = function(s2) {
                  return getPhraseByPlural(s2, [", всеки %s ден от седмицата", ", всеки %s дена от седмицата"]);
                };
                bg2.prototype.commaX0ThroughX1 = function(s2) {
                  return ", от %s до %s";
                };
                bg2.prototype.commaAndX0ThroughX1 = function(s2) {
                  return " и от %s до %s";
                };
                bg2.prototype.first = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["первият", "первата"]);
                };
                bg2.prototype.second = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["вторият", "втората"]);
                };
                bg2.prototype.third = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["третият", "третата"]);
                };
                bg2.prototype.fourth = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["четвертият", "четвертата"]);
                };
                bg2.prototype.fifth = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["петият", "петата"]);
                };
                bg2.prototype.commaOnThe = function(s2) {
                  return ", ";
                };
                bg2.prototype.spaceX0OfTheMonth = function() {
                  return " %s на месеца";
                };
                bg2.prototype.lastDay = function() {
                  return "последният ден";
                };
                bg2.prototype.commaOnTheLastX0OfTheMonth = function(s2) {
                  return getPhraseByDayOfWeek(s2, [", в последният %s от месеца", ", в последната %s отмесеца"]);
                };
                bg2.prototype.commaOnlyOnX0 = function(s2) {
                  return ", %s";
                };
                bg2.prototype.commaAndOnX0 = function() {
                  return " и %s";
                };
                bg2.prototype.commaEveryX0Months = function(s2) {
                  return " всеки %s месеца";
                };
                bg2.prototype.commaOnlyInMonthX0 = function() {
                  return ", %s";
                };
                bg2.prototype.commaOnlyInX0 = function() {
                  return ", в %s";
                };
                bg2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", в последният ден на месеца";
                };
                bg2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", в последния делничен ден от месеца";
                };
                bg2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function(s2) {
                  return getPhraseByPlural(s2, [", %s ден преди края на месеца", ", %s дена преди края на месеца"]);
                };
                bg2.prototype.firstWeekday = function() {
                  return "първият делничен ден";
                };
                bg2.prototype.weekdayNearestDayX0 = function() {
                  return "най-близкият делничен ден до %s число";
                };
                bg2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", на %s число от месеца";
                };
                bg2.prototype.commaEveryX0Days = function(s2) {
                  return getPhraseByPlural(s2, [", всеки %s ден", ", всеки %s дена"]);
                };
                bg2.prototype.commaBetweenDayX0AndX1OfTheMonth = function(s2) {
                  var _a2;
                  var values = (_a2 = s2 === null || s2 === void 0 ? void 0 : s2.split("-")) !== null && _a2 !== void 0 ? _a2 : [];
                  return ", от %s-".concat(getNumberEnding(values[0], "ср"), " до %s-").concat(getNumberEnding(values[1], "ср"), " число на месеца");
                };
                bg2.prototype.commaOnDayX0OfTheMonth = function(s2) {
                  return ", на %s-".concat(getNumberEnding(s2, "ср"), " число от месеца");
                };
                bg2.prototype.commaEveryX0Years = function(s2) {
                  return getPhraseByPlural(s2, [", всяка %s година", ", всеки %s години"]);
                };
                bg2.prototype.commaStartingX0 = function() {
                  return ", започвайки %s";
                };
                bg2.prototype.daysOfTheWeek = function() {
                  return ["неделя", "понеделник", "вторник", "сряда", "четвъртък", "петък", "събота"];
                };
                bg2.prototype.monthsOfTheYear = function() {
                  return ["януари", "февруари", "март", "април", "май", "юни", "юли", "август", "септевмври", "октомври", "ноември", "декември"];
                };
                bg2.prototype.onTheHour = function() {
                  return "в началото на часа";
                };
                return bg2;
              })();
              exports$12.bg = bg;
            },
            /***/
            845(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.ca = void 0;
              var ca2 = (function() {
                function ca3() {
                }
                ca3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                ca3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                ca3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                ca3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                ca3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                ca3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "S'ha produït un error mentres es generava la descripció de l'expressió. Revisi la sintaxi de la expressió de cron.";
                };
                ca3.prototype.at = function() {
                  return "A les";
                };
                ca3.prototype.atSpace = function() {
                  return "A les ";
                };
                ca3.prototype.atX0 = function() {
                  return "a les %s";
                };
                ca3.prototype.atX0MinutesPastTheHour = function() {
                  return "als %s minuts de l'hora";
                };
                ca3.prototype.atX0SecondsPastTheMinute = function() {
                  return "als %s segonds del minut";
                };
                ca3.prototype.betweenX0AndX1 = function() {
                  return "entre les %s i les %s";
                };
                ca3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", entre els dies %s i %s del mes";
                };
                ca3.prototype.commaEveryDay = function() {
                  return ", cada dia";
                };
                ca3.prototype.commaEveryX0Days = function() {
                  return ", cada %s dies";
                };
                ca3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", cada %s dies de la setmana";
                };
                ca3.prototype.commaEveryX0Months = function() {
                  return ", cada %s mesos";
                };
                ca3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", el dia %s del mes";
                };
                ca3.prototype.commaOnlyInX0 = function() {
                  return ", sólo en %s";
                };
                ca3.prototype.commaOnlyOnX0 = function() {
                  return ", només el %s";
                };
                ca3.prototype.commaAndOnX0 = function() {
                  return ", i el %s";
                };
                ca3.prototype.commaOnThe = function() {
                  return ", en el ";
                };
                ca3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", en l'últim dia del mes";
                };
                ca3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", en l'últim dia de la setmana del mes";
                };
                ca3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dies abans de l'últim dia del mes";
                };
                ca3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", en l'últim %s del mes";
                };
                ca3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", en el %s del mes";
                };
                ca3.prototype.commaX0ThroughX1 = function() {
                  return ", de %s a %s";
                };
                ca3.prototype.commaAndX0ThroughX1 = function() {
                  return ", i de %s a %s";
                };
                ca3.prototype.everyHour = function() {
                  return "cada hora";
                };
                ca3.prototype.everyMinute = function() {
                  return "cada minut";
                };
                ca3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "cada minut entre les %s i les %s";
                };
                ca3.prototype.everySecond = function() {
                  return "cada segon";
                };
                ca3.prototype.everyX0Hours = function() {
                  return "cada %s hores";
                };
                ca3.prototype.everyX0Minutes = function() {
                  return "cada %s minuts";
                };
                ca3.prototype.everyX0Seconds = function() {
                  return "cada %s segons";
                };
                ca3.prototype.fifth = function() {
                  return "cinquè";
                };
                ca3.prototype.first = function() {
                  return "primer";
                };
                ca3.prototype.firstWeekday = function() {
                  return "primer dia de la setmana";
                };
                ca3.prototype.fourth = function() {
                  return "quart";
                };
                ca3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "del minut %s al %s passada l'hora";
                };
                ca3.prototype.second = function() {
                  return "segon";
                };
                ca3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "En els segons %s al %s de cada minut";
                };
                ca3.prototype.spaceAnd = function() {
                  return " i";
                };
                ca3.prototype.spaceX0OfTheMonth = function() {
                  return " %s del mes";
                };
                ca3.prototype.lastDay = function() {
                  return "l'últim dia";
                };
                ca3.prototype.third = function() {
                  return "tercer";
                };
                ca3.prototype.weekdayNearestDayX0 = function() {
                  return "dia de la setmana més proper al %s";
                };
                ca3.prototype.commaEveryX0Years = function() {
                  return ", cada %s anys";
                };
                ca3.prototype.commaStartingX0 = function() {
                  return ", començant %s";
                };
                ca3.prototype.daysOfTheWeek = function() {
                  return ["diumenge", "dilluns", "dimarts", "dimecres", "dijous", "divendres", "dissabte"];
                };
                ca3.prototype.monthsOfTheYear = function() {
                  return [
                    "gener",
                    "febrer",
                    "març",
                    "abril",
                    "maig",
                    "juny",
                    "juliol",
                    "agost",
                    "setembre",
                    "octubre",
                    "novembre",
                    "desembre"
                  ];
                };
                ca3.prototype.onTheHour = function() {
                  return "en punt";
                };
                return ca3;
              })();
              exports$12.ca = ca2;
            },
            /***/
            651(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.cs = void 0;
              var cs = (function() {
                function cs2() {
                }
                cs2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                cs2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                cs2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                cs2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                cs2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                cs2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Při vytváření popisu došlo k chybě. Zkontrolujte prosím správnost syntaxe cronu.";
                };
                cs2.prototype.everyMinute = function() {
                  return "každou minutu";
                };
                cs2.prototype.everyHour = function() {
                  return "každou hodinu";
                };
                cs2.prototype.atSpace = function() {
                  return "V ";
                };
                cs2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Každou minutu mezi %s a %s";
                };
                cs2.prototype.at = function() {
                  return "V";
                };
                cs2.prototype.spaceAnd = function() {
                  return " a";
                };
                cs2.prototype.everySecond = function() {
                  return "každou sekundu";
                };
                cs2.prototype.everyX0Seconds = function() {
                  return "každých %s sekund";
                };
                cs2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekundy od %s do %s";
                };
                cs2.prototype.atX0SecondsPastTheMinute = function() {
                  return "v %s sekund";
                };
                cs2.prototype.everyX0Minutes = function() {
                  return "každých %s minut";
                };
                cs2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minuty od %s do %s";
                };
                cs2.prototype.atX0MinutesPastTheHour = function() {
                  return "v %s minut";
                };
                cs2.prototype.everyX0Hours = function() {
                  return "každých %s hodin";
                };
                cs2.prototype.betweenX0AndX1 = function() {
                  return "mezi %s a %s";
                };
                cs2.prototype.atX0 = function() {
                  return "v %s";
                };
                cs2.prototype.commaEveryDay = function() {
                  return ", každý den";
                };
                cs2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", každých %s dní v týdnu";
                };
                cs2.prototype.commaX0ThroughX1 = function() {
                  return ", od %s do %s";
                };
                cs2.prototype.commaAndX0ThroughX1 = function() {
                  return ", a od %s do %s";
                };
                cs2.prototype.first = function() {
                  return "první";
                };
                cs2.prototype.second = function() {
                  return "druhý";
                };
                cs2.prototype.third = function() {
                  return "třetí";
                };
                cs2.prototype.fourth = function() {
                  return "čtvrtý";
                };
                cs2.prototype.fifth = function() {
                  return "pátý";
                };
                cs2.prototype.commaOnThe = function() {
                  return ", ";
                };
                cs2.prototype.spaceX0OfTheMonth = function() {
                  return " %s v měsíci";
                };
                cs2.prototype.lastDay = function() {
                  return "poslední den";
                };
                cs2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", poslední %s v měsíci";
                };
                cs2.prototype.commaOnlyOnX0 = function() {
                  return ", pouze v %s";
                };
                cs2.prototype.commaAndOnX0 = function() {
                  return ", a v %s";
                };
                cs2.prototype.commaEveryX0Months = function() {
                  return ", každých %s měsíců";
                };
                cs2.prototype.commaOnlyInX0 = function() {
                  return ", pouze v %s";
                };
                cs2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", poslední den v měsíci";
                };
                cs2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", poslední pracovní den v měsíci";
                };
                cs2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dní před posledním dnem v měsíci";
                };
                cs2.prototype.firstWeekday = function() {
                  return "první pracovní den";
                };
                cs2.prototype.weekdayNearestDayX0 = function() {
                  return "pracovní den nejblíže %s. dni";
                };
                cs2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", v %s v měsíci";
                };
                cs2.prototype.commaEveryX0Days = function() {
                  return ", každých %s dnů";
                };
                cs2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", mezi dny %s a %s v měsíci";
                };
                cs2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", %s. den v měsíci";
                };
                cs2.prototype.commaEveryX0Years = function() {
                  return ", každých %s roků";
                };
                cs2.prototype.commaStartingX0 = function() {
                  return ", začínající %s";
                };
                cs2.prototype.daysOfTheWeek = function() {
                  return ["Neděle", "Pondělí", "Úterý", "Středa", "Čtvrtek", "Pátek", "Sobota"];
                };
                cs2.prototype.monthsOfTheYear = function() {
                  return [
                    "Leden",
                    "Únor",
                    "Březen",
                    "Duben",
                    "Květen",
                    "Červen",
                    "Červenec",
                    "Srpen",
                    "Září",
                    "Říjen",
                    "Listopad",
                    "Prosinec"
                  ];
                };
                cs2.prototype.onTheHour = function() {
                  return "v celou hodinu";
                };
                return cs2;
              })();
              exports$12.cs = cs;
            },
            /***/
            506(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.da = void 0;
              var da2 = (function() {
                function da3() {
                }
                da3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                da3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Der opstod en fejl ved generering af udtryksbeskrivelsen. Tjek cron-ekspressionssyntaxen.";
                };
                da3.prototype.at = function() {
                  return "kl";
                };
                da3.prototype.atSpace = function() {
                  return "kl ";
                };
                da3.prototype.atX0 = function() {
                  return "kl %s";
                };
                da3.prototype.atX0MinutesPastTheHour = function() {
                  return "%s minutter efter timeskift";
                };
                da3.prototype.atX0SecondsPastTheMinute = function() {
                  return "%s sekunder efter minutskift";
                };
                da3.prototype.betweenX0AndX1 = function() {
                  return "mellem %s og %s";
                };
                da3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", mellem dag %s og %s i måneden";
                };
                da3.prototype.commaEveryDay = function() {
                  return ", hver dag";
                };
                da3.prototype.commaEveryX0Days = function() {
                  return ", hver %s. dag";
                };
                da3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", hver %s. ugedag";
                };
                da3.prototype.commaEveryX0Months = function() {
                  return ", hver %s. måned";
                };
                da3.prototype.commaEveryX0Years = function() {
                  return ", hvert %s. år";
                };
                da3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", på dag %s i måneden";
                };
                da3.prototype.commaOnlyInX0 = function() {
                  return ", kun i %s";
                };
                da3.prototype.commaOnlyOnX0 = function(s2) {
                  return ", på enhver %s";
                };
                da3.prototype.commaAndOnX0 = function() {
                  return ", og på %s";
                };
                da3.prototype.commaOnThe = function() {
                  return ", på den ";
                };
                da3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", på den sidste dag i måneden";
                };
                da3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", på den sidste hverdag i måneden";
                };
                da3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dage før den sidste dag i måneden";
                };
                da3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", på den sidste %s i måneden";
                };
                da3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", på den %s i måneden";
                };
                da3.prototype.commaX0ThroughX1 = function() {
                  return ", %s til og med %s";
                };
                da3.prototype.commaAndX0ThroughX1 = function() {
                  return ", og %s til og med %s";
                };
                da3.prototype.everyHour = function() {
                  return "hver time";
                };
                da3.prototype.everyMinute = function() {
                  return "hvert minut";
                };
                da3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "hvert minut mellem %s og %s";
                };
                da3.prototype.everySecond = function() {
                  return "hvert sekund";
                };
                da3.prototype.everyX0Hours = function() {
                  return "hver %s. time";
                };
                da3.prototype.everyX0Minutes = function() {
                  return "hvert %s. minut";
                };
                da3.prototype.everyX0Seconds = function() {
                  return "hvert %s. sekund";
                };
                da3.prototype.fifth = function() {
                  return "femte";
                };
                da3.prototype.first = function() {
                  return "første";
                };
                da3.prototype.firstWeekday = function() {
                  return "første hverdag";
                };
                da3.prototype.fourth = function() {
                  return "fjerde";
                };
                da3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minutterne fra %s til og med %s hver time";
                };
                da3.prototype.second = function() {
                  return "anden";
                };
                da3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekunderne fra %s til og med %s hvert minut";
                };
                da3.prototype.spaceAnd = function() {
                  return " og";
                };
                da3.prototype.spaceX0OfTheMonth = function() {
                  return " %s i måneden";
                };
                da3.prototype.lastDay = function() {
                  return "sidste dag";
                };
                da3.prototype.third = function() {
                  return "tredje";
                };
                da3.prototype.weekdayNearestDayX0 = function() {
                  return "hverdag nærmest dag %s";
                };
                da3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                da3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                da3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                da3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                da3.prototype.commaStartingX0 = function() {
                  return ", startende %s";
                };
                da3.prototype.daysOfTheWeek = function() {
                  return ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"];
                };
                da3.prototype.monthsOfTheYear = function() {
                  return [
                    "januar",
                    "februar",
                    "marts",
                    "april",
                    "maj",
                    "juni",
                    "juli",
                    "august",
                    "september",
                    "oktober",
                    "november",
                    "december"
                  ];
                };
                da3.prototype.onTheHour = function() {
                  return "på timen";
                };
                return da3;
              })();
              exports$12.da = da2;
            },
            /***/
            230(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.de = void 0;
              var de2 = (function() {
                function de3() {
                }
                de3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                de3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                de3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                de3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                de3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                de3.prototype.everyMinute = function() {
                  return "jede Minute";
                };
                de3.prototype.everyHour = function() {
                  return "jede Stunde";
                };
                de3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Beim Generieren der Ausdrucksbeschreibung ist ein Fehler aufgetreten. Überprüfen Sie die Syntax des Cron-Ausdrucks.";
                };
                de3.prototype.atSpace = function() {
                  return "Um ";
                };
                de3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Jede Minute zwischen %s und %s";
                };
                de3.prototype.at = function() {
                  return "Um";
                };
                de3.prototype.spaceAnd = function() {
                  return " und";
                };
                de3.prototype.everySecond = function() {
                  return "Jede Sekunde";
                };
                de3.prototype.everyX0Seconds = function() {
                  return "alle %s Sekunden";
                };
                de3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "Sekunden %s bis %s";
                };
                de3.prototype.atX0SecondsPastTheMinute = function() {
                  return "bei Sekunde %s";
                };
                de3.prototype.everyX0Minutes = function() {
                  return "alle %s Minuten";
                };
                de3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "Minuten %s bis %s";
                };
                de3.prototype.atX0MinutesPastTheHour = function() {
                  return "bei Minute %s";
                };
                de3.prototype.everyX0Hours = function() {
                  return "alle %s Stunden";
                };
                de3.prototype.betweenX0AndX1 = function() {
                  return "zwischen %s und %s";
                };
                de3.prototype.atX0 = function() {
                  return "um %s";
                };
                de3.prototype.commaEveryDay = function() {
                  return ", jeden Tag";
                };
                de3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", alle %s Tage der Woche";
                };
                de3.prototype.commaX0ThroughX1 = function() {
                  return ", %s bis %s";
                };
                de3.prototype.commaAndX0ThroughX1 = function() {
                  return ", und %s bis %s";
                };
                de3.prototype.first = function() {
                  return "ersten";
                };
                de3.prototype.second = function() {
                  return "zweiten";
                };
                de3.prototype.third = function() {
                  return "dritten";
                };
                de3.prototype.fourth = function() {
                  return "vierten";
                };
                de3.prototype.fifth = function() {
                  return "fünften";
                };
                de3.prototype.commaOnThe = function() {
                  return ", am ";
                };
                de3.prototype.spaceX0OfTheMonth = function() {
                  return " %s des Monats";
                };
                de3.prototype.lastDay = function() {
                  return "der letzte Tag";
                };
                de3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", am letzten %s des Monats";
                };
                de3.prototype.commaOnlyOnX0 = function() {
                  return ", nur jeden %s";
                };
                de3.prototype.commaAndOnX0 = function() {
                  return ", und jeden %s";
                };
                de3.prototype.commaEveryX0Months = function() {
                  return ", alle %s Monate";
                };
                de3.prototype.commaOnlyInX0 = function() {
                  return ", nur im %s";
                };
                de3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", am letzten Tag des Monats";
                };
                de3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", am letzten Werktag des Monats";
                };
                de3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s tage vor dem letzten Tag des Monats";
                };
                de3.prototype.firstWeekday = function() {
                  return "ersten Werktag";
                };
                de3.prototype.weekdayNearestDayX0 = function() {
                  return "Werktag am nächsten zum %s Tag";
                };
                de3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", am %s des Monats";
                };
                de3.prototype.commaEveryX0Days = function() {
                  return ", alle %s Tage";
                };
                de3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", zwischen Tag %s und %s des Monats";
                };
                de3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", an Tag %s des Monats";
                };
                de3.prototype.commaEveryX0Years = function() {
                  return ", alle %s Jahre";
                };
                de3.prototype.commaStartingX0 = function() {
                  return ", beginnend %s";
                };
                de3.prototype.daysOfTheWeek = function() {
                  return ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"];
                };
                de3.prototype.monthsOfTheYear = function() {
                  return [
                    "Januar",
                    "Februar",
                    "März",
                    "April",
                    "Mai",
                    "Juni",
                    "Juli",
                    "August",
                    "September",
                    "Oktober",
                    "November",
                    "Dezember"
                  ];
                };
                de3.prototype.onTheHour = function() {
                  return "zur vollen Stunde";
                };
                return de3;
              })();
              exports$12.de = de2;
            },
            /***/
            486(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.en = void 0;
              var en2 = (function() {
                function en3() {
                }
                en3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                en3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                en3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                en3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                en3.prototype.use24HourTimeFormatByDefault = function() {
                  return false;
                };
                en3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "An error occurred when generating the expression description. Check the cron expression syntax.";
                };
                en3.prototype.everyMinute = function() {
                  return "every minute";
                };
                en3.prototype.everyHour = function() {
                  return "every hour";
                };
                en3.prototype.atSpace = function() {
                  return "At ";
                };
                en3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Every minute between %s and %s";
                };
                en3.prototype.at = function() {
                  return "At";
                };
                en3.prototype.spaceAnd = function() {
                  return " and";
                };
                en3.prototype.everySecond = function() {
                  return "every second";
                };
                en3.prototype.everyX0Seconds = function() {
                  return "every %s seconds";
                };
                en3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "seconds %s through %s past the minute";
                };
                en3.prototype.atX0SecondsPastTheMinute = function() {
                  return "at %s seconds past the minute";
                };
                en3.prototype.everyX0Minutes = function() {
                  return "every %s minutes";
                };
                en3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minutes %s through %s past the hour";
                };
                en3.prototype.atX0MinutesPastTheHour = function() {
                  return "at %s minutes past the hour";
                };
                en3.prototype.everyX0Hours = function() {
                  return "every %s hours";
                };
                en3.prototype.betweenX0AndX1 = function() {
                  return "between %s and %s";
                };
                en3.prototype.atX0 = function() {
                  return "at %s";
                };
                en3.prototype.commaEveryDay = function() {
                  return ", every day";
                };
                en3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", every %s days of the week";
                };
                en3.prototype.commaX0ThroughX1 = function() {
                  return ", %s through %s";
                };
                en3.prototype.commaAndX0ThroughX1 = function() {
                  return ", %s through %s";
                };
                en3.prototype.first = function() {
                  return "first";
                };
                en3.prototype.second = function() {
                  return "second";
                };
                en3.prototype.third = function() {
                  return "third";
                };
                en3.prototype.fourth = function() {
                  return "fourth";
                };
                en3.prototype.fifth = function() {
                  return "fifth";
                };
                en3.prototype.commaOnThe = function() {
                  return ", on the ";
                };
                en3.prototype.spaceX0OfTheMonth = function() {
                  return " %s of the month";
                };
                en3.prototype.lastDay = function() {
                  return "the last day";
                };
                en3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", on the last %s of the month";
                };
                en3.prototype.commaOnlyOnX0 = function() {
                  return ", only on %s";
                };
                en3.prototype.commaAndOnX0 = function() {
                  return ", and on %s";
                };
                en3.prototype.commaEveryX0Months = function() {
                  return ", every %s months";
                };
                en3.prototype.commaOnlyInX0 = function() {
                  return ", only in %s";
                };
                en3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", on the last day of the month";
                };
                en3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", on the last weekday of the month";
                };
                en3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s days before the last day of the month";
                };
                en3.prototype.firstWeekday = function() {
                  return "first weekday";
                };
                en3.prototype.weekdayNearestDayX0 = function() {
                  return "weekday nearest day %s";
                };
                en3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", on the %s of the month";
                };
                en3.prototype.commaEveryX0Days = function() {
                  return ", every %s days in a month";
                };
                en3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", between day %s and %s of the month";
                };
                en3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", on day %s of the month";
                };
                en3.prototype.commaEveryHour = function() {
                  return ", every hour";
                };
                en3.prototype.commaEveryX0Years = function() {
                  return ", every %s years";
                };
                en3.prototype.commaStartingX0 = function() {
                  return ", starting %s";
                };
                en3.prototype.daysOfTheWeek = function() {
                  return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
                };
                en3.prototype.monthsOfTheYear = function() {
                  return [
                    "January",
                    "February",
                    "March",
                    "April",
                    "May",
                    "June",
                    "July",
                    "August",
                    "September",
                    "October",
                    "November",
                    "December"
                  ];
                };
                en3.prototype.atReboot = function() {
                  return "Run once, at startup";
                };
                en3.prototype.onTheHour = function() {
                  return "on the hour";
                };
                return en3;
              })();
              exports$12.en = en2;
            },
            /***/
            153(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.es = void 0;
              var es = (function() {
                function es2() {
                }
                es2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                es2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                es2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                es2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                es2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                es2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Ocurrió un error mientras se generaba la descripción de la expresión. Revise la sintaxis de la expresión de cron.";
                };
                es2.prototype.at = function() {
                  return "A las";
                };
                es2.prototype.atSpace = function() {
                  return "A las ";
                };
                es2.prototype.atX0 = function() {
                  return "a las %s";
                };
                es2.prototype.atX0MinutesPastTheHour = function() {
                  return "a los %s minutos de la hora";
                };
                es2.prototype.atX0SecondsPastTheMinute = function() {
                  return "a los %s segundos del minuto";
                };
                es2.prototype.betweenX0AndX1 = function() {
                  return "entre las %s y las %s";
                };
                es2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", entre los días %s y %s del mes";
                };
                es2.prototype.commaEveryDay = function() {
                  return ", cada día";
                };
                es2.prototype.commaEveryX0Days = function() {
                  return ", cada %s días";
                };
                es2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", cada %s días de la semana";
                };
                es2.prototype.commaEveryX0Months = function() {
                  return ", cada %s meses";
                };
                es2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", el día %s del mes";
                };
                es2.prototype.commaOnlyInX0 = function() {
                  return ", sólo en %s";
                };
                es2.prototype.commaOnlyOnX0 = function() {
                  return ", sólo el %s";
                };
                es2.prototype.commaAndOnX0 = function() {
                  return ", y el %s";
                };
                es2.prototype.commaOnThe = function() {
                  return ", en el ";
                };
                es2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", en el último día del mes";
                };
                es2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", en el último día de la semana del mes";
                };
                es2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s días antes del último día del mes";
                };
                es2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", en el último %s del mes";
                };
                es2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", en el %s del mes";
                };
                es2.prototype.commaX0ThroughX1 = function() {
                  return ", de %s a %s";
                };
                es2.prototype.commaAndX0ThroughX1 = function() {
                  return ", y de %s a %s";
                };
                es2.prototype.everyHour = function() {
                  return "cada hora";
                };
                es2.prototype.everyMinute = function() {
                  return "cada minuto";
                };
                es2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "cada minuto entre las %s y las %s";
                };
                es2.prototype.everySecond = function() {
                  return "cada segundo";
                };
                es2.prototype.everyX0Hours = function() {
                  return "cada %s horas";
                };
                es2.prototype.everyX0Minutes = function() {
                  return "cada %s minutos";
                };
                es2.prototype.everyX0Seconds = function() {
                  return "cada %s segundos";
                };
                es2.prototype.fifth = function() {
                  return "quinto";
                };
                es2.prototype.first = function() {
                  return "primero";
                };
                es2.prototype.firstWeekday = function() {
                  return "primer día de la semana";
                };
                es2.prototype.fourth = function() {
                  return "cuarto";
                };
                es2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "del minuto %s al %s pasada la hora";
                };
                es2.prototype.second = function() {
                  return "segundo";
                };
                es2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "En los segundos %s al %s de cada minuto";
                };
                es2.prototype.spaceAnd = function() {
                  return " y";
                };
                es2.prototype.spaceX0OfTheMonth = function() {
                  return " %s del mes";
                };
                es2.prototype.lastDay = function() {
                  return "el último día";
                };
                es2.prototype.third = function() {
                  return "tercer";
                };
                es2.prototype.weekdayNearestDayX0 = function() {
                  return "día de la semana más próximo al %s";
                };
                es2.prototype.commaEveryX0Years = function() {
                  return ", cada %s años";
                };
                es2.prototype.commaStartingX0 = function() {
                  return ", comenzando %s";
                };
                es2.prototype.daysOfTheWeek = function() {
                  return ["domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"];
                };
                es2.prototype.monthsOfTheYear = function() {
                  return [
                    "enero",
                    "febrero",
                    "marzo",
                    "abril",
                    "mayo",
                    "junio",
                    "julio",
                    "agosto",
                    "septiembre",
                    "octubre",
                    "noviembre",
                    "diciembre"
                  ];
                };
                es2.prototype.onTheHour = function() {
                  return "en punto";
                };
                return es2;
              })();
              exports$12.es = es;
            },
            /***/
            804(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.fa = void 0;
              var fa2 = (function() {
                function fa3() {
                }
                fa3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                fa3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                fa3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                fa3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                fa3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                fa3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "خطایی در نمایش توضیحات این وظیفه رخ داد. لطفا ساختار آن را بررسی کنید.";
                };
                fa3.prototype.everyMinute = function() {
                  return "هر دقیقه";
                };
                fa3.prototype.everyHour = function() {
                  return "هر ساعت";
                };
                fa3.prototype.atSpace = function() {
                  return "در ";
                };
                fa3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "هر دقیقه بین %s و %s";
                };
                fa3.prototype.at = function() {
                  return "در";
                };
                fa3.prototype.spaceAnd = function() {
                  return " و";
                };
                fa3.prototype.everySecond = function() {
                  return "هر ثانیه";
                };
                fa3.prototype.everyX0Seconds = function() {
                  return "هر %s ثانیه";
                };
                fa3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "ثانیه %s تا %s دقیقه گذشته";
                };
                fa3.prototype.atX0SecondsPastTheMinute = function() {
                  return "در %s قانیه از دقیقه گذشته";
                };
                fa3.prototype.everyX0Minutes = function() {
                  return "هر %s دقیقه";
                };
                fa3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "دقیقه %s تا %s ساعت گذشته";
                };
                fa3.prototype.atX0MinutesPastTheHour = function() {
                  return "در %s دقیقه پس از ساعت";
                };
                fa3.prototype.everyX0Hours = function() {
                  return "هر %s ساعت";
                };
                fa3.prototype.betweenX0AndX1 = function() {
                  return "بین %s و %s";
                };
                fa3.prototype.atX0 = function() {
                  return "در %s";
                };
                fa3.prototype.commaEveryDay = function() {
                  return ", هر روز";
                };
                fa3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", هر %s روز از هفته";
                };
                fa3.prototype.commaX0ThroughX1 = function() {
                  return ", %s تا %s";
                };
                fa3.prototype.commaAndX0ThroughX1 = function() {
                  return ", و %s تا %s";
                };
                fa3.prototype.first = function() {
                  return "اول";
                };
                fa3.prototype.second = function() {
                  return "دوم";
                };
                fa3.prototype.third = function() {
                  return "سوم";
                };
                fa3.prototype.fourth = function() {
                  return "چهارم";
                };
                fa3.prototype.fifth = function() {
                  return "پنجم";
                };
                fa3.prototype.commaOnThe = function() {
                  return ", در ";
                };
                fa3.prototype.spaceX0OfTheMonth = function() {
                  return " %s ماه";
                };
                fa3.prototype.lastDay = function() {
                  return "آخرین روز";
                };
                fa3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", در %s ماه";
                };
                fa3.prototype.commaOnlyOnX0 = function() {
                  return ", فقط در %s";
                };
                fa3.prototype.commaAndOnX0 = function() {
                  return ", و در %s";
                };
                fa3.prototype.commaEveryX0Months = function() {
                  return ", هر %s ماه";
                };
                fa3.prototype.commaOnlyInX0 = function() {
                  return ", فقط در %s";
                };
                fa3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", در آخرین روز ماه";
                };
                fa3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", در آخرین روز ماه";
                };
                fa3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s روز قبل از آخرین روز ماه";
                };
                fa3.prototype.firstWeekday = function() {
                  return "اولین روز";
                };
                fa3.prototype.weekdayNearestDayX0 = function() {
                  return "روز نزدیک به روز %s";
                };
                fa3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", در %s ماه";
                };
                fa3.prototype.commaEveryX0Days = function() {
                  return ", هر %s روز";
                };
                fa3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", بین روز %s و %s ماه";
                };
                fa3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", در %s ماه";
                };
                fa3.prototype.commaEveryMinute = function() {
                  return ", هر minute";
                };
                fa3.prototype.commaEveryHour = function() {
                  return ", هر ساعت";
                };
                fa3.prototype.commaEveryX0Years = function() {
                  return ", هر %s سال";
                };
                fa3.prototype.commaStartingX0 = function() {
                  return ", آغاز %s";
                };
                fa3.prototype.daysOfTheWeek = function() {
                  return ["یک‌شنبه", "دوشنبه", "سه‌شنبه", "چهارشنبه", "پنج‌شنبه", "جمعه", "شنبه"];
                };
                fa3.prototype.monthsOfTheYear = function() {
                  return ["ژانویه", "فوریه", "مارس", "آپریل", "مه", "ژوئن", "ژوئیه", "آگوست", "سپتامبر", "اکتبر", "نوامبر", "دسامبر"];
                };
                fa3.prototype.onTheHour = function() {
                  return "سر ساعت";
                };
                return fa3;
              })();
              exports$12.fa = fa2;
            },
            /***/
            964(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.fi = void 0;
              var fi = (function() {
                function fi2() {
                }
                fi2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                fi2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Virhe kuvauksen generoinnissa. Tarkista cron-syntaksi.";
                };
                fi2.prototype.at = function() {
                  return "Klo";
                };
                fi2.prototype.atSpace = function() {
                  return "Klo ";
                };
                fi2.prototype.atX0 = function() {
                  return "klo %s";
                };
                fi2.prototype.atX0MinutesPastTheHour = function() {
                  return "%s minuuttia yli";
                };
                fi2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return "%s minuuttia yli";
                };
                fi2.prototype.atX0SecondsPastTheMinute = function() {
                  return "%s sekunnnin jälkeen";
                };
                fi2.prototype.betweenX0AndX1 = function() {
                  return "%s - %s välillä";
                };
                fi2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", kuukauden päivien %s ja %s välillä";
                };
                fi2.prototype.commaEveryDay = function() {
                  return ", joka päivä";
                };
                fi2.prototype.commaEveryHour = function() {
                  return ", joka tunti";
                };
                fi2.prototype.commaEveryMinute = function() {
                  return ", joka minuutti";
                };
                fi2.prototype.commaEveryX0Days = function() {
                  return ", joka %s. päivä";
                };
                fi2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", joka %s. viikonpäivä";
                };
                fi2.prototype.commaEveryX0Months = function() {
                  return ", joka %s. kuukausi";
                };
                fi2.prototype.commaEveryX0Years = function() {
                  return ", joka %s. vuosi";
                };
                fi2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", kuukauden %s päivä";
                };
                fi2.prototype.commaOnlyInX0 = function() {
                  return ", vain %s";
                };
                fi2.prototype.commaOnlyOnX0 = function() {
                  return ", vain %s";
                };
                fi2.prototype.commaOnThe = function() {
                  return ",";
                };
                fi2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", kuukauden viimeisenä päivänä";
                };
                fi2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", kuukauden viimeisenä viikonpäivänä";
                };
                fi2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", kuukauden viimeinen %s";
                };
                fi2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", kuukauden %s";
                };
                fi2.prototype.commaX0ThroughX1 = function() {
                  return ", %s - %s";
                };
                fi2.prototype.commaAndX0ThroughX1 = function() {
                  return ", %s - %s";
                };
                fi2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s päivää ennen kuukauden viimeistä päivää";
                };
                fi2.prototype.commaStartingX0 = function() {
                  return ", alkaen %s";
                };
                fi2.prototype.everyHour = function() {
                  return "joka tunti";
                };
                fi2.prototype.everyMinute = function() {
                  return "joka minuutti";
                };
                fi2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "joka minuutti %s - %s välillä";
                };
                fi2.prototype.everySecond = function() {
                  return "joka sekunti";
                };
                fi2.prototype.everyX0Hours = function() {
                  return "joka %s. tunti";
                };
                fi2.prototype.everyX0Minutes = function() {
                  return "joka %s. minuutti";
                };
                fi2.prototype.everyX0Seconds = function() {
                  return "joka %s. sekunti";
                };
                fi2.prototype.fifth = function() {
                  return "viides";
                };
                fi2.prototype.first = function() {
                  return "ensimmäinen";
                };
                fi2.prototype.firstWeekday = function() {
                  return "ensimmäinen viikonpäivä";
                };
                fi2.prototype.fourth = function() {
                  return "neljäs";
                };
                fi2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "joka tunti minuuttien %s - %s välillä";
                };
                fi2.prototype.second = function() {
                  return "toinen";
                };
                fi2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "joka minuutti sekunttien %s - %s välillä";
                };
                fi2.prototype.spaceAnd = function() {
                  return " ja";
                };
                fi2.prototype.spaceAndSpace = function() {
                  return " ja ";
                };
                fi2.prototype.spaceX0OfTheMonth = function() {
                  return " %s kuukaudessa";
                };
                fi2.prototype.third = function() {
                  return "kolmas";
                };
                fi2.prototype.weekdayNearestDayX0 = function() {
                  return "viikonpäivä lähintä %s päivää";
                };
                fi2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                fi2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                fi2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                fi2.prototype.lastDay = function() {
                  return "viimeinen päivä";
                };
                fi2.prototype.commaAndOnX0 = function() {
                  return ", ja edelleen %s";
                };
                fi2.prototype.daysOfTheWeek = function() {
                  return ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"];
                };
                fi2.prototype.monthsOfTheYear = function() {
                  return [
                    "tammikuu",
                    "helmikuu",
                    "maaliskuu",
                    "huhtikuu",
                    "toukokuu",
                    "kesäkuu",
                    "heinäkuu",
                    "elokuu",
                    "syyskuu",
                    "lokakuu",
                    "marraskuu",
                    "joulukuu"
                  ];
                };
                fi2.prototype.onTheHour = function() {
                  return "tasalta";
                };
                return fi2;
              })();
              exports$12.fi = fi;
            },
            /***/
            517(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.fr = void 0;
              var fr = (function() {
                function fr2() {
                }
                fr2.prototype.conciseVerbosityReplacements = function() {
                  return {
                    "de le": "du"
                  };
                };
                fr2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                fr2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                fr2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                fr2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                fr2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                fr2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Une erreur est survenue en générant la description de l'expression cron. Vérifiez sa syntaxe.";
                };
                fr2.prototype.everyMinute = function() {
                  return "toutes les minutes";
                };
                fr2.prototype.everyHour = function() {
                  return "toutes les heures";
                };
                fr2.prototype.atSpace = function() {
                  return "À ";
                };
                fr2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Toutes les minutes entre %s et %s";
                };
                fr2.prototype.at = function() {
                  return "À";
                };
                fr2.prototype.spaceAnd = function() {
                  return " et";
                };
                fr2.prototype.everySecond = function() {
                  return "toutes les secondes";
                };
                fr2.prototype.everyX0Seconds = function() {
                  return "toutes les %s secondes";
                };
                fr2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "les secondes entre %s et %s après la minute";
                };
                fr2.prototype.atX0SecondsPastTheMinute = function() {
                  return "%s secondes après la minute";
                };
                fr2.prototype.everyX0Minutes = function() {
                  return "toutes les %s minutes";
                };
                fr2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "les minutes entre %s et %s après l'heure";
                };
                fr2.prototype.atX0MinutesPastTheHour = function() {
                  return "%s minutes après l'heure";
                };
                fr2.prototype.everyX0Hours = function() {
                  return "toutes les %s heures";
                };
                fr2.prototype.betweenX0AndX1 = function() {
                  return "de %s à %s";
                };
                fr2.prototype.atX0 = function() {
                  return "%s";
                };
                fr2.prototype.commaEveryDay = function() {
                  return ", tous les jours";
                };
                fr2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", tous les %s jours de la semaine";
                };
                fr2.prototype.commaX0ThroughX1 = function() {
                  return ", de %s à %s";
                };
                fr2.prototype.commaAndX0ThroughX1 = function() {
                  return ", et de %s à %s";
                };
                fr2.prototype.first = function() {
                  return "premier";
                };
                fr2.prototype.second = function() {
                  return "second";
                };
                fr2.prototype.third = function() {
                  return "troisième";
                };
                fr2.prototype.fourth = function() {
                  return "quatrième";
                };
                fr2.prototype.fifth = function() {
                  return "cinquième";
                };
                fr2.prototype.commaOnThe = function() {
                  return ", le ";
                };
                fr2.prototype.spaceX0OfTheMonth = function() {
                  return " %s du mois";
                };
                fr2.prototype.lastDay = function() {
                  return "le dernier jour";
                };
                fr2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", le dernier %s du mois";
                };
                fr2.prototype.commaOnlyOnX0 = function() {
                  return ", uniquement le %s";
                };
                fr2.prototype.commaAndOnX0 = function() {
                  return ", et %s";
                };
                fr2.prototype.commaEveryX0Months = function() {
                  return ", tous les %s mois";
                };
                fr2.prototype.commaOnlyInX0 = function() {
                  return ", uniquement en %s";
                };
                fr2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", le dernier jour du mois";
                };
                fr2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", le dernier jour ouvrable du mois";
                };
                fr2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s jours avant le dernier jour du mois";
                };
                fr2.prototype.firstWeekday = function() {
                  return "premier jour ouvrable";
                };
                fr2.prototype.weekdayNearestDayX0 = function() {
                  return "jour ouvrable le plus proche du %s";
                };
                fr2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", le %s du mois";
                };
                fr2.prototype.commaEveryX0Days = function() {
                  return ", tous les %s jours";
                };
                fr2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", du %s au %s du mois";
                };
                fr2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", le %s du mois";
                };
                fr2.prototype.commaEveryHour = function() {
                  return ", chaque heure";
                };
                fr2.prototype.commaEveryX0Years = function() {
                  return ", tous les %s ans";
                };
                fr2.prototype.commaDaysX0ThroughX1 = function() {
                  return ", du %s au %s";
                };
                fr2.prototype.commaStartingX0 = function() {
                  return ", à partir de %s";
                };
                fr2.prototype.daysOfTheWeek = function() {
                  return ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"];
                };
                fr2.prototype.monthsOfTheYear = function() {
                  return [
                    "janvier",
                    "février",
                    "mars",
                    "avril",
                    "mai",
                    "juin",
                    "juillet",
                    "août",
                    "septembre",
                    "octobre",
                    "novembre",
                    "décembre"
                  ];
                };
                fr2.prototype.onTheHour = function() {
                  return "à l'heure pile";
                };
                return fr2;
              })();
              exports$12.fr = fr;
            },
            /***/
            82(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.he = void 0;
              var he2 = (function() {
                function he3() {
                }
                he3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                he3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                he3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                he3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                he3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                he3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "אירעה שגיאה בעת יצירת תיאור הביטוי. בדוק את תחביר הביטוי cron.";
                };
                he3.prototype.everyMinute = function() {
                  return "כל דקה";
                };
                he3.prototype.everyHour = function() {
                  return "כל שעה";
                };
                he3.prototype.atSpace = function() {
                  return "ב ";
                };
                he3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "כל דקה %s עד %s";
                };
                he3.prototype.at = function() {
                  return "ב";
                };
                he3.prototype.spaceAnd = function() {
                  return " ו";
                };
                he3.prototype.everySecond = function() {
                  return "כל שניה";
                };
                he3.prototype.everyX0Seconds = function() {
                  return "כל %s שניות";
                };
                he3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "%s עד %s שניות של הדקה";
                };
                he3.prototype.atX0SecondsPastTheMinute = function() {
                  return "ב %s שניות של הדקה";
                };
                he3.prototype.everyX0Minutes = function() {
                  return "כל %s דקות";
                };
                he3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "%s עד %s דקות של השעה";
                };
                he3.prototype.atX0MinutesPastTheHour = function() {
                  return "ב %s דקות של השעה";
                };
                he3.prototype.everyX0Hours = function() {
                  return "כל %s שעות";
                };
                he3.prototype.betweenX0AndX1 = function() {
                  return "%s עד %s";
                };
                he3.prototype.atX0 = function() {
                  return "ב %s";
                };
                he3.prototype.commaEveryDay = function() {
                  return ", כל יום";
                };
                he3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", כל %s ימים בשבוע";
                };
                he3.prototype.commaX0ThroughX1 = function() {
                  return ", %s עד %s";
                };
                he3.prototype.commaAndX0ThroughX1 = function() {
                  return ", ו %s עד %s";
                };
                he3.prototype.first = function() {
                  return "ראשון";
                };
                he3.prototype.second = function() {
                  return "שני";
                };
                he3.prototype.third = function() {
                  return "שלישי";
                };
                he3.prototype.fourth = function() {
                  return "רביעי";
                };
                he3.prototype.fifth = function() {
                  return "חמישי";
                };
                he3.prototype.commaOnThe = function() {
                  return ", ב ";
                };
                he3.prototype.spaceX0OfTheMonth = function() {
                  return " %s של החודש";
                };
                he3.prototype.lastDay = function() {
                  return "היום האחרון";
                };
                he3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", רק ב %s של החודש";
                };
                he3.prototype.commaOnlyOnX0 = function() {
                  return ", רק ב %s";
                };
                he3.prototype.commaAndOnX0 = function() {
                  return ", וב %s";
                };
                he3.prototype.commaEveryX0Months = function() {
                  return ", כל %s חודשים";
                };
                he3.prototype.commaOnlyInX0 = function() {
                  return ", רק ב %s";
                };
                he3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", ביום האחרון של החודש";
                };
                he3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", ביום החול האחרון של החודש";
                };
                he3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s ימים לפני היום האחרון בחודש";
                };
                he3.prototype.firstWeekday = function() {
                  return "יום החול הראשון";
                };
                he3.prototype.weekdayNearestDayX0 = function() {
                  return "יום החול הראשון הקרוב אל %s";
                };
                he3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", ביום ה%s של החודש";
                };
                he3.prototype.commaEveryX0Days = function() {
                  return ", כל %s ימים";
                };
                he3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", בין היום ה%s וה%s של החודש";
                };
                he3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", ביום ה%s של החודש";
                };
                he3.prototype.commaEveryX0Years = function() {
                  return ", כל %s שנים";
                };
                he3.prototype.commaStartingX0 = function() {
                  return ", החל מ %s";
                };
                he3.prototype.daysOfTheWeek = function() {
                  return ["יום ראשון", "יום שני", "יום שלישי", "יום רביעי", "יום חמישי", "יום שישי", "יום שבת"];
                };
                he3.prototype.monthsOfTheYear = function() {
                  return ["ינואר", "פברואר", "מרץ", "אפריל", "מאי", "יוני", "יולי", "אוגוסט", "ספטמבר", "אוקטובר", "נובמבר", "דצמבר"];
                };
                he3.prototype.onTheHour = function() {
                  return "בשעה עגולה";
                };
                return he3;
              })();
              exports$12.he = he2;
            },
            /***/
            131(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.hr = void 0;
              var hr2 = (function() {
                function hr3() {
                }
                hr3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                hr3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Došlo je do pogreške pri generiranju izraza. Provjerite sintaksu cron izraza.";
                };
                hr3.prototype.at = function() {
                  return "U";
                };
                hr3.prototype.atSpace = function() {
                  return "U ";
                };
                hr3.prototype.atX0 = function() {
                  return "u %s";
                };
                hr3.prototype.atX0MinutesPastTheHour = function() {
                  return "u %s minuta nakon punog sata";
                };
                hr3.prototype.atX0SecondsPastTheMinute = function() {
                  return "u %s sekundi nakon pune minute";
                };
                hr3.prototype.betweenX0AndX1 = function() {
                  return "između %s i %s";
                };
                hr3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", između %s. i %s. dana u mjesecu";
                };
                hr3.prototype.commaEveryDay = function() {
                  return ", svaki dan";
                };
                hr3.prototype.commaEveryX0Days = function() {
                  return ", svakih %s dana";
                };
                hr3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", svakih %s dana u tjednu";
                };
                hr3.prototype.commaEveryX0Months = function() {
                  return ", svakih %s mjeseci";
                };
                hr3.prototype.commaEveryX0Years = function() {
                  return ", svakih %s godina";
                };
                hr3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", %s. dan u mjesecu";
                };
                hr3.prototype.commaOnlyInX0 = function() {
                  return ", samo u %s";
                };
                hr3.prototype.commaOnlyOnX0 = function() {
                  return ", samo %s";
                };
                hr3.prototype.commaAndOnX0 = function() {
                  return ", i %s";
                };
                hr3.prototype.commaOnThe = function() {
                  return ", ";
                };
                hr3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", zadnji dan u mjesecu";
                };
                hr3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", zadnji radni dan u mjesecu";
                };
                hr3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dana prije kraja mjeseca";
                };
                hr3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", zadnji %s u mjesecu";
                };
                hr3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", %s u mjesecu";
                };
                hr3.prototype.commaX0ThroughX1 = function() {
                  return ", od %s do %s";
                };
                hr3.prototype.commaAndX0ThroughX1 = function() {
                  return ", i od %s do %s";
                };
                hr3.prototype.everyHour = function() {
                  return "svaki sat";
                };
                hr3.prototype.everyMinute = function() {
                  return "svaku minutu";
                };
                hr3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Svaku minutu između %s i %s";
                };
                hr3.prototype.everySecond = function() {
                  return "svaku sekundu";
                };
                hr3.prototype.everyX0Hours = function() {
                  return "svakih %s sati";
                };
                hr3.prototype.everyX0Minutes = function() {
                  return "svakih %s minuta";
                };
                hr3.prototype.everyX0Seconds = function() {
                  return "svakih %s sekundi";
                };
                hr3.prototype.fifth = function() {
                  return "peti";
                };
                hr3.prototype.first = function() {
                  return "prvi";
                };
                hr3.prototype.firstWeekday = function() {
                  return "prvi radni dan";
                };
                hr3.prototype.fourth = function() {
                  return "četvrti";
                };
                hr3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minute od %s do %s nakon punog sata";
                };
                hr3.prototype.second = function() {
                  return "drugi";
                };
                hr3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekunde od %s do %s nakon pune minute";
                };
                hr3.prototype.spaceAnd = function() {
                  return " i";
                };
                hr3.prototype.spaceX0OfTheMonth = function() {
                  return " %s u mjesecu";
                };
                hr3.prototype.lastDay = function() {
                  return "zadnji dan";
                };
                hr3.prototype.third = function() {
                  return "treći";
                };
                hr3.prototype.weekdayNearestDayX0 = function() {
                  return "radni dan najbliži %s. danu";
                };
                hr3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                hr3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                hr3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                hr3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                hr3.prototype.commaStartingX0 = function() {
                  return ", počevši od %s";
                };
                hr3.prototype.daysOfTheWeek = function() {
                  return [
                    "Nedjelja",
                    "Ponedjeljak",
                    "Utorak",
                    "Srijeda",
                    "Četvrtak",
                    "Petak",
                    "Subota"
                  ];
                };
                hr3.prototype.monthsOfTheYear = function() {
                  return [
                    "siječanj",
                    "veljača",
                    "ožujak",
                    "travanj",
                    "svibanj",
                    "lipanj",
                    "srpanj",
                    "kolovoz",
                    "rujan",
                    "listopad",
                    "studeni",
                    "prosinac"
                  ];
                };
                hr3.prototype.onTheHour = function() {
                  return "u puni sat";
                };
                return hr3;
              })();
              exports$12.hr = hr2;
            },
            /***/
            194(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.hu = void 0;
              var hu = (function() {
                function hu2() {
                }
                hu2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                hu2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                hu2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                hu2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                hu2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                hu2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Hiba történt a kifejezésleírás generálásakor. Ellenőrizze a cron kifejezés szintaxisát.";
                };
                hu2.prototype.everyMinute = function() {
                  return "minden percben";
                };
                hu2.prototype.everyHour = function() {
                  return "minden órában";
                };
                hu2.prototype.atSpace = function() {
                  return "Ekkor: ";
                };
                hu2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "percenként %s és %s között";
                };
                hu2.prototype.at = function() {
                  return "Ekkor:";
                };
                hu2.prototype.spaceAnd = function() {
                  return " és";
                };
                hu2.prototype.everySecond = function() {
                  return "minden másodpercben";
                };
                hu2.prototype.everyX0Seconds = function() {
                  return "%s másodpercenként";
                };
                hu2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "%s. másodpercben %s perc után";
                };
                hu2.prototype.atX0SecondsPastTheMinute = function() {
                  return "%s. másodpercben";
                };
                hu2.prototype.everyX0Minutes = function() {
                  return "minden %s. percben";
                };
                hu2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "%s. percben %s óra után";
                };
                hu2.prototype.atX0MinutesPastTheHour = function() {
                  return "%s. percben";
                };
                hu2.prototype.everyX0Hours = function() {
                  return "minden %s órában";
                };
                hu2.prototype.betweenX0AndX1 = function() {
                  return "%s és %s között";
                };
                hu2.prototype.atX0 = function() {
                  return "ekkor %s";
                };
                hu2.prototype.commaEveryDay = function() {
                  return ", minden nap";
                };
                hu2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", a hét minden %s napján";
                };
                hu2.prototype.commaX0ThroughX1 = function() {
                  return ", %s - %s";
                };
                hu2.prototype.commaAndX0ThroughX1 = function() {
                  return ", és %s - %s";
                };
                hu2.prototype.first = function() {
                  return "első";
                };
                hu2.prototype.second = function() {
                  return "második";
                };
                hu2.prototype.third = function() {
                  return "harmadik";
                };
                hu2.prototype.fourth = function() {
                  return "negyedik";
                };
                hu2.prototype.fifth = function() {
                  return "ötödik";
                };
                hu2.prototype.commaOnThe = function() {
                  return ", ";
                };
                hu2.prototype.spaceX0OfTheMonth = function() {
                  return " %s a hónapban";
                };
                hu2.prototype.lastDay = function() {
                  return "az utolsó nap";
                };
                hu2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", a hónap utolsó %s";
                };
                hu2.prototype.commaOnlyOnX0 = function() {
                  return ", csak ekkor: %s";
                };
                hu2.prototype.commaAndOnX0 = function() {
                  return ", és %s";
                };
                hu2.prototype.commaEveryX0Months = function() {
                  return ", minden %s hónapban";
                };
                hu2.prototype.commaOnlyInX0 = function() {
                  return ", csak ekkor: %s";
                };
                hu2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", a hónap utolsó napján";
                };
                hu2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", a hónap utolsó hétköznapján";
                };
                hu2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s nappal a hónap utolsó napja előtt";
                };
                hu2.prototype.firstWeekday = function() {
                  return "első hétköznap";
                };
                hu2.prototype.weekdayNearestDayX0 = function() {
                  return "hétköznap legközelebbi nap %s";
                };
                hu2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", a hónap %s";
                };
                hu2.prototype.commaEveryX0Days = function() {
                  return ", %s naponként";
                };
                hu2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", a hónap %s és %s napja között";
                };
                hu2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", a hónap %s napján";
                };
                hu2.prototype.commaEveryHour = function() {
                  return ", minden órában";
                };
                hu2.prototype.commaEveryX0Years = function() {
                  return ", %s évente";
                };
                hu2.prototype.commaStartingX0 = function() {
                  return ", %s kezdettel";
                };
                hu2.prototype.daysOfTheWeek = function() {
                  return ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"];
                };
                hu2.prototype.monthsOfTheYear = function() {
                  return [
                    "január",
                    "február",
                    "március",
                    "április",
                    "május",
                    "június",
                    "július",
                    "augusztus",
                    "szeptember",
                    "október",
                    "november",
                    "december"
                  ];
                };
                hu2.prototype.onTheHour = function() {
                  return "órakor";
                };
                return hu2;
              })();
              exports$12.hu = hu;
            },
            /***/
            72(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.id = void 0;
              var id = (function() {
                function id2() {
                }
                id2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                id2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                id2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                id2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                id2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                id2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Terjadi kesalahan saat membuat deskripsi ekspresi. Periksa sintaks ekspresi cron.";
                };
                id2.prototype.everyMinute = function() {
                  return "setiap menit";
                };
                id2.prototype.everyHour = function() {
                  return "setiap jam";
                };
                id2.prototype.atSpace = function() {
                  return "Pada ";
                };
                id2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Setiap menit diantara %s dan %s";
                };
                id2.prototype.at = function() {
                  return "Pada";
                };
                id2.prototype.spaceAnd = function() {
                  return " dan";
                };
                id2.prototype.everySecond = function() {
                  return "setiap detik";
                };
                id2.prototype.everyX0Seconds = function() {
                  return "setiap %s detik";
                };
                id2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "detik ke %s sampai %s melewati menit";
                };
                id2.prototype.atX0SecondsPastTheMinute = function() {
                  return "pada %s detik lewat satu menit";
                };
                id2.prototype.everyX0Minutes = function() {
                  return "setiap %s menit";
                };
                id2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "menit ke %s sampai %s melewati jam";
                };
                id2.prototype.atX0MinutesPastTheHour = function() {
                  return "pada %s menit melewati jam";
                };
                id2.prototype.everyX0Hours = function() {
                  return "setiap %s jam";
                };
                id2.prototype.betweenX0AndX1 = function() {
                  return "diantara %s dan %s";
                };
                id2.prototype.atX0 = function() {
                  return "pada %s";
                };
                id2.prototype.commaEveryDay = function() {
                  return ", setiap hari";
                };
                id2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", setiap hari %s  dalam seminggu";
                };
                id2.prototype.commaX0ThroughX1 = function() {
                  return ", %s sampai %s";
                };
                id2.prototype.commaAndX0ThroughX1 = function() {
                  return ", dan %s sampai %s";
                };
                id2.prototype.first = function() {
                  return "pertama";
                };
                id2.prototype.second = function() {
                  return "kedua";
                };
                id2.prototype.third = function() {
                  return "ketiga";
                };
                id2.prototype.fourth = function() {
                  return "keempat";
                };
                id2.prototype.fifth = function() {
                  return "kelima";
                };
                id2.prototype.commaOnThe = function() {
                  return ", di ";
                };
                id2.prototype.spaceX0OfTheMonth = function() {
                  return " %s pada bulan";
                };
                id2.prototype.lastDay = function() {
                  return "hari terakhir";
                };
                id2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", pada %s terakhir bulan ini";
                };
                id2.prototype.commaOnlyOnX0 = function() {
                  return ", hanya pada %s";
                };
                id2.prototype.commaAndOnX0 = function() {
                  return ", dan pada %s";
                };
                id2.prototype.commaEveryX0Months = function() {
                  return ", setiap bulan %s ";
                };
                id2.prototype.commaOnlyInX0 = function() {
                  return ", hanya pada %s";
                };
                id2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", pada hari terakhir bulan ini";
                };
                id2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", pada hari kerja terakhir setiap bulan";
                };
                id2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s hari sebelum hari terakhir setiap bulan";
                };
                id2.prototype.firstWeekday = function() {
                  return "hari kerja pertama";
                };
                id2.prototype.weekdayNearestDayX0 = function() {
                  return "hari kerja terdekat %s";
                };
                id2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", pada %s bulan ini";
                };
                id2.prototype.commaEveryX0Days = function() {
                  return ", setiap %s hari";
                };
                id2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", antara hari %s dan %s dalam sebulan";
                };
                id2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", pada hari %s dalam sebulan";
                };
                id2.prototype.commaEveryHour = function() {
                  return ", setiap jam";
                };
                id2.prototype.commaEveryX0Years = function() {
                  return ", setiap %s tahun";
                };
                id2.prototype.commaStartingX0 = function() {
                  return ", mulai pada %s";
                };
                id2.prototype.daysOfTheWeek = function() {
                  return ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"];
                };
                id2.prototype.monthsOfTheYear = function() {
                  return [
                    "Januari",
                    "Februari",
                    "Maret",
                    "April",
                    "Mei",
                    "Juni",
                    "Juli",
                    "Agustus",
                    "September",
                    "Oktober",
                    "November",
                    "Desember"
                  ];
                };
                id2.prototype.onTheHour = function() {
                  return "tepat pada jam";
                };
                return id2;
              })();
              exports$12.id = id;
            },
            /***/
            488(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.it = void 0;
              var it2 = (function() {
                function it3() {
                }
                it3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                it3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                it3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                it3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                it3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                it3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "È verificato un errore durante la generazione la descrizione espressione. Controllare la sintassi delle espressioni cron.";
                };
                it3.prototype.at = function() {
                  return "Alle";
                };
                it3.prototype.atSpace = function() {
                  return "Alle ";
                };
                it3.prototype.atX0 = function() {
                  return "alle %s";
                };
                it3.prototype.atX0MinutesPastTheHour = function() {
                  return "al %s minuto passata l'ora";
                };
                it3.prototype.atX0SecondsPastTheMinute = function() {
                  return "al %s secondo passato il minuto";
                };
                it3.prototype.betweenX0AndX1 = function() {
                  return "tra le %s e le %s";
                };
                it3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", tra il giorno %s e %s del mese";
                };
                it3.prototype.commaEveryDay = function() {
                  return ", ogni giorno";
                };
                it3.prototype.commaEveryX0Days = function() {
                  return ", ogni %s giorni";
                };
                it3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", ogni %s giorni della settimana";
                };
                it3.prototype.commaEveryX0Months = function() {
                  return ", ogni %s mesi";
                };
                it3.prototype.commaEveryX0Years = function() {
                  return ", ogni %s anni";
                };
                it3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", il giorno %s del mese";
                };
                it3.prototype.commaOnlyInX0 = function() {
                  return ", solo in %s";
                };
                it3.prototype.commaOnlyOnX0 = function() {
                  return ", solo il %s";
                };
                it3.prototype.commaAndOnX0 = function() {
                  return ", e il %s";
                };
                it3.prototype.commaOnThe = function() {
                  return ", il ";
                };
                it3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", l'ultimo giorno del mese";
                };
                it3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", nell'ultima settimana del mese";
                };
                it3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s giorni prima dell'ultimo giorno del mese";
                };
                it3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", l'ultimo %s del mese";
                };
                it3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", il %s del mese";
                };
                it3.prototype.commaX0ThroughX1 = function() {
                  return ", %s al %s";
                };
                it3.prototype.commaAndX0ThroughX1 = function() {
                  return ", e %s al %s";
                };
                it3.prototype.everyHour = function() {
                  return "ogni ora";
                };
                it3.prototype.everyMinute = function() {
                  return "ogni minuto";
                };
                it3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Ogni minuto tra le %s e le %s";
                };
                it3.prototype.everySecond = function() {
                  return "ogni secondo";
                };
                it3.prototype.everyX0Hours = function() {
                  return "ogni %s ore";
                };
                it3.prototype.everyX0Minutes = function() {
                  return "ogni %s minuti";
                };
                it3.prototype.everyX0Seconds = function() {
                  return "ogni %s secondi";
                };
                it3.prototype.fifth = function() {
                  return "quinto";
                };
                it3.prototype.first = function() {
                  return "primo";
                };
                it3.prototype.firstWeekday = function() {
                  return "primo giorno della settimana";
                };
                it3.prototype.fourth = function() {
                  return "quarto";
                };
                it3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minuti %s al %s dopo l'ora";
                };
                it3.prototype.second = function() {
                  return "secondo";
                };
                it3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "secondi %s al %s oltre il minuto";
                };
                it3.prototype.spaceAnd = function() {
                  return " e";
                };
                it3.prototype.spaceX0OfTheMonth = function() {
                  return " %s del mese";
                };
                it3.prototype.lastDay = function() {
                  return "l'ultimo giorno";
                };
                it3.prototype.third = function() {
                  return "terzo";
                };
                it3.prototype.weekdayNearestDayX0 = function() {
                  return "giorno della settimana più vicino al %s";
                };
                it3.prototype.commaStartingX0 = function() {
                  return ", a partire %s";
                };
                it3.prototype.daysOfTheWeek = function() {
                  return ["domenica", "lunedì", "martedì", "mercoledì", "giovedì", "venerdì", "sabato"];
                };
                it3.prototype.monthsOfTheYear = function() {
                  return [
                    "gennaio",
                    "febbraio",
                    "marzo",
                    "aprile",
                    "maggio",
                    "giugno",
                    "luglio",
                    "agosto",
                    "settembre",
                    "ottobre",
                    "novembre",
                    "dicembre"
                  ];
                };
                it3.prototype.onTheHour = function() {
                  return "all'ora esatta";
                };
                return it3;
              })();
              exports$12.it = it2;
            },
            /***/
            904(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.ja = void 0;
              var ja2 = (function() {
                function ja3() {
                }
                ja3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                ja3.prototype.everyMinute = function() {
                  return "毎分";
                };
                ja3.prototype.everyHour = function() {
                  return "毎時";
                };
                ja3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "式の記述を生成する際にエラーが発生しました。Cron 式の構文を確認してください。";
                };
                ja3.prototype.atSpace = function() {
                  return "次において実施";
                };
                ja3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "%s から %s まで毎分";
                };
                ja3.prototype.at = function() {
                  return "次において実施";
                };
                ja3.prototype.spaceAnd = function() {
                  return "と";
                };
                ja3.prototype.everySecond = function() {
                  return "毎秒";
                };
                ja3.prototype.everyX0Seconds = function() {
                  return "%s 秒ごと";
                };
                ja3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "毎分 %s 秒から %s 秒まで";
                };
                ja3.prototype.atX0SecondsPastTheMinute = function() {
                  return "毎分 %s 秒過ぎ";
                };
                ja3.prototype.everyX0Minutes = function() {
                  return "%s 分ごと";
                };
                ja3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "毎時 %s 分から %s 分まで";
                };
                ja3.prototype.atX0MinutesPastTheHour = function() {
                  return "毎時 %s 分過ぎ";
                };
                ja3.prototype.everyX0Hours = function() {
                  return "%s 時間ごと";
                };
                ja3.prototype.betweenX0AndX1 = function() {
                  return "%s と %s の間";
                };
                ja3.prototype.atX0 = function() {
                  return "次において実施 %s";
                };
                ja3.prototype.commaEveryDay = function() {
                  return "、毎日";
                };
                ja3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return "、週のうち %s 日ごと";
                };
                ja3.prototype.commaX0ThroughX1 = function() {
                  return "、%s から %s まで";
                };
                ja3.prototype.commaAndX0ThroughX1 = function() {
                  return "、%s から %s まで";
                };
                ja3.prototype.first = function() {
                  return "1 番目";
                };
                ja3.prototype.second = function() {
                  return "2 番目";
                };
                ja3.prototype.third = function() {
                  return "3 番目";
                };
                ja3.prototype.fourth = function() {
                  return "4 番目";
                };
                ja3.prototype.fifth = function() {
                  return "5 番目";
                };
                ja3.prototype.commaOnThe = function() {
                  return "次に";
                };
                ja3.prototype.spaceX0OfTheMonth = function() {
                  return "月のうち %s";
                };
                ja3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return "月の最後の %s に";
                };
                ja3.prototype.commaOnlyOnX0 = function() {
                  return "%s にのみ";
                };
                ja3.prototype.commaEveryX0Months = function() {
                  return "、%s か月ごと";
                };
                ja3.prototype.commaOnlyInX0 = function() {
                  return "%s でのみ";
                };
                ja3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return "次の最終日に";
                };
                ja3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return "月の最後の平日に";
                };
                ja3.prototype.firstWeekday = function() {
                  return "最初の平日";
                };
                ja3.prototype.weekdayNearestDayX0 = function() {
                  return "%s 日の直近の平日";
                };
                ja3.prototype.commaOnTheX0OfTheMonth = function() {
                  return "月の %s に";
                };
                ja3.prototype.commaEveryX0Days = function() {
                  return "、%s 日ごと";
                };
                ja3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return "、月の %s 日から %s 日の間";
                };
                ja3.prototype.commaOnDayX0OfTheMonth = function() {
                  return "、月の %s 日目";
                };
                ja3.prototype.spaceAndSpace = function() {
                  return "と";
                };
                ja3.prototype.commaEveryMinute = function() {
                  return "、毎分";
                };
                ja3.prototype.commaEveryHour = function() {
                  return "、毎時";
                };
                ja3.prototype.commaEveryX0Years = function() {
                  return "、%s 年ごと";
                };
                ja3.prototype.commaStartingX0 = function() {
                  return "、%s に開始";
                };
                ja3.prototype.aMPeriod = function() {
                  return "AM";
                };
                ja3.prototype.pMPeriod = function() {
                  return "PM";
                };
                ja3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return "月の最終日の %s 日前";
                };
                ja3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                ja3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                ja3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                ja3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                ja3.prototype.lastDay = function() {
                  return "最終日";
                };
                ja3.prototype.commaAndOnX0 = function() {
                  return "、〜と %s";
                };
                ja3.prototype.daysOfTheWeek = function() {
                  return ["日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日"];
                };
                ja3.prototype.monthsOfTheYear = function() {
                  return ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"];
                };
                ja3.prototype.onTheHour = function() {
                  return "時ちょうど";
                };
                return ja3;
              })();
              exports$12.ja = ja2;
            },
            /***/
            839(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.ko = void 0;
              var ko = (function() {
                function ko2() {
                }
                ko2.prototype.setPeriodBeforeTime = function() {
                  return true;
                };
                ko2.prototype.pm = function() {
                  return "오후";
                };
                ko2.prototype.am = function() {
                  return "오전";
                };
                ko2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                ko2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                ko2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                ko2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                ko2.prototype.use24HourTimeFormatByDefault = function() {
                  return false;
                };
                ko2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "표현식 설명을 생성하는 중 오류가 발생했습니다. cron 표현식 구문을 확인하십시오.";
                };
                ko2.prototype.everyMinute = function() {
                  return "1분마다";
                };
                ko2.prototype.everyHour = function() {
                  return "1시간마다";
                };
                ko2.prototype.atSpace = function() {
                  return "시간 ";
                };
                ko2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "매분 %s~%s";
                };
                ko2.prototype.at = function() {
                  return "시간";
                };
                ko2.prototype.spaceAnd = function() {
                  return " 및";
                };
                ko2.prototype.everySecond = function() {
                  return "1초마다";
                };
                ko2.prototype.everyX0Seconds = function() {
                  return "%s초마다";
                };
                ko2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "%s~%s초";
                };
                ko2.prototype.atX0SecondsPastTheMinute = function() {
                  return "%s초";
                };
                ko2.prototype.everyX0Minutes = function() {
                  return "%s분마다";
                };
                ko2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "%s~%s분";
                };
                ko2.prototype.atX0MinutesPastTheHour = function() {
                  return "%s분";
                };
                ko2.prototype.everyX0Hours = function() {
                  return "%s시간마다";
                };
                ko2.prototype.betweenX0AndX1 = function() {
                  return "%s에서 %s 사이";
                };
                ko2.prototype.atX0 = function() {
                  return "%s에서";
                };
                ko2.prototype.commaEveryDay = function() {
                  return ", 매일";
                };
                ko2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", 주 중 %s일마다";
                };
                ko2.prototype.commaX0ThroughX1 = function() {
                  return ", %s에서 %s까지";
                };
                ko2.prototype.commaAndX0ThroughX1 = function() {
                  return ", 및 %s에서 %s까지";
                };
                ko2.prototype.first = function() {
                  return "첫 번째";
                };
                ko2.prototype.second = function() {
                  return "두 번째";
                };
                ko2.prototype.third = function() {
                  return "세 번째";
                };
                ko2.prototype.fourth = function() {
                  return "네 번째";
                };
                ko2.prototype.fifth = function() {
                  return "다섯 번째";
                };
                ko2.prototype.commaOnThe = function() {
                  return ", 매월 ";
                };
                ko2.prototype.spaceX0OfTheMonth = function() {
                  return " %s";
                };
                ko2.prototype.lastDay = function() {
                  return "마지막 날";
                };
                ko2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", 해당 월의 마지막 %s";
                };
                ko2.prototype.commaOnlyOnX0 = function() {
                  return ", %s에만";
                };
                ko2.prototype.commaAndOnX0 = function() {
                  return ", 및 %s에";
                };
                ko2.prototype.commaEveryX0Months = function() {
                  return ", %s개월마다";
                };
                ko2.prototype.commaOnlyInX0 = function() {
                  return ", %s에만";
                };
                ko2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", 해당 월의 마지막 날에";
                };
                ko2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", 매월 마지막 평일";
                };
                ko2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", 해당 월의 마지막 날 %s일 전";
                };
                ko2.prototype.firstWeekday = function() {
                  return "첫 번째 평일";
                };
                ko2.prototype.weekdayNearestDayX0 = function() {
                  return "%s일과 가장 가까운 평일";
                };
                ko2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", 매월 %s";
                };
                ko2.prototype.commaEveryX0Days = function() {
                  return ", %s일마다";
                };
                ko2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", 해당 월의 %s일에서 %s일까지";
                };
                ko2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", 매월 %s일";
                };
                ko2.prototype.commaEveryMinute = function() {
                  return ", 1분마다";
                };
                ko2.prototype.commaEveryHour = function() {
                  return ", 1시간마다";
                };
                ko2.prototype.commaEveryX0Years = function() {
                  return ", %s년마다";
                };
                ko2.prototype.commaStartingX0 = function() {
                  return ", %s부터";
                };
                ko2.prototype.daysOfTheWeek = function() {
                  return ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"];
                };
                ko2.prototype.monthsOfTheYear = function() {
                  return ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"];
                };
                ko2.prototype.onTheHour = function() {
                  return "정각";
                };
                return ko2;
              })();
              exports$12.ko = ko;
            },
            /***/
            919(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.my = void 0;
              var my = (function() {
                function my2() {
                }
                my2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                my2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                my2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                my2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                my2.prototype.use24HourTimeFormatByDefault = function() {
                  return false;
                };
                my2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Terdapat ralat semasa menjana penerangan ungkapan. Sila periksa sintaks ungkapan cron.";
                };
                my2.prototype.everyMinute = function() {
                  return "setiap minit";
                };
                my2.prototype.everyHour = function() {
                  return "setiap jam";
                };
                my2.prototype.atSpace = function() {
                  return "Pada ";
                };
                my2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Setiap minit antara %s dan %s";
                };
                my2.prototype.at = function() {
                  return "Pada";
                };
                my2.prototype.spaceAnd = function() {
                  return " dan";
                };
                my2.prototype.everySecond = function() {
                  return "setiap saat";
                };
                my2.prototype.everyX0Seconds = function() {
                  return "setiap %s saat";
                };
                my2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "saat ke %s hingga %s selepas minit";
                };
                my2.prototype.atX0SecondsPastTheMinute = function() {
                  return "pada %s saat selepas minit";
                };
                my2.prototype.everyX0Minutes = function() {
                  return "setiap %s minit";
                };
                my2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minit ke %s hingga %s selepas jam";
                };
                my2.prototype.atX0MinutesPastTheHour = function() {
                  return "pada %s minit selepas jam";
                };
                my2.prototype.everyX0Hours = function() {
                  return "setiap %s jam";
                };
                my2.prototype.betweenX0AndX1 = function() {
                  return "antara %s dan %s";
                };
                my2.prototype.atX0 = function() {
                  return "pada %s";
                };
                my2.prototype.commaEveryDay = function() {
                  return ", setiap hari";
                };
                my2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", setiap %s hari dalam minggu";
                };
                my2.prototype.commaX0ThroughX1 = function() {
                  return ", %s hingga %s";
                };
                my2.prototype.commaAndX0ThroughX1 = function() {
                  return ", dan %s hingga %s";
                };
                my2.prototype.first = function() {
                  return "pertama";
                };
                my2.prototype.second = function() {
                  return "kedua";
                };
                my2.prototype.third = function() {
                  return "ketiga";
                };
                my2.prototype.fourth = function() {
                  return "keempat";
                };
                my2.prototype.fifth = function() {
                  return "kelima";
                };
                my2.prototype.commaOnThe = function() {
                  return ", pada ";
                };
                my2.prototype.spaceX0OfTheMonth = function() {
                  return " %s pada bulan";
                };
                my2.prototype.lastDay = function() {
                  return "hari terakhir";
                };
                my2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", pada %s terakhir bulan";
                };
                my2.prototype.commaOnlyOnX0 = function() {
                  return ", hanya pada %s";
                };
                my2.prototype.commaAndOnX0 = function() {
                  return ", dan pada %s";
                };
                my2.prototype.commaEveryX0Months = function() {
                  return ", setiap bulan %s";
                };
                my2.prototype.commaOnlyInX0 = function() {
                  return ", hanya pada %s";
                };
                my2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", pada hari terakhir bulan";
                };
                my2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", pada minggu terakhir bulan";
                };
                my2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s hari sebelum hari terakhir bulan";
                };
                my2.prototype.firstWeekday = function() {
                  return "hari pertama minggu bekerja";
                };
                my2.prototype.weekdayNearestDayX0 = function() {
                  return "hari bekerja yang terdekat dengan %s";
                };
                my2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", pada %s bulan";
                };
                my2.prototype.commaEveryX0Days = function() {
                  return ", setiap %s hari";
                };
                my2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", antara hari %s dan %s dalam bulan";
                };
                my2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", pada hari %s dalam bulan";
                };
                my2.prototype.commaEveryHour = function() {
                  return ", setiap jam";
                };
                my2.prototype.commaEveryX0Years = function() {
                  return ", setiap %s tahun";
                };
                my2.prototype.commaStartingX0 = function() {
                  return ", bermula %s";
                };
                my2.prototype.daysOfTheWeek = function() {
                  return ["Ahad", "Isnin", "Selasa", "Rabu", "Khamis", "Jumaat", "Sabtu"];
                };
                my2.prototype.monthsOfTheYear = function() {
                  return [
                    "Januari",
                    "Februari",
                    "Mac",
                    "April",
                    "Mei",
                    "Jun",
                    "Julai",
                    "Ogos",
                    "September",
                    "Oktober",
                    "November",
                    "Disember"
                  ];
                };
                my2.prototype.onTheHour = function() {
                  return "pada waktu yang tepat";
                };
                return my2;
              })();
              exports$12.my = my;
            },
            /***/
            957(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.nb = void 0;
              var nb = (function() {
                function nb2() {
                }
                nb2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                nb2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                nb2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                nb2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                nb2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                nb2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "En feil inntraff ved generering av uttrykksbeskrivelse. Sjekk cron syntaks.";
                };
                nb2.prototype.at = function() {
                  return "Kl.";
                };
                nb2.prototype.atSpace = function() {
                  return "Kl.";
                };
                nb2.prototype.atX0 = function() {
                  return "på %s";
                };
                nb2.prototype.atX0MinutesPastTheHour = function() {
                  return "på %s minutter etter timen";
                };
                nb2.prototype.atX0SecondsPastTheMinute = function() {
                  return "på %s sekunder etter minuttet";
                };
                nb2.prototype.betweenX0AndX1 = function() {
                  return "mellom %s og %s";
                };
                nb2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", mellom dag %s og %s av måneden";
                };
                nb2.prototype.commaEveryDay = function() {
                  return ", hver dag";
                };
                nb2.prototype.commaEveryX0Days = function() {
                  return ", hver %s dag";
                };
                nb2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", hver %s ukedag";
                };
                nb2.prototype.commaEveryX0Months = function() {
                  return ", hver %s måned";
                };
                nb2.prototype.commaEveryX0Years = function() {
                  return ", hvert %s år";
                };
                nb2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", på dag %s av måneden";
                };
                nb2.prototype.commaOnlyInX0 = function() {
                  return ", bare i %s";
                };
                nb2.prototype.commaOnlyOnX0 = function() {
                  return ", på %s";
                };
                nb2.prototype.commaAndOnX0 = function() {
                  return ", og på %s";
                };
                nb2.prototype.commaOnThe = function() {
                  return ", på ";
                };
                nb2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", på den siste dagen i måneden";
                };
                nb2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", den siste ukedagen i måneden";
                };
                nb2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dager før den siste dagen i måneden";
                };
                nb2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", på den siste %s av måneden";
                };
                nb2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", på den %s av måneden";
                };
                nb2.prototype.commaX0ThroughX1 = function() {
                  return ", %s til og med %s";
                };
                nb2.prototype.commaAndX0ThroughX1 = function() {
                  return ", og %s til og med %s";
                };
                nb2.prototype.everyHour = function() {
                  return "hver time";
                };
                nb2.prototype.everyMinute = function() {
                  return "hvert minutt";
                };
                nb2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Hvert minutt mellom %s og %s";
                };
                nb2.prototype.everySecond = function() {
                  return "hvert sekund";
                };
                nb2.prototype.everyX0Hours = function() {
                  return "hver %s time";
                };
                nb2.prototype.everyX0Minutes = function() {
                  return "hvert %s minutt";
                };
                nb2.prototype.everyX0Seconds = function() {
                  return "hvert %s sekund";
                };
                nb2.prototype.fifth = function() {
                  return "femte";
                };
                nb2.prototype.first = function() {
                  return "første";
                };
                nb2.prototype.firstWeekday = function() {
                  return "første ukedag";
                };
                nb2.prototype.fourth = function() {
                  return "fjerde";
                };
                nb2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minuttene fra %s til og med %s etter timen";
                };
                nb2.prototype.second = function() {
                  return "andre";
                };
                nb2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekundene fra %s til og med %s etter minuttet";
                };
                nb2.prototype.spaceAnd = function() {
                  return " og";
                };
                nb2.prototype.spaceX0OfTheMonth = function() {
                  return " %s i måneden";
                };
                nb2.prototype.lastDay = function() {
                  return "den siste dagen";
                };
                nb2.prototype.third = function() {
                  return "tredje";
                };
                nb2.prototype.weekdayNearestDayX0 = function() {
                  return "ukedag nærmest dag %s";
                };
                nb2.prototype.commaStartingX0 = function() {
                  return ", starter %s";
                };
                nb2.prototype.daysOfTheWeek = function() {
                  return ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"];
                };
                nb2.prototype.monthsOfTheYear = function() {
                  return [
                    "januar",
                    "februar",
                    "mars",
                    "april",
                    "mai",
                    "juni",
                    "juli",
                    "august",
                    "september",
                    "oktober",
                    "november",
                    "desember"
                  ];
                };
                nb2.prototype.onTheHour = function() {
                  return "på timen";
                };
                return nb2;
              })();
              exports$12.nb = nb;
            },
            /***/
            647(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.nl = void 0;
              var nl = (function() {
                function nl2() {
                }
                nl2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                nl2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                nl2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                nl2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                nl2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                nl2.prototype.everyMinute = function() {
                  return "elke minuut";
                };
                nl2.prototype.everyHour = function() {
                  return "elk uur";
                };
                nl2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Er is een fout opgetreden bij het vertalen van de gegevens. Controleer de gegevens.";
                };
                nl2.prototype.atSpace = function() {
                  return "Om ";
                };
                nl2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Elke minuut tussen %s en %s";
                };
                nl2.prototype.at = function() {
                  return "Om";
                };
                nl2.prototype.spaceAnd = function() {
                  return " en";
                };
                nl2.prototype.everySecond = function() {
                  return "elke seconde";
                };
                nl2.prototype.everyX0Seconds = function() {
                  return "elke %s seconden";
                };
                nl2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "seconden %s t/m %s na de minuut";
                };
                nl2.prototype.atX0SecondsPastTheMinute = function() {
                  return "op %s seconden na de minuut";
                };
                nl2.prototype.everyX0Minutes = function() {
                  return "elke %s minuten";
                };
                nl2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minuut %s t/m %s na het uur";
                };
                nl2.prototype.atX0MinutesPastTheHour = function() {
                  return "op %s minuten na het uur";
                };
                nl2.prototype.everyX0Hours = function() {
                  return "elke %s uur";
                };
                nl2.prototype.betweenX0AndX1 = function() {
                  return "tussen %s en %s";
                };
                nl2.prototype.atX0 = function() {
                  return "om %s";
                };
                nl2.prototype.commaEveryDay = function() {
                  return ", elke dag";
                };
                nl2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", elke %s dagen van de week";
                };
                nl2.prototype.commaX0ThroughX1 = function() {
                  return ", %s t/m %s";
                };
                nl2.prototype.commaAndX0ThroughX1 = function() {
                  return ", en %s t/m %s";
                };
                nl2.prototype.first = function() {
                  return "eerste";
                };
                nl2.prototype.second = function() {
                  return "tweede";
                };
                nl2.prototype.third = function() {
                  return "derde";
                };
                nl2.prototype.fourth = function() {
                  return "vierde";
                };
                nl2.prototype.fifth = function() {
                  return "vijfde";
                };
                nl2.prototype.commaOnThe = function() {
                  return ", op de ";
                };
                nl2.prototype.spaceX0OfTheMonth = function() {
                  return " %s van de maand";
                };
                nl2.prototype.lastDay = function() {
                  return "de laatste dag";
                };
                nl2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", op de laatste %s van de maand";
                };
                nl2.prototype.commaOnlyOnX0 = function() {
                  return ", alleen op %s";
                };
                nl2.prototype.commaAndOnX0 = function() {
                  return ", en op %s";
                };
                nl2.prototype.commaEveryX0Months = function() {
                  return ", elke %s maanden";
                };
                nl2.prototype.commaOnlyInX0 = function() {
                  return ", alleen in %s";
                };
                nl2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", op de laatste dag van de maand";
                };
                nl2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", op de laatste werkdag van de maand";
                };
                nl2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dagen vóór de laatste dag van de maand";
                };
                nl2.prototype.firstWeekday = function() {
                  return "eerste werkdag";
                };
                nl2.prototype.weekdayNearestDayX0 = function() {
                  return "werkdag dichtst bij dag %s";
                };
                nl2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", op de %s van de maand";
                };
                nl2.prototype.commaEveryX0Days = function() {
                  return ", elke %s dagen";
                };
                nl2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", tussen dag %s en %s van de maand";
                };
                nl2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", op dag %s van de maand";
                };
                nl2.prototype.commaEveryX0Years = function() {
                  return ", elke %s jaren";
                };
                nl2.prototype.commaStartingX0 = function() {
                  return ", beginnend %s";
                };
                nl2.prototype.daysOfTheWeek = function() {
                  return ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"];
                };
                nl2.prototype.monthsOfTheYear = function() {
                  return [
                    "januari",
                    "februari",
                    "maart",
                    "april",
                    "mei",
                    "juni",
                    "juli",
                    "augustus",
                    "september",
                    "oktober",
                    "november",
                    "december"
                  ];
                };
                nl2.prototype.onTheHour = function() {
                  return "op het hele uur";
                };
                return nl2;
              })();
              exports$12.nl = nl;
            },
            /***/
            905(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.pl = void 0;
              var pl = (function() {
                function pl2() {
                }
                pl2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                pl2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                pl2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                pl2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                pl2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                pl2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Wystąpił błąd podczas generowania opisu wyrażenia cron. Sprawdź składnię wyrażenia cron.";
                };
                pl2.prototype.at = function() {
                  return "O";
                };
                pl2.prototype.atSpace = function() {
                  return "O ";
                };
                pl2.prototype.atX0 = function() {
                  return "o %s";
                };
                pl2.prototype.atX0MinutesPastTheHour = function() {
                  return "w %s minucie";
                };
                pl2.prototype.atX0SecondsPastTheMinute = function() {
                  return "w %s sekundzie";
                };
                pl2.prototype.betweenX0AndX1 = function() {
                  return "od %s do %s";
                };
                pl2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", od %s-ego do %s-ego dnia miesiąca";
                };
                pl2.prototype.commaEveryDay = function() {
                  return ", co dzień";
                };
                pl2.prototype.commaEveryX0Days = function() {
                  return ", co %s dni";
                };
                pl2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", co %s dni tygodnia";
                };
                pl2.prototype.commaEveryX0Months = function() {
                  return ", co %s miesięcy";
                };
                pl2.prototype.commaEveryX0Years = function() {
                  return ", co %s lat";
                };
                pl2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", %s-ego dnia miesiąca";
                };
                pl2.prototype.commaOnlyInX0 = function() {
                  return ", tylko %s";
                };
                pl2.prototype.commaOnlyOnX0 = function() {
                  return ", tylko %s";
                };
                pl2.prototype.commaAndOnX0 = function() {
                  return ", i %s";
                };
                pl2.prototype.commaOnThe = function() {
                  return ", ";
                };
                pl2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", ostatni dzień miesiąca";
                };
                pl2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", ostatni dzień roboczy miesiąca";
                };
                pl2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dni przed ostatnim dniem miesiąca";
                };
                pl2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", ostatni %s miesiąca";
                };
                pl2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", %s miesiąca";
                };
                pl2.prototype.commaX0ThroughX1 = function() {
                  return ", od %s do %s";
                };
                pl2.prototype.commaAndX0ThroughX1 = function() {
                  return ", i od %s do %s";
                };
                pl2.prototype.everyHour = function() {
                  return "co godzinę";
                };
                pl2.prototype.everyMinute = function() {
                  return "co minutę";
                };
                pl2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Co minutę od %s do %s";
                };
                pl2.prototype.everySecond = function() {
                  return "co sekundę";
                };
                pl2.prototype.everyX0Hours = function() {
                  return "co %s godzin";
                };
                pl2.prototype.everyX0Minutes = function() {
                  return "co %s minut";
                };
                pl2.prototype.everyX0Seconds = function() {
                  return "co %s sekund";
                };
                pl2.prototype.fifth = function() {
                  return "piąty";
                };
                pl2.prototype.first = function() {
                  return "pierwszy";
                };
                pl2.prototype.firstWeekday = function() {
                  return "pierwszy dzień roboczy";
                };
                pl2.prototype.fourth = function() {
                  return "czwarty";
                };
                pl2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minuty od %s do %s";
                };
                pl2.prototype.second = function() {
                  return "drugi";
                };
                pl2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekundy od %s do %s";
                };
                pl2.prototype.spaceAnd = function() {
                  return " i";
                };
                pl2.prototype.spaceX0OfTheMonth = function() {
                  return " %s miesiąca";
                };
                pl2.prototype.lastDay = function() {
                  return "ostatni dzień";
                };
                pl2.prototype.third = function() {
                  return "trzeci";
                };
                pl2.prototype.weekdayNearestDayX0 = function() {
                  return "dzień roboczy najbliższy %s-ego dnia";
                };
                pl2.prototype.commaStartingX0 = function() {
                  return ", startowy %s";
                };
                pl2.prototype.daysOfTheWeek = function() {
                  return ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"];
                };
                pl2.prototype.monthsOfTheYear = function() {
                  return [
                    "styczeń",
                    "luty",
                    "marzec",
                    "kwiecień",
                    "maj",
                    "czerwiec",
                    "lipiec",
                    "sierpień",
                    "wrzesień",
                    "październik",
                    "listopad",
                    "grudzień"
                  ];
                };
                pl2.prototype.onTheHour = function() {
                  return "o pełnej godzinie";
                };
                return pl2;
              })();
              exports$12.pl = pl;
            },
            /***/
            556(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.pt_BR = void 0;
              var pt_BR = (function() {
                function pt_BR2() {
                }
                pt_BR2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                pt_BR2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                pt_BR2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                pt_BR2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                pt_BR2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                pt_BR2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Ocorreu um erro ao gerar a descrição da expressão Cron.";
                };
                pt_BR2.prototype.at = function() {
                  return "às";
                };
                pt_BR2.prototype.atSpace = function() {
                  return "às ";
                };
                pt_BR2.prototype.atX0 = function() {
                  return "Às %s";
                };
                pt_BR2.prototype.atX0MinutesPastTheHour = function() {
                  return "aos %s minutos da hora";
                };
                pt_BR2.prototype.atX0SecondsPastTheMinute = function() {
                  return "aos %s segundos do minuto";
                };
                pt_BR2.prototype.betweenX0AndX1 = function() {
                  return "entre %s e %s";
                };
                pt_BR2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", entre os dias %s e %s do mês";
                };
                pt_BR2.prototype.commaEveryDay = function() {
                  return ", a cada dia";
                };
                pt_BR2.prototype.commaEveryX0Days = function() {
                  return ", a cada %s dias";
                };
                pt_BR2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", a cada %s dias de semana";
                };
                pt_BR2.prototype.commaEveryX0Months = function() {
                  return ", a cada %s meses";
                };
                pt_BR2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", no dia %s do mês";
                };
                pt_BR2.prototype.commaOnlyInX0 = function(s2) {
                  return s2 && s2.length > 1 && s2[1] === "-" ? "somente %s" : ", somente em %s";
                };
                pt_BR2.prototype.commaOnlyOnX0 = function(s2) {
                  return s2 && s2.length > 1 && s2[1] === "-" ? ", somente %s" : ", somente de %s";
                };
                pt_BR2.prototype.commaAndOnX0 = function() {
                  return ", e de %s";
                };
                pt_BR2.prototype.commaOnThe = function(s2, day) {
                  return day === "6" || day === "0" ? ", no" : ", na ";
                };
                pt_BR2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", no último dia do mês";
                };
                pt_BR2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", no último dia da semana do mês";
                };
                pt_BR2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dias antes do último dia do mês";
                };
                pt_BR2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", na última %s do mês";
                };
                pt_BR2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", no %s do mês";
                };
                pt_BR2.prototype.commaX0ThroughX1 = function() {
                  return ", de %s a %s";
                };
                pt_BR2.prototype.commaAndX0ThroughX1 = function() {
                  return ", e de %s a %s";
                };
                pt_BR2.prototype.everyHour = function() {
                  return "a cada hora";
                };
                pt_BR2.prototype.everyMinute = function() {
                  return "a cada minuto";
                };
                pt_BR2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "a cada minuto entre %s e %s";
                };
                pt_BR2.prototype.everySecond = function() {
                  return "a cada segundo";
                };
                pt_BR2.prototype.everyX0Hours = function() {
                  return "a cada %s horas";
                };
                pt_BR2.prototype.everyX0Minutes = function() {
                  return "a cada %s minutos";
                };
                pt_BR2.prototype.everyX0Seconds = function() {
                  return "a cada %s segundos";
                };
                pt_BR2.prototype.fifth = function(s2) {
                  return s2 === "6" || s2 === "0" ? "quinto" : "quinta";
                };
                pt_BR2.prototype.first = function(s2) {
                  return s2 === "6" || s2 === "0" ? "primeiro" : "primeira";
                };
                pt_BR2.prototype.firstWeekday = function() {
                  return "primeiro dia da semana";
                };
                pt_BR2.prototype.fourth = function(s2) {
                  return s2 === "6" || s2 === "0" ? "quarto" : "quarta";
                };
                pt_BR2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "do minuto %s até %s de cada hora";
                };
                pt_BR2.prototype.second = function(s2) {
                  return s2 === "6" || s2 === "0" ? "segundo" : "segunda";
                };
                pt_BR2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "No segundo %s até %s de cada minuto";
                };
                pt_BR2.prototype.spaceAnd = function() {
                  return " e";
                };
                pt_BR2.prototype.spaceX0OfTheMonth = function() {
                  return " %s do mês";
                };
                pt_BR2.prototype.lastDay = function() {
                  return "o último dia";
                };
                pt_BR2.prototype.third = function(s2) {
                  return s2 === "6" || s2 === "0" ? "terceiro" : "terceira";
                };
                pt_BR2.prototype.weekdayNearestDayX0 = function() {
                  return "dia da semana mais próximo do dia %s";
                };
                pt_BR2.prototype.commaEveryX0Years = function() {
                  return ", a cada %s anos";
                };
                pt_BR2.prototype.commaStartingX0 = function() {
                  return ", iniciando %s";
                };
                pt_BR2.prototype.daysOfTheWeek = function() {
                  return ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"];
                };
                pt_BR2.prototype.monthsOfTheYear = function() {
                  return [
                    "janeiro",
                    "fevereiro",
                    "março",
                    "abril",
                    "maio",
                    "junho",
                    "julho",
                    "agosto",
                    "setembro",
                    "outubro",
                    "novembro",
                    "dezembro"
                  ];
                };
                pt_BR2.prototype.onTheHour = function() {
                  return "na hora certa";
                };
                return pt_BR2;
              })();
              exports$12.pt_BR = pt_BR;
            },
            /***/
            163(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.pt_PT = void 0;
              var pt_PT = (function() {
                function pt_PT2() {
                }
                pt_PT2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                pt_PT2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                pt_PT2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                pt_PT2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                pt_PT2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                pt_PT2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Ocorreu um erro ao gerar a descrição da expressão Cron.";
                };
                pt_PT2.prototype.at = function() {
                  return "às";
                };
                pt_PT2.prototype.atSpace = function() {
                  return "às ";
                };
                pt_PT2.prototype.atX0 = function() {
                  return "Às %s";
                };
                pt_PT2.prototype.atX0MinutesPastTheHour = function() {
                  return "aos %s minutos da hora";
                };
                pt_PT2.prototype.atX0SecondsPastTheMinute = function() {
                  return "aos %s segundos do minuto";
                };
                pt_PT2.prototype.betweenX0AndX1 = function() {
                  return "entre %s e %s";
                };
                pt_PT2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", entre os dias %s e %s do mês";
                };
                pt_PT2.prototype.commaEveryDay = function() {
                  return ", a cada dia";
                };
                pt_PT2.prototype.commaEveryX0Days = function() {
                  return ", a cada %s dias";
                };
                pt_PT2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", a cada %s dias de semana";
                };
                pt_PT2.prototype.commaEveryX0Months = function() {
                  return ", a cada %s meses";
                };
                pt_PT2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", no dia %s do mês";
                };
                pt_PT2.prototype.commaOnlyInX0 = function() {
                  return ", somente em %s";
                };
                pt_PT2.prototype.commaOnlyOnX0 = function() {
                  return ", somente de %s";
                };
                pt_PT2.prototype.commaAndOnX0 = function() {
                  return ", e de %s";
                };
                pt_PT2.prototype.commaOnThe = function(s2, day) {
                  return day === "6" || day === "0" ? ", no" : ", na ";
                };
                pt_PT2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", no último dia do mês";
                };
                pt_PT2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", no último dia da semana do mês";
                };
                pt_PT2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dias antes do último dia do mês";
                };
                pt_PT2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", na última %s do mês";
                };
                pt_PT2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", no %s do mês";
                };
                pt_PT2.prototype.commaX0ThroughX1 = function() {
                  return ", de %s a %s";
                };
                pt_PT2.prototype.commaAndX0ThroughX1 = function() {
                  return ", e de %s a %s";
                };
                pt_PT2.prototype.everyHour = function() {
                  return "a cada hora";
                };
                pt_PT2.prototype.everyMinute = function() {
                  return "a cada minuto";
                };
                pt_PT2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "a cada minuto entre %s e %s";
                };
                pt_PT2.prototype.everySecond = function() {
                  return "a cada segundo";
                };
                pt_PT2.prototype.everyX0Hours = function() {
                  return "a cada %s horas";
                };
                pt_PT2.prototype.everyX0Minutes = function() {
                  return "a cada %s minutos";
                };
                pt_PT2.prototype.everyX0Seconds = function() {
                  return "a cada %s segundos";
                };
                pt_PT2.prototype.fifth = function(s2) {
                  return s2 === "6" || s2 === "0" ? "quinto" : "quinta";
                };
                pt_PT2.prototype.first = function(s2) {
                  return s2 === "6" || s2 === "0" ? "primeiro" : "primeira";
                };
                pt_PT2.prototype.firstWeekday = function() {
                  return "primeiro dia da semana";
                };
                pt_PT2.prototype.fourth = function(s2) {
                  return s2 === "6" || s2 === "0" ? "quarto" : "quarta";
                };
                pt_PT2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "do minuto %s até %s de cada hora";
                };
                pt_PT2.prototype.second = function(s2) {
                  return s2 === "6" || s2 === "0" ? "segundo" : "segunda";
                };
                pt_PT2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "No segundo %s até %s de cada minuto";
                };
                pt_PT2.prototype.spaceAnd = function() {
                  return " e";
                };
                pt_PT2.prototype.spaceX0OfTheMonth = function() {
                  return " %s do mês";
                };
                pt_PT2.prototype.lastDay = function() {
                  return "o último dia";
                };
                pt_PT2.prototype.third = function(s2) {
                  return s2 === "6" || s2 === "0" ? "terceiro" : "terceira";
                };
                pt_PT2.prototype.weekdayNearestDayX0 = function() {
                  return "dia da semana mais próximo do dia %s";
                };
                pt_PT2.prototype.commaEveryX0Years = function() {
                  return ", a cada %s anos";
                };
                pt_PT2.prototype.commaStartingX0 = function() {
                  return ", iniciando %s";
                };
                pt_PT2.prototype.daysOfTheWeek = function() {
                  return ["domingo", "segunda-feira", "terça-feira", "quarta-feira", "quinta-feira", "sexta-feira", "sábado"];
                };
                pt_PT2.prototype.monthsOfTheYear = function() {
                  return [
                    "janeiro",
                    "fevereiro",
                    "março",
                    "abril",
                    "maio",
                    "junho",
                    "julho",
                    "agosto",
                    "setembro",
                    "outubro",
                    "novembro",
                    "dezembro"
                  ];
                };
                pt_PT2.prototype.onTheHour = function() {
                  return "à hora certa";
                };
                return pt_PT2;
              })();
              exports$12.pt_PT = pt_PT;
            },
            /***/
            614(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.ro = void 0;
              var ro = (function() {
                function ro2() {
                }
                ro2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                ro2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Eroare la generarea descrierii. Verificați sintaxa.";
                };
                ro2.prototype.at = function() {
                  return "La";
                };
                ro2.prototype.atSpace = function() {
                  return "La ";
                };
                ro2.prototype.atX0 = function() {
                  return "la %s";
                };
                ro2.prototype.atX0MinutesPastTheHour = function() {
                  return "la și %s minute";
                };
                ro2.prototype.atX0SecondsPastTheMinute = function() {
                  return "la și %s secunde";
                };
                ro2.prototype.betweenX0AndX1 = function() {
                  return "între %s și %s";
                };
                ro2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", între zilele %s și %s ale lunii";
                };
                ro2.prototype.commaEveryDay = function() {
                  return ", în fiecare zi";
                };
                ro2.prototype.commaEveryX0Days = function() {
                  return ", la fiecare %s zile";
                };
                ro2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", la fiecare a %s-a zi a săptămânii";
                };
                ro2.prototype.commaEveryX0Months = function() {
                  return ", la fiecare %s luni";
                };
                ro2.prototype.commaEveryX0Years = function() {
                  return ", o dată la %s ani";
                };
                ro2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", în ziua %s a lunii";
                };
                ro2.prototype.commaOnlyInX0 = function() {
                  return ", doar în %s";
                };
                ro2.prototype.commaOnlyOnX0 = function() {
                  return ", doar %s";
                };
                ro2.prototype.commaAndOnX0 = function() {
                  return ", și %s";
                };
                ro2.prototype.commaOnThe = function() {
                  return ", în ";
                };
                ro2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", în ultima zi a lunii";
                };
                ro2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", în ultima zi lucrătoare a lunii";
                };
                ro2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s zile înainte de ultima zi a lunii";
                };
                ro2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", în ultima %s a lunii";
                };
                ro2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", în %s a lunii";
                };
                ro2.prototype.commaX0ThroughX1 = function() {
                  return ", de %s până %s";
                };
                ro2.prototype.commaAndX0ThroughX1 = function() {
                  return ", și de %s până %s";
                };
                ro2.prototype.everyHour = function() {
                  return "în fiecare oră";
                };
                ro2.prototype.everyMinute = function() {
                  return "în fiecare minut";
                };
                ro2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "În fiecare minut între %s și %s";
                };
                ro2.prototype.everySecond = function() {
                  return "în fiecare secundă";
                };
                ro2.prototype.everyX0Hours = function() {
                  return "la fiecare %s ore";
                };
                ro2.prototype.everyX0Minutes = function() {
                  return "la fiecare %s minute";
                };
                ro2.prototype.everyX0Seconds = function() {
                  return "la fiecare %s secunde";
                };
                ro2.prototype.fifth = function() {
                  return "a cincea";
                };
                ro2.prototype.first = function() {
                  return "prima";
                };
                ro2.prototype.firstWeekday = function() {
                  return "prima zi a săptămânii";
                };
                ro2.prototype.fourth = function() {
                  return "a patra";
                };
                ro2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "între minutele %s și %s";
                };
                ro2.prototype.second = function() {
                  return "a doua";
                };
                ro2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "între secunda %s și secunda %s";
                };
                ro2.prototype.spaceAnd = function() {
                  return " și";
                };
                ro2.prototype.spaceX0OfTheMonth = function() {
                  return " %s a lunii";
                };
                ro2.prototype.lastDay = function() {
                  return "ultima zi";
                };
                ro2.prototype.third = function() {
                  return "a treia";
                };
                ro2.prototype.weekdayNearestDayX0 = function() {
                  return "cea mai apropiată zi a săptămânii de ziua %s";
                };
                ro2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return ", din %s până în %s";
                };
                ro2.prototype.commaYearX0ThroughYearX1 = function() {
                  return ", din %s până în %s";
                };
                ro2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return "la și %s de minute";
                };
                ro2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return "la și %s de secunde";
                };
                ro2.prototype.commaStartingX0 = function() {
                  return ", pornire %s";
                };
                ro2.prototype.daysOfTheWeek = function() {
                  return ["duminică", "luni", "marți", "miercuri", "joi", "vineri", "sâmbătă"];
                };
                ro2.prototype.monthsOfTheYear = function() {
                  return [
                    "ianuarie",
                    "februarie",
                    "martie",
                    "aprilie",
                    "mai",
                    "iunie",
                    "iulie",
                    "august",
                    "septembrie",
                    "octombrie",
                    "noiembrie",
                    "decembrie"
                  ];
                };
                ro2.prototype.onTheHour = function() {
                  return "fix la oră";
                };
                return ro2;
              })();
              exports$12.ro = ro;
            },
            /***/
            892(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.ru = void 0;
              var getPhraseByNumber = function(str, words) {
                var number = Number(str);
                return number !== void 0 ? words[number % 100 > 4 && number % 100 < 20 ? 2 : [2, 0, 1, 1, 1, 2][number % 10 < 5 ? Math.abs(number) % 10 : 5]] : words[2];
              };
              var getPhraseByDayOfWeek = function(str, words) {
                var number = Number(str);
                return number !== void 0 ? words[number === 0 ? 0 : number === 1 || number === 2 || number === 4 ? 1 : 2] : words[1];
              };
              var ru = (function() {
                function ru2() {
                }
                ru2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                ru2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                ru2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                ru2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                ru2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                ru2.prototype.everyMinute = function() {
                  return "каждую минуту";
                };
                ru2.prototype.everyHour = function() {
                  return "каждый час";
                };
                ru2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Произошла ошибка во время генерации описания выражения. Проверьте синтаксис крон-выражения.";
                };
                ru2.prototype.atSpace = function() {
                  return "В ";
                };
                ru2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Каждую минуту с %s по %s";
                };
                ru2.prototype.at = function() {
                  return "В";
                };
                ru2.prototype.spaceAnd = function() {
                  return " и";
                };
                ru2.prototype.everySecond = function() {
                  return "каждую секунду";
                };
                ru2.prototype.everyX0Seconds = function(s2) {
                  return getPhraseByNumber(s2, ["каждую %s секунду", "каждые %s секунды", "каждые %s секунд"]);
                };
                ru2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "секунды с %s по %s";
                };
                ru2.prototype.atX0SecondsPastTheMinute = function(s2) {
                  return getPhraseByNumber(s2, ["в %s секунду", "в %s секунды", "в %s секунд"]);
                };
                ru2.prototype.everyX0Minutes = function(s2) {
                  return getPhraseByNumber(s2, ["каждую %s минуту", "каждые %s минуты", "каждые %s минут"]);
                };
                ru2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "минуты с %s по %s";
                };
                ru2.prototype.atX0MinutesPastTheHour = function(s2) {
                  return getPhraseByNumber(s2, ["в %s минуту", "в %s минуты", "в %s минут"]);
                };
                ru2.prototype.everyX0Hours = function(s2) {
                  return getPhraseByNumber(s2, ["каждый %s час", "каждые %s часа", "каждые %s часов"]);
                };
                ru2.prototype.betweenX0AndX1 = function() {
                  return "с %s по %s";
                };
                ru2.prototype.atX0 = function() {
                  return "в %s";
                };
                ru2.prototype.commaEveryDay = function() {
                  return ", каждый день";
                };
                ru2.prototype.commaEveryX0DaysOfTheWeek = function(s2) {
                  return getPhraseByNumber(s2, [", каждый %s день недели", ", каждые %s дня недели", ", каждые %s дней недели"]);
                };
                ru2.prototype.commaX0ThroughX1 = function(s2) {
                  return s2 && (s2[0] == "2" || s2[0] == "3") ? ", со %s по %s" : ", с %s по %s";
                };
                ru2.prototype.commaAndX0ThroughX1 = function(s2) {
                  return s2 && (s2[0] == "2" || s2[0] == "3") ? " и со %s по %s" : " и с %s по %s";
                };
                ru2.prototype.first = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["первое", "первый", "первую"]);
                };
                ru2.prototype.second = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["второе", "второй", "вторую"]);
                };
                ru2.prototype.third = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["третье", "третий", "третью"]);
                };
                ru2.prototype.fourth = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["четвертое", "четвертый", "четвертую"]);
                };
                ru2.prototype.fifth = function(s2) {
                  return getPhraseByDayOfWeek(s2, ["пятое", "пятый", "пятую"]);
                };
                ru2.prototype.commaOnThe = function(s2) {
                  return s2 === "2" ? ", во " : ", в ";
                };
                ru2.prototype.spaceX0OfTheMonth = function() {
                  return " %s месяца";
                };
                ru2.prototype.lastDay = function() {
                  return "последний день";
                };
                ru2.prototype.commaOnTheLastX0OfTheMonth = function(s2) {
                  return getPhraseByDayOfWeek(s2, [", в последнее %s месяца", ", в последний %s месяца", ", в последнюю %s месяца"]);
                };
                ru2.prototype.commaOnlyOnX0 = function(s2) {
                  return s2 && s2[0] === "2" ? ", только во %s" : ", только в %s";
                };
                ru2.prototype.commaAndOnX0 = function() {
                  return ", и %s";
                };
                ru2.prototype.commaEveryX0Months = function(s2) {
                  return getPhraseByNumber(s2, ["", " каждые %s месяца", " каждые %s месяцев"]);
                };
                ru2.prototype.commaOnlyInMonthX0 = function() {
                  return ", только %s";
                };
                ru2.prototype.commaOnlyInX0 = function() {
                  return ", только в %s";
                };
                ru2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", в последний день месяца";
                };
                ru2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", в последний будний день месяца";
                };
                ru2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function(s2) {
                  return getPhraseByNumber(s2, [
                    ", за %s день до конца месяца",
                    ", за %s дня до конца месяца",
                    ", за %s дней до конца месяца"
                  ]);
                };
                ru2.prototype.firstWeekday = function() {
                  return "первый будний день";
                };
                ru2.prototype.weekdayNearestDayX0 = function() {
                  return "ближайший будний день к %s числу";
                };
                ru2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", в %s месяца";
                };
                ru2.prototype.commaEveryX0Days = function(s2) {
                  return getPhraseByNumber(s2, [", каждый %s день", ", каждые %s дня", ", каждые %s дней"]);
                };
                ru2.prototype.commaBetweenDayX0AndX1OfTheMonth = function(s2) {
                  return s2 && s2.substring(0, s2.indexOf("-")) == "2" ? ", со %s по %s число месяца" : ", с %s по %s число месяца";
                };
                ru2.prototype.commaOnDayX0OfTheMonth = function(s2) {
                  return s2 && s2[0] == "2" ? ", во %s число месяца" : ", в %s число месяца";
                };
                ru2.prototype.commaEveryX0Years = function(s2) {
                  return getPhraseByNumber(s2, [", каждый %s год", ", каждые %s года", ", каждые %s лет"]);
                };
                ru2.prototype.commaStartingX0 = function() {
                  return ", начало %s";
                };
                ru2.prototype.daysOfTheWeek = function() {
                  return ["воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота"];
                };
                ru2.prototype.daysOfTheWeekInCase = function(f2) {
                  if (f2 === void 0) {
                    f2 = 2;
                  }
                  return f2 == 1 ? ["воскресенья", "понедельника", "вторника", "среды", "четверга", "пятницы", "субботы"] : ["воскресенье", "понедельник", "вторник", "среду", "четверг", "пятницу", "субботу"];
                };
                ru2.prototype.monthsOfTheYear = function() {
                  return [
                    "январь",
                    "февраль",
                    "март",
                    "апрель",
                    "май",
                    "июнь",
                    "июль",
                    "август",
                    "сентябрь",
                    "октябрь",
                    "ноябрь",
                    "декабрь"
                  ];
                };
                ru2.prototype.monthsOfTheYearInCase = function(f2) {
                  return f2 == 1 ? [
                    "января",
                    "февраля",
                    "марта",
                    "апреля",
                    "мая",
                    "июня",
                    "июля",
                    "августа",
                    "сентября",
                    "октября",
                    "ноября",
                    "декабря"
                  ] : this.monthsOfTheYear();
                };
                ru2.prototype.onTheHour = function() {
                  return "ровно в час";
                };
                return ru2;
              })();
              exports$12.ru = ru;
            },
            /***/
            923(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.sk = void 0;
              var sk = (function() {
                function sk2() {
                }
                sk2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                sk2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                sk2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                sk2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                sk2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                sk2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Pri vytváraní popisu došlo k chybe. Skontrolujte prosím správnosť syntaxe cronu.";
                };
                sk2.prototype.everyMinute = function() {
                  return "každú minútu";
                };
                sk2.prototype.everyHour = function() {
                  return "každú hodinu";
                };
                sk2.prototype.atSpace = function() {
                  return "V ";
                };
                sk2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Každú minútu medzi %s a %s";
                };
                sk2.prototype.at = function() {
                  return "V";
                };
                sk2.prototype.spaceAnd = function() {
                  return " a";
                };
                sk2.prototype.everySecond = function() {
                  return "každú sekundu";
                };
                sk2.prototype.everyX0Seconds = function() {
                  return "každých %s sekúnd";
                };
                sk2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekundy od %s do %s";
                };
                sk2.prototype.atX0SecondsPastTheMinute = function() {
                  return "v %s sekúnd";
                };
                sk2.prototype.everyX0Minutes = function() {
                  return "každých %s minút";
                };
                sk2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minúty od %s do %s";
                };
                sk2.prototype.atX0MinutesPastTheHour = function() {
                  return "v %s minút";
                };
                sk2.prototype.everyX0Hours = function() {
                  return "každých %s hodín";
                };
                sk2.prototype.betweenX0AndX1 = function() {
                  return "medzi %s a %s";
                };
                sk2.prototype.atX0 = function() {
                  return "v %s";
                };
                sk2.prototype.commaEveryDay = function() {
                  return ", každý deň";
                };
                sk2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", každých %s dní v týždni";
                };
                sk2.prototype.commaX0ThroughX1 = function() {
                  return ", od %s do %s";
                };
                sk2.prototype.commaAndX0ThroughX1 = function() {
                  return ", a od %s do %s";
                };
                sk2.prototype.first = function() {
                  return "prvý";
                };
                sk2.prototype.second = function() {
                  return "druhý";
                };
                sk2.prototype.third = function() {
                  return "tretí";
                };
                sk2.prototype.fourth = function() {
                  return "štvrtý";
                };
                sk2.prototype.fifth = function() {
                  return "piaty";
                };
                sk2.prototype.commaOnThe = function() {
                  return ", ";
                };
                sk2.prototype.spaceX0OfTheMonth = function() {
                  return " %s v mesiaci";
                };
                sk2.prototype.lastDay = function() {
                  return "posledný deň";
                };
                sk2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", posledný %s v mesiaci";
                };
                sk2.prototype.commaOnlyOnX0 = function() {
                  return ", iba v %s";
                };
                sk2.prototype.commaAndOnX0 = function() {
                  return ", a v %s";
                };
                sk2.prototype.commaEveryX0Months = function() {
                  return ", každých %s mesiacov";
                };
                sk2.prototype.commaOnlyInX0 = function() {
                  return ", iba v %s";
                };
                sk2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", posledný deň v mesiaci";
                };
                sk2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", posledný pracovný deň v mesiaci";
                };
                sk2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dní pred posledným dňom v mesiaci";
                };
                sk2.prototype.firstWeekday = function() {
                  return "prvý pracovný deň";
                };
                sk2.prototype.weekdayNearestDayX0 = function() {
                  return "pracovný deň najbližšie %s. dňu";
                };
                sk2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", v %s v mesiaci";
                };
                sk2.prototype.commaEveryX0Days = function() {
                  return ", každých %s dní";
                };
                sk2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", medzi dňami %s a %s v mesiaci";
                };
                sk2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", %s. deň v mesiaci";
                };
                sk2.prototype.commaEveryX0Years = function() {
                  return ", každých %s rokov";
                };
                sk2.prototype.commaStartingX0 = function() {
                  return ", začínajúcich %s";
                };
                sk2.prototype.daysOfTheWeek = function() {
                  return ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"];
                };
                sk2.prototype.monthsOfTheYear = function() {
                  return [
                    "Január",
                    "Február",
                    "Marec",
                    "Apríl",
                    "Máj",
                    "Jún",
                    "Júl",
                    "August",
                    "September",
                    "Október",
                    "November",
                    "December"
                  ];
                };
                sk2.prototype.onTheHour = function() {
                  return "o celú hodinu";
                };
                return sk2;
              })();
              exports$12.sk = sk;
            },
            /***/
            474(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.sl = void 0;
              var sl = (function() {
                function sl2() {
                }
                sl2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                sl2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Pri generiranju opisa izraza je prišlo do napake. Preverite sintakso izraza cron.";
                };
                sl2.prototype.at = function() {
                  return "Ob";
                };
                sl2.prototype.atSpace = function() {
                  return "Ob ";
                };
                sl2.prototype.atX0 = function() {
                  return "ob %s";
                };
                sl2.prototype.atX0MinutesPastTheHour = function() {
                  return "ob %s.";
                };
                sl2.prototype.atX0SecondsPastTheMinute = function() {
                  return "ob %s.";
                };
                sl2.prototype.betweenX0AndX1 = function() {
                  return "od %s do %s";
                };
                sl2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", od %s. do %s. dne v mesecu";
                };
                sl2.prototype.commaEveryDay = function() {
                  return ", vsak dan";
                };
                sl2.prototype.commaEveryX0Days = function() {
                  return ", vsakih %s dni";
                };
                sl2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", vsakih %s dni v tednu";
                };
                sl2.prototype.commaEveryX0Months = function() {
                  return ", vsakih %s mesecev";
                };
                sl2.prototype.commaEveryX0Years = function() {
                  return ", vsakih %s let";
                };
                sl2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", %s. dan v mesecu";
                };
                sl2.prototype.commaOnlyInX0 = function() {
                  return ", samo v %s";
                };
                sl2.prototype.commaOnlyOnX0 = function() {
                  return ", samo v %s";
                };
                sl2.prototype.commaAndOnX0 = function() {
                  return "in naprej %s";
                };
                sl2.prototype.commaOnThe = function() {
                  return ", ";
                };
                sl2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", zadnji %s v mesecu";
                };
                sl2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", zadnji delovni dan v mesecu";
                };
                sl2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dni pred koncem meseca";
                };
                sl2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", zadnji %s v mesecu";
                };
                sl2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", %s v mesecu";
                };
                sl2.prototype.commaX0ThroughX1 = function() {
                  return ", od %s do %s";
                };
                sl2.prototype.commaAndX0ThroughX1 = function() {
                  return ", in od %s do %s";
                };
                sl2.prototype.everyHour = function() {
                  return "vsako uro";
                };
                sl2.prototype.everyMinute = function() {
                  return "vsako minuto";
                };
                sl2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Vsako minuto od %s do %s";
                };
                sl2.prototype.everySecond = function() {
                  return "vsako sekundo";
                };
                sl2.prototype.everyX0Hours = function() {
                  return "vsakih %s ur";
                };
                sl2.prototype.everyX0Minutes = function() {
                  return "vsakih %s minut";
                };
                sl2.prototype.everyX0Seconds = function() {
                  return "vsakih %s sekund";
                };
                sl2.prototype.fifth = function() {
                  return "peti";
                };
                sl2.prototype.first = function() {
                  return "prvi";
                };
                sl2.prototype.firstWeekday = function() {
                  return "prvi delovni dan";
                };
                sl2.prototype.fourth = function() {
                  return "četrti";
                };
                sl2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minute od %s do %s";
                };
                sl2.prototype.second = function() {
                  return "drugi";
                };
                sl2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekunde od %s do %s";
                };
                sl2.prototype.spaceAnd = function() {
                  return " in";
                };
                sl2.prototype.spaceX0OfTheMonth = function() {
                  return " %s v mesecu";
                };
                sl2.prototype.lastDay = function() {
                  return "zadnjič";
                };
                sl2.prototype.third = function() {
                  return "tretji";
                };
                sl2.prototype.weekdayNearestDayX0 = function() {
                  return "delovni dan, najbližji %s. dnevu";
                };
                sl2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                sl2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                sl2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                sl2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                sl2.prototype.commaStartingX0 = function() {
                  return ", začenši %s";
                };
                sl2.prototype.daysOfTheWeek = function() {
                  return ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"];
                };
                sl2.prototype.monthsOfTheYear = function() {
                  return [
                    "januar",
                    "februar",
                    "marec",
                    "april",
                    "maj",
                    "junij",
                    "julij",
                    "avgust",
                    "september",
                    "oktober",
                    "november",
                    "december"
                  ];
                };
                sl2.prototype.onTheHour = function() {
                  return "ob točni uri";
                };
                return sl2;
              })();
              exports$12.sl = sl;
            },
            /***/
            716(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.sr = void 0;
              var sr2 = (function() {
                function sr3() {
                }
                sr3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                sr3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Došlo je do greške pri generisanju izraza. Proverite sintaksu cron izraza.";
                };
                sr3.prototype.at = function() {
                  return "U";
                };
                sr3.prototype.atSpace = function() {
                  return "U ";
                };
                sr3.prototype.atX0 = function() {
                  return "u %s";
                };
                sr3.prototype.atX0MinutesPastTheHour = function() {
                  return "u %s minuta posle punog sata";
                };
                sr3.prototype.atX0SecondsPastTheMinute = function() {
                  return "u %s sekundi posle pune minute";
                };
                sr3.prototype.betweenX0AndX1 = function() {
                  return "između %s i %s";
                };
                sr3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", između %s. i %s. dana u mesecu";
                };
                sr3.prototype.commaEveryDay = function() {
                  return ", svaki dan";
                };
                sr3.prototype.commaEveryX0Days = function() {
                  return ", svakih %s dana";
                };
                sr3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", svakih %s dana u nedelji";
                };
                sr3.prototype.commaEveryX0Months = function() {
                  return ", svakih %s meseci";
                };
                sr3.prototype.commaEveryX0Years = function() {
                  return ", svakih %s godina";
                };
                sr3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", %s. dan u mesecu";
                };
                sr3.prototype.commaOnlyInX0 = function() {
                  return ", samo u %s";
                };
                sr3.prototype.commaOnlyOnX0 = function() {
                  return ", samo %s";
                };
                sr3.prototype.commaAndOnX0 = function() {
                  return ", i %s";
                };
                sr3.prototype.commaOnThe = function() {
                  return ", ";
                };
                sr3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", poslednjeg dana u mesecu";
                };
                sr3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", poslednjeg radnog dana u mesecu";
                };
                sr3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dana pre kraja meseca";
                };
                sr3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", poslednji %s u mesecu";
                };
                sr3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", %s u mesecu";
                };
                sr3.prototype.commaX0ThroughX1 = function() {
                  return ", od %s do %s";
                };
                sr3.prototype.commaAndX0ThroughX1 = function() {
                  return ", i od %s do %s";
                };
                sr3.prototype.everyHour = function() {
                  return "svaki sat";
                };
                sr3.prototype.everyMinute = function() {
                  return "svakog minuta";
                };
                sr3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Svakog minuta između %s i %s";
                };
                sr3.prototype.everySecond = function() {
                  return "svake sekunde";
                };
                sr3.prototype.everyX0Hours = function() {
                  return "svakih %s sati";
                };
                sr3.prototype.everyX0Minutes = function() {
                  return "svakih %s minuta";
                };
                sr3.prototype.everyX0Seconds = function() {
                  return "svakih %s sekundi";
                };
                sr3.prototype.fifth = function() {
                  return "peti";
                };
                sr3.prototype.first = function() {
                  return "prvi";
                };
                sr3.prototype.firstWeekday = function() {
                  return "prvi radni dan";
                };
                sr3.prototype.fourth = function() {
                  return "četvrti";
                };
                sr3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minute od %s do %s posle punog sata";
                };
                sr3.prototype.second = function() {
                  return "drugi";
                };
                sr3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekunde od %s do %s posle pune minute";
                };
                sr3.prototype.spaceAnd = function() {
                  return " i";
                };
                sr3.prototype.spaceX0OfTheMonth = function() {
                  return " %s u mesecu";
                };
                sr3.prototype.lastDay = function() {
                  return "poslednji dan";
                };
                sr3.prototype.third = function() {
                  return "treći";
                };
                sr3.prototype.weekdayNearestDayX0 = function() {
                  return "radni dan najbliži %s. danu";
                };
                sr3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                sr3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                sr3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                sr3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                sr3.prototype.commaStartingX0 = function() {
                  return ", počevši od %s";
                };
                sr3.prototype.daysOfTheWeek = function() {
                  return [
                    "Nedelja",
                    "Ponedeljak",
                    "Utorak",
                    "Sreda",
                    "Četvrtak",
                    "Petak",
                    "Subota"
                  ];
                };
                sr3.prototype.monthsOfTheYear = function() {
                  return [
                    "januar",
                    "februar",
                    "mart",
                    "april",
                    "maj",
                    "jun",
                    "jul",
                    "avgust",
                    "septembar",
                    "oktobar",
                    "novembar",
                    "decembar"
                  ];
                };
                sr3.prototype.onTheHour = function() {
                  return "u pun sat";
                };
                return sr3;
              })();
              exports$12.sr = sr2;
            },
            /***/
            544(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.sv = void 0;
              var sv = (function() {
                function sv2() {
                }
                sv2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                sv2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                sv2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                sv2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                sv2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                sv2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Ett fel inträffade vid generering av uttryckets beskrivning. Kontrollera cron-uttryckets syntax.";
                };
                sv2.prototype.everyMinute = function() {
                  return "varje minut";
                };
                sv2.prototype.everyHour = function() {
                  return "varje timme";
                };
                sv2.prototype.atSpace = function() {
                  return "Kl ";
                };
                sv2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Varje minut mellan %s och %s";
                };
                sv2.prototype.at = function() {
                  return "Kl";
                };
                sv2.prototype.spaceAnd = function() {
                  return " och";
                };
                sv2.prototype.everySecond = function() {
                  return "varje sekund";
                };
                sv2.prototype.everyX0Seconds = function() {
                  return "varje %s sekund";
                };
                sv2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekunderna från %s till och med %s efter minuten";
                };
                sv2.prototype.atX0SecondsPastTheMinute = function() {
                  return "på %s sekunder efter minuten";
                };
                sv2.prototype.everyX0Minutes = function() {
                  return "var %s minut";
                };
                sv2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minuterna från %s till och med %s efter timmen";
                };
                sv2.prototype.atX0MinutesPastTheHour = function() {
                  return "på %s minuten efter timmen";
                };
                sv2.prototype.everyX0Hours = function() {
                  return "var %s timme";
                };
                sv2.prototype.betweenX0AndX1 = function() {
                  return "mellan %s och %s";
                };
                sv2.prototype.atX0 = function() {
                  return "kl %s";
                };
                sv2.prototype.commaEveryDay = function() {
                  return ", varje dag";
                };
                sv2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", var %s dag i veckan";
                };
                sv2.prototype.commaX0ThroughX1 = function() {
                  return ", %s till %s";
                };
                sv2.prototype.commaAndX0ThroughX1 = function() {
                  return ", och %s till %s";
                };
                sv2.prototype.first = function() {
                  return "första";
                };
                sv2.prototype.second = function() {
                  return "andra";
                };
                sv2.prototype.third = function() {
                  return "tredje";
                };
                sv2.prototype.fourth = function() {
                  return "fjärde";
                };
                sv2.prototype.fifth = function() {
                  return "femte";
                };
                sv2.prototype.commaOnThe = function() {
                  return ", den ";
                };
                sv2.prototype.spaceX0OfTheMonth = function() {
                  return " %sen av månaden";
                };
                sv2.prototype.lastDay = function() {
                  return "den sista dagen";
                };
                sv2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", på sista %s av månaden";
                };
                sv2.prototype.commaOnlyOnX0 = function() {
                  return ", varje %s";
                };
                sv2.prototype.commaAndOnX0 = function() {
                  return ", och på %s";
                };
                sv2.prototype.commaEveryX0Months = function() {
                  return ", var %s månad";
                };
                sv2.prototype.commaOnlyInX0 = function() {
                  return ", bara på %s";
                };
                sv2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", på sista dagen av månaden";
                };
                sv2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", på sista veckodag av månaden";
                };
                sv2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s dagar före den sista dagen i månaden";
                };
                sv2.prototype.firstWeekday = function() {
                  return "första veckodag";
                };
                sv2.prototype.weekdayNearestDayX0 = function() {
                  return "veckodagen närmast dag %s";
                };
                sv2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", på den %s av månaden";
                };
                sv2.prototype.commaEveryX0Days = function() {
                  return ", var %s dag";
                };
                sv2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", mellan dag %s och %s av månaden";
                };
                sv2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", på dag %s av månaden";
                };
                sv2.prototype.commaEveryX0Years = function() {
                  return ", var %s år";
                };
                sv2.prototype.commaStartingX0 = function() {
                  return ", startar %s";
                };
                sv2.prototype.daysOfTheWeek = function() {
                  return ["söndag", "måndag", "tisdag", "onsdag", "torsdag", "fredag", "lördag"];
                };
                sv2.prototype.monthsOfTheYear = function() {
                  return [
                    "januari",
                    "februari",
                    "mars",
                    "april",
                    "maj",
                    "juni",
                    "juli",
                    "augusti",
                    "september",
                    "oktober",
                    "november",
                    "december"
                  ];
                };
                sv2.prototype.onTheHour = function() {
                  return "på heltimmen";
                };
                return sv2;
              })();
              exports$12.sv = sv;
            },
            /***/
            799(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.sw = void 0;
              var sw = (function() {
                function sw2() {
                }
                sw2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                sw2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                sw2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                sw2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                sw2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                sw2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Kuna tatizo wakati wa kutunga msemo. Angalia cron expression syntax.";
                };
                sw2.prototype.everyMinute = function() {
                  return "kila dakika";
                };
                sw2.prototype.everyHour = function() {
                  return "kila saa";
                };
                sw2.prototype.atSpace = function() {
                  return "Kwa ";
                };
                sw2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Kila dakika kwanzia %s hadi %s";
                };
                sw2.prototype.at = function() {
                  return "Kwa";
                };
                sw2.prototype.spaceAnd = function() {
                  return " na";
                };
                sw2.prototype.everySecond = function() {
                  return "kila sekunde";
                };
                sw2.prototype.everyX0Seconds = function() {
                  return "kila sekunde %s";
                };
                sw2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "sekunde ya %s hadi %s baada ya dakika";
                };
                sw2.prototype.atX0SecondsPastTheMinute = function() {
                  return "sekunde %s baada ya dakika";
                };
                sw2.prototype.everyX0Minutes = function() {
                  return "kila dakika %s";
                };
                sw2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "minutes %s through %s past the hour";
                };
                sw2.prototype.atX0MinutesPastTheHour = function() {
                  return "at %s minutes past the hour";
                };
                sw2.prototype.everyX0Hours = function() {
                  return "every %s hours";
                };
                sw2.prototype.betweenX0AndX1 = function() {
                  return "kati ya %s na %s";
                };
                sw2.prototype.atX0 = function() {
                  return "kwenye %s";
                };
                sw2.prototype.commaEveryDay = function() {
                  return ", kila siku";
                };
                sw2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", kila siku %s ya wiki";
                };
                sw2.prototype.commaX0ThroughX1 = function() {
                  return ", %s hadi %s";
                };
                sw2.prototype.commaAndX0ThroughX1 = function() {
                  return ", na %s hadi %s";
                };
                sw2.prototype.first = function() {
                  return "ya kwanza";
                };
                sw2.prototype.second = function() {
                  return "ya pili";
                };
                sw2.prototype.third = function() {
                  return "ya tatu";
                };
                sw2.prototype.fourth = function() {
                  return "ya nne";
                };
                sw2.prototype.fifth = function() {
                  return "ya tano";
                };
                sw2.prototype.commaOnThe = function() {
                  return ", kwenye ";
                };
                sw2.prototype.spaceX0OfTheMonth = function() {
                  return " siku %s ya mwezi";
                };
                sw2.prototype.lastDay = function() {
                  return "siku ya mwisho";
                };
                sw2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", siku ya %s ya mwezi";
                };
                sw2.prototype.commaOnlyOnX0 = function() {
                  return ", kwa %s tu";
                };
                sw2.prototype.commaAndOnX0 = function() {
                  return ", na pia %s";
                };
                sw2.prototype.commaEveryX0Months = function() {
                  return ", kila mwezi wa %s";
                };
                sw2.prototype.commaOnlyInX0 = function() {
                  return ", kwa %s tu";
                };
                sw2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", siku ya mwisho wa mwezi";
                };
                sw2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", wikendi ya mwisho wa mwezi";
                };
                sw2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", siku ya %s kabla ya siku ya mwisho wa mwezi";
                };
                sw2.prototype.firstWeekday = function() {
                  return "siku za kazi ya kwanza";
                };
                sw2.prototype.weekdayNearestDayX0 = function() {
                  return "siku ya kazi karibu na siku ya %s";
                };
                sw2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", siku ya %s ya mwezi";
                };
                sw2.prototype.commaEveryX0Days = function() {
                  return ", kila siku %s";
                };
                sw2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", kati ya siku %s na %s ya mwezi";
                };
                sw2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", siku ya %s ya mwezi";
                };
                sw2.prototype.commaEveryX0Years = function() {
                  return ", kila miaka %s";
                };
                sw2.prototype.commaStartingX0 = function() {
                  return ", kwanzia %s";
                };
                sw2.prototype.daysOfTheWeek = function() {
                  return ["Jumapili", "Jumatatu", "Jumanne", "Jumatano", "Alhamisi", "Ijumaa", "Jumamosi"];
                };
                sw2.prototype.monthsOfTheYear = function() {
                  return [
                    "Januari",
                    "Februari",
                    "Machi",
                    "Aprili",
                    "Mei",
                    "Juni",
                    "Julai",
                    "Agosti",
                    "Septemba",
                    "Oktoba",
                    "Novemba",
                    "Desemba"
                  ];
                };
                sw2.prototype.onTheHour = function() {
                  return "saa kamili";
                };
                return sw2;
              })();
              exports$12.sw = sw;
            },
            /***/
            33(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.th = void 0;
              var th = (function() {
                function th2() {
                }
                th2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                th2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                th2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                th2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                th2.prototype.use24HourTimeFormatByDefault = function() {
                  return false;
                };
                th2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "เกิดข้อผิดพลาดขณะสร้างคำอธิบายนิพจน์ ตรวจสอบไวยากรณ์นิพจน์ครอน";
                };
                th2.prototype.everyMinute = function() {
                  return "ทุกๆ นาที";
                };
                th2.prototype.everyHour = function() {
                  return "ทุกๆ ชั่วโมง";
                };
                th2.prototype.atSpace = function() {
                  return "เมื่อ ";
                };
                th2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "ทุกๆ นาที %s และ %s";
                };
                th2.prototype.at = function() {
                  return "เมื่อ";
                };
                th2.prototype.spaceAnd = function() {
                  return " และ";
                };
                th2.prototype.everySecond = function() {
                  return "ทุกๆ วินาที";
                };
                th2.prototype.everyX0Seconds = function() {
                  return "ทุกๆ %s วินาที";
                };
                th2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "วินาที %s ถึง %s นาทีที่ผ่านมา";
                };
                th2.prototype.atX0SecondsPastTheMinute = function() {
                  return "เมื่อ %s วินาที นาทีที่ผ่านมา";
                };
                th2.prototype.everyX0Minutes = function() {
                  return "ทุกๆ %s นาที";
                };
                th2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "นาที %s ถึง %s ชั่วโมงที่ผ่านมา";
                };
                th2.prototype.atX0MinutesPastTheHour = function() {
                  return "เมื่อ %s นาที ชั่วโมงที่ผ่านมา";
                };
                th2.prototype.everyX0Hours = function() {
                  return "ทุกๆ %s ชั่วโมง";
                };
                th2.prototype.betweenX0AndX1 = function() {
                  return "ระหว่าง %s ถึง %s";
                };
                th2.prototype.atX0 = function() {
                  return "เมื่อ %s";
                };
                th2.prototype.commaEveryDay = function() {
                  return ", ทุกๆ วัน";
                };
                th2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", ทุกๆ %s วันของสัปดาห์";
                };
                th2.prototype.commaX0ThroughX1 = function() {
                  return ", %s ถึง %s";
                };
                th2.prototype.commaAndX0ThroughX1 = function() {
                  return ", %s ถึง %s";
                };
                th2.prototype.first = function() {
                  return "แรก";
                };
                th2.prototype.second = function() {
                  return "ที่สอง";
                };
                th2.prototype.third = function() {
                  return "ที่สาม";
                };
                th2.prototype.fourth = function() {
                  return "ที่สี่";
                };
                th2.prototype.fifth = function() {
                  return "ที่ห้า";
                };
                th2.prototype.commaOnThe = function() {
                  return ", ในวัน ";
                };
                th2.prototype.spaceX0OfTheMonth = function() {
                  return " %s ของเดือน";
                };
                th2.prototype.lastDay = function() {
                  return "วันสุดท้าย";
                };
                th2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", ณ สุดท้าย %s ของเดือน";
                };
                th2.prototype.commaOnlyOnX0 = function() {
                  return ", เท่านั้น %s";
                };
                th2.prototype.commaAndOnX0 = function() {
                  return ", และใน %s";
                };
                th2.prototype.commaEveryX0Months = function() {
                  return ", ทุกๆ %s เดือน";
                };
                th2.prototype.commaOnlyInX0 = function() {
                  return ", เท่านั้น %s";
                };
                th2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", ในวันสิ้นเดือน";
                };
                th2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", ในวันธรรมดาสุดท้ายของเดือน";
                };
                th2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s วันก่อนวันสุดท้ายของเดือน";
                };
                th2.prototype.firstWeekday = function() {
                  return "วันธรรมดาวันแรก";
                };
                th2.prototype.weekdayNearestDayX0 = function() {
                  return "วันธรรมดาที่ใกล้ที่สุด %s";
                };
                th2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", ในวัน %s ของเดือน";
                };
                th2.prototype.commaEveryX0Days = function() {
                  return ", ทุกๆ %s วัน";
                };
                th2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", ระหว่างวัน %s และ %s ของเดือน";
                };
                th2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", ในวัน %s ของเดือน";
                };
                th2.prototype.commaEveryHour = function() {
                  return ", ทุกๆ ชั่วโมง";
                };
                th2.prototype.commaEveryX0Years = function() {
                  return ", ทุกๆ %s ปี";
                };
                th2.prototype.commaStartingX0 = function() {
                  return ", เริ่ม %s";
                };
                th2.prototype.daysOfTheWeek = function() {
                  return ["วันอาทิตย์", "วันจันทร์", "วันอังคาร", "วันพุธ", "วันพฤหัสบดี", "วันศุกร์", "วันเสาร์"];
                };
                th2.prototype.monthsOfTheYear = function() {
                  return [
                    "มกราคม",
                    "กุมภาพันธ์",
                    "มีนาคม",
                    "เมษายน",
                    "พฤษภาคม",
                    "มิถุนายน",
                    "กรกฎาคม",
                    "สิงหาคม",
                    "กันยายน",
                    "ตุลาคม",
                    "พฤศจิกายน",
                    "ธันวาคม"
                  ];
                };
                th2.prototype.onTheHour = function() {
                  return "ตรงชั่วโมง";
                };
                return th2;
              })();
              exports$12.th = th;
            },
            /***/
            631(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.tr = void 0;
              var tr2 = (function() {
                function tr3() {
                }
                tr3.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                tr3.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                tr3.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                tr3.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                tr3.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                tr3.prototype.everyMinute = function() {
                  return "her dakika";
                };
                tr3.prototype.everyHour = function() {
                  return "her saat";
                };
                tr3.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "İfade açıklamasını oluştururken bir hata oluştu. Cron ifadesini gözden geçirin.";
                };
                tr3.prototype.atSpace = function() {
                  return "Saat ";
                };
                tr3.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Saat %s ve %s arasındaki her dakika";
                };
                tr3.prototype.at = function() {
                  return "Saat";
                };
                tr3.prototype.spaceAnd = function() {
                  return " ve";
                };
                tr3.prototype.everySecond = function() {
                  return "her saniye";
                };
                tr3.prototype.everyX0Seconds = function() {
                  return "her %s saniyede bir";
                };
                tr3.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "dakikaların %s. ve %s. saniyeleri arası";
                };
                tr3.prototype.atX0SecondsPastTheMinute = function() {
                  return "dakikaların %s. saniyesinde";
                };
                tr3.prototype.everyX0Minutes = function() {
                  return "her %s dakikada bir";
                };
                tr3.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "saatlerin %s. ve %s. dakikaları arası";
                };
                tr3.prototype.atX0MinutesPastTheHour = function() {
                  return "saatlerin %s. dakikasında";
                };
                tr3.prototype.everyX0Hours = function() {
                  return "her %s saatte";
                };
                tr3.prototype.betweenX0AndX1 = function() {
                  return "%s ile %s arasında";
                };
                tr3.prototype.atX0 = function() {
                  return "saat %s";
                };
                tr3.prototype.commaEveryDay = function() {
                  return ", her gün";
                };
                tr3.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", ayın her %s günü";
                };
                tr3.prototype.commaX0ThroughX1 = function() {
                  return ", %s ile %s arasında";
                };
                tr3.prototype.commaAndX0ThroughX1 = function() {
                  return ", ve %s ile %s arasında";
                };
                tr3.prototype.first = function() {
                  return "ilk";
                };
                tr3.prototype.second = function() {
                  return "ikinci";
                };
                tr3.prototype.third = function() {
                  return "üçüncü";
                };
                tr3.prototype.fourth = function() {
                  return "dördüncü";
                };
                tr3.prototype.fifth = function() {
                  return "beşinci";
                };
                tr3.prototype.commaOnThe = function() {
                  return ", ayın ";
                };
                tr3.prototype.spaceX0OfTheMonth = function() {
                  return " %s günü";
                };
                tr3.prototype.lastDay = function() {
                  return "son gün";
                };
                tr3.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", ayın son %s günü";
                };
                tr3.prototype.commaOnlyOnX0 = function() {
                  return ", sadece %s günü";
                };
                tr3.prototype.commaAndOnX0 = function() {
                  return ", ve %s";
                };
                tr3.prototype.commaEveryX0Months = function() {
                  return ", %s ayda bir";
                };
                tr3.prototype.commaOnlyInX0 = function() {
                  return ", sadece %s için";
                };
                tr3.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", ayın son günü";
                };
                tr3.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", ayın son iş günü";
                };
                tr3.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s ayın son gününden önceki günler";
                };
                tr3.prototype.firstWeekday = function() {
                  return "ilk iş günü";
                };
                tr3.prototype.weekdayNearestDayX0 = function() {
                  return "%s. günü sonrasındaki ilk iş günü";
                };
                tr3.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", ayın %s";
                };
                tr3.prototype.commaEveryX0Days = function() {
                  return ", %s günde bir";
                };
                tr3.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", ayın %s. ve %s. günleri arası";
                };
                tr3.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", ayın %s. günü";
                };
                tr3.prototype.commaEveryX0Years = function() {
                  return ", %s yılda bir";
                };
                tr3.prototype.commaStartingX0 = function() {
                  return ", başlangıç %s";
                };
                tr3.prototype.daysOfTheWeek = function() {
                  return ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"];
                };
                tr3.prototype.monthsOfTheYear = function() {
                  return [
                    "Ocak",
                    "Şubat",
                    "Mart",
                    "Nisan",
                    "Mayıs",
                    "Haziran",
                    "Temmuz",
                    "Ağustos",
                    "Eylül",
                    "Ekim",
                    "Kasım",
                    "Aralık"
                  ];
                };
                tr3.prototype.onTheHour = function() {
                  return "saatin başında";
                };
                return tr3;
              })();
              exports$12.tr = tr2;
            },
            /***/
            225(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.uk = void 0;
              var uk = (function() {
                function uk2() {
                }
                uk2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                uk2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                uk2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                uk2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                uk2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                uk2.prototype.everyMinute = function() {
                  return "щохвилини";
                };
                uk2.prototype.everyHour = function() {
                  return "щогодини";
                };
                uk2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "ВІдбулася помилка підчас генерації опису. Перевірта правильність написання cron виразу.";
                };
                uk2.prototype.atSpace = function() {
                  return "О ";
                };
                uk2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Щохвилини між %s та %s";
                };
                uk2.prototype.at = function() {
                  return "О";
                };
                uk2.prototype.spaceAnd = function() {
                  return " та";
                };
                uk2.prototype.everySecond = function() {
                  return "Щосекунди";
                };
                uk2.prototype.everyX0Seconds = function() {
                  return "кожні %s секунд";
                };
                uk2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "з %s по %s секунду";
                };
                uk2.prototype.atX0SecondsPastTheMinute = function() {
                  return "о %s секунді";
                };
                uk2.prototype.everyX0Minutes = function() {
                  return "кожні %s хвилин";
                };
                uk2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "з %s по %s хвилину";
                };
                uk2.prototype.atX0MinutesPastTheHour = function() {
                  return "о %s хвилині";
                };
                uk2.prototype.everyX0Hours = function() {
                  return "кожні %s годин";
                };
                uk2.prototype.betweenX0AndX1 = function() {
                  return "між %s та %s";
                };
                uk2.prototype.atX0 = function() {
                  return "о %s";
                };
                uk2.prototype.commaEveryDay = function() {
                  return ", щоденно";
                };
                uk2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", кожен %s день тижня";
                };
                uk2.prototype.commaX0ThroughX1 = function() {
                  return ", %s по %s";
                };
                uk2.prototype.commaAndX0ThroughX1 = function() {
                  return ", та %s по %s";
                };
                uk2.prototype.first = function() {
                  return "перший";
                };
                uk2.prototype.second = function() {
                  return "другий";
                };
                uk2.prototype.third = function() {
                  return "третій";
                };
                uk2.prototype.fourth = function() {
                  return "четвертий";
                };
                uk2.prototype.fifth = function() {
                  return "п'ятий";
                };
                uk2.prototype.commaOnThe = function() {
                  return ", в ";
                };
                uk2.prototype.spaceX0OfTheMonth = function() {
                  return " %s місяця";
                };
                uk2.prototype.lastDay = function() {
                  return "останній день";
                };
                uk2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", в останній %s місяця";
                };
                uk2.prototype.commaOnlyOnX0 = function() {
                  return ", тільки в %s";
                };
                uk2.prototype.commaAndOnX0 = function() {
                  return ", і в %s";
                };
                uk2.prototype.commaEveryX0Months = function() {
                  return ", кожен %s місяць";
                };
                uk2.prototype.commaOnlyInX0 = function() {
                  return ", тільки в %s";
                };
                uk2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", в останній день місяця";
                };
                uk2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", в останній будень місяця";
                };
                uk2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s днів до останнього дня місяця";
                };
                uk2.prototype.firstWeekday = function() {
                  return "перший будень";
                };
                uk2.prototype.weekdayNearestDayX0 = function() {
                  return "будень найближчий до %s дня";
                };
                uk2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", в %s місяця";
                };
                uk2.prototype.commaEveryX0Days = function() {
                  return ", кожен %s день";
                };
                uk2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", між %s та %s днями місяця";
                };
                uk2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", на %s день місяця";
                };
                uk2.prototype.commaEveryX0Years = function() {
                  return ", кожні %s роки";
                };
                uk2.prototype.commaStartingX0 = function() {
                  return ", початок %s";
                };
                uk2.prototype.daysOfTheWeek = function() {
                  return ["неділя", "понеділок", "вівторок", "середа", "четвер", "п'ятниця", "субота"];
                };
                uk2.prototype.monthsOfTheYear = function() {
                  return [
                    "січень",
                    "лютий",
                    "березень",
                    "квітень",
                    "травень",
                    "червень",
                    "липень",
                    "серпень",
                    "вересень",
                    "жовтень",
                    "листопад",
                    "грудень"
                  ];
                };
                uk2.prototype.onTheHour = function() {
                  return "рівно о годині";
                };
                return uk2;
              })();
              exports$12.uk = uk;
            },
            /***/
            292(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.vi = void 0;
              var vi = (function() {
                function vi2() {
                }
                vi2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                vi2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                vi2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                vi2.prototype.commaYearX0ThroughYearX1 = function() {
                  return null;
                };
                vi2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                vi2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "Đã xảy ra lỗi khi tạo mô tả biểu thức. Vui lòng kiểm tra cú pháp biểu thức cron.";
                };
                vi2.prototype.everyMinute = function() {
                  return "mỗi phút";
                };
                vi2.prototype.everyHour = function() {
                  return "mỗi giờ";
                };
                vi2.prototype.atSpace = function() {
                  return "Vào ";
                };
                vi2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "Mỗi phút giữa %s and %s";
                };
                vi2.prototype.at = function() {
                  return "Vào";
                };
                vi2.prototype.spaceAnd = function() {
                  return " và";
                };
                vi2.prototype.everySecond = function() {
                  return "mỗi giây";
                };
                vi2.prototype.everyX0Seconds = function() {
                  return "mỗi %s giây";
                };
                vi2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "giây thứ %s qua phút thứ %s";
                };
                vi2.prototype.atX0SecondsPastTheMinute = function() {
                  return "tại giây thứ %s của mỗi phút";
                };
                vi2.prototype.everyX0Minutes = function() {
                  return "mỗi %s phút";
                };
                vi2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "phút thứ %s qua %s tiếng";
                };
                vi2.prototype.atX0MinutesPastTheHour = function() {
                  return "vào %s phút của mỗi tiếng";
                };
                vi2.prototype.everyX0Hours = function() {
                  return "mỗi %s tiếng";
                };
                vi2.prototype.betweenX0AndX1 = function() {
                  return "giữa %s và %s";
                };
                vi2.prototype.atX0 = function() {
                  return "vào %s";
                };
                vi2.prototype.commaEveryDay = function() {
                  return ", mỗi ngày";
                };
                vi2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", mỗi %s ngày trong tuần";
                };
                vi2.prototype.commaX0ThroughX1 = function() {
                  return ", %s đến %s";
                };
                vi2.prototype.commaAndX0ThroughX1 = function() {
                  return ", %s đến %s";
                };
                vi2.prototype.first = function() {
                  return "đầu tiên";
                };
                vi2.prototype.second = function() {
                  return "thứ 2";
                };
                vi2.prototype.third = function() {
                  return "thứ 3";
                };
                vi2.prototype.fourth = function() {
                  return "thứ 4";
                };
                vi2.prototype.fifth = function() {
                  return "thứ 5";
                };
                vi2.prototype.commaOnThe = function() {
                  return ", trên ";
                };
                vi2.prototype.spaceX0OfTheMonth = function() {
                  return " %s của tháng";
                };
                vi2.prototype.lastDay = function() {
                  return "ngày cuối cùng";
                };
                vi2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", vào ngày %s cuối cùng của tháng";
                };
                vi2.prototype.commaOnlyOnX0 = function() {
                  return ", chỉ trên %s";
                };
                vi2.prototype.commaAndOnX0 = function() {
                  return ", và hơn %s";
                };
                vi2.prototype.commaEveryX0Months = function() {
                  return ", mỗi ngày %s tháng";
                };
                vi2.prototype.commaOnlyInX0 = function() {
                  return ", chỉ trong %s";
                };
                vi2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", vào ngày cuối cùng của tháng";
                };
                vi2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", vào ngày cuối tuần của tháng";
                };
                vi2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s ngày trước ngày cuối cùng của tháng";
                };
                vi2.prototype.firstWeekday = function() {
                  return "ngày đầu tuần";
                };
                vi2.prototype.weekdayNearestDayX0 = function() {
                  return "ngày trong tuần ngày gần nhất %s";
                };
                vi2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", vào ngày %s của tháng";
                };
                vi2.prototype.commaEveryX0Days = function() {
                  return ", mỗi %s ngày";
                };
                vi2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", giữa ngày %s và %s trong tháng";
                };
                vi2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", vào %s ngày trong tháng";
                };
                vi2.prototype.commaEveryHour = function() {
                  return ", mỗi tiếng";
                };
                vi2.prototype.commaEveryX0Years = function() {
                  return ", mỗi %s năm";
                };
                vi2.prototype.commaStartingX0 = function() {
                  return ", bắt đầu %s";
                };
                vi2.prototype.daysOfTheWeek = function() {
                  return ["Chủ nhật", "Thứ 2", "Thứ 3", "Thứ 4", "Thứ 5", "Thứ 6", "Thứ 7"];
                };
                vi2.prototype.monthsOfTheYear = function() {
                  return [
                    "Tháng 1",
                    "Tháng 2",
                    "Tháng 3",
                    "Tháng 4",
                    "Tháng 5",
                    "Tháng 6",
                    "Tháng 7",
                    "Tháng 8",
                    "Tháng 9",
                    "Tháng 10",
                    "Tháng 11",
                    "Tháng 12"
                  ];
                };
                vi2.prototype.onTheHour = function() {
                  return "đúng giờ";
                };
                return vi2;
              })();
              exports$12.vi = vi;
            },
            /***/
            571(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.zh_CN = void 0;
              var zh_CN = (function() {
                function zh_CN2() {
                }
                zh_CN2.prototype.setPeriodBeforeTime = function() {
                  return true;
                };
                zh_CN2.prototype.pm = function() {
                  return "下午";
                };
                zh_CN2.prototype.am = function() {
                  return "上午";
                };
                zh_CN2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                zh_CN2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                zh_CN2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                zh_CN2.prototype.commaYearX0ThroughYearX1 = function() {
                  return ", 从%s年至%s年";
                };
                zh_CN2.prototype.use24HourTimeFormatByDefault = function() {
                  return false;
                };
                zh_CN2.prototype.everyMinute = function() {
                  return "每分钟";
                };
                zh_CN2.prototype.everyHour = function() {
                  return "每小时";
                };
                zh_CN2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "生成表达式描述时发生了错误，请检查cron表达式语法。";
                };
                zh_CN2.prototype.atSpace = function() {
                  return "在";
                };
                zh_CN2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "在 %s 至 %s 之间的每分钟";
                };
                zh_CN2.prototype.at = function() {
                  return "在";
                };
                zh_CN2.prototype.spaceAnd = function() {
                  return " 和";
                };
                zh_CN2.prototype.everySecond = function() {
                  return "每秒";
                };
                zh_CN2.prototype.everyX0Seconds = function() {
                  return "每隔 %s 秒";
                };
                zh_CN2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "在一分钟后的第 %s 到 %s 秒";
                };
                zh_CN2.prototype.atX0SecondsPastTheMinute = function() {
                  return "在一分钟后的第 %s 秒";
                };
                zh_CN2.prototype.everyX0Minutes = function() {
                  return "每隔 %s 分钟";
                };
                zh_CN2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "在整点后的第 %s 到 %s 分钟";
                };
                zh_CN2.prototype.atX0MinutesPastTheHour = function() {
                  return "在整点后的第 %s 分钟";
                };
                zh_CN2.prototype.everyX0Hours = function() {
                  return "每隔 %s 小时";
                };
                zh_CN2.prototype.betweenX0AndX1 = function() {
                  return "在 %s 和 %s 之间";
                };
                zh_CN2.prototype.atX0 = function() {
                  return "在%s";
                };
                zh_CN2.prototype.commaEveryDay = function() {
                  return ", 每天";
                };
                zh_CN2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", 每周的每 %s 天";
                };
                zh_CN2.prototype.commaX0ThroughX1 = function() {
                  return ", %s至%s";
                };
                zh_CN2.prototype.commaAndX0ThroughX1 = function() {
                  return ", 和%s至%s";
                };
                zh_CN2.prototype.first = function() {
                  return "第一个";
                };
                zh_CN2.prototype.second = function() {
                  return "第二个";
                };
                zh_CN2.prototype.third = function() {
                  return "第三个";
                };
                zh_CN2.prototype.fourth = function() {
                  return "第四个";
                };
                zh_CN2.prototype.fifth = function() {
                  return "第五个";
                };
                zh_CN2.prototype.commaOnThe = function() {
                  return ", 限每月的";
                };
                zh_CN2.prototype.spaceX0OfTheMonth = function() {
                  return "%s";
                };
                zh_CN2.prototype.lastDay = function() {
                  return "本月最后一天";
                };
                zh_CN2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", 限每月的最后一个%s";
                };
                zh_CN2.prototype.commaOnlyOnX0 = function() {
                  return ", 仅%s";
                };
                zh_CN2.prototype.commaAndOnX0 = function() {
                  return ", 或者为%s";
                };
                zh_CN2.prototype.commaEveryX0Months = function() {
                  return ", 每隔 %s 个月";
                };
                zh_CN2.prototype.commaOnlyInX0 = function() {
                  return ", 仅限%s";
                };
                zh_CN2.prototype.commaOnlyInMonthX0 = function() {
                  return ", 仅于%s份";
                };
                zh_CN2.prototype.commaOnlyInYearX0 = function() {
                  return ", 仅于 %s 年";
                };
                zh_CN2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", 限每月的最后一天";
                };
                zh_CN2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", 限每月的最后一个工作日";
                };
                zh_CN2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", 限每月最后%s天";
                };
                zh_CN2.prototype.firstWeekday = function() {
                  return "第一个工作日";
                };
                zh_CN2.prototype.weekdayNearestDayX0 = function() {
                  return "最接近 %s 号的工作日";
                };
                zh_CN2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", 限每月的%s";
                };
                zh_CN2.prototype.commaEveryX0Days = function() {
                  return ", 每隔 %s 天";
                };
                zh_CN2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", 限每月的 %s 至 %s 之间";
                };
                zh_CN2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", 限每月%s";
                };
                zh_CN2.prototype.commaEveryX0Years = function() {
                  return ", 每隔 %s 年";
                };
                zh_CN2.prototype.commaStartingX0 = function() {
                  return ", %s开始";
                };
                zh_CN2.prototype.dayX0 = function() {
                  return " %s 号";
                };
                zh_CN2.prototype.daysOfTheWeek = function() {
                  return ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
                };
                zh_CN2.prototype.monthsOfTheYear = function() {
                  return ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"];
                };
                zh_CN2.prototype.onTheHour = function() {
                  return "整点";
                };
                return zh_CN2;
              })();
              exports$12.zh_CN = zh_CN;
            },
            /***/
            983(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.zh_TW = void 0;
              var zh_TW = (function() {
                function zh_TW2() {
                }
                zh_TW2.prototype.atX0SecondsPastTheMinuteGt20 = function() {
                  return null;
                };
                zh_TW2.prototype.atX0MinutesPastTheHourGt20 = function() {
                  return null;
                };
                zh_TW2.prototype.commaMonthX0ThroughMonthX1 = function() {
                  return null;
                };
                zh_TW2.prototype.commaYearX0ThroughYearX1 = function() {
                  return ", 從 %s 年至 %s 年";
                };
                zh_TW2.prototype.use24HourTimeFormatByDefault = function() {
                  return true;
                };
                zh_TW2.prototype.everyMinute = function() {
                  return "每分鐘";
                };
                zh_TW2.prototype.everyHour = function() {
                  return "每小時";
                };
                zh_TW2.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
                  return "產生表達式描述時發生了錯誤，請檢查 cron 表達式語法。";
                };
                zh_TW2.prototype.atSpace = function() {
                  return "在 ";
                };
                zh_TW2.prototype.everyMinuteBetweenX0AndX1 = function() {
                  return "在 %s 和 %s 之間的每分鐘";
                };
                zh_TW2.prototype.at = function() {
                  return "在";
                };
                zh_TW2.prototype.spaceAnd = function() {
                  return " 和";
                };
                zh_TW2.prototype.everySecond = function() {
                  return "每秒";
                };
                zh_TW2.prototype.everyX0Seconds = function() {
                  return "每 %s 秒";
                };
                zh_TW2.prototype.secondsX0ThroughX1PastTheMinute = function() {
                  return "在一分鐘後的 %s 到 %s 秒";
                };
                zh_TW2.prototype.atX0SecondsPastTheMinute = function() {
                  return "在一分鐘後的 %s 秒";
                };
                zh_TW2.prototype.everyX0Minutes = function() {
                  return "每 %s 分鐘";
                };
                zh_TW2.prototype.minutesX0ThroughX1PastTheHour = function() {
                  return "在整點後的 %s 到 %s 分鐘";
                };
                zh_TW2.prototype.atX0MinutesPastTheHour = function() {
                  return "在整點後的 %s 分";
                };
                zh_TW2.prototype.everyX0Hours = function() {
                  return "每 %s 小時";
                };
                zh_TW2.prototype.betweenX0AndX1 = function() {
                  return "在 %s 和 %s 之間";
                };
                zh_TW2.prototype.atX0 = function() {
                  return "在 %s";
                };
                zh_TW2.prototype.commaEveryDay = function() {
                  return ", 每天";
                };
                zh_TW2.prototype.commaEveryX0DaysOfTheWeek = function() {
                  return ", 每週的每 %s 天";
                };
                zh_TW2.prototype.commaX0ThroughX1 = function() {
                  return ", %s 到 %s";
                };
                zh_TW2.prototype.commaAndX0ThroughX1 = function() {
                  return ", 和 %s 到 %s";
                };
                zh_TW2.prototype.first = function() {
                  return "第一個";
                };
                zh_TW2.prototype.second = function() {
                  return "第二個";
                };
                zh_TW2.prototype.third = function() {
                  return "第三個";
                };
                zh_TW2.prototype.fourth = function() {
                  return "第四個";
                };
                zh_TW2.prototype.fifth = function() {
                  return "第五個";
                };
                zh_TW2.prototype.commaOnThe = function() {
                  return ", 在每月 ";
                };
                zh_TW2.prototype.spaceX0OfTheMonth = function() {
                  return "%s ";
                };
                zh_TW2.prototype.lastDay = function() {
                  return "最後一天";
                };
                zh_TW2.prototype.commaOnTheLastX0OfTheMonth = function() {
                  return ", 每月的最後一個 %s ";
                };
                zh_TW2.prototype.commaOnlyOnX0 = function() {
                  return ", 僅在 %s";
                };
                zh_TW2.prototype.commaAndOnX0 = function() {
                  return ", 或 %s";
                };
                zh_TW2.prototype.commaEveryX0Months = function() {
                  return ", 每 %s 月";
                };
                zh_TW2.prototype.commaOnlyInX0 = function() {
                  return ", 僅在 %s";
                };
                zh_TW2.prototype.commaOnlyInMonthX0 = function() {
                  return ", 僅在 %s";
                };
                zh_TW2.prototype.commaOnlyInYearX0 = function() {
                  return ", 僅在 %s 年";
                };
                zh_TW2.prototype.commaOnTheLastDayOfTheMonth = function() {
                  return ", 每月的最後一天";
                };
                zh_TW2.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
                  return ", 每月的最後一個工作日";
                };
                zh_TW2.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
                  return ", %s 這個月的最後一天的前幾天";
                };
                zh_TW2.prototype.firstWeekday = function() {
                  return "第一個工作日";
                };
                zh_TW2.prototype.weekdayNearestDayX0 = function() {
                  return "最接近 %s 號的工作日";
                };
                zh_TW2.prototype.commaOnTheX0OfTheMonth = function() {
                  return ", 每月的 %s ";
                };
                zh_TW2.prototype.commaEveryX0Days = function() {
                  return ", 每 %s 天";
                };
                zh_TW2.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
                  return ", 在每月的 %s 和 %s 之間";
                };
                zh_TW2.prototype.commaOnDayX0OfTheMonth = function() {
                  return ", 每月的 %s";
                };
                zh_TW2.prototype.commaEveryX0Years = function() {
                  return ", 每 %s 年";
                };
                zh_TW2.prototype.commaStartingX0 = function() {
                  return ", %s 開始";
                };
                zh_TW2.prototype.dayX0 = function() {
                  return " %s 號";
                };
                zh_TW2.prototype.daysOfTheWeek = function() {
                  return ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
                };
                zh_TW2.prototype.monthsOfTheYear = function() {
                  return ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"];
                };
                zh_TW2.prototype.onTheHour = function() {
                  return "整點";
                };
                return zh_TW2;
              })();
              exports$12.zh_TW = zh_TW;
            },
            /***/
            515(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              function assert(value, message) {
                if (!value) {
                  throw new Error(message);
                }
              }
              var RangeValidator = (function() {
                function RangeValidator2() {
                }
                RangeValidator2.secondRange = function(parse) {
                  var parsed = parse.split(",");
                  for (var i2 = 0; i2 < parsed.length; i2++) {
                    if (!isNaN(parseInt(parsed[i2], 10))) {
                      var second = parseInt(parsed[i2], 10);
                      assert(second >= 0 && second <= 59, "seconds part must be >= 0 and <= 59");
                    }
                  }
                };
                RangeValidator2.minuteRange = function(parse) {
                  var parsed = parse.split(",");
                  for (var i2 = 0; i2 < parsed.length; i2++) {
                    if (!isNaN(parseInt(parsed[i2], 10))) {
                      var minute = parseInt(parsed[i2], 10);
                      assert(minute >= 0 && minute <= 59, "minutes part must be >= 0 and <= 59");
                    }
                  }
                };
                RangeValidator2.hourRange = function(parse) {
                  var parsed = parse.split(",");
                  for (var i2 = 0; i2 < parsed.length; i2++) {
                    if (!isNaN(parseInt(parsed[i2], 10))) {
                      var hour = parseInt(parsed[i2], 10);
                      assert(hour >= 0 && hour <= 23, "hours part must be >= 0 and <= 23");
                    }
                  }
                };
                RangeValidator2.dayOfMonthRange = function(parse) {
                  var parsed = parse.split(",");
                  for (var i2 = 0; i2 < parsed.length; i2++) {
                    if (!isNaN(parseInt(parsed[i2], 10))) {
                      var dayOfMonth = parseInt(parsed[i2], 10);
                      assert(dayOfMonth >= 1 && dayOfMonth <= 31, "DOM part must be >= 1 and <= 31");
                    }
                  }
                };
                RangeValidator2.monthRange = function(parse, monthStartIndexZero) {
                  var parsed = parse.split(",");
                  for (var i2 = 0; i2 < parsed.length; i2++) {
                    if (!isNaN(parseInt(parsed[i2], 10))) {
                      var month = parseInt(parsed[i2], 10);
                      assert(month >= 1 && month <= 12, monthStartIndexZero ? "month part must be >= 0 and <= 11" : "month part must be >= 1 and <= 12");
                    }
                  }
                };
                RangeValidator2.dayOfWeekRange = function(parse, dayOfWeekStartIndexZero) {
                  var parsed = parse.split(",");
                  for (var i2 = 0; i2 < parsed.length; i2++) {
                    if (!isNaN(parseInt(parsed[i2], 10))) {
                      var dayOfWeek = parseInt(parsed[i2], 10);
                      assert(dayOfWeek >= 0 && dayOfWeek <= 6, dayOfWeekStartIndexZero ? "DOW part must be >= 0 and <= 6" : "DOW part must be >= 1 and <= 7");
                    }
                  }
                };
                return RangeValidator2;
              })();
              exports$12["default"] = RangeValidator;
            },
            /***/
            823(__unused_webpack_module, exports$12) {
              Object.defineProperty(exports$12, "__esModule", { value: true });
              exports$12.StringUtilities = void 0;
              var StringUtilities = (function() {
                function StringUtilities2() {
                }
                StringUtilities2.format = function(template) {
                  var values = [];
                  for (var _i = 1; _i < arguments.length; _i++) {
                    values[_i - 1] = arguments[_i];
                  }
                  return template.replace(/%s/g, function(substring) {
                    return values.shift();
                  });
                };
                StringUtilities2.containsAny = function(text, searchStrings) {
                  return searchStrings.some(function(c2) {
                    return text.indexOf(c2) > -1;
                  });
                };
                return StringUtilities2;
              })();
              exports$12.StringUtilities = StringUtilities;
            }
            /******/
          };
          var __webpack_module_cache__ = {};
          function __webpack_require__(moduleId) {
            var cachedModule = __webpack_module_cache__[moduleId];
            if (cachedModule !== void 0) {
              return cachedModule.exports;
            }
            var module2 = __webpack_module_cache__[moduleId] = {
              /******/
              // no module.id needed
              /******/
              // no module.loaded needed
              /******/
              exports: {}
              /******/
            };
            __webpack_modules__[moduleId](module2, module2.exports, __webpack_require__);
            return module2.exports;
          }
          var __webpack_exports__ = {};
          (() => {
            var exports$12 = __webpack_exports__;
            Object.defineProperty(exports$12, "__esModule", { value: true });
            exports$12.toString = void 0;
            var expressionDescriptor_1 = __webpack_require__(333);
            var allLocalesLoader_1 = __webpack_require__(420);
            expressionDescriptor_1.ExpressionDescriptor.initialize(new allLocalesLoader_1.allLocalesLoader());
            exports$12["default"] = expressionDescriptor_1.ExpressionDescriptor;
            var cronstrue_i18n_toString = expressionDescriptor_1.ExpressionDescriptor.toString;
            exports$12.toString = cronstrue_i18n_toString;
          })();
          return __webpack_exports__;
        })()
      );
    });
  })(cronstrueI18n);
  return cronstrueI18n.exports;
}
var i18n;
var hasRequiredI18n;
function requireI18n() {
  if (hasRequiredI18n) return i18n;
  hasRequiredI18n = 1;
  var cronstrueWithLocales = requireCronstrueI18n();
  i18n = cronstrueWithLocales;
  return i18n;
}
var i18nExports = requireI18n();
const cronstrue = /* @__PURE__ */ getDefaultExportFromCjs(i18nExports);
const getCronLocale = () => {
  const wpLocale = window.wp?.i18n?.getLocaleData()?.[""]?.lang || "en";
  return wpLocale.split("_")[0];
};
const cronToHuman = (cron) => {
  if (!cron) return "";
  try {
    return cronstrue.toString(cron, {
      locale: getCronLocale(),
      use24HourTimeFormat: true,
      throwExceptionOnParseError: true
    });
  } catch (e2) {
    return window.wp.i18n.__("Custom schedule", "structura");
  }
};
const parseCronForUi = (cron) => {
  try {
    const parts = cron.split(" ");
    if (parts.length < 5) return null;
    const [minute, hour, dayOfMonth, , dayOfWeek] = parts;
    const time = `${hour.padStart(2, "0")}:${minute.padStart(2, "0")}`;
    if (dayOfMonth !== "*" && dayOfWeek === "*") {
      return { frequency: "monthly", time, dayOfMonth: parseInt(dayOfMonth), days: [] };
    }
    if (dayOfWeek !== "*") {
      return {
        frequency: "weekly",
        time,
        dayOfMonth: 1,
        days: dayOfWeek.split(",").map(Number)
      };
    }
    return { frequency: "daily", time, dayOfMonth: 1, days: [] };
  } catch (e2) {
    return null;
  }
};
const META = {
  traffic_magnet: {
    label: window.wp.i18n.__("Traffic Magnet", "structura"),
    iconHint: "TrendingUp",
    bg: "bg-brand-50 dark:bg-brand-950/30",
    text: "text-brand-500 dark:text-brand-400"
  },
  quick_wins: {
    label: window.wp.i18n.__("Quick Wins", "structura"),
    iconHint: "Zap",
    bg: "bg-amber-50 dark:bg-amber-950/30",
    text: "text-amber-500 dark:text-amber-400"
  },
  conversion: {
    label: window.wp.i18n.__("Conversion", "structura"),
    iconHint: "Target",
    bg: "bg-emerald-50 dark:bg-emerald-950/30",
    text: "text-emerald-500 dark:text-emerald-400"
  },
  authority: {
    label: window.wp.i18n.__("Authority", "structura"),
    iconHint: "Crown",
    bg: "bg-violet-50 dark:bg-violet-950/30",
    text: "text-violet-500 dark:text-violet-400"
  }
};
const FALLBACK = {
  label: window.wp.i18n.__("Default", "structura"),
  iconHint: "Layers",
  bg: "bg-neutral-100 dark:bg-neutral-800",
  text: "text-neutral-400 dark:text-neutral-500"
};
const getCampaignModeMeta = (mode) => META[mode] ?? FALLBACK;
const SUPPORT_URL$1 = "https://www.structurawp.com/support";
const MODE_ICONS = {
  traffic_magnet: TrendingUp,
  quick_wins: Zap,
  conversion: Target,
  authority: Crown
};
const resolveNewCampaignBlockedReason = (args) => {
  const { isLicensed, atCampaignCap, usedCampaigns, campaignCap, engineBlockedReason } = args;
  if (!isLicensed) {
    return engineBlockedReason ?? window.wp.i18n.__("Campaigns need a license — claim a free one to schedule posts.", "structura");
  }
  if (atCampaignCap && campaignCap !== null) {
    return window.wp.i18n.sprintf(
      /* translators: 1: campaigns currently used, 2: plan limit */
      window.wp.i18n.__(
        "You're using %1$d of %2$d campaigns on your plan. Pause or delete one, or contact us for more.",
        "structura"
      ),
      usedCampaigns,
      campaignCap
    );
  }
  return engineBlockedReason;
};
const CampaignsPage = () => {
  const navigate = useNavigate();
  const [hideCompleted, setHideCompleted] = window.wp.element.useState(true);
  const { data: campaigns = [], isLoading, isFetching } = useCampaignsQuery();
  const { isLicensed, isPaidLicense, plan, maxCampaigns } = useLicense();
  const { activeProviders } = useAiConnections();
  const { data: personas = [] } = usePersonasQuery();
  const isManagedAiPlan = isManagedPlan(plan);
  const hasApiKey = activeProviders.length > 0;
  const isEngineReady = isManagedAiPlan || hasApiKey;
  const campaignCap = maxCampaigns;
  const usedCampaigns = campaigns.length;
  const atCampaignCap = campaignCap !== null && usedCampaigns >= campaignCap;
  const engineBlockedReason = !hasApiKey && !isManagedAiPlan ? window.wp.i18n.__("Connect an AI provider in the AI Engine settings first.", "structura") : void 0;
  const newCampaignBlockedReason = resolveNewCampaignBlockedReason({
    isLicensed,
    atCampaignCap,
    usedCampaigns,
    campaignCap,
    engineBlockedReason
  });
  const personaMap = new Map(personas.map((p2) => [p2.id, p2.name]));
  const STATUS_ORDER = { active: 0, paused: 1, completed: 2 };
  const sorted = [...campaigns].sort(
    (a3, b2) => (STATUS_ORDER[a3.status] ?? 9) - (STATUS_ORDER[b2.status] ?? 9)
  );
  const completedCount = campaigns.filter((c2) => c2.status === "completed").length;
  const visibleCampaigns = hideCompleted ? sorted.filter((c2) => c2.status !== "completed") : sorted;
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading campaigns…", "structura"), size: "lg", padding: "lg" });
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-4xl space-y-8" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Campaigns", "structura")), isFetching && !isLoading && /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "animate-spin text-neutral-400" })), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Create and manage your content campaigns.", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, isLicensed && campaignCap !== null && /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: B$1(
        "inline-flex items-center gap-1 rounded-full px-2.5 py-1 text-[11px] font-semibold tabular-nums",
        atCampaignCap ? "bg-amber-50 text-amber-700 ring-1 ring-amber-200/60 dark:bg-amber-950/30 dark:text-amber-300 dark:ring-amber-900/60" : "bg-neutral-100 text-neutral-500 ring-1 ring-neutral-200/60 dark:bg-neutral-800 dark:text-neutral-400 dark:ring-neutral-700/60"
      ),
      title: atCampaignCap ? window.wp.i18n.sprintf(
        /* translators: 1: campaigns used, 2: plan cap */
        window.wp.i18n.__(
          "You're using %1$d of %2$d campaigns on your plan. Pause or delete one to free up a slot, or contact us for more.",
          "structura"
        ),
        usedCampaigns,
        campaignCap
      ) : window.wp.i18n.sprintf(
        /* translators: 1: campaigns used, 2: plan cap */
        window.wp.i18n.__("%1$d of %2$d campaigns used on your plan.", "structura"),
        usedCampaigns,
        campaignCap
      )
    },
    window.wp.i18n.sprintf(
      /* translators: 1: campaigns used, 2: plan cap */
      window.wp.i18n.__("%1$d / %2$d campaigns", "structura"),
      usedCampaigns,
      campaignCap
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      variant: "secondary",
      onClick: () => navigate("/generate"),
      disabled: !isEngineReady,
      title: engineBlockedReason
    },
    /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Generate Post", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      onClick: () => navigate("/campaigns/new"),
      disabled: !isEngineReady || !isLicensed || atCampaignCap,
      title: newCampaignBlockedReason
    },
    /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 16, className: "mr-1.5" }),
    window.wp.i18n.__("New Campaign", "structura")
  ))), /* @__PURE__ */ window.wp.element.createElement(CampaignDraftBanner, null), isLicensed && isPaidLicense && atCampaignCap && campaignCap !== null && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-start justify-between gap-3 rounded-2xl border border-amber-200/70 bg-amber-50/60 px-5 py-4 sm:flex-row sm:items-center dark:border-amber-900/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-amber-800 dark:text-amber-200" }, window.wp.i18n.__("You've reached your plan's campaign limit.", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-700/80 dark:text-amber-300/80" }, window.wp.i18n.sprintf(
    /* translators: 1: campaigns used, 2: plan cap */
    window.wp.i18n.__(
      "You're using %1$d of %2$d campaigns. Pause or delete one to free up a slot, or contact us if you need more.",
      "structura"
    ),
    usedCampaigns,
    campaignCap
  ))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, size: "sm", variant: "secondary" }, /* @__PURE__ */ window.wp.element.createElement("a", { href: SUPPORT_URL$1, target: "_blank", rel: "noreferrer" }, window.wp.i18n.__("Contact us", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })))), !isLicensed ? /* @__PURE__ */ window.wp.element.createElement(
    UnlicensedTeaser,
    {
      isEngineReady,
      engineBlockedReason,
      onGenerate: () => navigate("/generate")
    }
  ) : campaigns.length === 0 ? /* @__PURE__ */ window.wp.element.createElement(
    EmptyState$1,
    {
      isEngineReady,
      engineBlockedReason,
      onNew: () => navigate("/campaigns/new")
    }
  ) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4" }, completedCount > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end" }, /* @__PURE__ */ window.wp.element.createElement("label", { className: "flex cursor-pointer items-center gap-2 text-xs text-neutral-400 select-none dark:text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setHideCompleted((v2) => !v2),
      className: B$1(
        "flex size-4 cursor-pointer items-center justify-center rounded border transition-colors",
        hideCompleted ? "border-brand-500 bg-brand-500 dark:border-brand-400 dark:bg-brand-500 text-white" : "border-neutral-300 bg-white dark:border-neutral-600 dark:bg-neutral-800"
      )
    },
    hideCompleted && /* @__PURE__ */ window.wp.element.createElement(Check, { size: 10, strokeWidth: 3 })
  ), window.wp.i18n.sprintf(window.wp.i18n.__("Hide completed (%s)", "structura"), completedCount.toString()))), visibleCampaigns.map((campaign) => /* @__PURE__ */ window.wp.element.createElement(
    CampaignCard,
    {
      key: campaign.id,
      campaign,
      personaName: getPersonaLabel(campaign.intelligence.personaId, personaMap),
      onClick: () => navigate(`/campaigns/${campaign.id}`)
    }
  ))), isLicensed && !isPaidLicense && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-dashed border-neutral-200 bg-neutral-50/50 px-6 py-5 text-center dark:border-neutral-700 dark:bg-neutral-900/30" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Want more from your campaigns?", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "Upgrade to Pro for keyword research, authority domains, pre-generated publishes, more active campaigns, and more.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm", className: "mt-3" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildPortalSignupUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    window.wp.i18n.__("See Plans", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })
  ))));
};
const CampaignCard = ({
  campaign,
  personaName,
  onClick
}) => {
  const { identity: identity2, intelligence, schedule, stats, lastRun } = campaign;
  const isQuota = schedule.endCondition.type === "quota";
  const isDate = schedule.endCondition.type === "date";
  const acknowledgeRun = useAcknowledgeRunMutation();
  const progress = isQuota ? Math.min(
    Math.round(stats.postsPublished / schedule.endCondition.value * 100),
    100
  ) : 0;
  const isActive = campaign.status === "active";
  const modeMeta = getCampaignModeMeta(identity2.campaignMode);
  const providerVis = getProviderVisual(intelligence.textProvider);
  const ModeIcon = MODE_ICONS[identity2.campaignMode ?? ""] ?? Layers;
  const ProviderIcon = providerVis.icon;
  return /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick,
      className: B$1(
        "group w-full cursor-pointer rounded-2xl border bg-white text-left shadow-sm transition-all dark:bg-neutral-900",
        isActive ? B$1(providerVis.border, providerVis.glow, "hover:shadow-md") : "border-neutral-200/60 hover:border-neutral-300 hover:shadow-md dark:border-neutral-800 dark:hover:border-neutral-700"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-5 px-6 py-5" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "mt-0.5 flex size-11 shrink-0 items-center justify-center rounded-xl",
          isActive ? modeMeta.bg : "bg-neutral-100 dark:bg-neutral-800"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(
        ModeIcon,
        {
          size: 20,
          className: isActive ? modeMeta.text : "text-neutral-400 dark:text-neutral-500"
        }
      )
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1 space-y-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2.5" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! truncate text-base font-bold text-neutral-900 dark:text-white" }, identity2.name), /* @__PURE__ */ window.wp.element.createElement(
      Me,
      {
        variant: "solid",
        intent: getBadgeIntentByCampaignStatus(campaign.status),
        className: "shrink-0"
      },
      campaignStatusLabel(campaign.status)
    ), lastRun?.status === "failed" && lastRun.runId && /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        role: "link",
        tabIndex: 0,
        onClick: (e2) => {
          e2.stopPropagation();
          acknowledgeRun.mutate(lastRun.runId);
          window.location.hash = `#/runs/${lastRun.runId}`;
        },
        onKeyDown: (e2) => {
          if (e2.key === "Enter" || e2.key === " ") {
            e2.preventDefault();
            e2.stopPropagation();
            acknowledgeRun.mutate(lastRun.runId);
            window.location.hash = `#/runs/${lastRun.runId}`;
          }
        },
        className: "inline-flex shrink-0 cursor-pointer items-center gap-1 rounded-full bg-red-50 px-2 py-0.5 text-[11px] font-semibold text-red-700 ring-1 ring-red-200/60 transition-colors hover:bg-red-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-400 dark:bg-red-950/40 dark:text-red-300 dark:ring-red-900/60 dark:hover:bg-red-950/60",
        "aria-label": lastRun.errorMessage ? window.wp.i18n.sprintf(
          // translators: %s is the failure reason.
          window.wp.i18n.__("Last run failed — %s. View details.", "structura"),
          lastRun.errorMessage
        ) : window.wp.i18n.__("Last run failed — view details.", "structura"),
        title: lastRun.errorMessage || lastRun.headline || window.wp.i18n.__("Last run failed — view details.", "structura")
      },
      /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 11, strokeWidth: 2.5 }),
      window.wp.i18n.__("Needs attention", "structura")
    )), identity2.objective && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1!line-clamp-1 mb-0! text-[13px] text-neutral-400 dark:text-neutral-500" }, identity2.objective)), /* @__PURE__ */ window.wp.element.createElement(
      ChevronRight,
      {
        size: 18,
        className: "mt-1 shrink-0 text-neutral-300 transition-transform group-hover:translate-x-0.5 dark:text-neutral-600"
      }
    )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-2 text-[11px] text-neutral-400 dark:text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
      ProviderIcon,
      {
        size: 14,
        className: isActive ? providerVis.color : "text-neutral-400 dark:text-neutral-500"
      }
    ), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-semibold" }, providerVis.label), intelligence.textModel && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-300 dark:text-neutral-700" }, "·"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-400 dark:text-neutral-500" }, intelligence.textModel))), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-200 dark:text-neutral-700" }, "|"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(User, { size: 11, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("span", null, personaName)), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-200 dark:text-neutral-700" }, "|"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(Clock, { size: 11, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("span", null, cronToHuman(schedule.cron))), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-200 dark:text-neutral-700" }, "|"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
      ModeIcon,
      {
        size: 11,
        className: isActive ? modeMeta.text : "text-neutral-400 dark:text-neutral-500"
      }
    ), /* @__PURE__ */ window.wp.element.createElement("span", null, modeMeta.label))))),
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-6 border-t border-neutral-100 px-6 py-3 dark:border-neutral-800/60" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 text-[11px]" }, /* @__PURE__ */ window.wp.element.createElement(FileText, { size: 12, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-bold text-neutral-600 tabular-nums dark:text-neutral-400" }, stats.postsPublished), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("published", "structura"))), schedule.pregenerationEnabled && /* @__PURE__ */ window.wp.element.createElement(
      StockSummaryChip,
      {
        campaignId: campaign.id,
        pregenerationEnabled: schedule.pregenerationEnabled
      }
    ), stats.nextRun && campaign.status === "active" && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-200 dark:text-neutral-700" }, "·"), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 text-[11px]" }, /* @__PURE__ */ window.wp.element.createElement(Clock, { size: 12, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("Next run", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-semibold text-neutral-600 dark:text-neutral-400" }, stats.nextRun))), isQuota && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-200 dark:text-neutral-700" }, "·"), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-1 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "h-1.5 w-full max-w-32 overflow-hidden rounded-full bg-neutral-100 dark:bg-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: "bg-brand-600 dark:bg-brand-500 h-full transition-all duration-500 ease-out",
        style: { width: `${progress}%` }
      }
    )), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[11px] font-bold text-neutral-500 tabular-nums dark:text-neutral-400" }, stats.postsPublished, "/", schedule.endCondition.value))), isDate && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-200 dark:text-neutral-700" }, "·"), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 text-[11px]" }, /* @__PURE__ */ window.wp.element.createElement(Calendar, { size: 12, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("Ends", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-semibold text-neutral-600 dark:text-neutral-400" }, dayjs(schedule.endCondition.value).format("ll")))), !isQuota && !isDate && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-200 dark:text-neutral-700" }, "·"), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 text-[11px]" }, /* @__PURE__ */ window.wp.element.createElement(Infinity$1, { size: 14, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("Ongoing", "structura"))))),
    /* @__PURE__ */ window.wp.element.createElement(CampaignRunProgress, { campaignId: campaign.id, variant: "card", className: "rounded-b-2xl" })
  );
};
const getPersonaLabel = (personaId, personaMap) => {
  if (personaId === "random") return window.wp.i18n.__("Random persona", "structura");
  return personaMap.get(personaId) ?? window.wp.i18n.__("Unknown persona", "structura");
};
const UnlicensedTeaser = ({
  isEngineReady,
  engineBlockedReason,
  onGenerate
}) => {
  const { plan } = useLicense();
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  return (
    // Lower-key than the previous full-page locked card. Anonymous users
    // CAN generate posts one-off via the AI Engine; campaigns (scheduling)
    // are the gated bit. So the primary CTA is "Generate Post" (an action
    // they can do right now) and "Get Free License" sits behind it as the
    // upgrade path, instead of fronting a giant Lock icon that reads as
    // "you can't use this app yet."
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-start justify-between gap-5 rounded-2xl border border-neutral-200 bg-white px-6 py-6 sm:flex-row sm:items-center dark:border-neutral-700 dark:bg-neutral-900/30" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-50 text-brand-600 dark:bg-brand-950/30 dark:text-brand-400 flex size-10 shrink-0 items-center justify-center rounded-xl" }, /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 18 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Generate a post now — automate later", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! max-w-xl text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "Anonymous installs can generate posts one at a time. Claim a free license to unlock campaigns that publish on a schedule.",
      "structura"
    )))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        size: "sm",
        onClick: onGenerate,
        disabled: !isEngineReady,
        title: engineBlockedReason
      },
      /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 14, className: "mr-1.5" }),
      window.wp.i18n.__("Generate Post", "structura")
    ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, size: "sm", variant: "secondary" }, /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: buildPortalSignupUrl({
          intent: "general_upgrade",
          domain,
          plan
        }),
        target: "_blank",
        rel: "noreferrer"
      },
      window.wp.i18n.__("Get Free License", "structura"),
      /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })
    ))))
  );
};
const EmptyState$1 = ({
  isEngineReady,
  engineBlockedReason,
  onNew
}) => /* @__PURE__ */ window.wp.element.createElement(
  Ea,
  {
    icon: /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 24 }),
    title: window.wp.i18n.__("No campaigns yet", "structura"),
    description: window.wp.i18n.__(
      "Create your first campaign to start generating content automatically.",
      "structura"
    ),
    action: /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: onNew, disabled: !isEngineReady, title: engineBlockedReason }, /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 16, className: "mr-1.5" }), window.wp.i18n.__("Create Campaign", "structura"))
  }
);
const useCampaignQuery = (id) => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: campaignKeys.detail(id),
    queryFn: async () => {
      const campaigns = await window.wp.apiFetch({
        path: "/structura/v1/scheduler/campaigns"
      });
      return campaigns.find((c2) => String(c2.id) === String(id)) ?? null;
    },
    enabled: hasUsableLicense === true && !!id,
    // Always refetch when navigating to the edit page so we never show
    // stale data after a save-then-back-then-edit cycle.
    staleTime: 0,
    refetchOnMount: "always"
  });
};
function computeAddonCardState(addon, entitlement, grace) {
  if (grace && grace.isOrphanedHere) {
    return {
      kind: "grace_orphan",
      addon,
      entitlement: entitlement ?? null,
      grace
    };
  }
  if (entitlement) {
    return { kind: "bundled_included", addon, entitlement };
  }
  return { kind: "not_entitled", addon };
}
function getAddonCatalogEntry(id) {
  switch (id) {
    case "channels":
      return {
        id,
        name: window.wp.i18n.__("Channels", "structura"),
        description: window.wp.i18n.__(
          "AI-adapted distribution for LinkedIn, Slack, Discord, and IndexNow.",
          "structura"
        ),
        pricingAnchor: "#channels"
      };
    case "growth":
      return {
        id,
        name: window.wp.i18n.__("Growth", "structura"),
        description: window.wp.i18n.__(
          "High-stakes paid-spend integrations (ads, attribution, and retargeting).",
          "structura"
        ),
        pricingAnchor: "#growth"
      };
  }
}
const AddonCard = ({ state, catalog, domain }) => {
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-6! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "rounded-lg p-2 ring-1",
        state.kind === "grace_orphan" ? "bg-amber-50 text-amber-600 ring-amber-100 dark:bg-amber-950/30 dark:ring-amber-900/50" : "bg-brand-50 text-brand-600 ring-brand-100 dark:bg-brand-950/30 dark:ring-brand-900/50"
      ),
      "aria-hidden": true
    },
    state.kind === "grace_orphan" ? /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { className: "h-5 w-5" }) : state.kind === "bundled_included" ? /* @__PURE__ */ window.wp.element.createElement(Package, { className: "h-5 w-5" }) : /* @__PURE__ */ window.wp.element.createElement(SlidersHorizontal, { className: "h-5 w-5" })
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm font-bold text-gray-900 dark:text-white" }, catalog.name), renderStatusBadge(state)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-1! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, catalog.description), renderUsageLine(state))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "shrink-0" }, renderCta(state, { domain, catalog }))), renderGraceBanner(state));
};
function renderStatusBadge(state) {
  switch (state.kind) {
    case "bundled_included":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success", variant: "solid" }, window.wp.i18n.__("Included", "structura"));
    case "grace_orphan":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "warning", variant: "solid" }, window.wp.i18n.__("Action required", "structura"));
    case "not_entitled":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "secondary", variant: "solid" }, window.wp.i18n.__("Not included", "structura"));
  }
}
function renderUsageLine(state) {
  if (state.kind === "not_entitled") return null;
  if (state.kind === "bundled_included") {
    if (!state.entitlement) {
      return /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-2! text-[11px] font-medium text-gray-500 dark:text-gray-500" }, window.wp.i18n.__("Active on this site.", "structura"));
    }
    const seatsLine2 = window.wp.i18n.sprintf(
      // translators: %1$d = seats currently in use; %2$d = license seat budget.
      window.wp.i18n.__("%1$d of %2$d seats used.", "structura"),
      state.entitlement.seatsUsed,
      state.entitlement.maxSeats
    );
    return /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-2! text-[11px] font-medium text-gray-500 dark:text-gray-500" }, seatsLine2, " ", window.wp.i18n.__("Active on this site.", "structura"));
  }
  const entitlement = state.entitlement;
  if (!entitlement) return null;
  const seatsLine = window.wp.i18n.sprintf(
    // translators: %1$d = seats currently in use; %2$d = license seat budget.
    window.wp.i18n.__("%1$d of %2$d seats used.", "structura"),
    entitlement.seatsUsed,
    entitlement.maxSeats
  );
  return /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-2! text-[11px] font-medium text-gray-500 dark:text-gray-500" }, seatsLine);
}
function renderCta(state, ctx) {
  switch (state.kind) {
    case "not_entitled":
      return /* @__PURE__ */ window.wp.element.createElement(
        tr$1,
        {
          variant: "secondary",
          size: "sm",
          href: buildMarketingPricingUrl({
            intent: "unlock_addon",
            domain: ctx.domain,
            anchor: ctx.catalog.pricingAnchor
          }),
          target: "_blank",
          rel: "noreferrer"
        },
        /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 14, className: "mr-1.5" }),
        window.wp.i18n.__("Upgrade", "structura")
      );
    // `bundled_included` (Channels ships with every paid plan) and
    // `grace_orphan` (dunning — the global banner owns the "Resolve in
    // billing" action) render no per-card CTA. The seat is auto-granted;
    // there's no per-site enable / disable / reassign flow anymore.
    case "bundled_included":
    case "grace_orphan":
      return null;
  }
}
function renderGraceBanner(state) {
  if (state.kind !== "grace_orphan") return null;
  const { grace } = state;
  const revokeDate = new Date(grace.revokeAt);
  const dateLabel = revokeDate.toLocaleDateString(void 0, {
    month: "short",
    day: "numeric",
    year: "numeric"
  });
  const reasonTitle = grace.reason === "payment_failed" ? window.wp.i18n.__("Payment issue — seats will be revoked", "structura") : window.wp.i18n.__("Plan downgrade — seats will be revoked", "structura");
  const reasonBody = grace.reason === "payment_failed" ? window.wp.i18n.sprintf(
    // translators: %s = localized revoke date.
    window.wp.i18n.__(
      "We couldn't charge your payment method. Update billing before %s to keep this add-on enabled on this site.",
      "structura"
    ),
    dateLabel
  ) : window.wp.i18n.sprintf(
    // translators: %s = localized revoke date.
    window.wp.i18n.__(
      "Your plan change removes Channels from this site on %s. Upgrade to a paid plan in your billing portal to keep it.",
      "structura"
    ),
    dateLabel
  );
  return /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning", className: "mt-4" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, reasonTitle), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, reasonBody));
}
const ADDON_IDS = ["channels"];
const AddonsSection = ({
  entitlements,
  graceperiods,
  domain,
  returnTo
}) => {
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Package, { className: "h-5 w-5 text-gray-400 dark:text-gray-600" }), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, window.wp.i18n.__("Add-ons for This Site", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, ADDON_IDS.map((addonId) => {
    const state = computeAddonCardState(
      addonId,
      entitlements[addonId],
      graceperiods[addonId]
    );
    return /* @__PURE__ */ window.wp.element.createElement(
      AddonCard,
      {
        key: addonId,
        state,
        catalog: getAddonCatalogEntry(addonId),
        domain,
        returnTo
      }
    );
  })));
};
const WorkspaceMembershipCard = () => {
  const { workspace } = useLicense();
  if (!workspace) return null;
  if (workspace.activationsCount <= 1) return null;
  const siblings = Math.max(0, workspace.activationsCount - 1);
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-6! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl bg-violet-50 p-2 ring-1 ring-violet-100 dark:bg-violet-950/30 dark:ring-violet-900/50" }, /* @__PURE__ */ window.wp.element.createElement(Layers, { className: "h-5 w-5 text-violet-600 dark:text-violet-400" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-[11px] font-bold tracking-widest text-gray-500 uppercase dark:text-gray-400" }, window.wp.i18n.__("Workspace", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! truncate text-base font-semibold text-gray-900 dark:text-white" }, workspace.name), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.sprintf(
    /* translators: 1: workspace name (interpolated above), 2: number of OTHER sites in the workspace (excludes the current site). */
    window.wp.i18n._n(
      "This site is part of the workspace alongside %d other site.",
      "This site is part of the workspace alongside %d other sites.",
      siblings,
      "structura"
    ),
    siblings
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", asChild: true }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: `https://app.structurawp.com/workspaces/${workspace.id}`,
      target: "_blank",
      rel: "noreferrer noopener"
    },
    window.wp.i18n.__("Manage workspace", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3.5 w-3.5" })
  ))))));
};
const Account = () => {
  const {
    isLicensed,
    plan,
    license,
    cloudStatus,
    entitlements,
    graceperiods,
    activate,
    deactivate,
    processing
  } = useLicense();
  const [licenseKeyInput, setLicenseKeyInput] = window.wp.element.useState("");
  const [confirmDialogOpen, setConfirmDialogOpen] = window.wp.element.useState(false);
  const [purge, setPurge] = window.wp.element.useState(false);
  const statusConfig = {
    none: {
      title: window.wp.i18n.__("Anonymous Mode", "structura"),
      desc: window.wp.i18n.__(
        "Connect a free account to unlock Headings, Featured Images, and Scheduled tasks.",
        "structura"
      ),
      icon: /* @__PURE__ */ window.wp.element.createElement(CircleUser, { className: "h-7 w-7" }),
      theme: "text-neutral-600 bg-neutral-50 ring-neutral-100"
    },
    free: {
      title: window.wp.i18n.__("Registered Architect", "structura"),
      desc: window.wp.i18n.__(
        "Your account is connected. Upgrade to Pro for high-authority SEO rules and bulk synthesis.",
        "structura"
      ),
      icon: /* @__PURE__ */ window.wp.element.createElement(Activity, { className: "h-7 w-7" }),
      theme: "text-emerald-600 bg-emerald-50 ring-emerald-100 dark:text-emerald-400 dark:bg-emerald-950/30 dark:ring-emerald-900/50"
    },
    pro: {
      title: window.wp.i18n.__("Pro Architect", "structura"),
      desc: window.wp.i18n.__(
        "All systems operational. You have full access to the Structura ecosystem.",
        "structura"
      ),
      icon: /* @__PURE__ */ window.wp.element.createElement(Award, { className: "h-7 w-7" }),
      theme: "text-brand-600 bg-brand-50 ring-brand-100 dark:text-brand-400 dark:bg-brand-950/30 dark:ring-brand-900/50"
    },
    cloud: {
      title: window.wp.i18n.__("Cloud Architect", "structura"),
      desc: window.wp.i18n.__(
        "Fully managed AI — no API keys required. Maximum output, zero maintenance.",
        "structura"
      ),
      icon: /* @__PURE__ */ window.wp.element.createElement(Zap, { className: "h-7 w-7" }),
      theme: "text-violet-600 bg-violet-50 ring-violet-100 dark:text-violet-400 dark:bg-violet-950/30 dark:ring-violet-900/50"
    },
    // Cloud Pro: top-tier managed plan with per-post model swaps and
    // bundled Channels. Uses amber to distinguish from Cloud's violet in
    // the dashboard — see specs/design-guide.md on premium-tier accents.
    cloud_pro: {
      title: window.wp.i18n.__("Cloud Pro Architect", "structura"),
      desc: window.wp.i18n.__(
        "Top-tier managed AI models with per-post model swaps and bundled Channels distribution.",
        "structura"
      ),
      icon: /* @__PURE__ */ window.wp.element.createElement(Award, { className: "h-7 w-7" }),
      theme: "text-amber-600 bg-amber-50 ring-amber-100 dark:text-amber-400 dark:bg-amber-950/30 dark:ring-amber-900/50"
    }
  };
  const paidPlan = plan === "cloud_pro" || plan === "cloud" || plan === "byok";
  const currentStatus = plan === "cloud_pro" ? statusConfig.cloud_pro : plan === "cloud" ? statusConfig.cloud : plan === "byok" ? statusConfig.pro : isLicensed ? statusConfig.free : statusConfig.none;
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-10" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "mb-10" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-3xl font-extrabold tracking-tight text-gray-900 dark:text-white" }, window.wp.i18n.__("Account & License", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs font-bold tracking-[0.2em] text-gray-400 uppercase dark:text-gray-500" }, window.wp.i18n.__("Manage your Structura identity and subscription tier", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-8 flex items-start gap-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1("rounded-xl p-3 ring-1 transition-colors", currentStatus.theme) }, currentStatus.icon), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "mt-0! mb-1! text-lg leading-none font-bold text-gray-900 dark:text-white" }, currentStatus.title), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! max-w-md text-sm leading-relaxed text-gray-500 dark:text-gray-400" }, currentStatus.desc))), !isLicensed && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-8 flex flex-wrap items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      href: buildPortalSignupUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    window.wp.i18n.__("Create Free Account", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      href: buildMarketingPricingUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    window.wp.i18n.__("View Plans", "structura")
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3 px-1" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "h-2 flex-1 rounded-full transition-colors duration-500",
        isLicensed ? "bg-emerald-500" : "bg-gray-200 dark:bg-neutral-800"
      )
    }
  ), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 12, className: "text-gray-300 dark:text-gray-700" }), /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "h-2 flex-[1.5] rounded-full transition-colors duration-500",
        plan === "cloud_pro" ? "bg-amber-500" : plan === "cloud" ? "bg-violet-500" : plan === "byok" ? "bg-brand-500" : "bg-gray-200 dark:bg-neutral-800"
      )
    }
  ))), /* @__PURE__ */ window.wp.element.createElement(WorkspaceMembershipCard, null), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8! shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Key, { className: "h-5 w-5 text-gray-400 dark:text-gray-600" }), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, window.wp.i18n.__("License Activation", "structura"))), !license.masked_key ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-end gap-3 md:flex-row" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("License Key", "structura"),
      placeholder: !isLicensed ? "ST-XXXX-XXXX-XXXX" : "ST-PRO-XXXX-XXXX",
      className: "flex-1 font-mono tracking-tighter",
      value: licenseKeyInput,
      onChange: (e2) => setLicenseKeyInput(e2.target.value),
      hiddenLabel: true
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: async () => {
        try {
          await activate(licenseKeyInput);
          setLicenseKeyInput("");
        } catch (e2) {
        }
      },
      disabled: processing || !licenseKeyInput,
      loading: processing,
      title: !licenseKeyInput ? window.wp.i18n.__("Paste your license key first.", "structura") : void 0
    },
    /* @__PURE__ */ window.wp.element.createElement(Zap, { className: "size-4" }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2" }, !isLicensed ? window.wp.i18n.__("Connect Account", "structura") : window.wp.i18n.__("Upgrade", "structura"))
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! px-1 text-[10px] font-medium text-gray-400" }, window.wp.i18n.__("No license key yet? It comes with your account.", "structura"), /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildPortalSignupUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer",
      className: "text-brand-600 dark:text-brand-400 ml-1 font-bold hover:underline"
    },
    window.wp.i18n.__("Create Free Account", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement("span", { className: "mx-1", "aria-hidden": true }, "·"), /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildMarketingPricingUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      className: "text-brand-600 dark:text-brand-400 font-bold hover:underline"
    },
    window.wp.i18n.__("View Pricing", "structura")
  ))) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-between gap-6 rounded-xl border border-gray-100 bg-gray-50 p-6 md:flex-row dark:border-neutral-800 dark:bg-neutral-950/50" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "success" }, formatPlanName(plan)), cloudStatus?.valid && /* @__PURE__ */ window.wp.element.createElement(ce, { title: window.wp.i18n.__("Cloud Connection Verified", "structura") }, /* @__PURE__ */ window.wp.element.createElement(ShieldCheck, { className: "h-4 w-4 text-emerald-500" }))), /* @__PURE__ */ window.wp.element.createElement("code", { className: "font-mono text-sm tracking-tighter text-gray-600 dark:text-gray-400" }, license?.masked_key), license.plan === "none" && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Your license is currently inactive. Please contact support if you believe this is an error.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildPortalSignupUrl({
        intent: "manage_account",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "size-4" }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2" }, window.wp.i18n.__("Manage account", "structura"))
  )), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "danger",
      onClick: () => setConfirmDialogOpen(true),
      disabled: processing
    },
    window.wp.i18n.__("Disconnect", "structura")
  )))), isLicensed && /* @__PURE__ */ window.wp.element.createElement(
    AddonsSection,
    {
      entitlements,
      graceperiods,
      domain: typeof window !== "undefined" ? window.location.hostname : "",
      returnTo: typeof window !== "undefined" ? window.location.href : void 0
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-6 md:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: docsUrl(),
      target: "_blank",
      rel: "noreferrer",
      className: "group block no-underline"
    },
    /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "duration-normal hover:border-brand-300 dark:hover:border-brand-800 shadow-sm transition-all" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-50 text-brand-600 duration-normal dark:bg-brand-950/30 dark:text-brand-400 rounded-xl p-3 transition-transform group-hover:scale-110" }, /* @__PURE__ */ window.wp.element.createElement(BookOpen, { size: 20 })), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm font-bold text-gray-900 dark:text-white" }, window.wp.i18n.__("Documentation", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-1! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
      "Learn how to master the Architect and configure custom personas.",
      "structura"
    )))))
  ), paidPlan ? /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: "https://www.structurawp.com/support",
      target: "_blank",
      rel: "noreferrer",
      className: "group block no-underline"
    },
    /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "duration-normal shadow-sm transition-all hover:border-purple-300 dark:hover:border-purple-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "duration-normal rounded-xl bg-purple-50 p-3 text-purple-600 transition-transform group-hover:scale-110 dark:bg-purple-950/30 dark:text-purple-400" }, /* @__PURE__ */ window.wp.element.createElement(MessageSquare, { size: 20 })), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm font-bold text-gray-900 dark:text-white" }, window.wp.i18n.__("Support Portal", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-1! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
      "Get help from our architects if you run into any issues.",
      "structura"
    )))))
  ) : /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: "https://wordpress.org/support/plugin/structura/",
      target: "_blank",
      rel: "noreferrer",
      className: "group block no-underline"
    },
    /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "duration-normal shadow-sm transition-all hover:border-blue-300 dark:hover:border-blue-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "duration-normal rounded-xl bg-blue-50 p-3 text-blue-600 transition-transform group-hover:scale-110 dark:bg-blue-950/30 dark:text-blue-400" }, /* @__PURE__ */ window.wp.element.createElement(Users, { size: 20 })), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! text-sm font-bold text-gray-900 dark:text-white" }, window.wp.i18n.__("Community Forum", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-1! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("Ask the community and browse existing support topics.", "structura")))))
  )))), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: confirmDialogOpen,
      onClose: () => {
        setConfirmDialogOpen(false);
        setPurge(false);
      },
      onConfirm: async () => {
        try {
          await deactivate({ purge });
          setConfirmDialogOpen(false);
          setPurge(false);
        } catch (e2) {
        }
      },
      title: window.wp.i18n.__("Disconnect Account", "structura"),
      description: window.wp.i18n.__(
        "Are you sure? This site will revert to Anonymous Mode and all scheduled campaign work will stop. If you later activate a different license, you'll start with a fresh workspace — your existing personas, campaigns, AI keys and channel connections won't transfer over.",
        "structura"
      ),
      variant: "danger",
      loading: processing,
      confirmButtonProps: {
        label: purge ? window.wp.i18n.__("Delete permanently", "structura") : window.wp.i18n.__("Disconnect Site", "structura")
      }
    },
    /* @__PURE__ */ window.wp.element.createElement(
      Xa,
      {
        className: "mt-4",
        label: window.wp.i18n.__("Permanently delete all data for this site", "structura"),
        description: window.wp.i18n.__(
          "Erases everything we store for this site — it can't be restored. If this is your only site, your shared personas, AI keys and presets are deleted too.",
          "structura"
        ),
        checked: purge,
        onChange: setPurge
      }
    )
  ));
};
const Tab = ({ to, icon, children }) => /* @__PURE__ */ window.wp.element.createElement(
  NavLink,
  {
    to,
    className: ({ isActive }) => B$1(
      "-mb-px inline-flex items-center gap-2 border-b-2 px-1 pb-3 text-sm font-medium transition-colors",
      isActive ? "border-brand-500 text-brand-600!" : "border-transparent text-neutral-500! hover:border-neutral-300 hover:text-neutral-800!"
    )
  },
  /* @__PURE__ */ window.wp.element.createElement("span", { "aria-hidden": "true", className: "inline-flex items-center" }, icon),
  children
);
const SiteSubNav = () => /* @__PURE__ */ window.wp.element.createElement(
  "nav",
  {
    "aria-label": window.wp.i18n.__("Site sections", "structura"),
    className: "flex flex-wrap items-center gap-6 border-b border-neutral-200"
  },
  /* @__PURE__ */ window.wp.element.createElement(Tab, { to: "/site/info", icon: /* @__PURE__ */ window.wp.element.createElement(Settings, { size: 14 }) }, window.wp.i18n.__("Info", "structura")),
  /* @__PURE__ */ window.wp.element.createElement(Tab, { to: "/site/competitors", icon: /* @__PURE__ */ window.wp.element.createElement(Users, { size: 14 }) }, window.wp.i18n.__("Competitors", "structura")),
  /* @__PURE__ */ window.wp.element.createElement(Tab, { to: "/site/referrals", icon: /* @__PURE__ */ window.wp.element.createElement(Link2, { size: 14 }) }, window.wp.i18n.__("Referral links", "structura")),
  /* @__PURE__ */ window.wp.element.createElement(Tab, { to: "/site/settings", icon: /* @__PURE__ */ window.wp.element.createElement(Search, { size: 14 }) }, window.wp.i18n.__("Settings", "structura"))
);
const LockedPanel = ({
  valueStatement,
  detail,
  intent = "unlock_keyword_bank",
  ctaLabel,
  children
}) => {
  const { plan } = useLicense();
  const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
  const upgradeHref2 = buildPortalSignupUrl({
    intent,
    domain,
    plan
  });
  const label = ctaLabel ?? window.wp.i18n.__("Unlock this feature", "structura");
  return (
    // CSS grid stacking — both children land in the same single cell
    // (col-start-1 / row-start-1) so the wrapper sizes itself to
    // whichever child is taller. This avoids the previous failure mode
    // where `absolute inset-0` made the overlay overflow visually when
    // the preview happened to be shorter than the overlay card (e.g.,
    // the Authority tab where the preview is a 2-stat dl while the
    // overlay carries an icon + heading + 2 lines + button).
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative grid" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        "aria-hidden": "true",
        className: "col-start-1 row-start-1 pointer-events-none opacity-30 select-none [filter:saturate(0.5)]"
      },
      children
    ), /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "col-start-1 row-start-1 flex items-center justify-center",
          // Inset padding so the lock card has breathing room and never
          // sits flush against the panel edges (it previously did on
          // every locked tab — Keywords/Competitors/Settings).
          "p-6 sm:p-10",
          // Subtle backdrop so the value statement reads cleanly against
          // whatever the preview happens to be.
          "bg-gradient-to-b from-white/20 to-white/80 backdrop-blur-[2px]",
          "dark:from-neutral-900/20 dark:to-neutral-900/80"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "max-w-md p-6 text-center shadow-lg" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-3 inline-flex items-center justify-center rounded-full bg-brand-50 p-3 dark:bg-brand-900/30" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { className: "h-5 w-5 text-brand-600 dark:text-brand-400", "aria-hidden": "true" })), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! mb-2! text-base font-semibold text-neutral-900 dark:text-neutral-100" }, valueStatement), detail ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-4! text-sm text-neutral-600 dark:text-neutral-400" }, detail) : null, /* @__PURE__ */ window.wp.element.createElement(
        "a",
        {
          href: upgradeHref2,
          target: "_blank",
          rel: "noopener noreferrer",
          className: "inline-flex items-center gap-2 rounded-md bg-brand-600 px-4 py-2 text-sm font-medium text-white! hover:bg-brand-700 focus:outline-none focus:ring-2 focus:ring-brand-500 focus:ring-offset-2"
        },
        label,
        /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14, "aria-hidden": "true" })
      ))
    ))
  );
};
const SitePanelHeader = ({
  title,
  description,
  action
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-col gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, title), description ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, description) : null), action ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "shrink-0" }, action) : null);
void window.wp.i18n.__;
const SitePageLayout = ({ children }) => /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Site", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__(
  "Everything Structura knows about this site — identity, keyword footprint, competitors, and refresh preferences.",
  "structura"
))), /* @__PURE__ */ window.wp.element.createElement(SiteSubNav, null), /* @__PURE__ */ window.wp.element.createElement("section", null, children));
const ROLE_OPTIONS = [
  { value: "about", label: window.wp.i18n.__("About", "structura") },
  { value: "features", label: window.wp.i18n.__("Features", "structura") },
  { value: "services", label: window.wp.i18n.__("Services", "structura") },
  { value: "pricing", label: window.wp.i18n.__("Pricing", "structura") },
  { value: "case_studies", label: window.wp.i18n.__("Case studies", "structura") },
  { value: "blog_index", label: window.wp.i18n.__("Blog index", "structura") },
  { value: "contact", label: window.wp.i18n.__("Contact", "structura") },
  { value: "other", label: window.wp.i18n.__("Other", "structura") }
];
const KeyPagesEditor = ({
  pages,
  onChange,
  max: max2 = 8,
  disabled = false
}) => {
  const updateAt = (index2, patch) => {
    onChange(
      pages.map((page, i2) => i2 === index2 ? { ...page, ...patch } : page)
    );
  };
  const removeAt = (index2) => {
    onChange(pages.filter((_2, i2) => i2 !== index2));
  };
  const addRow = () => {
    if (pages.length >= max2) return;
    onChange([...pages, { url: "", label: "", role: "other" }]);
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, pages.length === 0 && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "No key pages yet. Add the about, pricing, or features pages on your public site so Structura can link to them from new posts.",
    "structura"
  )), pages.map((page, index2) => /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      key: index2,
      className: "grid grid-cols-1 gap-2 rounded-xl border border-gray-200 p-3 sm:grid-cols-[2fr_1fr_auto_auto] dark:border-gray-800"
    },
    /* @__PURE__ */ window.wp.element.createElement(
      he,
      {
        type: "url",
        label: window.wp.i18n.__("URL", "structura"),
        hiddenLabel: true,
        placeholder: "https://example.com/about",
        value: page.url,
        onChange: (e2) => updateAt(index2, { url: e2.target.value }),
        disabled
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      he,
      {
        label: window.wp.i18n.__("Label", "structura"),
        hiddenLabel: true,
        placeholder: window.wp.i18n.__("About", "structura"),
        value: page.label,
        onChange: (e2) => updateAt(index2, { label: e2.target.value }),
        disabled
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      Zn,
      {
        options: ROLE_OPTIONS,
        value: page.role,
        onValueChange: (val) => updateAt(index2, { role: val }),
        size: "sm",
        disabled,
        className: "min-w-[140px]"
      },
      /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Content, null, ROLE_OPTIONS.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        variant: "transparent",
        size: "sm",
        onClick: () => removeAt(index2),
        disabled,
        "aria-label": window.wp.i18n.__("Remove key page", "structura")
      },
      /* @__PURE__ */ window.wp.element.createElement(Trash2, { className: "h-4 w-4" })
    )
  )), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: addRow,
      disabled: disabled || pages.length >= max2
    },
    /* @__PURE__ */ window.wp.element.createElement(Plus, { className: "mr-1.5 h-4 w-4" }),
    window.wp.i18n.__("Add page", "structura")
  ));
};
const QuickSetupConfirmModal = ({
  open,
  proposal,
  willOverwrite,
  loading,
  onApply,
  onClose
}) => {
  const handleApply = () => {
    if (proposal) onApply(proposal);
  };
  return /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open, onClose, size: "lg" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement(Y.Header, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "text-brand-500 h-5 w-5" }), /* @__PURE__ */ window.wp.element.createElement(Y.Title, null, window.wp.i18n.__("Quick setup proposals", "structura"))), /* @__PURE__ */ window.wp.element.createElement(Y.Description, null, window.wp.i18n.__(
    "Structura scraped your public website. Review what it found before applying — these values will be saved into the form, you can still edit them before clicking Save.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(Y.Body, null, loading && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-center py-8" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("Scraping your public site…", "structura"))), !loading && proposal && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, willOverwrite && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3 rounded-lg border border-amber-200 bg-amber-50 p-3 dark:border-amber-900/50 dark:bg-amber-900/20" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-600 dark:text-amber-400" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-800 dark:text-amber-200" }, window.wp.i18n.__(
    "Applying these proposals will replace your current description and key pages.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! mb-2 text-xs font-semibold tracking-wider text-gray-700 uppercase dark:text-gray-300" }, window.wp.i18n.__("Description", "structura")), proposal.description ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-lg border border-gray-200 bg-gray-50 p-3 text-sm text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300" }, proposal.description) : /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-gray-500 italic dark:text-gray-400" }, window.wp.i18n.__(
    "No description found on the page — you can write one manually.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h4", { className: "m-0! mb-2 text-xs font-semibold tracking-wider text-gray-700 uppercase dark:text-gray-300" }, window.wp.i18n.__("Key pages", "structura"), " ", /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-gray-400" }, "(", proposal.keyPages.length, ")")), proposal.keyPages.length > 0 ? /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0! list-none space-y-1.5 p-0!" }, proposal.keyPages.map((page, i2) => /* @__PURE__ */ window.wp.element.createElement(
    "li",
    {
      key: i2,
      className: "flex items-center justify-between gap-3 rounded-lg border border-gray-200 px-3 py-2 dark:border-gray-800"
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100" }, page.label), /* @__PURE__ */ window.wp.element.createElement("span", { className: "truncate text-xs text-gray-500 dark:text-gray-400" }, page.url)),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "rounded bg-gray-100 px-2 py-0.5 text-[10px] font-medium tracking-wider text-gray-600 uppercase dark:bg-gray-800 dark:text-gray-400" }, page.role.replace("_", " "))
  ))) : /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-gray-500 italic dark:text-gray-400" }, window.wp.i18n.__(
    "No nav links matched a known page type — you can add key pages manually.",
    "structura"
  ))))), /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: onClose, disabled: loading }, window.wp.i18n.__("Cancel", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: handleApply, disabled: loading || !proposal }, window.wp.i18n.__("Apply proposals", "structura")))));
};
const EMPTY_DRAFT = {
  publicUrl: "",
  isHeadless: false,
  description: "",
  keyPages: [],
  permalinkStrategy: "inherit",
  permalinkTemplate: "",
  defaultPermalinkLang: ""
};
const STRATEGY_OPTIONS = [
  { value: "inherit", label: window.wp.i18n.__("Inherit (use WP permalink)", "structura") },
  { value: "prefixSwap", label: window.wp.i18n.__("Prefix swap ({publicUrl}/{lang}/blog/{slug})", "structura") },
  { value: "template", label: window.wp.i18n.__("Custom template…", "structura") }
];
const BACKEND_PREFIXES = ["cms.", "wp.", "admin.", "backend.", "editor."];
function suggestPublicUrls(homeUrl) {
  if (!homeUrl) return [];
  let parsed;
  try {
    parsed = new URL(homeUrl);
  } catch {
    return [];
  }
  const host = parsed.hostname;
  const protocol = parsed.protocol === "http:" ? "http:" : "https:";
  const matchedPrefix = BACKEND_PREFIXES.find((p2) => host.startsWith(p2));
  if (!matchedPrefix) return [];
  const stripped = host.slice(matchedPrefix.length);
  if (stripped === "" || !stripped.includes(".")) {
    return [];
  }
  const out = [`${protocol}//${stripped}`];
  if (!stripped.startsWith("www.")) {
    out.push(`${protocol}//www.${stripped}`);
  }
  return out;
}
function chipLabel(url) {
  return url.replace(/^https?:\/\//i, "");
}
const PublicSiteCard = () => {
  const { data: profile, isLoading } = usePublicSiteProfile();
  const saveMutation = usePublicSiteProfileMutation();
  const quickSetup = useQuickSetup();
  const [draft, setDraft] = window.wp.element.useState(EMPTY_DRAFT);
  const [quickSetupOpen, setQuickSetupOpen] = window.wp.element.useState(false);
  const [proposal, setProposal] = window.wp.element.useState(null);
  window.wp.element.useEffect(() => {
    if (!profile) return;
    setDraft({
      publicUrl: profile.publicUrl,
      isHeadless: profile.isHeadless,
      description: profile.description,
      keyPages: profile.keyPages,
      permalinkStrategy: profile.permalinkStrategy,
      permalinkTemplate: profile.permalinkTemplate,
      defaultPermalinkLang: profile.defaultPermalinkLang
    });
  }, [profile]);
  const willOverwriteOnQuickSetup = window.wp.element.useMemo(
    () => draft.description !== "" || draft.keyPages.length > 0,
    [draft.description, draft.keyPages.length]
  );
  const handleChange = (key, value) => {
    setDraft((prev) => {
      const next = { ...prev, [key]: value };
      if (key === "isHeadless" && value === true && prev.permalinkStrategy === "inherit") {
        next.permalinkStrategy = "prefixSwap";
      }
      return next;
    });
  };
  const handleSave = async () => {
    try {
      await saveMutation.mutateAsync(draft);
    } catch {
    }
  };
  const urlSuggestions = window.wp.element.useMemo(
    () => suggestPublicUrls(profile?.homeUrl ?? ""),
    [profile?.homeUrl]
  );
  const handleQuickSetupClick = async () => {
    const urlToScrape = draft.publicUrl.trim();
    if (urlToScrape === "") return;
    setQuickSetupOpen(true);
    setProposal(null);
    try {
      const result = await quickSetup.mutateAsync(urlToScrape);
      setProposal(result.proposed);
    } catch (err) {
      const message = err?.message ?? window.wp.i18n.__("Quick setup failed. Try again or fill the fields manually.", "structura");
      An.error(message);
      setQuickSetupOpen(false);
    }
  };
  const handleApplyProposal = (p2) => {
    setDraft((prev) => ({
      ...prev,
      description: p2.description || prev.description,
      keyPages: p2.keyPages.length > 0 ? p2.keyPages : prev.keyPages,
      // Default strategy to prefixSwap when applying — the most common
      // headless setup. Operator can change after.
      permalinkStrategy: prev.permalinkStrategy === "inherit" ? "prefixSwap" : prev.permalinkStrategy
    }));
    setQuickSetupOpen(false);
    An.success(window.wp.i18n.__("Proposals applied. Review and click Save.", "structura"));
  };
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "h-5 w-5 animate-spin" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("Loading public website settings…", "structura"))));
  }
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Globe, { className: "text-brand-500 h-5 w-5" }), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold tracking-wider text-gray-900 uppercase dark:text-white" }, window.wp.i18n.__("Public website", "structura"))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: handleSave, disabled: saveMutation.isPending, size: "sm" }, saveMutation.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Save, { className: "mr-2 h-4 w-4" }), window.wp.i18n.__("Save", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("My public website lives elsewhere (headless mode)", "structura"),
      description: window.wp.i18n.__(
        "Turn this on if your readers visit a different website (e.g. xerx.io) and this WordPress install only stores content. Off by default — Structura assumes WordPress IS the public website.",
        "structura"
      ),
      checked: draft.isHeadless,
      onChange: (val) => handleChange("isHeadless", val)
    }
  )), !draft.isHeadless && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! rounded-lg bg-gray-50 p-3 text-xs text-gray-600 dark:bg-gray-900 dark:text-gray-400" }, window.wp.i18n.__(
    "Inherits everything from this WordPress install — site title, tagline, logo, and post URLs.",
    "structura"
  )), draft.isHeadless && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6 border-t border-gray-200 pt-6 dark:border-gray-800" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Public website URL", "structura"),
      type: "url",
      placeholder: "https://example.com",
      value: draft.publicUrl,
      onChange: (e2) => handleChange("publicUrl", e2.target.value)
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1.5 mb-0! text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("The URL readers actually visit. No trailing slash needed.", "structura")), urlSuggestions.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 flex flex-wrap items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__("Try:", "structura")), urlSuggestions.map((suggestion) => /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: suggestion,
      type: "button",
      onClick: () => handleChange("publicUrl", suggestion),
      className: "hover:border-brand-500 hover:bg-brand-50 hover:text-brand-700 dark:hover:border-brand-400 dark:hover:bg-brand-900/20 dark:hover:text-brand-300 inline-flex items-center rounded-full border border-gray-300 bg-white px-2.5 py-0.5 text-xs text-gray-700 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300",
      "aria-label": window.wp.i18n.sprintf(
        // translators: %s is a public-URL suggestion (e.g. "xerx.io")
        window.wp.i18n.__("Use %s", "structura"),
        chipLabel(suggestion)
      )
    },
    chipLabel(suggestion)
  )))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-dashed border-gray-300 p-4 dark:border-gray-700" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "max-w-xl" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-gray-700 dark:text-gray-300" }, window.wp.i18n.__("Scrape & auto-fill", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Visits the URL above, reads the homepage and nav, and proposes description + key pages. Review before saving.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: handleQuickSetupClick,
      disabled: quickSetup.isPending || draft.publicUrl.trim() === ""
    },
    quickSetup.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "mr-1.5 h-4 w-4 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "mr-1.5 h-4 w-4" }),
    window.wp.i18n.__("Auto-fill from this URL", "structura")
  ))), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Description", "structura"),
      placeholder: window.wp.i18n.__("A short paragraph describing what your site is for…", "structura"),
      rows: 3,
      maxLength: 600,
      value: draft.description,
      onChange: (e2) => handleChange("description", e2.target.value)
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1.5 mb-0! text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Optional brand summary used as a fallback when AI grounding can't reach your homepage. ≤ 600 characters.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-1.5! text-sm font-medium text-gray-700 dark:text-gray-300" }, window.wp.i18n.__("Key pages", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-3 text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "High-value non-blog pages used for internal links and AI context. Up to 8 entries.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(
    KeyPagesEditor,
    {
      pages: draft.keyPages,
      onChange: (keyPages) => handleChange("keyPages", keyPages)
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement("div", null, (() => {
    const visibleOptions = STRATEGY_OPTIONS.filter((opt) => opt.value !== "inherit");
    return /* @__PURE__ */ window.wp.element.createElement(
      Zn,
      {
        value: draft.permalinkStrategy,
        onValueChange: (val) => handleChange("permalinkStrategy", val),
        options: visibleOptions
      },
      /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Post URL pattern", "structura")),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
      /* @__PURE__ */ window.wp.element.createElement(Zn.Content, null, visibleOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
    );
  })()), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Default language for URLs", "structura"),
      placeholder: "en",
      value: draft.defaultPermalinkLang,
      onChange: (e2) => handleChange("defaultPermalinkLang", e2.target.value)
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1.5 mb-0! text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Used when {lang} is in the URL pattern. Defaults to the WP site language.",
    "structura"
  )))), draft.permalinkStrategy === "template" && /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Custom template", "structura"),
      placeholder: "/{lang}/blog/{slug}",
      value: draft.permalinkTemplate,
      onChange: (e2) => handleChange("permalinkTemplate", e2.target.value)
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1.5 mb-0! text-xs text-gray-500 dark:text-gray-400" }, window.wp.i18n.__(
    "Tokens: {slug}, {lang}, {year}, {month}. Anchored against your public URL unless the template starts with https://.",
    "structura"
  )))), /* @__PURE__ */ window.wp.element.createElement(
    QuickSetupConfirmModal,
    {
      open: quickSetupOpen,
      proposal,
      willOverwrite: willOverwriteOnQuickSetup,
      loading: quickSetup.isPending,
      onApply: handleApplyProposal,
      onClose: () => setQuickSetupOpen(false)
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-6 border-t border-neutral-200 pt-4 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: docsUrl("using/headless-mode"),
      target: "_blank",
      rel: "noopener noreferrer",
      className: "inline-flex items-center gap-1 text-xs text-gray-500 underline-offset-2 hover:text-gray-700 hover:underline dark:text-gray-400 dark:hover:text-gray-200"
    },
    window.wp.i18n.__("Read the headless-mode guide", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3 w-3" })
  )));
};
const SiteIntelligencePanel = () => {
  const query = useSiteAnalysisQuery();
  const analyze = useAnalyzeSiteMutation();
  const domain = query.data?.domain;
  const capturedAt = query.data?.capturedAt ?? null;
  const ranAnalysis = capturedAt !== null;
  const hasNamedCategory = !!domain?.categories.some((c2) => !/^\d+$/.test(c2));
  const hasNicheData = !!domain && (hasNamedCategory || domain.niche.length > 0 || domain.rankingKeywordCount !== void 0 || domain.topRankingCount !== void 0 || domain.estimatedTrafficValue !== void 0 || domain.authorityScore !== void 0);
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-6 p-6" }, /* @__PURE__ */ window.wp.element.createElement(
    SitePanelHeader,
    {
      title: window.wp.i18n.__("Site intelligence", "structura"),
      description: ranAnalysis ? window.wp.i18n.__(
        "Detected niche + authority signals. Refreshed monthly.",
        "structura"
      ) : window.wp.i18n.__(
        "Detect your site's niche and authority baseline.",
        "structura"
      ),
      action: /* @__PURE__ */ window.wp.element.createElement(
        tr$1,
        {
          variant: ranAnalysis ? "transparent" : "primary",
          size: "sm",
          onClick: () => analyze.mutate(),
          disabled: analyze.isPending
        },
        analyze.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-2 animate-spin" }) : ranAnalysis ? /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-2" }) : /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14, className: "mr-2" }),
        analyze.isPending ? window.wp.i18n.__("Analyzing…", "structura") : ranAnalysis ? window.wp.i18n.__("Refresh", "structura") : window.wp.i18n.__("Analyze my site", "structura")
      )
    }
  ), ranAnalysis && domain && hasNicheData ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "m-0! text-xs uppercase tracking-wider text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Detected niche", "structura")), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "m-0! mt-1! flex items-center gap-2 text-sm font-medium text-neutral-900 dark:text-neutral-100" }, /* @__PURE__ */ window.wp.element.createElement(Tag, { size: 14, className: "text-brand-500" }), domain.niche || window.wp.i18n.__("Unclassified", "structura")), (() => {
    const named = domain.categories.filter((c2) => !/^\d+$/.test(c2));
    if (named.length === 0) return null;
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 flex flex-wrap gap-1.5" }, named.slice(0, 3).map((cat) => /* @__PURE__ */ window.wp.element.createElement(Me, { key: cat, intent: "info" }, cat)), named.length > 3 ? /* @__PURE__ */ window.wp.element.createElement(ce, { title: named.slice(3).join(", ") }, /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "default" }, "+", named.length - 3)) : null);
  })()), domain.authorityScore !== void 0 ? /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "m-0! text-xs uppercase tracking-wider text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Authority score", "structura")), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "m-0! mt-1! flex items-center gap-2 text-2xl font-semibold text-neutral-900 dark:text-neutral-100" }, /* @__PURE__ */ window.wp.element.createElement(Award, { size: 16, className: "text-brand-500" }), domain.authorityScore)) : domain.rankingKeywordCount !== void 0 ? /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "m-0! text-xs uppercase tracking-wider text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Ranking keywords", "structura")), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "m-0! mt-1! flex items-center gap-2 text-2xl font-semibold text-neutral-900 dark:text-neutral-100" }, /* @__PURE__ */ window.wp.element.createElement(Award, { size: 16, className: "text-brand-500" }), domain.rankingKeywordCount.toLocaleString())) : null) : null, ranAnalysis && !hasNicheData ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-md border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-900/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-700 dark:text-amber-300" }, window.wp.i18n.__(
    "Analysis ran, but no public search data is available for this domain yet. Common for new sites, low-traffic domains, or sites Google hasn't indexed recently.",
    "structura"
  )), query.data?.analyzedUrl ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-2! text-xs text-amber-700 dark:text-amber-300" }, window.wp.i18n.__("Analyzed:", "structura"), " ", /* @__PURE__ */ window.wp.element.createElement("code", { className: "font-mono" }, query.data.analyzedUrl), query.data.analyzedUrlSource === "publicUrl" ? " " + window.wp.i18n.__("(headless override from Site → Info)", "structura") : query.data.analyzedUrlSource === "homeUrl" ? " " + window.wp.i18n.__("(WordPress home URL)", "structura") : null) : null) : null, query.data?.reason === "unsupported_locale" && !ranAnalysis ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-600 dark:text-amber-400" }, window.wp.i18n.__(
    "Enhanced data isn't available for this site's language yet.",
    "structura"
  )) : null);
};
const SiteInfoTab = () => {
  const { isPaidLicense } = useLicense();
  return /* @__PURE__ */ window.wp.element.createElement(SitePageLayout, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(PublicSiteCard, null), isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(PositioningCard, null) : null, isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(SiteIntelligencePanel, null) : null));
};
const AiGuessNotice = ({ message }) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-2.5 rounded-md border border-brand-200 bg-brand-50 px-4 py-3 dark:border-brand-900/40 dark:bg-brand-950/20" }, /* @__PURE__ */ window.wp.element.createElement(
  Sparkles,
  {
    size: 15,
    className: "mt-0.5 shrink-0 text-brand-500 dark:text-brand-400",
    "aria-hidden": "true"
  }
), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs leading-relaxed text-brand-800 dark:text-brand-200" }, message));
function sameSet(a3, b2) {
  if (a3.length !== b2.length) return false;
  const sb = new Set(b2);
  return a3.every((x2) => sb.has(x2));
}
function useDraftList(serverValue) {
  const [draft, setDraft] = window.wp.element.useState(serverValue);
  const lastServerRef = window.wp.element.useRef(serverValue);
  window.wp.element.useEffect(() => {
    if (sameSet(serverValue, lastServerRef.current)) return;
    const wasDirty = !sameSet(draft, lastServerRef.current);
    lastServerRef.current = serverValue;
    if (!wasDirty) setDraft(serverValue);
  }, [serverValue, draft]);
  const add = (item) => setDraft((prev) => prev.includes(item) ? prev : [...prev, item]);
  const addMany = (items) => setDraft((prev) => {
    const next = [...prev];
    for (const it2 of items) if (!next.includes(it2)) next.push(it2);
    return next;
  });
  const remove = (item) => setDraft((prev) => prev.filter((x2) => x2 !== item));
  return { value: draft, dirty: !sameSet(draft, serverValue), add, addMany, remove };
}
function hostOf(raw) {
  try {
    return new URL(raw.startsWith("http") ? raw : `https://${raw}`).hostname.replace(
      /^www\./,
      ""
    );
  } catch {
    return raw.replace(/^www\./, "");
  }
}
const COMPETITOR_URLS_MAX = 25;
function normaliseInput(raw) {
  const trimmed = raw.trim();
  if (!trimmed) return null;
  try {
    const candidate = trimmed.startsWith("http") ? trimmed : `https://${trimmed}`;
    return new URL(candidate).toString();
  } catch {
    return null;
  }
}
function suggestionToConfirmedUrl(domain) {
  try {
    return new URL(`https://${domain}`).toString();
  } catch {
    return `https://${domain}/`;
  }
}
const CompetitorsPreview = () => /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-4 p-6" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Competitor map", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
  "Tell us who you compete with and we'll surface the keywords they rank for that you don't — straight into your next campaign's keyword bank.",
  "structura"
)), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "space-y-2 text-sm text-neutral-700 dark:text-neutral-300" }, /* @__PURE__ */ window.wp.element.createElement("li", { className: "flex items-center justify-between gap-4 border-b border-neutral-100 pb-2 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__("competitor-a.example", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-400" }, window.wp.i18n.__("Example", "structura"))), /* @__PURE__ */ window.wp.element.createElement("li", { className: "flex items-center justify-between gap-4 pb-2" }, /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__("competitor-b.example", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-400" }, window.wp.i18n.__("Example", "structura")))));
const CompetitorsEditor = () => {
  const query = useSiteAnalysisQuery();
  const analyze = useAnalyzeSiteMutation();
  const update = useUpdateSiteSeoSettingsMutation();
  const [error, setError] = window.wp.element.useState(null);
  const serverUrls = query.data?.seoIntelSettings?.competitorUrls ?? [];
  const suggestions = query.data?.suggestedCompetitors ?? [];
  const ranAnalysis = (query.data?.capturedAt ?? null) !== null;
  const {
    value: confirmedUrls,
    dirty,
    add: addToDraft,
    addMany,
    remove
  } = useDraftList(serverUrls);
  const atCap = confirmedUrls.length >= COMPETITOR_URLS_MAX;
  const remaining = COMPETITOR_URLS_MAX - confirmedUrls.length;
  const save = () => update.mutate({ competitorUrls: confirmedUrls });
  const adoptedHosts = new Set(
    confirmedUrls.map((u2) => {
      try {
        return new URL(u2).hostname;
      } catch {
        return u2;
      }
    }).map((h4) => h4.replace(/^www\./, ""))
  );
  const availableSuggestions = suggestions.filter(
    (s2) => !adoptedHosts.has(s2.domain.replace(/^www\./, ""))
  );
  const positioningQuery = useWizardPositioningQuery();
  const suggestAi = useSuggestWizardCompetitorsMutation();
  const [aiSuggestions, setAiSuggestions] = window.wp.element.useState([]);
  const runAiSuggest = async () => {
    const p2 = positioningQuery.data?.positioning;
    try {
      const res = await suggestAi.mutateAsync({
        positioning: p2 ? { what: p2.what, who: p2.who, problem: p2.problem } : void 0,
        excludeDomains: confirmedUrls.map(hostOf)
      });
      setAiSuggestions(res.suggestions);
    } catch {
    }
  };
  const availableAiSuggestions = aiSuggestions.filter(
    (s2) => !adoptedHosts.has(hostOf(s2.domain))
  );
  const showAi = availableSuggestions.length === 0 && availableAiSuggestions.length > 0;
  const addAllAi = () => addMany(
    availableAiSuggestions.slice(0, remaining).map((s2) => suggestionToConfirmedUrl(s2.domain))
  );
  const capMessage = window.wp.i18n.sprintf(
    window.wp.i18n.__("Maximum of %d competitor URLs reached.", "structura"),
    COMPETITOR_URLS_MAX
  );
  const addAllSuggestions = () => {
    addMany(
      availableSuggestions.slice(0, remaining).map((s2) => suggestionToConfirmedUrl(s2.domain))
    );
  };
  const suggestedItems = availableSuggestions.length > 0 ? availableSuggestions.map((s2) => ({
    value: suggestionToConfirmedUrl(s2.domain),
    label: hostOf(s2.domain),
    count: s2.intersections
  })) : showAi ? availableAiSuggestions.map((s2) => ({
    value: suggestionToConfirmedUrl(s2.domain),
    label: hostOf(s2.domain),
    tooltip: s2.rationale || void 0
  })) : [];
  const onAddSuggested = (value) => {
    if (atCap) {
      setError(capMessage);
      return;
    }
    addToDraft(value);
  };
  const onAddManual = (raw) => {
    const normalised = normaliseInput(raw);
    if (!normalised) {
      setError(window.wp.i18n.__("Enter a valid URL or domain.", "structura"));
      return false;
    }
    if (confirmedUrls.includes(normalised)) {
      setError(window.wp.i18n.__("That URL is already in the list.", "structura"));
      return false;
    }
    if (atCap) {
      setError(capMessage);
      return false;
    }
    addToDraft(normalised);
    setError(null);
    return true;
  };
  const suggestedNotice = showAi ? /* @__PURE__ */ window.wp.element.createElement(
    AiGuessNotice,
    {
      message: window.wp.i18n.__(
        "We couldn't find SERP-measured competitors for your domain yet (common for new or low-traffic sites), so these are AI suggestions based on what you do. Re-discover once your site is indexed to swap in measured data.",
        "structura"
      )
    }
  ) : ranAnalysis && availableSuggestions.length === 0 && suggestAi.isPending ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 text-xs text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "animate-spin" }), window.wp.i18n.__("No SERP data yet — asking AI for likely competitors…", "structura")) : ranAnalysis && availableSuggestions.length === 0 && availableAiSuggestions.length === 0 && !suggestAi.isPending ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-700 dark:text-amber-300" }, window.wp.i18n.__(
    "Analysis ran, but no SERP competitors were found for this domain yet. Common for new sites with limited ranking footprint. Re-discover after you've published more content.",
    "structura"
  )) : void 0;
  if (query.isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-6 p-6" }, /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading competitors…", "structura"), size: "md" }));
  }
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-6 p-6" }, /* @__PURE__ */ window.wp.element.createElement(
    SitePanelHeader,
    {
      title: window.wp.i18n.__("Your competitors", "structura"),
      description: window.wp.i18n.__(
        "Used at every campaign creation to mine gap-keyword opportunities — terms they rank for that you don't.",
        "structura"
      ),
      action: /* @__PURE__ */ window.wp.element.createElement(
        tr$1,
        {
          variant: "primary",
          size: "sm",
          onClick: save,
          disabled: !dirty || update.isPending
        },
        update.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Save, { size: 14, className: "mr-1.5" }),
        window.wp.i18n.__("Save", "structura")
      )
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    Bn,
    {
      kind: "domain",
      labels: {
        remove: (l2) => window.wp.i18n.sprintf(window.wp.i18n.__("Remove %s", "structura"), l2),
        addAll: window.wp.i18n.__("Add all", "structura"),
        add: window.wp.i18n.__("Add", "structura")
      },
      ariaLabel: window.wp.i18n.__("Competitor URLs", "structura"),
      added: confirmedUrls.map((url) => ({ value: url, label: hostOf(url) })),
      suggested: suggestedItems,
      onAdd: onAddSuggested,
      onRemove: remove,
      onAddAll: suggestedItems.length > 0 ? availableSuggestions.length > 0 ? addAllSuggestions : addAllAi : void 0,
      onDiscover: () => analyze.mutate(void 0, {
        // Manual re-discover only: run the fresh DFS pass, and fall back
        // to AI-guessed peers when DFS surfaced no SERP competitors.
        onSuccess: (data) => {
          const dfsHits = (data?.suggestedCompetitors ?? []).filter(
            (s2) => !adoptedHosts.has(s2.domain.replace(/^www\./, ""))
          );
          if (dfsHits.length === 0) void runAiSuggest();
        }
      }),
      discoverLabel: analyze.isPending ? window.wp.i18n.__("Analyzing…", "structura") : ranAnalysis ? window.wp.i18n.__("Re-discover", "structura") : window.wp.i18n.__("Discover", "structura"),
      discovering: analyze.isPending,
      discoverPrimary: !ranAnalysis,
      suggestedLabel: window.wp.i18n.__("Auto-detected from your site", "structura"),
      suggestedNotice,
      emptyText: window.wp.i18n.__(
        "No competitors confirmed yet. Adopt a suggestion above, or add one manually below.",
        "structura"
      ),
      inputPlaceholder: window.wp.i18n.__(
        "competitor.com or https://competitor.com/blog",
        "structura"
      ),
      onAddManual,
      addManualError: error,
      disabled: atCap
    }
  ));
};
const SiteCompetitorsTab = () => {
  const { isPaidLicense } = useLicense();
  if (!isPaidLicense) {
    return /* @__PURE__ */ window.wp.element.createElement(SitePageLayout, null, /* @__PURE__ */ window.wp.element.createElement(
      LockedPanel,
      {
        valueStatement: window.wp.i18n.__(
          "Find the keywords your competitors rank for — that you don't.",
          "structura"
        ),
        detail: window.wp.i18n.__(
          "Add competitor URLs and Structura surfaces the gap-keyword opportunities they're winning, ready for your next campaign.",
          "structura"
        ),
        intent: "unlock_keyword_bank"
      },
      /* @__PURE__ */ window.wp.element.createElement(CompetitorsPreview, null)
    ));
  }
  return /* @__PURE__ */ window.wp.element.createElement(SitePageLayout, null, /* @__PURE__ */ window.wp.element.createElement(CompetitorsEditor, null));
};
const ReferralLinksEditorSection = () => {
  const query = useSiteAnalysisQuery();
  const update = useUpdateSiteSeoSettingsMutation();
  const saved = query.data?.seoIntelSettings?.referralLinks ?? [];
  const savedKey = JSON.stringify(saved);
  const [value, setValue] = window.wp.element.useState(saved);
  window.wp.element.useEffect(() => {
    setValue(query.data?.seoIntelSettings?.referralLinks ?? []);
  }, [savedKey]);
  const dirty = JSON.stringify(value) !== savedKey;
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-4 p-6" }, /* @__PURE__ */ window.wp.element.createElement(
    Un,
    {
      binding: "site",
      value,
      onChange: setValue,
      labels: buildReferralLabels()
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end gap-3" }, dirty && /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-400" }, window.wp.i18n.__("Unsaved changes", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      onClick: () => update.mutate({ referralLinks: value }),
      disabled: !dirty,
      loading: update.isPending
    },
    /* @__PURE__ */ window.wp.element.createElement(Save, { size: 14 }),
    window.wp.i18n.__("Save", "structura")
  )));
};
const ReferralsPreview = () => /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-4 p-6" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Referral links", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
  "Your tracking links, woven into topically-relevant posts with AI-written anchor text.",
  "structura"
)), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "space-y-2 text-sm text-neutral-700 dark:text-neutral-300" }, /* @__PURE__ */ window.wp.element.createElement("li", { className: "flex items-center justify-between gap-4 border-b border-neutral-100 pb-2 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__("TrailPass Pro", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-400" }, "trailpass.example/ref")), /* @__PURE__ */ window.wp.element.createElement("li", { className: "flex items-center justify-between gap-4 pb-2" }, /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__("Summit Gear", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-400" }, "summitgear.example/aff"))));
const SiteReferralsTab = () => {
  const { isPaidLicense } = useLicense();
  if (!isPaidLicense) {
    return /* @__PURE__ */ window.wp.element.createElement(SitePageLayout, null, /* @__PURE__ */ window.wp.element.createElement(
      LockedPanel,
      {
        valueStatement: window.wp.i18n.__(
          "Weave your affiliate and partner links into every relevant post.",
          "structura"
        ),
        detail: window.wp.i18n.__(
          "Add your tracking URLs once and Structura places the right one into topically-matched posts — with AI-written anchor text.",
          "structura"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(ReferralsPreview, null)
    ));
  }
  return /* @__PURE__ */ window.wp.element.createElement(SitePageLayout, null, /* @__PURE__ */ window.wp.element.createElement(ReferralLinksEditorSection, null));
};
const SettingsPreview = () => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-6" }, /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-3 p-6" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Monthly digest", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
  "Get a once-a-month summary of new keyword opportunities Structura found for your site. Off by default — opt in below.",
  "structura"
))), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-3 p-6" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Budget remaining", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
  "Live data and refreshes consume your workspace's monthly SEO budget. We'll surface usage here once your first refresh runs.",
  "structura"
))));
const SettingsLive = () => {
  const query = useSiteAnalysisQuery();
  const analyze = useAnalyzeSiteMutation();
  const update = useUpdateSiteSeoSettingsMutation();
  const settings = query.data?.seoIntelSettings;
  const capturedAt = query.data?.capturedAt ?? null;
  const digestOn = settings?.emailDigestOptIn ?? false;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-6" }, /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-4 p-6" }, /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Monthly digest email", "structura"),
      description: window.wp.i18n.__(
        "Once-a-month email summarising new keyword opportunities Structura found for your site. Off by default.",
        "structura"
      ),
      checked: digestOn,
      onChange: (checked) => {
        update.mutate({ emailDigestOptIn: checked });
      },
      disabled: update.isPending
    }
  )), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-4 p-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start justify-between gap-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-col gap-2" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Last refresh", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, capturedAt ? window.wp.i18n.__("Most recent SEO intelligence run for this site.", "structura") : window.wp.i18n.__("This site hasn't been analyzed yet.", "structura")), capturedAt ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-medium text-neutral-900 dark:text-neutral-100" }, new Date(capturedAt).toLocaleString()) : null), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: () => analyze.mutate(),
      disabled: analyze.isPending
    },
    analyze.isPending ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }),
    capturedAt ? window.wp.i18n.__("Refresh now", "structura") : window.wp.i18n.__("Run now", "structura")
  ))), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "flex flex-col gap-3 p-6" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold uppercase tracking-wider text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Budget remaining", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Live data and refreshes consume your workspace's monthly SEO budget. Per-workspace usage tracking lands in the next release.",
    "structura"
  ))));
};
const SiteSettingsTab = () => {
  const { isPaidLicense } = useLicense();
  return /* @__PURE__ */ window.wp.element.createElement(SitePageLayout, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-6" }, isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(SettingsLive, null) : /* @__PURE__ */ window.wp.element.createElement(
    LockedPanel,
    {
      valueStatement: window.wp.i18n.__(
        "Tune your SEO intelligence refresh.",
        "structura"
      ),
      detail: window.wp.i18n.__(
        "Opt in to the monthly digest, control refresh cadence, and watch your workspace budget — all from one place.",
        "structura"
      ),
      intent: "unlock_keyword_bank"
    },
    /* @__PURE__ */ window.wp.element.createElement(SettingsPreview, null)
  ), /* @__PURE__ */ window.wp.element.createElement(RestartWizardCard, null)));
};
const LicenseStatusBanner = () => {
  const { isPaidLicense, status, plan } = useLicense();
  if (!isPaidLicense || ["none", "active"].includes(status)) {
    return null;
  }
  const config = {
    past_due: {
      variant: "warning",
      icon: /* @__PURE__ */ window.wp.element.createElement(CreditCard, null),
      title: window.wp.i18n.__("Payment Required", "structura"),
      description: window.wp.i18n.__(
        "We couldn't process your last subscription payment. Please update your billing information to avoid service interruption.",
        "structura"
      ),
      actionLabel: window.wp.i18n.__("Update Billing", "structura")
    },
    expired: {
      variant: "error",
      icon: /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, null),
      title: window.wp.i18n.__("License Expired", "structura"),
      description: window.wp.i18n.__(
        "Your Pro features are currently locked. Renew your subscription to resume AI synthesis and campaign scheduling.",
        "structura"
      ),
      actionLabel: window.wp.i18n.__("Renew License", "structura")
    },
    canceled: {
      variant: "error",
      icon: /* @__PURE__ */ window.wp.element.createElement(CircleX, null),
      title: window.wp.i18n.__("Subscription Canceled", "structura"),
      description: window.wp.i18n.__(
        "Your subscription has been canceled. You can still access your data, but Pro features are disabled.",
        "structura"
      ),
      actionLabel: window.wp.i18n.__("View Plans", "structura")
    },
    revoked: {
      variant: "error",
      icon: /* @__PURE__ */ window.wp.element.createElement(CircleX, null),
      title: window.wp.i18n.__("License Revoked", "structura"),
      description: window.wp.i18n.__(
        "This license has been disabled due to a security flag or refund. Contact support if you believe this is an error.",
        "structura"
      ),
      actionLabel: window.wp.i18n.__("Contact Support", "structura")
    }
  };
  const current = config[status] || config.expired;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: current.variant }, current.icon, /* @__PURE__ */ window.wp.element.createElement($n.Title, null, current.title), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, current.description), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", asChild: true }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildPortalSignupUrl({
        intent: "manage_account",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    current.actionLabel,
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14 })
  )))));
};
const SiteNotConnectedBanner = () => {
  const { hasUsableLicense } = useLicense();
  const queryClient2 = useQueryClient();
  const [forgetOpen, setForgetOpen] = window.wp.element.useState(false);
  const [forgetKey, setForgetKey] = window.wp.element.useState("");
  const [forgetting, setForgetting] = window.wp.element.useState(false);
  if (hasUsableLicense !== false) return null;
  const hadPriorActivation = typeof window !== "undefined" ? window.structuraConfig?.had_prior_activation ?? true : true;
  if (!hadPriorActivation) return null;
  const handleForgetSite = async (event) => {
    event.preventDefault();
    if (!forgetKey.trim() || forgetting) return;
    setForgetting(true);
    try {
      await window.wp.apiFetch({
        path: "/structura/v1/license/forget-site",
        method: "POST",
        data: { key: forgetKey.trim() }
      });
      if (typeof window !== "undefined" && window.structuraConfig) {
        window.structuraConfig.had_prior_activation = false;
      }
      An.success(window.wp.i18n.__("Site removed from your activations.", "structura"));
      setForgetOpen(false);
      setForgetKey("");
      queryClient2.invalidateQueries();
    } catch (err) {
      const message = err instanceof Error ? err.message : window.wp.i18n.__("Could not remove this site. Please try again.", "structura");
      An.error(message);
    } finally {
      setForgetting(false);
    }
  };
  return /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(Link, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("This site isn't connected", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, window.wp.i18n.__(
    "Structura needs an active license to fetch campaigns, runs, personas, and integrations. Connect this site from the Account page to bring everything back.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", asChild: true }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/account" }, window.wp.i18n.__("Connect this site", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      variant: "transparent",
      onClick: () => setForgetOpen(true)
    },
    window.wp.i18n.__("Forget this site", "structura")
  )))), /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open: forgetOpen, onClose: () => forgetting ? void 0 : setForgetOpen(false) }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, null, /* @__PURE__ */ window.wp.element.createElement("form", { onSubmit: handleForgetSite }, /* @__PURE__ */ window.wp.element.createElement(Y.Header, null, /* @__PURE__ */ window.wp.element.createElement(Y.Title, null, window.wp.i18n.__("Forget this site?", "structura")), /* @__PURE__ */ window.wp.element.createElement(Y.Description, null, window.wp.i18n.__(
    "This permanently removes this site's activation from your Structura account, including its campaigns, runs, and connection secrets. Re-enter your license key to confirm.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(Y.Body, null, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("License key", "structura"),
      value: forgetKey,
      onChange: (e2) => setForgetKey(e2.target.value),
      autoComplete: "off",
      autoFocus: true,
      required: true,
      disabled: forgetting
    }
  )), /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      type: "button",
      variant: "transparent",
      onClick: () => setForgetOpen(false),
      disabled: forgetting
    },
    window.wp.i18n.__("Cancel", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { type: "submit", variant: "danger", disabled: forgetting || !forgetKey.trim() }, forgetting ? window.wp.i18n.__("Removing…", "structura") : window.wp.i18n.__("Forget this site", "structura")))))));
};
const DisconnectedProvidersBanner = () => {
  const navigate = useNavigate();
  const { plan, hasWorkspace } = useLicense();
  const {
    activeProviders,
    isLoading: loadingAi,
    isFetching: fetchingAi
  } = useAiConnections();
  const { data: campaigns, isLoading: loadingCampaigns } = useCampaignsQuery();
  if (isManagedPlan(plan)) return null;
  if (hasWorkspace !== true) return null;
  if (loadingAi || fetchingAi || loadingCampaigns) return null;
  const hasProviders = activeProviders.length > 0;
  if (hasProviders) return null;
  const activeCampaigns = (campaigns ?? []).filter((c2) => c2.status === "active");
  const hasActiveCampaigns = activeCampaigns.length > 0;
  if (hasActiveCampaigns) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "error" }, /* @__PURE__ */ window.wp.element.createElement(CircleX, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Campaign Generation Blocked", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, window.wp.i18n.sprintf(
      window.wp.i18n.__(
        "You have %d active campaign(s) but no AI providers connected. Scheduled posts cannot be generated until you reconnect at least one provider.",
        "structura"
      ),
      activeCampaigns.length
    )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", onClick: () => navigate("/ai-engine") }, window.wp.i18n.__("Reconnect Now", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-2", strokeWidth: 2 })))));
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Connect Your AI Engine", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, window.wp.i18n.__(
    "Add an AI provider to start generating content. Without one, post generation and image creation are disabled.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", onClick: () => navigate("/ai-engine") }, window.wp.i18n.__("Connect Provider", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14 })))));
};
const CycleQuotaBanner = () => {
  const navigate = useNavigate();
  const { data: usageData, isLoading } = useUsageAnalytics();
  if (isLoading) return null;
  const cycle = usageData?.cycleUsage;
  if (!cycle || cycle.kind !== "managed") return null;
  const usage = selectOwnActivationUsage(
    cycle,
    typeof window !== "undefined" ? window.structuraConfig?.activation_id : void 0
  ) ?? cycle.workspace;
  const isOverQuota = usage.utilizationPercent >= 100 || usage.tokensUsed > usage.tokensIncluded;
  const isApproaching = !isOverQuota && usage.utilizationPercent >= 80;
  if (!isOverQuota && !isApproaching) return null;
  if (isOverQuota) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(TrendingUp, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Cycle quota reached", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, window.wp.i18n.sprintf(
      /* translators: 1: tokens used (compact e.g. "1.2M"), 2: tokens included. */
      window.wp.i18n.__(
        "This site has used %1$s of its %2$s included tokens. Generation is paused until the cycle resets — upgrade to keep posting.",
        "structura"
      ),
      formatTokens(usage.tokensUsed),
      formatTokens(usage.tokensIncluded)
    )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", onClick: () => navigate("/") }, window.wp.i18n.__("View usage", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14 })))));
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "info" }, /* @__PURE__ */ window.wp.element.createElement(Gauge, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Approaching cycle quota", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, window.wp.i18n.sprintf(
    /* translators: 1: utilisation percent, 2: tokens used, 3: tokens included. */
    window.wp.i18n.__(
      "This site has used %1$d%% of its cycle token budget (%2$s of %3$s). Generation pauses once the included amount is used up.",
      "structura"
    ),
    Math.round(usage.utilizationPercent),
    formatTokens(usage.tokensUsed),
    formatTokens(usage.tokensIncluded)
  )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", onClick: () => navigate("/") }, window.wp.i18n.__("View usage", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14 })))));
};
function formatTokens(n2) {
  if (n2 >= 1e6) {
    return (n2 / 1e6).toFixed(n2 >= 1e7 ? 0 : 1).replace(/\.0$/, "") + "M";
  }
  if (n2 >= 1e3) {
    return (n2 / 1e3).toFixed(n2 >= 1e4 ? 0 : 1).replace(/\.0$/, "") + "K";
  }
  return n2.toLocaleString();
}
function currentHostname() {
  return typeof window !== "undefined" ? window.location.hostname : "";
}
const DomainMismatchAdvisory = ({ hostname }) => {
  const { isActivationValid } = useLicense();
  if (isActivationValid !== false) return null;
  const host = hostname ?? currentHostname();
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6", "data-testid": "domain-mismatch-advisory" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("This site isn't registered to your license", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0!" }, window.wp.i18n.__(
    "You're viewing Structura on a host that isn't one of your license's activations, so we can't verify cloud requests from here. The rest of the plugin still works — but channel connections, the Store, and cloud-backed automations can't load until you reconnect this host.",
    "structura"
  )), host && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2! mb-0! font-mono text-xs break-all opacity-80" }, host)), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/account" }, window.wp.i18n.__("Reconnect from Account", "structura"), /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "ml-1.5 size-3.5", strokeWidth: 2.5 }))))));
};
function selectUnhealthy(connections) {
  return connections.filter((c2) => c2.status !== "connected");
}
function countByStatus(unhealthy) {
  const out = { expired: 0, revoked: 0, error: 0 };
  for (const c2 of unhealthy) {
    if (c2.status === "expired") out.expired++;
    else if (c2.status === "revoked") out.revoked++;
    else out.error++;
  }
  return out;
}
const ExpiredConnectionsBanner = () => {
  const { data: connections, isLoading } = useChannelConnectionsQuery();
  const navigate = useNavigate();
  const unhealthy = window.wp.element.useMemo(() => selectUnhealthy(connections ?? []), [connections]);
  const counts = window.wp.element.useMemo(() => countByStatus(unhealthy), [unhealthy]);
  if (isLoading || unhealthy.length === 0) return null;
  const hasExpiredOrRevoked = counts.expired > 0 || counts.revoked > 0;
  const variant = hasExpiredOrRevoked ? "error" : "warning";
  const Icon2 = hasExpiredOrRevoked ? CircleX : TriangleAlert;
  const title = unhealthy.length === 1 ? window.wp.i18n.sprintf(
    // translators: %s = display name of the affected connection.
    window.wp.i18n.__("Channel connection “%s” needs attention", "structura"),
    unhealthy[0].displayName
  ) : window.wp.i18n.sprintf(
    // translators: %d = number of unhealthy connections.
    window.wp.i18n.__("%d channel connections need attention", "structura"),
    unhealthy.length
  );
  const reasons = [];
  if (counts.expired > 0) {
    reasons.push(window.wp.i18n.sprintf(window.wp.i18n.__("%d expired", "structura"), counts.expired));
  }
  if (counts.revoked > 0) {
    reasons.push(window.wp.i18n.sprintf(window.wp.i18n.__("%d revoked", "structura"), counts.revoked));
  }
  if (counts.error > 0) {
    reasons.push(window.wp.i18n.sprintf(window.wp.i18n.__("%d errored", "structura"), counts.error));
  }
  const body = window.wp.i18n.sprintf(
    // translators: %s = comma-separated status list like "2 expired, 1 revoked".
    window.wp.i18n.__(
      "Some of your channel integrations aren't working (%s). Posts won't be distributed through these channels until the issue is resolved.",
      "structura"
    ),
    reasons.join(", ")
  );
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6", "data-testid": "expired-connections-banner" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant }, /* @__PURE__ */ window.wp.element.createElement(Icon2, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, title), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, body), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", onClick: () => navigate("/channels/connections") }, window.wp.i18n.__("View Connections", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14 })))));
};
const WpCronDisabledBanner = () => {
  const triggered = typeof window !== "undefined" ? !!window.structuraConfig?.wp_cron_disabled : false;
  if (!triggered) return null;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "error" }, /* @__PURE__ */ window.wp.element.createElement(OctagonAlert, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("WordPress cron is disabled on this site", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-2!" }, window.wp.i18n.__(
    "Your wp-config.php sets DISABLE_WP_CRON to true. Every Structura task — scheduled campaigns, image generation, channel dispatches — runs through Action Scheduler, which only fires when WP-Cron runs OR a system cron is hitting wp-cron.php. Without one of those, queued work stalls silently and your posts never get generated.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0!" }, window.wp.i18n.__(
    "If you already have a system cron configured, nothing is broken — the condition just cannot be verified from PHP. If you don't, set one up before relying on scheduled campaigns.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: docsUrl("troubleshooting/wp-cron-disabled"),
      target: "_blank",
      rel: "noopener noreferrer",
      className: "inline-flex items-center gap-1 text-sm"
    },
    window.wp.i18n.__("Read the setup guide", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3.5 w-3.5" })
  ))));
};
const CloudUnreachableBanner = () => {
  const triggered = typeof window !== "undefined" ? !!window.structuraConfig?.cloud_unreachable : false;
  if (!triggered) return null;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement($n, { variant: "error" }, /* @__PURE__ */ window.wp.element.createElement(OctagonAlert, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Structura Cloud can't reach this site", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-2!" }, window.wp.i18n.__(
    "Every Structura post is generated in the cloud and delivered back to your site over a secure webhook. The last connection check couldn't reach this site, so generated posts have nowhere to land — campaigns will run but no post will ever appear.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0!" }, window.wp.i18n.__(
    "This usually means the site is on a local or staging URL (localhost, *.local, *.test), a private network address, or behind HTTP password protection or a firewall that blocks incoming requests. Run a connection check from Settings once the site is publicly reachable.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: docsUrl("troubleshooting/cloud-unreachable"),
      target: "_blank",
      rel: "noopener noreferrer",
      className: "inline-flex items-center gap-1 text-sm"
    },
    window.wp.i18n.__("Read the setup guide", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3.5 w-3.5" })
  ))));
};
const DefaultPersonaAdvisory = () => {
  const navigate = useNavigate();
  const { data: personas, isLoading } = usePersonasQuery();
  if (isLoading) return null;
  const count2 = personas?.length ?? 0;
  if (count2 !== 1) return null;
  const personaName = personas?.[0]?.name ?? "";
  return /* @__PURE__ */ window.wp.element.createElement($n, { variant: "info" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Using your only persona", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, personaName ? (
    // translators: %s is the persona name.
    window.wp.i18n.sprintf(
      window.wp.i18n.__(
        "Every post will use “%s” — your only persona. Add a couple more to vary tone across campaigns and posts.",
        "structura"
      ),
      personaName
    )
  ) : window.wp.i18n.__(
    "Every post will use your only persona. Add a couple more to vary tone across campaigns and posts.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", onClick: () => navigate("/personas") }, window.wp.i18n.__("Add Persona", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-2", strokeWidth: 2 }))));
};
const NoPersonasBlocker = () => {
  const navigate = useNavigate();
  const { data: personas, isLoading } = usePersonasQuery();
  if (isLoading) return null;
  const count2 = personas?.length ?? 0;
  if (count2 > 0) return null;
  return /* @__PURE__ */ window.wp.element.createElement($n, { variant: "warning" }, /* @__PURE__ */ window.wp.element.createElement(Users, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Add a persona to continue", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, window.wp.i18n.__(
    "Every post is written in the voice of a persona. This workspace doesn't have any yet — create one (or start from a template) before generating content.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", variant: "secondary", onClick: () => navigate("/personas") }, window.wp.i18n.__("Create a persona", "structura"), /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-2", strokeWidth: 2 }))));
};
const EMPTY_RESPONSE = {
  detected: [],
  checked_at: null
};
const useCompatPageBuildersQuery = () => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: ["compat", "page-builders"],
    enabled: hasUsableLicense === true,
    queryFn: async () => {
      try {
        const res = await window.wp.apiFetch({
          path: "/structura/v1/compat/page-builders"
        });
        return res ?? EMPTY_RESPONSE;
      } catch {
        return EMPTY_RESPONSE;
      }
    },
    staleTime: 30 * 60 * 1e3,
    // 30 minutes — detection runs daily
    refetchOnWindowFocus: false
  });
};
const DISMISSAL_KEY = perActivationStorageKey(
  "structura:page-builder-compat-card:v1"
);
const DISMISSAL_THRESHOLD = 3;
function readDismissal() {
  if (typeof window === "undefined") {
    return { count: 0, snapshot: "" };
  }
  try {
    const raw = window.localStorage.getItem(DISMISSAL_KEY);
    if (!raw) return { count: 0, snapshot: "" };
    const parsed = JSON.parse(raw);
    return {
      count: typeof parsed.count === "number" ? parsed.count : 0,
      snapshot: typeof parsed.snapshot === "string" ? parsed.snapshot : ""
    };
  } catch {
    return { count: 0, snapshot: "" };
  }
}
function writeDismissal(state) {
  if (typeof window === "undefined") return;
  try {
    window.localStorage.setItem(DISMISSAL_KEY, JSON.stringify(state));
  } catch {
  }
}
function snapshotHash(builders) {
  return builders.map((b2) => b2.slug).sort((a3, b2) => a3.localeCompare(b2)).join(",");
}
function PageBuilderCompatCard() {
  const { data, isLoading } = useCompatPageBuildersQuery();
  const [dismissal, setDismissal] = window.wp.element.useState(() => readDismissal());
  const builders = data?.detected ?? [];
  const snapshot = snapshotHash(builders);
  window.wp.element.useEffect(() => {
    if (snapshot === "") return;
    if (dismissal.snapshot !== "" && dismissal.snapshot !== snapshot) {
      const reset = { count: 0, snapshot };
      writeDismissal(reset);
      setDismissal(reset);
    } else if (dismissal.snapshot === "") {
      writeDismissal({ count: dismissal.count, snapshot });
    }
  }, [snapshot]);
  if (isLoading) return null;
  if (builders.length === 0) return null;
  if (dismissal.count >= DISMISSAL_THRESHOLD) return null;
  const atomicMeta = builders.filter((b2) => b2.opt_out_meta_active);
  const optIn = builders.filter((b2) => !b2.opt_out_meta_active);
  const primary = atomicMeta.length > 0 ? atomicMeta : optIn;
  const variant = atomicMeta.length > 0 ? "info" : "default";
  const labels = primary.map((b2) => b2.label);
  const builderList = humanList(labels);
  const headline = atomicMeta.length > 0 ? window.wp.i18n.sprintf(
    /* translators: %s is a natural-language list of page builders, e.g. "Divi" or "Divi and WPBakery". */
    window.wp.i18n.__("%s detected on this site.", "structura"),
    builderList
  ) : window.wp.i18n.sprintf(
    /* translators: %s is a natural-language list of opt-in page builders, e.g. "Elementor" or "Elementor and Brizy". */
    window.wp.i18n.__("%s is active on this site.", "structura"),
    builderList
  );
  const body = atomicMeta.length > 0 ? window.wp.i18n.__(
    "Structura automatically opts every generated post out of this builder, so the body renders normally on the front end. If a post still looks blank, check your theme builder template.",
    "structura"
  ) : window.wp.i18n.__(
    "Structura posts are stored as Gutenberg blocks. If you open one with this page builder, the builder will replace the block content on save.",
    "structura"
  );
  const handleDismiss = () => {
    const next = {
      count: dismissal.count + 1,
      snapshot
    };
    writeDismissal(next);
    setDismissal(next);
  };
  return /* @__PURE__ */ window.wp.element.createElement(
    $n,
    {
      variant,
      onDismiss: handleDismiss,
      dismissLabel: window.wp.i18n.__("Dismiss", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(Info, null),
    /* @__PURE__ */ window.wp.element.createElement($n.Title, null, headline),
    /* @__PURE__ */ window.wp.element.createElement($n.Description, null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-2!" }, body), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0! list-none p-0! flex flex-wrap gap-3" }, primary.map((b2) => /* @__PURE__ */ window.wp.element.createElement("li", { key: b2.slug, className: "m-0!" }, /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: b2.docs_url,
        target: "_blank",
        rel: "noopener noreferrer",
        className: "inline-flex items-center gap-1 text-sm"
      },
      window.wp.i18n.sprintf(
        /* translators: %s is a page-builder display name. */
        window.wp.i18n.__("%s compatibility guide", "structura"),
        b2.label
      ),
      /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3.5 w-3.5" })
    )))))
  );
}
function humanList(labels) {
  if (labels.length === 0) return "";
  if (labels.length === 1) return labels[0];
  if (labels.length === 2) {
    return window.wp.i18n.sprintf(
      /* translators: 1: first item, 2: second item — rendered as "A and B". */
      window.wp.i18n.__("%1$s and %2$s", "structura"),
      labels[0],
      labels[1]
    );
  }
  const tail = labels[labels.length - 1];
  const head = labels.slice(0, -1).join(", ");
  return window.wp.i18n.sprintf(
    /* translators: 1: comma-separated list of items, 2: last item — "A, B, and C". */
    window.wp.i18n.__("%1$s, and %2$s", "structura"),
    head,
    tail
  );
}
const VisualStyleFallbackNotice = ({
  imagesEnabled
}) => {
  const navigate = useNavigate();
  const { data, isLoading } = useVisualPresetsQuery();
  if (!imagesEnabled || isLoading) return null;
  if (data?.boundPresetId != null) return null;
  return /* @__PURE__ */ window.wp.element.createElement($n, { variant: "info" }, /* @__PURE__ */ window.wp.element.createElement(Palette, null), /* @__PURE__ */ window.wp.element.createElement($n.Title, null, window.wp.i18n.__("Images will use a generic style", "structura")), /* @__PURE__ */ window.wp.element.createElement($n.Description, null, window.wp.i18n.__(
    "No visual style is set for this site, so generated images use a neutral default look. Set your brand's art direction in Visuals for on-brand images.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement($n.Action, null, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      variant: "secondary",
      onClick: () => navigate("/visuals")
    },
    window.wp.i18n.__("Set visual style", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-2", strokeWidth: 2 })
  )));
};
const resolveDefaultModel = ({
  provider,
  capability,
  providerSettings,
  catalogDefaults
}) => {
  const configured = capability === "text" ? providerSettings?.[provider]?.text_model : providerSettings?.[provider]?.image_model;
  return configured || catalogDefaults?.[provider]?.[capability] || "";
};
const normalizePostStatus = (value) => value === "publish" ? "publish" : "draft";
const NO_SEO_RULES = {
  include_faq_section: false,
  include_action_steps: false,
  include_statistics: false,
  number_in_title: false,
  internal_link_optimization: false,
  outbound_link_authority: false,
  eeat_signals: false,
  entity_coverage: false
};
const getCampaignFormDataForLicense = ({
  isPaidLicense,
  isLicensed
}) => {
  if (isLicensed && !isPaidLicense) {
    return {
      ...DEFAULT_CAMPAIGN_FORM_DATA,
      intelligence: {
        ...DEFAULT_CAMPAIGN_FORM_DATA.intelligence,
        seoRules: NO_SEO_RULES,
        postLength: 500
      },
      schedule: {
        ...DEFAULT_CAMPAIGN_FORM_DATA.schedule,
        pregenerationEnabled: false
      },
      structure: {
        ...DEFAULT_CAMPAIGN_FORM_DATA.structure,
        enabledBlocks: CONTENT_BLOCKS.filter((block) => !block.isPro).map((block) => block.name),
        featuredImage: true
      }
    };
  }
  if (isPaidLicense) {
    return {
      ...DEFAULT_CAMPAIGN_FORM_DATA,
      structure: {
        ...DEFAULT_CAMPAIGN_FORM_DATA.structure,
        enabledBlocks: CONTENT_BLOCKS.filter((block) => !block.defaultOff).map(
          (block) => block.name
        ),
        featuredImage: true,
        bodyImages: true
      }
    };
  }
  return {
    ...DEFAULT_CAMPAIGN_FORM_DATA,
    intelligence: {
      ...DEFAULT_CAMPAIGN_FORM_DATA.intelligence,
      seoRules: NO_SEO_RULES,
      postLength: 500
    }
  };
};
const CampaignContext = window.wp.element.createContext(void 0);
const CampaignProvider = ({
  children,
  initialData,
  mode = "campaign"
}) => {
  const isPersistedFlow = mode === "campaign" && !initialData;
  if (isPersistedFlow) {
    return /* @__PURE__ */ window.wp.element.createElement(PersistedCampaignProvider, { mode }, children);
  }
  return /* @__PURE__ */ window.wp.element.createElement(LocalCampaignProvider, { mode, initialData }, children);
};
const buildIsValid = (formData, mode) => (step) => {
  switch (step) {
    case 1:
      if (mode === "single") return formData.identity.objective.length >= 20;
      return formData.identity.name.length >= 3 && formData.identity.objective.length >= 20;
    case 2:
      return !!formData.intelligence.textProvider && !!formData.intelligence.personaId;
    case 3:
      if (formData.taxonomy.categories.mode === "restricted") {
        return formData.taxonomy.categories.list.length > 0;
      }
      return true;
    case 5:
      return !!formData.schedule.cron;
    default:
      return true;
  }
};
const useModelBackfill = (intelligence, applyPatch) => {
  const { isCloud } = useDefaultProviders();
  const { data: ai } = useAiSettingsQuery();
  const { data: availableModels } = useAvailableModelsQuery();
  const { textProvider, imageProvider, textModel, imageModel } = intelligence;
  window.wp.element.useEffect(() => {
    if (isCloud) return;
    const patch = {
      resolvedFor: { textProvider, imageProvider }
    };
    if (!textModel) {
      const resolved = resolveDefaultModel({
        provider: textProvider,
        capability: "text",
        providerSettings: ai?.providers,
        catalogDefaults: availableModels?.defaults
      });
      if (resolved) patch.textModel = resolved;
    }
    if (!imageModel) {
      const resolved = resolveDefaultModel({
        provider: imageProvider,
        capability: "image",
        providerSettings: ai?.providers,
        catalogDefaults: availableModels?.defaults
      });
      if (resolved) patch.imageModel = resolved;
    }
    if (patch.textModel || patch.imageModel) applyPatch(patch);
  }, [
    isCloud,
    ai,
    availableModels,
    textProvider,
    imageProvider,
    textModel,
    imageModel,
    applyPatch
  ]);
};
const guardModelPatch = (patch, current) => ({
  ...patch.textModel && !current.textModel && current.textProvider === patch.resolvedFor.textProvider ? { textModel: patch.textModel } : {},
  ...patch.imageModel && !current.imageModel && current.imageProvider === patch.resolvedFor.imageProvider ? { imageModel: patch.imageModel } : {}
});
const LocalCampaignProvider = ({
  children,
  initialData,
  mode
}) => {
  const { isPaidLicense, isLicensed } = useLicense();
  const { defaultTextProvider, defaultImageProvider } = useDefaultProviders();
  const defaultFormData = window.wp.element.useMemo(
    () => ({
      ...DEFAULT_CAMPAIGN_FORM_DATA,
      intelligence: {
        ...DEFAULT_CAMPAIGN_FORM_DATA.intelligence,
        textProvider: defaultTextProvider,
        imageProvider: defaultImageProvider
      }
    }),
    [defaultTextProvider, defaultImageProvider]
  );
  const [formData, setFormData] = window.wp.element.useState(initialData ?? defaultFormData);
  window.wp.element.useEffect(() => {
    if (initialData || !isLicensed && !isPaidLicense) {
      return;
    }
    const refinedData = getCampaignFormDataForLicense({ isPaidLicense, isLicensed });
    setFormData({
      ...refinedData,
      intelligence: {
        ...refinedData.intelligence,
        textProvider: defaultTextProvider,
        imageProvider: defaultImageProvider
      }
    });
  }, [initialData, isPaidLicense, isLicensed, defaultTextProvider, defaultImageProvider]);
  const updateForm = window.wp.element.useCallback(
    (cluster, data) => {
      setFormData((prev) => ({
        ...prev,
        [cluster]: { ...prev[cluster], ...data }
      }));
    },
    []
  );
  const applyModelPatch = window.wp.element.useCallback(
    (patch) => setFormData((prev) => {
      const safe = guardModelPatch(patch, prev.intelligence);
      if (!safe.textModel && !safe.imageModel) return prev;
      return { ...prev, intelligence: { ...prev.intelligence, ...safe } };
    }),
    []
  );
  useModelBackfill(formData.intelligence, applyModelPatch);
  const value = window.wp.element.useMemo(
    () => ({ formData, updateForm, isValid: buildIsValid(formData, mode), mode, isCreate: false }),
    [formData, updateForm, mode]
  );
  return /* @__PURE__ */ window.wp.element.createElement(CampaignContext.Provider, { value }, children);
};
const PersistedCampaignProvider = ({
  children,
  mode
}) => {
  const { isPaidLicense, isLicensed } = useLicense();
  const { defaultTextProvider, defaultImageProvider } = useDefaultProviders();
  const formData = useCampaignDraftStore((s2) => s2.formData);
  const lastUpdatedAt = useCampaignDraftStore((s2) => s2.lastUpdatedAt);
  const updateFormStore = useCampaignDraftStore((s2) => s2.updateForm);
  const replaceForm = useCampaignDraftStore((s2) => s2.replaceForm);
  window.wp.element.useEffect(() => {
    if (lastUpdatedAt !== null) return;
    if (!isLicensed && !isPaidLicense) return;
    const refinedData = getCampaignFormDataForLicense({ isPaidLicense, isLicensed });
    replaceForm(
      {
        ...refinedData,
        intelligence: {
          ...refinedData.intelligence,
          textProvider: defaultTextProvider,
          imageProvider: defaultImageProvider
        }
      },
      { markTouched: false }
    );
  }, [
    lastUpdatedAt,
    isPaidLicense,
    isLicensed,
    defaultTextProvider,
    defaultImageProvider,
    replaceForm
  ]);
  const applyModelPatch = window.wp.element.useCallback(
    (patch) => {
      const safe = guardModelPatch(
        patch,
        useCampaignDraftStore.getState().formData.intelligence
      );
      if (!safe.textModel && !safe.imageModel) return;
      updateFormStore("intelligence", safe, { markTouched: false });
    },
    [updateFormStore]
  );
  useModelBackfill(formData.intelligence, applyModelPatch);
  const value = window.wp.element.useMemo(
    () => ({
      formData,
      updateForm: updateFormStore,
      isValid: buildIsValid(formData, mode),
      mode,
      isCreate: true
    }),
    [formData, updateFormStore, mode]
  );
  return /* @__PURE__ */ window.wp.element.createElement(CampaignContext.Provider, { value }, children);
};
const useCampaignForm = () => {
  const context = window.wp.element.useContext(CampaignContext);
  if (!context) throw new Error("useCampaignForm must be used within a CampaignProvider");
  return context;
};
const SUPPORT_URL = "https://www.structurawp.com/support";
const isCampaignLimitReachedError = (err) => typeof err === "object" && err !== null && err.code === "campaign_limit_reached";
const isCadenceLimitReachedError = (err) => typeof err === "object" && err !== null && err.code === "cadence_limit_reached";
const showCadenceLimitToast = (error) => {
  const maxPerWeek = error.data?.maxPerWeek ?? 1;
  const detail = maxPerWeek === 1 ? window.wp.i18n.__(
    "Your current plan publishes one post a week. Upgrade to publish more often.",
    "structura"
  ) : window.wp.i18n.sprintf(
    /* translators: %d is the plan's weekly post limit. */
    window.wp.i18n.__(
      "Your current plan publishes up to %d posts a week. Upgrade to publish more often.",
      "structura"
    ),
    maxPerWeek
  );
  An.error(detail, {
    title: window.wp.i18n.__("Publishing limit reached", "structura"),
    // 0 = sticky; the Go Pro CTA is the point of the toast.
    duration: 0,
    action: {
      label: window.wp.i18n.__("Go Pro", "structura"),
      onClick: () => {
        window.open(
          buildPortalSignupUrl({
            intent: "unlock_cadence",
            domain: typeof window !== "undefined" ? window.location.hostname : void 0
          }),
          "_blank",
          "noopener,noreferrer"
        );
      }
    }
  });
};
const SCHEDULE_FALLBACK = {
  cron: "",
  endCondition: { type: "infinite", value: 0 },
  pregenerationEnabled: true
};
const flattenCampaign = (data) => {
  const { identity: identity2, intelligence, structure, taxonomy, authority, keywords, researchAttachments } = data;
  const schedule = data.schedule ?? SCHEDULE_FALLBACK;
  return {
    // Identity Cluster
    name: identity2.name,
    topic: identity2.objective,
    campaign_mode: identity2.campaignMode,
    // Single-post focus keyphrase (SEO Targeting). Only present when the user
    // picked one; the plugin maps it to the ephemeral post's picked keyword.
    ...identity2.focusKeyphrase?.trim() ? { focus_keyphrase: identity2.focusKeyphrase.trim() } : {},
    // Intelligence Cluster — split providers (new) + legacy provider field (backward compat)
    text_provider: intelligence.textProvider,
    image_provider: intelligence.imageProvider,
    provider: intelligence.textProvider,
    // Legacy field for older cloud functions
    text_model: intelligence.textModel,
    image_model: intelligence.imageModel,
    // BYOK quality tier (top | mid) — sent ONLY when set so a tier-less
    // campaign never writes one and a partial save can't wipe a stored tier
    // (matches the plugin validator's omit-when-absent contract, §10). The
    // cloud prefers the tier over text_model/image_model at generation time.
    ...intelligence.textTier ? { text_tier: intelligence.textTier } : {},
    ...intelligence.imageTier ? { image_tier: intelligence.imageTier } : {},
    // Optional fallback providers — null/undefined means "no fallback".
    // Server-side validator rejects same-as-primary; we still let the payload
    // carry whatever the form has (client can't know server plan rules for
    // every edge case, so the server remains the source of truth).
    fallback_text_provider: intelligence.fallbackTextProvider ?? "",
    fallback_image_provider: intelligence.fallbackImageProvider ?? "",
    persona_id: intelligence.personaId,
    language: intelligence.language,
    post_length: intelligence.postLength,
    replace_long_dashes: intelligence.replaceLongDashes,
    disable_emojis: intelligence.disableEmojis,
    seo_optimization_rules: intelligence.seoRules,
    // Structure Cluster
    enabled_blocks: structure.enabledBlocks,
    enable_disclosure: structure.disclosure.enabled,
    disclosure_text: structure.disclosure.text,
    // Referral / partner links — always sent (even empty) so clearing the
    // list persists. The transformer sanitizes + drops URL-less rows.
    referral_links: structure.referralLinks ?? [],
    featured_image: structure.featuredImage,
    body_images: structure.bodyImages,
    // Per-campaign replacement for the removed global `structura_post_status`
    // option — Task_Runner reads this on each scheduled run to decide whether
    // to publish, save as draft, or mark the post pending review.
    post_status: structure.postStatus,
    // Taxonomy Cluster
    category_mode: taxonomy.categories.mode,
    allowed_categories: taxonomy.categories.list,
    tag_mode: taxonomy.tags.mode,
    allowed_tags: taxonomy.tags.list,
    // Schedule Cluster
    cron_schedule: schedule.cron,
    end_mode: schedule.endCondition.type,
    // Map the polymorphic value to the specific columns
    end_posts: schedule.endCondition.type === "quota" ? schedule.endCondition.value : 0,
    end_date: schedule.endCondition.type === "date" ? schedule.endCondition.value : "",
    // Phase 1.6 — pre-generation toggle. The cloud accepts this on the
    // top-level campaign doc (not nested under schedule); the SPA
    // happens to keep it on the schedule cluster for form-locality
    // purposes only. Default true on creation; existing campaigns
    // without the field default OFF on the cloud side per Phase 1.7
    // migration. Empty/undefined falls through to whatever the cloud
    // doc currently holds (patch semantics).
    pregeneration_enabled: schedule.pregenerationEnabled ?? true,
    // Authority Cluster (optional — only present when discovery has been run)
    ...authority?.domains?.length ? { authority_domains: authority.domains } : {},
    // Keywords Cluster (optional — only present when keyword discovery has been run)
    ...keywords?.bank?.length ? { keyword_bank: keywords.bank } : {},
    // Resolved discovery mode / KD ceiling / path (ranked keyword bank) —
    // only when the SPA has one, so an older doc keeps what it holds.
    ...keywords?.discoveryMeta ? { keyword_discovery_meta: keywords.discoveryMeta } : {},
    // Research material (single-post flow only). Sent as snake_case refs the
    // plugin's `generate_single_post` re-stamps on the ephemeral campaign as
    // `researchAttachments` — which lands in the run's `inputSnapshot`, so a
    // "Run again" replay flows the refs back through here unchanged. Mapped
    // field-by-field to pin the wire shape (max 5, id+name only) even when a
    // replayed snapshot carries extra keys.
    ...researchAttachments?.length ? {
      research_attachments: researchAttachments.slice(0, 5).map(({ id, name }) => ({ id, name }))
    } : {}
  };
};
const useCampaignMutations = () => {
  const queryClient2 = useQueryClient();
  const invalidate = () => {
    queryClient2.invalidateQueries({ queryKey: campaignKeys.all });
    queryClient2.invalidateQueries({ queryKey: jobKeys.lists() });
  };
  const toggleMutation = useMutation({
    mutationFn: (id) => window.wp.apiFetch({ path: `/structura/v1/scheduler/campaign/${id}/toggle`, method: "POST" }),
    onSuccess: () => invalidate()
  });
  const createMutation = useMutation({
    meta: { silentError: true },
    mutationFn: ({ data }) => window.wp.apiFetch({
      path: "/structura/v1/scheduler/campaign",
      method: "POST",
      data: flattenCampaign(data)
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("New campaign deployed to the engine.", "structura"));
      capture("campaign_created");
      invalidate();
    },
    onError: (error) => {
      if (isCampaignLimitReachedError(error)) {
        const limit = error.data?.limit ?? null;
        const current = error.data?.current ?? null;
        const detail = limit !== null && current !== null ? window.wp.i18n.sprintf(
          /* translators: 1: campaigns currently used, 2: plan limit */
          window.wp.i18n.__("You're using %1$d of %2$d campaigns on your current plan.", "structura"),
          current,
          limit
        ) : window.wp.i18n.__("You've reached your plan's campaign limit.", "structura");
        An.error(detail, {
          title: window.wp.i18n.__("Campaign limit reached", "structura"),
          // 0 = sticky; the user has to dismiss or click Contact Us.
          // The cap is rare to hit and the CTA is the whole point of
          // the toast — auto-dismiss would lose it before the user
          // reads it.
          duration: 0,
          action: {
            label: window.wp.i18n.__("Contact us", "structura"),
            onClick: () => {
              window.open(SUPPORT_URL, "_blank", "noopener,noreferrer");
            }
          }
        });
        return;
      }
      if (isCadenceLimitReachedError(error)) {
        showCadenceLimitToast(error);
        return;
      }
      const message = error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error ? String(error.message) : window.wp.i18n.__("Unknown error", "structura");
      An.error(`${window.wp.i18n.__("Action Failed:", "structura")} ${message}`);
    }
  });
  const updateMutation = useMutation({
    // Suppress the global handler so the cadence-cap rejection (editing a
    // flagged Free campaign to publish too often) gets the same Go Pro
    // toast as create, instead of a generic "Action Failed".
    meta: { silentError: true },
    mutationFn: ({ id, data }) => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${id}`,
      method: "PUT",
      data: flattenCampaign(data)
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Campaign architecture updated.", "structura"));
      invalidate();
    },
    onError: (error) => {
      if (isCadenceLimitReachedError(error)) {
        showCadenceLimitToast(error);
        return;
      }
      const message = error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error ? String(error.message) : window.wp.i18n.__("Unknown error", "structura");
      An.error(`${window.wp.i18n.__("Action Failed:", "structura")} ${message}`);
    }
  });
  const duplicateMutation = useMutation({
    mutationFn: ({ id }) => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${id}/duplicate`,
      method: "POST"
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Campaign duplicated.", "structura"));
      invalidate();
    }
  });
  const deleteMutation = useMutation({
    mutationFn: (id) => window.wp.apiFetch({ path: `/structura/v1/scheduler/campaign/${id}`, method: "DELETE" }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Campaign deleted.", "structura"));
      invalidate();
    }
  });
  const generatePostMutation = useMutation({
    mutationFn: ({ data }) => window.wp.apiFetch({
      path: "/structura/v1/post/generate",
      method: "POST",
      data: flattenCampaign(data)
    }),
    onSuccess: () => {
      capture("post_generation_started", { surface: "single_post" });
      queryClient2.invalidateQueries({ queryKey: progressKeys.singlePostRuns() });
      queryClient2.invalidateQueries({ queryKey: progressKeys.activeRuns() });
    }
  });
  const discoverAuthorityMutation = useMutation({
    mutationFn: ({ campaignId }) => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${campaignId}/discover-authority`,
      method: "POST"
    }),
    onSuccess: () => invalidate()
  });
  const discoverAuthorityDetachedMutation = useMutation({
    mutationFn: (params) => window.wp.apiFetch({
      path: "/structura/v1/scheduler/discover-authority",
      method: "POST",
      data: params
    })
  });
  const discoverKeywordsDetachedMutation = useMutation({
    mutationFn: (params) => window.wp.apiFetch({
      path: "/structura/v1/scheduler/discover-keywords",
      method: "POST",
      data: params
    })
  });
  const saveKeywordsMutation = useMutation({
    mutationFn: ({
      campaignId,
      keywords,
      discoveryMeta
    }) => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${campaignId}/save-keywords`,
      method: "POST",
      data: { keywords, ...discoveryMeta ? { discoveryMeta } : {} }
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Keyword bank saved.", "structura"));
      invalidate();
    }
  });
  const saveAuthorityMutation = useMutation({
    mutationFn: ({
      campaignId,
      domains
    }) => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${campaignId}/save-authority`,
      method: "POST",
      data: { domains }
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Authority domains saved.", "structura"));
      invalidate();
    }
  });
  return {
    // Promise-returning variants so callers can `await` them. Lets the
    // CampaignViewPage's ConfirmDialog stay open with a spinner until the
    // round-trip completes, then auto-close — the previous fire-and-forget
    // `mutate` shape gave the dialog no way to know when to dismiss, so it
    // closed instantly and the user had to refresh to see the new state.
    toggleCampaign: toggleMutation.mutateAsync,
    isToggling: toggleMutation.isPending,
    createCampaign: createMutation.mutateAsync,
    isCreating: createMutation.isPending,
    updateCampaign: updateMutation.mutateAsync,
    isUpdating: updateMutation.isPending,
    duplicateCampaign: duplicateMutation.mutateAsync,
    isDuplicating: duplicateMutation.isPending,
    deleteCampaign: deleteMutation.mutateAsync,
    isDeleting: deleteMutation.isPending,
    generatePost: generatePostMutation.mutateAsync,
    isGenerating: generatePostMutation.isPending,
    discoverAuthority: discoverAuthorityMutation.mutateAsync,
    isDiscovering: discoverAuthorityMutation.isPending,
    discoverAuthorityDetached: discoverAuthorityDetachedMutation.mutateAsync,
    isDiscoveringDetached: discoverAuthorityDetachedMutation.isPending,
    saveAuthority: saveAuthorityMutation.mutateAsync,
    isSavingAuthority: saveAuthorityMutation.isPending,
    discoverKeywordsDetached: discoverKeywordsDetachedMutation.mutateAsync,
    isDiscoveringKeywords: discoverKeywordsDetachedMutation.isPending,
    saveKeywords: saveKeywordsMutation.mutateAsync,
    isSavingKeywords: saveKeywordsMutation.isPending
  };
};
const QUESTIONS = [
  {
    id: "goal",
    question: window.wp.i18n.__("What's the primary goal of this campaign?", "structura"),
    chips: [
      { label: window.wp.i18n.__("Drive organic traffic", "structura"), value: "traffic_magnet" },
      { label: window.wp.i18n.__("Target low-competition topics", "structura"), value: "quick_wins" },
      { label: window.wp.i18n.__("Convert readers to customers", "structura"), value: "conversion" },
      { label: window.wp.i18n.__("Build niche authority", "structura"), value: "authority" }
    ],
    allowCustom: true
  },
  {
    id: "audience",
    question: window.wp.i18n.__("Who's your target audience?", "structura"),
    chips: [
      { label: window.wp.i18n.__("Beginners & newcomers", "structura"), value: "beginners" },
      { label: window.wp.i18n.__("Professionals & practitioners", "structura"), value: "professionals" },
      { label: window.wp.i18n.__("Business owners & decision-makers", "structura"), value: "business_owners" },
      { label: window.wp.i18n.__("Developers & technical users", "structura"), value: "developers" },
      { label: window.wp.i18n.__("General public", "structura"), value: "general" }
    ],
    allowCustom: true
  },
  {
    id: "topic",
    question: window.wp.i18n.__("What topics or niches should this campaign cover?", "structura"),
    chips: [],
    // Populated dynamically via AI
    allowCustom: true,
    multiSelect: true
  },
  {
    id: "content_types",
    question: window.wp.i18n.__("What type of content works best for your audience?", "structura"),
    chips: [
      { label: window.wp.i18n.__("How-to guides", "structura"), value: "how_to" },
      { label: window.wp.i18n.__("Listicles & roundups", "structura"), value: "listicles" },
      { label: window.wp.i18n.__("In-depth analysis", "structura"), value: "analysis" },
      { label: window.wp.i18n.__("Comparisons & reviews", "structura"), value: "comparisons" },
      { label: window.wp.i18n.__("Tutorials & walkthroughs", "structura"), value: "tutorials" },
      { label: window.wp.i18n.__("Case studies", "structura"), value: "case_studies" }
    ],
    allowCustom: true,
    multiSelect: true
  },
  {
    id: "differentiator",
    question: window.wp.i18n.__("What makes your perspective unique?", "structura"),
    chips: [
      { label: window.wp.i18n.__("Years of hands-on experience", "structura"), value: "experience" },
      { label: window.wp.i18n.__("Data-driven insights", "structura"), value: "data_driven" },
      { label: window.wp.i18n.__("Contrarian / fresh take", "structura"), value: "contrarian" },
      { label: window.wp.i18n.__("Step-by-step practical advice", "structura"), value: "practical" },
      { label: window.wp.i18n.__("Industry insider knowledge", "structura"), value: "insider" }
    ],
    allowCustom: true,
    multiSelect: true
  }
];
const mergeTopicChips = (seedChips, aiChips) => {
  const seen2 = new Set(
    seedChips.flatMap((c2) => [c2.label.toLowerCase(), c2.value])
  );
  const merged = [...seedChips];
  for (const chip of aiChips) {
    if (seen2.has(chip.label.toLowerCase()) || seen2.has(chip.value)) continue;
    seen2.add(chip.label.toLowerCase());
    seen2.add(chip.value);
    merged.push(chip);
  }
  return merged;
};
const GuidedInterview = ({ onComplete }) => {
  const { suggest, isSuggesting } = useMagicSuggest();
  const { isPaidLicense } = useLicense();
  const { formData, updateForm } = useCampaignForm();
  const activeProvider = formData.intelligence.textProvider;
  const handleProviderChange = (p2) => updateForm("intelligence", { textProvider: p2 });
  const [currentStep, setCurrentStep] = window.wp.element.useState(0);
  const [answers, setAnswers] = window.wp.element.useState(/* @__PURE__ */ new Map());
  const [customInput, setCustomInput] = window.wp.element.useState("");
  const [isCustomMode, setIsCustomMode] = window.wp.element.useState(false);
  const [topicChips, setTopicChips] = window.wp.element.useState([]);
  const [isLoadingTopics, setIsLoadingTopics] = window.wp.element.useState(false);
  const [topicsLoaded, setTopicsLoaded] = window.wp.element.useState(false);
  const [topicProvider, setTopicProvider] = window.wp.element.useState(null);
  window.wp.element.useEffect(() => {
    if (!isPaidLicense) return;
    if (isLoadingTopics) return;
    if (topicProvider === activeProvider) return;
    const loadTopics = async () => {
      setIsLoadingTopics(true);
      setTopicProvider(activeProvider);
      console.info("[Structura] Loading topic chips via provider:", activeProvider);
      try {
        const response = await window.wp.apiFetch({
          path: "/structura/v1/suggest",
          method: "POST",
          data: {
            mode: "topic_chips",
            provider: activeProvider,
            context: []
          }
        });
        const data = response?.result ?? response;
        let topics = data?.topics;
        if (typeof topics === "string") {
          try {
            topics = JSON.parse(topics);
          } catch {
            topics = null;
          }
        }
        if (Array.isArray(topics) && topics.length > 0) {
          setTopicChips(
            topics.map((t2) => ({
              label: t2.label,
              value: t2.value
            }))
          );
        }
      } catch (err) {
        console.warn("[Structura] Topic chip suggestion failed:", err);
      } finally {
        setIsLoadingTopics(false);
        setTopicsLoaded(true);
      }
    };
    loadTopics();
  }, [activeProvider]);
  const topicQuestionChips = window.wp.element.useMemo(
    () => mergeTopicChips([], topicChips),
    [topicChips]
  );
  const questions = window.wp.element.useMemo(() => {
    return QUESTIONS.map((q2) => {
      if (q2.id === "topic" && topicQuestionChips.length > 0) {
        return { ...q2, chips: topicQuestionChips };
      }
      return q2;
    });
  }, [topicQuestionChips]);
  const question = questions[currentStep];
  const isLastQuestion = currentStep === questions.length - 1;
  const hasAnswer = answers.has(question?.id);
  const currentAnswers = window.wp.element.useMemo(() => answers.get(question?.id) ?? [], [answers, question?.id]);
  const isChipSelected = window.wp.element.useCallback(
    (value) => currentAnswers.some((a3) => a3.value === value),
    [currentAnswers]
  );
  const customAnswers = window.wp.element.useMemo(() => {
    const predefinedValues = new Set(question?.chips.map((c2) => c2.value) ?? []);
    return currentAnswers.filter((a3) => !predefinedValues.has(a3.value));
  }, [currentAnswers, question?.chips]);
  const selectChip = (chip) => {
    const qId = question.id;
    if (question.multiSelect) {
      setAnswers((prev) => {
        const next = new Map(prev);
        const existing = next.get(qId) ?? [];
        const isSelected = existing.some((a3) => a3.value === chip.value);
        if (isSelected) {
          next.set(
            qId,
            existing.filter((a3) => a3.value !== chip.value)
          );
        } else {
          next.set(qId, [...existing, { questionId: qId, label: chip.label, value: chip.value }]);
        }
        return next;
      });
    } else {
      setAnswers((prev) => {
        const next = new Map(prev);
        next.set(qId, [{ questionId: qId, label: chip.label, value: chip.value }]);
        return next;
      });
      setIsCustomMode(false);
      if (!isLastQuestion) {
        setCurrentStep((s2) => s2 + 1);
      }
    }
  };
  const removeAnswer = (value) => {
    const qId = question.id;
    setAnswers((prev) => {
      const next = new Map(prev);
      const existing = next.get(qId) ?? [];
      const filtered = existing.filter((a3) => a3.value !== value);
      if (filtered.length > 0) {
        next.set(qId, filtered);
      } else {
        next.delete(qId);
      }
      return next;
    });
  };
  const submitCustom = () => {
    const trimmed = customInput.trim();
    if (!trimmed) return;
    const qId = question.id;
    if (question.multiSelect) {
      setAnswers((prev) => {
        const next = new Map(prev);
        const existing = next.get(qId) ?? [];
        next.set(qId, [...existing, { questionId: qId, label: trimmed, value: trimmed }]);
        return next;
      });
    } else {
      setAnswers((prev) => {
        const next = new Map(prev);
        next.set(qId, [{ questionId: qId, label: trimmed, value: trimmed }]);
        return next;
      });
    }
    setCustomInput("");
    if (question.multiSelect) ;
    else {
      setIsCustomMode(false);
      if (!isLastQuestion) {
        setCurrentStep((s2) => s2 + 1);
      }
    }
  };
  const handleCustomKeyDown = (e2) => {
    if (e2.key === "Enter") {
      e2.preventDefault();
      submitCustom();
    }
    if (e2.key === "Escape") {
      setIsCustomMode(false);
      setCustomInput("");
    }
  };
  const advance = () => {
    if (isLastQuestion) return;
    setCurrentStep((s2) => s2 + 1);
    setIsCustomMode(false);
    setCustomInput("");
  };
  const goBack = () => {
    if (currentStep === 0) return;
    setCurrentStep((s2) => s2 - 1);
    setIsCustomMode(false);
    setCustomInput("");
  };
  const generateStrategy = async () => {
    const context = Array.from(answers.entries()).map(([qId, ans]) => {
      const q2 = questions.find((qu) => qu.id === qId);
      return {
        title: q2?.question ?? qId,
        url: "",
        content: ans.map((a3) => a3.label).join(", ")
      };
    });
    const data = await suggest("campaign", {
      provider: activeProvider,
      context
    });
    if (data?.name && data?.strategy) {
      const validModes = [
        "traffic_magnet",
        "quick_wins",
        "conversion",
        "authority"
      ];
      const goalAnswer = answers.get("goal")?.[0]?.value;
      const campaignMode = validModes.includes(goalAnswer) ? goalAnswer : data.campaign_mode && validModes.includes(data.campaign_mode) ? data.campaign_mode : void 0;
      const topics = (answers.get("topic") ?? []).map((a3) => a3.label.trim()).filter(Boolean);
      onComplete({
        name: data.name,
        objective: data.strategy,
        campaignMode,
        ...topics.length > 0 ? { topics } : {}
      });
    }
  };
  const allAnswered = questions.every((q2) => {
    const ans = answers.get(q2.id);
    return ans && ans.length > 0;
  });
  const isTopicLoading = question?.id === "topic" && isLoadingTopics && topicQuestionChips.length === 0;
  const isTopicAppending = question?.id === "topic" && isLoadingTopics && topicQuestionChips.length > 0;
  const isTopicEmpty = question?.id === "topic" && question.chips.length === 0 && !isLoadingTopics;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1" }, questions.map((q2, i2) => /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: q2.id,
      type: "button",
      onClick: () => {
        const firstUnanswered = questions.findIndex((q22) => !answers.has(q22.id));
        if (i2 <= currentStep || answers.has(q2.id) || i2 === firstUnanswered) {
          setCurrentStep(i2);
          setIsCustomMode(false);
          setCustomInput("");
        }
      },
      className: B$1(
        "h-1.5 flex-1 cursor-pointer rounded-full transition-all duration-300",
        i2 < currentStep ? "bg-brand-500 dark:bg-brand-400" : i2 === currentStep ? "bg-brand-300 dark:bg-brand-600" : answers.has(q2.id) ? "bg-brand-200 dark:bg-brand-800" : "bg-neutral-200 dark:bg-neutral-700"
      )
    }
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-100 bg-white px-6 py-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-2 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement(MessageSquare, { size: 12 }), window.wp.i18n.sprintf(window.wp.i18n.__("Question %d of %d", "structura"), currentStep + 1, questions.length)), /* @__PURE__ */ window.wp.element.createElement(
    ProviderPill,
    {
      provider: activeProvider,
      onProviderChange: handleProviderChange
    }
  )), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mb-6 text-lg font-bold text-neutral-900 dark:text-white" }, question?.question), isTopicLoading && /* @__PURE__ */ window.wp.element.createElement(
    MagicSuggestProgress,
    {
      isLoading: true,
      variant: "panel",
      className: "mb-4"
    }
  ), (question?.chips.length > 0 || customAnswers.length > 0) && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex flex-wrap gap-2" }, question.chips.map((chip) => {
    const selected = isChipSelected(chip.value);
    return /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        key: chip.value,
        type: "button",
        onClick: () => selectChip(chip),
        "aria-pressed": selected,
        className: B$1(
          "inline-flex cursor-pointer items-center gap-1.5 rounded-xl border px-4 py-2.5 text-sm font-medium transition-all duration-200",
          selected ? "border-brand-300 bg-brand-50 text-brand-700 dark:border-brand-700 dark:bg-brand-950/40 dark:text-brand-300 shadow-sm" : "hover:border-brand-200 hover:bg-brand-50/50 hover:text-brand-700 dark:hover:border-brand-800 dark:hover:bg-brand-950/20 dark:hover:text-brand-300 border-neutral-200 bg-white text-neutral-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-300"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(
        Check,
        {
          size: 14,
          "aria-hidden": "true",
          className: B$1(
            "shrink-0 transition-all duration-200",
            selected ? "scale-100 opacity-100" : "scale-50 opacity-0"
          )
        }
      ),
      chip.label
    );
  }), customAnswers.map((a3) => /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      key: a3.value,
      className: "inline-flex items-center gap-1.5 rounded-xl border border-brand-300 bg-brand-50 px-4 py-2.5 text-sm font-medium text-brand-700 shadow-sm dark:border-brand-700 dark:bg-brand-950/40 dark:text-brand-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14, className: "shrink-0" }),
    a3.label,
    /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => removeAnswer(a3.value),
        className: "ml-0.5 shrink-0 cursor-pointer rounded-full p-0.5 text-brand-400 transition-colors hover:bg-brand-100 hover:text-red-500 dark:text-brand-500 dark:hover:bg-brand-900 dark:hover:text-red-400"
      },
      /* @__PURE__ */ window.wp.element.createElement(X, { size: 12 })
    )
  )), question.id === "topic" && topicChips.length > 0 && /* @__PURE__ */ window.wp.element.createElement("span", { className: "bg-brand-50 text-brand-500 dark:bg-brand-950/30 dark:text-brand-400 inline-flex items-center gap-1 self-center rounded-full px-2 py-0.5 text-[9px] font-bold" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 8 }), window.wp.i18n.__("AI-suggested", "structura")), isTopicAppending && /* @__PURE__ */ window.wp.element.createElement(
    MagicSuggestProgress,
    {
      isLoading: true,
      variant: "inline",
      stages: [window.wp.i18n.__("Suggesting more topics…", "structura")],
      className: "self-center"
    }
  )), question?.allowCustom && !isTopicLoading && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3" }, !isCustomMode && question.chips.length > 0 ? /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setIsCustomMode(true),
      className: "hover:border-brand-300 hover:text-brand-600 dark:hover:border-brand-700 dark:hover:text-brand-400 inline-flex cursor-pointer items-center gap-1.5 rounded-xl border border-dashed border-neutral-300 px-4 py-2.5 text-sm text-neutral-500 transition-colors dark:border-neutral-600 dark:text-neutral-400"
    },
    /* @__PURE__ */ window.wp.element.createElement(PenLine, { size: 14 }),
    window.wp.i18n.__("Type your own answer", "structura")
  ) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Your answer", "structura"),
      hiddenLabel: true,
      autoFocus: true,
      value: customInput,
      onChange: (e2) => setCustomInput(e2.target.value),
      onKeyDown: handleCustomKeyDown,
      placeholder: isTopicEmpty ? window.wp.i18n.__("e.g. WordPress performance optimization", "structura") : question.chips.length === 0 ? window.wp.i18n.__("Type your answer…", "structura") : window.wp.i18n.__("Type your own answer…", "structura"),
      rightAdornment: /* @__PURE__ */ window.wp.element.createElement(
        "button",
        {
          type: "button",
          onClick: submitCustom,
          disabled: !customInput.trim(),
          className: B$1(
            "flex items-center justify-center rounded-md p-1 transition-colors",
            customInput.trim() ? "text-brand-600 hover:bg-brand-50 dark:text-brand-400 dark:hover:bg-brand-950/30 cursor-pointer" : "text-neutral-300 dark:text-neutral-600"
          )
        },
        /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14 })
      )
    }
  )), question.chips.length > 0 && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      size: "sm",
      variant: "transparent",
      onClick: () => {
        setIsCustomMode(false);
        setCustomInput("");
      }
    },
    window.wp.i18n.__("Cancel", "structura")
  )))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between" }, currentStep > 0 ? /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "transparent", size: "sm", onClick: goBack }, window.wp.i18n.__("Back", "structura")) : /* @__PURE__ */ window.wp.element.createElement("div", null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, hasAnswer && !isLastQuestion && /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: advance }, window.wp.i18n.__("Next", "structura"), /* @__PURE__ */ window.wp.element.createElement(ChevronRight, { size: 16, className: "ml-1" })), isLastQuestion && hasAnswer && isPaidLicense && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(MagicSuggestProgress, { isLoading: isSuggesting, variant: "inline" }), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: generateStrategy,
      disabled: !allAnswered || isSuggesting,
      className: "from-brand-600 shadow-brand-600/20 bg-gradient-to-r to-purple-600 font-bold shadow-lg"
    },
    isSuggesting ? /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 16, className: "mr-2 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(WandSparkles, { size: 16, className: "mr-2" }),
    window.wp.i18n.__("Generate Campaign Strategy", "structura")
  )), isLastQuestion && hasAnswer && !isPaidLicense && // AI strategy synthesis is Pro-only; free/none use the
  // "Skip interview — I'll fill in the details myself" link
  // below to proceed manually.
  /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      disabled: true,
      title: window.wp.i18n.__(
        'AI strategy synthesis is a paid feature. Use "Skip interview" below to fill in the details yourself, or upgrade your plan.',
        "structura"
      ),
      className: "from-brand-600 to-purple-600 bg-gradient-to-r font-bold"
    },
    /* @__PURE__ */ window.wp.element.createElement(WandSparkles, { size: 16, className: "mr-2" }),
    window.wp.i18n.__("Generate Campaign Strategy", "structura"),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2 rounded-md bg-white/25 px-1.5 py-0.5 text-[8px] font-black tracking-wider uppercase" }, window.wp.i18n.__("Pro", "structura"))
  ))), currentStep > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1" }, questions.slice(0, currentStep).map((q2) => {
    const ans = answers.get(q2.id);
    if (!ans?.length) return null;
    const isMulti = ans.length > 1;
    return /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        key: q2.id,
        type: "button",
        onClick: () => {
          setCurrentStep(questions.indexOf(q2));
          setIsCustomMode(false);
        },
        className: "flex w-full cursor-pointer items-start gap-3 rounded-lg px-3 py-2 text-left transition-colors hover:bg-neutral-50 dark:hover:bg-neutral-800/50"
      },
      /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14, className: "mt-[3px] shrink-0 text-emerald-500" }),
      isMulti ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-500 dark:text-neutral-400" }, q2.question), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap gap-1.5" }, ans.map((a3, i2) => /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          key: `${a3.value}-${i2}`,
          className: "inline-flex items-center rounded-full bg-neutral-100 px-2 py-0.5 text-[11px] font-medium text-neutral-700 dark:bg-neutral-800 dark:text-neutral-200"
        },
        a3.label
      )))) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0 flex-1 truncate text-xs text-neutral-500 dark:text-neutral-400" }, q2.question), /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 text-xs font-medium text-neutral-700 dark:text-neutral-300" }, ans[0].label))
    );
  })));
};
function keywordBankLabels() {
  return {
    listAria: window.wp.i18n.__("Keyword bank, in publish order", "structura"),
    pillarsAria: window.wp.i18n.__("Pillar keywords", "structura"),
    publishOrder: window.wp.i18n.__("Publish order · best winnable volume first", "structura"),
    orderEstimated: window.wp.i18n.__("order estimated", "structura"),
    showAll: (count2) => (
      /* translators: %d: total number of keywords in the bank. */
      window.wp.i18n.sprintf(window.wp.i18n.__("Show all %d keywords", "structura"), count2)
    ),
    showTop: (count2) => (
      /* translators: %d: number of rows shown while collapsed (15). */
      window.wp.i18n.sprintf(window.wp.i18n.__("Show top %d only", "structura"), count2)
    ),
    hiddenCaption: (hidden, pillars) => {
      const more = window.wp.i18n.sprintf(
        /* translators: %d: keywords hidden below the fold. */
        window.wp.i18n._n("%d more", "%d more", hidden, "structura"),
        hidden
      );
      if (pillars <= 0) return more;
      const last = window.wp.i18n.sprintf(
        /* translators: %d: number of pillar keywords (above the KD ceiling). */
        window.wp.i18n._n("%d pillar publishes last", "%d pillars publish last", pillars, "structura"),
        pillars
      );
      return window.wp.i18n.sprintf(window.wp.i18n.__("%1$s · %2$s", "structura"), more, last);
    },
    pillarsTitle: window.wp.i18n.__("Pillars", "structura"),
    pillarsBody: window.wp.i18n.__(
      "Long-term targets above your difficulty ceiling — published after the winnable ones.",
      "structura"
    ),
    variantsLine: (count2) => window.wp.i18n.sprintf(
      /* translators: %d: total long-tail variants across the bank. */
      window.wp.i18n._n(
        "%d long-tail variant ready — each post gets its own keyphrase, so seeds can safely repeat.",
        "%d long-tail variants ready — each post gets its own keyphrase, so seeds can safely repeat.",
        count2,
        "structura"
      ),
      count2
    ),
    movedToTop: window.wp.i18n.__("Moved to position 1", "structura")
  };
}
function keywordRowLabels() {
  return {
    remove: (keyword) => (
      /* translators: %s: the keyword. */
      window.wp.i18n.sprintf(window.wp.i18n.__("Remove %s", "structura"), keyword)
    ),
    moveToTop: (keyword) => (
      /* translators: %s: the keyword. */
      window.wp.i18n.sprintf(window.wp.i18n.__("Move %s to the top of the publish order", "structura"), keyword)
    ),
    provenance: {
      related_search: window.wp.i18n.__("Search-suggested — from live related-search data", "structura"),
      people_also_ask: window.wp.i18n.__(
        "People also ask — a question searchers pair with this topic",
        "structura"
      ),
      competitor_gap: window.wp.i18n.__("Competitor gap — they rank for it, you don't yet", "structura"),
      already_ranking: window.wp.i18n.__("Already ranking — your site has a foothold here", "structura"),
      ai_generated: window.wp.i18n.__(
        "AI-generated — no live search data; numbers are estimates",
        "structura"
      ),
      manual: window.wp.i18n.__("Added manually", "structura")
    },
    variants: (count2) => window.wp.i18n.sprintf(
      /* translators: %d: long-tail variants for this keyword. */
      window.wp.i18n._n(
        "%d long-tail variant ready as a per-post keyphrase",
        "%d long-tail variants ready as per-post keyphrases",
        count2,
        "structura"
      ),
      count2
    ),
    kd: (kd, state, ceiling) => {
      switch (state) {
        case "pillar":
          return window.wp.i18n.sprintf(
            window.wp.i18n.__("Difficulty %1$d — pillar (above your KD ≤ %2$d ceiling)", "structura"),
            kd,
            ceiling ?? 0
          );
        case "stretch":
          return window.wp.i18n.sprintf(
            window.wp.i18n.__("Difficulty %1$d — stretch (near your KD ≤ %2$d ceiling)", "structura"),
            kd,
            ceiling ?? 0
          );
        default:
          return window.wp.i18n.sprintf(window.wp.i18n.__("Difficulty %d — winnable for this site", "structura"), kd);
      }
    },
    volume: (formatted) => (
      /* translators: %s: compact monthly search volume, e.g. 2.9K. */
      window.wp.i18n.sprintf(window.wp.i18n.__("%s monthly searches", "structura"), formatted)
    ),
    intent: {
      informational: window.wp.i18n.__("DIY", "structura"),
      commercial: window.wp.i18n.__("Research", "structura")
    },
    bucket: {
      high: window.wp.i18n.__("High", "structura"),
      medium: window.wp.i18n.__("Medium", "structura"),
      low: window.wp.i18n.__("Low", "structura")
    },
    bucketEstimated: window.wp.i18n.__("Estimated volume bucket — no live search data", "structura"),
    pending: window.wp.i18n.__("Looking up search data…", "structura")
  };
}
const MODE_LABELS = {
  winnable: window.wp.i18n.__("Quick wins", "structura"),
  balanced: window.wp.i18n.__("Balanced", "structura"),
  authority: window.wp.i18n.__("Authority", "structura")
};
function keywordModeCaption(meta) {
  if (!meta?.resolvedMode) return { caption: null, tooltip: "" };
  const mode = MODE_LABELS[meta.resolvedMode];
  return {
    caption: meta.kdCeiling == null ? (
      /* translators: %s: difficulty mode label. */
      window.wp.i18n.sprintf(window.wp.i18n.__("%s · no KD cap", "structura"), mode)
    ) : (
      /* translators: 1: difficulty mode label, 2: KD ceiling. */
      window.wp.i18n.sprintf(window.wp.i18n.__("%1$s · KD ≤ %2$d", "structura"), mode, meta.kdCeiling)
    ),
    tooltip: window.wp.i18n.__(
      "Difficulty mode resolved from this site's organic footprint. Keywords above the ceiling become pillars, published last.",
      "structura"
    )
  };
}
function buildWizardResumeUrl(step) {
  if (typeof window === "undefined") return "";
  const url = new URL(window.location.href);
  url.hash = `/campaigns/new?resume=draft&step=${encodeURIComponent(step)}`;
  return url.toString();
}
const DOCS_URL$1 = docsUrl("using/campaigns/target-keywords");
const StepKeywords = window.wp.element.forwardRef(
  ({
    topic,
    topicSeeds,
    campaignName,
    language,
    provider,
    existingKeywords,
    existingDiscoveryMeta,
    onKeywordsChange,
    onPhaseChange,
    onSkipToNextStep
  }, ref) => {
    const { isPaidLicense, isLicensed, plan } = useLicense();
    const [phase, setPhase] = window.wp.element.useState(
      existingKeywords?.length ? "complete" : "idle"
    );
    const [keywords, setKeywords] = window.wp.element.useState(existingKeywords ?? []);
    const [error, setError] = window.wp.element.useState("");
    const [discoveryMeta, setDiscoveryMeta] = window.wp.element.useState(
      existingDiscoveryMeta ?? null
    );
    const dataPath = discoveryMeta?.path ?? null;
    const [newKeywordInput, setNewKeywordInput] = window.wp.element.useState("");
    const [listKey, setListKey] = window.wp.element.useState(0);
    const inputRef = window.wp.element.useRef(null);
    const { discoverKeywordsDetached, isDiscoveringKeywords, saveKeywords } = useCampaignMutations();
    const isRunning = isDiscoveringKeywords;
    window.wp.element.useEffect(() => {
      onKeywordsChange?.(keywords.length);
    }, [keywords.length, onKeywordsChange]);
    window.wp.element.useEffect(() => {
      onPhaseChange?.(phase);
    }, [phase, onPhaseChange]);
    window.wp.element.useImperativeHandle(
      ref,
      () => ({
        getKeywords: () => keywords,
        getDiscoveryMeta: () => discoveryMeta,
        save: async (id) => {
          await saveKeywords({ campaignId: id, keywords, discoveryMeta });
        },
        isBusy: isRunning || phase !== "complete" && phase !== "idle"
      }),
      [keywords, discoveryMeta, isRunning, phase, saveKeywords]
    );
    const runDiscovery = window.wp.element.useCallback(async () => {
      setPhase("extracting");
      setError("");
      const phaseTimer1 = setTimeout(() => setPhase("searching"), 4e3);
      const phaseTimer2 = setTimeout(() => setPhase("expanding"), 11e3);
      const phaseTimer3 = setTimeout(() => setPhase("curating"), 2e4);
      try {
        const result = await discoverKeywordsDetached({
          keyphrase: topic ?? "",
          campaign_name: campaignName ?? "",
          language: language ?? "default",
          provider: provider ?? "gemini",
          // Interview topics seed discovery directly; absent → cloud derives
          // seeds from the objective (keyphrase).
          ...topicSeeds?.length ? { topic_seeds: topicSeeds } : {}
        });
        clearTimeout(phaseTimer1);
        clearTimeout(phaseTimer2);
        clearTimeout(phaseTimer3);
        const metrics = result?.metrics ?? {};
        const discovered = (result?.keywords ?? []).map((k2) => {
          const m3 = metrics[k2.keyword];
          if (!m3) return k2;
          return {
            ...k2,
            ...typeof m3.volumeNumber === "number" ? { volumeNumber: m3.volumeNumber } : {},
            ...typeof m3.difficulty === "number" ? { difficulty: m3.difficulty } : {},
            ...m3.intent ? { intent: m3.intent } : {},
            ...typeof m3.variantCount === "number" ? { variantCount: m3.variantCount } : {}
          };
        });
        const path = result?.meta?.path;
        setDiscoveryMeta(
          path === "provider" || path === "legacy" ? {
            // Legacy runs carry no KD → "no cap": every row winnable,
            // no pillar group — the list is in estimated mode anyway.
            resolvedMode: result?.meta?.resolvedMode ?? "authority",
            kdCeiling: result?.meta?.kdCeiling ?? null,
            path
          } : null
        );
        setListKey((k2) => k2 + 1);
        setKeywords((prev) => {
          const manualKeywords = prev.filter((k2) => k2.source === "manual");
          const deduped = manualKeywords.filter(
            (m3) => !discovered.some(
              (d2) => d2.keyword.toLowerCase() === m3.keyword.toLowerCase()
            )
          );
          return [...discovered, ...deduped];
        });
        setPhase("complete");
        if (discovered.length === 0) {
          setError(
            window.wp.i18n.__(
              "No keywords were discovered for this topic. You can add keywords manually below.",
              "structura"
            )
          );
        }
      } catch (err) {
        clearTimeout(phaseTimer1);
        clearTimeout(phaseTimer2);
        clearTimeout(phaseTimer3);
        setError(
          err?.message ?? window.wp.i18n.__(
            "Keyword discovery failed. You can retry, add keywords manually, or skip this step.",
            "structura"
          )
        );
        setPhase("complete");
      }
    }, [topic, topicSeeds, campaignName, language, provider, discoverKeywordsDetached]);
    window.wp.element.useEffect(() => {
      if (isPaidLicense && !existingKeywords?.length && phase === "idle") {
        runDiscovery();
      }
    }, []);
    const removeKeyword = (keyword) => {
      setKeywords((prev) => prev.filter((k2) => k2.keyword !== keyword));
    };
    const moveKeywordToTop = (keyword) => {
      setKeywords((prev) => {
        const idx = prev.findIndex((k2) => k2.keyword === keyword);
        if (idx <= 0) return prev;
        return [prev[idx], ...prev.slice(0, idx), ...prev.slice(idx + 1)];
      });
    };
    const estimated = dataPath === "legacy";
    const kdCeiling = discoveryMeta?.kdCeiling ?? null;
    const bankItems = window.wp.element.useMemo(
      () => keywords.map((k2) => {
        const metrics = {};
        if (typeof k2.volumeNumber === "number") metrics.volumeNumber = k2.volumeNumber;
        if (k2.volume) metrics.volumeBucket = k2.volume;
        if (typeof k2.difficulty === "number") metrics.kd = k2.difficulty;
        if (k2.intent === "informational" || k2.intent === "commercial") metrics.intent = k2.intent;
        return {
          keyword: k2.keyword,
          source: Vn(k2.source),
          metrics,
          ...typeof k2.variantCount === "number" ? { variantCount: k2.variantCount } : {}
        };
      }),
      [keywords]
    );
    const modeCaption = keywordModeCaption(discoveryMeta);
    const addManualKeyword = () => {
      const raw = newKeywordInput.trim().toLowerCase();
      if (!raw || raw.length < 2) return;
      if (keywords.some((k2) => k2.keyword.toLowerCase() === raw)) {
        setNewKeywordInput("");
        return;
      }
      const newKw = {
        keyword: newKeywordInput.trim(),
        source: "manual",
        usageCount: 0
      };
      setKeywords((prev) => [...prev, newKw]);
      setNewKeywordInput("");
      inputRef.current?.focus();
    };
    const handleKeyDown = (e2) => {
      if (e2.key === "Enter") {
        e2.preventDefault();
        addManualKeyword();
      }
    };
    if (!isPaidLicense) {
      const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
      const returnTo = buildWizardResumeUrl("keywords");
      const portalUrl = buildPortalSignupUrl({
        intent: "unlock_keyword_bank",
        domain,
        plan,
        returnTo
      });
      const primaryLabel = isLicensed ? window.wp.i18n.__("Unlock with Pro", "structura") : window.wp.i18n.__("Create account", "structura");
      return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center py-12 text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "from-brand-50 dark:from-brand-950/30 mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-gradient-to-br to-purple-50 dark:to-purple-950/30" }, /* @__PURE__ */ window.wp.element.createElement(Key, { size: 28, className: "text-brand-400" })), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mb-2 text-base font-semibold text-neutral-800 dark:text-white" }, window.wp.i18n.__("Keyword Bank", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mx-auto mb-4 max-w-md text-sm text-neutral-500" }, window.wp.i18n.__(
        "Automatically discover 20–50 high-value keywords for your campaign using real Google search data. Keywords are targeted round-robin across your posts for consistent SEO coverage.",
        "structura"
      )), /* @__PURE__ */ window.wp.element.createElement("span", { className: "from-brand-500 inline-flex items-center gap-1.5 rounded-full bg-gradient-to-r to-purple-500 px-4 py-1.5 text-xs font-bold text-white" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 12 }), window.wp.i18n.__("Pro / Cloud Feature", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-10 flex flex-col items-center gap-3 sm:flex-row" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement("a", { href: portalUrl, target: "_blank", rel: "noopener noreferrer" }, primaryLabel, /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14, className: "ml-1.5" }))), onSkipToNextStep && /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "transparent", onClick: onSkipToNextStep }, window.wp.i18n.__("Skip & continue", "structura"), /* @__PURE__ */ window.wp.element.createElement(ChevronsRight, { size: 14, className: "ml-1" }))));
    }
    if (phase !== "complete" && phase !== "idle") {
      return /* @__PURE__ */ window.wp.element.createElement(KeywordDiscoveryLoader, { phase });
    }
    return /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-brand-100 bg-brand-50/50 dark:border-brand-900/30 dark:bg-brand-950/20 mb-5 rounded-xl border px-5 py-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Key, { size: 18, className: "text-brand-500 dark:text-brand-400 mt-0.5 shrink-0" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "text-xs leading-relaxed text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0!" }, window.wp.i18n.__(
      "Your Keyword Bank contains targetable keywords discovered from real Google search data. Structura picks one keyword per post in round-robin order, ensuring diverse SEO coverage across your campaign.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: DOCS_URL$1,
        target: "_blank",
        rel: "noopener noreferrer",
        className: "text-brand-600 hover:text-brand-700 dark:text-brand-400 dark:hover:text-brand-300 mt-2 inline-flex items-center gap-1 font-medium"
      },
      window.wp.i18n.__("Learn more", "structura"),
      /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 11 })
    )))), error && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-950/30" }, /* @__PURE__ */ window.wp.element.createElement(
      TriangleAlert,
      {
        size: 16,
        className: "mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"
      }
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1 text-xs text-amber-800 dark:text-amber-300" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0!" }, error)), /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => setError(""),
        className: "shrink-0 cursor-pointer rounded p-1 text-amber-400 hover:text-amber-600"
      },
      /* @__PURE__ */ window.wp.element.createElement(X, { size: 12 })
    )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex items-center justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-semibold text-neutral-800 dark:text-white" }, keywords.length > 0 ? window.wp.i18n.sprintf(window.wp.i18n.__("%d Keyword(s)", "structura"), keywords.length) : window.wp.i18n.__("Keyword Bank", "structura")), dataPath === "provider" ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success" }, window.wp.i18n.__("Live data", "structura")) : dataPath === "legacy" ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "warning" }, window.wp.i18n.__("AI estimate", "structura")) : null), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: runDiscovery, loading: isRunning }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: B$1("mr-2", isRunning && "animate-spin") }), keywords.length > 0 ? window.wp.i18n.__("Re-discover", "structura") : window.wp.i18n.__("Discover", "structura"))), keywords.length > 0 ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0! mb-4! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
      "Prefilled from your site's target keywords by default. Add, remove, or re-discover to tailor them for this campaign.",
      "structura"
    )) : null, dataPath === "legacy" && keywords.length > 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 rounded-md border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-900/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-700 dark:text-amber-300" }, window.wp.i18n.__(
      "These keywords were generated by AI based on your campaign objective. Real search-volume data wasn't available for this run — typically because your tier or workspace budget caps the SEO data provider, or this language isn't supported yet. Numbers are estimates.",
      "structura"
    ))) : null, keywords.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4" }, /* @__PURE__ */ window.wp.element.createElement(
      On,
      {
        key: listKey,
        items: bankItems,
        kdCeiling,
        estimated,
        modeCaption: modeCaption.caption,
        modeTooltip: modeCaption.tooltip,
        onRemove: removeKeyword,
        onMoveToTop: moveKeywordToTop,
        addInputRef: inputRef,
        locale: typeof document !== "undefined" ? document.documentElement.lang || void 0 : void 0,
        labels: keywordBankLabels(),
        rowLabels: keywordRowLabels()
      }
    )), keywords.length === 0 && !error && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 rounded-xl border border-dashed border-neutral-200 px-6 py-8 text-center dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(Search, { size: 24, className: "mx-auto mb-2 text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-xs text-neutral-400" }, window.wp.i18n.__("No keywords yet. Use Discover or add keywords manually below.", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(
      he,
      {
        ref: inputRef,
        label: window.wp.i18n.__("Add keyword", "structura"),
        hiddenLabel: true,
        size: "sm",
        value: newKeywordInput,
        onChange: (e2) => setNewKeywordInput(e2.target.value),
        onKeyDown: handleKeyDown,
        placeholder: window.wp.i18n.__(
          "Add a keyword manually (e.g. best WordPress SEO plugins)",
          "structura"
        ),
        rightAdornment: /* @__PURE__ */ window.wp.element.createElement(
          tr$1,
          {
            variant: "transparent",
            size: "sm",
            onClick: addManualKeyword,
            disabled: !newKeywordInput.trim()
          },
          /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 14, className: "mr-1" }),
          window.wp.i18n.__("Add", "structura")
        )
      }
    )));
  }
);
StepKeywords.displayName = "StepKeywords";
const KEYWORD_PIPELINE_STEPS = [
  {
    id: "extracting",
    label: window.wp.i18n.__("Analyzing", "structura"),
    description: window.wp.i18n.__("Studying your topic landscape…", "structura")
  },
  {
    id: "searching",
    label: window.wp.i18n.__("Discovering", "structura"),
    description: window.wp.i18n.__("Surfacing how readers search this niche…", "structura")
  },
  {
    id: "expanding",
    label: window.wp.i18n.__("Expanding", "structura"),
    description: window.wp.i18n.__("Mapping adjacent angles and long-tail variants…", "structura")
  },
  {
    id: "curating",
    label: window.wp.i18n.__("Curating", "structura"),
    description: window.wp.i18n.__("Ranking by relevance to your campaign…", "structura")
  }
];
const keywordPhaseIndex = (phase) => KEYWORD_PIPELINE_STEPS.findIndex((s2) => s2.id === phase);
const KeywordDiscoveryLoader = ({ phase }) => {
  const currentIdx = keywordPhaseIndex(phase);
  const currentStep = KEYWORD_PIPELINE_STEPS[currentIdx];
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center py-12" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative mb-8" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "from-brand-50 shadow-brand-100/50 dark:from-brand-950/50 dark:shadow-brand-900/20 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br to-purple-50 shadow-lg dark:to-purple-950/50" }, /* @__PURE__ */ window.wp.element.createElement(Key, { className: "text-brand-600 dark:text-brand-400 h-7 w-7" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-400 shadow-brand-400/50 absolute -top-1 -right-1 h-3 w-3 animate-pulse rounded-full shadow-lg" })), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mb-8 text-sm font-medium text-neutral-700 dark:text-neutral-300" }, currentStep?.description ?? ""), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex w-full max-w-md items-center justify-center" }, KEYWORD_PIPELINE_STEPS.map((step, i2) => {
    const isDone = i2 < currentIdx;
    const isActive = i2 === currentIdx;
    const isPending = i2 > currentIdx;
    return /* @__PURE__ */ window.wp.element.createElement("div", { key: step.id, className: "flex items-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-bold transition-all duration-500",
          isDone && "bg-emerald-100 text-emerald-600 dark:bg-emerald-950 dark:text-emerald-400",
          isActive && "bg-brand-100 text-brand-600 shadow-brand-200/50 dark:bg-brand-950 dark:text-brand-400 dark:shadow-brand-900/30 shadow-md",
          isPending && "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-600"
        )
      },
      isDone ? /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14 }) : isActive ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement("span", null, i2 + 1)
    ), /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "text-[10px] font-semibold transition-colors duration-500",
          isDone && "text-emerald-600 dark:text-emerald-400",
          isActive && "text-brand-600 dark:text-brand-400",
          isPending && "text-neutral-400 dark:text-neutral-600"
        )
      },
      step.label
    )), i2 < KEYWORD_PIPELINE_STEPS.length - 1 && /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "mb-5 h-px w-8 transition-colors duration-500",
          i2 < currentIdx ? "bg-emerald-200 dark:bg-emerald-800" : "bg-neutral-200 dark:bg-neutral-700"
        )
      }
    ));
  })));
};
const DOCS_URL = docsUrl("using/campaigns/authority-links");
const CATEGORY_ICONS = {
  academic: GraduationCap,
  government: Building2,
  research: BookOpen,
  publication: Newspaper,
  reference: BookOpen,
  industry: Globe,
  documentation: BookOpen,
  community: Globe
};
const CATEGORY_LABELS = {
  academic: window.wp.i18n.__("Academic", "structura"),
  government: window.wp.i18n.__("Government", "structura"),
  research: window.wp.i18n.__("Research", "structura"),
  publication: window.wp.i18n.__("Publication", "structura"),
  reference: window.wp.i18n.__("Reference", "structura"),
  industry: window.wp.i18n.__("Industry", "structura"),
  documentation: window.wp.i18n.__("Docs", "structura"),
  community: window.wp.i18n.__("Community", "structura")
};
const CATEGORY_COLORS = {
  academic: "bg-violet-50 text-violet-700 dark:bg-violet-950/30 dark:text-violet-400",
  government: "bg-blue-50 text-blue-700 dark:bg-blue-950/30 dark:text-blue-400",
  research: "bg-indigo-50 text-indigo-700 dark:bg-indigo-950/30 dark:text-indigo-400",
  publication: "bg-rose-50 text-rose-700 dark:bg-rose-950/30 dark:text-rose-400",
  reference: "bg-teal-50 text-teal-700 dark:bg-teal-950/30 dark:text-teal-400",
  industry: "bg-sky-50 text-sky-700 dark:bg-sky-950/30 dark:text-sky-400",
  documentation: "bg-amber-50 text-amber-700 dark:bg-amber-950/30 dark:text-amber-400",
  community: "bg-emerald-50 text-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-400"
};
const AuthorityDiscovery = window.wp.element.forwardRef(
  ({
    campaignId,
    topic,
    campaignName,
    language,
    provider,
    existingDomains,
    onDomainsChange,
    onPhaseChange,
    onSkipToNextStep
  }, ref) => {
    const { isPaidLicense, isLicensed, plan } = useLicense();
    const [phase, setPhase] = window.wp.element.useState(
      existingDomains?.length ? "complete" : "idle"
    );
    const [domains, setDomains] = window.wp.element.useState(existingDomains ?? []);
    const [error, setError] = window.wp.element.useState("");
    const [newDomainInput, setNewDomainInput] = window.wp.element.useState("");
    const inputRef = window.wp.element.useRef(null);
    const {
      discoverAuthority,
      isDiscovering,
      discoverAuthorityDetached,
      isDiscoveringDetached,
      saveAuthority
    } = useCampaignMutations();
    const isRunning = isDiscovering || isDiscoveringDetached;
    window.wp.element.useEffect(() => {
      onDomainsChange?.(domains.length);
    }, [domains.length, onDomainsChange]);
    window.wp.element.useEffect(() => {
      onPhaseChange?.(phase);
    }, [phase, onPhaseChange]);
    window.wp.element.useImperativeHandle(
      ref,
      () => ({
        getDomains: () => domains,
        save: async (id) => {
          await saveAuthority({ campaignId: id, domains });
        },
        isBusy: isRunning || phase !== "complete" && phase !== "idle"
      }),
      [domains, isRunning, phase, saveAuthority]
    );
    const runDiscovery = window.wp.element.useCallback(async () => {
      setPhase("extracting");
      setError("");
      const phaseTimer1 = setTimeout(() => setPhase("suggesting"), 3e3);
      const phaseTimer2 = setTimeout(() => setPhase("verifying"), 8e3);
      try {
        let result;
        if (campaignId) {
          result = await discoverAuthority({ campaignId });
        } else {
          result = await discoverAuthorityDetached({
            keyphrase: topic ?? "",
            campaign_name: campaignName ?? "",
            language: language ?? "default",
            provider: provider ?? "gemini"
          });
        }
        clearTimeout(phaseTimer1);
        clearTimeout(phaseTimer2);
        const discovered = result?.domains ?? [];
        setDomains((prev) => {
          const manualDomains = prev.filter(
            (d2) => d2.description === window.wp.i18n.__("Manually added", "structura")
          );
          const deduped = manualDomains.filter(
            (m3) => !discovered.some((d2) => d2.domain.toLowerCase() === m3.domain.toLowerCase())
          );
          return [...discovered, ...deduped];
        });
        setPhase("complete");
        if (discovered.length === 0) {
          setError(
            window.wp.i18n.__(
              "No authority domains were found for this niche. You can add domains manually below.",
              "structura"
            )
          );
        }
      } catch (err) {
        clearTimeout(phaseTimer1);
        clearTimeout(phaseTimer2);
        setError(
          err?.message ?? window.wp.i18n.__(
            "Discovery failed. You can retry, add domains manually, or skip this step.",
            "structura"
          )
        );
        setPhase("complete");
      }
    }, [
      campaignId,
      topic,
      campaignName,
      language,
      provider,
      discoverAuthority,
      discoverAuthorityDetached
    ]);
    window.wp.element.useEffect(() => {
      if (isPaidLicense && !existingDomains?.length && phase === "idle") {
        runDiscovery();
      }
    }, []);
    const removeDomain = (domain) => {
      setDomains((prev) => prev.filter((d2) => d2.domain !== domain));
    };
    const addManualDomain = () => {
      const raw = newDomainInput.trim().toLowerCase().replace(/^(https?:\/\/)?(www\.)?/, "").replace(/\/.*$/, "");
      if (!raw || raw.length < 3 || !raw.includes(".")) return;
      if (domains.some((d2) => d2.domain === raw)) {
        setNewDomainInput("");
        return;
      }
      const newDomain = {
        domain: raw,
        description: window.wp.i18n.__("Manually added", "structura"),
        tier: "niche",
        citedBy: 0,
        category: "industry",
        sampleUrls: []
      };
      setDomains((prev) => [...prev, newDomain]);
      setNewDomainInput("");
      inputRef.current?.focus();
    };
    const handleKeyDown = (e2) => {
      if (e2.key === "Enter") {
        e2.preventDefault();
        addManualDomain();
      }
    };
    if (!isPaidLicense) {
      const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
      const returnTo = buildWizardResumeUrl("authority");
      const portalUrl = buildPortalSignupUrl({
        intent: "unlock_authority",
        domain,
        plan,
        returnTo
      });
      const primaryLabel = isLicensed ? window.wp.i18n.__("Unlock with Pro", "structura") : window.wp.i18n.__("Create account", "structura");
      return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center py-12 text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "from-brand-50 dark:from-brand-950/30 mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-gradient-to-br to-purple-50 dark:to-purple-950/30" }, /* @__PURE__ */ window.wp.element.createElement(Shield, { size: 28, className: "text-brand-400" })), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mb-2 text-base font-semibold text-neutral-800 dark:text-white" }, window.wp.i18n.__("Authority Sources", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mx-auto mb-4 max-w-md text-sm text-neutral-500" }, window.wp.i18n.__(
        "Discover real, validated authority domains for your niche — academic, government, research, and reference sources. Every outbound link is verified live before it ships in a post.",
        "structura"
      )), /* @__PURE__ */ window.wp.element.createElement("span", { className: "from-brand-500 inline-flex items-center gap-1.5 rounded-full bg-gradient-to-r to-purple-500 px-4 py-1.5 text-xs font-bold text-white" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 12 }), window.wp.i18n.__("Pro / Cloud Feature", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-10 flex flex-col items-center gap-3 sm:flex-row" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement("a", { href: portalUrl, target: "_blank", rel: "noopener noreferrer" }, primaryLabel, /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14, className: "ml-1.5" }))), onSkipToNextStep && /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "transparent", onClick: onSkipToNextStep }, window.wp.i18n.__("Skip & continue", "structura"), /* @__PURE__ */ window.wp.element.createElement(ChevronsRight, { size: 14, className: "ml-1" }))));
    }
    if (phase !== "complete" && phase !== "idle") {
      return /* @__PURE__ */ window.wp.element.createElement(DiscoveryLoader, { phase });
    }
    return /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-brand-100 bg-brand-50/50 dark:border-brand-900 dark:bg-brand-950/50 mb-5 rounded-xl border px-5 py-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Shield, { size: 18, className: "text-brand-500 dark:text-brand-400 mt-0.5 shrink-0" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "text-xs leading-relaxed text-neutral-600 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0!" }, window.wp.i18n.__(
      "Authority Sources are high-quality domains that Structura uses for outbound links in your posts. We automatically discover and vet trusted sources specific to your niche — you can review, edit, or add your own below.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: DOCS_URL,
        target: "_blank",
        rel: "noopener noreferrer",
        className: "text-brand-600 hover:text-brand-700 dark:text-brand-400 dark:hover:text-brand-300 mt-2 inline-flex items-center gap-1 font-medium"
      },
      window.wp.i18n.__("Learn more", "structura"),
      /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 11 })
    )))), error && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex items-start gap-3 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 dark:border-amber-800 dark:bg-amber-950/30" }, /* @__PURE__ */ window.wp.element.createElement(
      TriangleAlert,
      {
        size: 16,
        className: "mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"
      }
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1 text-xs text-amber-800 dark:text-amber-300" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0!" }, error)), /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => setError(""),
        className: "shrink-0 cursor-pointer rounded p-1 text-amber-400 hover:text-amber-600"
      },
      /* @__PURE__ */ window.wp.element.createElement(X, { size: 12 })
    )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-5 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "text-sm font-semibold text-neutral-800 dark:text-white" }, domains.length > 0 ? window.wp.i18n.sprintf(window.wp.i18n.__("%d Authority Source(s)", "structura"), domains.length) : window.wp.i18n.__("Authority Sources", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: runDiscovery, loading: isRunning }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: B$1("mr-2", isRunning && "animate-spin") }), domains.length > 0 ? window.wp.i18n.__("Re-discover", "structura") : window.wp.i18n.__("Discover", "structura"))), domains.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex flex-wrap gap-2" }, domains.map((d2) => /* @__PURE__ */ window.wp.element.createElement(DomainPill, { key: d2.domain, domain: d2, onRemove: () => removeDomain(d2.domain) }))), domains.length === 0 && !error && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 rounded-xl border border-dashed border-neutral-200 px-6 py-8 text-center dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(Globe, { size: 24, className: "mx-auto mb-2 text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-xs text-neutral-400" }, window.wp.i18n.__("No domains yet. Use Discover or add domains manually below.", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement(
      he,
      {
        ref: inputRef,
        label: window.wp.i18n.__("Add domain", "structura"),
        hiddenLabel: true,
        size: "sm",
        value: newDomainInput,
        onChange: (e2) => setNewDomainInput(e2.target.value),
        onKeyDown: handleKeyDown,
        placeholder: window.wp.i18n.__("Add a domain manually (e.g. moz.com)", "structura"),
        rightAdornment: /* @__PURE__ */ window.wp.element.createElement(
          tr$1,
          {
            variant: "transparent",
            size: "sm",
            onClick: addManualDomain,
            disabled: !newDomainInput.trim()
          },
          /* @__PURE__ */ window.wp.element.createElement(Plus, { size: 14, className: "mr-1" }),
          window.wp.i18n.__("Add", "structura")
        )
      }
    )));
  }
);
AuthorityDiscovery.displayName = "AuthorityDiscovery";
const DomainFavicon = ({ domain, category }) => /* @__PURE__ */ window.wp.element.createElement(At, { domain, fallback: CATEGORY_ICONS[category] ?? Globe });
const DomainPill = ({
  domain,
  onRemove
}) => {
  const tierColor = domain.tier === "universal" ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-950/30 dark:text-emerald-400" : "bg-blue-50 text-blue-700 dark:bg-blue-950/30 dark:text-blue-400";
  const tierLabel2 = domain.tier === "universal" ? window.wp.i18n.__("Universal", "structura") : window.wp.i18n.__("Niche", "structura");
  const categoryLabel2 = CATEGORY_LABELS[domain.category] ?? domain.category;
  const categoryColor = CATEGORY_COLORS[domain.category] ?? "bg-neutral-50 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-400";
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: "group flex items-center gap-1.5 rounded-lg border border-neutral-100 bg-white px-3 py-1.5 text-xs transition-colors hover:border-neutral-200 dark:border-neutral-800 dark:bg-neutral-900 dark:hover:border-neutral-700",
      title: domain.description
    },
    /* @__PURE__ */ window.wp.element.createElement(DomainFavicon, { domain: domain.domain, category: domain.category }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-700 dark:text-neutral-300" }, domain.domain),
    /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1("shrink-0 rounded px-1.5 py-0.5 text-[9px] font-bold uppercase", tierColor)
      },
      tierLabel2
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "shrink-0 rounded px-1.5 py-0.5 text-[9px] font-bold uppercase",
          categoryColor
        )
      },
      categoryLabel2
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: onRemove,
        className: "ml-0.5 shrink-0 cursor-pointer rounded p-0.5 text-neutral-400 transition-colors hover:text-red-500",
        title: window.wp.i18n.__("Remove domain", "structura")
      },
      /* @__PURE__ */ window.wp.element.createElement(X, { size: 10 })
    )
  );
};
const PIPELINE_STEPS = [
  {
    id: "extracting",
    label: window.wp.i18n.__("Analyzing", "structura"),
    description: window.wp.i18n.__("Understanding your campaign objective and niche…", "structura")
  },
  {
    id: "suggesting",
    label: window.wp.i18n.__("Discovering", "structura"),
    description: window.wp.i18n.__("Identifying authoritative domains in your topic space…", "structura")
  },
  {
    id: "verifying",
    label: window.wp.i18n.__("Verifying", "structura"),
    description: window.wp.i18n.__("Checking domain availability and validating sources…", "structura")
  }
];
const phaseIndex = (phase) => PIPELINE_STEPS.findIndex((s2) => s2.id === phase);
const DiscoveryLoader = ({ phase }) => {
  const currentIdx = phaseIndex(phase);
  const currentStep = PIPELINE_STEPS[currentIdx];
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center py-12" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "relative mb-8" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "from-brand-50 shadow-brand-100/50 dark:from-brand-950/50 dark:shadow-brand-900/20 flex h-16 w-16 items-center justify-center rounded-2xl bg-gradient-to-br to-purple-50 shadow-lg dark:to-purple-950/50" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { className: "text-brand-600 dark:text-brand-400 h-7 w-7" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-400 shadow-brand-400/50 absolute -top-1 -right-1 h-3 w-3 animate-pulse rounded-full shadow-lg" })), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mb-8 text-sm font-medium text-neutral-700 dark:text-neutral-300" }, currentStep?.description ?? ""), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex w-full max-w-sm items-center justify-center" }, PIPELINE_STEPS.map((step, i2) => {
    const isDone = i2 < currentIdx;
    const isActive = i2 === currentIdx;
    const isPending = i2 > currentIdx;
    return /* @__PURE__ */ window.wp.element.createElement("div", { key: step.id, className: "flex items-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-bold transition-all duration-500",
          isDone && "bg-emerald-100 text-emerald-600 dark:bg-emerald-950 dark:text-emerald-400",
          isActive && "bg-brand-100 text-brand-600 shadow-brand-200/50 dark:bg-brand-950 dark:text-brand-400 dark:shadow-brand-900/30 shadow-md",
          isPending && "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-600"
        )
      },
      isDone ? /* @__PURE__ */ window.wp.element.createElement(Check, { size: 14 }) : isActive ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement("span", null, i2 + 1)
    ), /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "text-[10px] font-semibold transition-colors duration-500",
          isDone && "text-emerald-600 dark:text-emerald-400",
          isActive && "text-brand-600 dark:text-brand-400",
          isPending && "text-neutral-400 dark:text-neutral-600"
        )
      },
      step.label
    )), i2 < PIPELINE_STEPS.length - 1 && /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "mb-5 h-px w-10 transition-colors duration-500",
          i2 < currentIdx ? "bg-emerald-200 dark:bg-emerald-800" : "bg-neutral-200 dark:bg-neutral-700"
        )
      }
    ));
  })));
};
function randInt(min2, max2) {
  return Math.floor(Math.random() * (max2 - min2 + 1)) + min2;
}
function pickRandom(arr, count2) {
  const shuffled = [...arr].sort(() => Math.random() - 0.5);
  return shuffled.slice(0, Math.min(count2, arr.length));
}
const WEEKDAYS = [1, 2, 3, 4, 5];
function generateHumanizedSchedule(postsPerPeriod, unit) {
  if (unit === "week") {
    return generateWeeklySchedule(postsPerPeriod);
  }
  return generateMonthlySchedule(postsPerPeriod);
}
function generateWeeklySchedule(postsPerWeek) {
  const count2 = Math.max(1, Math.min(postsPerWeek, 7));
  let selectedDays;
  if (count2 <= 5) {
    selectedDays = pickRandom(WEEKDAYS, count2);
  } else {
    selectedDays = [...WEEKDAYS, ...pickRandom([0, 6], count2 - 5)];
  }
  selectedDays.sort((a3, b2) => a3 - b2);
  const isMorning = Math.random() > 0.4;
  const hour = isMorning ? randInt(7, 11) : randInt(13, 17);
  const minute = randInt(0, 59);
  const cron = `${minute} ${hour} * * ${selectedDays.join(",")}`;
  const description = window.wp.i18n.sprintf(
    // translators: %d is the number of posts per week.
    window.wp.i18n._n("%d post per week", "%d posts per week", count2, "structura"),
    count2
  );
  return { cron, description };
}
function generateMonthlySchedule(postsPerMonth) {
  const count2 = Math.max(1, Math.min(postsPerMonth, 4));
  const spacing = Math.floor(28 / count2);
  const days = [];
  for (let i2 = 0; i2 < count2; i2++) {
    const base = 1 + i2 * spacing;
    const jittered = Math.max(1, Math.min(28, base + randInt(-2, 2)));
    days.push(jittered);
  }
  const uniqueDays = [...new Set(days)].sort((a3, b2) => a3 - b2);
  const isMorning = Math.random() > 0.4;
  const hour = isMorning ? randInt(7, 11) : randInt(13, 17);
  const minute = randInt(0, 59);
  const cron = `${minute} ${hour} ${uniqueDays.join(",")} * *`;
  const description = window.wp.i18n.sprintf(
    // translators: %d is the number of posts per month.
    window.wp.i18n._n("%d post per month", "%d posts per month", count2, "structura"),
    count2
  );
  return { cron, description };
}
function parseSimpleFrequency(cron) {
  if (!cron) return null;
  const parts = cron.split(" ");
  if (parts.length < 5) return null;
  const [, , dayOfMonth, , dayOfWeek] = parts;
  if (dayOfMonth === "*" && dayOfWeek !== "*") {
    const days = dayOfWeek.split(",").filter(Boolean);
    return { count: days.length, unit: "week" };
  }
  if (dayOfMonth !== "*" && dayOfWeek === "*") {
    const days = dayOfMonth.split(",").filter(Boolean);
    return { count: days.length, unit: "month" };
  }
  if (dayOfMonth === "*" && dayOfWeek === "*") {
    return { count: 7, unit: "week" };
  }
  return null;
}
const LocalTimeDisplay = ({ utcTime }) => {
  const [hours, minutes] = utcTime.split(":").map(Number);
  const engineTime = dayjs.utc().hour(hours).minute(minutes);
  const localFormatted = engineTime.local().format("LT");
  const zoneName = dayjs.tz.guess();
  return /* @__PURE__ */ window.wp.element.createElement("span", { className: "ml-2 text-[10px] font-medium text-neutral-400 italic" }, "(", localFormatted, " ", zoneName, ")");
};
const ScheduleBuilder = () => {
  const { formData, updateForm, isCreate } = useCampaignForm();
  const { isPaidLicense, plan } = useLicense();
  const lockCadence = !isPaidLicense && isCreate;
  const upgradeUrl = buildPortalSignupUrl({
    intent: "unlock_cadence",
    domain: typeof window !== "undefined" ? window.location.hostname : void 0,
    plan
  });
  const { cron: currentCron } = formData.schedule;
  const [frequency, setFrequency] = window.wp.element.useState("weekly");
  const [time, setTime] = window.wp.element.useState("09:00");
  const [days, setDays] = window.wp.element.useState([1, 3, 5]);
  const [dayOfMonth, setDayOfMonth] = window.wp.element.useState(1);
  const dayLabels = [
    { label: window.wp.i18n.__("Mon", "structura"), val: 1 },
    { label: window.wp.i18n.__("Tue", "structura"), val: 2 },
    { label: window.wp.i18n.__("Wed", "structura"), val: 3 },
    { label: window.wp.i18n.__("Thu", "structura"), val: 4 },
    { label: window.wp.i18n.__("Fri", "structura"), val: 5 },
    { label: window.wp.i18n.__("Sat", "structura"), val: 6 },
    { label: window.wp.i18n.__("Sun", "structura"), val: 0 }
  ];
  window.wp.element.useEffect(() => {
    if (currentCron) {
      const parsed = parseCronForUi(currentCron);
      if (parsed) {
        setFrequency(parsed.frequency);
        setTime(parsed.time);
        setDays(parsed.days);
        setDayOfMonth(parsed.dayOfMonth);
      }
    }
  }, []);
  window.wp.element.useEffect(() => {
    const [hours, minutes] = time.split(":").map(Number);
    let cron = "";
    switch (frequency) {
      case "daily":
        cron = `${minutes} ${hours} * * *`;
        break;
      case "weekly":
        cron = `${minutes} ${hours} * * ${days.length ? days.sort().join(",") : "*"}`;
        break;
      case "monthly":
        cron = `${minutes} ${hours} ${dayOfMonth} * *`;
        break;
    }
    if (cron !== currentCron) {
      updateForm("schedule", { cron });
    }
  }, [frequency, time, days, dayOfMonth, currentCron, updateForm]);
  window.wp.element.useEffect(() => {
    if (!lockCadence) return;
    if (frequency === "daily") setFrequency("weekly");
    if (days.length > 1) setDays((prev) => [[...prev].sort((a3, b2) => a3 - b2)[0]]);
  }, [lockCadence, frequency, days]);
  const toggleDay = (val) => {
    if (lockCadence) {
      setDays([val]);
      return;
    }
    setDays((prev) => prev.includes(val) ? prev.filter((d2) => d2 !== val) : [...prev, val]);
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "w-full overflow-hidden rounded-2xl border border-neutral-200 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-neutral-100 bg-neutral-50 px-6 py-3 dark:border-neutral-700 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 text-brand-600 dark:text-brand-400" }, /* @__PURE__ */ window.wp.element.createElement(CalendarClock, { size: 16 }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-900 dark:text-white uppercase" }, window.wp.i18n.__("Deployment Pulse", "structura")))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6 p-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-3 rounded-xl bg-neutral-100 p-1 dark:bg-neutral-800" }, ["daily", "weekly", "monthly"].map((f2) => {
    const locked = lockCadence && f2 === "daily";
    return /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        key: f2,
        type: "button",
        disabled: locked,
        "aria-disabled": locked,
        onClick: () => {
          if (!locked) setFrequency(f2);
        },
        title: locked ? window.wp.i18n.__("Daily publishing is available on paid plans.", "structura") : void 0,
        className: B$1(
          "flex items-center justify-center gap-1 rounded-lg py-2 text-[10px] font-black uppercase transition-all duration-fast",
          locked ? "cursor-not-allowed text-neutral-300 dark:text-neutral-600" : "cursor-pointer",
          !locked && frequency === f2 ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : !locked && "text-neutral-400 hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-400"
        )
      },
      locked && /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 9 }),
      window.wp.i18n.__(f2, "structura")
    );
  })), lockCadence && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: upgradeUrl,
      target: "_blank",
      rel: "noreferrer",
      className: "flex items-center gap-2 rounded-xl border border-brand-100 bg-brand-50/50 px-3 py-2.5 text-[11px] font-medium text-brand-700 transition-colors hover:bg-brand-50 dark:border-brand-900/30 dark:bg-brand-950/20 dark:text-brand-300 dark:hover:bg-brand-950/40"
    },
    /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 12, className: "shrink-0" }),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex-1" }, window.wp.i18n.__(
      "Free plans publish one post a week. Go Pro for daily and Smart scheduling.",
      "structura"
    )),
    /* @__PURE__ */ window.wp.element.createElement(ArrowUpRight, { size: 14, className: "shrink-0" })
  ), frequency === "weekly" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in fade-in slide-in-from-top-1 space-y-3 duration-300" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-between gap-1.5" }, dayLabels.map((d2) => /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: d2.val,
      type: "button",
      onClick: () => toggleDay(d2.val),
      className: B$1(
        "h-10 flex-1 cursor-pointer rounded-lg border text-[11px] font-bold transition-all",
        days.includes(d2.val) ? "border-brand-600 bg-brand-600/10 text-brand-600 dark:border-brand-400 dark:bg-brand-950/20 dark:text-brand-400" : "border-neutral-200 bg-white text-neutral-500 hover:border-brand-300 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:border-brand-400"
      )
    },
    d2.label
  )))), frequency === "monthly" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in fade-in slide-in-from-top-1 space-y-3 duration-300" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Specific Day of Month", "structura"),
      type: "number",
      min: "1",
      max: "31",
      value: dayOfMonth,
      onChange: (e2) => setDayOfMonth(parseInt(e2.target.value)),
      className: "max-w-xs",
      inputClassName: "font-mono font-bold text-brand-600 dark:text-brand-400",
      rightAdornment: /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black text-neutral-400 uppercase" }, window.wp.i18n.__("Day", "structura"))
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-t border-neutral-100 pt-6" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Execution Window", "structura")), /* @__PURE__ */ window.wp.element.createElement(LocalTimeDisplay, { utcTime: time })), /* @__PURE__ */ window.wp.element.createElement(
    "input",
    {
      type: "time",
      value: time,
      onChange: (e2) => setTime(e2.target.value),
      className: "rounded-lg border border-neutral-200 bg-neutral-50 px-3 py-2 text-sm font-bold text-neutral-900 outline-none focus:border-brand-500 focus:ring-1 focus:ring-brand-500 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:focus:border-brand-400 dark:focus:ring-brand-400"
    }
  ))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-t border-neutral-100 bg-brand-50/30 p-4 dark:border-neutral-700 dark:bg-brand-950/10" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-8 shrink-0 items-center justify-center rounded-full border border-emerald-100 bg-emerald-50 text-emerald-600" }, /* @__PURE__ */ window.wp.element.createElement(Check, { size: 16 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "overflow-hidden" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-[9px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Parsed Autonomous Rhythm", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "truncate text-xs font-bold text-brand-900 dark:text-brand-300" }, cronToHuman(currentCron))))));
};
const END_CONDITION_OPTIONS = [
  { value: "infinite", label: window.wp.i18n.__("Run forever", "structura") },
  { value: "quota", label: window.wp.i18n.__("Stop after N posts", "structura") },
  { value: "date", label: window.wp.i18n.__("Stop on a date", "structura") }
];
const SimpleStepRhythm = () => {
  const { formData, updateForm, isCreate } = useCampaignForm();
  const { isPaidLicense } = useLicense();
  const lockSmart = !isPaidLicense && isCreate;
  const [scheduleMode, setScheduleMode] = window.wp.element.useState(
    lockSmart ? "manual" : "humanized"
  );
  const [postsCount, setPostsCount] = window.wp.element.useState(3);
  const [unit, setUnit] = window.wp.element.useState("week");
  window.wp.element.useEffect(() => {
    if (lockSmart && scheduleMode !== "manual") setScheduleMode("manual");
  }, [lockSmart, scheduleMode]);
  window.wp.element.useEffect(() => {
    const parsed = parseSimpleFrequency(formData.schedule.cron);
    if (parsed) {
      setPostsCount(parsed.count);
      setUnit(parsed.unit);
    }
  }, []);
  window.wp.element.useEffect(() => {
    if (scheduleMode !== "humanized") return;
    const { cron } = generateHumanizedSchedule(postsCount, unit);
    updateForm("schedule", { cron });
  }, [postsCount, unit, scheduleMode]);
  const endType = formData.schedule.endCondition.type;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in slide-in-from-right-4 space-y-6 duration-500" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "overflow-hidden rounded-2xl border border-neutral-200 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-neutral-100 bg-neutral-50 px-5 py-3 dark:border-neutral-800 dark:bg-neutral-800/50" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(CalendarClock, { size: 15, className: "text-brand-600 dark:text-brand-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-900 uppercase dark:text-white" }, window.wp.i18n.__("Publishing Frequency", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex gap-1 rounded-lg bg-neutral-100 p-0.5 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      disabled: lockSmart,
      "aria-disabled": lockSmart,
      onClick: () => {
        if (!lockSmart) setScheduleMode("humanized");
      },
      title: lockSmart ? window.wp.i18n.__("Smart scheduling is available on paid plans.", "structura") : void 0,
      className: B$1(
        "flex items-center gap-1 rounded-lg px-2.5 py-1 text-[9px] font-black uppercase transition-all duration-fast ease-out",
        lockSmart ? "cursor-not-allowed text-neutral-300 dark:text-neutral-600" : "cursor-pointer",
        !lockSmart && scheduleMode === "humanized" ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : !lockSmart && "text-neutral-400 hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300"
      )
    },
    lockSmart ? /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 10 }) : /* @__PURE__ */ window.wp.element.createElement(Shuffle, { size: 10 }),
    window.wp.i18n.__("Smart", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setScheduleMode("manual"),
      className: B$1(
        "flex cursor-pointer items-center gap-1 rounded-lg px-2.5 py-1 text-[9px] font-black uppercase transition-all duration-fast ease-out",
        scheduleMode === "manual" ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : "text-neutral-400 hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement(SlidersHorizontal, { size: 10 }),
    window.wp.i18n.__("Manual", "structura")
  ))), scheduleMode === "humanized" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-5 p-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300" }, window.wp.i18n.__("Publish", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex gap-1.5" }, [1, 2, 3, 4, 5, 6, 7].map((n2) => /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: n2,
      type: "button",
      onClick: () => setPostsCount(n2),
      className: B$1(
        "flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg border text-sm font-bold transition-all duration-fast ease-out",
        postsCount === n2 ? "border-brand-600 bg-brand-600/10 text-brand-600 dark:border-brand-500 dark:bg-brand-500/10 dark:text-brand-400" : "border-neutral-200 bg-white text-neutral-500 hover:border-brand-300 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:border-brand-500/40"
      )
    },
    n2
  ))), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300" }, postsCount === 1 ? window.wp.i18n.__("post per", "structura") : window.wp.i18n.__("posts per", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex gap-1.5" }, ["week", "month"].map((u2) => /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: u2,
      type: "button",
      onClick: () => setUnit(u2),
      className: B$1(
        "cursor-pointer rounded-lg border px-3 py-1.5 text-[10px] font-black uppercase transition-all duration-fast ease-out",
        unit === u2 ? "border-brand-600 bg-brand-600/10 text-brand-600 dark:border-brand-500 dark:bg-brand-500/10 dark:text-brand-400" : "border-neutral-200 bg-white text-neutral-500 hover:border-brand-300 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:border-brand-500/40"
      )
    },
    u2 === "week" ? window.wp.i18n.__("week", "structura") : window.wp.i18n.__("month", "structura")
  )))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3 rounded-xl border border-emerald-100 bg-emerald-50/50 p-3 dark:border-emerald-900/30 dark:bg-emerald-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-7 shrink-0 items-center justify-center rounded-full bg-emerald-100 text-emerald-600 dark:bg-emerald-900/30 dark:text-emerald-400" }, /* @__PURE__ */ window.wp.element.createElement(Shuffle, { size: 14 })), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] font-bold text-emerald-800 dark:text-emerald-300" }, window.wp.i18n.__("Humanized schedule active", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[10px] leading-relaxed text-emerald-600/80 dark:text-emerald-400/70" }, window.wp.i18n.__(
    "Publishing days and times are randomized to create a natural rhythm. Posts will land at varied but reasonable hours across the period.",
    "structura"
  ))))), scheduleMode === "manual" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "p-0" }, /* @__PURE__ */ window.wp.element.createElement(ScheduleBuilder, null))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "overflow-hidden rounded-2xl border border-neutral-200 bg-white shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 border-b border-neutral-100 bg-neutral-50 px-5 py-3 dark:border-neutral-800 dark:bg-neutral-800/50" }, /* @__PURE__ */ window.wp.element.createElement(Clock, { size: 15, className: "text-brand-600 dark:text-brand-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-900 uppercase dark:text-white" }, window.wp.i18n.__("Lifecycle", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4 p-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-3 rounded-xl bg-neutral-100 p-1 dark:bg-neutral-800" }, END_CONDITION_OPTIONS.map((opt) => /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: opt.value,
      type: "button",
      onClick: () => updateForm("schedule", {
        endCondition: {
          type: opt.value,
          value: opt.value === "quota" ? 30 : opt.value === "date" ? dayjs().add(1, "month").format("YYYY-MM-DD") : ""
        }
      }),
      className: B$1(
        "cursor-pointer rounded-lg py-2 text-[10px] font-black uppercase transition-all duration-fast ease-out",
        endType === opt.value ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : "text-neutral-400 hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300"
      )
    },
    opt.label
  ))), endType === "quota" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in fade-in slide-in-from-top-1" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Total posts to publish", "structura"),
      type: "number",
      min: "1",
      max: "10000",
      value: formData.schedule.endCondition.value,
      onChange: (e2) => updateForm("schedule", {
        endCondition: { type: "quota", value: parseInt(e2.target.value) || 1 }
      }),
      rightAdornment: /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black text-neutral-400 uppercase" }, window.wp.i18n.__("posts", "structura"))
    }
  )), endType === "date" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in fade-in slide-in-from-top-1" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("End date", "structura"),
      type: "date",
      value: formData.schedule.endCondition.value,
      onChange: (e2) => updateForm("schedule", {
        endCondition: { type: "date", value: e2.target.value }
      })
    }
  )), endType === "infinite" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in fade-in slide-in-from-top-1 flex items-center gap-2 rounded-lg border border-neutral-100 bg-neutral-50/50 p-3 dark:border-neutral-800 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement(Infinity$1, { size: 14, className: "text-neutral-400 dark:text-neutral-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-medium text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("The campaign will run continuously until you pause or stop it.", "structura"))))));
};
const TaxonomySection = ({
  title,
  icon,
  mode,
  setMode,
  items,
  selected,
  setSelected
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "overflow-hidden rounded-2xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-4 flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 text-brand-600 dark:text-brand-400" }, icon, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-black tracking-widest text-neutral-900 uppercase dark:text-white" }, title)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex rounded-lg bg-neutral-100 p-1 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
  "button",
  {
    onClick: () => setMode("auto"),
    className: B$1(
      "rounded-lg px-3 py-1 text-[10px] font-black transition-all",
      mode === "auto" ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : "cursor-pointer text-neutral-400"
    )
  },
  window.wp.i18n.__("Autonomous", "structura")
), /* @__PURE__ */ window.wp.element.createElement(
  "button",
  {
    onClick: () => setMode("restricted"),
    className: B$1(
      "rounded-lg px-3 py-1 text-[10px] font-black transition-all",
      mode === "restricted" ? "bg-white text-brand-600 shadow-sm dark:bg-neutral-700 dark:text-brand-400" : "cursor-pointer text-neutral-400"
    )
  },
  window.wp.i18n.__("Restricted", "structura")
), /* @__PURE__ */ window.wp.element.createElement(
  "button",
  {
    onClick: () => setMode("disabled"),
    className: B$1(
      "rounded-lg px-3 py-1 text-[10px] font-black transition-all",
      mode === "disabled" ? "bg-white text-rose-500 shadow-sm dark:bg-neutral-700 dark:text-rose-400" : "cursor-pointer text-neutral-400"
    )
  },
  window.wp.i18n.__("Disabled", "structura")
))), mode === "restricted" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in fade-in mt-4 grid max-h-32 grid-cols-2 gap-2 overflow-y-auto duration-300" }, items.map((item) => /* @__PURE__ */ window.wp.element.createElement(
  "label",
  {
    key: item.id,
    className: B$1("flex cursor-pointer items-center gap-2 rounded-lg border border-neutral-50 p-2 hover:bg-neutral-50 dark:border-neutral-700 dark:hover:bg-neutral-800")
  },
  /* @__PURE__ */ window.wp.element.createElement(
    "input",
    {
      type: "checkbox",
      checked: selected.includes(item.id),
      onChange: (e2) => {
        const next = e2.target.checked ? [...selected, item.id] : selected.filter((id) => id !== item.id);
        setSelected(next);
      },
      className: "rounded border-neutral-300 text-brand-600 dark:border-neutral-600 dark:bg-neutral-800"
    }
  ),
  /* @__PURE__ */ window.wp.element.createElement("span", { className: "truncate text-[11px] font-bold text-neutral-600" }, item.name)
))), mode === "auto" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 flex items-start gap-3 rounded-xl bg-brand-50/50 p-4 dark:bg-brand-950/20" }, /* @__PURE__ */ window.wp.element.createElement(Info, { size: 16, className: "mt-0.5 shrink-0 text-brand-400 dark:text-brand-400" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed font-medium text-brand-700 dark:text-brand-300" }, window.wp.i18n.__(
  "The AI will scan your current site taxonomy and autonomously choose or create relevant terms based on the article context.",
  "structura"
))), mode === "disabled" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "animate-in fade-in mt-2 flex items-start gap-3 rounded-xl bg-neutral-50 p-4 duration-300" }, /* @__PURE__ */ window.wp.element.createElement(OctagonX, { size: 16, className: "mt-0.5 shrink-0 text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-relaxed font-medium text-neutral-500" }, window.wp.i18n.__(
  "No terms will be assigned automatically. You can set them manually on each post after publishing.",
  "structura"
))));
const MODELS = [
  // ---------------------------------------------------------------------------
  // OpenAI
  // ---------------------------------------------------------------------------
  {
    id: "gpt-5.2-2025-12-11",
    name: "GPT-5.2",
    provider: "openai",
    role: "text",
    tier: "top",
    default: true,
    recommended: true,
    batchInputUsdPerMTok: 2.5,
    manifest: { family: "chat", endpoint: "v1/chat/completions" }
  },
  {
    id: "gpt-5.4-mini",
    name: "GPT-5.4 Mini",
    provider: "openai",
    role: "text",
    tier: "mid",
    fast: true,
    batchInputUsdPerMTok: 0.5,
    manifest: { family: "chat", endpoint: "v1/chat/completions" }
  },
  {
    id: "gpt-5-nano-2025-08-07",
    name: "GPT-5 Nano",
    provider: "openai",
    role: "text",
    tier: "cheap",
    manifest: { family: "chat", endpoint: "v1/chat/completions" }
  },
  {
    id: "gpt-4o",
    name: "GPT-4o",
    provider: "openai",
    role: "text",
    manifest: { family: "chat", endpoint: "v1/chat/completions" }
  },
  {
    id: "gpt-4o-mini",
    name: "GPT-4o Mini",
    provider: "openai",
    role: "text",
    manifest: { family: "chat", endpoint: "v1/chat/completions" }
  },
  // Image — strict mid + top (see header). gpt-image-1-mini is the Cloud-tier
  // mid; gpt-image-2 is the Agency / Cloud Pro top.
  {
    id: "gpt-image-1-mini",
    name: "GPT Image 1 Mini",
    provider: "openai",
    role: "image",
    tier: "mid",
    default: true,
    manifest: {
      family: "image",
      endpoint: "v1/images/generations",
      sizes: { "1:1": "1024x1024", "16:9": "1536x1024", "9:16": "1024x1536" },
      qualities: ["low", "medium", "high", "auto"],
      default_quality: "high"
    }
  },
  {
    id: "gpt-image-2",
    name: "GPT Image 2",
    provider: "openai",
    role: "image",
    tier: "top",
    recommended: true,
    manifest: {
      family: "image",
      endpoint: "v1/images/generations",
      sizes: { "1:1": "1024x1024", "16:9": "1536x1024", "9:16": "1024x1536" },
      qualities: ["low", "medium", "high", "auto"],
      default_quality: "high"
    }
  },
  // Text-to-speech (video voiceover) — registry-only, not in the served catalog.
  {
    id: "gpt-4o-mini-tts",
    name: "GPT-4o mini TTS",
    provider: "openai",
    role: "tts",
    manifest: { family: "tts", endpoint: "v1/audio/speech" }
  },
  // ---------------------------------------------------------------------------
  // Google Gemini
  // ---------------------------------------------------------------------------
  {
    id: "gemini-3.1-pro-preview",
    name: "Gemini 3.1 Pro",
    provider: "gemini",
    role: "text",
    tier: "top",
    default: true,
    recommended: true,
    batchInputUsdPerMTok: 1.5,
    manifest: { family: "text", endpoint: "generateContent" }
  },
  {
    id: "gemini-3.5-flash",
    name: "Gemini 3.5 Flash",
    provider: "gemini",
    role: "text",
    tier: "mid",
    fast: true,
    manifest: { family: "text", endpoint: "generateContent" }
  },
  {
    // Gemini's `cheap` — confirmed live by the slice-5 sync script (was a Flash
    // placeholder). Heading extraction / connection-ping / WP-migration resolve
    // here now, so those move Flash → Flash-Lite (the intended cost win).
    id: "gemini-3.1-flash-lite",
    name: "Gemini 3.1 Flash Lite",
    provider: "gemini",
    role: "text",
    tier: "cheap",
    batchInputUsdPerMTok: 0.15,
    manifest: { family: "text", endpoint: "generateContent" }
  },
  {
    id: "gemini-2.5-pro",
    name: "Gemini 2.5 Pro",
    provider: "gemini",
    role: "text",
    manifest: { family: "text", endpoint: "generateContent" }
  },
  // Image. Flash Image is the RECOMMENDED default everywhere — strong quality
  // at ~half the batch cost; Pro Image remains selectable.
  {
    id: "gemini-3.1-flash-image",
    name: "Gemini 3.1 Flash Image",
    provider: "gemini",
    role: "image",
    tier: "mid",
    default: true,
    recommended: true,
    manifest: {
      family: "image",
      endpoint: "generateContent",
      ratios: ["1:1", "4:3", "16:9", "9:16"]
    }
  },
  {
    id: "gemini-3-pro-image",
    name: "Gemini 3 Pro Image",
    provider: "gemini",
    role: "image",
    tier: "top",
    manifest: {
      family: "image",
      endpoint: "generateContent",
      ratios: ["1:1", "4:3", "16:9", "9:16"]
    }
  },
  {
    id: "gemini-3.1-flash-tts-preview",
    name: "Gemini 3.1 Flash TTS",
    provider: "gemini",
    role: "tts",
    manifest: { family: "tts", endpoint: "generateContent" }
  },
  // ---------------------------------------------------------------------------
  // Anthropic Claude — no image capability.
  // ---------------------------------------------------------------------------
  // Sonnet stays the role default (mid) so existing BYOK saves and Cloud-tier
  // callers keep landing on the same model. Opus is `recommended` (top). Haiku
  // is the `cheap` utility model.
  {
    id: "claude-sonnet-5",
    name: "Claude Sonnet 5",
    provider: "anthropic",
    role: "text",
    tier: "mid",
    default: true,
    batchInputUsdPerMTok: 1.5,
    manifest: { family: "messages", endpoint: "v1/messages", max_output_tokens: 8192 }
  },
  {
    id: "claude-haiku-4-5-20251001",
    name: "Claude Haiku 4.5",
    provider: "anthropic",
    role: "text",
    tier: "cheap",
    fast: true,
    manifest: { family: "messages", endpoint: "v1/messages", max_output_tokens: 8192 }
  },
  {
    id: "claude-opus-4-8",
    name: "Claude Opus 4.8",
    provider: "anthropic",
    role: "text",
    tier: "top",
    recommended: true,
    batchInputUsdPerMTok: 2.5,
    manifest: { family: "messages", endpoint: "v1/messages", max_output_tokens: 8192 }
  }
];
const PROVIDER_ORDER = ["openai", "gemini", "anthropic"];
function toEntry(m3) {
  const entry = { id: m3.id, name: m3.name };
  if (m3.default)
    entry.default = true;
  if (m3.recommended)
    entry.recommended = true;
  if (m3.fast)
    entry.fast = true;
  if (m3.warning !== void 0)
    entry.warning = m3.warning;
  return entry;
}
function buildProvider(provider) {
  const models = MODELS.filter((m3) => m3.provider === provider && (m3.role === "text" || m3.role === "image"));
  const text = models.filter((m3) => m3.role === "text");
  const image = models.filter((m3) => m3.role === "image");
  const manifest = {};
  for (const m3 of models)
    manifest[m3.id] = m3.manifest;
  return {
    // Empty-string image default for image-less providers (Anthropic) matches
    // the historical hand-authored catalog.
    defaults: {
      text: text.find((m3) => m3.default)?.id ?? "",
      fast: text.find((m3) => m3.fast)?.id ?? "",
      image: image.find((m3) => m3.default)?.id ?? ""
    },
    text: text.map(toEntry),
    image: image.map(toEntry),
    manifest
  };
}
Object.fromEntries(PROVIDER_ORDER.map((p2) => [p2, buildProvider(p2)]));
function getRegistryModelId(provider, role, tier) {
  return getRegistryModel(provider, role, tier)?.id;
}
function getRegistryModel(provider, role, tier) {
  return MODELS.find((m3) => m3.provider === provider && m3.role === role && m3.tier === tier);
}
function tierForModelId(provider, role, modelId) {
  if (!modelId)
    return void 0;
  return MODELS.find((m3) => m3.provider === provider && m3.role === role && m3.id === modelId)?.tier;
}
const LEGACY_BATCH_INPUT_PRICES = Object.freeze({
  // Retired by the 2026-07-20 model bump (Opus 4.7 → 4.8, Sonnet 4.6 → 5).
  "anthropic:claude-opus-4-7": 2.5,
  "anthropic:claude-sonnet-4-6": 1.5,
  "anthropic:claude-opus-4-6": 2.5,
  "anthropic:claude-opus-4-5": 2.5,
  "anthropic:claude-sonnet-4-5": 1.5,
  "openai:gpt-5": 2.5
});
Object.freeze({
  ...LEGACY_BATCH_INPUT_PRICES,
  ...Object.fromEntries(MODELS.filter((m3) => m3.batchInputUsdPerMTok !== void 0).map((m3) => [
    `${m3.provider}:${m3.id}`,
    m3.batchInputUsdPerMTok
  ]))
});
const MODEL_TIERS = ["top", "mid"];
const tierLabel = (tier) => tier === "top" ? window.wp.i18n.__("Top", "structura") : window.wp.i18n.__("Standard", "structura");
const buildTierOptions = (provider, capability) => MODEL_TIERS.flatMap((tier) => {
  const model = getRegistryModel(provider, capability, tier);
  return model ? [{ value: tier, label: `${tierLabel(tier)} (${model.name})` }] : [];
});
const mirrorModelForTier = (provider, capability, tier) => getRegistryModelId(provider, capability, tier);
const effectiveTier = (provider, capability, storedTier, storedModel) => {
  if (storedTier) return storedTier;
  const derived = tierForModelId(provider, capability, storedModel);
  return derived === "top" || derived === "mid" ? derived : "mid";
};
const ProviderButton = ({ selected, onClick, icon, title, incomplete }) => {
  const button = /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: incomplete ? void 0 : onClick,
      disabled: incomplete,
      className: B$1(
        "relative flex flex-1 items-center justify-center gap-2 rounded-lg border py-2 transition-all",
        incomplete ? "cursor-not-allowed border-neutral-100 bg-neutral-50/50 text-neutral-300 opacity-60 dark:border-neutral-700 dark:bg-neutral-800/50 dark:text-neutral-600" : selected ? "cursor-pointer border-brand-200 bg-white text-brand-600 shadow-sm ring-2 ring-brand-50 dark:border-brand-500/30 dark:bg-neutral-800 dark:text-brand-400 dark:ring-brand-950/20" : "cursor-pointer border-neutral-100 bg-neutral-50 text-neutral-400 hover:bg-neutral-100 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500 dark:hover:bg-neutral-700"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1(
      incomplete ? "text-neutral-300 dark:text-neutral-600" : selected ? "text-brand-600 dark:text-brand-400" : "text-neutral-400 dark:text-neutral-500"
    ) }, icon),
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest uppercase" }, title),
    incomplete && /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 11, className: "absolute top-1 right-1 text-amber-500 dark:text-amber-400" })
  );
  if (incomplete) {
    return /* @__PURE__ */ window.wp.element.createElement(
      ce,
      {
        title: window.wp.i18n.__("Complete model setup in AI Engine settings", "structura"),
        position: "top"
      },
      button
    );
  }
  return button;
};
const getProviderIcon = (id, size2 = 15) => {
  const Icon2 = getProviderVisual(id).icon;
  return /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: size2 });
};
const ProviderToggle = ({
  textProvider,
  imageProvider,
  onTextProviderChange,
  onImageProviderChange,
  availableTextProviders,
  availableImageProviders,
  showTierSelectors = false,
  textTier = "top",
  imageTier = "top",
  onTextTierChange,
  onImageTierChange
}) => {
  const { isLicensed } = useLicense();
  const { isProviderIncomplete } = useDefaultProviders();
  const showImageSection = isLicensed && availableImageProviders.length > 0;
  const isTextProviderIncomplete = isProviderIncomplete(textProvider);
  const isImageProviderIncomplete = isProviderIncomplete(imageProvider);
  const textTierOptions = buildTierOptions(textProvider, "text");
  const imageTierOptions = buildTierOptions(imageProvider, "image");
  const showTextToggle = availableTextProviders.length > 1;
  const showImageToggle = availableImageProviders.length > 1;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-0 divide-y divide-neutral-100 rounded-xl border border-neutral-200 bg-neutral-50/30 overflow-hidden dark:divide-neutral-800 dark:border-neutral-700 dark:bg-neutral-900/30" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-0" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 bg-neutral-50/50 px-3 py-2 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement(Type, { size: 12, className: "text-blue-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Text Provider", "structura"))), showTextToggle && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex gap-1.5 px-1.5 pb-1.5" }, availableTextProviders.map((p2) => /* @__PURE__ */ window.wp.element.createElement(
    ProviderButton,
    {
      key: p2,
      selected: textProvider === p2,
      onClick: () => onTextProviderChange(p2),
      icon: getProviderIcon(p2),
      title: getProviderVisual(p2).label,
      incomplete: isProviderIncomplete(p2)
    }
  ))), isTextProviderIncomplete && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 px-3 pb-2 text-[10px] font-medium text-amber-600 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 11 }), window.wp.i18n.__("Model not selected — complete setup in AI Engine settings", "structura"))), showImageSection && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-0" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 bg-neutral-50/50 px-3 py-2 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement(Image, { size: 12, className: "text-purple-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black tracking-widest text-neutral-400 uppercase" }, window.wp.i18n.__("Image Provider", "structura"))), showImageToggle && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex gap-1.5 px-1.5 pb-1.5" }, availableImageProviders.map((p2) => /* @__PURE__ */ window.wp.element.createElement(
    ProviderButton,
    {
      key: p2,
      selected: imageProvider === p2,
      onClick: () => onImageProviderChange(p2),
      icon: getProviderIcon(p2),
      title: getProviderVisual(p2).label,
      incomplete: isProviderIncomplete(p2)
    }
  ))), isImageProviderIncomplete && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 px-3 pb-2 text-[10px] font-medium text-amber-600 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 11 }), window.wp.i18n.__("Model not selected — complete setup in AI Engine settings", "structura"))), showTierSelectors && /* @__PURE__ */ window.wp.element.createElement("div", { className: "p-3 space-y-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Bot, { size: 13, className: "text-brand-600 dark:text-brand-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-black tracking-widest text-neutral-500 uppercase" }, window.wp.i18n.__("Engine", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: B$1(
    "grid grid-cols-1 gap-2.5",
    showImageSection && "sm:grid-cols-2"
  ) }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Text Model", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      options: textTierOptions,
      value: textTier,
      onValueChange: (val) => onTextTierChange?.(val)
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, textTierOptions.map((o4) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: o4.value, value: o4.value }, o4.label)))
  )), showImageSection && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Image Model", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      options: imageTierOptions,
      value: imageTier,
      onValueChange: (val) => onImageTierChange?.(val)
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, imageTierOptions.map((o4) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: o4.value, value: o4.value }, o4.label)))
  )))));
};
const TEXT_ONLY_PROVIDERS = ["anthropic"];
const CapabilityLabel = ({ icon, title }) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2 sm:min-w-[72px]" }, icon, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-black tracking-widest text-neutral-500 uppercase dark:text-neutral-400" }, title));
const PregenerationStrip = ({
  enabled,
  onChange
}) => {
  const { plan, isPaidLicense } = useLicense();
  const isManaged = isManagedPlan(plan);
  if (isManaged) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-brand-200 bg-brand-50/50 dark:border-brand-800 dark:bg-brand-950/30 flex items-start gap-3 rounded-xl border px-3 py-2.5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "from-brand-500 mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br to-purple-500 shadow-sm" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 13, className: "text-white" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-brand-700 dark:text-brand-300 m-0! text-xs font-bold" }, window.wp.i18n.__("Instant publishes are on", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-brand-600/80 dark:text-brand-400/80 mt-0.5! mb-0! text-[11px] leading-snug" }, window.wp.i18n.__(
      "Your scheduled posts are pre-generated so they publish instantly. Run Now still generates fresh on demand for one-off posts.",
      "structura"
    ))));
  }
  if (!isPaidLicense) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3 rounded-xl border border-dashed border-neutral-200 bg-neutral-50/40 px-3 py-2.5 dark:border-neutral-700 dark:bg-neutral-900/40" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-neutral-100 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 12, className: "text-neutral-400 dark:text-neutral-500" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-bold text-neutral-600 dark:text-neutral-300" }, window.wp.i18n.__("Pre-generate posts ahead of schedule", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "from-brand-500 inline-flex items-center gap-1 rounded-full bg-gradient-to-r to-purple-500 px-1.5 py-0.5 text-[9px] font-bold tracking-wider text-white uppercase" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 9 }), window.wp.i18n.__("Pro", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-[11px] leading-snug text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
      "Upgrade to Pro to pre-generate scheduled posts ahead of time. Scheduled posts publish in under a second instead of waiting on AI synthesis.",
      "structura"
    ))));
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3 rounded-xl border border-neutral-200 bg-white px-3 py-2.5 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-50 dark:bg-brand-950/40 mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-lg" }, /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 13, className: "text-brand-600 dark:text-brand-400" })), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      className: "flex-1",
      label: window.wp.i18n.__("Pre-generate posts ahead of schedule", "structura"),
      description: window.wp.i18n.__(
        "Save up to 50% on AI costs and publish in under a second. Scheduled posts are written ahead of time; Run Now still generates fresh on demand.",
        "structura"
      ),
      checked: enabled,
      onChange
    }
  ));
};
const buildProviderOptions = (providers) => providers.map((p2) => ({
  value: p2,
  label: getProviderVisual(p2).label
}));
const CapabilityRow = ({
  capability,
  primary,
  onPrimaryChange,
  fallback,
  onFallbackChange,
  tier,
  onTierChange,
  tierOptions,
  primaryCandidates,
  fallbackCandidates,
  showModelSelector,
  fallbackLocked,
  fallbackLockedReason,
  isFallbackEligible,
  primaryIncomplete
}) => {
  const icon = capability === "text" ? /* @__PURE__ */ window.wp.element.createElement(Type, { size: 12, className: "text-blue-500" }) : /* @__PURE__ */ window.wp.element.createElement(Image, { size: 12, className: "text-purple-500" });
  const title = capability === "text" ? window.wp.i18n.__("Text", "structura") : window.wp.i18n.__("Image", "structura");
  const fallbackOptions = window.wp.element.useMemo(() => {
    const opts = [
      { value: "__none__", label: window.wp.i18n.__("None", "structura") }
    ];
    for (const candidate of fallbackCandidates) {
      if (candidate === primary) continue;
      if (!isFallbackEligible(candidate)) continue;
      opts.push({
        value: candidate,
        label: getProviderVisual(candidate).label
      });
    }
    return opts;
  }, [fallbackCandidates, primary, isFallbackEligible]);
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-2 rounded-xl border border-neutral-200 bg-white p-3 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2" }, /* @__PURE__ */ window.wp.element.createElement(CapabilityLabel, { icon, title }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-[150px] flex-1 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Provider", "structura")), primaryCandidates.length <= 1 ? /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex flex-1 items-center gap-1.5 rounded-lg border border-neutral-200 bg-neutral-50/60 px-3 py-1.5 text-[11px] font-medium text-neutral-700 dark:border-neutral-800 dark:bg-neutral-800/50 dark:text-neutral-300" }, getProviderVisual(primary).label) : /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      className: "flex-1",
      size: "sm",
      options: buildProviderOptions(primaryCandidates),
      value: primary,
      onValueChange: (v2) => onPrimaryChange(v2)
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, primaryCandidates.map((p2) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: p2, value: p2 }, getProviderVisual(p2).label)))
  )), showModelSelector && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-[180px] flex-1 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Model", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      className: "flex-1",
      size: "sm",
      options: tierOptions,
      value: tier,
      onValueChange: (v2) => onTierChange(v2)
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select model...", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, tierOptions.map((o4) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: o4.value, value: o4.value }, o4.label)))
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-[150px] flex-1 items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Fallback", "structura")), fallbackLocked ? /* @__PURE__ */ window.wp.element.createElement(
    ce,
    {
      title: fallbackLockedReason ?? window.wp.i18n.__("Upgrade to Pro to unlock provider fallback.", "structura"),
      position: "top"
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex flex-1 items-center justify-between gap-2 rounded-lg border border-neutral-200 bg-neutral-50/60 px-3 py-1.5 text-[11px] font-medium text-neutral-400 dark:border-neutral-800 dark:bg-neutral-800/50 dark:text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 10 }), window.wp.i18n.__("Pro", "structura")))
  ) : /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      className: "flex-1",
      size: "sm",
      options: fallbackOptions.map((o4) => ({ value: o4.value, label: o4.label })),
      value: fallback ?? "__none__",
      onValueChange: (v2) => {
        const val = v2;
        onFallbackChange(val === "__none__" ? null : val);
      }
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, null),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, fallbackOptions.map((o4) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: o4.value, value: o4.value }, o4.label)))
  ))), primaryIncomplete && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-1.5 text-[10px] font-medium text-amber-600 dark:text-amber-400" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 11 }), window.wp.i18n.__("Model not selected — complete setup in AI Engine settings", "structura")));
};
const CampaignAiEngineSection = ({
  availableTextProviders,
  availableImageProviders
}) => {
  const { formData, updateForm } = useCampaignForm();
  const { isCloud, isProviderIncomplete } = useDefaultProviders();
  const { isLicensed } = useLicense();
  const { data: ai } = useAiSettingsQuery();
  const showModelSelector = !isCloud;
  const isFree = !isLicensed;
  const intelligence = formData.intelligence;
  const schedule = formData.schedule;
  const textTier = effectiveTier(
    intelligence.textProvider,
    "text",
    intelligence.textTier,
    intelligence.textModel
  );
  const imageTier = effectiveTier(
    intelligence.imageProvider,
    "image",
    intelligence.imageTier,
    intelligence.imageModel
  );
  const changeProvider = (capability, p2) => {
    const tier = capability === "text" ? textTier : imageTier;
    const mirroredModel = showModelSelector ? getRegistryModelId(p2, capability, tier) ?? "" : "";
    updateForm(
      "intelligence",
      capability === "text" ? { textProvider: p2, textModel: mirroredModel } : { imageProvider: p2, imageModel: mirroredModel }
    );
  };
  const changeTier = (capability, tier) => {
    const provider = capability === "text" ? intelligence.textProvider : intelligence.imageProvider;
    const mirroredModel = getRegistryModelId(provider, capability, tier);
    updateForm(
      "intelligence",
      capability === "text" ? { textTier: tier, textModel: mirroredModel ?? intelligence.textModel } : { imageTier: tier, imageModel: mirroredModel ?? intelligence.imageModel }
    );
  };
  const isFallbackEligibleFor = (capability) => (p2) => {
    const primary = capability === "text" ? intelligence.textProvider : intelligence.imageProvider;
    if (p2 === primary) return false;
    if (isFree) return false;
    if (isCloud) return true;
    const info = ai?.providers?.[p2];
    if (!info?.connected) return false;
    return capability === "text" ? !!info.text_model : !!info.image_model;
  };
  const textFallbackCandidates = availableTextProviders;
  const imageFallbackCandidates = availableImageProviders.filter(
    (p2) => !TEXT_ONLY_PROVIDERS.includes(p2)
  );
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement(
    PregenerationStrip,
    {
      enabled: schedule.pregenerationEnabled ?? true,
      onChange: (next) => updateForm("schedule", { pregenerationEnabled: next })
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    CapabilityRow,
    {
      capability: "text",
      primary: intelligence.textProvider,
      onPrimaryChange: (p2) => changeProvider("text", p2),
      fallback: intelligence.fallbackTextProvider ?? null,
      onFallbackChange: (p2) => updateForm("intelligence", { fallbackTextProvider: p2 }),
      tier: textTier,
      onTierChange: (t2) => changeTier("text", t2),
      tierOptions: buildTierOptions(intelligence.textProvider, "text"),
      primaryCandidates: availableTextProviders,
      fallbackCandidates: textFallbackCandidates,
      showModelSelector,
      fallbackLocked: isFree,
      fallbackLockedReason: window.wp.i18n.__("Upgrade to Pro to unlock provider fallback.", "structura"),
      isFallbackEligible: isFallbackEligibleFor("text"),
      primaryIncomplete: isProviderIncomplete(intelligence.textProvider)
    }
  ), availableImageProviders.length > 0 && isLicensed && /* @__PURE__ */ window.wp.element.createElement(
    CapabilityRow,
    {
      capability: "image",
      primary: intelligence.imageProvider,
      onPrimaryChange: (p2) => changeProvider("image", p2),
      fallback: intelligence.fallbackImageProvider ?? null,
      onFallbackChange: (p2) => updateForm("intelligence", { fallbackImageProvider: p2 }),
      tier: imageTier,
      onTierChange: (t2) => changeTier("image", t2),
      tierOptions: buildTierOptions(intelligence.imageProvider, "image"),
      primaryCandidates: availableImageProviders,
      fallbackCandidates: imageFallbackCandidates,
      showModelSelector,
      fallbackLocked: false,
      isFallbackEligible: isFallbackEligibleFor("image"),
      primaryIncomplete: isProviderIncomplete(intelligence.imageProvider)
    }
  ), !isFree && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! px-1 text-[10px] leading-snug text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "If the primary provider is temporarily unavailable (rate-limit, timeout, or 5xx), we'll retry once through the fallback before failing the run.",
    "structura"
  )));
};
const LANGUAGES = [
  { value: "en_US", label: "English (United States)" },
  { value: "af", label: "Afrikaans" },
  { value: "am", label: "አማርኛ" },
  { value: "arg", label: "Aragonés" },
  { value: "ar", label: "العربية" },
  { value: "ary", label: "العربية المغربية" },
  { value: "as", label: "অসমীয়া" },
  { value: "azb", label: "گؤنئی آذربایجان" },
  { value: "az", label: "Azərbaycan dili" },
  { value: "bel", label: "Беларуская мова" },
  { value: "bg_BG", label: "Български" },
  { value: "bn_BD", label: "বাংলা" },
  { value: "bo", label: "བོད་ཡིག" },
  { value: "bs_BA", label: "Bosanski" },
  { value: "ca", label: "Català" },
  { value: "ceb", label: "Cebuano" },
  { value: "cs_CZ", label: "Čeština" },
  { value: "cy", label: "Cymraeg" },
  { value: "da_DK", label: "Dansk" },
  { value: "de_AT", label: "Deutsch (Österreich)" },
  { value: "de_DE", label: "Deutsch" },
  { value: "de_DE_formal", label: "Deutsch (Sie)" },
  { value: "de_CH", label: "Deutsch (Schweiz)" },
  { value: "de_CH_informal", label: "Deutsch (Schweiz, Du)" },
  { value: "dsb", label: "Dolnoserbšćina" },
  { value: "dzo", label: "རྫོང་ཁ" },
  { value: "el", label: "Ελληνικά" },
  { value: "en_CA", label: "English (Canada)" },
  { value: "en_GB", label: "English (UK)" },
  { value: "en_ZA", label: "English (South Africa)" },
  { value: "en_AU", label: "English (Australia)" },
  { value: "en_NZ", label: "English (New Zealand)" },
  { value: "eo", label: "Esperanto" },
  { value: "es_MX", label: "Español de México" },
  { value: "es_AR", label: "Español de Argentina" },
  { value: "es_ES", label: "Español" },
  { value: "es_PE", label: "Español de Perú" },
  { value: "es_CR", label: "Español de Costa Rica" },
  { value: "es_VE", label: "Español de Venezuela" },
  { value: "es_EC", label: "Español de Ecuador" },
  { value: "es_DO", label: "Español de República Dominicana" },
  { value: "es_UY", label: "Español de Uruguay" },
  { value: "es_PR", label: "Español de Puerto Rico" },
  { value: "es_GT", label: "Español de Guatemala" },
  { value: "es_CL", label: "Español de Chile" },
  { value: "es_CO", label: "Español de Colombia" },
  { value: "et", label: "Eesti" },
  { value: "eu", label: "Euskara" },
  { value: "fa_IR", label: "فارسی" },
  { value: "fa_AF", label: "(فارسی (افغانستان" },
  { value: "fi", label: "Suomi" },
  { value: "fr_CA", label: "Français du Canada" },
  { value: "fr_BE", label: "Français de Belgique" },
  { value: "fr_FR", label: "Français" },
  { value: "fur", label: "Friulian" },
  { value: "fy", label: "Frysk" },
  { value: "gd", label: "Gàidhlig" },
  { value: "gl_ES", label: "Galego" },
  { value: "gu", label: "ગુજરાતી" },
  { value: "haz", label: "هزاره گی" },
  { value: "he_IL", label: "עִבְרִית" },
  { value: "hi_IN", label: "हिन्दी" },
  { value: "hr", label: "Hrvatski" },
  { value: "hsb", label: "Hornjoserbšćina" },
  { value: "hu_HU", label: "Magyar" },
  { value: "hy", label: "Հայերեն" },
  { value: "id_ID", label: "Bahasa Indonesia" },
  { value: "is_IS", label: "Íslenska" },
  { value: "it_IT", label: "Italiano" },
  { value: "ja", label: "日本語" },
  { value: "jv_ID", label: "Basa Jawa" },
  { value: "ka_GE", label: "ქართული" },
  { value: "kab", label: "Taqbaylit" },
  { value: "kk", label: "Қазақ тілі" },
  { value: "km", label: "ភាសាខ្មែរ" },
  { value: "kn", label: "ಕನ್ನಡ" },
  { value: "ko_KR", label: "한국어" },
  { value: "ckb", label: "كوردی&lrm;" },
  { value: "kir", label: "Кыргызча" },
  { value: "lo", label: "ພາສາລາວ" },
  { value: "lt_LT", label: "Lietuvių kalba" },
  { value: "lv", label: "Latviešu valoda" },
  { value: "mk_MK", label: "Македонски јазик" },
  { value: "ml_IN", label: "മലയാളം" },
  { value: "mn", label: "Монгол" },
  { value: "mr", label: "मराठी" },
  { value: "ms_MY", label: "Bahasa Melayu" },
  { value: "my_MM", label: "ဗမာစာ" },
  { value: "nb_NO", label: "Norsk bokmål" },
  { value: "ne_NP", label: "नेपाली" },
  { value: "nl_BE", label: "Nederlands (België)" },
  { value: "nl_NL_formal", label: "Nederlands (Formeel)" },
  { value: "nl_NL", label: "Nederlands" },
  { value: "nn_NO", label: "Norsk nynorsk" },
  { value: "oci", label: "Occitan" },
  { value: "pa_IN", label: "ਪੰਜਾਬੀ" },
  { value: "pl_PL", label: "Polski" },
  { value: "ps", label: "پښتو" },
  { value: "pt_BR", label: "Português do Brasil" },
  { value: "pt_AO", label: "Português de Angola" },
  { value: "pt_PT", label: "Português" },
  { value: "pt_PT_ao90", label: "Português (AO90)" },
  { value: "rhg", label: "Ruáinga" },
  { value: "ro_RO", label: "Română" },
  { value: "ru_RU", label: "Русский" },
  { value: "sah", label: "Сахалыы" },
  { value: "snd", label: "سنڌي" },
  { value: "si_LK", label: "සිංහල" },
  { value: "sk_SK", label: "Slovenčina" },
  { value: "skr", label: "سرائیکی" },
  { value: "sl_SI", label: "Slovenščina" },
  { value: "sq", label: "Shqip" },
  { value: "sr_RS", label: "Српски језик" },
  { value: "sv_SE", label: "Svenska" },
  { value: "sw", label: "Kiswahili" },
  { value: "szl", label: "Ślōnskŏ gŏdka" },
  { value: "ta_IN", label: "தமிழ்" },
  { value: "ta_LK", label: "தமிழ்" },
  { value: "te", label: "తెలుగు" },
  { value: "th", label: "ไทย" },
  { value: "tl", label: "Tagalog" },
  { value: "tr_TR", label: "Türkçe" },
  { value: "tt_RU", label: "Татар теле" },
  { value: "tah", label: "Reo Tahiti" },
  { value: "ug_CN", label: "ئۇيغۇرچە" },
  { value: "uk", label: "Українська" },
  { value: "ur", label: "اردو" },
  { value: "uz_UZ", label: "O‘zbekcha" },
  { value: "vi", label: "Tiếng Việt" },
  { value: "zh_TW", label: "繁體中文" },
  { value: "zh_HK", label: "香港中文" },
  { value: "zh_CN", label: "简体中文" }
];
const POST_STATUS_OPTIONS$1 = [
  { value: "publish", label: window.wp.i18n.__("Publish immediately", "structura") },
  { value: "draft", label: window.wp.i18n.__("Save as draft", "structura") }
  // "Pending review" was removed 2026-07-09 — WP treated it as a draft.
];
const CoreContentSettings = () => {
  const { formData, updateForm } = useCampaignForm();
  const { isPaidLicense } = useLicense();
  const { data: personas = [], isLoading: loadingPersonas } = usePersonasQuery();
  const { intelligence, structure } = formData;
  const personaOptions = window.wp.element.useMemo(
    () => [
      { value: "random", label: window.wp.i18n.__("Random persona", "structura") },
      // 2026-05-01 — `String(p.id)` normalises legacy numeric ids
      // and cloud nanoids into one shape so the form's
      // `String(personaId)` value round-trips through `<Select>`'s
      // strict-equality option-find regardless of source.
      ...personas.map((p2) => ({ value: String(p2.id), label: p2.name }))
    ],
    [personas]
  );
  const languageOptions = window.wp.element.useMemo(
    () => [{ value: "default", label: window.wp.i18n.__("System Default", "structura") }, ...LANGUAGES],
    []
  );
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5 text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, /* @__PURE__ */ window.wp.element.createElement(Languages, { size: 12, className: "text-brand-500" }), window.wp.i18n.__("Language", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: intelligence.language,
      onValueChange: (val) => updateForm("intelligence", { language: val }),
      options: languageOptions
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, { hidden: true }, window.wp.i18n.__("Language", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select…", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, languageOptions.map((l2) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: l2.value, value: l2.value }, l2.label)))
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5 text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, /* @__PURE__ */ window.wp.element.createElement(FileStack, { size: 12, className: "text-brand-500" }), window.wp.i18n.__("Post Length", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Words", "structura"),
      hiddenLabel: true,
      type: "number",
      value: intelligence.postLength,
      max: !isPaidLicense ? 500 : void 0,
      onChange: (e2) => {
        const parsed = parseInt(e2.target.value);
        const next = Number.isFinite(parsed) ? parsed : 0;
        updateForm("intelligence", {
          postLength: !isPaidLicense ? Math.min(next, 500) : next
        });
      },
      rightAdornment: /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-bold text-neutral-400 uppercase" }, window.wp.i18n.__("Words", "structura"))
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5 text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, /* @__PURE__ */ window.wp.element.createElement(UserCheck, { size: 12, className: "text-neutral-400" }), window.wp.i18n.__("Persona", "structura")), loadingPersonas ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-10 items-center justify-center rounded-lg border border-dashed border-neutral-200 dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "size-3 animate-spin text-neutral-400" })) : /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: intelligence.personaId === "random" ? "random" : String(intelligence.personaId),
      onValueChange: (val) => updateForm("intelligence", {
        personaId: val === "random" ? "random" : String(val)
      }),
      options: personaOptions
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Choose…", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, personaOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-1.5 text-[10px] font-black tracking-widest text-neutral-400 uppercase" }, /* @__PURE__ */ window.wp.element.createElement(Send, { size: 12, className: "text-brand-500" }), window.wp.i18n.__("Post Status", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      value: structure.postStatus,
      onValueChange: (val) => updateForm("structure", { postStatus: val }),
      options: POST_STATUS_OPTIONS$1
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, { hidden: true }, window.wp.i18n.__("Post Status", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select…", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, { className: "w-(--button-width)" }, POST_STATUS_OPTIONS$1.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  ))), !isPaidLicense && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-snug text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "Free and anonymous installs are capped at 500 words per post. Upgrade to Pro to publish longer posts.",
    "structura"
  )));
};
const CreateCampaignPage = () => {
  return /* @__PURE__ */ window.wp.element.createElement(CampaignProvider, { mode: "campaign" }, /* @__PURE__ */ window.wp.element.createElement(CreateCampaignInner, null));
};
const CAMPAIGN_MODES$1 = [
  {
    value: "traffic_magnet",
    label: window.wp.i18n.__("Traffic Magnet", "structura"),
    description: window.wp.i18n.__("Maximize organic traffic with high-volume topics", "structura")
  },
  {
    value: "quick_wins",
    label: window.wp.i18n.__("Quick Wins", "structura"),
    description: window.wp.i18n.__("Target low-competition keywords for fast rankings", "structura")
  },
  {
    value: "conversion",
    label: window.wp.i18n.__("Conversion", "structura"),
    description: window.wp.i18n.__("Content designed to convert readers to customers", "structura")
  },
  {
    value: "authority",
    label: window.wp.i18n.__("Authority", "structura"),
    description: window.wp.i18n.__("Build topical authority with comprehensive coverage", "structura")
  }
];
const ALL_STEPS$1 = [
  { id: "interview", label: window.wp.i18n.__("Interview", "structura"), icon: MessageSquare },
  { id: "strategy", label: window.wp.i18n.__("Strategy", "structura"), icon: ClipboardList },
  { id: "keywords", label: window.wp.i18n.__("Keywords", "structura"), icon: Key },
  { id: "authority", label: window.wp.i18n.__("Authority", "structura"), icon: Shield },
  { id: "rhythm", label: window.wp.i18n.__("Rhythm", "structura"), icon: CalendarClock },
  { id: "summary", label: window.wp.i18n.__("Summary", "structura"), icon: Layers }
];
const HorizontalStepper = ({
  steps,
  activeStep,
  completedSteps,
  skippedSteps,
  onStepClick
}) => {
  return /* @__PURE__ */ window.wp.element.createElement("nav", { className: "py-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start" }, steps.map((step, i2) => {
    const isActive = activeStep === step.id;
    const isComplete = completedSteps.has(step.id);
    const isSkipped = skippedSteps.has(step.id);
    const activeIdx = steps.findIndex((s2) => s2.id === activeStep);
    const isReachable = i2 <= activeIdx || isComplete || isSkipped;
    const Icon2 = step.icon;
    return /* @__PURE__ */ window.wp.element.createElement("div", { key: step.id, className: "flex flex-1 items-start" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center" }, /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => isReachable && onStepClick(step.id),
        disabled: !isReachable,
        className: B$1(
          "group flex flex-col items-center gap-2 disabled:cursor-not-allowed",
          isReachable && "cursor-pointer"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          className: B$1(
            "flex h-10 w-10 items-center justify-center rounded-full transition-all",
            isComplete ? "bg-emerald-50 text-emerald-600 dark:bg-emerald-950/30 dark:text-emerald-400" : isSkipped ? "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500" : isActive ? "bg-brand-600 text-white shadow-md shadow-brand-600/25 ring-4 ring-brand-100 dark:bg-brand-500 dark:ring-brand-950/40" : isReachable ? "bg-neutral-200 text-neutral-500 group-hover:bg-brand-100 group-hover:text-brand-600 dark:bg-neutral-700 dark:text-neutral-400 dark:group-hover:bg-brand-900/50 dark:group-hover:text-brand-400" : "bg-neutral-200 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500"
          )
        },
        isComplete ? /* @__PURE__ */ window.wp.element.createElement(Check, { size: 18, strokeWidth: 2.5 }) : isSkipped ? /* @__PURE__ */ window.wp.element.createElement(ChevronsRight, { size: 16, className: "opacity-50" }) : /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 16 })
      ),
      /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "max-w-[80px] text-center text-[11px] font-bold leading-tight tracking-wide",
            isComplete ? "text-emerald-600 dark:text-emerald-400" : isSkipped ? "text-neutral-400 dark:text-neutral-500" : isActive ? "text-brand-700 dark:text-brand-300" : isReachable ? "text-neutral-500 dark:text-neutral-400" : "text-neutral-400 dark:text-neutral-500"
          )
        },
        isSkipped ? window.wp.i18n.__("Skipped", "structura") : step.label
      )
    )), i2 < steps.length - 1 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-5 flex flex-1 items-center px-2" }, /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "h-0.5 w-full rounded-full transition-colors",
          completedSteps.has(step.id) || skippedSteps.has(step.id) ? isSkipped ? "bg-neutral-300 dark:bg-neutral-600" : "bg-emerald-300 dark:bg-emerald-700" : "bg-neutral-200 dark:bg-neutral-700"
        )
      }
    )));
  })));
};
const CreateCampaignInner = () => {
  const navigate = useNavigate();
  const { formData, updateForm, isValid } = useCampaignForm();
  const { createCampaign, isCreating } = useCampaignMutations();
  const { isPaidLicense } = useLicense();
  const hasAuthorityRule = formData.intelligence.seoRules?.outbound_link_authority === true;
  const keywordsRef = window.wp.element.useRef(null);
  const authorityRef = window.wp.element.useRef(null);
  const activeStep = useCampaignDraftStore((s2) => s2.activeStep);
  const completedStepsArr = useCampaignDraftStore((s2) => s2.completedSteps);
  const skippedStepsArr = useCampaignDraftStore((s2) => s2.skippedSteps);
  const setActiveStep = useCampaignDraftStore((s2) => s2.setActiveStep);
  const markComplete = useCampaignDraftStore((s2) => s2.markComplete);
  const markSkipped = useCampaignDraftStore((s2) => s2.markSkipped);
  const clearStepFlag = useCampaignDraftStore((s2) => s2.clearStepFlag);
  const discardDraft = useCampaignDraftStore((s2) => s2.discardDraft);
  const hasDraft = useCampaignDraftStore((s2) => s2.lastUpdatedAt !== null);
  const completedSteps = window.wp.element.useMemo(() => new Set(completedStepsArr), [completedStepsArr]);
  const skippedSteps = window.wp.element.useMemo(() => new Set(skippedStepsArr), [skippedStepsArr]);
  const [keywordsPhase, setKeywordsPhase] = window.wp.element.useState("idle");
  const [authorityPhase, setAuthorityPhase] = window.wp.element.useState("idle");
  const [interviewTopics, setInterviewTopics] = window.wp.element.useState([]);
  const steps = ALL_STEPS$1.filter(
    (s2) => s2.id !== "authority" || hasAuthorityRule || !isPaidLicense
  );
  const [searchParams, setSearchParams] = useSearchParams();
  const resumeApplied = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (resumeApplied.current) return;
    const resume = searchParams.get("resume");
    const requestedStep = searchParams.get("step");
    if (resume !== "draft" || !requestedStep) return;
    if (!hasDraft) return;
    const stepExists = steps.some((s2) => s2.id === requestedStep);
    if (!stepExists) return;
    resumeApplied.current = true;
    setActiveStep(requestedStep);
    const next = new URLSearchParams(searchParams);
    next.delete("resume");
    next.delete("step");
    setSearchParams(next, { replace: true });
  }, [searchParams, hasDraft, steps, setActiveStep, setSearchParams]);
  const goToStep = window.wp.element.useCallback(
    (step) => {
      setActiveStep(step);
      window.scrollTo({ top: 0, behavior: "smooth" });
    },
    [setActiveStep]
  );
  const nextStep = window.wp.element.useCallback(
    (currentStepId) => {
      const idx = steps.findIndex((s2) => s2.id === currentStepId);
      if (idx < steps.length - 1) {
        goToStep(steps[idx + 1].id);
      }
    },
    [steps, goToStep]
  );
  const handleSkipInterview = window.wp.element.useCallback(() => {
    markSkipped("interview");
    goToStep("strategy");
  }, [markSkipped, goToStep]);
  const handleInterviewComplete = window.wp.element.useCallback(
    (result) => {
      updateForm("identity", {
        name: result.name,
        objective: result.objective,
        ...result.campaignMode ? { campaignMode: result.campaignMode } : {}
      });
      setInterviewTopics(result.topics ?? []);
      clearStepFlag("interview");
      markComplete("interview");
      goToStep("strategy");
    },
    [updateForm, clearStepFlag, markComplete, goToStep]
  );
  const confirmStrategy = () => {
    markComplete("strategy");
    goToStep("keywords");
  };
  const handleLaunch = async () => {
    if (keywordsRef.current) {
      const bank = keywordsRef.current.getKeywords();
      updateForm("keywords", {
        bank,
        discoveryMeta: keywordsRef.current.getDiscoveryMeta(),
        discoveredAt: bank.length > 0 ? (/* @__PURE__ */ new Date()).toISOString() : null
      });
    }
    if (authorityRef.current) {
      const domains = authorityRef.current.getDomains();
      updateForm("authority", {
        domains,
        discoveredAt: domains.length > 0 ? (/* @__PURE__ */ new Date()).toISOString() : null
      });
    }
    await new Promise((r2) => setTimeout(r2, 50));
    try {
      await createCampaign({ data: formData });
      discardDraft();
      navigate("/campaigns");
    } catch (error) {
      if (isCampaignLimitReachedError(error)) {
        discardDraft();
        navigate("/campaigns");
      }
    }
  };
  const handleDiscardDraft = window.wp.element.useCallback(() => {
    discardDraft();
    navigate("/campaigns");
  }, [discardDraft, navigate]);
  const isKeywordsComplete = keywordsPhase === "complete";
  const isAuthorityComplete = authorityPhase === "complete";
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-8 pb-16" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex items-center gap-4" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => navigate("/campaigns"),
      className: "flex h-9 w-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-400 transition-colors hover:border-neutral-300 hover:text-neutral-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500 dark:hover:border-neutral-600 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("New Campaign", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Configure and launch your content strategy", "structura")))), /* @__PURE__ */ window.wp.element.createElement(NoPersonasBlocker, null), /* @__PURE__ */ window.wp.element.createElement(DefaultPersonaAdvisory, null), /* @__PURE__ */ window.wp.element.createElement(PageBuilderCompatCard, null), /* @__PURE__ */ window.wp.element.createElement(
    HorizontalStepper,
    {
      steps,
      activeStep,
      completedSteps,
      skippedSteps,
      onStepClick: goToStep
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-200/60 bg-white p-6 shadow-sm sm:p-8 dark:border-neutral-800 dark:bg-neutral-900" }, activeStep === "interview" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(GuidedInterview, { onComplete: handleInterviewComplete }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-t border-neutral-100 pt-4 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: handleSkipInterview,
      className: "cursor-pointer text-xs font-medium text-neutral-400 transition-colors hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(ChevronsRight, { size: 14, className: "mr-1 inline-block" }),
    window.wp.i18n.__("Skip interview — I'll fill in the details myself", "structura")
  ))), activeStep === "strategy" && /* @__PURE__ */ window.wp.element.createElement(
    StrategySection,
    {
      onConfirm: confirmStrategy,
      onRestart: () => {
        clearStepFlag("interview");
        clearStepFlag("strategy");
        goToStep("interview");
      }
    }
  ), activeStep === "keywords" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(
    StepKeywords,
    {
      ref: keywordsRef,
      topic: formData.identity.objective,
      topicSeeds: interviewTopics,
      campaignName: formData.identity.name,
      language: formData.intelligence.language,
      provider: formData.intelligence.textProvider,
      existingKeywords: formData.keywords?.bank?.length ? formData.keywords.bank : void 0,
      existingDiscoveryMeta: formData.keywords?.discoveryMeta,
      onKeywordsChange: () => {
      },
      onPhaseChange: setKeywordsPhase,
      onSkipToNextStep: () => {
        markSkipped("keywords");
        nextStep("keywords");
      }
    }
  ), isKeywordsComplete && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end gap-3 border-t border-neutral-100 pt-5 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: () => setKeywordsPhase("idle")
    },
    /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Re-discover", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: () => {
        if (keywordsRef.current) {
          const bank = keywordsRef.current.getKeywords();
          updateForm("keywords", {
            bank,
            discoveryMeta: keywordsRef.current.getDiscoveryMeta(),
            discoveredAt: bank.length > 0 ? (/* @__PURE__ */ new Date()).toISOString() : null
          });
        }
        markComplete("keywords");
        nextStep("keywords");
      }
    },
    window.wp.i18n.__("Looks good — continue", "structura")
  ))), activeStep === "authority" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(
    AuthorityDiscovery,
    {
      ref: authorityRef,
      topic: formData.identity.objective,
      campaignName: formData.identity.name,
      language: formData.intelligence.language,
      provider: formData.intelligence.textProvider,
      existingDomains: formData.authority?.domains?.length ? formData.authority.domains : void 0,
      onDomainsChange: () => {
      },
      onPhaseChange: setAuthorityPhase,
      onSkipToNextStep: () => {
        markSkipped("authority");
        nextStep("authority");
      }
    }
  ), isAuthorityComplete && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end gap-3 border-t border-neutral-100 pt-5 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: () => setAuthorityPhase("idle")
    },
    /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Re-discover", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: () => {
        if (authorityRef.current) {
          const domains = authorityRef.current.getDomains();
          updateForm("authority", {
            domains,
            discoveredAt: domains.length > 0 ? (/* @__PURE__ */ new Date()).toISOString() : null
          });
        }
        markComplete("authority");
        nextStep("authority");
      }
    },
    window.wp.i18n.__("Looks good — continue", "structura")
  ))), activeStep === "rhythm" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(SimpleStepRhythm, null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-end border-t border-neutral-100 pt-5 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: () => {
        markComplete("rhythm");
        nextStep("rhythm");
      }
    },
    window.wp.i18n.__("Continue", "structura")
  ))), activeStep === "summary" && /* @__PURE__ */ window.wp.element.createElement(
    SummarySection,
    {
      formData,
      hasAuthorityRule,
      onLaunch: handleLaunch,
      isCreating,
      isValid
    }
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center gap-3 text-xs sm:flex-row sm:gap-6" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => navigate("/campaigns"),
      className: "cursor-pointer text-neutral-400 underline-offset-2 transition-colors hover:text-neutral-600 hover:underline dark:text-neutral-500 dark:hover:text-neutral-300"
    },
    hasDraft ? window.wp.i18n.__("Return to Campaigns (draft auto-saved)", "structura") : window.wp.i18n.__("Cancel and return to Campaigns", "structura")
  ), hasDraft && /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: handleDiscardDraft,
      className: "inline-flex cursor-pointer items-center gap-1 text-rose-500 underline-offset-2 transition-colors hover:text-rose-600 hover:underline dark:text-rose-400 dark:hover:text-rose-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 12 }),
    window.wp.i18n.__("Discard draft and start over", "structura")
  )));
};
const CompactToggle$1 = ({
  label,
  description,
  isEnabled,
  onToggle,
  isDisabled,
  badge
}) => /* @__PURE__ */ window.wp.element.createElement(
  "div",
  {
    className: B$1(
      "flex items-center justify-between gap-3 rounded-lg px-3 py-2 transition-colors",
      isDisabled ? "opacity-50" : "hover:bg-neutral-50 dark:hover:bg-neutral-800/40"
    )
  },
  /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: B$1(
        "truncate text-xs font-medium",
        isEnabled && !isDisabled ? "text-neutral-900 dark:text-white" : "text-neutral-600 dark:text-neutral-400"
      )
    },
    label
  ), description && /* @__PURE__ */ window.wp.element.createElement(ce, { title: description, position: "top" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 cursor-help text-neutral-300 dark:text-neutral-600" }, /* @__PURE__ */ window.wp.element.createElement(CircleQuestionMark, { size: 12 }))), badge),
  /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label,
      hiddenLabel: true,
      checked: isEnabled,
      onChange: () => !isDisabled && onToggle(),
      disabled: isDisabled
    }
  )
);
const SettingsGroup$1 = ({
  icon,
  label,
  count: count2,
  children,
  defaultOpen = false
}) => {
  const [open, setOpen] = window.wp.element.useState(defaultOpen);
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "rounded-lg border transition-colors duration-200",
        open ? "border-brand-200 bg-brand-50/30 shadow-sm dark:border-brand-900/40 dark:bg-brand-950/20" : "border-neutral-200/70 hover:border-neutral-300 hover:shadow-sm dark:border-neutral-800 dark:hover:border-neutral-700"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => setOpen(!open),
        className: B$1(
          "flex w-full cursor-pointer items-center justify-between px-3 py-2.5 transition-colors",
          open ? "rounded-t-lg" : "rounded-lg hover:bg-neutral-50 dark:hover:bg-neutral-800/40"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2" }, icon, /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "text-[10px] font-black tracking-widest uppercase transition-colors",
            open ? "text-brand-600 dark:text-brand-400" : "text-neutral-500 dark:text-neutral-400"
          )
        },
        label
      ), typeof count2 === "number" && /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "rounded-full px-1.5 py-0.5 text-[9px] font-bold tabular-nums transition-colors",
            open ? "bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400" : "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500"
          )
        },
        count2
      )),
      /* @__PURE__ */ window.wp.element.createElement(
        ChevronDown,
        {
          size: 12,
          className: B$1(
            "transition-transform duration-200",
            open ? "rotate-180 text-brand-500 dark:text-brand-400" : "text-neutral-400"
          )
        }
      )
    ),
    open && /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-1 pb-2 pt-1" }, children)
  );
};
const ProBadge$1 = () => /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 rounded-full bg-brand-50 px-1.5 py-0.5 text-[8px] font-black text-brand-600 uppercase dark:bg-brand-950/30 dark:text-brand-400" }, window.wp.i18n.__("Pro", "structura"));
const FreeBadge$1 = () => /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 rounded-full bg-emerald-50 px-1.5 py-0.5 text-[8px] font-black text-emerald-600 uppercase dark:bg-emerald-950/30 dark:text-emerald-400" }, window.wp.i18n.__("Free", "structura"));
const RequiredBadge$1 = () => /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 rounded-full bg-neutral-100 px-1.5 py-0.5 text-[8px] font-black text-neutral-500 uppercase dark:bg-neutral-800 dark:text-neutral-400" }, window.wp.i18n.__("Required", "structura"));
const AdvancedSettings = () => {
  const { formData, updateForm } = useCampaignForm();
  const { isPaidLicense, isLicensed } = useLicense();
  const uploadsUnwritable = !!window.structuraConfig?.uploads_unwritable;
  const { availableProviders, availableImageProviders, isFullyConfigured } = useDefaultProviders();
  const { rules, isLoading: loadingSeoRules } = useSeoRules();
  const [open, setOpen] = window.wp.element.useState(false);
  const { intelligence, structure, taxonomy } = formData;
  const [availableCats, setAvailableCats] = window.wp.element.useState([]);
  const [availableTags, setAvailableTags] = window.wp.element.useState([]);
  const [loadingTax, setLoadingTax] = window.wp.element.useState(false);
  window.wp.element.useEffect(() => {
    if (!open) return;
    if (availableCats.length > 0 || availableTags.length > 0 || loadingTax) return;
    const run = async () => {
      setLoadingTax(true);
      try {
        const [cats, tg] = await Promise.all([
          window.wp.apiFetch({ path: "/wp/v2/categories?per_page=100" }),
          window.wp.apiFetch({ path: "/wp/v2/tags?per_page=100" })
        ]);
        setAvailableCats(cats);
        setAvailableTags(tg);
      } catch {
      } finally {
        setLoadingTax(false);
      }
    };
    run();
  }, [open]);
  const toggleBlock = (blockName) => {
    const cur = structure.enabledBlocks || [];
    const next = cur.includes(blockName) ? cur.filter((b2) => b2 !== blockName) : [...cur, blockName];
    updateForm("structure", { enabledBlocks: next });
  };
  const toggleRule = (name) => {
    updateForm("intelligence", {
      seoRules: { ...intelligence.seoRules, [name]: !intelligence.seoRules[name] }
    });
  };
  rules ? Object.keys(rules).length : 0;
  const enabledSeoCount = rules ? Object.keys(rules).filter((k2) => intelligence.seoRules[k2]).length : 0;
  const enabledBlockCount = structure.enabledBlocks.length;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-200/60 dark:border-neutral-700/60" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setOpen(!open),
      className: B$1(
        "flex w-full cursor-pointer items-center justify-between px-4 py-3 transition-colors",
        open ? "rounded-t-xl border-b border-neutral-100 bg-neutral-50/50 dark:border-neutral-800 dark:bg-neutral-800/30" : "rounded-xl hover:bg-neutral-50 dark:hover:bg-neutral-800/30"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2 text-xs font-bold text-neutral-600 dark:text-neutral-300" }, /* @__PURE__ */ window.wp.element.createElement(Settings2, { size: 14, className: "text-neutral-400 dark:text-neutral-500" }), window.wp.i18n.__("Advanced Settings", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(
      ChevronDown,
      {
        size: 14,
        className: B$1("text-neutral-400 transition-transform duration-200", open && "rotate-180")
      }
    )
  ), open && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4 p-4" }, isFullyConfigured && availableProviders.length > 0 && /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Bot, { size: 13, className: "text-brand-500" }),
      label: window.wp.i18n.__("AI Engine", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-2 py-2" }, /* @__PURE__ */ window.wp.element.createElement(
      CampaignAiEngineSection,
      {
        availableTextProviders: availableProviders,
        availableImageProviders
      }
    ))
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Rocket, { size: 13, className: "text-rose-500" }),
      label: window.wp.i18n.__("Improvements", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle$1,
      {
        label: window.wp.i18n.__("Replace long AI-like dashes", "structura"),
        description: window.wp.i18n.__("Normalize AI dashes (like—this) to standard format (like - this).", "structura"),
        isEnabled: intelligence.replaceLongDashes,
        onToggle: () => updateForm("intelligence", { replaceLongDashes: !intelligence.replaceLongDashes })
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle$1,
      {
        label: window.wp.i18n.__("Disable emojis", "structura"),
        description: window.wp.i18n.__("Remove emojis from AI-generated content for a cleaner output.", "structura"),
        isEnabled: intelligence.disableEmojis,
        onToggle: () => updateForm("intelligence", { disableEmojis: !intelligence.disableEmojis })
      }
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Image, { size: 13, className: "text-emerald-500" }),
      label: window.wp.i18n.__("Images", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle$1,
      {
        label: window.wp.i18n.__("Generate featured image", "structura"),
        description: window.wp.i18n.__("Create a relevant featured image for each post.", "structura"),
        isEnabled: structure.featuredImage,
        onToggle: () => updateForm("structure", { featuredImage: !structure.featuredImage }),
        isDisabled: !isLicensed || uploadsUnwritable,
        badge: !isLicensed ? /* @__PURE__ */ window.wp.element.createElement(FreeBadge$1, null) : void 0
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle$1,
      {
        label: window.wp.i18n.__("Body image generation", "structura"),
        description: window.wp.i18n.__("Identify spots and generate images in the post body.", "structura"),
        isEnabled: structure.bodyImages,
        onToggle: () => updateForm("structure", { bodyImages: !structure.bodyImages }),
        isDisabled: !isPaidLicense || uploadsUnwritable,
        badge: !isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(ProBadge$1, null) : void 0
      }
    ),
    uploadsUnwritable && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-snug text-amber-600 dark:text-amber-500" }, window.wp.i18n.__(
      "Image generation is unavailable because WordPress can't write to your uploads folder. Posts will still publish without images.",
      "structura"
    ), " ", /* @__PURE__ */ window.wp.element.createElement(
      "a",
      {
        href: "https://docs.structurawp.com/troubleshooting/images-not-generating",
        target: "_blank",
        rel: "noopener noreferrer",
        className: "underline hover:text-amber-700 dark:hover:text-amber-400"
      },
      window.wp.i18n.__("How to fix this", "structura")
    )),
    /* @__PURE__ */ window.wp.element.createElement(
      VisualStyleFallbackNotice,
      {
        imagesEnabled: structure.featuredImage || structure.bodyImages
      }
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(PanelsTopLeft, { size: 13, className: "text-purple-500" }),
      label: window.wp.i18n.__("Content Blocks", "structura"),
      count: enabledBlockCount
    },
    CONTENT_BLOCKS.map((block) => {
      const isProLocked = block.isPro && !isPaidLicense;
      const isFreeLocked = block.name === "core/heading" && !isLicensed;
      return /* @__PURE__ */ window.wp.element.createElement(
        CompactToggle$1,
        {
          key: block.name,
          label: block.label,
          description: block.description,
          isEnabled: block.isRequired || structure.enabledBlocks.includes(block.name),
          onToggle: () => toggleBlock(block.name),
          isDisabled: block.isRequired || isProLocked || isFreeLocked,
          badge: block.isRequired ? /* @__PURE__ */ window.wp.element.createElement(RequiredBadge$1, null) : isProLocked ? /* @__PURE__ */ window.wp.element.createElement(ProBadge$1, null) : isFreeLocked ? /* @__PURE__ */ window.wp.element.createElement(FreeBadge$1, null) : void 0
        }
      );
    })
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 13, className: "text-amber-500" }),
      label: window.wp.i18n.__("SEO Directives", "structura"),
      count: enabledSeoCount
    },
    loadingSeoRules ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-8 items-center justify-center" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "size-3 animate-spin text-neutral-400" })) : rules ? Object.entries(rules).map(([name, rule]) => {
      const isProLocked = ["byok", "cloud"].includes(rule.plan) && !isPaidLicense;
      const isFreeLocked = rule.plan === "free" && !isLicensed;
      return /* @__PURE__ */ window.wp.element.createElement(
        CompactToggle$1,
        {
          key: name,
          label: rule.label,
          description: rule.description,
          isEnabled: intelligence.seoRules[name],
          onToggle: () => toggleRule(name),
          isDisabled: isProLocked || isFreeLocked,
          badge: isProLocked ? /* @__PURE__ */ window.wp.element.createElement(ProBadge$1, null) : isFreeLocked ? /* @__PURE__ */ window.wp.element.createElement(FreeBadge$1, null) : void 0
        }
      );
    }) : null
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup$1,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(FolderOpen, { size: 13, className: "text-brand-500" }),
      label: window.wp.i18n.__("Taxonomy", "structura")
    },
    loadingTax ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-8 items-center justify-center" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "size-3 animate-spin text-neutral-400" })) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3 px-2 py-2" }, /* @__PURE__ */ window.wp.element.createElement(
      TaxonomySection,
      {
        title: window.wp.i18n.__("Categories", "structura"),
        icon: /* @__PURE__ */ window.wp.element.createElement(FolderOpen, { size: 14 }),
        mode: taxonomy.categories.mode,
        setMode: (val) => updateForm("taxonomy", { categories: { ...taxonomy.categories, mode: val } }),
        items: availableCats,
        selected: taxonomy.categories.list,
        setSelected: (val) => updateForm("taxonomy", { categories: { ...taxonomy.categories, list: val } })
      }
    ), /* @__PURE__ */ window.wp.element.createElement(
      TaxonomySection,
      {
        title: window.wp.i18n.__("Tags", "structura"),
        icon: /* @__PURE__ */ window.wp.element.createElement(Tag, { size: 14 }),
        mode: taxonomy.tags.mode,
        setMode: (val) => updateForm("taxonomy", { tags: { ...taxonomy.tags, mode: val } }),
        items: availableTags,
        selected: taxonomy.tags.list,
        setSelected: (val) => updateForm("taxonomy", { tags: { ...taxonomy.tags, list: val } })
      }
    ))
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between rounded-lg px-3 py-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Scale, { size: 13, className: "text-emerald-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("AI Transparency Signal", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    ce,
    {
      title: window.wp.i18n.__("Append a disclosure notice to AI-generated content for transparency.", "structura"),
      position: "top"
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "cursor-help text-neutral-300 dark:text-neutral-600" }, /* @__PURE__ */ window.wp.element.createElement(CircleQuestionMark, { size: 12 }))
  )), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Disclosure", "structura"),
      hiddenLabel: true,
      checked: structure.disclosure.enabled,
      onChange: (checked) => updateForm("structure", { disclosure: { ...structure.disclosure, enabled: checked } })
    }
  )), structure.disclosure.enabled && /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-3" }, /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Disclosure Notice", "structura"),
      value: structure.disclosure.text,
      onChange: (e2) => updateForm("structure", { disclosure: { ...structure.disclosure, text: e2.target.value } }),
      rows: 2
    }
  ))));
};
const StrategySection = ({
  onConfirm,
  onRestart
}) => {
  const { formData, updateForm } = useCampaignForm();
  const { availableProviders, availableImageProviders, isFullyConfigured, isCloud } = useDefaultProviders();
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-gradient-to-r from-brand-50 to-purple-50 px-3 py-1 text-[10px] font-bold text-brand-700 dark:from-brand-950/40 dark:to-purple-950/40 dark:text-brand-300" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 10 }), window.wp.i18n.__("AI-Generated Strategy", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: onRestart,
      className: "cursor-pointer text-[10px] font-medium text-neutral-400 underline-offset-2 hover:text-brand-600 hover:underline dark:text-neutral-500 dark:hover:text-brand-400"
    },
    window.wp.i18n.__("Restart interview", "structura")
  )), /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Campaign Name", "structura"),
      value: formData.identity.name,
      onChange: (e2) => updateForm("identity", { name: e2.target.value }),
      placeholder: window.wp.i18n.__("e.g. Winter 2026 SEO Push", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Campaign Objective", "structura"),
      value: formData.identity.objective,
      onChange: (e2) => updateForm("identity", { objective: e2.target.value }),
      rows: 6,
      placeholder: window.wp.i18n.__("Your campaign strategy…", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("label", { className: "mb-2 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Writing approach", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Gn,
    {
      options: CAMPAIGN_MODES$1,
      value: formData.identity.campaignMode,
      onChange: (value) => updateForm("identity", { campaignMode: value }),
      ariaLabel: window.wp.i18n.__("Writing approach", "structura")
    }
  )), !isFullyConfigured && availableProviders.length > 0 && /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-neutral-200 p-0!" }, /* @__PURE__ */ window.wp.element.createElement(
    ProviderToggle,
    {
      textProvider: formData.intelligence.textProvider,
      imageProvider: formData.intelligence.imageProvider,
      onTextProviderChange: (p2) => updateForm("intelligence", {
        textProvider: p2,
        textModel: mirrorModelForTier(p2, "text", formData.intelligence.textTier ?? "mid") ?? ""
      }),
      onImageProviderChange: (p2) => updateForm("intelligence", {
        imageProvider: p2,
        imageModel: mirrorModelForTier(p2, "image", formData.intelligence.imageTier ?? "mid") ?? ""
      }),
      availableTextProviders: availableProviders,
      availableImageProviders,
      showTierSelectors: !isCloud,
      textTier: formData.intelligence.textTier ?? "mid",
      imageTier: formData.intelligence.imageTier ?? "mid",
      onTextTierChange: (t2) => updateForm("intelligence", {
        textTier: t2,
        textModel: mirrorModelForTier(formData.intelligence.textProvider, "text", t2) ?? ""
      }),
      onImageTierChange: (t2) => updateForm("intelligence", {
        imageTier: t2,
        imageModel: mirrorModelForTier(formData.intelligence.imageProvider, "image", t2) ?? ""
      })
    }
  )), /* @__PURE__ */ window.wp.element.createElement(CoreContentSettings, null), /* @__PURE__ */ window.wp.element.createElement(AdvancedSettings, null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex justify-end border-t border-neutral-100 pt-5 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: onConfirm,
      disabled: formData.identity.name.length < 3 || formData.identity.objective.length < 20
    },
    window.wp.i18n.__("Looks good — continue", "structura")
  )));
};
const SummarySection = ({
  formData,
  hasAuthorityRule,
  onLaunch,
  isCreating,
  isValid
}) => {
  const keywordCount = formData.keywords?.bank?.length ?? 0;
  const domainCount = formData.authority?.domains?.length ?? 0;
  const { data: personas = [], isLoading: loadingPersonas } = usePersonasQuery();
  const hasNoPersonas = !loadingPersonas && personas.length === 0;
  const modeLabel = CAMPAIGN_MODES$1.find((m3) => m3.value === formData.identity.campaignMode)?.label ?? "—";
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mb-1 text-lg font-bold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Campaign Summary", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Review your campaign details before launching", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid gap-3 sm:grid-cols-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 dark:border-neutral-800 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-1 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Campaign", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-bold text-neutral-900 dark:text-white" }, formData.identity.name || "—")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 dark:border-neutral-800 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-1 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Mode", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-bold text-neutral-900 dark:text-white" }, modeLabel)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 dark:border-neutral-800 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-1 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Keywords", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-bold text-neutral-900 dark:text-white" }, keywordCount > 0 ? window.wp.i18n.sprintf(window.wp.i18n.__("%d discovered", "structura"), keywordCount) : window.wp.i18n.__("None", "structura"))), hasAuthorityRule && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 dark:border-neutral-800 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-1 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Authority Sources", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-bold text-neutral-900 dark:text-white" }, domainCount > 0 ? window.wp.i18n.sprintf(window.wp.i18n.__("%d domains", "structura"), domainCount) : window.wp.i18n.__("None", "structura")))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-100 bg-neutral-50/50 p-4 dark:border-neutral-800 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "mb-2 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Objective", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "line-clamp-4 text-xs leading-relaxed text-neutral-600 dark:text-neutral-400" }, formData.identity.objective || "—")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between rounded-2xl border border-brand-200 bg-gradient-to-r from-brand-50/50 to-purple-50/50 px-6 py-5 dark:border-brand-800 dark:from-brand-950/20 dark:to-purple-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col gap-0.5" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-bold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Ready to launch?", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Your campaign will start generating content based on the schedule", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: onLaunch,
      loading: isCreating,
      disabled: !isValid(1) || !isValid(5) || hasNoPersonas,
      className: "bg-gradient-to-r from-brand-600 to-purple-600 font-bold shadow-lg shadow-brand-600/20"
    },
    /* @__PURE__ */ window.wp.element.createElement(Rocket, { size: 16, className: "mr-2" }),
    window.wp.i18n.__("Launch Campaign", "structura")
  )));
};
const EditCampaignPage = () => {
  const { id: campaignId } = useParams();
  const { data: campaign, isLoading, dataUpdatedAt } = useCampaignQuery(campaignId);
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading campaign…", "structura"), size: "lg", padding: "lg" });
  }
  if (!campaign) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center gap-4 py-20 text-center" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-500" }, window.wp.i18n.__("Campaign not found.", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary" }, /* @__PURE__ */ window.wp.element.createElement("a", { href: "#/campaigns" }, window.wp.i18n.__("Back to Campaigns", "structura"))));
  }
  const initialData = {
    identity: campaign.identity,
    intelligence: campaign.intelligence,
    structure: {
      ...campaign.structure,
      // Normalize legacy "pending" (removed 2026-07-09) → "draft"; a
      // pre-postStatus campaign (no value) keeps the historical publish
      // default it actually ran with.
      postStatus: normalizePostStatus(campaign.structure.postStatus ?? "publish")
    },
    taxonomy: campaign.taxonomy,
    schedule: campaign.schedule,
    authority: campaign.authority,
    keywords: campaign.keywords
  };
  return /* @__PURE__ */ window.wp.element.createElement(CampaignProvider, { key: dataUpdatedAt, initialData, mode: "campaign" }, /* @__PURE__ */ window.wp.element.createElement(EditCampaignInner, { campaign }));
};
const CAMPAIGN_MODES = [
  {
    value: "traffic_magnet",
    label: window.wp.i18n.__("Traffic Magnet", "structura"),
    description: window.wp.i18n.__("Maximize organic traffic with high-volume topics", "structura")
  },
  {
    value: "quick_wins",
    label: window.wp.i18n.__("Quick Wins", "structura"),
    description: window.wp.i18n.__("Target low-competition keywords for fast rankings", "structura")
  },
  {
    value: "conversion",
    label: window.wp.i18n.__("Conversion", "structura"),
    description: window.wp.i18n.__("Content designed to convert readers to customers", "structura")
  },
  {
    value: "authority",
    label: window.wp.i18n.__("Authority", "structura"),
    description: window.wp.i18n.__("Build topical authority with comprehensive coverage", "structura")
  }
];
const ALL_STEPS = [
  { id: "strategy", label: window.wp.i18n.__("Strategy", "structura"), icon: ClipboardList },
  { id: "keywords", label: window.wp.i18n.__("Keywords", "structura"), icon: Key },
  { id: "authority", label: window.wp.i18n.__("Authority", "structura"), icon: Shield },
  { id: "rhythm", label: window.wp.i18n.__("Rhythm", "structura"), icon: CalendarClock }
];
const TabBar$1 = ({
  steps,
  activeStep,
  onStepClick
}) => /* @__PURE__ */ window.wp.element.createElement("nav", { className: "flex gap-1 rounded-xl bg-neutral-100 p-1 dark:bg-neutral-800" }, steps.map((step) => {
  const isActive = activeStep === step.id;
  const Icon2 = step.icon;
  return /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: step.id,
      type: "button",
      onClick: () => onStepClick(step.id),
      className: B$1(
        "flex cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-xs font-bold transition-all",
        isActive ? "text-brand-700 dark:text-brand-300 bg-white shadow-sm dark:bg-neutral-700" : "text-neutral-400 hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 14 }),
    step.label
  );
}));
const EditCampaignInner = ({ campaign }) => {
  const navigate = useNavigate();
  const { formData, updateForm } = useCampaignForm();
  const { updateCampaign, isUpdating } = useCampaignMutations();
  const hasAuthorityRule = formData.intelligence.seoRules?.outbound_link_authority === true;
  const keywordsRef = window.wp.element.useRef(null);
  const authorityRef = window.wp.element.useRef(null);
  const [activeStep, setActiveStep] = window.wp.element.useState("strategy");
  const [keywordsPhase, setKeywordsPhase] = window.wp.element.useState("idle");
  const [authorityPhase, setAuthorityPhase] = window.wp.element.useState("idle");
  const steps = ALL_STEPS.filter((s2) => s2.id !== "authority" || hasAuthorityRule);
  const goToStep = window.wp.element.useCallback((step) => {
    setActiveStep(step);
    window.scrollTo({ top: 0, behavior: "smooth" });
  }, []);
  const isKeywordsComplete = keywordsPhase === "complete";
  const isAuthorityComplete = authorityPhase === "complete";
  const handleSave = async () => {
    if (keywordsRef.current) {
      const bank = keywordsRef.current.getKeywords();
      updateForm("keywords", {
        bank,
        discoveryMeta: keywordsRef.current.getDiscoveryMeta(),
        discoveredAt: bank.length > 0 ? (/* @__PURE__ */ new Date()).toISOString() : null
      });
    }
    if (authorityRef.current) {
      const domains = authorityRef.current.getDomains();
      updateForm("authority", {
        domains,
        discoveredAt: domains.length > 0 ? (/* @__PURE__ */ new Date()).toISOString() : null
      });
    }
    await new Promise((r2) => setTimeout(r2, 50));
    try {
      await updateCampaign({ id: campaign.id, data: formData });
      navigate(`/campaigns/${campaign.id}`);
    } catch {
    }
  };
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-6 pb-24" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex items-center gap-4" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => navigate(`/campaigns/${campaign.id}`),
      className: "flex h-9 w-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-400 transition-colors hover:border-neutral-300 hover:text-neutral-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500 dark:hover:border-neutral-600 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-baseline gap-3" }, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, campaign.identity.name), /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: getBadgeIntentByCampaignStatus(campaign.status) }, campaignStatusLabel(campaign.status))), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Edit campaign configuration", "structura")))), /* @__PURE__ */ window.wp.element.createElement(PageBuilderCompatCard, null), /* @__PURE__ */ window.wp.element.createElement(TabBar$1, { steps, activeStep, onStepClick: goToStep }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-200/60 bg-white p-6 shadow-sm sm:p-8 dark:border-neutral-800 dark:bg-neutral-900" }, activeStep === "strategy" && /* @__PURE__ */ window.wp.element.createElement(StrategyEditSection, null), activeStep === "keywords" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(
    StepKeywords,
    {
      ref: keywordsRef,
      topic: formData.identity.objective,
      campaignName: formData.identity.name,
      language: formData.intelligence.language,
      provider: formData.intelligence.textProvider,
      existingKeywords: formData.keywords?.bank,
      existingDiscoveryMeta: formData.keywords?.discoveryMeta,
      onKeywordsChange: () => {
      },
      onPhaseChange: setKeywordsPhase
    }
  ), isKeywordsComplete && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end gap-3 border-t border-neutral-100 pt-5 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "transparent", size: "sm", onClick: () => setKeywordsPhase("idle") }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Re-discover", "structura")))), activeStep === "authority" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(
    AuthorityDiscovery,
    {
      ref: authorityRef,
      topic: formData.identity.objective,
      campaignName: formData.identity.name,
      language: formData.intelligence.language,
      provider: formData.intelligence.textProvider,
      existingDomains: formData.authority?.domains,
      onDomainsChange: () => {
      },
      onPhaseChange: setAuthorityPhase
    }
  ), isAuthorityComplete && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end gap-3 border-t border-neutral-100 pt-5 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "transparent", size: "sm", onClick: () => setAuthorityPhase("idle") }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Re-discover", "structura")))), activeStep === "rhythm" && /* @__PURE__ */ window.wp.element.createElement(SimpleStepRhythm, null)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "sticky bottom-0 z-20 flex items-center justify-end gap-3 rounded-2xl border border-neutral-200/60 bg-white/80 px-6 py-4 shadow-lg backdrop-blur-md dark:border-neutral-800 dark:bg-neutral-900/80" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", onClick: () => navigate(`/campaigns/${campaign.id}`) }, window.wp.i18n.__("Cancel", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: handleSave,
      loading: isUpdating,
      disabled: formData.identity.name.length < 3 || formData.identity.objective.length < 20
    },
    /* @__PURE__ */ window.wp.element.createElement(Save, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Save Changes", "structura")
  )));
};
const StrategyEditSection = () => {
  const { formData, updateForm } = useCampaignForm();
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-5" }, /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Campaign Name", "structura"),
      value: formData.identity.name,
      onChange: (e2) => updateForm("identity", { name: e2.target.value }),
      placeholder: window.wp.i18n.__("e.g. Winter 2026 SEO Push", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Campaign Objective", "structura"),
      value: formData.identity.objective,
      onChange: (e2) => updateForm("identity", { objective: e2.target.value }),
      rows: 5,
      placeholder: window.wp.i18n.__("Your campaign strategy…", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("label", { className: "mb-2 block text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Writing approach", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-2 gap-2 sm:grid-cols-4" }, CAMPAIGN_MODES.map((mode) => {
    const isSelected = formData.identity.campaignMode === mode.value;
    return /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        key: mode.value,
        type: "button",
        onClick: () => updateForm("identity", { campaignMode: mode.value }),
        className: B$1(
          "cursor-pointer rounded-xl border px-3 py-3 text-left transition-all",
          isSelected ? "border-brand-300 bg-brand-50 dark:border-brand-700 dark:bg-brand-950/40 shadow-sm" : "hover:border-brand-200 dark:hover:border-brand-800 border-neutral-200 bg-white dark:border-neutral-700 dark:bg-neutral-800"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "block text-xs font-bold",
            isSelected ? "text-brand-700 dark:text-brand-300" : "text-neutral-700 dark:text-neutral-300"
          )
        },
        mode.label
      ),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "mt-0.5 block text-[10px] text-neutral-400 dark:text-neutral-500" }, mode.description)
    );
  }))), /* @__PURE__ */ window.wp.element.createElement(CoreContentSettings, null), /* @__PURE__ */ window.wp.element.createElement(EditAdvancedSettings, null));
};
const CompactToggle = ({
  label,
  description,
  isEnabled,
  onToggle,
  isDisabled,
  badge
}) => /* @__PURE__ */ window.wp.element.createElement(
  "div",
  {
    className: B$1(
      "flex items-center justify-between gap-3 rounded-lg px-3 py-2 transition-colors",
      isDisabled ? "opacity-50" : "hover:bg-neutral-50 dark:hover:bg-neutral-800/40"
    )
  },
  /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex min-w-0 items-center gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
    "span",
    {
      className: B$1(
        "truncate text-xs font-medium",
        isEnabled && !isDisabled ? "text-neutral-900 dark:text-white" : "text-neutral-600 dark:text-neutral-400"
      )
    },
    label
  ), description && /* @__PURE__ */ window.wp.element.createElement(ce, { title: description, position: "top" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 cursor-help text-neutral-300 dark:text-neutral-600" }, /* @__PURE__ */ window.wp.element.createElement(CircleQuestionMark, { size: 12 }))), badge),
  /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label,
      hiddenLabel: true,
      checked: isEnabled,
      onChange: () => !isDisabled && onToggle(),
      disabled: isDisabled
    }
  )
);
const SettingsGroup = ({
  icon,
  label,
  count: count2,
  children,
  defaultOpen = false
}) => {
  const [open, setOpen] = window.wp.element.useState(defaultOpen);
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "rounded-lg border transition-colors duration-200",
        open ? "border-brand-200 bg-brand-50/30 dark:border-brand-900/40 dark:bg-brand-950/20 shadow-sm" : "border-neutral-200/70 hover:border-neutral-300 hover:shadow-sm dark:border-neutral-800 dark:hover:border-neutral-700"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: () => setOpen(!open),
        className: B$1(
          "flex w-full cursor-pointer items-center justify-between px-3 py-2.5 transition-colors",
          open ? "rounded-t-lg" : "rounded-lg hover:bg-neutral-50 dark:hover:bg-neutral-800/40"
        )
      },
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2" }, icon, /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "text-[10px] font-black tracking-widest uppercase transition-colors",
            open ? "text-brand-600 dark:text-brand-400" : "text-neutral-500 dark:text-neutral-400"
          )
        },
        label
      ), typeof count2 === "number" && /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "rounded-full px-1.5 py-0.5 text-[9px] font-bold tabular-nums transition-colors",
            open ? "bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400" : "bg-neutral-100 text-neutral-400 dark:bg-neutral-800 dark:text-neutral-500"
          )
        },
        count2
      )),
      /* @__PURE__ */ window.wp.element.createElement(
        ChevronDown,
        {
          size: 12,
          className: B$1(
            "transition-transform duration-200",
            open ? "text-brand-500 dark:text-brand-400 rotate-180" : "text-neutral-400"
          )
        }
      )
    ),
    open && /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-1 pt-1 pb-2" }, children)
  );
};
const ProBadge = () => /* @__PURE__ */ window.wp.element.createElement("span", { className: "bg-brand-50 text-brand-600 dark:bg-brand-950/30 dark:text-brand-400 shrink-0 rounded-full px-1.5 py-0.5 text-[8px] font-black uppercase" }, window.wp.i18n.__("Pro", "structura"));
const FreeBadge = () => /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 rounded-full bg-emerald-50 px-1.5 py-0.5 text-[8px] font-black text-emerald-600 uppercase dark:bg-emerald-950/30 dark:text-emerald-400" }, window.wp.i18n.__("Free", "structura"));
const RequiredBadge = () => /* @__PURE__ */ window.wp.element.createElement("span", { className: "shrink-0 rounded-full bg-neutral-100 px-1.5 py-0.5 text-[8px] font-black text-neutral-500 uppercase dark:bg-neutral-800 dark:text-neutral-400" }, window.wp.i18n.__("Required", "structura"));
const EditAdvancedSettings = () => {
  const { formData, updateForm } = useCampaignForm();
  const { isPaidLicense, isLicensed } = useLicense();
  const { availableProviders, availableImageProviders } = useDefaultProviders();
  const { rules, isLoading: loadingSeoRules } = useSeoRules();
  const [open, setOpen] = window.wp.element.useState(false);
  const { intelligence, structure, taxonomy } = formData;
  const [availableCats, setAvailableCats] = window.wp.element.useState([]);
  const [availableTags, setAvailableTags] = window.wp.element.useState([]);
  const [loadingTax, setLoadingTax] = window.wp.element.useState(false);
  window.wp.element.useEffect(() => {
    if (!open) return;
    if (availableCats.length > 0 || availableTags.length > 0 || loadingTax) return;
    const run = async () => {
      setLoadingTax(true);
      try {
        const [cats, tg] = await Promise.all([
          window.wp.apiFetch({ path: "/wp/v2/categories?per_page=100" }),
          window.wp.apiFetch({ path: "/wp/v2/tags?per_page=100" })
        ]);
        setAvailableCats(cats);
        setAvailableTags(tg);
      } catch {
      } finally {
        setLoadingTax(false);
      }
    };
    run();
  }, [open]);
  const toggleBlock = (blockName) => {
    const cur = structure.enabledBlocks || [];
    const next = cur.includes(blockName) ? cur.filter((b2) => b2 !== blockName) : [...cur, blockName];
    updateForm("structure", {
      enabledBlocks: next
    });
  };
  const toggleRule = (name) => {
    updateForm("intelligence", {
      seoRules: {
        ...intelligence.seoRules,
        [name]: !intelligence.seoRules[name]
      }
    });
  };
  const enabledSeoCount = rules ? Object.keys(rules).filter((k2) => intelligence.seoRules[k2]).length : 0;
  const enabledBlockCount = structure.enabledBlocks.length;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-neutral-200/60 dark:border-neutral-700/60" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setOpen(!open),
      className: B$1(
        "flex w-full cursor-pointer items-center justify-between px-4 py-3 transition-colors",
        open ? "rounded-t-xl border-b border-neutral-100 bg-neutral-50/50 dark:border-neutral-800 dark:bg-neutral-800/30" : "rounded-xl hover:bg-neutral-50 dark:hover:bg-neutral-800/30"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2 text-xs font-bold text-neutral-600 dark:text-neutral-300" }, /* @__PURE__ */ window.wp.element.createElement(Settings2, { size: 14, className: "text-neutral-400 dark:text-neutral-500" }), window.wp.i18n.__("Advanced Settings", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(
      ChevronDown,
      {
        size: 14,
        className: B$1("text-neutral-400 transition-transform duration-200", open && "rotate-180")
      }
    )
  ), open && /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4 p-4" }, availableProviders.length > 0 && /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Bot, { size: 13, className: "text-brand-500" }),
      label: window.wp.i18n.__("AI Engine", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-2 py-2" }, /* @__PURE__ */ window.wp.element.createElement(
      CampaignAiEngineSection,
      {
        availableTextProviders: availableProviders,
        availableImageProviders
      }
    ))
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Rocket, { size: 13, className: "text-rose-500" }),
      label: window.wp.i18n.__("Improvements", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle,
      {
        label: window.wp.i18n.__("Replace long AI-like dashes", "structura"),
        description: window.wp.i18n.__(
          "Normalize AI dashes (like—this) to standard format (like - this).",
          "structura"
        ),
        isEnabled: intelligence.replaceLongDashes,
        onToggle: () => updateForm("intelligence", {
          replaceLongDashes: !intelligence.replaceLongDashes
        })
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle,
      {
        label: window.wp.i18n.__("Disable emojis", "structura"),
        description: window.wp.i18n.__(
          "Remove emojis from AI-generated content for a cleaner output.",
          "structura"
        ),
        isEnabled: intelligence.disableEmojis,
        onToggle: () => updateForm("intelligence", {
          disableEmojis: !intelligence.disableEmojis
        })
      }
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Image, { size: 13, className: "text-emerald-500" }),
      label: window.wp.i18n.__("Images", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle,
      {
        label: window.wp.i18n.__("Generate featured image", "structura"),
        description: window.wp.i18n.__("Create a relevant featured image for each post.", "structura"),
        isEnabled: structure.featuredImage,
        onToggle: () => updateForm("structure", {
          featuredImage: !structure.featuredImage
        }),
        isDisabled: !isLicensed,
        badge: !isLicensed ? /* @__PURE__ */ window.wp.element.createElement(FreeBadge, null) : void 0
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      CompactToggle,
      {
        label: window.wp.i18n.__("Body image generation", "structura"),
        description: window.wp.i18n.__("Identify spots and generate images in the post body.", "structura"),
        isEnabled: structure.bodyImages,
        onToggle: () => updateForm("structure", {
          bodyImages: !structure.bodyImages
        }),
        isDisabled: !isPaidLicense,
        badge: !isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(ProBadge, null) : void 0
      }
    ),
    /* @__PURE__ */ window.wp.element.createElement(
      VisualStyleFallbackNotice,
      {
        imagesEnabled: structure.featuredImage || structure.bodyImages
      }
    )
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(PanelsTopLeft, { size: 13, className: "text-purple-500" }),
      label: window.wp.i18n.__("Content Blocks", "structura"),
      count: enabledBlockCount
    },
    CONTENT_BLOCKS.map((block) => {
      const isProLocked = block.isPro && !isPaidLicense;
      const isFreeLocked = block.name === "core/heading" && !isLicensed;
      return /* @__PURE__ */ window.wp.element.createElement(
        CompactToggle,
        {
          key: block.name,
          label: block.label,
          description: block.description,
          isEnabled: block.isRequired || structure.enabledBlocks.includes(block.name),
          onToggle: () => toggleBlock(block.name),
          isDisabled: block.isRequired || isProLocked || isFreeLocked,
          badge: block.isRequired ? /* @__PURE__ */ window.wp.element.createElement(RequiredBadge, null) : isProLocked ? /* @__PURE__ */ window.wp.element.createElement(ProBadge, null) : isFreeLocked ? /* @__PURE__ */ window.wp.element.createElement(FreeBadge, null) : void 0
        }
      );
    })
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 13, className: "text-amber-500" }),
      label: window.wp.i18n.__("SEO Directives", "structura"),
      count: enabledSeoCount
    },
    loadingSeoRules ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-8 items-center justify-center" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "size-3 animate-spin text-neutral-400" })) : rules ? Object.entries(rules).map(([name, rule]) => {
      const isProLocked = ["byok", "cloud"].includes(rule.plan) && !isPaidLicense;
      const isFreeLocked = rule.plan === "free" && !isLicensed;
      return /* @__PURE__ */ window.wp.element.createElement(
        CompactToggle,
        {
          key: name,
          label: rule.label,
          description: rule.description,
          isEnabled: intelligence.seoRules[name],
          onToggle: () => toggleRule(name),
          isDisabled: isProLocked || isFreeLocked,
          badge: isProLocked ? /* @__PURE__ */ window.wp.element.createElement(ProBadge, null) : isFreeLocked ? /* @__PURE__ */ window.wp.element.createElement(FreeBadge, null) : void 0
        }
      );
    }) : null
  ), /* @__PURE__ */ window.wp.element.createElement(
    SettingsGroup,
    {
      icon: /* @__PURE__ */ window.wp.element.createElement(FolderOpen, { size: 13, className: "text-brand-500" }),
      label: window.wp.i18n.__("Taxonomy", "structura")
    },
    loadingTax ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-8 items-center justify-center" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "size-3 animate-spin text-neutral-400" })) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3 px-2 py-2" }, /* @__PURE__ */ window.wp.element.createElement(
      TaxonomySection,
      {
        title: window.wp.i18n.__("Categories", "structura"),
        icon: /* @__PURE__ */ window.wp.element.createElement(FolderOpen, { size: 14 }),
        mode: taxonomy.categories.mode,
        setMode: (val) => updateForm("taxonomy", {
          categories: {
            ...taxonomy.categories,
            mode: val
          }
        }),
        items: availableCats,
        selected: taxonomy.categories.list,
        setSelected: (val) => updateForm("taxonomy", {
          categories: {
            ...taxonomy.categories,
            list: val
          }
        })
      }
    ), /* @__PURE__ */ window.wp.element.createElement(
      TaxonomySection,
      {
        title: window.wp.i18n.__("Tags", "structura"),
        icon: /* @__PURE__ */ window.wp.element.createElement(Tag, { size: 14 }),
        mode: taxonomy.tags.mode,
        setMode: (val) => updateForm("taxonomy", {
          tags: { ...taxonomy.tags, mode: val }
        }),
        items: availableTags,
        selected: taxonomy.tags.list,
        setSelected: (val) => updateForm("taxonomy", {
          tags: { ...taxonomy.tags, list: val }
        })
      }
    ))
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between rounded-lg px-3 py-2" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Scale, { size: 13, className: "text-emerald-500" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("AI Transparency Signal", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    ce,
    {
      title: window.wp.i18n.__(
        "Append a disclosure notice to AI-generated content for transparency.",
        "structura"
      ),
      position: "top"
    },
    /* @__PURE__ */ window.wp.element.createElement("span", { className: "cursor-help text-neutral-300 dark:text-neutral-600" }, /* @__PURE__ */ window.wp.element.createElement(CircleQuestionMark, { size: 12 }))
  )), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Disclosure", "structura"),
      hiddenLabel: true,
      checked: structure.disclosure.enabled,
      onChange: (checked) => updateForm("structure", {
        disclosure: {
          ...structure.disclosure,
          enabled: checked
        }
      })
    }
  )), structure.disclosure.enabled && /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-3" }, /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Disclosure Notice", "structura"),
      value: structure.disclosure.text,
      onChange: (e2) => updateForm("structure", {
        disclosure: {
          ...structure.disclosure,
          text: e2.target.value
        }
      }),
      rows: 2
    }
  ))));
};
const useJobMutations = () => {
  const queryClient2 = useQueryClient();
  const { successToast, errorToast } = Mn();
  const { setActiveRun } = useRuns();
  const invalidate = () => {
    queryClient2.invalidateQueries({ queryKey: jobKeys.lists() });
    queryClient2.invalidateQueries({ queryKey: campaignKeys.lists() });
  };
  const runMutation = useMutation({
    mutationFn: (campaignId) => window.wp.apiFetch({
      path: `/structura/v1/jobs/run`,
      method: "POST",
      data: { campaign_id: campaignId }
    }),
    // `campaignId` is read from the mutation variables (second arg) so
    // we can pair it with the runId returned in the response. Using
    // variables rather than shoehorning campaignId into the mutationFn
    // return shape keeps the wire type honest — the REST reply really
    // doesn't carry it; we're combining server state with the known
    // call-site input.
    onSuccess: (res, campaignId) => {
      if (res.campaign_run_id) {
        setActiveRun({
          runId: res.campaign_run_id,
          campaignId
        });
      }
      successToast(res.message || window.wp.i18n.__("Campaign execution initiated.", "structura"));
      invalidate();
    }
  });
  const retryMutation = useMutation({
    mutationFn: (actionId) => window.wp.apiFetch({
      path: `/structura/v1/jobs/retry`,
      method: "POST",
      data: { id: actionId }
    }),
    onSuccess: () => {
      successToast(window.wp.i18n.__("Task rescheduled for immediate retry.", "structura"));
      invalidate();
    }
  });
  const deleteMutation = useMutation({
    mutationFn: (actionId) => window.wp.apiFetch({
      path: `/structura/v1/jobs/${actionId}`,
      method: "DELETE"
    }),
    onSuccess: () => {
      successToast(window.wp.i18n.__("Task removed from queue.", "structura"));
      invalidate();
    }
  });
  return {
    runNow: runMutation.mutateAsync,
    isRunningNow: runMutation.isPending,
    retry: retryMutation.mutateAsync,
    deleteJob: deleteMutation.mutateAsync,
    runMutation,
    retryMutation,
    deleteMutation,
    isAnyProcessing: runMutation.isPending || retryMutation.isPending || deleteMutation.isPending
  };
};
const useCampaignPostsQuery = (campaignId, page, perPage = 10) => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: ["campaign-posts", { campaignId, page, perPage }],
    enabled: hasUsableLicense === true,
    queryFn: async () => {
      const params = new URLSearchParams({
        campaign_id: String(campaignId),
        page: page.toString(),
        per_page: perPage.toString()
      });
      return window.wp.apiFetch({
        path: `/structura/v1/analytics/recent-blueprints?${params.toString()}`
      });
    },
    placeholderData: keepPreviousData,
    staleTime: 5e3
  });
};
const statusBadgeIntent = (status) => {
  switch (status) {
    case "connected":
      return "success";
    case "expired":
      return "warning";
    case "revoked":
    case "error":
    default:
      return "destructive";
  }
};
const ChannelsTab = ({ campaignId: _campaignId }) => {
  const { data: connections, isLoading, isError } = useChannelConnectionsQuery();
  const { data: catalog } = useChannelCatalogQuery();
  const catalogById = window.wp.element.useMemo(() => {
    const map = /* @__PURE__ */ new Map();
    catalog?.entries.forEach((entry) => map.set(entry.id, entry));
    return map;
  }, [catalog]);
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-16 w-full rounded-xl" }), /* @__PURE__ */ window.wp.element.createElement(wa, { className: "h-16 w-full rounded-xl" }));
  }
  if (isError) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-red-200 bg-red-50 p-5 text-sm text-red-800 dark:border-red-900/40 dark:bg-red-950/30 dark:text-red-200" }, window.wp.i18n.__(
      "We couldn't load your channel connections. Try reloading the page.",
      "structura"
    ));
  }
  if (!connections || connections.length === 0) {
    return /* @__PURE__ */ window.wp.element.createElement(EmptyState, null);
  }
  return /* @__PURE__ */ window.wp.element.createElement("section", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex items-start justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "These channels will fire whenever a post from this campaign is published. Connections apply site-wide — edit them on the Channels page.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/connections" }, window.wp.i18n.__("Manage channels", "structura")))), /* @__PURE__ */ window.wp.element.createElement(
    "ul",
    {
      className: "m-0! list-none space-y-2 p-0!",
      "aria-label": window.wp.i18n.__("Channels enabled for this campaign", "structura")
    },
    connections.map((connection) => {
      const entry = catalogById.get(connection.integrationId);
      return /* @__PURE__ */ window.wp.element.createElement(
        "li",
        {
          key: connection.connectionId ?? connection.integrationId,
          className: "flex items-center gap-3 rounded-xl border border-neutral-200 bg-white p-3 dark:border-neutral-800 dark:bg-neutral-900"
        },
        /* @__PURE__ */ window.wp.element.createElement(
          IntegrationIcon,
          {
            integrationId: connection.integrationId,
            iconUrl: entry?.iconUrl,
            sizeClassName: "size-9"
          }
        ),
        /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "truncate text-sm font-semibold text-neutral-900 dark:text-neutral-100" }, entry?.name ?? connection.integrationId), /* @__PURE__ */ window.wp.element.createElement("div", { className: "truncate text-xs text-neutral-500 dark:text-neutral-400" }, connection.displayName || connection.integrationId)),
        /* @__PURE__ */ window.wp.element.createElement(
          Me,
          {
            variant: "solid",
            intent: statusBadgeIntent(connection.status)
          },
          connectionStatusLabel(connection.status)
        )
      );
    })
  ));
};
const EmptyState = () => /* @__PURE__ */ window.wp.element.createElement(
  Ea,
  {
    icon: /* @__PURE__ */ window.wp.element.createElement(Plug, { size: 22 }),
    title: window.wp.i18n.__("Connect your first channel", "structura"),
    description: window.wp.i18n.__(
      "Notify Slack, ping IndexNow, or auto-publish to LinkedIn when posts in this campaign go live. Pick a channel from the Store to get started.",
      "structura"
    ),
    action: /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/channels/store" }, /* @__PURE__ */ window.wp.element.createElement(Store, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Browse Channels Store", "structura")))
  }
);
const CampaignRunsTab = ({ campaignId }) => {
  const { data, isLoading, isError, refetch, isFetching } = useCampaignRunsQuery(campaignId);
  if (isError) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-neutral-200/60 p-8 text-center" }, /* @__PURE__ */ window.wp.element.createElement(
      CircleAlert,
      {
        className: "mx-auto mb-3 h-8 w-8 text-neutral-400 dark:text-neutral-500",
        "aria-hidden": true
      }
    ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-700 dark:text-neutral-300" }, window.wp.i18n.__("Couldn’t load run history", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-neutral-500 dark:text-neutral-500" }, window.wp.i18n.__("Something went wrong reaching the cloud. Try again in a moment.", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        type: "button",
        variant: "secondary",
        size: "sm",
        onClick: () => {
          void refetch();
        },
        disabled: isFetching,
        className: "mt-4"
      },
      /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 12, className: B$1("mr-1.5", isFetching && "animate-spin"), "aria-hidden": true }),
      isFetching ? window.wp.i18n.__("Retrying…", "structura") : window.wp.i18n.__("Try again", "structura")
    ));
  }
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-neutral-200/60 p-0!" }, /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading runs…", "structura"), size: "lg", padding: "lg" }));
  }
  const runs = data ?? [];
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-neutral-200/60 p-0!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-neutral-100 bg-neutral-50/50 px-5 py-3 sm:px-6 dark:border-neutral-800 dark:bg-neutral-950/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, runs.length > 0 ? (
    /* translators: %s is a count of runs (e.g. "12"). */
    window.wp.i18n.sprintf(window.wp.i18n.__("%s runs", "structura"), runs.length.toString())
  ) : window.wp.i18n.__("Runs", "structura"))), runs.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "py-16 text-center" }, /* @__PURE__ */ window.wp.element.createElement(
    Activity,
    {
      size: 32,
      className: "mx-auto mb-3 text-neutral-200 dark:text-neutral-700",
      "aria-hidden": true
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("No runs recorded for this campaign yet.", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "A run will appear here the next time this campaign generates a post.",
    "structura"
  ))) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "divide-y divide-neutral-100 dark:divide-neutral-800" }, runs.map((run) => /* @__PURE__ */ window.wp.element.createElement(RunRow, { key: run.runId, run }))));
};
const RunRow = ({ run }) => {
  const startedAt = new Date(run.startedAt);
  const endedAt = run.endedAt ? new Date(run.endedAt) : null;
  const computedDurationMs = run.durationMs ?? (endedAt ? endedAt.getTime() - startedAt.getTime() : void 0);
  const isTerminal = run.status !== "queued" && run.status !== "running";
  return /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: `#/runs/${encodeURIComponent(run.runId)}`,
      className: B$1(
        "group flex flex-col gap-1 px-5 py-3.5 transition-colors hover:bg-neutral-50/60 sm:px-6 dark:hover:bg-neutral-800/30",
        "no-underline"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(RunStatusChip, { status: run.status })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-800 dark:text-neutral-200" }, formatAbsoluteTime(startedAt)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-[11px] text-neutral-400 dark:text-neutral-500" }, isTerminal && computedDurationMs != null ? (
      /* translators: %s is a duration like "3m 42s". */
      window.wp.i18n.sprintf(window.wp.i18n.__("Completed in %s", "structura"), formatDuration(computedDurationMs))
    ) : !isTerminal ? (
      /* translators: %s is a human step name like "Generating images". */
      window.wp.i18n.sprintf(window.wp.i18n.__("In progress · %s", "structura"), humanizeStep(run.currentStep))
    ) : window.wp.i18n.__("Duration unavailable", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
      ChevronRight,
      {
        size: 14,
        className: "shrink-0 text-neutral-300 transition-colors group-hover:text-neutral-500 dark:text-neutral-600 dark:group-hover:text-neutral-400",
        "aria-hidden": true
      }
    )),
    run.status === "failed" && run.error?.userMessage && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-md bg-red-50 px-3 py-2 text-xs text-red-700 sm:ml-28 dark:bg-red-950/40 dark:text-red-300" }, run.error.userMessage)
  );
};
const RunStatusChip = ({ status }) => {
  switch (status) {
    case "succeeded":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "success", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(Check, { size: 11, className: "mr-1", "aria-hidden": true }), window.wp.i18n.__("Succeeded", "structura"));
    case "succeeded_with_warnings":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "warning", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(CircleAlert, { size: 11, className: "mr-1", "aria-hidden": true }), window.wp.i18n.__("Warnings", "structura"));
    case "failed":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "destructive", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(X, { size: 11, className: "mr-1", "aria-hidden": true }), window.wp.i18n.__("Stopped", "structura"));
    case "cancelled":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "default", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(Minus, { size: 11, className: "mr-1", "aria-hidden": true }), window.wp.i18n.__("Cancelled", "structura"));
    case "running":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "info", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 11, className: "mr-1 animate-spin", "aria-hidden": true }), window.wp.i18n.__("Running", "structura"));
    case "awaiting_pull":
      return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "info", className: "shrink-0" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 11, className: "mr-1 animate-spin", "aria-hidden": true }), window.wp.i18n.__("Delivering", "structura"));
    case "queued":
    default:
      return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "default", className: "shrink-0" }, window.wp.i18n.__("Queued", "structura"));
  }
};
function formatAbsoluteTime(d2) {
  try {
    return new Intl.DateTimeFormat(void 0, {
      dateStyle: "medium",
      timeStyle: "short"
    }).format(d2);
  } catch {
    return d2.toISOString();
  }
}
function humanizeStep(step) {
  switch (step) {
    case "queued":
      return window.wp.i18n.__("Queued", "structura");
    case "authority_fetch":
      return window.wp.i18n.__("Authorities", "structura");
    case "keyword_research":
      return window.wp.i18n.__("Keywords", "structura");
    case "topic_selection":
      return window.wp.i18n.__("Topic", "structura");
    case "drafting":
      return window.wp.i18n.__("Draft", "structura");
    case "images":
    case "image_featured":
    case "image_body":
      return window.wp.i18n.__("Images", "structura");
    case "publish":
      return window.wp.i18n.__("Publishing", "structura");
    case "channels_fanout":
      return window.wp.i18n.__("Channels", "structura");
    default:
      return step;
  }
}
const useStockListQuery = (campaignId, options) => {
  const { hasUsableLicense } = useLicense();
  return useQuery({
    queryKey: campaignKeys.stock(campaignId),
    enabled: hasUsableLicense === true && (options?.enabled ?? true),
    staleTime: 15e3,
    refetchInterval: (query) => {
      const entries = query.state.data?.entries ?? [];
      const hasInFlight = entries.some((e2) => e2.entryStatus === "pending");
      if (query.state.data?.pregen?.paused) return 6e4;
      return hasInFlight ? 3e4 : false;
    },
    queryFn: async () => {
      const response = await window.wp.apiFetch({
        path: `/structura/v1/scheduler/campaign/${campaignId}/stock`
      });
      return {
        entries: response?.entries ?? [],
        pregen: response?.pregen ?? null
      };
    },
    // The tab renders its own empty/error states; no global toast.
    meta: { silentError: true }
  });
};
const useStockMutations = (campaignId) => {
  const queryClient2 = useQueryClient();
  const invalidate = () => {
    void queryClient2.invalidateQueries({ queryKey: campaignKeys.stock(campaignId) });
    void queryClient2.invalidateQueries({
      queryKey: campaignKeys.stockSummary(campaignId)
    });
  };
  const deleteMutation = useMutation({
    mutationFn: (stockId) => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${campaignId}/stock/${stockId}`,
      method: "DELETE"
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Stock post discarded.", "structura"));
      invalidate();
    }
  });
  const clearMutation = useMutation({
    mutationFn: () => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${campaignId}/stock/clear`,
      method: "POST"
    }),
    onSuccess: () => {
      An.success(window.wp.i18n.__("Stock emptied.", "structura"));
      invalidate();
    }
  });
  const restockMutation = useMutation({
    mutationFn: () => window.wp.apiFetch({
      path: `/structura/v1/scheduler/campaign/${campaignId}/stock/restock`,
      method: "POST"
    }),
    onSuccess: (result) => {
      if (result?.refillOk) {
        An.success(window.wp.i18n.__("Regenerating stock — fresh posts are on the way.", "structura"));
      } else if (result?.refill === "daily_cap_hit") {
        An.error(
          window.wp.i18n.__(
            "Stock regeneration is paused for today — this campaign hit its daily refill limit.",
            "structura"
          )
        );
      } else {
        An.error(window.wp.i18n.__("Could not start the regeneration. Please try again later.", "structura"));
      }
      invalidate();
    }
  });
  return {
    deleteEntry: deleteMutation.mutateAsync,
    isDeletingEntry: deleteMutation.isPending,
    clearStock: clearMutation.mutateAsync,
    isClearing: clearMutation.isPending,
    restock: restockMutation.mutateAsync,
    isRestocking: restockMutation.isPending
  };
};
const ENTRY_STATUS_INTENT = {
  ready: "success",
  pending: "warning",
  failed: "destructive"
};
const entryStatusLabel = (status) => {
  switch (status) {
    case "ready":
      return window.wp.i18n.__("Ready", "structura");
    case "pending":
      return window.wp.i18n.__("Generating", "structura");
    case "failed":
      return window.wp.i18n.__("Failed", "structura");
  }
};
const batchAge = (submittedAtIso) => {
  if (!submittedAtIso) return null;
  const mins = Math.max(0, Math.round((Date.now() - new Date(submittedAtIso).getTime()) / 6e4));
  if (mins < 60) return window.wp.i18n.sprintf(window.wp.i18n.__("%d min", "structura"), mins);
  return window.wp.i18n.sprintf(window.wp.i18n.__("%s h", "structura"), (mins / 60).toFixed(1));
};
const StockBanner = ({ campaign }) => {
  const { isCloud } = useDefaultProviders();
  const { updateCampaign, isUpdating } = useCampaignMutations();
  const pregenEnabled = campaign.schedule.pregenerationEnabled ?? true;
  const enablePregeneration = async () => {
    const data = {
      identity: campaign.identity,
      intelligence: campaign.intelligence,
      structure: {
        ...campaign.structure,
        // Normalize legacy "pending" (removed 2026-07-09) → "draft".
        postStatus: normalizePostStatus(campaign.structure.postStatus ?? "publish")
      },
      taxonomy: campaign.taxonomy,
      schedule: { ...campaign.schedule, pregenerationEnabled: true },
      authority: campaign.authority,
      keywords: campaign.keywords
    };
    await updateCampaign({ id: campaign.id, data });
  };
  if (!pregenEnabled && !isCloud) {
    return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "border-amber-200/60 bg-amber-50/40 p-5 dark:border-amber-900/30 dark:bg-amber-950/10" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 18, className: "mt-0.5 shrink-0 text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-bold text-neutral-800 dark:text-neutral-200" }, window.wp.i18n.__("Pre-generation is off for this campaign", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
      "Stock is a buffer of posts written ahead of your schedule using your AI provider's discounted batch tier. With it on, scheduled posts cost up to 50% less and publish in under a second — without it, every run generates fresh at full price. We highly recommend enabling it.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", className: "mt-3", onClick: enablePregeneration, disabled: isUpdating }, isUpdating ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Enable pre-generation", "structura")))));
  }
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "border-neutral-200/60 p-5" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 18, className: "text-brand-500 mt-0.5 shrink-0" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-bold text-neutral-800 dark:text-neutral-200" }, window.wp.i18n.__("What is stock?", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__(
    "Stock is a small buffer of posts written ahead of your schedule on the AI provider's discounted batch tier. When a scheduled run fires, it publishes a stocked post instantly and a replacement is generated in the background. These are drafts held in the cloud — they only become real posts on your site when their scheduled run consumes them. Editing the campaign discards outdated stock automatically.",
    "structura"
  ), isCloud ? " " + window.wp.i18n.__("Pre-generation is always on for managed plans.", "structura") : ""))));
};
const GeneratingStrip = ({ entries, onRestock, isRestocking }) => {
  const inFlight = entries.filter((e2) => e2.entryStatus === "pending");
  if (inFlight.length === 0) return null;
  const oldest = inFlight.reduce((acc, e2) => {
    if (!e2.batchSubmittedAt) return acc;
    return !acc || e2.batchSubmittedAt < acc ? e2.batchSubmittedAt : acc;
  }, null);
  const age = batchAge(oldest);
  const looksStuck = !!oldest && Date.now() - new Date(oldest).getTime() > 60 * 6e4;
  return /* @__PURE__ */ window.wp.element.createElement(
    Vt,
    {
      className: B$1(
        "p-4",
        looksStuck ? "border-amber-200/60 bg-amber-50/40 dark:border-amber-900/30 dark:bg-amber-950/10" : "border-neutral-200/60"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
      RefreshCw,
      {
        size: 16,
        className: B$1(
          "shrink-0 animate-spin",
          looksStuck ? "text-amber-500" : "text-brand-500"
        ),
        style: { animationDuration: "2.5s" }
      }
    ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-neutral-800 dark:text-neutral-200" }, window.wp.i18n.sprintf(
      /* translators: %d: number of posts being generated. */
      window.wp.i18n.__("Generating %d post(s)…", "structura"),
      inFlight.length
    ), age ? " " + window.wp.i18n.sprintf(
      /* translators: %s: elapsed time like "26 min". */
      window.wp.i18n.__("(started %s ago)", "structura"),
      age
    ) : ""), looksStuck && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-xs text-amber-700 dark:text-amber-400" }, window.wp.i18n.__(
      "This is taking longer than usual — the provider's batch queue may be slow. You can cancel and start over.",
      "structura"
    )))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", onClick: onRestock, disabled: isRestocking }, isRestocking ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 13, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 13, className: "mr-1.5" }), window.wp.i18n.__("Cancel & regenerate", "structura")))
  );
};
const StockEntryRow = ({ entry, onDelete, onRetry, isRestocking }) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "group flex items-start gap-4 px-5 py-4 transition-colors hover:bg-neutral-50/50 sm:px-6 dark:hover:bg-neutral-800/30" }, entry.featuredImageUrl ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "size-14 shrink-0 overflow-hidden rounded-lg border border-neutral-200 shadow-sm dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement("img", { src: entry.featuredImageUrl, alt: "", className: "h-full w-full object-cover" })) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-14 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(Image, { size: 18, className: "text-neutral-300 dark:text-neutral-600" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! truncate text-sm font-semibold text-neutral-800 dark:text-neutral-200" }, entry.title ?? (entry.entryStatus === "failed" ? window.wp.i18n.__("Generation failed", "structura") : window.wp.i18n.__("Writing this post…", "structura"))), entry.excerpt && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5!line-clamp-2 mb-0! text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, entry.excerpt), entry.entryStatus === "failed" && entry.failureReason && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5!flex mb-0! items-start gap-1 text-xs text-red-600 dark:text-red-400" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 12, className: "mt-0.5 shrink-0" }), /* @__PURE__ */ window.wp.element.createElement("span", null, entry.failureReason)), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-[11px] text-neutral-400 dark:text-neutral-500" }, entry.createdAt ? dayjs(entry.createdAt).fromNow() : null, entry.textModel ? /* @__PURE__ */ window.wp.element.createElement("span", null, " · ", entry.textModel) : null)), /* @__PURE__ */ window.wp.element.createElement(
  Me,
  {
    variant: "solid",
    intent: ENTRY_STATUS_INTENT[entry.entryStatus] ?? "default",
    className: "mt-0.5 shrink-0"
  },
  entryStatusLabel(entry.entryStatus)
), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-1" }, entry.entryStatus === "failed" && /* @__PURE__ */ window.wp.element.createElement(
  "button",
  {
    type: "button",
    onClick: onRetry,
    disabled: isRestocking,
    title: window.wp.i18n.__("Retry", "structura"),
    className: "hover:bg-brand-50 hover:text-brand-600 dark:hover:bg-brand-950/20 dark:hover:text-brand-400 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg text-neutral-300 transition-colors disabled:cursor-not-allowed disabled:opacity-50 dark:text-neutral-600"
  },
  /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14 })
), /* @__PURE__ */ window.wp.element.createElement(
  "button",
  {
    type: "button",
    onClick: onDelete,
    title: window.wp.i18n.__("Discard", "structura"),
    className: "flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg text-neutral-300 transition-colors hover:bg-red-50 hover:text-red-600 dark:text-neutral-600 dark:hover:bg-red-950/20 dark:hover:text-red-400"
  },
  /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 14 })
)));
const StockTab = ({ campaign }) => {
  const pregenEnabled = campaign.schedule.pregenerationEnabled ?? true;
  const { data, isLoading } = useStockListQuery(campaign.id, {
    enabled: pregenEnabled
  });
  const entries = data?.entries ?? [];
  const pregen = data?.pregen ?? null;
  const { deleteEntry, isDeletingEntry, clearStock, isClearing, restock, isRestocking } = useStockMutations(campaign.id);
  const [confirm, setConfirm] = window.wp.element.useState(null);
  const readyCount = entries.filter((e2) => e2.entryStatus === "ready").length;
  const handleConfirm = async () => {
    if (!confirm) return;
    try {
      if (confirm.type === "delete") {
        await deleteEntry(confirm.stockId);
      } else {
        await clearStock();
      }
    } catch {
    }
    setConfirm(null);
  };
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-4" }, /* @__PURE__ */ window.wp.element.createElement(StockBanner, { campaign }), pregen?.paused && /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "border-amber-200/60 bg-amber-50/40 p-5 dark:border-amber-900/30 dark:bg-amber-950/10" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(TriangleAlert, { size: 18, className: "mt-0.5 shrink-0 text-amber-500" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-bold text-neutral-800 dark:text-neutral-200" }, window.wp.i18n.__("Pre-generation paused — provider errors", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.sprintf(
    /* translators: %d: number of failed generation attempts today. */
    window.wp.i18n.__(
      "We hit %d failed generation attempts today, so new pre-generated posts are paused to avoid wasting your AI credits. Your scheduled posts still publish normally — they just generate fresh at run time until stock recovers.",
      "structura"
    ),
    pregen.failureCount
  ), pregen.resetsAt ? " " + window.wp.i18n.sprintf(
    /* translators: %s: date/time when pre-generation resumes. */
    window.wp.i18n.__("It resumes automatically around %s.", "structura"),
    dayjs(pregen.resetsAt).format("MMM D, HH:mm")
  ) : ""), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-amber-700 dark:text-amber-400" }, window.wp.i18n.__(
    "If this keeps happening, try switching this campaign's AI provider in AI Engine settings.",
    "structura"
  ))))), pregenEnabled && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(
    GeneratingStrip,
    {
      entries,
      onRestock: () => void restock(),
      isRestocking
    }
  ), /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-neutral-200/60 p-0!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-neutral-100 bg-neutral-50/50 px-5 py-3 sm:px-6 dark:border-neutral-800 dark:bg-neutral-950/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.sprintf(
    /* translators: %d: number of ready pre-generated posts. */
    window.wp.i18n.__("%d ready in stock", "structura"),
    readyCount
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => void restock(),
      disabled: isRestocking,
      title: window.wp.i18n.__("Discard everything and generate fresh posts", "structura")
    },
    isRestocking ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 13, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 13, className: "mr-1.5" }),
    window.wp.i18n.__("Regenerate", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => setConfirm({ type: "clear" }),
      disabled: isClearing || entries.length === 0
    },
    /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 13, className: "mr-1.5" }),
    window.wp.i18n.__("Empty stock", "structura")
  ))), isLoading ? /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading stock…", "structura"), size: "lg", padding: "lg" }) : entries.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "py-16 text-center" }, /* @__PURE__ */ window.wp.element.createElement(
    PackageOpen,
    {
      size: 32,
      className: "mx-auto mb-3 text-neutral-200 dark:text-neutral-700"
    }
  ), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "Stock is empty — posts are pre-generated automatically ahead of your schedule.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      className: "mt-4",
      onClick: () => void restock(),
      disabled: isRestocking
    },
    isRestocking ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 13, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 13, className: "mr-1.5" }),
    window.wp.i18n.__("Generate now", "structura")
  )) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "divide-y divide-neutral-100 dark:divide-neutral-800" }, entries.map((entry) => /* @__PURE__ */ window.wp.element.createElement(
    StockEntryRow,
    {
      key: entry.stockId,
      entry,
      onDelete: () => setConfirm({ type: "delete", stockId: entry.stockId }),
      onRetry: () => void restock(),
      isRestocking
    }
  ))))), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: !!confirm,
      onClose: () => setConfirm(null),
      onConfirm: handleConfirm,
      loading: confirm?.type === "clear" ? isClearing : isDeletingEntry,
      variant: "danger",
      title: confirm?.type === "clear" ? window.wp.i18n.__("Empty the stock?", "structura") : window.wp.i18n.__("Discard this post?", "structura"),
      description: confirm?.type === "clear" ? window.wp.i18n.__(
        "All pre-generated posts for this campaign will be discarded, including any still generating. While pre-generation stays on, fresh posts are written automatically.",
        "structura"
      ) : window.wp.i18n.__(
        "This pre-generated post will be discarded. A replacement is written automatically while pre-generation stays on.",
        "structura"
      ),
      confirmButtonProps: {
        label: confirm?.type === "clear" ? window.wp.i18n.__("Empty stock", "structura") : window.wp.i18n.__("Discard", "structura")
      }
    }
  ));
};
const buildTabs = (channelsVisible, stockReadyCount) => [
  { id: "overview", label: window.wp.i18n.__("Overview", "structura"), icon: LayoutDashboard },
  { id: "posts", label: window.wp.i18n.__("Posts", "structura"), icon: FileText },
  {
    id: "stock",
    label: window.wp.i18n.__("Stock", "structura"),
    icon: Package,
    chip: stockReadyCount
  },
  ...channelsVisible ? [
    {
      id: "channels",
      label: window.wp.i18n.__("Channels", "structura"),
      icon: Share2
    }
  ] : [],
  { id: "runs", label: window.wp.i18n.__("Runs", "structura"), icon: Activity }
];
const CampaignViewPage = () => {
  const { id: campaignId } = useParams();
  const { data: campaign, isLoading } = useCampaignQuery(campaignId);
  if (isLoading) {
    return /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading campaign…", "structura"), size: "lg", padding: "lg" });
  }
  if (!campaign) {
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "py-20 text-center text-neutral-500" }, window.wp.i18n.__("Campaign not found.", "structura"));
  }
  return /* @__PURE__ */ window.wp.element.createElement(CampaignViewInner, { campaign });
};
const TabBar = ({
  tabs,
  activeTab,
  onTabClick
}) => /* @__PURE__ */ window.wp.element.createElement("nav", { className: "flex gap-1 overflow-x-auto rounded-xl bg-neutral-100 p-1 dark:bg-neutral-800" }, tabs.map((tab) => {
  const isActive = activeTab === tab.id;
  const Icon2 = tab.icon;
  return /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      key: tab.id,
      type: "button",
      onClick: () => onTabClick(tab.id),
      className: B$1(
        "flex shrink-0 cursor-pointer items-center gap-2 rounded-lg px-4 py-2 text-xs font-bold transition-all",
        isActive ? "text-brand-700 dark:text-brand-300 bg-white shadow-sm dark:bg-neutral-700" : "text-neutral-400 hover:text-neutral-600 dark:text-neutral-500 dark:hover:text-neutral-300"
      )
    },
    /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 14 }),
    tab.label,
    typeof tab.chip === "number" && tab.chip > 0 && /* @__PURE__ */ window.wp.element.createElement(
      "span",
      {
        className: B$1(
          "flex h-4 min-w-4 items-center justify-center rounded-full px-1 text-[10px] font-black",
          isActive ? "bg-brand-100 text-brand-700 dark:bg-brand-900/50 dark:text-brand-300" : "bg-neutral-200 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400"
        )
      },
      tab.chip
    )
  );
}));
const CampaignViewInner = ({ campaign }) => {
  const navigate = useNavigate();
  const {
    toggleCampaign,
    isToggling,
    deleteCampaign,
    isDeleting,
    duplicateCampaign,
    isDuplicating
  } = useCampaignMutations();
  const { runNow, isRunningNow } = useJobMutations();
  const { activeRunId, activeCampaignId, dismiss } = useRuns();
  const [isCancelling, setIsCancelling] = window.wp.element.useState(false);
  const isThisCampaignsRun = !!activeRunId && activeCampaignId === campaign.id;
  const activeRunQuery = useCampaignRunQuery(isThisCampaignsRun ? activeRunId : null);
  const activeRunStatus = activeRunQuery.data?.run?.status;
  const TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set([
    "succeeded",
    "succeeded_with_warnings",
    "failed",
    "cancelled"
  ]);
  const hasLiveRun = isThisCampaignsRun && (!activeRunStatus || !TERMINAL_RUN_STATUSES.has(activeRunStatus));
  const channelsVisible = useChannelsVisibility();
  const { data: stockSummary } = useStockSummaryQuery(campaign.id, {
    enabled: campaign.schedule.pregenerationEnabled ?? true
  });
  const tabs = buildTabs(channelsVisible, stockSummary?.ready ?? 0);
  const [activeTab, setActiveTab] = window.wp.element.useState("overview");
  const [confirmAction, setConfirmAction] = window.wp.element.useState(null);
  const handleConfirm = async () => {
    if (!confirmAction) return;
    try {
      if (confirmAction.type === "delete") {
        await deleteCampaign(campaign.id);
        navigate("/campaigns");
      } else if (confirmAction.type === "duplicate") {
        await duplicateCampaign({ id: campaign.id });
      } else if (confirmAction.type === "run_now") {
        await runNow(campaign.id);
      } else if (confirmAction.type === "stop_run") {
        if (!activeRunId) {
          setConfirmAction(null);
          return;
        }
        setIsCancelling(true);
        try {
          await window.wp.apiFetch({
            path: "/structura/v1/scheduler/runs/cancel",
            method: "POST",
            data: {
              run_id: activeRunId,
              cancelled_by: "user",
              cancel_reason: "User cancelled from campaign view"
            }
          });
          dismiss();
        } catch (error) {
          console.error("Failed to cancel run:", error);
        } finally {
          setIsCancelling(false);
        }
      } else {
        await toggleCampaign(campaign.id);
      }
    } catch (error) {
      console.error("Confirm action failed:", error);
    }
    setConfirmAction(null);
  };
  const isConfirmLoading = (() => {
    if (!confirmAction) return false;
    switch (confirmAction.type) {
      case "pause":
      case "resume":
        return isToggling;
      case "duplicate":
        return isDuplicating;
      case "delete":
        return isDeleting;
      case "run_now":
        return isRunningNow;
      case "stop_run":
        return isCancelling;
      default:
        return false;
    }
  })();
  const confirmContent = confirmAction ? getDialogContent(confirmAction.type) : null;
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow", className: "space-y-6 pb-8" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => navigate("/campaigns"),
      className: "mt-1.5 flex h-9 w-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-400 transition-colors hover:border-neutral-300 hover:text-neutral-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500 dark:hover:border-neutral-600 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-xl font-bold tracking-tight text-neutral-900 sm:text-2xl dark:text-white" }, campaign.identity.name), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, campaign.identity.objective.length > 120 ? campaign.identity.objective.slice(0, 120) + "…" : campaign.identity.objective))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: getBadgeIntentByCampaignStatus(campaign.status) }, campaignStatusLabel(campaign.status)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, campaign.status === "active" && /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, hasLiveRun ? /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => setConfirmAction({ type: "stop_run" }),
      className: "border-red-200! text-red-600! hover:border-red-300! hover:bg-red-50! hover:text-red-700! dark:border-red-900/40! dark:text-red-400! dark:hover:border-red-900/60! dark:hover:bg-red-950/40! dark:hover:text-red-300!"
    },
    /* @__PURE__ */ window.wp.element.createElement(Pause, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Stop Run", "structura")
  ) : /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => setConfirmAction({ type: "run_now" })
    },
    /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Run Now", "structura")
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-0.5 h-6 w-px bg-neutral-200 dark:bg-neutral-700" })), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setConfirmAction({ type: "duplicate" }),
      title: window.wp.i18n.__("Duplicate", "structura"),
      className: "flex h-9 w-9 cursor-pointer items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-400 transition-colors hover:border-emerald-200 hover:bg-emerald-50 hover:text-emerald-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500 dark:hover:border-emerald-900/30 dark:hover:bg-emerald-950/20 dark:hover:text-emerald-400"
    },
    /* @__PURE__ */ window.wp.element.createElement(Copy, { size: 15 })
  ), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setConfirmAction({ type: "delete" }),
      title: window.wp.i18n.__("Delete", "structura"),
      className: "flex h-9 w-9 cursor-pointer items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-400 transition-colors hover:border-red-200 hover:bg-red-50 hover:text-red-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500 dark:hover:border-red-900/30 dark:hover:bg-red-950/20 dark:hover:text-red-400"
    },
    /* @__PURE__ */ window.wp.element.createElement(Trash2, { size: 15 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-0.5 h-6 w-px bg-neutral-200 dark:bg-neutral-700" }), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: () => setConfirmAction({
        type: campaign.status === "active" ? "pause" : "resume"
      })
    },
    campaign.status === "active" ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(Pause, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Pause", "structura")) : /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(Play, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Resume", "structura"))
  ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { size: "sm", onClick: () => navigate(`/campaigns/${campaign.id}/edit`) }, /* @__PURE__ */ window.wp.element.createElement(Pencil, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Edit", "structura"))))), /* @__PURE__ */ window.wp.element.createElement(TabBar, { tabs, activeTab, onTabClick: setActiveTab }), activeTab === "overview" && /* @__PURE__ */ window.wp.element.createElement(OverviewTab, { campaign }), activeTab === "posts" && /* @__PURE__ */ window.wp.element.createElement(PostsTab, { campaignId: campaign.id }), activeTab === "stock" && /* @__PURE__ */ window.wp.element.createElement(StockTab, { campaign }), activeTab === "channels" && channelsVisible && /* @__PURE__ */ window.wp.element.createElement(ChannelsTab, { campaignId: campaign.id }), activeTab === "runs" && /* @__PURE__ */ window.wp.element.createElement(CampaignRunsTab, { campaignId: campaign.id }), /* @__PURE__ */ window.wp.element.createElement(
    Dn,
    {
      isOpen: !!confirmAction,
      onClose: () => setConfirmAction(null),
      onConfirm: handleConfirm,
      loading: isConfirmLoading,
      title: confirmContent?.title ?? "",
      description: confirmContent?.description ?? "",
      variant: confirmContent?.variant ?? "primary",
      confirmButtonProps: {
        label: confirmContent?.confirmLabel ?? window.wp.i18n.__("Confirm", "structura")
      }
    }
  ));
};
const getDialogContent = (type) => {
  switch (type) {
    case "delete":
      return {
        title: window.wp.i18n.__("Delete Campaign?", "structura"),
        description: window.wp.i18n.__(
          "This action cannot be undone. All scheduled jobs will be cancelled.",
          "structura"
        ),
        variant: "danger",
        confirmLabel: window.wp.i18n.__("Delete", "structura")
      };
    case "pause":
      return {
        title: window.wp.i18n.__("Pause Campaign?", "structura"),
        description: window.wp.i18n.__(
          "Pausing will temporarily halt all scheduled executions. You can resume at any time.",
          "structura"
        ),
        variant: "primary",
        confirmLabel: window.wp.i18n.__("Pause", "structura")
      };
    case "resume":
      return {
        title: window.wp.i18n.__("Resume Campaign?", "structura"),
        description: window.wp.i18n.__(
          "Resuming will reactivate the campaign and scheduled executions will continue.",
          "structura"
        ),
        variant: "primary",
        confirmLabel: window.wp.i18n.__("Resume", "structura")
      };
    case "run_now":
      return {
        title: window.wp.i18n.__("Run Now?", "structura"),
        description: window.wp.i18n.__(
          "This will generate an extra post from this campaign right away, outside of the regular schedule.",
          "structura"
        ),
        variant: "primary",
        confirmLabel: window.wp.i18n.__("Run Now", "structura")
      };
    case "stop_run":
      return {
        title: window.wp.i18n.__("Stop this run?", "structura"),
        description: window.wp.i18n.__(
          "The current generation will be cancelled. Any work in progress will be discarded.",
          "structura"
        ),
        variant: "danger",
        confirmLabel: window.wp.i18n.__("Stop Run", "structura")
      };
    case "duplicate":
      return {
        title: window.wp.i18n.__("Duplicate Campaign?", "structura"),
        description: window.wp.i18n.__("A copy of this campaign will be created in a paused state.", "structura"),
        variant: "primary",
        confirmLabel: window.wp.i18n.__("Duplicate", "structura")
      };
  }
};
const OverviewTab = ({ campaign }) => {
  const navigate = useNavigate();
  const { identity: identity2, intelligence, schedule, stats, keywords, authority } = campaign;
  const isQuota = schedule.endCondition.type === "quota";
  const isDate = schedule.endCondition.type === "date";
  const keywordCount = keywords?.bank?.length ?? 0;
  const domainCount = authority?.domains?.length ?? 0;
  const progress = isQuota ? Math.min(
    Math.round(stats.postsPublished / schedule.endCondition.value * 100),
    100
  ) : 0;
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement(CampaignRunProgress, { campaignId: campaign.id, variant: "page", expandable: true }), isDate && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-4 rounded-2xl border border-neutral-200/60 bg-white px-5 py-4 shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-neutral-100 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(Calendar, { size: 20, className: "text-neutral-400 dark:text-neutral-500" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[10px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Ends On", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-sm font-semibold text-neutral-700 dark:text-neutral-300" }, dayjs(schedule.endCondition.value).format("LL")))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4" }, /* @__PURE__ */ window.wp.element.createElement(
    StatCard,
    {
      label: window.wp.i18n.__("Posts Published", "structura"),
      value: stats.postsPublished.toString(),
      icon: /* @__PURE__ */ window.wp.element.createElement(FileText, { size: 16 }),
      accent: "brand",
      detail: (stats.postsCreated ?? stats.postsPublished) > stats.postsPublished ? window.wp.i18n.sprintf(
        window.wp.i18n.__("%s created", "structura"),
        (stats.postsCreated ?? stats.postsPublished).toString()
      ) : void 0
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    StatCard,
    {
      label: window.wp.i18n.__("Next Run", "structura"),
      value: stats.nextRun || "—",
      icon: /* @__PURE__ */ window.wp.element.createElement(Clock, { size: 16 }),
      accent: "amber",
      small: true
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    StatCard,
    {
      label: window.wp.i18n.__("Keywords", "structura"),
      value: keywordCount.toString(),
      icon: /* @__PURE__ */ window.wp.element.createElement(Key, { size: 16 }),
      accent: "emerald",
      detail: domainCount > 0 ? window.wp.i18n.sprintf(window.wp.i18n.__("+ %s authority domains", "structura"), domainCount.toString()) : void 0
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    StatCard,
    {
      label: window.wp.i18n.__("Schedule", "structura"),
      value: cronToHuman(schedule.cron),
      icon: /* @__PURE__ */ window.wp.element.createElement(Activity, { size: 16 }),
      accent: "violet",
      small: true
    }
  )), isQuota && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-200/60 bg-white p-5 shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between text-[10px] font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, /* @__PURE__ */ window.wp.element.createElement("span", null, window.wp.i18n.__("Output Progress", "structura")), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-neutral-900 dark:text-white" }, stats.postsPublished, " / ", schedule.endCondition.value)), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 h-2 w-full overflow-hidden rounded-full bg-neutral-100 dark:bg-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: "bg-brand-600 dark:bg-brand-500 h-full transition-all duration-500 ease-out",
      style: { width: `${progress}%` }
    }
  ))), /* @__PURE__ */ window.wp.element.createElement(NeedsApprovalWidget, { campaignId: campaign.id }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-200/60 bg-white p-5 shadow-sm sm:p-6 dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mt-0! mb-4! text-xs font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Campaign Configuration", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-x-8 gap-y-3 sm:grid-cols-2" }, campaign.createdAt && /* @__PURE__ */ window.wp.element.createElement(
    InfoRow,
    {
      label: window.wp.i18n.__("Created", "structura"),
      value: dayjs(campaign.createdAt).format("LL")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(InfoRow, { label: window.wp.i18n.__("Mode", "structura"), value: formatMode(identity2.campaignMode) }), /* @__PURE__ */ window.wp.element.createElement(
    InfoRow,
    {
      label: window.wp.i18n.__("AI Providers", "structura"),
      value: /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-1.5" }, /* @__PURE__ */ window.wp.element.createElement(
        ProviderLine,
        {
          providerId: intelligence.textProvider,
          model: intelligence.textModel,
          kind: "text"
        }
      ), /* @__PURE__ */ window.wp.element.createElement(
        ProviderLine,
        {
          providerId: intelligence.imageProvider,
          model: intelligence.imageModel,
          kind: "image"
        }
      ))
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    InfoRow,
    {
      label: window.wp.i18n.__("Language", "structura"),
      value: intelligence.language === "default" ? window.wp.i18n.__("System Default", "structura") : intelligence.language
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    InfoRow,
    {
      label: window.wp.i18n.__("Post Length", "structura"),
      value: window.wp.i18n.sprintf(window.wp.i18n.__("%s words", "structura"), intelligence.postLength.toString())
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    InfoRow,
    {
      label: window.wp.i18n.__("Post Status", "structura"),
      value: formatPostStatus(campaign.structure.postStatus)
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    InfoRow,
    {
      label: window.wp.i18n.__("Featured Image", "structura"),
      value: campaign.structure.featuredImage ? window.wp.i18n.__("Enabled", "structura") : window.wp.i18n.__("Disabled", "structura")
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    InfoRow,
    {
      label: window.wp.i18n.__("AI Disclosure", "structura"),
      value: campaign.structure.disclosure.enabled ? window.wp.i18n.__("Enabled", "structura") : window.wp.i18n.__("Disabled", "structura")
    }
  ))), /* @__PURE__ */ window.wp.element.createElement(RecentPostsWidget, { campaignId: campaign.id, onViewAll: () => navigate(`#posts`) }));
};
const ACCENT_MAP = {
  brand: {
    bg: "bg-brand-50 dark:bg-brand-950/30",
    icon: "text-brand-500 dark:text-brand-400"
  },
  amber: {
    bg: "bg-amber-50 dark:bg-amber-950/30",
    icon: "text-amber-500 dark:text-amber-400"
  },
  emerald: {
    bg: "bg-emerald-50 dark:bg-emerald-950/30",
    icon: "text-emerald-500 dark:text-emerald-400"
  },
  violet: {
    bg: "bg-violet-50 dark:bg-violet-950/30",
    icon: "text-violet-500 dark:text-violet-400"
  }
};
const StatCard = ({
  label,
  value,
  icon,
  accent,
  small,
  detail
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-200/60 bg-white p-4 shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-2 flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(
  "div",
  {
    className: B$1("flex h-7 w-7 items-center justify-center rounded-lg", ACCENT_MAP[accent].bg)
  },
  /* @__PURE__ */ window.wp.element.createElement("span", { className: ACCENT_MAP[accent].icon }, icon)
), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-bold tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, label)), /* @__PURE__ */ window.wp.element.createElement(
  "p",
  {
    className: B$1(
      "m-0! font-black tracking-tight text-neutral-900 dark:text-white",
      small ? "text-sm leading-snug" : "text-2xl"
    )
  },
  value
), detail && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-[11px] text-neutral-400 dark:text-neutral-500" }, detail));
const InfoRow = ({ label, value }) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-4 border-b border-neutral-50 py-2.5 last:border-0 dark:border-neutral-800/50" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-bold text-neutral-400 dark:text-neutral-500" }, label), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-right text-xs font-semibold text-neutral-700 dark:text-neutral-300" }, value));
const ProviderLine = ({
  providerId,
  model,
  kind
}) => {
  const { data: models } = useAvailableModelsQuery();
  const modelLabel = model ? [...models?.text ?? [], ...models?.image ?? []].find((m3) => m3.id === model)?.name ?? model : void 0;
  if (!providerId) {
    return /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center justify-end gap-1.5 text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-bold uppercase" }, kind), window.wp.i18n.__("Not set", "structura"));
  }
  const v2 = getProviderVisual(providerId);
  const Icon2 = v2.icon;
  return /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center justify-end gap-1.5" }, /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 13, className: v2.color }), modelLabel && /* @__PURE__ */ window.wp.element.createElement("span", null, modelLabel), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[9px] font-bold text-neutral-300 uppercase dark:text-neutral-600" }, kind));
};
const NeedsApprovalWidget = ({ campaignId }) => {
  const { data, isLoading } = useCampaignPostsQuery(campaignId, 1, 50);
  const drafts = (data?.data ?? []).filter((p2) => p2.status === "draft" || p2.status === "pending");
  if (isLoading) return null;
  if (drafts.length === 0) return null;
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-amber-200/60 p-0! dark:border-amber-900/30" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-amber-100 bg-amber-50/50 px-5 py-3 sm:px-6 dark:border-amber-900/30 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(CircleAlert, { size: 14, className: "text-amber-500 dark:text-amber-400" }), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "text-xs font-black tracking-widest text-amber-600 uppercase dark:text-amber-400" }, window.wp.i18n.__("Needs Approval", "structura"))), /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "warning" }, drafts.length.toString())), /* @__PURE__ */ window.wp.element.createElement("div", { className: "divide-y divide-amber-100/50 dark:divide-amber-900/20" }, drafts.slice(0, 5).map((post) => /* @__PURE__ */ window.wp.element.createElement(PostRow, { key: post.id, post, compact: true })), drafts.length > 5 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "px-5 py-2.5 text-center text-[11px] font-semibold text-amber-600 sm:px-6 dark:text-amber-400" }, window.wp.i18n.sprintf(
    window.wp.i18n.__("+ %s more drafts awaiting review", "structura"),
    (drafts.length - 5).toString()
  ))));
};
const RecentPostsWidget = ({
  campaignId,
  onViewAll
}) => {
  const { data, isLoading } = useCampaignPostsQuery(campaignId, 1, 5);
  const posts = data?.data ?? [];
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-neutral-200/60 p-0!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-neutral-100 px-5 py-3 sm:px-6 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "text-xs font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, window.wp.i18n.__("Recent Posts", "structura")), posts.length > 0 && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "transparent",
      size: "sm",
      onClick: onViewAll,
      className: "text-brand-600 dark:text-brand-400"
    },
    window.wp.i18n.__("View all", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ChevronRight, { size: 14, className: "ml-1" })
  )), isLoading ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-center py-12" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 20, className: "animate-spin text-neutral-300 dark:text-neutral-600" })) : posts.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "py-12 text-center" }, /* @__PURE__ */ window.wp.element.createElement(FileText, { size: 28, className: "mx-auto mb-2 text-neutral-200 dark:text-neutral-700" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-xs text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("No posts generated yet.", "structura"))) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "divide-y divide-neutral-100 dark:divide-neutral-800" }, posts.map((post) => /* @__PURE__ */ window.wp.element.createElement(PostRow, { key: post.id, post, compact: true }))));
};
const POST_STATUS_INTENT = {
  publish: "success",
  future: "info",
  draft: "warning",
  pending: "warning"
};
const PostRow = ({ post, compact }) => /* @__PURE__ */ window.wp.element.createElement(
  "div",
  {
    className: B$1(
      "group flex items-center gap-4 transition-colors hover:bg-neutral-50/50 dark:hover:bg-neutral-800/30",
      compact ? "px-5 py-3 sm:px-6" : "px-6 py-3.5"
    )
  },
  post.thumbnail ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "size-10 shrink-0 overflow-hidden rounded-lg border border-neutral-200 shadow-sm dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement("img", { src: post.thumbnail, alt: "", className: "h-full w-full object-cover" })) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex size-10 shrink-0 items-center justify-center rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement(FileText, { size: 16, className: "text-neutral-300 dark:text-neutral-600" })),
  /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! truncate text-sm font-semibold text-neutral-800 dark:text-neutral-200" }, post.title || window.wp.i18n.__("Untitled", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-[11px] text-neutral-400 dark:text-neutral-500" }, post.date, !compact && post.author && /* @__PURE__ */ window.wp.element.createElement("span", null, " · ", post.author))),
  /* @__PURE__ */ window.wp.element.createElement(
    Me,
    {
      variant: "solid",
      intent: POST_STATUS_INTENT[post.status] ?? "default",
      className: "shrink-0"
    },
    postStatusLabel(post.status)
  ),
  /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex shrink-0 items-center gap-1" }, post.status === "publish" && post.permalink && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: post.permalink,
      target: "_blank",
      rel: "noreferrer",
      title: window.wp.i18n.__("View post", "structura"),
      className: "hover:bg-brand-50 hover:text-brand-600 dark:hover:bg-brand-950/20 dark:hover:text-brand-400 flex h-8 w-8 items-center justify-center rounded-lg text-neutral-300 transition-colors dark:text-neutral-600"
    },
    /* @__PURE__ */ window.wp.element.createElement(Globe, { size: 14 })
  ), (post.status === "draft" || post.status === "pending") && post.edit_link && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: post.edit_link,
      target: "_blank",
      rel: "noreferrer",
      title: window.wp.i18n.__("Review post", "structura"),
      className: "flex h-8 w-8 items-center justify-center rounded-lg text-neutral-300 transition-colors hover:bg-amber-50 hover:text-amber-600 dark:text-neutral-600 dark:hover:bg-amber-950/20 dark:hover:text-amber-400"
    },
    /* @__PURE__ */ window.wp.element.createElement(Eye, { size: 14 })
  ), post.edit_link && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: post.edit_link,
      target: "_blank",
      rel: "noreferrer",
      title: window.wp.i18n.__("Edit in WordPress", "structura"),
      className: "flex h-8 w-8 items-center justify-center rounded-lg text-neutral-300 transition-colors hover:bg-neutral-100 hover:text-neutral-600 dark:text-neutral-600 dark:hover:bg-neutral-800 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(Pencil, { size: 13 })
  ))
);
const PostsTab = ({ campaignId }) => {
  const [page, setPage] = window.wp.element.useState(1);
  const { data, isLoading, isFetching, refetch } = useCampaignPostsQuery(campaignId, page, 15);
  const posts = data?.data ?? [];
  const pagination = data?.pagination;
  const isRefreshing = isFetching && !isLoading;
  return /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "overflow-hidden border-neutral-200/60 p-0!" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-b border-neutral-100 bg-neutral-50/50 px-5 py-3 sm:px-6 dark:border-neutral-800 dark:bg-neutral-950/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, pagination ? window.wp.i18n.sprintf(window.wp.i18n.__("%s posts", "structura"), pagination.total_items.toString()) : window.wp.i18n.__("Posts", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", onClick: () => refetch(), disabled: isFetching }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 13, className: isRefreshing ? "animate-spin" : "" }))), isLoading ? /* @__PURE__ */ window.wp.element.createElement(Fn, { label: window.wp.i18n.__("Loading posts…", "structura"), size: "lg", padding: "lg" }) : posts.length === 0 ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "py-16 text-center" }, /* @__PURE__ */ window.wp.element.createElement(FileText, { size: 32, className: "mx-auto mb-3 text-neutral-200 dark:text-neutral-700" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__("No posts generated yet.", "structura"))) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "divide-y divide-neutral-100 dark:divide-neutral-800" }, posts.map((post) => /* @__PURE__ */ window.wp.element.createElement(PostRow, { key: post.id, post }))), pagination && pagination.total_pages > 1 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between border-t border-neutral-100 bg-neutral-50/50 px-5 py-3 sm:px-6 dark:border-neutral-800 dark:bg-neutral-950/30" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium text-neutral-500" }, window.wp.i18n.__("Page", "structura"), " ", pagination.current_page, " ", window.wp.i18n.__("of", "structura"), " ", pagination.total_pages), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex gap-1" }, /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      disabled: page <= 1,
      onClick: () => setPage((p2) => p2 - 1)
    },
    /* @__PURE__ */ window.wp.element.createElement(ChevronLeft, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      disabled: page >= pagination.total_pages,
      onClick: () => setPage((p2) => p2 + 1)
    },
    /* @__PURE__ */ window.wp.element.createElement(ChevronRight, { size: 16 })
  ))));
};
const formatMode = (mode) => {
  switch (mode) {
    case "traffic_magnet":
      return window.wp.i18n.__("Traffic Magnet", "structura");
    case "quick_wins":
      return window.wp.i18n.__("Quick Wins", "structura");
    case "conversion":
      return window.wp.i18n.__("Conversion", "structura");
    case "authority":
      return window.wp.i18n.__("Authority", "structura");
    default:
      return window.wp.i18n.__("Default", "structura");
  }
};
const formatPostStatus = (status) => {
  switch (status) {
    case "publish":
      return window.wp.i18n.__("Publish immediately", "structura");
    case "draft":
    // "pending" was removed 2026-07-09; legacy values read as a draft.
    case "pending":
      return window.wp.i18n.__("Save as draft", "structura");
    default:
      return window.wp.i18n.__("Publish immediately", "structura");
  }
};
const useSingleGenQuota = () => {
  const { hasWorkspace } = useLicense();
  return useQuery({
    queryKey: ["singleGenQuota"],
    enabled: hasWorkspace === true,
    // Refreshed after each generation attempt anyway via refetch-on-mount
    // when the user navigates back; a short staleTime keeps the count
    // honest without polling.
    staleTime: 6e4,
    queryFn: () => window.wp.apiFetch({ path: "/structura/v1/generate/quota" })
  });
};
const researchRejectTypeMessage = (fileName) => window.wp.i18n.sprintf(
  /* translators: %s: file name */
  window.wp.i18n.__("%s isn't a supported format — use PDF, DOCX, TXT, MD or HTML.", "structura"),
  fileName
);
const researchRejectSizeMessage = (fileName, size2) => window.wp.i18n.sprintf(
  /* translators: 1: file name, 2: formatted file size (e.g. "14.8 MB") */
  window.wp.i18n.__("%1$s is %2$s — files can be up to 10 MB.", "structura"),
  fileName,
  size2
);
const messageForKey = (key, file) => {
  switch (key) {
    case "attachments.unsupportedType":
      return researchRejectTypeMessage(file.name);
    case "attachments.tooLarge":
      return researchRejectSizeMessage(file.name, ue(file.size));
    case "attachments.unreadable":
      return window.wp.i18n.__(
        "We couldn't read this file — it may be corrupt or image-only.",
        "structura"
      );
    case "attachments.planRequired":
      return window.wp.i18n.__(
        "Research material needs a paid plan — upgrade to attach files.",
        "structura"
      );
    default:
      return null;
  }
};
const GENERIC_FAILURE = () => window.wp.i18n.__("The upload failed — please try again.", "structura");
async function uploadResearchDoc(file) {
  const form = new FormData();
  form.append("file", file, file.name);
  let response;
  try {
    response = await window.wp.apiFetch({
      path: "/structura/v1/research-docs",
      method: "POST",
      body: form
    });
  } catch (err) {
    const rejected = err ?? {};
    const key = typeof rejected.data?.message_key === "string" ? rejected.data.message_key : "";
    const mapped = key ? messageForKey(key, file) : null;
    const serverMessage = typeof rejected.message === "string" ? rejected.message : "";
    throw new Error(mapped ?? (serverMessage || GENERIC_FAILURE()));
  }
  const attachment = response?.attachment;
  const attachmentId = typeof attachment?.attachmentId === "string" ? attachment.attachmentId : "";
  if (!attachmentId) {
    throw new Error(GENERIC_FAILURE());
  }
  return {
    attachmentId,
    name: typeof attachment?.name === "string" && attachment.name ? attachment.name : file.name,
    ext: typeof attachment?.ext === "string" ? attachment.ext : "",
    sizeBytes: typeof attachment?.sizeBytes === "number" ? attachment.sizeBytes : file.size,
    charCount: typeof attachment?.charCount === "number" ? attachment.charCount : 0,
    truncated: attachment?.truncated === true,
    extractedUnit: attachment?.extractedUnit === "pages" ? "pages" : "words",
    extractedUsed: typeof attachment?.extractedUsed === "number" ? attachment.extractedUsed : 0,
    extractedTotal: typeof attachment?.extractedTotal === "number" ? attachment.extractedTotal : 0
  };
}
function compactVolume(n2) {
  if (n2 >= 1e3) return (n2 / 1e3).toFixed(n2 >= 1e4 ? 0 : 1).replace(/\.0$/, "") + "K";
  return n2.toLocaleString();
}
const SeoTargetingSection = ({
  formData,
  onChange,
  isPaidLicense,
  isLicensed,
  plan
}) => {
  const {
    discoverKeywordsDetached,
    isDiscoveringKeywords,
    discoverAuthorityDetached,
    isDiscoveringDetached
  } = useCampaignMutations();
  const [phase, setPhase] = window.wp.element.useState("idle");
  const [candidates, setCandidates] = window.wp.element.useState([]);
  const [dataPath, setDataPath] = window.wp.element.useState(null);
  const [ownInput, setOwnInput] = window.wp.element.useState("");
  const [authoritySuggested, setAuthoritySuggested] = window.wp.element.useState([]);
  const objective = formData.identity.objective.trim();
  const selected = formData.identity.focusKeyphrase ?? "";
  const authorityDomains = formData.authority?.domains ?? [];
  const setFocus = (kp) => onChange({ identity: { ...formData.identity, focusKeyphrase: kp } });
  if (!isPaidLicense) {
    const domain = typeof window !== "undefined" ? window.location.hostname : void 0;
    const portalUrl = buildPortalSignupUrl({
      intent: "unlock_keyword_bank",
      domain,
      plan,
      returnTo: buildWizardResumeUrl("keywords")
    });
    return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center py-10 text-center" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "from-brand-50 dark:from-brand-950/30 mb-5 flex h-16 w-16 items-center justify-center rounded-full bg-gradient-to-br to-purple-50 dark:to-purple-950/30" }, /* @__PURE__ */ window.wp.element.createElement(Key, { size: 28, className: "text-brand-400" })), /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mb-2 text-base font-semibold text-neutral-800 dark:text-white" }, window.wp.i18n.__("SEO Targeting", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mx-auto mb-4 max-w-md text-sm text-neutral-500" }, window.wp.i18n.__(
      "Ground this post in a real focus keyphrase with live search volume and vetted authority sources — using real Google search data.",
      "structura"
    )), /* @__PURE__ */ window.wp.element.createElement("span", { className: "from-brand-500 inline-flex items-center gap-1.5 rounded-full bg-gradient-to-r to-purple-500 px-4 py-1.5 text-xs font-bold text-white" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 12 }), window.wp.i18n.__("Pro / Cloud Feature", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-8" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true }, /* @__PURE__ */ window.wp.element.createElement("a", { href: portalUrl, target: "_blank", rel: "noopener noreferrer" }, isLicensed ? window.wp.i18n.__("Unlock with Pro", "structura") : window.wp.i18n.__("Create account", "structura"), /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 14, className: "ml-1.5" })))));
  }
  const runSuggest = () => {
    if (!objective) return;
    setPhase("loading");
    discoverKeywordsDetached({
      keyphrase: objective,
      language: formData.intelligence.language || "default",
      provider: formData.intelligence.textProvider
    }).then((res) => {
      const metrics = res?.metrics ?? {};
      const next = (res?.keywords ?? []).map((k2) => ({
        keyword: k2.keyword,
        volumeNumber: metrics[k2.keyword]?.volumeNumber
      }));
      setCandidates(next);
      setDataPath(res?.meta?.path ?? null);
      setPhase(next.length > 0 ? "results" : "empty");
    }).catch(() => setPhase("error"));
  };
  const useOwn = () => {
    const v2 = ownInput.trim();
    if (!v2) return;
    setFocus(v2);
    setOwnInput("");
  };
  const runAuthorityDiscovery = () => {
    discoverAuthorityDetached({
      keyphrase: objective || selected,
      language: formData.intelligence.language || "default",
      provider: formData.intelligence.textProvider
    }).then((res) => {
      const found = (res?.domains ?? []).map((d2) => d2.domain);
      const existing = new Set(authorityDomains.map((d2) => d2.domain));
      setAuthoritySuggested(found.filter((d2) => !existing.has(d2)));
    }).catch(() => setAuthoritySuggested([]));
  };
  const setAuthority = (domains) => onChange({
    authority: {
      domains: domains.map(
        (domain) => authorityDomains0(formData)[domain] ?? {
          domain,
          description: domain,
          tier: "niche",
          citedBy: 0,
          category: "",
          sampleUrls: []
        }
      ),
      discoveredAt: (/* @__PURE__ */ new Date()).toISOString()
    }
  });
  const serpPreview = candidates.filter((c2) => c2.keyword !== selected).slice(0, 5);
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-6" }, /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("label", { className: "mb-2 block text-xs font-bold text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Focus keyphrase", "structura")), selected && /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-brand-500 bg-brand-50 dark:border-brand-500/60 dark:bg-brand-500/10 mb-3 flex items-center gap-3 rounded-xl border-[1.5px] p-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "bg-brand-600 grid h-8 w-8 flex-none place-items-center rounded-lg text-white" }, /* @__PURE__ */ window.wp.element.createElement(Target, { size: 16 })), /* @__PURE__ */ window.wp.element.createElement("span", { className: "min-w-0 flex-1 truncate text-sm font-bold text-neutral-900 dark:text-white" }, selected), /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => setFocus(""),
      "aria-label": window.wp.i18n.__("Clear keyphrase", "structura"),
      className: "grid h-6 w-6 flex-none place-items-center rounded-full text-neutral-400 hover:text-neutral-700"
    },
    /* @__PURE__ */ window.wp.element.createElement(X, { size: 15 })
  )), phase === "idle" && !selected && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center gap-3 rounded-xl border border-dashed border-neutral-200 px-5 py-7 text-center dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "max-w-sm text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Pick one focus keyphrase and every heading, section, and meta field is optimized around it. Suggest pulls ranked candidates with real monthly search volume.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: runSuggest, disabled: !objective }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Suggest keyphrases", "structura")), !objective && /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-[11px] text-neutral-400" }, window.wp.i18n.__("Describe the post topic above first.", "structura"))), phase === "loading" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-col items-center justify-center gap-3 py-8" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 24, className: "text-brand-500 animate-spin" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "text-sm text-neutral-500" }, window.wp.i18n.__("Finding your best keyphrase…", "structura"))), phase === "results" && /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-3 flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "flex items-center gap-2 text-xs font-semibold text-neutral-600 dark:text-neutral-300" }, window.wp.i18n.__("Pick one — it becomes your focus keyphrase.", "structura"), dataPath === "provider" ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "success" }, window.wp.i18n.__("Live data", "structura")) : dataPath === "legacy" ? /* @__PURE__ */ window.wp.element.createElement(Me, { intent: "warning" }, window.wp.i18n.__("AI estimate", "structura")) : null), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", onClick: runSuggest, loading: isDiscoveringKeywords }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Re-suggest", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex flex-wrap gap-2" }, candidates.map((c2) => {
    const on2 = c2.keyword === selected;
    return /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        key: c2.keyword,
        type: "button",
        onClick: () => setFocus(c2.keyword),
        className: B$1(
          "inline-flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs font-medium transition-colors",
          on2 ? "border-brand-500 bg-brand-50 text-brand-900 dark:border-brand-500/60 dark:bg-brand-500/10 dark:text-brand-100" : "border-neutral-200 text-neutral-700 hover:border-brand-300 dark:border-neutral-700 dark:text-neutral-300"
        )
      },
      on2 && /* @__PURE__ */ window.wp.element.createElement(Check, { size: 12, className: "text-brand-500 shrink-0" }),
      /* @__PURE__ */ window.wp.element.createElement("span", null, c2.keyword),
      typeof c2.volumeNumber === "number" && /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: B$1(
            "rounded px-1 py-0.5 font-mono text-[9px] font-bold",
            on2 ? "bg-brand-100 text-brand-700 dark:bg-brand-500/20 dark:text-brand-300" : "bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"
          )
        },
        compactVolume(c2.volumeNumber),
        "/mo"
      )
    );
  })), /* @__PURE__ */ window.wp.element.createElement(OwnKeyphrase, { value: ownInput, onChange: setOwnInput, onUse: useOwn }), serpPreview.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-5 rounded-xl border border-neutral-200 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "border-b border-neutral-200 px-4 py-2 text-[10px] font-black tracking-[0.14em] text-neutral-400 uppercase dark:border-neutral-800" }, window.wp.i18n.__("What searchers also ask", "structura")), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0 list-none p-0" }, serpPreview.map((c2) => /* @__PURE__ */ window.wp.element.createElement(
    "li",
    {
      key: c2.keyword,
      className: "border-b border-neutral-100 px-4 py-2 text-xs text-neutral-600 last:border-b-0 dark:border-neutral-800/70 dark:text-neutral-300"
    },
    c2.keyword
  ))))), phase === "empty" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-dashed border-neutral-200 px-5 py-6 text-center dark:border-neutral-700" }, /* @__PURE__ */ window.wp.element.createElement(SearchX, { size: 22, className: "mx-auto mb-2 text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mb-3 text-xs text-neutral-500" }, window.wp.i18n.__("No live search data for that topic. Enter your own focus keyphrase.", "structura")), /* @__PURE__ */ window.wp.element.createElement(OwnKeyphrase, { value: ownInput, onChange: setOwnInput, onUse: useOwn })), phase === "error" && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl border border-red-200 px-5 py-6 text-center dark:border-red-900/40" }, /* @__PURE__ */ window.wp.element.createElement(CloudOff, { size: 22, className: "mx-auto mb-2 text-red-400" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mb-3 text-xs text-neutral-500" }, window.wp.i18n.__(
    "Couldn't reach the keyword service. The post can still generate — enter a keyphrase manually or retry.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", size: "sm", onClick: runSuggest }, /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }), window.wp.i18n.__("Retry", "structura")), /* @__PURE__ */ window.wp.element.createElement(OwnKeyphrase, { value: ownInput, onChange: setOwnInput, onUse: useOwn }))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-t border-neutral-200/70 pt-5 dark:border-neutral-800" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "mb-1 flex items-center gap-1.5 text-xs font-bold text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Earth, { size: 13 }), window.wp.i18n.__("Authority sources", "structura"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-normal text-neutral-400" }, window.wp.i18n.__("· optional", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mb-3 text-[11px] leading-snug text-neutral-400" }, window.wp.i18n.__(
    "Reputable domains the post can cite as outbound links for E-E-A-T. Discover them automatically or add your own — leave empty to let the writer choose.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement(
    Bn,
    {
      kind: "domain",
      added: authorityDomains.map((d2) => ({ value: d2.domain, label: d2.domain })),
      suggested: authoritySuggested.map((d2) => ({ value: d2, label: d2 })),
      onAdd: (value) => {
        setAuthority([...authorityDomains.map((d2) => d2.domain), value]);
        setAuthoritySuggested((prev) => prev.filter((d2) => d2 !== value));
      },
      onRemove: (value) => setAuthority(authorityDomains.map((d2) => d2.domain).filter((d2) => d2 !== value)),
      onAddManual: (raw) => {
        const v2 = raw.trim().replace(/^https?:\/\//, "").replace(/\/.*$/, "");
        if (!v2) return false;
        setAuthority([...authorityDomains.map((d2) => d2.domain), v2]);
        return true;
      },
      onDiscover: runAuthorityDiscovery,
      discovering: isDiscoveringDetached,
      discoverLabel: window.wp.i18n.__("Discover authority sources", "structura"),
      suggestedLabel: window.wp.i18n.__("Suggested — tap to add", "structura"),
      emptyText: window.wp.i18n.__("No authority sources yet.", "structura"),
      inputPlaceholder: window.wp.i18n.__("Add a domain (e.g. developer.mozilla.org)", "structura"),
      ariaLabel: window.wp.i18n.__("Authority sources", "structura")
    }
  )));
};
function authorityDomains0(formData) {
  const out = {};
  for (const d2 of formData.authority?.domains ?? []) out[d2.domain] = d2;
  return out;
}
const OwnKeyphrase = ({
  value,
  onChange,
  onUse
}) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3" }, /* @__PURE__ */ window.wp.element.createElement(
  he,
  {
    label: window.wp.i18n.__("…or type your own keyphrase", "structura"),
    hiddenLabel: true,
    size: "sm",
    value,
    placeholder: window.wp.i18n.__("…or type your own keyphrase", "structura"),
    onChange: (e2) => onChange(e2.target.value),
    onKeyDown: (e2) => {
      if (e2.key === "Enter") {
        e2.preventDefault();
        onUse();
      }
    },
    rightAdornment: /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "transparent", size: "sm", onClick: onUse, disabled: !value.trim() }, window.wp.i18n.__("Use", "structura"))
  }
));
const MagicSuggestButton = ({
  isLoading,
  onTrigger,
  ctaLabel,
  subLabel,
  className
}) => {
  const { defaultTextProvider } = useDefaultProviders();
  const { isPaidLicense } = useLicense();
  const [providerOverride, setProviderOverride] = window.wp.element.useState(null);
  const activeProvider = providerOverride ?? defaultTextProvider;
  if (!isPaidLicense) {
    return /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: B$1(
          "flex items-center justify-between rounded-xl border border-dashed border-neutral-200 bg-neutral-50/50 px-4 py-3 dark:border-neutral-800 dark:bg-neutral-900/40",
          className
        )
      },
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Magic suggestions are available on Pro and above.", "structura")),
      /* @__PURE__ */ window.wp.element.createElement("span", { className: "bg-brand-100 text-brand-600 dark:bg-brand-950/30 dark:text-brand-400 rounded-md px-1.5 py-0.5 text-[8px] font-black tracking-wider uppercase" }, window.wp.i18n.__("Pro", "structura"))
    );
  }
  return /* @__PURE__ */ window.wp.element.createElement(
    "div",
    {
      className: B$1(
        "rounded-xl border border-neutral-100 bg-neutral-50/50 p-3 dark:border-neutral-800 dark:bg-neutral-800/20",
        className
      )
    },
    !isLoading ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between gap-3" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement(
      tr$1,
      {
        size: "sm",
        onClick: () => onTrigger(activeProvider),
        disabled: isLoading,
        className: "from-brand-600 shadow-brand-600/15 bg-gradient-to-r to-purple-600 font-bold shadow-sm"
      },
      /* @__PURE__ */ window.wp.element.createElement(WandSparkles, { size: 14, className: "mr-1.5" }),
      ctaLabel
    ), subLabel && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1.5! mb-0! text-[10px] text-neutral-400 dark:text-neutral-500" }, subLabel)), /* @__PURE__ */ window.wp.element.createElement(ProviderPill, { provider: activeProvider, onProviderChange: setProviderOverride })) : /* @__PURE__ */ window.wp.element.createElement(MagicSuggestProgress, { isLoading, variant: "panel" })
  );
};
const POST_STATUS_OPTIONS = [
  { value: "publish", label: window.wp.i18n.__("Publish immediately", "structura") },
  { value: "draft", label: window.wp.i18n.__("Save as draft", "structura") }
  // "Pending review" was removed 2026-07-09 — WP treated it as a draft.
];
const MODES = ["traffic_magnet", "quick_wins", "conversion", "authority"];
const MODE_DESCRIPTIONS = {
  traffic_magnet: window.wp.i18n.__("Maximize organic traffic with high-volume topics", "structura"),
  quick_wins: window.wp.i18n.__("Target low-competition keywords for fast rankings", "structura"),
  conversion: window.wp.i18n.__("Content designed to convert readers to customers", "structura"),
  authority: window.wp.i18n.__("Build topical authority with comprehensive coverage", "structura")
};
const Section = ({
  title,
  children,
  className
}) => /* @__PURE__ */ window.wp.element.createElement(
  "div",
  {
    className: B$1(
      "space-y-4 rounded-2xl border border-neutral-200/60 bg-white p-5 shadow-sm sm:p-6 dark:border-neutral-800 dark:bg-neutral-900",
      className
    )
  },
  /* @__PURE__ */ window.wp.element.createElement("h3", { className: "mt-0! mb-2! text-xs font-black tracking-widest text-neutral-400 uppercase dark:text-neutral-500" }, title),
  children
);
const LockedFeature = ({ label, tier = "Pro" }) => /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between rounded-lg bg-neutral-50 px-3 py-2 dark:bg-neutral-800/50" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Lock, { size: 12, className: "text-neutral-300 dark:text-neutral-600" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs text-neutral-400 dark:text-neutral-500" }, label)), /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "outline", intent: "premium", className: "text-[9px]" }, tier));
const RESEARCH_ATTACHMENTS_LABELS = {
  title: window.wp.i18n.__("Research material", "structura"),
  optionalTag: window.wp.i18n.__("Optional", "structura"),
  valueLine: window.wp.i18n.__(
    "Attach research, briefs or notes — the post will draw on them.",
    "structura"
  ),
  dropCtaBold: window.wp.i18n.__("Click to upload", "structura"),
  dropCta: window.wp.i18n.__("or drag and drop", "structura"),
  dropHint: window.wp.i18n.__(
    "PDF, DOCX, TXT, MD or HTML · up to 10 MB each · up to 5 files",
    "structura"
  ),
  dropActive: window.wp.i18n.__("Drop to attach", "structura"),
  busy: window.wp.i18n.__("Uploading & reading…", "structura"),
  readPages: (n2) => window.wp.i18n.sprintf(
    /* translators: %d: number of pages extracted from the document */
    window.wp.i18n._n("%d page read", "%d pages read", n2, "structura"),
    n2
  ),
  readWords: (n2) => window.wp.i18n.sprintf(
    /* translators: %s: approximate number of words extracted */
    window.wp.i18n.__("≈%s words read", "structura"),
    n2.toLocaleString()
  ),
  partialNote: (n2, unit) => unit === "pages" ? window.wp.i18n.sprintf(
    /* translators: %d: number of pages that will be used */
    window.wp.i18n.__("Long document — we'll use the first ~%d pages.", "structura"),
    n2
  ) : window.wp.i18n.sprintf(
    /* translators: %s: number of words that will be used */
    window.wp.i18n.__("Long document — we'll use the first ~%s words.", "structura"),
    n2.toLocaleString()
  ),
  failedNote: window.wp.i18n.__(
    "We couldn't read this file — it may be corrupt or image-only.",
    "structura"
  ),
  retry: window.wp.i18n.__("Retry", "structura"),
  remove: (name) => window.wp.i18n.sprintf(
    /* translators: %s: file name */
    window.wp.i18n.__("Remove %s", "structura"),
    name
  ),
  cancel: window.wp.i18n.__("Cancel upload", "structura"),
  rejectType: researchRejectTypeMessage,
  rejectSize: researchRejectSizeMessage,
  addMore: (n2, max2) => window.wp.i18n.sprintf(
    /* translators: 1: number of files attached, 2: maximum number of files */
    window.wp.i18n.__("Add more files · %1$d of %2$d", "structura"),
    n2,
    max2
  ),
  capStrip: window.wp.i18n.__("5 of 5 files attached — remove one to add another.", "structura"),
  counter: (n2, max2) => window.wp.i18n.sprintf(
    /* translators: 1: number of files attached, 2: maximum number of files */
    window.wp.i18n.__("%1$d of %2$d", "structura"),
    n2,
    max2
  ),
  srReady: window.wp.i18n.__("Ready", "structura")
};
const GeneratePostPage = () => {
  const navigate = useNavigate();
  const { isLicensed, isPaidLicense, plan } = useLicense();
  const uploadsUnwritable = !!window.structuraConfig?.uploads_unwritable;
  const {
    activeProviders,
    isLoading: connectionsLoading,
    isFetching: connectionsFetching
  } = useAiConnections();
  const { data: aiSettings } = useAiSettingsQuery();
  const { defaultTextProvider, defaultImageProvider } = useDefaultProviders();
  const { data: personas = [], isLoading: loadingPersonas } = usePersonasQuery();
  const { generatePost, isGenerating } = useCampaignMutations();
  const { suggest, isSuggesting } = useMagicSuggest();
  const generateStrategy = async (provider) => {
    const data = await suggest("campaign", { provider, context: [] });
    if (data?.strategy) {
      update("identity", {
        objective: data.strategy,
        ...data.campaign_mode && MODES.includes(data.campaign_mode) ? { campaignMode: data.campaign_mode } : {}
      });
    }
  };
  const isManagedAiPlan = isManagedPlan(plan);
  const showPerPostModelPicker = !isManagedAiPlan;
  const [formData, setFormData] = window.wp.element.useState(
    () => getCampaignFormDataForLicense({ isPaidLicense, isLicensed })
  );
  const [showAdvanced, setShowAdvanced] = window.wp.element.useState(false);
  const [researchFiles, setResearchFiles] = window.wp.element.useState([]);
  const hasSyncedProviders = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (hasSyncedProviders.current) return;
    if (!aiSettings) return;
    if (!isManagedAiPlan && (connectionsLoading || connectionsFetching)) return;
    hasSyncedProviders.current = true;
    setFormData((prev) => ({
      ...prev,
      intelligence: {
        ...prev.intelligence,
        textProvider: defaultTextProvider,
        imageProvider: defaultImageProvider,
        textModel: mirrorModelForTier(defaultTextProvider, "text", prev.intelligence.textTier ?? "mid") ?? "",
        imageModel: mirrorModelForTier(defaultImageProvider, "image", prev.intelligence.imageTier ?? "mid") ?? ""
      }
    }));
  }, [
    aiSettings,
    defaultTextProvider,
    defaultImageProvider,
    isManagedAiPlan,
    connectionsLoading,
    connectionsFetching
  ]);
  const hasPinnedSinglePersona = window.wp.element.useRef(false);
  window.wp.element.useEffect(() => {
    if (hasPinnedSinglePersona.current) return;
    if (loadingPersonas) return;
    if (personas.length !== 1) return;
    hasPinnedSinglePersona.current = true;
    setFormData(
      (prev) => prev.intelligence.personaId === "random" ? {
        ...prev,
        intelligence: {
          ...prev.intelligence,
          personaId: String(personas[0].id)
        }
      } : prev
    );
  }, [loadingPersonas, personas]);
  const update = (cluster, partial) => setFormData((prev) => ({
    ...prev,
    [cluster]: { ...prev[cluster], ...partial }
  }));
  const patch = (p2) => setFormData((prev) => ({ ...prev, ...p2 }));
  const updateSeoRule = (key, value) => update("intelligence", {
    seoRules: { ...formData.intelligence.seoRules, [key]: value }
  });
  const isValid = formData.identity.objective.length >= 20;
  const hasApiKey = activeProviders.length > 0;
  const hasNoPersonas = !loadingPersonas && personas.length === 0;
  const selectedTextProviderConnected = isManagedAiPlan || activeProviders.includes(formData.intelligence.textProvider);
  const isEngineReady = (isManagedAiPlan || hasApiKey) && selectedTextProviderConnected;
  const { data: quota } = useSingleGenQuota();
  const hasWeeklyCap = quota?.cap != null;
  const atWeeklyCap = hasWeeklyCap && (quota?.used ?? 0) >= (quota?.cap ?? 0);
  const wantsAnyImage = formData.structure.featuredImage || formData.structure.bodyImages;
  const handleGenerate = async () => {
    if (!isValid || !isEngineReady || hasNoPersonas || atWeeklyCap) return;
    const researchAttachments = researchFiles.filter((f2) => f2.status === "ready" && f2.attachmentId).map((f2) => ({ id: f2.attachmentId, name: f2.name }));
    try {
      const result = await generatePost({ data: { ...formData, researchAttachments } });
      const runId = result?.run_id;
      if (runId) {
        navigate(`/generate/runs/${runId}`);
      } else {
        navigate("/");
      }
    } catch {
    }
  };
  const personaOptions = [
    ...personas.length > 1 ? [{ value: "random", label: window.wp.i18n.__("Random persona", "structura") }] : [],
    ...personas.map((p2) => ({ value: String(p2.id), label: p2.name }))
  ];
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "mx-auto max-w-4xl space-y-6" }, /* @__PURE__ */ window.wp.element.createElement("header", { className: "flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    "button",
    {
      type: "button",
      onClick: () => navigate(-1),
      className: "mt-1.5 flex h-9 w-9 shrink-0 cursor-pointer items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-400 transition-colors hover:border-neutral-300 hover:text-neutral-600 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-500 dark:hover:border-neutral-600 dark:hover:text-neutral-300"
    },
    /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Generate a Post", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__("Create a single post right now using AI.", "structura"))))), /* @__PURE__ */ window.wp.element.createElement(NoPersonasBlocker, null), /* @__PURE__ */ window.wp.element.createElement(DefaultPersonaAdvisory, null), !connectionsLoading && !connectionsFetching && !isEngineReady && /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-amber-200 bg-amber-50/60 px-5 py-4 dark:border-amber-900/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-amber-800 dark:text-amber-200" }, hasApiKey ? window.wp.i18n.__(
    "The selected text provider isn't connected. Choose a connected provider below, or connect it in the AI Engine settings.",
    "structura"
  ) : window.wp.i18n.__("Connect an AI provider in the AI Engine settings first.", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      className: "mt-2",
      onClick: () => navigate("/ai-engine")
    },
    window.wp.i18n.__("Connect AI Provider", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })
  )), hasWeeklyCap && (atWeeklyCap ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-amber-200 bg-amber-50/60 px-5 py-4 dark:border-amber-900/40 dark:bg-amber-950/20" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-semibold text-amber-800 dark:text-amber-200" }, window.wp.i18n.sprintf(
    /* translators: %d: weekly one-off post allowance */
    window.wp.i18n.__(
      "Weekly post limit reached — this site has used all %d of its one-off posts this week. Your allowance resets on Monday (UTC).",
      "structura"
    ),
    quota?.cap ?? 0
  ))) : /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! px-1 text-xs font-medium text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.sprintf(
    /* translators: 1: one-off posts used this week, 2: weekly allowance */
    window.wp.i18n.__("%1$d of %2$d one-off posts used this week.", "structura"),
    quota?.used ?? 0,
    quota?.cap ?? 0
  ))), /* @__PURE__ */ window.wp.element.createElement(VisualStyleFallbackNotice, { imagesEnabled: wantsAnyImage }), /* @__PURE__ */ window.wp.element.createElement(Section, { title: window.wp.i18n.__("What should we write about?", "structura") }, /* @__PURE__ */ window.wp.element.createElement(
    MagicSuggestButton,
    {
      isLoading: isSuggesting,
      onTrigger: generateStrategy,
      ctaLabel: window.wp.i18n.__("Generate post strategy", "structura"),
      subLabel: window.wp.i18n.__("We'll study your site and draft a focused objective.", "structura"),
      className: "mb-4"
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Describe your post topic or objective", "structura"),
      hiddenLabel: true,
      placeholder: window.wp.i18n.__(
        "e.g. Write an in-depth guide on React server components for mid-level developers, covering streaming, suspense boundaries, and real-world migration patterns...",
        "structura"
      ),
      value: formData.identity.objective,
      onChange: (e2) => update("identity", { objective: e2.target.value }),
      rows: 4
    }
  ), formData.identity.objective.length > 0 && formData.identity.objective.length < 20 && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs text-amber-500" }, window.wp.i18n.__("Please describe your topic in at least 20 characters.", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-2" }, /* @__PURE__ */ window.wp.element.createElement("label", { className: "mb-2 block text-xs font-bold text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__("Writing approach", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    Gn,
    {
      options: MODES.map((mode) => ({
        value: mode,
        label: getCampaignModeMeta(mode).label,
        description: MODE_DESCRIPTIONS[mode]
      })),
      value: formData.identity.campaignMode ?? "traffic_magnet",
      onChange: (mode) => update("identity", { campaignMode: mode }),
      ariaLabel: window.wp.i18n.__("Writing approach", "structura")
    }
  ))), isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement(
    cn,
    {
      files: researchFiles,
      onFilesChange: setResearchFiles,
      onUpload: uploadResearchDoc,
      labels: RESEARCH_ATTACHMENTS_LABELS,
      disabled: isGenerating
    }
  ) : /* @__PURE__ */ window.wp.element.createElement(
    Ga,
    {
      title: window.wp.i18n.__("Research material", "structura"),
      badge: window.wp.i18n.__("Pro", "structura"),
      line: window.wp.i18n.__(
        "Ground posts in your own PDFs, briefs and interview notes — attach up to 5 files per post.",
        "structura"
      ),
      cta: /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(
        "a",
        {
          href: buildMarketingPricingUrl({
            intent: "general_upgrade",
            domain: typeof window !== "undefined" ? window.location.hostname : void 0,
            plan
          }),
          target: "_blank",
          rel: "noreferrer"
        },
        window.wp.i18n.__("Upgrade plan", "structura"),
        /* @__PURE__ */ window.wp.element.createElement(ArrowUpRight, { size: 14, className: "ml-1.5" })
      ))
    }
  ), /* @__PURE__ */ window.wp.element.createElement(Section, { title: window.wp.i18n.__("SEO Targeting", "structura") }, /* @__PURE__ */ window.wp.element.createElement(
    SeoTargetingSection,
    {
      formData,
      onChange: patch,
      isPaidLicense: !!isPaidLicense,
      isLicensed: !!isLicensed,
      plan
    }
  )), /* @__PURE__ */ window.wp.element.createElement(Section, { title: window.wp.i18n.__("AI & Persona", "structura") }, /* @__PURE__ */ window.wp.element.createElement(
    ProviderToggle,
    {
      textProvider: formData.intelligence.textProvider,
      imageProvider: formData.intelligence.imageProvider,
      onTextProviderChange: (p2) => update("intelligence", {
        textProvider: p2,
        textModel: mirrorModelForTier(p2, "text", formData.intelligence.textTier ?? "mid") ?? ""
      }),
      onImageProviderChange: (p2) => update("intelligence", {
        imageProvider: p2,
        imageModel: mirrorModelForTier(p2, "image", formData.intelligence.imageTier ?? "mid") ?? ""
      }),
      availableTextProviders: isManagedAiPlan ? ["gemini", "openai", "anthropic"] : activeProviders,
      availableImageProviders: isManagedAiPlan ? ["gemini", "openai"] : activeProviders,
      showTierSelectors: showPerPostModelPicker,
      textTier: formData.intelligence.textTier ?? "mid",
      imageTier: formData.intelligence.imageTier ?? "mid",
      onTextTierChange: (t2) => update("intelligence", {
        textTier: t2,
        textModel: mirrorModelForTier(formData.intelligence.textProvider, "text", t2) ?? ""
      }),
      onImageTierChange: (t2) => update("intelligence", {
        imageTier: t2,
        imageModel: mirrorModelForTier(formData.intelligence.imageProvider, "image", t2) ?? ""
      })
    }
  ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4" }, /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      options: personaOptions,
      value: formData.intelligence.personaId === "random" ? "random" : String(formData.intelligence.personaId),
      onValueChange: (val) => update("intelligence", {
        // Keep the value as the string the option emitted —
        // `Number(val)` produces `NaN` for cloud nanoid ids
        // ("4r9TBGo…") and the round-trip silently drops the
        // selection. Numeric legacy WP ids round-trip fine
        // as strings; the cloud accepts both shapes.
        personaId: val === "random" ? "random" : String(val)
      })
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Persona", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select persona…", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, null, personaOptions.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value.toString() }, opt.label)))
  ), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      options: [
        { value: "default", label: window.wp.i18n.__("System Default", "structura") },
        { value: "en", label: "English" },
        { value: "es", label: "Español" },
        { value: "fr", label: "Français" },
        { value: "de", label: "Deutsch" },
        { value: "it", label: "Italiano" },
        { value: "pt", label: "Português" },
        { value: "nl", label: "Nederlands" },
        { value: "ru", label: "Русский" },
        { value: "ja", label: "日本語" },
        { value: "zh", label: "中文" },
        { value: "ko", label: "한국어" },
        { value: "ar", label: "العربية" },
        { value: "hi", label: "हिन्दी" },
        { value: "uk", label: "Українська" }
      ],
      value: formData.intelligence.language,
      onValueChange: (val) => update("intelligence", { language: val })
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Language", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select language…", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, null, [
      { value: "default", label: window.wp.i18n.__("System Default", "structura") },
      { value: "en", label: "English" },
      { value: "es", label: "Español" },
      { value: "fr", label: "Français" },
      { value: "de", label: "Deutsch" },
      { value: "it", label: "Italiano" },
      { value: "pt", label: "Português" },
      { value: "nl", label: "Nederlands" },
      { value: "ru", label: "Русский" },
      { value: "ja", label: "日本語" },
      { value: "zh", label: "中文" },
      { value: "ko", label: "한국어" },
      { value: "ar", label: "العربية" },
      { value: "hi", label: "हिन्दी" },
      { value: "uk", label: "Українська" }
    ].map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  ), /* @__PURE__ */ window.wp.element.createElement(
    he,
    {
      label: window.wp.i18n.__("Post Length", "structura"),
      type: "number",
      value: formData.intelligence.postLength,
      max: !isPaidLicense ? 500 : void 0,
      onChange: (e2) => {
        const parsed = parseInt(e2.target.value);
        const next = Number.isFinite(parsed) ? parsed : 0;
        update("intelligence", {
          // Mirror the server clamp client-side so the displayed
          // value never exceeds what the post will actually be.
          postLength: !isPaidLicense ? Math.min(next, 500) : next
        });
      },
      rightAdornment: /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-[10px] font-bold text-neutral-400 uppercase" }, window.wp.i18n.__("Words", "structura"))
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    Zn,
    {
      options: POST_STATUS_OPTIONS,
      value: formData.structure.postStatus,
      onValueChange: (val) => update("structure", { postStatus: val })
    },
    /* @__PURE__ */ window.wp.element.createElement(Zn.Label, null, window.wp.i18n.__("Post Status", "structura")),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Trigger, { placeholder: window.wp.i18n.__("Select…", "structura") }),
    /* @__PURE__ */ window.wp.element.createElement(Zn.Content, null, POST_STATUS_OPTIONS.map((opt) => /* @__PURE__ */ window.wp.element.createElement(Zn.Item, { key: opt.value, value: opt.value }, opt.label)))
  )), !isPaidLicense && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-3 text-[11px] leading-snug text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "Free and anonymous installs are capped at 500 words per post. Upgrade to Pro to publish longer posts.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(Section, { title: window.wp.i18n.__("Content Options", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, isLicensed ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Image, { size: 14, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300" }, window.wp.i18n.__("Featured image", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Featured image", "structura"),
      hiddenLabel: true,
      disabled: uploadsUnwritable,
      checked: formData.structure.featuredImage && !uploadsUnwritable,
      onChange: (checked) => update("structure", { featuredImage: checked })
    }
  )) : /* @__PURE__ */ window.wp.element.createElement(
    LockedFeature,
    {
      label: window.wp.i18n.__("Featured image", "structura"),
      tier: window.wp.i18n.__("Free License", "structura")
    }
  ), isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Image, { size: 14, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300" }, window.wp.i18n.__("Body images", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("Body images", "structura"),
      hiddenLabel: true,
      disabled: uploadsUnwritable,
      checked: formData.structure.bodyImages && !uploadsUnwritable,
      onChange: (checked) => update("structure", { bodyImages: checked })
    }
  )) : /* @__PURE__ */ window.wp.element.createElement(LockedFeature, { label: window.wp.i18n.__("Body images", "structura") }), uploadsUnwritable && /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-[11px] leading-snug text-amber-600 dark:text-amber-500" }, window.wp.i18n.__(
    "Image generation is unavailable because WordPress can't write to your uploads folder. Posts will still publish without images.",
    "structura"
  ), " ", /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: "https://docs.structurawp.com/troubleshooting/images-not-generating",
      target: "_blank",
      rel: "noopener noreferrer",
      className: "underline hover:text-amber-700 dark:hover:text-amber-400"
    },
    window.wp.i18n.__("How to fix this", "structura")
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Sparkles, { size: 14, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300" }, window.wp.i18n.__("AI disclosure", "structura"))), /* @__PURE__ */ window.wp.element.createElement(
    Ja,
    {
      label: window.wp.i18n.__("AI disclosure", "structura"),
      hiddenLabel: true,
      checked: formData.structure.disclosure.enabled,
      onChange: (checked) => update("structure", {
        disclosure: { ...formData.structure.disclosure, enabled: checked }
      })
    }
  )), formData.structure.disclosure.enabled && /* @__PURE__ */ window.wp.element.createElement("div", { className: "pl-6" }, /* @__PURE__ */ window.wp.element.createElement(
    un,
    {
      label: window.wp.i18n.__("Disclosure Notice", "structura"),
      value: formData.structure.disclosure.text,
      onChange: (e2) => update("structure", {
        disclosure: { ...formData.structure.disclosure, text: e2.target.value }
      }),
      rows: 2
    }
  )))), /* @__PURE__ */ window.wp.element.createElement(Section, { title: window.wp.i18n.__("Content Blocks", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, CONTENT_BLOCKS.map((block) => {
    const blockName = block.name;
    const isFreeLocked = block.name === "core/heading" && !isLicensed;
    const isProLocked = block.isPro && !isPaidLicense;
    const isLocked = isFreeLocked || isProLocked;
    if (block.isRequired) {
      return /* @__PURE__ */ window.wp.element.createElement(
        "div",
        {
          key: block.name,
          className: "flex items-center justify-between rounded-lg bg-neutral-50 px-3 py-2 dark:bg-neutral-800/50"
        },
        /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(PanelsTopLeft, { size: 12, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-xs font-medium text-neutral-700 dark:text-neutral-300" }, block.label)),
        /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "outline", className: "text-[9px]" }, window.wp.i18n.__("Required", "structura"))
      );
    }
    if (isLocked) {
      return /* @__PURE__ */ window.wp.element.createElement(
        LockedFeature,
        {
          key: block.name,
          label: block.label,
          tier: isFreeLocked ? window.wp.i18n.__("Free License", "structura") : window.wp.i18n.__("Pro", "structura")
        }
      );
    }
    const isEnabled = formData.structure.enabledBlocks.includes(blockName);
    return /* @__PURE__ */ window.wp.element.createElement("div", { key: block.name, className: "flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(PanelsTopLeft, { size: 14, className: "text-neutral-400" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300" }, block.label)), /* @__PURE__ */ window.wp.element.createElement(
      Ja,
      {
        label: block.label,
        hiddenLabel: true,
        checked: isEnabled,
        onChange: (checked) => {
          const cur = formData.structure.enabledBlocks;
          const next = checked ? [...cur.filter((b2) => b2 !== blockName), blockName] : cur.filter((b2) => b2 !== blockName);
          update("structure", { enabledBlocks: next });
        }
      }
    ));
  }))), /* @__PURE__ */ window.wp.element.createElement(Section, { title: window.wp.i18n.__("Content Features", "structura") }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "space-y-3" }, /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("FAQ section", "structura"),
      checked: formData.intelligence.seoRules.include_faq_section,
      onChange: (v2) => updateSeoRule("include_faq_section", v2),
      available: !!isPaidLicense
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("Action steps", "structura"),
      checked: formData.intelligence.seoRules.include_action_steps,
      onChange: (v2) => updateSeoRule("include_action_steps", v2),
      available: !!isPaidLicense
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("Supporting statistics", "structura"),
      checked: formData.intelligence.seoRules.include_statistics,
      onChange: (v2) => updateSeoRule("include_statistics", v2),
      available: !!isPaidLicense
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("Number in title", "structura"),
      checked: formData.intelligence.seoRules.number_in_title,
      onChange: (v2) => updateSeoRule("number_in_title", v2),
      available: !!isPaidLicense
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("Internal linking", "structura"),
      checked: formData.intelligence.seoRules.internal_link_optimization,
      onChange: (v2) => updateSeoRule("internal_link_optimization", v2),
      available: !!isPaidLicense
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("Authority outbound links", "structura"),
      checked: formData.intelligence.seoRules.outbound_link_authority,
      onChange: (v2) => updateSeoRule("outbound_link_authority", v2),
      available: !!isPaidLicense
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("E-E-A-T writing signals", "structura"),
      checked: formData.intelligence.seoRules.eeat_signals,
      onChange: (v2) => updateSeoRule("eeat_signals", v2),
      available: !!isPaidLicense
    }
  ), /* @__PURE__ */ window.wp.element.createElement(
    SeoToggle,
    {
      label: window.wp.i18n.__("Entity coverage", "structura"),
      checked: formData.intelligence.seoRules.entity_coverage,
      onChange: (v2) => updateSeoRule("entity_coverage", v2),
      available: !!isPaidLicense
    }
  )), isPaidLicense ? /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mt-4 text-xs leading-relaxed text-neutral-400 dark:text-neutral-500" }, window.wp.i18n.__(
    "Readability, keyphrase placement, SERP analysis, and meta fields are optimised automatically on every post.",
    "structura"
  )) : /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-4 flex items-center gap-3 rounded-xl border border-dashed border-neutral-200 bg-neutral-50/50 px-4 py-3 dark:border-neutral-700 dark:bg-neutral-800/30" }, /* @__PURE__ */ window.wp.element.createElement(Crown, { size: 16, className: "text-brand-500 dark:text-brand-400 shrink-0" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-xs font-semibold text-neutral-600 dark:text-neutral-400" }, window.wp.i18n.__("Unlock full SEO optimisation with Pro", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5! mb-0! text-[11px] text-neutral-500 dark:text-neutral-500" }, window.wp.i18n.__(
    "Readability tuning, keyphrase placement, SERP-aware writing, and link validation.",
    "structura"
  ))), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildMarketingPricingUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    window.wp.i18n.__("Upgrade", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 12, className: "ml-1" })
  )))), !isLicensed && /* @__PURE__ */ window.wp.element.createElement("div", { className: "border-brand-200 dark:border-brand-900/30 rounded-2xl border border-dashed bg-white px-6 py-5 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-100 dark:bg-brand-950/40 flex size-10 shrink-0 items-center justify-center rounded-xl" }, /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 20, className: "text-brand-500 dark:text-brand-400" })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("h3", { className: "m-0! text-sm font-bold text-neutral-900 dark:text-white" }, window.wp.i18n.__("Want to automate this?", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1! mb-0! text-xs leading-relaxed text-neutral-500 dark:text-neutral-400" }, window.wp.i18n.__(
    "Create a free account to set up campaigns that automatically generate and publish posts on a schedule. No more manual work.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3 flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildPortalSignupUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer",
      className: "text-white!"
    },
    window.wp.i18n.__("Get Free Account", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ArrowRight, { size: 14, className: "ml-1.5" })
  )), /* @__PURE__ */ window.wp.element.createElement(tr$1, { asChild: true, variant: "secondary", size: "sm" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: buildMarketingPricingUrl({
        intent: "general_upgrade",
        domain: typeof window !== "undefined" ? window.location.hostname : void 0,
        plan
      }),
      target: "_blank",
      rel: "noreferrer"
    },
    window.wp.i18n.__("See Plans", "structura")
  )))))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-end gap-3" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: () => navigate(-1) }, window.wp.i18n.__("Cancel", "structura")), /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      onClick: handleGenerate,
      loading: isGenerating,
      disabled: !isValid || !isEngineReady || hasNoPersonas || atWeeklyCap,
      title: atWeeklyCap ? window.wp.i18n.__(
        "Weekly post limit reached — your allowance resets on Monday.",
        "structura"
      ) : void 0
    },
    /* @__PURE__ */ window.wp.element.createElement(Zap, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Generate Now", "structura")
  )));
};
const SeoToggle = ({
  label,
  checked,
  onChange,
  available,
  tier = "Pro"
}) => {
  if (!available) {
    return /* @__PURE__ */ window.wp.element.createElement(LockedFeature, { label, tier });
  }
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm font-medium text-neutral-700 dark:text-neutral-300" }, label), /* @__PURE__ */ window.wp.element.createElement(Ja, { label, hiddenLabel: true, checked, onChange }));
};
const OVERLINE = "text-[10px] font-black uppercase tracking-widest text-neutral-400 dark:text-neutral-500";
const RunAgainConfirmDialog = ({
  open,
  onClose,
  onConfirm,
  submitting = false,
  topic,
  postStatus,
  providers,
  personaName,
  language,
  focusKeyphrase,
  researchAttachmentNames
}) => {
  const isPublish = postStatus === "publish";
  const rows = [
    ...(providers ?? []).map((p2) => ({
      key: p2.key,
      icon: p2.role === "text" ? PenLine : Image,
      label: p2.role === "text" ? window.wp.i18n.__("Text provider", "structura") : window.wp.i18n.__("Image provider", "structura"),
      value: p2.value,
      providerId: p2.providerId
    })),
    personaName && {
      key: "persona",
      icon: UserRound,
      label: window.wp.i18n.__("Persona", "structura"),
      value: personaName
    },
    language && {
      key: "language",
      icon: Languages,
      label: window.wp.i18n.__("Language", "structura"),
      value: language
    },
    focusKeyphrase && {
      key: "keyphrase",
      icon: Target,
      label: window.wp.i18n.__("Focus keyphrase", "structura"),
      value: focusKeyphrase
    },
    !!researchAttachmentNames?.length && {
      key: "research",
      icon: Paperclip,
      label: window.wp.i18n.__("Research files", "structura"),
      // Handoff `echo.more`: first file name + "+{n} more" for the rest.
      value: researchAttachmentNames.length === 1 ? researchAttachmentNames[0] : window.wp.i18n.sprintf(
        /* translators: 1: first file name, 2: count of additional files */
        window.wp.i18n.__("%1$s +%2$d more", "structura"),
        researchAttachmentNames[0],
        researchAttachmentNames.length - 1
      )
    }
  ].filter(Boolean);
  return (
    // Esc / overlay click close — suppressed while submitting so a kickoff
    // can't be interrupted mid-request.
    /* @__PURE__ */ window.wp.element.createElement(Y.Root, { open, onClose: submitting ? () => {
    } : onClose, size: "md" }, /* @__PURE__ */ window.wp.element.createElement(Y.Content, { className: "overflow-visible!" }, submitting && /* @__PURE__ */ window.wp.element.createElement("div", { className: "absolute inset-x-0 top-0 h-0.5 overflow-hidden rounded-t-2xl" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "bg-brand-500 h-full w-1/3 animate-pulse motion-reduce:animate-none" })), /* @__PURE__ */ window.wp.element.createElement(
      "button",
      {
        type: "button",
        onClick: onClose,
        disabled: submitting,
        "aria-label": window.wp.i18n.__("Close", "structura"),
        className: "absolute top-4 right-4 flex h-8 w-8 items-center justify-center rounded-lg text-neutral-400 transition-colors hover:bg-neutral-100 hover:text-neutral-600 disabled:pointer-events-none disabled:opacity-40 dark:hover:bg-white/10 dark:hover:text-neutral-200"
      },
      /* @__PURE__ */ window.wp.element.createElement(X, { size: 18 })
    ), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3.5 pr-8" }, /* @__PURE__ */ window.wp.element.createElement("span", { className: "bg-brand-50 text-brand-600 dark:bg-brand-500/15 dark:text-brand-300 flex h-11 w-11 shrink-0 items-center justify-center rounded-full" }, /* @__PURE__ */ window.wp.element.createElement(RotateCcw, { size: 20 })), /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0" }, /* @__PURE__ */ window.wp.element.createElement(Y.Title, null, window.wp.i18n.__("Run again?", "structura")), /* @__PURE__ */ window.wp.element.createElement(Y.Description, { className: "mt-1.5! text-[13px] leading-relaxed" }, window.wp.i18n.__("This creates a ", "structura"), /* @__PURE__ */ window.wp.element.createElement("span", { className: "font-semibold text-neutral-600 dark:text-neutral-300" }, window.wp.i18n.__("new post", "structura")), window.wp.i18n.__(
      " using the same settings below. It uses one generation from your plan.",
      "structura"
    )))), /* @__PURE__ */ window.wp.element.createElement(Y.Body, { className: "mt-5! space-y-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-xl bg-neutral-50 p-3.5 ring-1 ring-neutral-200/70 ring-inset dark:bg-white/[.03] dark:ring-white/[.06]" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: `mt-0! mb-1.5! ${OVERLINE}` }, window.wp.i18n.__("Topic", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      "p",
      {
        className: "m-0! text-sm leading-relaxed font-medium text-neutral-800 dark:text-neutral-100",
        style: {
          display: "-webkit-box",
          WebkitLineClamp: 2,
          WebkitBoxOrient: "vertical",
          overflow: "hidden"
        }
      },
      topic
    )), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("p", { className: `mt-0! mb-1.5! ${OVERLINE}` }, window.wp.i18n.__("Post status", "structura")), /* @__PURE__ */ window.wp.element.createElement(
      "div",
      {
        className: isPublish ? "flex items-center gap-3.5 rounded-xl border border-amber-300/70 bg-amber-50 p-3.5 dark:border-amber-500/30 dark:bg-amber-950/30" : "flex items-center gap-3.5 rounded-xl border border-neutral-200 bg-neutral-50/70 p-3.5 dark:border-neutral-700 dark:bg-white/[.03]"
      },
      /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: isPublish ? "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-amber-100 text-amber-700 dark:bg-amber-500/20 dark:text-amber-300" : "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-white text-neutral-500 ring-1 ring-neutral-200 dark:bg-white/5 dark:text-neutral-300 dark:ring-white/10"
        },
        isPublish ? /* @__PURE__ */ window.wp.element.createElement(Globe, { size: 20 }) : /* @__PURE__ */ window.wp.element.createElement(FilePenLine, { size: 20 })
      ),
      /* @__PURE__ */ window.wp.element.createElement("div", { className: "min-w-0 flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm font-bold text-neutral-900 dark:text-white" }, isPublish ? window.wp.i18n.__("Publishes live immediately", "structura") : window.wp.i18n.__("Saves as a draft", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-0.5!text-xs mb-0! leading-snug text-neutral-500 dark:text-neutral-400" }, isPublish ? window.wp.i18n.__("Goes public the moment it's generated.", "structura") : window.wp.i18n.__("Stays private until you publish it yourself.", "structura"))),
      /* @__PURE__ */ window.wp.element.createElement(
        "span",
        {
          className: isPublish ? "inline-flex items-center gap-1 rounded-full bg-amber-200 px-2.5 py-1 text-[10px] leading-none font-bold tracking-wide text-amber-800 uppercase dark:bg-amber-500/25 dark:text-amber-200" : "inline-flex items-center gap-1 rounded-full bg-neutral-200 px-2.5 py-1 text-[10px] leading-none font-bold tracking-wide text-neutral-600 uppercase dark:bg-white/10 dark:text-neutral-300"
        },
        isPublish ? /* @__PURE__ */ window.wp.element.createElement(Globe, { size: 11 }) : /* @__PURE__ */ window.wp.element.createElement(FilePenLine, { size: 11 }),
        isPublish ? window.wp.i18n.__("Publish", "structura") : window.wp.i18n.__("Draft", "structura")
      )
    )), rows.length > 0 && /* @__PURE__ */ window.wp.element.createElement("dl", { className: "m-0! divide-y divide-neutral-100 rounded-xl border border-neutral-200 px-3.5 dark:divide-neutral-800 dark:border-neutral-800" }, rows.map(({ key, icon: Icon2, label, value, providerId }) => {
      const Logo = providerId ? il(providerId) : null;
      return /* @__PURE__ */ window.wp.element.createElement("div", { key, className: "flex items-center justify-between gap-4 py-2.5" }, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "m-0! flex items-center gap-2 text-xs text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Icon2, { size: 14, className: "text-neutral-400 dark:text-neutral-500" }), label), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "m-0! flex min-w-0 items-center justify-end gap-1.5 text-[13px] font-semibold text-neutral-800 dark:text-neutral-100" }, Logo && /* @__PURE__ */ window.wp.element.createElement(Logo, { size: 15, className: "shrink-0" }), /* @__PURE__ */ window.wp.element.createElement("span", { className: "truncate" }, value)));
    }))), /* @__PURE__ */ window.wp.element.createElement(Y.Footer, null, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary", onClick: onClose, disabled: submitting, autoFocus: true }, window.wp.i18n.__("Cancel", "structura")), /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "primary", onClick: onConfirm, loading: submitting }, !submitting && /* @__PURE__ */ window.wp.element.createElement(RotateCcw, { size: 16, className: "mr-2" }), submitting ? window.wp.i18n.__("Starting…", "structura") : window.wp.i18n.__("Run again", "structura")))))
  );
};
const PROVIDER_LABELS = {
  openai: "OpenAI",
  gemini: "Gemini",
  anthropic: "Anthropic"
};
const INITIAL_GRACE_WINDOW_MS = 9e4;
const SinglePostRunDetailPage = () => {
  const { runId } = useParams();
  const { data, isError, isLoading } = useCampaignRunQuery(runId ?? null);
  const [mountedAt] = window.wp.element.useState(() => Date.now());
  const hasSeenRunRef = window.wp.element.useRef(false);
  if (data?.run) {
    hasSeenRunRef.current = true;
  }
  if (!runId) {
    return /* @__PURE__ */ window.wp.element.createElement(NotFoundState, null);
  }
  const inGraceWindow = Date.now() - mountedAt < INITIAL_GRACE_WINDOW_MS;
  if (!data?.run) {
    if (hasSeenRunRef.current) {
      return /* @__PURE__ */ window.wp.element.createElement(QueueingState, { runId });
    }
    if (isLoading || inGraceWindow) {
      return /* @__PURE__ */ window.wp.element.createElement(QueueingState, { runId });
    }
    if (isError) {
      return /* @__PURE__ */ window.wp.element.createElement(NotFoundState, null);
    }
    return /* @__PURE__ */ window.wp.element.createElement(QueueingState, { runId });
  }
  return /* @__PURE__ */ window.wp.element.createElement(SinglePostRunDetailLoaded, { run: data.run });
};
const QueueingState = ({ runId: _runId }) => {
  const [slow, setSlow] = window.wp.element.useState(false);
  window.wp.element.useEffect(() => {
    const t2 = window.setTimeout(() => setSlow(true), 15e3);
    return () => window.clearTimeout(t2);
  }, []);
  return renderQueueingState(slow);
};
const renderQueueingState = (slow) => /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
  Link$2,
  {
    to: "/generate",
    className: "mt-1 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-500 transition-colors hover:border-neutral-300 hover:bg-neutral-50 hover:text-neutral-700 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:border-neutral-600 dark:hover:bg-neutral-700",
    "aria-label": window.wp.i18n.__("Back to Generate", "structura")
  },
  /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { size: 16 })
), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Single-post generation", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent: "info" }, window.wp.i18n.__("queueing", "structura"))))), /* @__PURE__ */ window.wp.element.createElement("section", { className: "flex items-center gap-3 rounded-2xl border border-blue-200/60 bg-blue-50/40 p-6 shadow-sm dark:border-blue-900/40 dark:bg-blue-950/20" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "h-5 w-5 animate-spin text-blue-600 dark:text-blue-400" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-blue-900 dark:text-blue-100" }, slow ? window.wp.i18n.__(
  "Still waiting for your site's background runner to pick this up. On quiet sites this can take a minute — the run starts as soon as WordPress cron fires.",
  "structura"
) : window.wp.i18n.__("Setting up your run — this only takes a few seconds.", "structura"))));
const NotFoundState = () => /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "rounded-2xl border border-neutral-300/50 bg-white p-8 text-center shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement(
  CircleAlert,
  {
    className: "mx-auto mb-3 h-8 w-8 text-neutral-400 dark:text-neutral-500",
    "aria-hidden": true
  }
), /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, window.wp.i18n.__("Run not found", "structura")), /* @__PURE__ */ window.wp.element.createElement(PageDescription, null, window.wp.i18n.__(
  "We don't have this run anymore. Run docs are kept for 30 days after completion.",
  "structura"
)), /* @__PURE__ */ window.wp.element.createElement(Link$2, { to: "/generate", className: "mt-4 inline-block" }, /* @__PURE__ */ window.wp.element.createElement(tr$1, { variant: "secondary" }, /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { className: "mr-1.5 h-4 w-4" }), window.wp.i18n.__("Back to Generate", "structura")))));
const TERMINAL_STATUSES = /* @__PURE__ */ new Set([
  "succeeded",
  "succeeded_with_warnings",
  "failed",
  "cancelled"
]);
const SinglePostRunDetailLoaded = ({ run }) => {
  const navigate = useNavigate();
  const { generatePost, isGenerating } = useCampaignMutations();
  const [confirmOpen, setConfirmOpen] = window.wp.element.useState(false);
  const isTerminal = TERMINAL_STATUSES.has(run.status);
  const isSuccess = run.status === "succeeded" || run.status === "succeeded_with_warnings";
  const inputs = run.inputSnapshot;
  const objective = readString(inputs, "identity", "objective");
  const campaignMode = readString(inputs, "identity", "campaignMode");
  const textProvider = readString(inputs, "intelligence", "textProvider");
  const textModel = readString(inputs, "intelligence", "textModel");
  const imageProvider = readString(inputs, "intelligence", "imageProvider");
  const imageModel = readString(inputs, "intelligence", "imageModel");
  const language = readString(inputs, "intelligence", "language");
  const personaName = readString(inputs, "intelligence", "personaName");
  const requestedStatus = readString(inputs, "structure", "postStatus") || "publish";
  const openRunAgain = () => {
    if (!inputs) {
      navigate("/generate");
      return;
    }
    setConfirmOpen(true);
  };
  const handleRunAgain = async () => {
    if (!inputs) {
      navigate("/generate");
      return;
    }
    try {
      const result = await generatePost({
        data: inputs
      });
      const newRunId = result?.run_id;
      navigate(newRunId ? `/generate/runs/${newRunId}` : "/generate");
    } catch {
      setConfirmOpen(false);
    }
  };
  const focusKeyphrase = readString(inputs, "identity", "focusKeyphrase");
  const researchFileNames = readResearchFileNames(inputs);
  const { data: availableModels } = useAvailableModelsQuery();
  const providerModelValue = (providerId, modelId) => {
    const provider = PROVIDER_LABELS[providerId] ?? providerId;
    const model = modelId ? [...availableModels?.text ?? [], ...availableModels?.image ?? []].find(
      (m3) => m3.id === modelId
    )?.name ?? modelId : "";
    return model ? `${provider} · ${model}` : provider;
  };
  const runProviders = [
    textProvider && {
      key: "text",
      role: "text",
      providerId: textProvider,
      value: providerModelValue(textProvider, textModel)
    },
    imageProvider && {
      key: "image",
      role: "image",
      providerId: imageProvider,
      value: providerModelValue(imageProvider, imageModel)
    }
  ].filter(Boolean);
  return /* @__PURE__ */ window.wp.element.createElement(PageContainer, { variant: "narrow" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-start justify-between gap-4" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(
    Link$2,
    {
      to: "/generate",
      className: "mt-1 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-neutral-200 bg-white text-neutral-500 transition-colors hover:border-neutral-300 hover:bg-neutral-50 hover:text-neutral-700 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400 dark:hover:border-neutral-600 dark:hover:bg-neutral-700",
      "aria-label": window.wp.i18n.__("Back to Generate", "structura")
    },
    /* @__PURE__ */ window.wp.element.createElement(ArrowLeft, { size: 16 })
  ), /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement(PageTitle, null, objective.length > 60 ? objective.slice(0, 57) + "…" : objective || window.wp.i18n.__("Single-post generation", "structura")), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-2 flex items-center gap-2" }, /* @__PURE__ */ window.wp.element.createElement(StatusPill, { status: run.status }), (isSuccess || run.headline) && /* @__PURE__ */ window.wp.element.createElement("span", { className: "text-sm text-neutral-500 dark:text-neutral-400" }, isSuccess ? requestedStatus === "publish" ? window.wp.i18n.__("Post published", "structura") : window.wp.i18n.__("Draft created", "structura") : run.headline)))), isTerminal && /* @__PURE__ */ window.wp.element.createElement(
    tr$1,
    {
      variant: "secondary",
      size: "sm",
      onClick: openRunAgain,
      disabled: isGenerating
    },
    isGenerating ? /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { size: 14, className: "mr-1.5 animate-spin" }) : /* @__PURE__ */ window.wp.element.createElement(RefreshCw, { size: 14, className: "mr-1.5" }),
    window.wp.i18n.__("Run again", "structura")
  )), /* @__PURE__ */ window.wp.element.createElement(
    RunAgainConfirmDialog,
    {
      open: confirmOpen,
      onClose: () => !isGenerating && setConfirmOpen(false),
      onConfirm: handleRunAgain,
      submitting: isGenerating,
      topic: objective,
      postStatus: requestedStatus,
      providers: runProviders,
      personaName: personaName || void 0,
      language: language || void 0,
      focusKeyphrase: focusKeyphrase || void 0,
      researchAttachmentNames: researchFileNames.length > 0 ? researchFileNames : void 0
    }
  ), !isTerminal && /* @__PURE__ */ window.wp.element.createElement("section", { className: "mb-6 flex items-center gap-3 rounded-2xl border border-blue-200/60 bg-blue-50/40 p-6 shadow-sm dark:border-blue-900/40 dark:bg-blue-950/20" }, /* @__PURE__ */ window.wp.element.createElement(LoaderCircle, { className: "h-5 w-5 animate-spin text-blue-600 dark:text-blue-400" }), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! text-sm text-blue-900 dark:text-blue-100" }, window.wp.i18n.__("Working on your post — this usually takes 4–5 minutes.", "structura"))), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6" }, /* @__PURE__ */ window.wp.element.createElement(RunTimeline, { run })), inputs && /* @__PURE__ */ window.wp.element.createElement("section", { className: "mb-6 rounded-2xl border border-neutral-200 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900" }, /* @__PURE__ */ window.wp.element.createElement("h2", { className: "mb-4 text-sm font-semibold uppercase tracking-wide text-neutral-500 dark:text-neutral-400 m-0!" }, window.wp.i18n.__("Inputs", "structura")), /* @__PURE__ */ window.wp.element.createElement("dl", { className: "grid grid-cols-2 gap-4 text-sm" }, campaignMode && /* @__PURE__ */ window.wp.element.createElement(Field, { label: window.wp.i18n.__("Mode", "structura"), value: String(campaignMode) }), textProvider && /* @__PURE__ */ window.wp.element.createElement(
    Field,
    {
      label: window.wp.i18n.__("Text provider", "structura"),
      value: String(textProvider)
    }
  ), imageProvider && /* @__PURE__ */ window.wp.element.createElement(
    Field,
    {
      label: window.wp.i18n.__("Image provider", "structura"),
      value: String(imageProvider)
    }
  ), language && /* @__PURE__ */ window.wp.element.createElement(Field, { label: window.wp.i18n.__("Language", "structura"), value: String(language) }), personaName && /* @__PURE__ */ window.wp.element.createElement(Field, { label: window.wp.i18n.__("Persona", "structura"), value: String(personaName) }), researchFileNames.length > 0 && /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "flex items-center gap-1.5 text-xs uppercase tracking-wide text-neutral-500 dark:text-neutral-400" }, /* @__PURE__ */ window.wp.element.createElement(Paperclip, { size: 14, "aria-hidden": "true" }), window.wp.i18n.__("Research files", "structura")), /* @__PURE__ */ window.wp.element.createElement("dd", { className: "m-0! mt-1 space-y-0.5" }, researchFileNames.map((name, i2) => /* @__PURE__ */ window.wp.element.createElement(
    "p",
    {
      key: `${name}-${i2}`,
      className: "m-0! truncate font-mono text-[11.5px] text-neutral-900 dark:text-neutral-100",
      title: name
    },
    name
  )))))), isSuccess && run.resultPostId ? /* @__PURE__ */ window.wp.element.createElement(
    SuccessResult,
    {
      requestedStatus,
      postId: run.resultPostId,
      postUrl: run.resultPostUrl
    }
  ) : run.status === "failed" ? /* @__PURE__ */ window.wp.element.createElement(FailureResult, { error: run.error }) : null, isSuccess && requestedStatus === "publish" && run.resultPostUrl && /* @__PURE__ */ window.wp.element.createElement(
    SearchPerformanceSection,
    {
      pageUrl: run.resultPostUrl,
      publishedAt: run.endedAt ?? run.startedAt,
      className: "mb-6"
    }
  ));
};
const SuccessResult = ({
  requestedStatus,
  postId,
  postUrl
}) => {
  const isPublished = requestedStatus === "publish";
  const title = isPublished ? window.wp.i18n.__("Post published", "structura") : window.wp.i18n.__("Draft created", "structura");
  const helper = isPublished ? null : window.wp.i18n.__("It's saved as a draft — nothing is live yet.", "structura");
  const editUrl = buildEditPostUrl(postId);
  return /* @__PURE__ */ window.wp.element.createElement("section", { className: "mb-6 rounded-2xl border border-emerald-200/70 bg-emerald-50/40 p-6 shadow-sm dark:border-emerald-900/40 dark:bg-emerald-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(CircleCheck, { className: "mt-0.5 h-5 w-5 text-emerald-600 dark:text-emerald-400" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! font-medium text-emerald-900 dark:text-emerald-100" }, title), helper && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-1 text-sm text-emerald-800/90 dark:text-emerald-200/90 m-0!" }, helper), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mt-3 flex flex-wrap items-center gap-3" }, isPublished && postUrl && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: postUrl,
      target: "_blank",
      rel: "noopener noreferrer",
      className: "inline-flex items-center gap-1.5 text-sm font-medium text-emerald-700 hover:underline dark:text-emerald-300"
    },
    window.wp.i18n.__("View post", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { size: 13 })
  ), !isPublished && editUrl && /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: editUrl,
      target: "_blank",
      rel: "noopener noreferrer",
      className: "inline-flex items-center gap-1.5 text-sm font-medium text-emerald-700 hover:underline dark:text-emerald-300"
    },
    window.wp.i18n.__("Review draft", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(PencilLine, { size: 13 })
  )))));
};
const FailureResult = ({
  error
}) => {
  const primary = error?.userMessage || error?.devMessage;
  const techBits = [error?.code, error?.errorKind].filter(Boolean);
  return /* @__PURE__ */ window.wp.element.createElement("section", { className: "mb-6 rounded-2xl border border-red-200/70 bg-red-50/40 p-6 shadow-sm dark:border-red-900/40 dark:bg-red-950/20" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex items-start gap-3" }, /* @__PURE__ */ window.wp.element.createElement(CircleAlert, { className: "mt-0.5 h-5 w-5 text-red-600 dark:text-red-400" }), /* @__PURE__ */ window.wp.element.createElement("div", { className: "flex-1" }, /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! font-medium text-red-900 dark:text-red-100" }, window.wp.i18n.__("Generation failed", "structura")), /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2 text-sm text-red-800 dark:text-red-200 m-0!" }, primary || window.wp.i18n.__(
    "The run stopped before the post was created. Try Run again, or adjust your inputs and retry.",
    "structura"
  )), techBits.length > 0 && /* @__PURE__ */ window.wp.element.createElement("p", { className: "mt-2 font-mono text-[11px] text-red-700/80 dark:text-red-300/70 m-0!" }, techBits.join(" · ")))));
};
const buildEditPostUrl = (postId) => {
  if (typeof window === "undefined") return "";
  const { origin, pathname } = window.location;
  const adminDir = pathname.replace(/admin\.php$/, "");
  return `${origin}${adminDir}post.php?post=${encodeURIComponent(
    String(postId)
  )}&action=edit`;
};
const StatusPill = ({ status }) => {
  const intent = status === "succeeded" || status === "succeeded_with_warnings" ? "success" : status === "failed" || status === "cancelled" ? "destructive" : "info";
  return /* @__PURE__ */ window.wp.element.createElement(Me, { variant: "solid", intent }, status.replace(/_/g, " "));
};
const Field = ({ label, value }) => /* @__PURE__ */ window.wp.element.createElement("div", null, /* @__PURE__ */ window.wp.element.createElement("dt", { className: "text-xs uppercase tracking-wide text-neutral-500 dark:text-neutral-400" }, label), /* @__PURE__ */ window.wp.element.createElement("dd", { className: B$1("mt-1 text-sm text-neutral-900 dark:text-neutral-100 m-0!") }, value));
const readString = (obj, ...keys) => {
  let cur = obj;
  for (const k2 of keys) {
    if (!cur || typeof cur !== "object") return "";
    cur = cur[k2];
  }
  return typeof cur === "string" ? cur : "";
};
const readResearchFileNames = (obj) => {
  const raw = obj?.researchAttachments;
  if (!Array.isArray(raw)) return [];
  return raw.map(
    (ref) => ref && typeof ref === "object" && typeof ref.name === "string" ? ref.name : ""
  ).filter(Boolean);
};
const App = () => {
  const channelsVisible = useChannelsVisibility();
  const { loading: licenseLoading, entitlementsLoading } = useLicense();
  const channelsRouteState = resolveChannelsRouteState(
    licenseLoading,
    entitlementsLoading,
    channelsVisible
  );
  const { data: privacyConsent } = usePrivacyConsent();
  window.wp.element.useEffect(() => {
    if (!privacyConsent) return;
    void setConsented(privacyConsent.telemetryEnabled);
  }, [privacyConsent?.telemetryEnabled, privacyConsent?.choseAt]);
  return /* @__PURE__ */ window.wp.element.createElement(HashRouter, null, /* @__PURE__ */ window.wp.element.createElement(RunsProvider, null, /* @__PURE__ */ window.wp.element.createElement(OnboardingAutoRedirectBridge, null), /* @__PURE__ */ window.wp.element.createElement("div", { className: "structura-app-wrapper -ml-2.5 bg-[#f0f0f1] sm:-ml-5" }, /* @__PURE__ */ window.wp.element.createElement(Header, null), /* @__PURE__ */ window.wp.element.createElement("main", { className: "mx-auto max-w-7xl px-4 py-8 sm:px-6 lg:px-8" }, /* @__PURE__ */ window.wp.element.createElement(AppErrorBoundary, { resetOnNavigation: true }, /* @__PURE__ */ window.wp.element.createElement(WpCronDisabledBanner, null), /* @__PURE__ */ window.wp.element.createElement(CloudUnreachableBanner, null), /* @__PURE__ */ window.wp.element.createElement(SiteNotConnectedBanner, null), /* @__PURE__ */ window.wp.element.createElement(LicenseStatusBanner, null), /* @__PURE__ */ window.wp.element.createElement(DomainMismatchAdvisory, null), /* @__PURE__ */ window.wp.element.createElement(DisconnectedProvidersBanner, null), /* @__PURE__ */ window.wp.element.createElement(CycleQuotaBanner, null), channelsVisible && /* @__PURE__ */ window.wp.element.createElement(ExpiredConnectionsBanner, null), /* @__PURE__ */ window.wp.element.createElement(Routes, null, /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/", element: /* @__PURE__ */ window.wp.element.createElement(DashboardPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/generate", element: /* @__PURE__ */ window.wp.element.createElement(GeneratePostPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/generate/runs/:runId", element: /* @__PURE__ */ window.wp.element.createElement(SinglePostRunDetailPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/campaigns", element: /* @__PURE__ */ window.wp.element.createElement(CampaignsPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/campaigns/new", element: /* @__PURE__ */ window.wp.element.createElement(CreateCampaignPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/campaigns/:id", element: /* @__PURE__ */ window.wp.element.createElement(CampaignViewPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/campaigns/:id/edit", element: /* @__PURE__ */ window.wp.element.createElement(EditCampaignPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/personas", element: /* @__PURE__ */ window.wp.element.createElement(PersonasPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/ai-engine", element: /* @__PURE__ */ window.wp.element.createElement(AiEngine, null) }), channelsRouteState === "pending" ? null : channelsRouteState === "mounted" ? /* @__PURE__ */ window.wp.element.createElement(window.wp.element.Fragment, null, /* @__PURE__ */ window.wp.element.createElement(
    Route,
    {
      path: "/channels",
      element: /* @__PURE__ */ window.wp.element.createElement(Navigate, { to: "/channels/connections", replace: true })
    }
  ), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/channels/connections", element: /* @__PURE__ */ window.wp.element.createElement(ChannelsConnectionsPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/channels/store", element: /* @__PURE__ */ window.wp.element.createElement(ChannelsStorePage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/channels/activity", element: /* @__PURE__ */ window.wp.element.createElement(ChannelsActivityPage, null) })) : /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/channels/*", element: /* @__PURE__ */ window.wp.element.createElement(Navigate, { to: "/", replace: true }) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/visuals", element: /* @__PURE__ */ window.wp.element.createElement(VisualsPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/site", element: /* @__PURE__ */ window.wp.element.createElement(Navigate, { to: "/site/info", replace: true }) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/site/info", element: /* @__PURE__ */ window.wp.element.createElement(SiteInfoTab, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/site/competitors", element: /* @__PURE__ */ window.wp.element.createElement(SiteCompetitorsTab, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/site/referrals", element: /* @__PURE__ */ window.wp.element.createElement(SiteReferralsTab, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/site/settings", element: /* @__PURE__ */ window.wp.element.createElement(SiteSettingsTab, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/settings", element: /* @__PURE__ */ window.wp.element.createElement(SettingsPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/account", element: /* @__PURE__ */ window.wp.element.createElement(Account, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/notices", element: /* @__PURE__ */ window.wp.element.createElement(Notices, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/logs", element: /* @__PURE__ */ window.wp.element.createElement(Navigate, { to: "/notices", replace: true }) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/runs/:runId", element: /* @__PURE__ */ window.wp.element.createElement(RunDetailPage, null) }), /* @__PURE__ */ window.wp.element.createElement(Route, { path: "/onboarding", element: /* @__PURE__ */ window.wp.element.createElement(OnboardingPage, null) })))), /* @__PURE__ */ window.wp.element.createElement(RunStatusToastHost, null))));
};
const PRIVACY_URL = "https://www.structurawp.com/privacy";
const TERMS_URL = "https://www.structurawp.com/terms";
function needsCloudConsent(config) {
  return config?.cloud_consent === false;
}
const CloudConsentGate = ({ onGranted }) => {
  const grant = useGrantCloudConsent();
  const [failed, setFailed] = window.wp.element.useState(false);
  const handleConnect = async () => {
    setFailed(false);
    try {
      await grant.mutateAsync();
      if (onGranted) {
        onGranted();
      } else {
        window.location.reload();
      }
    } catch {
      setFailed(true);
    }
  };
  const shared = [
    window.wp.i18n.__("A random install ID, generated on this site by WordPress", "structura"),
    window.wp.i18n.__("Your site's address (host name) and site title", "structura"),
    window.wp.i18n.__("Your WordPress version and the plugin version", "structura"),
    window.wp.i18n.__(
      "Your site's branding details: title, tagline, language, logo URL, and active theme name",
      "structura"
    )
  ];
  return /* @__PURE__ */ window.wp.element.createElement("div", { className: "structura-app-wrapper -ml-2.5 min-h-screen bg-[#f0f0f1] sm:-ml-5 dark:bg-gray-950" }, /* @__PURE__ */ window.wp.element.createElement("main", { className: "mx-auto max-w-2xl px-4 py-16 sm:px-6 lg:px-8" }, /* @__PURE__ */ window.wp.element.createElement(Vt, { className: "p-8!", "data-testid": "cloud-consent-gate" }, /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex items-center gap-3" }, /* @__PURE__ */ window.wp.element.createElement(ShieldCheck, { className: "text-brand-500 h-6 w-6", "aria-hidden": "true" }), /* @__PURE__ */ window.wp.element.createElement("h1", { className: "m-0! text-xl font-bold text-gray-900 dark:text-white" }, window.wp.i18n.__("Connect this site to Structura Cloud", "structura"))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-4 text-sm leading-relaxed text-gray-700 dark:text-gray-300" }, window.wp.i18n.__(
    "Structura writes and formats your posts on Structura Cloud, a service run by the plugin author. Nothing has been sent yet. When you continue, the plugin creates an anonymous workspace for this site and shares:",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("ul", { className: "m-0! mb-4 list-disc space-y-1 pl-5 text-sm text-gray-700 dark:text-gray-300" }, shared.map((item) => /* @__PURE__ */ window.wp.element.createElement("li", { key: item }, item))), /* @__PURE__ */ window.wp.element.createElement("p", { className: "m-0! mb-6 text-sm leading-relaxed text-gray-600 dark:text-gray-400" }, window.wp.i18n.__(
    "No post content, prompts, or visitor data are included. You can disconnect at any time from Account & License. If you would rather not connect, simply deactivate the plugin — nothing has been sent.",
    "structura"
  )), /* @__PURE__ */ window.wp.element.createElement("div", { className: "mb-6 flex flex-wrap gap-4 text-sm" }, /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: PRIVACY_URL,
      target: "_blank",
      rel: "noopener noreferrer",
      className: "text-brand-600 dark:text-brand-400 inline-flex items-center gap-1 font-medium hover:underline"
    },
    window.wp.i18n.__("Privacy policy", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
  ), /* @__PURE__ */ window.wp.element.createElement(
    "a",
    {
      href: TERMS_URL,
      target: "_blank",
      rel: "noopener noreferrer",
      className: "text-brand-600 dark:text-brand-400 inline-flex items-center gap-1 font-medium hover:underline"
    },
    window.wp.i18n.__("Terms of service", "structura"),
    /* @__PURE__ */ window.wp.element.createElement(ExternalLink, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
  )), failed && /* @__PURE__ */ window.wp.element.createElement(
    "p",
    {
      role: "alert",
      className: "m-0! mb-4 text-sm font-medium text-red-600 dark:text-red-400"
    },
    window.wp.i18n.__(
      "We couldn't save your choice. Please try again in a moment.",
      "structura"
    )
  ), /* @__PURE__ */ window.wp.element.createElement(tr$1, { onClick: handleConnect, loading: grant.isPending, size: "lg" }, window.wp.i18n.__("Connect to Structura Cloud", "structura")))));
};
function installWpJsxRuntimeShim(element) {
  if (typeof element.jsx === "function") return;
  const jsx = (type, props, key) => element.createElement(type, key === void 0 ? props : { ...props, key });
  element.jsx = jsx;
  element.jsxs = jsx;
  element.jsxDEV = jsx;
}
if (window.wp?.element) {
  const element = window.wp.element;
  installWpJsxRuntimeShim(element);
  if (!element.version) {
    element.version = window.React?.version || "18.3.1";
  }
}
const queryClient = new QueryClient({
  queryCache: new QueryCache({
    // Global catch-all. A query can opt OUT of the toast by setting
    // `meta: { silentError: true }` — used by hooks that have their own
    // in-page advisory for known recoverable failures (e.g. the Channels
    // queries render a "this host isn't a registered activation" inline
    // banner instead of the generic "Data Fetch Error" toast). The
    // opt-out is explicit per query rather than global so anything that
    // forgets to set it still surfaces to the user by default.
    onError: (error, query) => {
      if (query.meta?.silentError) return;
      An.error(`${window.wp.i18n.__("Data Fetch Error:", "structura")} ${error.message}`);
    }
  }),
  mutationCache: new MutationCache({
    // Mirrors the QueryCache opt-out above. Mutations that surface their
    // own structured error UI (e.g. the campaign-limit-reached toast in
    // useCampaignMutations.ts, which carries a Contact Us CTA the
    // generic "Action Failed: …" toast can't render) set
    // `meta: { silentError: true }` so the global handler stays out of
    // the way. Default-on for everything else so a forgotten onError
    // still surfaces to the user.
    onError: (error, _vars, _ctx, mutation) => {
      if (mutation.meta?.silentError) return;
      An.error(`${window.wp.i18n.__("Action Failed:", "structura")} ${error.message}`);
    }
  }),
  defaultOptions: {
    queries: {
      retry: 1,
      refetchOnWindowFocus: false,
      staleTime: 1e3 * 60 * 5
    }
  }
});
document.addEventListener("DOMContentLoaded", () => {
  const rootElement = document.getElementById("structura-root");
  if (rootElement) {
    window.wp.element.createRoot(rootElement).render(
      /* @__PURE__ */ window.wp.element.createElement(window.wp.element.StrictMode, null, /* @__PURE__ */ window.wp.element.createElement(AppErrorBoundary, null, /* @__PURE__ */ window.wp.element.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ window.wp.element.createElement(Sn, null, needsCloudConsent(window.structuraConfig) ? /* @__PURE__ */ window.wp.element.createElement(CloudConsentGate, null) : /* @__PURE__ */ window.wp.element.createElement(App, null)))))
    );
  }
});
