// @bun
// src/components/templates/engine/index.ts
import {
  createDefaultTransformEngine,
  registerBasicValidation,
  registerDefaultReactRenderer
} from "@contractspec/lib.contracts-spec/presentations/transform-engine";
function createTemplateTransformEngine() {
  const engine = createDefaultTransformEngine();
  registerDefaultReactRenderer(engine);
  registerBasicValidation(engine);
  return engine;
}
function findPresentation(presentations, name, version) {
  return presentations.find((p) => p.meta.key === name && String(p.meta.version) === String(version));
}
function filterPresentationsByDomain(presentations, domain) {
  return presentations.filter((p) => p.meta.domain === domain);
}
function supportsTarget(presentation, target) {
  return presentation.targets.includes(target);
}
var engineInstance = null;
function getTemplateEngine() {
  if (!engineInstance) {
    engineInstance = createTemplateTransformEngine();
  }
  return engineInstance;
}
function resetTemplateEngine() {
  engineInstance = null;
}
export {
  supportsTarget,
  resetTemplateEngine,
  getTemplateEngine,
  findPresentation,
  filterPresentationsByDomain,
  createTemplateTransformEngine
};
