// @bun
var{defineProperty:K,getOwnPropertyNames:H,getOwnPropertyDescriptor:P}=Object,R=Object.prototype.hasOwnProperty;function u(j){return this[j]}var C=(j)=>{var q=(Q??=new WeakMap).get(j),B;if(q)return q;if(q=K({},"__esModule",{value:!0}),j&&typeof j==="object"||typeof j==="function"){for(var F of H(j))if(!R.call(q,F))K(q,F,{get:u.bind(j,F),enumerable:!(B=P(j,F))||B.enumerable})}return Q.set(j,q),q},Q;var x=(j)=>j;function I(j,q){this[j]=x.bind(null,q)}var v=(j,q)=>{for(var B in q)K(j,B,{get:q[B],enumerable:!0,configurable:!0,set:I.bind(q,B)})};var k=(j,q)=>()=>(j&&(q=j(j=0)),q);var c=import.meta.require;function p(j){if(j.includes("data-stx-cloak"))return j;let q=j.lastIndexOf("</head>");if(q===-1)return j;return`${j.slice(0,q)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
${j.slice(q)}`}function S(j,q={},B={}){let{title:F="stx App",lang:U="en",meta:V=[],link:X=[],script:Y=[],headRaw:N="",bodyClass:O="",bodyAttrs:Z={}}=q,_=B.title||F,$=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...V].map((z)=>{return`  <meta ${Object.entries(z).map(([E,G])=>`${E}="${G}"`).join(" ")}>`}).join(`
`),L=X.map((z)=>{return`  <link ${Object.entries(z).map(([E,G])=>`${E}="${G}"`).join(" ")}>`}).join(`
`),M=Y.map((z)=>{if(z.src)return`  <script ${Object.entries(z).filter(([E])=>E!=="content").map(([E,G])=>`${E}="${G}"`).join(" ")}></script>`;if(z.content)return`  <script>${z.content}</script>`;return""}).filter(Boolean).join(`
`),W=Object.entries(Z).map(([z,J])=>` ${z}="${J}"`).join(""),w=O?` class="${O}"`:"",A=[$,`  <title>${_}</title>`,"  <style data-stx-cloak>[x-cloak]{display:none !important}</style>",L,M,N?`  ${N}`:"",...(B.styles||[]).map((z)=>`  ${z}`),...(B.headScripts||[]).map((z)=>`  ${z}`),B.headStack||""].filter(Boolean),D=[j,...(B.bodyScripts||[]).map((z)=>z),B.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
<html lang="${U}">
<head>
${A.join(`
`)}
</head>
<body${w}${W}>
${D.join(`
`)}
</body>
</html>`}function T(j){return/<!DOCTYPE\b/i.test(j)||/<html[\s>]/i.test(j)}function d(j,q={},B={}){if(T(j))return j;return S(j,q,B)}var r="<style data-stx-cloak>[x-cloak]{display:none !important}</style>";export{p as injectCloakStyle,T as hasDocumentShell,S as generateDocumentShell,d as ensureDocumentShell,r as CLOAK_STYLE};
