import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
const HERE = dirname(fileURLToPath(import.meta.url))
const portal = resolve(HERE, '../../../release/web/portal')
let s = readFileSync(portal + '/shell.html', 'utf8')
const ids = Array.from(s.matchAll(//g)).map((m) => m[1])
for (const id of ids) s = s.replace('', '' + readFileSync(portal + '/templates/' + id + '.html', 'utf8') + '')
const T = [
[/]*?)href="#cms"/g, ']*?)href="#documents"/g, ']*?)href="#recalc"/g, ']*?)href="(?:https?:\/\/[^"]*)?\/(?:detail\/v2|v2)[^"]*"/g, '