import"./dist-BXwifpp-.js";import{r as e}from"./route-pattern-cHIQE8sj.js";import"node:fs";function t(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`)}function n(e){let n=e.some(e=>Object.keys(e.alternates??{}).length>0),r=e.some(e=>!!e.images?.length),i=e.some(e=>!!e.videos?.length),o=``;o+=`<?xml version="1.0" encoding="UTF-8"?>
`,o+=`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"`,r&&(o+=` xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"`),i&&(o+=` xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"`),n?o+=` xmlns:xhtml="http://www.w3.org/1999/xhtml">
`:o+=`>
`;for(let n of e){o+=`<url>
`,o+=`<loc>${t(n.url)}</loc>\n`;let e=n.alternates?.languages;if(e&&Object.keys(e).length)for(let n in e)o+=`<xhtml:link rel="alternate" hreflang="${t(n)}" href="${t(e[n])}" />\n`;if(n.images?.length)for(let e of n.images)o+=`<image:image>\n<image:loc>${t(e)}</image:loc>\n</image:image>\n`;if(n.videos?.length)for(let e of n.videos){let n=[`<video:video>`,`<video:title>${t(String(e.title))}</video:title>`,`<video:thumbnail_loc>${t(String(e.thumbnail_loc))}</video:thumbnail_loc>`,`<video:description>${t(String(e.description))}</video:description>`,e.content_loc&&`<video:content_loc>${t(String(e.content_loc))}</video:content_loc>`,e.player_loc&&`<video:player_loc>${t(String(e.player_loc))}</video:player_loc>`,e.duration&&`<video:duration>${e.duration}</video:duration>`,e.view_count&&`<video:view_count>${e.view_count}</video:view_count>`,e.tag&&`<video:tag>${t(String(e.tag))}</video:tag>`,e.rating&&`<video:rating>${e.rating}</video:rating>`,e.expiration_date&&`<video:expiration_date>${t(String(e.expiration_date))}</video:expiration_date>`,e.publication_date&&`<video:publication_date>${t(String(e.publication_date))}</video:publication_date>`,e.family_friendly&&`<video:family_friendly>${e.family_friendly}</video:family_friendly>`,e.requires_subscription&&`<video:requires_subscription>${e.requires_subscription}</video:requires_subscription>`,e.live&&`<video:live>${e.live}</video:live>`,e.restriction&&`<video:restriction relationship="${t(String(e.restriction.relationship))}">${t(String(e.restriction.content))}</video:restriction>`,e.platform&&`<video:platform relationship="${t(String(e.platform.relationship))}">${t(String(e.platform.content))}</video:platform>`,e.uploader&&`<video:uploader${e.uploader.info?` info="${t(String(e.uploader.info))}"`:``}>${t(String(e.uploader.content))}</video:uploader>`,`</video:video>
`].filter(Boolean);o+=n.join(`
`)}n.lastModified&&(o+=`<lastmod>${a(n.lastModified)}</lastmod>\n`),n.changeFrequency&&(o+=`<changefreq>${n.changeFrequency}</changefreq>\n`),typeof n.priority==`number`&&(o+=`<priority>${n.priority}</priority>\n`),o+=`</url>
`}return o+=`</urlset>
`,o}function r(e){let t=[],n=Array.isArray(e.rules)?e.rules:[e.rules];for(let e of n){let n=Array.isArray(e.userAgent)?e.userAgent:[e.userAgent??`*`];for(let e of n)t.push(`User-Agent: ${e}`);if(e.allow){let n=Array.isArray(e.allow)?e.allow:[e.allow];for(let e of n)t.push(`Allow: ${e}`)}if(e.disallow){let n=Array.isArray(e.disallow)?e.disallow:[e.disallow];for(let e of n)t.push(`Disallow: ${e}`)}if(e.crawlDelay!==void 0&&t.push(`Crawl-delay: ${e.crawlDelay}`),e.other)for(let n of Object.keys(e.other)){let r=e.other[n];if(r==null)continue;let i=Array.isArray(r)?r:[r];for(let e of i)t.push(`${n}: ${e}`)}t.push(``)}if(e.host&&t.push(`Host: ${e.host}`),e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let e of n)t.push(`Sitemap: ${e}`)}return t.join(`
`)+`
`}function i(e){return JSON.stringify(e,null,2)}function a(e){return e instanceof Date?e.toISOString():e}function o(e){return e.type===`favicon`?`favicon`:e.type===`icon`?`icon`:e.type===`apple-icon`?`apple`:e.type===`opengraph-image`?`openGraph`:e.type===`twitter-image`?`twitter`:e.type===`manifest`?`manifest`:null}function s(e){let t=o(e);return t===`icon`||t===`apple`||t===`openGraph`||t===`twitter`?t:null}var c=/^[a-zA-Z0-9-_.]+$/;function l(e){return c.test(e)}function u(t,n){return e(t,n)}export{u as a,i,o as n,r as o,l as r,n as s,s as t};