import { g as get, s as set, c as appendErrors } from './index.esm-Dbg0JH7r.js';
import { l as parse, m as parseAsync, K as $ZodError } from './registries-Tz_dluz3.js';
import { importShared } from './__federation_fn_import-jPSkU14D.js';
import { j as jsxRuntimeExports } from './jsx-runtime-XI9uIe3W.js';

const r=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r(t,o,e));}},s$1=(r,s)=>{s.shouldUseNativeValidation&&o(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i$1(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i$1=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}

function t(r,e){try{var o=r();}catch(r){return e(r)}return o&&o.then?o.then(void 0,e):o}function s(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("unionErrors"in t){var u=t.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("unionErrors"in t&&t.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function i(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(".");if(!n[a])if("invalid_union"===t.code&&t.errors.length>0){var u=t.errors[0][0];n[a]={message:u.message,type:u.code};}else n[a]={message:i,type:s};if("invalid_union"===t.code&&t.errors.forEach(function(e){return e.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=appendErrors(a,e,n,s,f?[].concat(f,t.message):t.message);}r.shift();}return n}function a(o$1,a,u){if(void 0===u&&(u={}),function(r){return "_def"in r&&"object"==typeof r._def&&"typeName"in r._def}(o$1))return function(n,i,c){try{return Promise.resolve(t(function(){return Promise.resolve(o$1["sync"===u.mode?"parse":"parseAsync"](n,a)).then(function(e){return c.shouldUseNativeValidation&&o({},c),{errors:{},values:u.raw?Object.assign({},n):e}})},function(r){if(function(r){return Array.isArray(null==r?void 0:r.issues)}(r))return {values:{},errors:s$1(s(r.errors,!c.shouldUseNativeValidation&&"all"===c.criteriaMode),c)};throw r}))}catch(r){return Promise.reject(r)}};if(function(r){return "_zod"in r&&"object"==typeof r._zod}(o$1))return function(s,c,f){try{return Promise.resolve(t(function(){return Promise.resolve(("sync"===u.mode?parse:parseAsync)(o$1,s,a)).then(function(e){return f.shouldUseNativeValidation&&o({},f),{errors:{},values:u.raw?Object.assign({},s):e}})},function(r){if(function(r){return r instanceof $ZodError}(r))return {values:{},errors:s$1(i(r.issues,!f.shouldUseNativeValidation&&"all"===f.criteriaMode),f)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error("Invalid input: not a Zod schema")}

const {PluginUtils} = await importShared('@baseplate-dev/project-builder-lib');

const {useProjectDefinition} = await importShared('@baseplate-dev/project-builder-lib/web');

const {NavigationTabs,NavigationTabsItem} = await importShared('@baseplate-dev/ui-components');

const {Link} = await importShared('@tanstack/react-router');

function QueueConfigTabs() {
  const { definition, schemaParserContext } = useProjectDefinition();
  const queuePlugin = schemaParserContext.pluginStore.availablePlugins.find(
    (p) => p.metadata.packageName === "@baseplate-dev/plugin-queue" && p.metadata.name === "queue"
  );
  if (!queuePlugin) {
    return null;
  }
  const queueConfig = PluginUtils.configByKey(
    definition,
    queuePlugin.metadata.key
  );
  const implementationPluginKey = queueConfig?.implementationPluginKey;
  const queueImplementationPlugin = schemaParserContext.pluginStore.availablePlugins.find(
    (p) => p.metadata.key === implementationPluginKey
  );
  if (!queueImplementationPlugin) {
    return null;
  }
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(NavigationTabs, { children: [
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      NavigationTabsItem,
      {
        render: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Link,
          {
            to: "/plugins/edit/$key",
            params: { key: queuePlugin.metadata.key },
            activeOptions: { exact: true }
          }
        ),
        children: "Queue"
      }
    ),
    /* @__PURE__ */ jsxRuntimeExports.jsx(
      NavigationTabsItem,
      {
        render: /* @__PURE__ */ jsxRuntimeExports.jsx(
          Link,
          {
            to: `/plugins/edit/${queueImplementationPlugin.metadata.key}`,
            activeOptions: { exact: true }
          }
        ),
        children: queueImplementationPlugin.metadata.displayName
      }
    )
  ] });
}

export { QueueConfigTabs as Q, a };
//# sourceMappingURL=styles--2Kzy2Z4.js.map
