const params = new URLSearchParams(typeof window === 'undefined' ? '' : window.location.search);
const requestedMode = params.get('mode') || import.meta.env.VITE_SHIRE_DENTAL_MODE || 'standalone';
const mode = requestedMode === 'shire' ? 'shire' : 'standalone';
export const runtimeConfig = {
  mode,
  embedded: mode === 'shire',
  standalone: mode === 'standalone',
  requireAuth: mode === 'standalone' && import.meta.env.VITE_DISABLE_AUTH !== 'true',
  requireLicense: mode === 'standalone' && import.meta.env.VITE_DISABLE_LICENSE !== 'true',
  productName: mode === 'shire' ? 'SHiRE Dental' : 'SHiRE Dental Studio',
  productTagline: mode === 'shire' ? 'Integrated Dental Workspace' : 'Digital Dentistry & Lab Workflow',
  hostOrigin: import.meta.env.VITE_SHIRE_HOST_ORIGIN || '*',
  version: import.meta.env.VITE_APP_VERSION || '2.0.0',
  edition: mode === 'shire' ? 'SHiRE OS Module' : 'Professional Standalone',
};
export function notifyHost(type, payload = {}) {
  if (!runtimeConfig.embedded || typeof window === 'undefined' || window.parent === window) return;
  window.parent.postMessage({ source:'shire-dental-studio', version:runtimeConfig.version, type, payload }, runtimeConfig.hostOrigin);
}
