import { getBackendSrv } from '@grafana/runtime';
import { getStaticConfigSchema } from './staticRegistry.js';
export { staticSchemaRegistry } from './staticRegistry.js';

const SCHEMA_PATH = "/public/plugins/{pluginType}/schema/settings.schema.json";
function getConfigSchemaUrl(pluginType) {
  return SCHEMA_PATH.replaceAll("{pluginType}", pluginType);
}
const schemaCache = /* @__PURE__ */ new Map();
async function getConfigSchema(pluginType) {
  const cached = schemaCache.get(pluginType);
  if (cached !== undefined) {
    return cached;
  }
  const url = getConfigSchemaUrl(pluginType);
  let schema;
  try {
    schema = await getBackendSrv().get(url);
  } catch (e) {
    schema = getStaticConfigSchema(pluginType);
  }
  schemaCache.set(pluginType, schema);
  return schema;
}

export { getConfigSchema, getConfigSchemaUrl, getStaticConfigSchema };
//# sourceMappingURL=index.js.map
