import type * as Diagram from 'embed-drawio';

let instance: typeof Diagram | null = null;

export const diagramLoader = (): Promise<typeof Diagram> => {
  if (instance) return Promise.resolve(instance);
  return import('embed-drawio').then(res => {
    instance = res;
    return res;
  });
};
