import {SHARED_HEADER} from './portal-navigation.mjs';
const a='https://www.dunerealms.com/assets/';
export const REALM_PAGE_DESIGNS=Object.freeze(Object.fromEntries([
['clan-center-index','Clans & quests','Your organisation','Your household, its people, equipment and adventures.','nav-clan-v2.webp'],
['company-center-index','Company workspace','Your organisation','Your company, its members, trade and shared plans.','guild.webp'],
['login','Welcome back','My account','Sign in to your DuneRealms account and continue your journey.','nav-account-full-v2.webp'],
['passport','Citizen passport','People of the realm','Identity, honours and the story of a citizen of the realm.','nav-account-full-v2.webp'],
['clan','Clan register','Clans & households','The household, its people and its place in the realm.','nav-clan-v2.webp'],
['account-bans','Account ban register','Community records','Review account restrictions and the available appeal route.','portal-ban-gate-v1.png'],
['account','Your account','My account','Your identity, correspondence and services in one place.','nav-account-full-v2.webp'],
['admin','Staff workspace','Staff','Manage the realm through your authorised staff services.','nav-staff-v2.webp'],
['api','Developer portal','DuneForge','Documentation and service references for DuneRealms developers.','nav-manual-v2.webp'],
['armoury','The Rockhaven Armoury','Equipment','Discover equipment, kit designs and their place in the realm.','items/office_water.png'],
['arrakis','Arrakduin','Explore the worlds','The desert world: spice, survival and a story beneath the sands.','gui/guild-world-arrakis-v1.png'],
['bans','Network ban register','Community records','Public moderation records and the path to an appeal.','portal-ban-gate-v1.png'],
['corrino-group','Corporate register','Companies','Discover registered enterprises, their people and their work.','guild.webp'],
['diplomacy','Imperial diplomacy','The realm','Houses, diplomatic relations and the offices of the Imperium.','seals/office-landsraad.png'],
['discord','Around the campfire','Community','Meet the community, make plans and carry the conversation onward.','nav-discord-v2.webp'],
['donate','Support the caravan','Community','Ways to support the community and its next chapter.','nav-account-v2.webp'],
['dunemark-collection','The Dunemark Collection','Imperial Postbank','Explore the illustrated notes and the history behind their designs.','imperial-postbank-v2.png'],
['equipment','Equipment of the realm','Equipment','Read equipment details, qualities and upgrade marks.','items/office_water.png'],
['forums','Community boards','Community','Conversations, ideas and stories from across the realm.','nav-boards-v2.webp'],
['government','Houses & offices','The realm','Find the current offices, elections and political workspaces.','seals/office-landsraad.png'],
['install','Connect to the realm','Player guide','Prepare your client and find the current downloads.','nav-home-v2.webp'],
['item','Imperial item register','Exchange','Inspect an item’s artwork, lore, quality, mark and published details.','nav-exchange-v2.webp'],
['kits','The Imperial Tailor','Exchange','Explore published organisation equipment sets and their contents.','items/office_water.png'],
['link-account','Link your game account','My account','Connect your website identity to your Minecraft account.','nav-account-full-v2.webp'],
['manual','The Field Manual','Player guide','Your guide to the worlds, their services and your first steps.','nav-manual-v2.webp'],
['news-archive','The Imperial Dispatch','Community','News, milestones and updates from across DuneRealms.','nav-discord-v2.webp'],
['news','The Compact Dispatch','Community','Read the latest dispatch and follow the realm’s story.','nav-discord-v2.webp'],
['patch-note-1-0-0-7','Realm update','News & updates','Release details and changes to the DuneRealms experience.','nav-manual-v2.webp'],
['patch-notes','Release journal','News & updates','Browse published updates and the changes they brought.','nav-manual-v2.webp'],
['portal','Your journey','My account','Choose the next step in your DuneRealms story.','nav-account-full-v2.webp'],
['profile','Citizen profile','People of the realm','Your public identity, honours and story.','nav-account-full-v2.webp'],
['races','Choose your House','Explore the worlds','Discover the Houses and the worlds they call home.','nav-clan-v2.webp'],
['rates-and-charges','Rates & charges','Imperial Postbank','Published banking tariffs and service conditions.','imperial-postbank-v2.png'],
['shop-oscommerce','Imperial Heralds','Community shop','Ceremonial pieces and ways to support the community.','nav-exchange-full-v2.webp'],
['shop','Imperial Heralds','Community shop','Ceremonial pieces and ways to support the community.','nav-exchange-full-v2.webp'],
['smugglers','Beyond the official routes','Careers & stories','Discover the smuggler’s path through the realm.','nav-exchange-v2.webp'],
['staff','People of the realm','Community','Meet the people who keep the caravan moving.','nav-staff-v2.webp'],
['tickets','The Petition Hall','Support','Open a request, follow its progress and find help.','nav-support-v2.webp'],
['wiki','Our world & its story','The Dunopedia','Read the world guide, project background and unofficial-project information.','nav-manual-v2.webp']
].map(([id,title,section,description,icon])=>[id+'.html',Object.freeze({title,section,description,icon})])));
const esc=s=>s.replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
const designHead='';
export function applyRealmPageDesign(html,file){
if(!/]*data-realm-design/.test(html))html=html.replace('',designHead+'');
if(file==='manual.html')html=html.replaceAll('https://www.dunerealms.com/realm-design','/realm-design');
const page=REALM_PAGE_DESIGNS[file];if(!page)return html;
if(html.includes('data-realm-layout="2"'))return html;
html=html.replace(/]*>[\s\S]*?<\/section>/g,'').replace(/\sdata-realm-page="[^"]*"/g,'');
html=html.replace(/]*)>/,(_,attrs)=>'');
html=html.replace(/]*)>/,(_,attrs)=>''class="'+classes+' dr-design dr-interior"'):attrs+' class="dr-design dr-interior"')+' data-realm-layout="2" data-realm-page="'+file.replace('.html','')+'">');
const header=html.search(/=0&&(main<0||header]*>[\s\S]*?<\/header>/,SHARED_HEADER):html.replace(/]*>/,m=>m+SHARED_HEADER);
const banner='