export const monacoConfig = {
  getWorkerUrl: function(moduleId, label) {
    const contextPath = document.querySelector('meta[name="context-path"]')?.getAttribute('content') || '/';
    const basePath = contextPath.endsWith('/') ? contextPath : `${contextPath}/`;

    const workers = {
      json: 'json.worker.bundle.js',
      css: 'css.worker.bundle.js',
      html: 'html.worker.bundle.js',
      typescript: 'ts.worker.bundle.js',
      javascript: 'ts.worker.bundle.js',
      default: 'editor.worker.bundle.js'
    };

    const workerPath = workers[label] || workers.default;
    return `${basePath}plugins/apitestmanager/${workerPath}`;
  }
};
