"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.applyColorPresetVars = applyColorPresetVars;
exports.applyDarkClass = applyDarkClass;
var _reactNative = require("react-native");
var _colorPresets = require("./color-presets.js");
var _tokenRegistry = require("./token-registry.js");
function applyDarkClass(resolved) {
  if (_reactNative.Platform.OS === 'web' && typeof document !== 'undefined') {
    document.documentElement.classList.toggle('dark', resolved === 'dark');
  }
}

/**
 * Apply a color preset's CSS custom properties to the document root.
 * No-op on native — only affects web (early-returns on `Platform.OS !== 'web'`).
 *
 * Web var contract (the form Tailwind v4 `@theme inline` compiles to)
 * -------------------------------------------------------------------
 * The shadcn/Tailwind-v4 web apps compile their color utilities to reference the
 * BASE token directly (`.bg-background { background-color: var(--background) }`),
 * so on web the base `--x` tokens MUST be FULL CSS colors. `getResolvedTokens`
 * returns every canonical token already resolved to an sRGB `rgb(...)` string,
 * so `var(--x)` resolves to a valid color directly — no per-value wrapping. The
 * same rgb values feed native (`color-mix` alpha utilities resolve on sRGB), so
 * web and native share one canonical token pipeline.
 *
 * Includes extended tokens (card, chart-*, content-area, sidebar-*) so consumer
 * apps don't need to synthesize them.
 */
function applyColorPresetVars(preset, resolved) {
  if (_reactNative.Platform.OS !== 'web' || typeof document === 'undefined') return;
  if (!_colorPresets.APP_COLOR_PRESETS[preset]) return;
  const vars = (0, _tokenRegistry.getResolvedTokens)(preset, resolved);
  const root = document.documentElement.style;
  for (const [key, value] of Object.entries(vars)) {
    root.setProperty(key, value);
  }
}
//# sourceMappingURL=apply-dark-class.js.map