import { defineComponent, ref, resolveComponent, h } from 'vue';
import { I as IdentityProviderProtocol, n as navigateTo } from './server.mjs';
import { buildFormSelect } from '@vue-layout/hyperscript';
import 'ofetch';
import 'hookable';
import 'unctx';
import 'destr';
import 'ufo';
import 'h3';
import '@unhead/vue';
import '@unhead/dom';
import 'vue-router';
import '@ebec/http';
import 'hapic';
import 'rapiq';
import '@vue-layout/basic';
import 'change-case';
import '@ucast/mongo2js';
import '@hapic/oauth2';
import '@vuelidate/validators';
import 'ilingo';
import 'nanoid';
import 'smob';
import 'browser-storage-adapter';
import 'cookie-es';
import 'ohash';
import 'vue/server-renderer';
import 'defu';
import './node-server.mjs';
import 'node-fetch-native/polyfill';
import 'http';
import 'https';
import 'unenv/runtime/fetch/index';
import 'scule';
import 'unstorage';
import 'radix3';
import 'node:fs';
import 'node:url';
import 'pathe';

const add = defineComponent({
  emits: ["failed", "created"],
  setup(props, { emit }) {
    const handleCreated = (e) => {
      navigateTo({ path: `/admin/identity-providers/${e.id}` });
    };
    const handleFailed = (e) => {
      emit("failed", e);
    };
    const protocol = ref(null);
    const select = buildFormSelect({
      labelContent: "Protocol",
      options: [
        { id: IdentityProviderProtocol.OAUTH2, value: "OAuth2" },
        { id: IdentityProviderProtocol.OIDC, value: "OIDC" },
        { id: IdentityProviderProtocol.LDAP, value: "LDAP" }
      ],
      value: protocol,
      onChange(value) {
        protocol.value = value;
      }
    });
    const form = resolveComponent("OAuth2ProviderForm");
    const renderForm = () => {
      switch (protocol.value) {
        case IdentityProviderProtocol.OAUTH2:
          return [
            h("hr"),
            h(form, {
              onCreated: handleCreated,
              onFailed: handleFailed
            })
          ];
      }
      return [];
    };
    return () => h("div", [
      select,
      renderForm()
    ]);
  }
});

export { add as default };
//# sourceMappingURL=add.4962b07b.mjs.map
