"use client";
'use strict';

var React = require('react');
require('react/jsx-runtime');

function _interopNamespace(e) {
  if (e && e.__esModule) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespace(React);

var AppThemeContext = React__namespace.createContext(null);
function useTheme() {
  const context = React__namespace.useContext(AppThemeContext);
  if (context == null) {
    throw new Error("useTheme must be used within AppThemeProvider");
  }
  return context;
}

// src/theme/use-app-shell-dark-appearance.ts
function subscribeHtmlDarkClass(onStoreChange) {
  const root = document.documentElement;
  const observer = new MutationObserver(onStoreChange);
  observer.observe(root, { attributes: true, attributeFilter: ["class"] });
  return () => observer.disconnect();
}
function getSnapshotHtmlHasDarkClass() {
  return document.documentElement.classList.contains("dark");
}
function useAppShellDarkAppearance() {
  const { resolvedTheme, theme } = useTheme();
  const themeSaysDark = (resolvedTheme != null ? resolvedTheme : theme) === "dark";
  return React.useSyncExternalStore(
    subscribeHtmlDarkClass,
    () => getSnapshotHtmlHasDarkClass() || themeSaysDark,
    () => false
  );
}

exports.useAppShellDarkAppearance = useAppShellDarkAppearance;
//# sourceMappingURL=use-app-shell-dark-appearance.cjs.map
//# sourceMappingURL=use-app-shell-dark-appearance.cjs.map