"use strict"; class UtilsChangelog { static _RELEASE_URL = "https://github.com/5etools-mirror-2/5etools-mirror-2.github.io/releases"; static renderChangelog (changelog, $wrp) { let lastMajorVersion = 0; let lastMinorVersion = 0; changelog.forEach((it, i) => { if (!it.txt) return; let [vMajor, vMinor, vPatch] = it.ver.split("."); vMajor = Number(vMajor); vMinor = Number(vMinor); const hLevel = vMajor !== lastMajorVersion ? "2" : vMinor !== lastMinorVersion ? "3" : "4"; const blocks = it.txt.trim().split(/\n\n+/g); let htmlStack = ""; const cleanListLine = l => l.trim().replace(/^-\s*/, ""); blocks.forEach(block => { htmlStack += `
`; const lines = block.split("\n"); let ulStack = []; let depth = -1; lines.forEach(l => { if (l.trim().startsWith("-")) { const nxtDepth = l.length - l.trimLeft().length; if (nxtDepth > depth) { depth = nxtDepth; htmlStack += `
  • ${cleanListLine(l).qq()}
  • `; } else { htmlStack += `
  • ${cleanListLine(l).qq()}
  • `; } } else { while (ulStack.length) { ulStack.pop(); htmlStack += ""; } depth = -1; htmlStack += `
    ${l.qq()}
    `; } }); while (ulStack.length) { ulStack.pop(); htmlStack += ""; } htmlStack += `
    `; }); htmlStack += ``; const isLast = i === changelog.length - 1; const titlePart = it.title ? `, "${it.title.escapeQuotes()}" Edition` : ""; $wrp.prepend(`
    v${isLast ? `` : ""}${it.ver}${isLast ? `` : ""}${titlePart} ${it.date}
    ${htmlStack}
    `); lastMajorVersion = vMajor; lastMinorVersion = vMinor; }); } } globalThis.UtilsChangelog = UtilsChangelog;