import { browserCapabilities } from "./browser.ts";
import { mobileCapabilities } from "./mobile.ts";
import { isMobile, platform, register, registered, run, supports } from "./registry.ts";

const names = new Set([...Object.keys(browserCapabilities), ...Object.keys(mobileCapabilities)]);
for (const name of names) {
  register(name, { ...browserCapabilities[name], ...mobileCapabilities[name] });
}

export * from "./types.ts";
export {
  NativeUnavailableError,
  clearRegistry,
  isMobile,
  platform,
  register,
  registered,
  run,
  supports,
} from "./registry.ts";
export { browserCapabilities } from "./browser.ts";
export { mobileCapabilities } from "./mobile.ts";

export const native = { isMobile, platform, register, registered, run, supports };
export {
  defineNativeManifest,
  inspectNativeCapabilities,
  missingNativeCapabilities,
  PermissionManager,
} from "./manifest.ts";
export type {
  NativeCapabilityManifestEntry,
  NativeCapabilityManifest,
  NativePermission,
  PermissionAdapter,
} from "./manifest.ts";
