// @bun
var{defineProperty:A,getOwnPropertyNames:H,getOwnPropertyDescriptor:I}=Object,J=Object.prototype.hasOwnProperty;function K(b){return this[b]}var O=(b)=>{var f=(F??=new WeakMap).get(b),w;if(f)return f;if(f=A({},"__esModule",{value:!0}),b&&typeof b==="object"||typeof b==="function"){for(var z of H(b))if(!J.call(f,z))A(f,z,{get:K.bind(b,z),enumerable:!(w=I(b,z))||w.enumerable})}return F.set(b,f),f},F;var L=(b)=>b;function N(b,f){this[b]=L.bind(null,f)}var P=(b,f)=>{for(var w in f)A(b,w,{get:f[w],enumerable:!0,configurable:!0,set:N.bind(f,w)})};var Q=(b,f)=>()=>(b&&(f=b(b=0)),f);var R=import.meta.require;var B={colorScheme:"light",primaryColor:"#3b82f6",backgroundColor:"#ffffff",textColor:"#333333",borderColor:"#e0e0e0",secondaryBackground:"#f5f5f5",secondaryText:"#666666",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',codeFontFamily:'"SF Mono", Monaco, Consolas, monospace',borderRadius:"4px"},j={colorScheme:"dark",primaryColor:"#60a5fa",backgroundColor:"#1a1a1a",textColor:"#ffffff",borderColor:"#404040",secondaryBackground:"#2a2a2a",secondaryText:"#a0a0a0",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',codeFontFamily:'"SF Mono", Monaco, Consolas, monospace',borderRadius:"4px"},q=B,v=!1;function V(){return q}function W(){return v}function X(){v=!v,q=v?j:B}function Y(b){q={...q,...b}}function Z(b){let{theme:f}=b.config;if(f.defaultColorScheme==="dark")v=!0,q=j;else if(f.defaultColorScheme==="auto"){if(typeof window<"u"&&window.matchMedia)v=window.matchMedia("(prefers-color-scheme: dark)").matches,q=v?j:B}}function _(b=q){return`
    :root {
      --primary: ${b.primaryColor};
      --bg: ${b.backgroundColor};
      --text: ${b.textColor};
      --border: ${b.borderColor};
      --bg-secondary: ${b.secondaryBackground};
      --text-secondary: ${b.secondaryText};
      --font-family: ${b.fontFamily};
      --code-font-family: ${b.codeFontFamily};
      --border-radius: ${b.borderRadius};
    }
  `}function $(){return`
    <button
      class="stx-theme-toggle"
      onclick="window.__stxStory.toggleTheme()"
      title="Toggle dark mode"
    >
      ${v?"\u2600\uFE0F":"\uD83C\uDF19"}
    </button>
  `}function y(){return`
    window.__stxStory.toggleTheme = function() {
      document.documentElement.classList.toggle('dark');
      const btn = document.querySelector('.stx-theme-toggle');
      if (btn) {
        const isDark = document.documentElement.classList.contains('dark');
        btn.textContent = isDark ? '\u2600\uFE0F' : '\uD83C\uDF19';
      }
    };

    // Initialize from system preference
    if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
      document.documentElement.classList.add('dark');
    }

    // Listen for system preference changes
    window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
      if (e.matches) {
        document.documentElement.classList.add('dark');
      }
else {
        document.documentElement.classList.remove('dark');
      }
    });
  `}function C(b=q){return JSON.stringify({colors:{primary:b.primaryColor,background:b.backgroundColor,text:b.textColor,border:b.borderColor,secondaryBackground:b.secondaryBackground,secondaryText:b.secondaryText},typography:{fontFamily:b.fontFamily,codeFontFamily:b.codeFontFamily},spacing:{borderRadius:b.borderRadius}},null,2)}function E(b=q){return`/* STX Story Theme Tokens */
:root {
  /* Colors */
  --stx-color-primary: ${b.primaryColor};
  --stx-color-background: ${b.backgroundColor};
  --stx-color-text: ${b.textColor};
  --stx-color-border: ${b.borderColor};
  --stx-color-background-secondary: ${b.secondaryBackground};
  --stx-color-text-secondary: ${b.secondaryText};

  /* Typography */
  --stx-font-family: ${b.fontFamily};
  --stx-font-family-code: ${b.codeFontFamily};

  /* Spacing */
  --stx-border-radius: ${b.borderRadius};
}
`}function G(){return`
    .stx-theme-toggle {
      width: 32px;
      height: 32px;
      border: 1px solid var(--border);
      border-radius: var(--border-radius);
      background: var(--bg);
      cursor: pointer;
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .stx-theme-toggle:hover {
      background: var(--bg-secondary);
    }

    /* Dark mode overrides */
    .dark {
      --bg: ${j.backgroundColor};
      --bg-secondary: ${j.secondaryBackground};
      --text: ${j.textColor};
      --text-secondary: ${j.secondaryText};
      --border: ${j.borderColor};
      --primary: ${j.primaryColor};
    }
  `}export{X as toggleDarkMode,Y as setTheme,B as lightTheme,W as isDark,Z as initializeTheme,y as getThemeToggleScript,G as getThemeStyles,V as getCurrentTheme,$ as generateThemeToggle,_ as generateThemeCSS,C as exportThemeTokensJSON,E as exportThemeTokensCSS,j as darkTheme};
