import { defineComponent, resolveComponent, h } from 'vue';
import { i as isRealmResourceWritable } from './utils-252b142e.mjs';
import { f as useAuthStore, s as storeToRefs, n as navigateTo } from './server.mjs';
import 'ofetch';
import 'hookable';
import 'unctx';
import 'destr';
import '@unhead/ssr';
import 'unhead';
import '@unhead/shared';
import 'vue-router';
import 'h3';
import 'ufo';
import '@ebec/http';
import 'hapic';
import '@hapic/oauth2';
import 'rapiq';
import '@vue-layout/basic';
import 'change-case';
import '@ucast/mongo2js';
import 'ilingo';
import '@vue-layout/hyperscript';
import '@vuelidate/validators';
import '@vuelidate/core';
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 'node:http';
import 'node:https';
import 'unenv/runtime/fetch/index';
import 'scule';
import 'unstorage';
import 'radix3';
import 'node:fs';
import 'node:url';
import 'pathe';

const add = /* @__PURE__ */ defineComponent({
  emits: ["failed", "created"],
  setup(props, { emit }) {
    const handleCreated = (e) => {
      navigateTo({ path: `/admin/roles/${e.id}` });
    };
    const handleFailed = (e) => {
      emit("failed", e);
    };
    const form = resolveComponent("RoleForm");
    const store = useAuthStore();
    const { realmManagement, realmManagementId } = storeToRefs(store);
    return () => {
      let realmId;
      if (!isRealmResourceWritable(realmManagement.value)) {
        realmId = realmManagementId.value;
      }
      return h(form, {
        onCreated: handleCreated,
        onFailed: handleFailed,
        realmId
      });
    };
  }
});

export { add as default };
//# sourceMappingURL=add-6601badc.mjs.map
