import { g as get, s as set, c as appendErrors } from './index.esm-CfkbVR3O.js';
import { importShared } from './__federation_fn_import-UR7U68uv.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(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=(e,t)=>{const r=n$1(t);return e.some(e=>n$1(e).match(`^${r}\\.\\d+`))};function n$1(e){return e.replace(/\]|\[/g,"")}

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

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, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Link,
      {
        to: "/plugins/edit/$key",
        params: { key: queuePlugin.metadata.key },
        activeOptions: { exact: true },
        children: "Queue"
      }
    ) }),
    /* @__PURE__ */ jsxRuntimeExports.jsx(NavigationTabsItem, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
      Link,
      {
        to: `/plugins/edit/${queueImplementationPlugin.metadata.key}`,
        activeOptions: { exact: true },
        children: queueImplementationPlugin.metadata.displayName
      }
    ) })
  ] });
}

export { QueueConfigTabs as Q, s };
//# sourceMappingURL=styles-D4kR8aSb.js.map
