// @bun
var{defineProperty:L,getOwnPropertyNames:Y,getOwnPropertyDescriptor:Z}=Object,_=Object.prototype.hasOwnProperty;function $(q){return this[q]}var b=(q)=>{var w=(U??=new WeakMap).get(q),D;if(w)return w;if(w=L({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var F of Y(q))if(!_.call(w,F))L(w,F,{get:$.bind(q,F),enumerable:!(D=Z(q,F))||D.enumerable})}return U.set(q,w),w},U;var j=(q)=>q;function v(q,w){this[q]=j.bind(null,w)}var f=(q,w)=>{for(var D in w)L(q,D,{get:w[D],enumerable:!0,configurable:!0,set:v.bind(w,D)})};var y=(q,w)=>()=>(q&&(w=q(q=0)),w);var B=import.meta.require;function R(q,w,D={},F="/"){let C=w.seo??{},J=D.title??C.title??w.name,K=D.description??C.description??w.description??"",H=D.image??C.image,M=`${w.url.replace(/\/$/,"")}${F}`,V=C.siteName??w.name,W=C.type??"website",X=C.locale??"en_US",E=[];if(C.favicon){let G=C.favicon.toLowerCase().split(".").pop(),S=G==="svg"?"image/svg+xml":G==="ico"?"image/x-icon":G==="png"?"image/png":G==="jpg"||G==="jpeg"?"image/jpeg":"";E.push(`<link rel="icon"${S?` type="${S}"`:""} href="${z(C.favicon)}">`)}if(E.push(`<title>${N(J)}</title>`,`<link rel="canonical" href="${z(M)}">`,`<meta name="description" content="${z(K)}">`,`<meta property="og:title" content="${z(J)}">`,`<meta property="og:description" content="${z(K)}">`,`<meta property="og:type" content="${z(W)}">`,`<meta property="og:url" content="${z(M)}">`,`<meta property="og:site_name" content="${z(V)}">`,`<meta property="og:locale" content="${z(X)}">`,`<meta name="twitter:card" content="${H?"summary_large_image":"summary"}">`,`<meta name="twitter:title" content="${z(J)}">`,`<meta name="twitter:description" content="${z(K)}">`),H)E.push(`<meta property="og:image" content="${z(H)}">`),E.push(`<meta name="twitter:image" content="${z(H)}">`);if(C.twitter)E.push(`<meta name="twitter:site" content="@${z(C.twitter.replace(/^@/,""))}">`),E.push(`<meta name="twitter:creator" content="@${z(C.twitter.replace(/^@/,""))}">`);let O=`<!-- SEO -->
${E.join(`
`)}
<!-- /SEO -->`,Q=/<!--\s*stx SEO Tags\s*-->[\s\S]*?<meta\s+name="twitter:description"[^>]*>\s*/i;if(Q.test(q))q=q.replace(Q,"");if(q=q.replace(/<!--\s*SEO\s*-->[\s\S]*?<!--\s*\/SEO\s*-->\s*/g,""),q=q.replace(/<title>[\s\S]*?<\/title>\s*/i,""),q=q.replace(/<meta\s+name="title"\s+content="stx Project"[^>]*>\s*/g,"").replace(/<meta\s+name="description"\s+content="A website built with stx[^"]*"[^>]*>\s*/g,"").replace(/<meta\s+property="og:title"\s+content="stx Project"[^>]*>\s*/g,"").replace(/<meta\s+property="og:description"\s+content="A website built with stx[^"]*"[^>]*>\s*/g,"").replace(/<meta\s+property="og:type"\s+content="website"[^>]*>\s*/g,"").replace(/<meta\s+name="twitter:card"\s+content="summary_large_image"[^>]*>\s*/g,"").replace(/<meta\s+name="twitter:title"\s+content="stx Project"[^>]*>\s*/g,"").replace(/<meta\s+name="twitter:description"\s+content="A website built with stx[^"]*"[^>]*>\s*/g,""),/<head[^>]*>/i.test(q))return q.replace(/<head([^>]*)>/i,`<head$1>
${O}`);return`${O}
${q}`}function z(q){return q.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N(q){return q.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}export{R as injectSeo};
