// @bun
var{defineProperty:B,getOwnPropertyNames:K,getOwnPropertyDescriptor:N}=Object,O=Object.prototype.hasOwnProperty;function Q(b){return this[b]}var W=(b)=>{var f=(E??=new WeakMap).get(b),q;if(f)return f;if(f=B({},"__esModule",{value:!0}),b&&typeof b==="object"||typeof b==="function"){for(var u of K(b))if(!O.call(f,u))B(f,u,{get:Q.bind(b,u),enumerable:!(q=N(b,u))||q.enumerable})}return E.set(b,f),f},E;var R=(b)=>b;function S(b,f){this[b]=R.bind(null,f)}var X=(b,f)=>{for(var q in f)B(b,q,{get:f[q],enumerable:!0,configurable:!0,set:S.bind(f,q)})};var Y=(b,f)=>()=>(b&&(f=b(b=0)),f);var C=import.meta.require;async function _(){try{return typeof(await import("@stacksjs/desktop")).createWindowWithHTML==="function"}catch{return!1}}async function $(b,f,q,u={}){try{let z=await import("@stacksjs/desktop"),A=f.story?.variants.find((D)=>D.id===q);if(!A)return null;let F=u.title||`${f.fileName} - ${A.title}`,J=U(b,f,A),V=await z.createWindowWithHTML(J,{title:F,width:u.width||800,height:u.height||600});return{close:()=>{},reload:()=>{},update:(D)=>{}}}catch(z){return console.warn("Desktop preview not available:",z),null}}function U(b,f,q){let{theme:u}=b.config;return`<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>${f.fileName} - ${q.title}</title>
  <style>
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      padding: 24px;
      background: ${u.defaultColorScheme==="dark"?"#1a1a1a":"#ffffff"};
      color: ${u.defaultColorScheme==="dark"?"#ffffff":"#333333"};
    }
    .preview-header {
      margin-bottom: 16px;
      padding-bottom: 16px;
      border-bottom: 1px solid ${u.defaultColorScheme==="dark"?"#404040":"#e0e0e0"};
    }
    .preview-title {
      font-size: 14px;
      font-weight: 600;
    }
    .preview-subtitle {
      font-size: 12px;
      color: ${u.defaultColorScheme==="dark"?"#a0a0a0":"#666666"};
    }
    .preview-content {
      padding: 16px;
    }
  </style>
</head>
<body>
  <div class="preview-header">
    <div class="preview-title">${f.fileName}</div>
    <div class="preview-subtitle">${q.title}</div>
  </div>
  <div class="preview-content">
    ${q.source||"<!-- No source -->"}
  </div>
  <script>
    window.__stxProps = ${JSON.stringify(q.state||{})};
  </script>
</body>
</html>`}function g(b,f){return`
    <button
      class="stx-desktop-preview-btn"
      onclick="window.__stxStory.openDesktopPreview('${b}', '${f}')"
      title="Open in native window"
    >
      \uD83D\uDDA5\uFE0F Desktop
    </button>
  `}function G(){return`
    .stx-desktop-preview-btn {
      padding: 6px 12px;
      border: 1px solid var(--border);
      border-radius: 4px;
      background: var(--bg);
      color: var(--text);
      font-size: 12px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .stx-desktop-preview-btn:hover {
      background: var(--bg-secondary);
    }
  `}export{$ as openDesktopPreview,_ as isDesktopPreviewAvailable,G as getDesktopPreviewStyles,g as getDesktopPreviewButton};
